23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
|
* 15.06.2002 added bframes options |
27 |
|
* 21.04.2002 fixed custom matrix support, tried to get dll size down |
28 |
|
* 17.04.2002 re-enabled lumi masking in 1st pass |
29 |
* 15.04.2002 updated cbr support |
* 15.04.2002 updated cbr support |
30 |
* 07.04.2002 min keyframe interval checkbox |
* 07.04.2002 min keyframe interval checkbox |
31 |
* 2-pass max bitrate and overflow customization |
* 2-pass max bitrate and overflow customization |
50 |
* now get Core Version use xvid_init() |
* now get Core Version use xvid_init() |
51 |
* 05.03.2002 Min Chen <chenm001@163.com> |
* 05.03.2002 Min Chen <chenm001@163.com> |
52 |
* Add Core version display to about box |
* Add Core version display to about box |
53 |
* 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
* 01.12.2001 inital version; (c)2001 peter ross <pross@xvid.org> |
54 |
* |
* |
55 |
*************************************************************************/ |
*************************************************************************/ |
56 |
|
|
59 |
#include <commctrl.h> |
#include <commctrl.h> |
60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
#ifdef _SMP |
63 |
|
#include <pthread.h> |
64 |
|
#endif |
65 |
|
|
66 |
|
#include <xvid.h> // XviD API |
67 |
|
|
68 |
#include "codec.h" |
#include "codec.h" |
69 |
#include "config.h" |
#include "config.h" |
|
#include "xvid.h" // cpu masks |
|
70 |
#include "resource.h" |
#include "resource.h" |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
/* registry info structs */ |
/* registry info structs */ |
75 |
|
|
76 |
CONFIG reg; |
CONFIG reg; |
84 |
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
85 |
{"rc_buffer", ®.rc_buffer, 100}, |
{"rc_buffer", ®.rc_buffer, 100}, |
86 |
|
|
87 |
{"motion_search", ®.motion_search, 5}, |
{"motion_search", ®.motion_search, 6}, |
88 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
89 |
{"fourcc_used", ®.fourcc_used, 0}, |
{"fourcc_used", ®.fourcc_used, 0}, |
90 |
|
{"vhq_mode", ®.vhq_mode, 0}, |
91 |
{"max_key_interval", ®.max_key_interval, 300}, |
{"max_key_interval", ®.max_key_interval, 300}, |
92 |
{"min_key_interval", ®.min_key_interval, 1}, |
{"min_key_interval", ®.min_key_interval, 1}, |
93 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
94 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
95 |
|
{"qpel", ®.qpel, 0}, |
96 |
|
{"gmc", ®.gmc, 0}, |
97 |
|
{"chromame", ®.chromame, 0}, |
98 |
|
//added by koepi for gruel's greyscale_mode |
99 |
|
{"greyscale", ®.greyscale, 0}, |
100 |
|
// end of koepi's additions |
101 |
|
{"max_bframes", ®.max_bframes, -1}, |
102 |
|
{"bquant_ratio", ®.bquant_ratio, 150}, |
103 |
|
{"bquant_offset", ®.bquant_offset, 100}, |
104 |
|
{"packed", ®.packed, 0}, |
105 |
|
{"dx50bvop", ®.dx50bvop, 1}, |
106 |
|
{"debug", ®.debug, 0}, |
107 |
|
{"reduced_resolution", ®.reduced_resolution, 0}, |
108 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
109 |
|
|
110 |
{"min_iquant", ®.min_iquant, 1}, |
{"min_iquant", ®.min_iquant, 2}, |
111 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
112 |
{"min_pquant", ®.min_pquant, 1}, |
{"min_pquant", ®.min_pquant, 2}, |
113 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
114 |
|
|
115 |
{"desired_size", ®.desired_size, 570000}, |
{"desired_size", ®.desired_size, 570000}, |
116 |
{"keyframe_boost", ®.keyframe_boost, 20}, |
{"keyframe_boost", ®.keyframe_boost, 0}, |
117 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
118 |
{"dummy2pass", ®.dummy2pass, 0}, |
{"dummy2pass", ®.dummy2pass, 0}, |
119 |
{"curve_compression_high", ®.curve_compression_high, 25}, |
// added by koepi for new two-pass curve treatment |
120 |
{"curve_compression_low", ®.curve_compression_low, 10}, |
{"kftreshold", ®.kftreshold, 10}, |
121 |
|
{"kfreduction", ®.kfreduction, 20}, |
122 |
|
// end of koepi's additions |
123 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
124 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
125 |
{"use_alt_curve", ®.use_alt_curve, 0}, |
{"use_alt_curve", ®.use_alt_curve, 0}, |
126 |
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
127 |
{"alt_curve_auto_str", ®.alt_curve_auto_str, 50}, |
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
128 |
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
129 |
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
130 |
{"alt_curve_type", ®.alt_curve_type, 1}, |
{"alt_curve_type", ®.alt_curve_type, 1}, |
131 |
{"alt_curve_high_dist", ®.alt_curve_high_dist, 300}, |
{"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
132 |
{"alt_curve_low_dist", ®.alt_curve_low_dist, 300}, |
{"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, |
133 |
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
134 |
{"bitrate_payback_delay", ®.bitrate_payback_delay, 240}, |
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
135 |
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
136 |
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
137 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
145 |
{"credits_end_begin", ®.credits_end_begin, 0}, |
{"credits_end_begin", ®.credits_end_begin, 0}, |
146 |
{"credits_end_end", ®.credits_end_end, 0}, |
{"credits_end_end", ®.credits_end_end, 0}, |
147 |
|
|
148 |
|
// added by koepi for greyscale credits |
149 |
|
{"credits_greyscale", ®.credits_greyscale, 0}, |
150 |
|
// end of koepi's addition |
151 |
{"credits_mode", ®.credits_mode, 0}, |
{"credits_mode", ®.credits_mode, 0}, |
152 |
{"credits_rate", ®.credits_rate, 20}, |
{"credits_rate", ®.credits_rate, 20}, |
153 |
{"credits_quant_i", ®.credits_quant_i, 20}, |
{"credits_quant_i", ®.credits_quant_i, 20}, |
154 |
{"credits_quant_p", ®.credits_quant_p, 20}, |
{"credits_quant_p", ®.credits_quant_p, 20}, |
155 |
{"credits_start_size", ®.credits_start_size, 10000}, |
{"credits_start_size", ®.credits_start_size, 10000}, |
156 |
{"credits_end_size", ®.credits_end_size, 10000} |
{"credits_end_size", ®.credits_end_size, 10000}, |
157 |
|
|
158 |
|
/* decoder */ |
159 |
|
{"deblock_y", ®.deblock_y, 0}, |
160 |
|
{"deblock_uv", ®.deblock_uv, 0} |
161 |
}; |
}; |
162 |
|
|
163 |
REG_STR const reg_strs[] = { |
REG_STR const reg_strs[] = { |
178 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
179 |
int i; |
int i; |
180 |
|
|
181 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
182 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
183 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
184 |
|
|
185 |
|
#ifdef _SMP |
186 |
|
reg.num_threads = pthread_num_processors_np(); |
187 |
|
#endif |
188 |
|
|
189 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
190 |
|
|
311 |
|
|
312 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
313 |
|
|
314 |
int config_get_int(HWND hDlg, UINT item, int config) |
int config_get_int(HWND hDlg, INT item, int config) |
315 |
|
{ |
316 |
|
BOOL success = FALSE; |
317 |
|
|
318 |
|
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
319 |
|
|
320 |
|
return (success) ? tmp : config; |
321 |
|
} |
322 |
|
|
323 |
|
|
324 |
|
int config_get_uint(HWND hDlg, UINT item, int config) |
325 |
{ |
{ |
326 |
BOOL success = FALSE; |
BOOL success = FALSE; |
327 |
|
|
339 |
{ |
{ |
340 |
default : |
default : |
341 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
342 |
config->rc_bitrate = config_get_int(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
343 |
break; |
break; |
344 |
|
|
345 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
346 |
config->quality = config_get_int(hDlg, IDC_VALUE, config->quality); |
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
347 |
break; |
break; |
348 |
|
|
349 |
case DLG_MODE_VBR_QUANT : |
case DLG_MODE_VBR_QUANT : |
350 |
config->quant = config_get_int(hDlg, IDC_VALUE, config->quant); |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
351 |
break; |
break; |
352 |
|
|
353 |
case DLG_MODE_2PASS_2_INT : |
case DLG_MODE_2PASS_2_INT : |
354 |
config->desired_size = config_get_int(hDlg, IDC_VALUE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
355 |
break; |
break; |
356 |
} |
} |
357 |
|
|
505 |
void adv_mode(HWND hDlg, int mode) |
void adv_mode(HWND hDlg, int mode) |
506 |
{ |
{ |
507 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
508 |
const int cbr_disable[] = { |
const short twopass_disable[] = { |
509 |
IDC_KFBOOST, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
510 |
|
// added by koepi for new curve treatment |
511 |
|
IDC_KFTRESHOLD, IDC_KFREDUCTION, |
512 |
|
//end of koepi's additions |
513 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
514 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS2, IDC_STATS2_BROWSE, |
515 |
|
}; |
516 |
|
|
517 |
|
const short cbr_disable[] = { |
518 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
519 |
IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
520 |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
521 |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
522 |
IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
523 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, IDC_CREDITS_GREYSCALE, IDC_HINTFILE |
524 |
}; |
}; |
525 |
|
|
526 |
const int qual_disable[] = { |
const short qual_disable[] = { |
527 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
528 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
529 |
IDC_KFBOOST, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
530 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_HINTFILE |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
|
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
|
531 |
}; |
}; |
532 |
|
|
533 |
const int quant_disable[] = { |
const short quant_disable[] = { |
534 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
535 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
536 |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
537 |
IDC_KFBOOST, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
538 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_HINTFILE |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
|
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
|
539 |
}; |
}; |
540 |
|
|
541 |
const int twopass1_disable[] = { |
const short twopass1_disable[] = { |
542 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
543 |
IDC_LUMMASK, IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
|
IDC_KFBOOST, IDC_DUMMY2PASS, |
|
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
|
|
IDC_STATS2, IDC_STATS2_BROWSE, |
|
544 |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
545 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
546 |
}; |
}; |
547 |
|
|
548 |
const int twopass2_ext_disable[] = { |
const short twopass2_ext_disable[] = { |
549 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
550 |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
IDC_CREDITS_RATE_RADIO, |
551 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
552 |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
553 |
}; |
}; |
554 |
|
|
555 |
const int twopass2_int_disable[] = { |
const short twopass2_int_disable[] = { |
556 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
557 |
IDC_STATS2, IDC_STATS2_BROWSE |
IDC_STATS2, IDC_STATS2_BROWSE |
558 |
}; |
}; |
559 |
|
|
560 |
// store pointers in order so we can lookup using config->mode |
// store pointers in order so we can lookup using config->mode |
561 |
const int* modes[] = { |
const short* modes[] = { |
562 |
cbr_disable, qual_disable, quant_disable, |
cbr_disable, qual_disable, quant_disable, |
563 |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
564 |
}; |
}; |
565 |
|
|
566 |
// ditto modes[] |
// ditto modes[] |
567 |
const int lengths[] = { |
const int lengths[] = { |
568 |
sizeof(cbr_disable)/sizeof(int), sizeof(qual_disable)/sizeof(int), |
sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
569 |
sizeof(quant_disable)/sizeof(int), sizeof(twopass1_disable)/sizeof(int), |
sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), |
570 |
sizeof(twopass2_ext_disable)/sizeof(int), sizeof(twopass2_int_disable)/sizeof(int) |
sizeof(twopass2_ext_disable)/sizeof(short), sizeof(twopass2_int_disable)/sizeof(short), 0 |
571 |
}; |
}; |
572 |
|
|
573 |
int i; |
int i; |
574 |
|
int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
575 |
|
int credits_start, credits_end, credits_rate, credits_quant, credits_size; |
576 |
|
int cpu_force; |
577 |
|
|
578 |
// first perform checkbox-based enable/disable |
// first perform checkbox-based enable/disable |
579 |
CONTROLDLG(IDC_HINTFILE, ISDLGSET(IDC_HINTEDME)); |
hinted_me = ISDLGSET(IDC_HINTEDME); |
580 |
CONTROLDLG(IDC_HINT_BROWSE, ISDLGSET(IDC_HINTEDME)); |
CONTROLDLG(IDC_HINTFILE, hinted_me); |
581 |
|
CONTROLDLG(IDC_HINT_BROWSE, hinted_me); |
582 |
CONTROLDLG(IDC_USEAUTO, ISDLGSET(IDC_USEALT)); |
|
583 |
CONTROLDLG(IDC_AUTOSTR, ISDLGSET(IDC_USEALT) && ISDLGSET(IDC_USEAUTO)); |
use_alt = ISDLGSET(IDC_USEALT) && (mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT); |
584 |
CONTROLDLG(IDC_USEAUTOBONUS, ISDLGSET(IDC_USEALT)); |
use_alt_auto = ISDLGSET(IDC_USEAUTO); |
585 |
CONTROLDLG(IDC_BONUSBIAS, (ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTOBONUS)))); |
use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); |
586 |
CONTROLDLG(IDC_CURVETYPE, ISDLGSET(IDC_USEALT)); |
CONTROLDLG(IDC_USEAUTO, use_alt); |
587 |
CONTROLDLG(IDC_ALTCURVEHIGH, ISDLGSET(IDC_USEALT)); |
CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); |
588 |
CONTROLDLG(IDC_ALTCURVELOW, ISDLGSET(IDC_USEALT)); |
CONTROLDLG(IDC_USEAUTOBONUS, use_alt); |
589 |
CONTROLDLG(IDC_MINQUAL, ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTO))); |
CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
590 |
|
CONTROLDLG(IDC_CURVETYPE, use_alt); |
591 |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); |
592 |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_ALTCURVELOW, use_alt); |
593 |
|
CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); |
594 |
CONTROLDLG(IDC_CREDITS_END_BEGIN, ISDLGSET(IDC_CREDITS_END)); |
|
595 |
CONTROLDLG(IDC_CREDITS_END_END, ISDLGSET(IDC_CREDITS_END)); |
credits_start = ISDLGSET(IDC_CREDITS_START); |
596 |
|
CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); |
597 |
CONTROLDLG(IDC_CREDITS_RATE, ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
CONTROLDLG(IDC_CREDITS_START_END, credits_start); |
598 |
CONTROLDLG(IDC_CREDITS_QUANTI, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
|
599 |
CONTROLDLG(IDC_CREDITS_QUANTP, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
credits_end = ISDLGSET(IDC_CREDITS_END); |
600 |
CONTROLDLG(IDC_CREDITS_START_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); |
601 |
CONTROLDLG(IDC_CREDITS_END_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
CONTROLDLG(IDC_CREDITS_END_END, credits_end); |
602 |
|
|
603 |
CONTROLDLG(IDC_CPU_MMX, ISDLGSET(IDC_CPU_FORCE)); |
credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); |
604 |
CONTROLDLG(IDC_CPU_MMXEXT, ISDLGSET(IDC_CPU_FORCE)); |
credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); |
605 |
CONTROLDLG(IDC_CPU_SSE, ISDLGSET(IDC_CPU_FORCE)); |
credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); |
606 |
CONTROLDLG(IDC_CPU_SSE2, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_CREDITS_RATE, credits_rate); |
607 |
CONTROLDLG(IDC_CPU_3DNOW, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); |
608 |
CONTROLDLG(IDC_CPU_3DNOWEXT, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); |
609 |
|
CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); |
610 |
|
CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); |
611 |
|
|
612 |
|
cpu_force = ISDLGSET(IDC_CPU_FORCE); |
613 |
|
CONTROLDLG(IDC_CPU_MMX, cpu_force); |
614 |
|
CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); |
615 |
|
CONTROLDLG(IDC_CPU_SSE, cpu_force); |
616 |
|
CONTROLDLG(IDC_CPU_SSE2, cpu_force); |
617 |
|
CONTROLDLG(IDC_CPU_3DNOW, cpu_force); |
618 |
|
CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); |
619 |
|
|
620 |
// now perform codec mode enable/disable |
// now perform codec mode enable/disable |
621 |
for (i=0 ; i<lengths[mode] ; ++i) |
for (i=0 ; i<lengths[mode] ; ++i) |
622 |
{ |
{ |
623 |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
624 |
} |
} |
625 |
|
|
626 |
|
if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) |
627 |
|
{ |
628 |
|
for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) |
629 |
|
{ |
630 |
|
EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); |
631 |
|
} |
632 |
|
} |
633 |
} |
} |
634 |
|
|
635 |
|
|
643 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
644 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
645 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
646 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
647 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
648 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
649 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
650 |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
651 |
|
|
652 |
|
CheckDlgButton(hDlg, IDC_QPEL, config->qpel ? BST_CHECKED : BST_UNCHECKED); |
653 |
|
CheckDlgButton(hDlg, IDC_GMC, config->gmc ? BST_CHECKED : BST_UNCHECKED); |
654 |
|
CheckDlgButton(hDlg, IDC_CHROMAME, config->chromame ? BST_CHECKED : BST_UNCHECKED); |
655 |
|
// added by koepi for gruel's greyscale_mode |
656 |
|
CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
657 |
|
// end of koepi's addition |
658 |
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
659 |
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
660 |
|
SetDlgItemInt(hDlg, IDC_BQUANTOFFSET, config->bquant_offset, FALSE); |
661 |
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
662 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
663 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
664 |
|
|
665 |
|
CheckDlgButton(hDlg, IDC_REDUCED, config->reduced_resolution ? BST_CHECKED : BST_UNCHECKED); |
666 |
break; |
break; |
667 |
|
|
668 |
case DLG_QUANT : |
case DLG_QUANT : |
676 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
677 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
678 |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
679 |
|
// added by koepi for new 2pass curve treatment |
680 |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
681 |
|
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
682 |
|
// end of koepi's additions |
683 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
684 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
685 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
719 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
720 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
721 |
|
|
722 |
|
// added by koepi for credits greyscale |
723 |
|
CheckDlgButton(hDlg, IDC_CREDITS_GREYSCALE, config->credits_greyscale ? BST_CHECKED : BST_UNCHECKED); |
724 |
|
// end of koepi's addition |
725 |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
726 |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
727 |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
753 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
754 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
755 |
|
|
756 |
|
#ifdef _SMP |
757 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
758 |
|
#endif |
759 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
760 |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
761 |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
762 |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
779 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
780 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
781 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
782 |
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
783 |
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
784 |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
785 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
786 |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
787 |
|
|
788 |
|
config->qpel = ISDLGSET(IDC_QPEL); |
789 |
|
config->gmc = ISDLGSET(IDC_GMC); |
790 |
|
config->chromame = ISDLGSET(IDC_CHROMAME); |
791 |
|
// added by koepi for gruel's greyscale_mode |
792 |
|
config->greyscale = ISDLGSET(IDC_GREYSCALE); |
793 |
|
// end of koepi's addition |
794 |
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
795 |
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
796 |
|
config->bquant_offset = config_get_uint(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
797 |
|
config->packed = ISDLGSET(IDC_PACKED); |
798 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
799 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
800 |
|
config->reduced_resolution = ISDLGSET(IDC_REDUCED); |
801 |
break; |
break; |
802 |
|
|
803 |
case DLG_QUANT : |
case DLG_QUANT : |
804 |
config->min_iquant = config_get_int(hDlg, IDC_MINIQUANT, config->min_iquant); |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
805 |
config->max_iquant = config_get_int(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
806 |
config->min_pquant = config_get_int(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
807 |
config->max_pquant = config_get_int(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
808 |
|
|
809 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
CONSTRAINVAL(config->min_iquant, 1, 31); |
810 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
814 |
|
|
815 |
case DLG_2PASS : |
case DLG_2PASS : |
816 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
817 |
|
// added by koepi for the new 2pass curve treatment |
818 |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
819 |
|
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
820 |
|
//end of koepi's additions |
821 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
822 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
823 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
824 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
825 |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
826 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
827 |
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
828 |
|
|
849 |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
850 |
|
|
851 |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
852 |
config->alt_curve_auto_str = config_get_int(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
853 |
|
|
854 |
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
855 |
config->alt_curve_bonus_bias = config_get_int(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
856 |
|
|
857 |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
858 |
config->alt_curve_high_dist = config_get_int(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
859 |
config->alt_curve_low_dist = config_get_int(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
860 |
config->alt_curve_min_rel_qual = config_get_int(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
861 |
|
|
862 |
config->twopass_max_bitrate /= CONFIG_KBPS; |
config->twopass_max_bitrate /= CONFIG_KBPS; |
863 |
config->twopass_max_bitrate = config_get_int(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
864 |
config->twopass_max_bitrate *= CONFIG_KBPS; |
config->twopass_max_bitrate *= CONFIG_KBPS; |
865 |
config->twopass_max_overflow_improvement = config_get_int(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
866 |
config->twopass_max_overflow_degradation = config_get_int(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
867 |
|
|
868 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
869 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
872 |
case DLG_CREDITS : |
case DLG_CREDITS : |
873 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
874 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
875 |
config->credits_start_end = config_get_int(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
config->credits_start_end = config_get_uint(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
876 |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
877 |
config->credits_end_begin = config_get_int(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
config->credits_end_begin = config_get_uint(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
878 |
config->credits_end_end = config_get_int(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
config->credits_end_end = config_get_uint(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
879 |
|
|
880 |
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
// added by koepi for gruel's greyscale_mode |
881 |
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
config->credits_greyscale = ISDLGSET(IDC_CREDITS_GREYSCALE); |
882 |
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
// end of koepi's addition |
883 |
config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
884 |
config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
885 |
|
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
886 |
|
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
887 |
|
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
888 |
|
|
889 |
config->credits_mode = 0; |
config->credits_mode = 0; |
890 |
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
917 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
918 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
919 |
|
|
920 |
config->rc_reaction_delay_factor = config_get_int(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
#ifdef _SMP |
921 |
config->rc_averaging_period = config_get_int(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
922 |
config->rc_buffer = config_get_int(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
#endif |
923 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
924 |
|
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
925 |
|
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
926 |
|
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
927 |
break; |
break; |
928 |
} |
} |
929 |
} |
} |
949 |
{ |
{ |
950 |
int temp; |
int temp; |
951 |
|
|
952 |
temp = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
953 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
954 |
temp = config->qmatrix_intra[i]; |
config->qmatrix_intra[i] = temp; |
955 |
|
|
956 |
temp = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
957 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
958 |
temp = config->qmatrix_inter[i]; |
config->qmatrix_inter[i] = temp; |
959 |
} |
} |
960 |
} |
} |
961 |
|
|
983 |
} |
} |
984 |
|
|
985 |
|
|
986 |
|
|
987 |
|
/* --- decoder options dialog --- */ |
988 |
|
|
989 |
|
#define DEC_DLG_COUNT 1 |
990 |
|
#define DEC_DLG_POSTPROC 0 |
991 |
|
|
992 |
|
/* decoder dialog: upload config data */ |
993 |
|
|
994 |
|
void dec_upload(HWND hDlg, int page, CONFIG * config) |
995 |
|
{ |
996 |
|
switch (page) |
997 |
|
{ |
998 |
|
case DEC_DLG_POSTPROC : |
999 |
|
CheckDlgButton(hDlg, IDC_DEBLOCK_Y, config->deblock_y ? BST_CHECKED : BST_UNCHECKED); |
1000 |
|
CheckDlgButton(hDlg, IDC_DEBLOCK_UV, config->deblock_uv ? BST_CHECKED : BST_UNCHECKED); |
1001 |
|
break; |
1002 |
|
} |
1003 |
|
} |
1004 |
|
|
1005 |
|
|
1006 |
|
/* dec dialog: download config data */ |
1007 |
|
|
1008 |
|
void dec_download(HWND hDlg, int page, CONFIG * config) |
1009 |
|
{ |
1010 |
|
switch (page) |
1011 |
|
{ |
1012 |
|
case DEC_DLG_POSTPROC : |
1013 |
|
config->deblock_y = ISDLGSET(IDC_DEBLOCK_Y); |
1014 |
|
config->deblock_uv = ISDLGSET(IDC_DEBLOCK_UV); |
1015 |
|
break; |
1016 |
|
} |
1017 |
|
} |
1018 |
|
|
1019 |
|
/* decoder dialog proc */ |
1020 |
|
|
1021 |
|
BOOL CALLBACK dec_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1022 |
|
{ |
1023 |
|
PROPSHEETINFO *psi; |
1024 |
|
|
1025 |
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
1026 |
|
|
1027 |
|
switch (uMsg) |
1028 |
|
{ |
1029 |
|
case WM_INITDIALOG : |
1030 |
|
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
1031 |
|
|
1032 |
|
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
1033 |
|
|
1034 |
|
if (hTooltip) |
1035 |
|
{ |
1036 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1037 |
|
} |
1038 |
|
|
1039 |
|
dec_upload(hDlg, psi->page, psi->config); |
1040 |
|
break; |
1041 |
|
|
1042 |
|
case WM_NOTIFY : |
1043 |
|
switch (((NMHDR *)lParam)->code) |
1044 |
|
{ |
1045 |
|
case PSN_KILLACTIVE : |
1046 |
|
/* validate */ |
1047 |
|
dec_download(hDlg, psi->page, psi->config); |
1048 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1049 |
|
break; |
1050 |
|
|
1051 |
|
case PSN_APPLY : |
1052 |
|
/* apply */ |
1053 |
|
dec_download(hDlg, psi->page, psi->config); |
1054 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1055 |
|
psi->config->save = TRUE; |
1056 |
|
break; |
1057 |
|
} |
1058 |
|
break; |
1059 |
|
|
1060 |
|
default : |
1061 |
|
return 0; |
1062 |
|
} |
1063 |
|
|
1064 |
|
return 1; |
1065 |
|
} |
1066 |
|
|
1067 |
|
|
1068 |
|
void dec_dialog(HWND hParent, CONFIG * config) |
1069 |
|
{ |
1070 |
|
PROPSHEETINFO psi[DEC_DLG_COUNT]; |
1071 |
|
PROPSHEETPAGE psp[DEC_DLG_COUNT]; |
1072 |
|
PROPSHEETHEADER psh; |
1073 |
|
CONFIG temp; |
1074 |
|
int i; |
1075 |
|
|
1076 |
|
config->save = FALSE; |
1077 |
|
memcpy(&temp, config, sizeof(CONFIG)); |
1078 |
|
|
1079 |
|
for (i=0 ; i<DEC_DLG_COUNT ; ++i) |
1080 |
|
{ |
1081 |
|
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
1082 |
|
psp[i].dwFlags = 0; |
1083 |
|
psp[i].hInstance = hInst; |
1084 |
|
psp[i].pfnDlgProc = dec_proc; |
1085 |
|
psp[i].lParam = (LPARAM)&psi[i]; |
1086 |
|
psp[i].pfnCallback = NULL; |
1087 |
|
|
1088 |
|
psi[i].page = i; |
1089 |
|
psi[i].config = &temp; |
1090 |
|
} |
1091 |
|
|
1092 |
|
psp[DEC_DLG_POSTPROC].pszTemplate = MAKEINTRESOURCE(IDD_POSTPROC); |
1093 |
|
|
1094 |
|
psh.dwSize = sizeof(PROPSHEETHEADER); |
1095 |
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
1096 |
|
psh.hwndParent = hParent; |
1097 |
|
psh.hInstance = hInst; |
1098 |
|
psh.pszCaption = (LPSTR) "XviD Configuration"; |
1099 |
|
psh.nPages = DEC_DLG_COUNT; |
1100 |
|
psh.nStartPage = DEC_DLG_POSTPROC; |
1101 |
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
1102 |
|
psh.pfnCallback = NULL; |
1103 |
|
|
1104 |
|
PropertySheet(&psh); |
1105 |
|
|
1106 |
|
if (temp.save) |
1107 |
|
{ |
1108 |
|
memcpy(config, &temp, sizeof(CONFIG)); |
1109 |
|
} |
1110 |
|
} |
1111 |
|
|
1112 |
|
|
1113 |
|
|
1114 |
/* main dialog proc */ |
/* main dialog proc */ |
1115 |
|
|
1116 |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1178 |
config_reg_set(config); |
config_reg_set(config); |
1179 |
} |
} |
1180 |
} |
} |
1181 |
|
else if (LOWORD(wParam) == IDC_DECODER && HIWORD(wParam) == BN_CLICKED) |
1182 |
|
{ |
1183 |
|
dec_dialog(hDlg, config); |
1184 |
|
|
1185 |
|
if (config->save) |
1186 |
|
{ |
1187 |
|
config_reg_set(config); |
1188 |
|
} |
1189 |
|
} |
1190 |
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
1191 |
{ |
{ |
1192 |
config_reg_default(config); |
config_reg_default(config); |
1198 |
} |
} |
1199 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
1200 |
{ |
{ |
1201 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
1202 |
int max = 1; |
int max = 1; |
1203 |
|
|
1204 |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1270 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
1271 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
1272 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
1273 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"New Modulated HQ"); |
1274 |
|
|
1275 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1276 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1277 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1278 |
|
|
1279 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"0 - Off"); |
1280 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"1 - Mode Decision"); |
1281 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search"); |
1282 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search"); |
1283 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
1284 |
|
/* XXX: reduced resolution is not ready for prime-time */ |
1285 |
|
ShowWindow(GetDlgItem(hDlg, IDC_REDUCED), SW_HIDE); |
1286 |
} |
} |
1287 |
else if (psi->page == DLG_2PASSALT) |
else if (psi->page == DLG_2PASSALT) |
1288 |
{ |
{ |
1290 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1291 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1292 |
} |
} |
1293 |
|
else if (psi->page == DLG_CPU) |
1294 |
|
{ |
1295 |
|
#ifndef _SMP |
1296 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1297 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1298 |
|
#endif |
1299 |
|
} |
1300 |
|
|
1301 |
if (hTooltip) |
if (hTooltip) |
1302 |
{ |
{ |
1528 |
LOGFONT lfData; |
LOGFONT lfData; |
1529 |
|
|
1530 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1531 |
|
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1532 |
|
|
1533 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1534 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1535 |
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
1536 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |