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 |
30 |
|
* 07.04.2002 min keyframe interval checkbox |
31 |
|
* 2-pass max bitrate and overflow customization |
32 |
|
* 04.04.2002 interlacing support |
33 |
|
* hinted ME support |
34 |
|
* 24.03.2002 daniel smith <danielsmith@astroboymail.com> |
35 |
|
* added Foxer's new CBR engine |
36 |
|
* - cbr_buffer is being used as reaction delay (quick hack) |
37 |
|
* 23.03.2002 daniel smith <danielsmith@astroboymail.com> |
38 |
|
* added load defaults button |
39 |
|
* merged foxer's alternative 2-pass code (2-pass alt tab) |
40 |
|
* added proper tooltips |
41 |
|
* moved registry data into reg_ints/reg_strs arrays |
42 |
|
* added DEBUGERR output on errors instead of returning |
43 |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
44 |
* rewrote/restructured most of file |
* rewrote/restructured most of file |
45 |
* added tooltips (kind of - dirty message hook method) |
* added tooltips (kind of - dirty message hook method) |
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 */ |
75 |
|
|
76 |
|
CONFIG reg; |
77 |
|
|
78 |
|
REG_INT const reg_ints[] = { |
79 |
|
{"mode", ®.mode, DLG_MODE_CBR}, |
80 |
|
{"quality", ®.quality, 85}, |
81 |
|
{"quant", ®.quant, 5}, |
82 |
|
{"rc_bitrate", ®.rc_bitrate, 900000}, |
83 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
84 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
85 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
86 |
|
|
87 |
|
{"motion_search", ®.motion_search, 5}, |
88 |
|
{"quant_type", ®.quant_type, 0}, |
89 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
90 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
91 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
92 |
|
{"lum_masking", ®.lum_masking, 0}, |
93 |
|
{"interlacing", ®.interlacing, 0}, |
94 |
|
{"qpel", ®.qpel, 0}, |
95 |
|
{"gmc", ®.gmc, 0}, |
96 |
|
{"chromame", ®.chromame, 0}, |
97 |
|
//added by koepi for gruel's greyscale_mode |
98 |
|
{"greyscale", ®.greyscale, 0}, |
99 |
|
// end of koepi's additions |
100 |
|
#ifdef BFRAMES |
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, 0}, |
106 |
|
{"debug", ®.debug, 0}, |
107 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
108 |
|
#endif |
109 |
|
|
110 |
|
{"min_iquant", ®.min_iquant, 2}, |
111 |
|
{"max_iquant", ®.max_iquant, 31}, |
112 |
|
{"min_pquant", ®.min_pquant, 2}, |
113 |
|
{"max_pquant", ®.max_pquant, 31}, |
114 |
|
|
115 |
|
{"desired_size", ®.desired_size, 570000}, |
116 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
117 |
|
{"discard1pass", ®.discard1pass, 1}, |
118 |
|
{"dummy2pass", ®.dummy2pass, 0}, |
119 |
|
// added by koepi for new two-pass curve treatment |
120 |
|
{"kftreshold", ®.kftreshold, 10}, |
121 |
|
{"kfreduction", ®.kfreduction, 30}, |
122 |
|
// end of koepi's additions |
123 |
|
{"curve_compression_high", ®.curve_compression_high, 25}, |
124 |
|
{"curve_compression_low", ®.curve_compression_low, 10}, |
125 |
|
{"use_alt_curve", ®.use_alt_curve, 1}, |
126 |
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
127 |
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
128 |
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
129 |
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
130 |
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
131 |
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
132 |
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, |
133 |
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
134 |
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
135 |
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
136 |
|
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
137 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
138 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
139 |
|
{"hinted_me", ®.hinted_me, 0}, |
140 |
|
|
141 |
|
{"credits_start", ®.credits_start, 0}, |
142 |
|
{"credits_start_begin", ®.credits_start_begin, 0}, |
143 |
|
{"credits_start_end", ®.credits_start_end, 0}, |
144 |
|
{"credits_end", ®.credits_end, 0}, |
145 |
|
{"credits_end_begin", ®.credits_end_begin, 0}, |
146 |
|
{"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}, |
152 |
|
{"credits_rate", ®.credits_rate, 20}, |
153 |
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
154 |
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
155 |
|
{"credits_start_size", ®.credits_start_size, 10000}, |
156 |
|
{"credits_end_size", ®.credits_end_size, 10000} |
157 |
|
}; |
158 |
|
|
159 |
|
REG_STR const reg_strs[] = { |
160 |
|
{"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
161 |
|
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
162 |
|
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
163 |
|
// {"build", reg.build, XVID_BUILD} |
164 |
|
}; |
165 |
|
|
166 |
/* get config settings from registry */ |
/* get config settings from registry */ |
167 |
|
|
|
#define REG_GET_N(X, Y, Z) size=sizeof(int);if(RegQueryValueEx(hKey, X, 0, 0, (LPBYTE)&Y, &size) != ERROR_SUCCESS) {Y=Z;} |
|
|
#define REG_GET_S(X, Y, Z) size=MAX_PATH;if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {lstrcpy(Y, Z);} |
|
168 |
#define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} |
#define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} |
169 |
|
|
170 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
172 |
HKEY hKey; |
HKEY hKey; |
173 |
DWORD size; |
DWORD size; |
174 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
175 |
|
int i; |
176 |
|
|
177 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
178 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
179 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
180 |
|
|
181 |
|
#ifdef _SMP |
182 |
|
reg.num_threads = pthread_num_processors_np(); |
183 |
|
#endif |
184 |
|
|
185 |
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); |
186 |
|
|
187 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
188 |
REG_GET_N("bitrate", config->bitrate, 900000); |
{ |
189 |
REG_GET_N("quality", config->quality, 85); |
size = sizeof(int); |
190 |
REG_GET_N("quant", config->quant, 5); |
|
191 |
REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000); |
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) |
192 |
|
{ |
193 |
REG_GET_N("motion_search", config->motion_search, 5); |
*reg_ints[i].config_int = reg_ints[i].def; |
194 |
REG_GET_N("quant_type", config->quant_type, 0); |
} |
195 |
REG_GET_N("fourcc_used", config->fourcc_used, 0); |
} |
196 |
REG_GET_N("max_key_interval", config->max_key_interval, 300); |
|
197 |
REG_GET_N("lum_masking", config->lum_masking, 0); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
198 |
|
{ |
199 |
REG_GET_N("min_iquant", config->min_iquant, 1); |
size = MAX_PATH; |
200 |
REG_GET_N("max_iquant", config->max_iquant, 31); |
|
201 |
REG_GET_N("min_pquant", config->min_pquant, 1); |
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) |
202 |
REG_GET_N("max_pquant", config->max_pquant, 31); |
{ |
203 |
|
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
204 |
REG_GET_N("desired_size", config->desired_size, 570000); |
} |
205 |
REG_GET_N("keyframe_boost", config->keyframe_boost, 20); |
} |
|
REG_GET_N("min_key_interval", config->min_key_interval, 6); |
|
|
REG_GET_N("discard1pass", config->discard1pass, 1); |
|
|
REG_GET_N("dummy2pass", config->dummy2pass, 0); |
|
|
REG_GET_N("curve_compression_high", config->curve_compression_high, 25); |
|
|
REG_GET_N("curve_compression_low", config->curve_compression_low, 10); |
|
|
REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240); |
|
|
REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0); |
|
|
REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE); |
|
|
REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE); |
|
|
|
|
|
REG_GET_N("credits_start", config->credits_start, 0); |
|
|
REG_GET_N("credits_start_begin", config->credits_start_begin, 0); |
|
|
REG_GET_N("credits_start_end", config->credits_start_end, 0); |
|
|
REG_GET_N("credits_end", config->credits_end, 0); |
|
|
REG_GET_N("credits_end_begin", config->credits_end_begin, 0); |
|
|
REG_GET_N("credits_end_end", config->credits_end_end, 0); |
|
|
|
|
|
REG_GET_N("credits_mode", config->credits_mode, 0); |
|
|
REG_GET_N("credits_rate", config->credits_rate, 20); |
|
|
REG_GET_N("credits_quant_i", config->credits_quant_i, 20); |
|
|
REG_GET_N("credits_quant_p", config->credits_quant_p, 20); |
|
|
REG_GET_N("credits_start_size", config->credits_start_size, 10000); |
|
|
REG_GET_N("credits_end_size", config->credits_end_size, 10000); |
|
206 |
|
|
207 |
{ |
{ |
208 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
227 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
228 |
}; |
}; |
229 |
|
|
230 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
231 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
232 |
} |
} |
233 |
|
|
234 |
|
memcpy(config, ®, sizeof(CONFIG)); |
235 |
|
|
236 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
237 |
} |
} |
238 |
|
|
239 |
|
|
240 |
/* put config settings in registry */ |
/* put config settings in registry */ |
241 |
|
|
|
#define REG_SET_N(X, Y) RegSetValueEx(hKey, X, 0, REG_DWORD, (LPBYTE)&Y, sizeof(int)) |
|
|
#define REG_SET_S(X, Y) RegSetValueEx(hKey, X, 0, REG_SZ, Y, lstrlen(Y)+1) |
|
242 |
#define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y))) |
#define REG_SET_B(X, Y) RegSetValueEx(hKey, X, 0, REG_BINARY, Y, sizeof((Y))) |
243 |
|
|
244 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
245 |
{ |
{ |
246 |
HKEY hKey; |
HKEY hKey; |
247 |
DWORD dispo; |
DWORD dispo; |
248 |
|
int i; |
249 |
|
|
250 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
251 |
XVID_REG_KEY, |
XVID_REG_KEY, |
262 |
return; |
return; |
263 |
} |
} |
264 |
|
|
265 |
REG_SET_N("mode", config->mode); |
memcpy(®, config, sizeof(CONFIG)); |
266 |
REG_SET_N("bitrate", config->bitrate); |
|
267 |
REG_SET_N("quality", config->quality); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
268 |
REG_SET_N("quant", config->quant); |
{ |
269 |
REG_SET_N("rc_buffersize", config->rc_buffersize); |
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
270 |
|
} |
271 |
REG_SET_N("motion_search", config->motion_search); |
|
272 |
REG_SET_N("quant_type", config->quant_type); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
273 |
REG_SET_N("fourcc_used", config->fourcc_used); |
{ |
274 |
REG_SET_N("max_key_interval", config->max_key_interval); |
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
275 |
REG_SET_N("lum_masking", config->lum_masking); |
} |
276 |
|
|
277 |
REG_SET_N("min_iquant", config->min_iquant); |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
278 |
REG_SET_N("max_iquant", config->max_iquant); |
REG_SET_B("qmatrix_inter", reg.qmatrix_inter); |
|
REG_SET_N("min_pquant", config->min_pquant); |
|
|
REG_SET_N("max_pquant", config->max_pquant); |
|
|
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
|
|
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
|
|
|
|
|
REG_SET_N("desired_size", config->desired_size); |
|
|
REG_SET_N("keyframe_boost", config->keyframe_boost); |
|
|
REG_SET_N("min_key_interval", config->min_key_interval); |
|
|
REG_SET_N("discard1pass", config->discard1pass); |
|
|
REG_SET_N("dummy2pass", config->dummy2pass); |
|
|
REG_SET_N("curve_compression_high", config->curve_compression_high); |
|
|
REG_SET_N("curve_compression_low", config->curve_compression_low); |
|
|
REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
|
|
REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); |
|
|
REG_SET_S("stats1", config->stats1); |
|
|
REG_SET_S("stats2", config->stats2); |
|
|
|
|
|
REG_SET_N("credits_start", config->credits_start); |
|
|
REG_SET_N("credits_start_begin", config->credits_start_begin); |
|
|
REG_SET_N("credits_start_end", config->credits_start_end); |
|
|
REG_SET_N("credits_end", config->credits_end); |
|
|
REG_SET_N("credits_end_begin", config->credits_end_begin); |
|
|
REG_SET_N("credits_end_end", config->credits_end_end); |
|
|
|
|
|
REG_SET_N("credits_mode", config->credits_mode); |
|
|
REG_SET_N("credits_rate", config->credits_rate); |
|
|
REG_SET_N("credits_quant_i", config->credits_quant_i); |
|
|
REG_SET_N("credits_quant_p", config->credits_quant_p); |
|
|
REG_SET_N("credits_start_size", config->credits_start_size); |
|
|
REG_SET_N("credits_end_size", config->credits_end_size); |
|
279 |
|
|
280 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
281 |
} |
} |
293 |
return; |
return; |
294 |
} |
} |
295 |
|
|
296 |
if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD)) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
297 |
{ |
{ |
298 |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
299 |
return; |
return; |
300 |
} |
} |
301 |
|
|
302 |
|
RegCloseKey(hKey); |
303 |
config_reg_get(config); |
config_reg_get(config); |
304 |
|
config_reg_set(config); |
305 |
} |
} |
306 |
|
|
307 |
|
|
308 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
309 |
|
|
310 |
int config_get_int(HWND hDlg, UINT item, int config) |
int config_get_int(HWND hDlg, INT item, int config) |
311 |
|
{ |
312 |
|
BOOL success = FALSE; |
313 |
|
|
314 |
|
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
315 |
|
|
316 |
|
return (success) ? tmp : config; |
317 |
|
} |
318 |
|
|
319 |
|
|
320 |
|
int config_get_uint(HWND hDlg, UINT item, int config) |
321 |
{ |
{ |
322 |
BOOL success = FALSE; |
BOOL success = FALSE; |
323 |
|
|
335 |
{ |
{ |
336 |
default : |
default : |
337 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
338 |
config->bitrate = config_get_int(hDlg, IDC_VALUE, config->bitrate) * CONFIG_KBPS; |
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
339 |
break; |
break; |
340 |
|
|
341 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
342 |
config->quality = config_get_int(hDlg, IDC_VALUE, config->quality); |
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
343 |
break; |
break; |
344 |
|
|
345 |
case DLG_MODE_VBR_QUANT : |
case DLG_MODE_VBR_QUANT : |
346 |
config->quant = config_get_int(hDlg, IDC_VALUE, config->quant); |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
347 |
break; |
break; |
348 |
|
|
349 |
case DLG_MODE_2PASS_2_INT : |
case DLG_MODE_2PASS_2_INT : |
350 |
config->desired_size = config_get_int(hDlg, IDC_VALUE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
351 |
break; |
break; |
352 |
} |
} |
353 |
|
|
354 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
|
config->rc_buffersize = config_get_int(hDlg, IDC_CBRBUFFER, config->rc_buffersize); |
|
355 |
} |
} |
356 |
|
|
357 |
|
|
370 |
|
|
371 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
372 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
373 |
value = config->bitrate / CONFIG_KBPS; |
value = config->rc_bitrate / CONFIG_KBPS; |
374 |
break; |
break; |
375 |
|
|
376 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
394 |
|
|
395 |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
396 |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
|
EnableWindow(GetDlgItem(hDlg, IDC_CBRBUFFER_STATIC), (config->mode == DLG_MODE_CBR)); |
|
|
EnableWindow(GetDlgItem(hDlg, IDC_CBRBUFFER), (config->mode == DLG_MODE_CBR)); |
|
397 |
} |
} |
398 |
|
|
399 |
|
|
414 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
415 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
416 |
range = MAKELONG(0,10000); |
range = MAKELONG(0,10000); |
417 |
pos = config->bitrate / CONFIG_KBPS; |
pos = config->rc_bitrate / CONFIG_KBPS; |
418 |
break; |
break; |
419 |
|
|
420 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
468 |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
469 |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
470 |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
471 |
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
472 |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
473 |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
474 |
|
|
496 |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
497 |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
498 |
|
|
499 |
|
#define MOD_CBR |
500 |
|
|
501 |
void adv_mode(HWND hDlg, int mode) |
void adv_mode(HWND hDlg, int mode) |
502 |
{ |
{ |
503 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
504 |
const int cbr_disable[] = { |
const short twopass_disable[] = { |
505 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
506 |
|
// added by koepi for new curve treatment |
507 |
|
IDC_KFTRESHOLD, IDC_KFREDUCTION, |
508 |
|
//end of koepi's additions |
509 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
510 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS2, IDC_STATS2_BROWSE, |
511 |
|
}; |
512 |
|
|
513 |
|
const short cbr_disable[] = { |
514 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
515 |
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, |
516 |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
517 |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
518 |
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, |
519 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, IDC_CREDITS_GREYSCALE, IDC_HINTFILE |
520 |
}; |
}; |
521 |
|
|
522 |
const int qual_disable[] = { |
const short qual_disable[] = { |
523 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
524 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
525 |
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, |
526 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_HINTFILE |
527 |
}; |
}; |
528 |
|
|
529 |
const int quant_disable[] = { |
const short quant_disable[] = { |
530 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
531 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
532 |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
533 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
534 |
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 |
|
535 |
}; |
}; |
536 |
|
|
537 |
const int twopass1_disable[] = { |
const short twopass1_disable[] = { |
538 |
IDC_LUMMASK, IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
539 |
IDC_KFBOOST, IDC_DUMMY2PASS, |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
|
|
IDC_STATS2, IDC_STATS2_BROWSE, |
|
540 |
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, |
541 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
542 |
}; |
}; |
543 |
|
|
544 |
const int twopass2_ext_disable[] = { |
const short twopass2_ext_disable[] = { |
545 |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
546 |
|
IDC_CREDITS_RATE_RADIO, |
547 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
548 |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
549 |
}; |
}; |
550 |
|
|
551 |
const int twopass2_int_disable[] = { |
const short twopass2_int_disable[] = { |
552 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
553 |
IDC_STATS2, IDC_STATS2_BROWSE |
IDC_STATS2, IDC_STATS2_BROWSE |
554 |
}; |
}; |
555 |
|
|
556 |
// store pointers in order so we can lookup using config->mode |
// store pointers in order so we can lookup using config->mode |
557 |
const int* modes[] = { |
const short* modes[] = { |
558 |
cbr_disable, qual_disable, quant_disable, |
cbr_disable, qual_disable, quant_disable, |
559 |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
560 |
}; |
}; |
561 |
|
|
562 |
// ditto modes[] |
// ditto modes[] |
563 |
const int lengths[] = { |
const int lengths[] = { |
564 |
sizeof(cbr_disable)/sizeof(int), sizeof(qual_disable)/sizeof(int), |
sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
565 |
sizeof(quant_disable)/sizeof(int), sizeof(twopass1_disable)/sizeof(int), |
sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), |
566 |
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 |
567 |
}; |
}; |
568 |
|
|
569 |
int i; |
int i; |
570 |
|
int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
571 |
|
int credits_start, credits_end, credits_rate, credits_quant, credits_size; |
572 |
|
int cpu_force; |
573 |
|
|
574 |
// first perform checkbox-based enable/disable |
// first perform checkbox-based enable/disable |
575 |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
hinted_me = ISDLGSET(IDC_HINTEDME); |
576 |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_HINTFILE, hinted_me); |
577 |
|
CONTROLDLG(IDC_HINT_BROWSE, hinted_me); |
578 |
CONTROLDLG(IDC_CREDITS_END_BEGIN, ISDLGSET(IDC_CREDITS_END)); |
|
579 |
CONTROLDLG(IDC_CREDITS_END_END, ISDLGSET(IDC_CREDITS_END)); |
use_alt = ISDLGSET(IDC_USEALT) && (mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT); |
580 |
|
use_alt_auto = ISDLGSET(IDC_USEAUTO); |
581 |
CONTROLDLG(IDC_CREDITS_RATE, ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); |
582 |
CONTROLDLG(IDC_CREDITS_QUANTI, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
CONTROLDLG(IDC_USEAUTO, use_alt); |
583 |
CONTROLDLG(IDC_CREDITS_QUANTP, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); |
584 |
CONTROLDLG(IDC_CREDITS_START_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
CONTROLDLG(IDC_USEAUTOBONUS, use_alt); |
585 |
CONTROLDLG(IDC_CREDITS_END_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
586 |
|
CONTROLDLG(IDC_CURVETYPE, use_alt); |
587 |
CONTROLDLG(IDC_CPU_MMX, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); |
588 |
CONTROLDLG(IDC_CPU_MMXEXT, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_ALTCURVELOW, use_alt); |
589 |
CONTROLDLG(IDC_CPU_SSE, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); |
590 |
CONTROLDLG(IDC_CPU_SSE2, ISDLGSET(IDC_CPU_FORCE)); |
|
591 |
CONTROLDLG(IDC_CPU_3DNOW, ISDLGSET(IDC_CPU_FORCE)); |
credits_start = ISDLGSET(IDC_CREDITS_START); |
592 |
CONTROLDLG(IDC_CPU_3DNOWEXT, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); |
593 |
|
CONTROLDLG(IDC_CREDITS_START_END, credits_start); |
594 |
|
|
595 |
|
credits_end = ISDLGSET(IDC_CREDITS_END); |
596 |
|
CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); |
597 |
|
CONTROLDLG(IDC_CREDITS_END_END, credits_end); |
598 |
|
|
599 |
|
credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); |
600 |
|
credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); |
601 |
|
credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); |
602 |
|
CONTROLDLG(IDC_CREDITS_RATE, credits_rate); |
603 |
|
CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); |
604 |
|
CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); |
605 |
|
CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); |
606 |
|
CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); |
607 |
|
|
608 |
|
cpu_force = ISDLGSET(IDC_CPU_FORCE); |
609 |
|
CONTROLDLG(IDC_CPU_MMX, cpu_force); |
610 |
|
CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); |
611 |
|
CONTROLDLG(IDC_CPU_SSE, cpu_force); |
612 |
|
CONTROLDLG(IDC_CPU_SSE2, cpu_force); |
613 |
|
CONTROLDLG(IDC_CPU_3DNOW, cpu_force); |
614 |
|
CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); |
615 |
|
|
616 |
// now perform codec mode enable/disable |
// now perform codec mode enable/disable |
617 |
for (i=0 ; i<lengths[mode] ; ++i) |
for (i=0 ; i<lengths[mode] ; ++i) |
618 |
{ |
{ |
619 |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
620 |
} |
} |
621 |
|
|
622 |
|
if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) |
623 |
|
{ |
624 |
|
for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) |
625 |
|
{ |
626 |
|
EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); |
627 |
|
} |
628 |
|
} |
629 |
} |
} |
630 |
|
|
631 |
|
|
640 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
641 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
642 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
643 |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
644 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
645 |
|
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
646 |
|
|
647 |
|
CheckDlgButton(hDlg, IDC_QPEL, config->qpel ? BST_CHECKED : BST_UNCHECKED); |
648 |
|
CheckDlgButton(hDlg, IDC_GMC, config->gmc ? BST_CHECKED : BST_UNCHECKED); |
649 |
|
CheckDlgButton(hDlg, IDC_CHROMAME, config->chromame ? BST_CHECKED : BST_UNCHECKED); |
650 |
|
// added by koepi for gruel's greyscale_mode |
651 |
|
CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
652 |
|
// end of koepi's addition |
653 |
|
#ifdef BFRAMES |
654 |
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
655 |
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
656 |
|
SetDlgItemInt(hDlg, IDC_BQUANTOFFSET, config->bquant_offset, FALSE); |
657 |
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
658 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
659 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
660 |
|
#endif |
661 |
break; |
break; |
662 |
|
|
663 |
case DLG_QUANT : |
case DLG_QUANT : |
669 |
|
|
670 |
case DLG_2PASS : |
case DLG_2PASS : |
671 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
|
672 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
673 |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
674 |
|
// added by koepi for new 2pass curve treatment |
675 |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
676 |
|
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
677 |
|
// end of koepi's additions |
678 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
679 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
680 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
681 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
682 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
683 |
|
|
684 |
|
CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
685 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); |
686 |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
687 |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
688 |
break; |
break; |
689 |
|
|
690 |
|
case DLG_2PASSALT : |
691 |
|
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
692 |
|
|
693 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
694 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
695 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
696 |
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
697 |
|
|
698 |
|
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
699 |
|
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
700 |
|
|
701 |
|
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
702 |
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
703 |
|
|
704 |
|
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
705 |
|
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
706 |
|
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
707 |
|
break; |
708 |
|
|
709 |
case DLG_CREDITS : |
case DLG_CREDITS : |
710 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
711 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
714 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
715 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
716 |
|
|
717 |
|
// added by koepi for credits greyscale |
718 |
|
CheckDlgButton(hDlg, IDC_CREDITS_GREYSCALE, config->credits_greyscale ? BST_CHECKED : BST_UNCHECKED); |
719 |
|
// end of koepi's addition |
720 |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
721 |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
722 |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
747 |
|
|
748 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
749 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
750 |
|
|
751 |
|
#ifdef _SMP |
752 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
753 |
|
#endif |
754 |
|
|
755 |
|
#ifdef BFRAMES |
756 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
757 |
|
#endif |
758 |
|
|
759 |
|
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
760 |
|
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
761 |
|
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
762 |
break; |
break; |
763 |
} |
} |
764 |
} |
} |
778 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
779 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
780 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
781 |
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
782 |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
783 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
784 |
|
config->interlacing = ISDLGSET(IDC_INTERLACING); |
785 |
|
|
786 |
|
config->qpel = ISDLGSET(IDC_QPEL); |
787 |
|
config->gmc = ISDLGSET(IDC_GMC); |
788 |
|
config->chromame = ISDLGSET(IDC_CHROMAME); |
789 |
|
// added by koepi for gruel's greyscale_mode |
790 |
|
config->greyscale = ISDLGSET(IDC_GREYSCALE); |
791 |
|
// end of koepi's addition |
792 |
|
#ifdef BFRAMES |
793 |
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
794 |
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
795 |
|
config->bquant_offset = config_get_uint(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
796 |
|
config->packed = ISDLGSET(IDC_PACKED); |
797 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
798 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
799 |
|
#endif |
800 |
break; |
break; |
801 |
|
|
802 |
case DLG_QUANT : |
case DLG_QUANT : |
803 |
config->min_iquant = config_get_int(hDlg, IDC_MINIQUANT, config->min_iquant); |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
804 |
config->max_iquant = config_get_int(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
805 |
config->min_pquant = config_get_int(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
806 |
config->max_pquant = config_get_int(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
807 |
|
|
808 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
CONSTRAINVAL(config->min_iquant, 1, 31); |
809 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
813 |
|
|
814 |
case DLG_2PASS : |
case DLG_2PASS : |
815 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
816 |
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); |
// added by koepi for the new 2pass curve treatment |
817 |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
818 |
|
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
819 |
|
//end of koepi's additions |
820 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
821 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
822 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
823 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
824 |
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); |
825 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
826 |
|
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
827 |
|
|
828 |
|
if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
829 |
|
{ |
830 |
|
lstrcpy(config->hintfile, CONFIG_HINTFILE); |
831 |
|
} |
832 |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
833 |
{ |
{ |
834 |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
844 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
845 |
break; |
break; |
846 |
|
|
847 |
|
case DLG_2PASSALT : |
848 |
|
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
849 |
|
|
850 |
|
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
851 |
|
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
852 |
|
|
853 |
|
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
854 |
|
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
855 |
|
|
856 |
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
857 |
|
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
858 |
|
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
859 |
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
860 |
|
|
861 |
|
config->twopass_max_bitrate /= CONFIG_KBPS; |
862 |
|
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
863 |
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
864 |
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
865 |
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
866 |
|
|
867 |
|
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
868 |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
869 |
|
break; |
870 |
|
|
871 |
case DLG_CREDITS : |
case DLG_CREDITS : |
872 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
873 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
874 |
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); |
875 |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
876 |
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); |
877 |
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); |
878 |
|
|
879 |
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
// added by koepi for gruel's greyscale_mode |
880 |
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
config->credits_greyscale = ISDLGSET(IDC_CREDITS_GREYSCALE); |
881 |
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
// end of koepi's addition |
882 |
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); |
883 |
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); |
884 |
|
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
885 |
|
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
886 |
|
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
887 |
|
|
888 |
config->credits_mode = 0; |
config->credits_mode = 0; |
889 |
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; |
915 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
916 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
917 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
918 |
|
|
919 |
|
#ifdef _SMP |
920 |
|
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
921 |
|
#endif |
922 |
|
#ifdef BFRAMES |
923 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
924 |
|
#endif |
925 |
|
|
926 |
|
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
927 |
|
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
928 |
|
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
929 |
break; |
break; |
930 |
} |
} |
931 |
} |
} |
951 |
{ |
{ |
952 |
int temp; |
int temp; |
953 |
|
|
954 |
temp = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
955 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
956 |
temp = config->qmatrix_intra[i]; |
config->qmatrix_intra[i] = temp; |
957 |
|
|
958 |
temp = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
959 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
960 |
temp = config->qmatrix_inter[i]; |
config->qmatrix_inter[i] = temp; |
961 |
} |
} |
962 |
} |
} |
963 |
|
|
|
/* monitor mouse events to dialog controls for help text */ |
|
|
|
|
|
HHOOK hHook; |
|
|
HWND hParent; |
|
964 |
|
|
965 |
LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam) |
/* enumerates child windows, assigns tooltips */ |
|
{ |
|
|
MSG* pmsg = (MSG *)lParam; |
|
966 |
|
|
967 |
if (pmsg->message == WM_MOUSEMOVE) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
|
{ |
|
|
if (pmsg->hwnd == hParent) |
|
|
{ |
|
|
SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP); |
|
|
} |
|
|
else if (IsChild(hParent, pmsg->hwnd)) |
|
968 |
{ |
{ |
|
char *message; |
|
969 |
char help[500]; |
char help[500]; |
970 |
|
|
971 |
int mode = SendDlgItemMessage(hParent, IDC_MODE, CB_GETCURSEL, 0, 0); |
if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500)) |
|
int item = GetDlgCtrlID(pmsg->hwnd); |
|
|
|
|
|
if (item == IDC_VALUE || item == IDC_SLIDER) |
|
|
{ |
|
|
switch (mode) |
|
|
{ |
|
|
case DLG_MODE_2PASS_2_INT : |
|
|
if (item == IDC_VALUE) |
|
972 |
{ |
{ |
973 |
message = "Set the desired video size in Kilobytes"; |
TOOLINFO ti; |
|
break; |
|
|
} |
|
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
message = "Set the target video bitrate"; |
|
|
break; |
|
|
|
|
|
case DLG_MODE_VBR_QUAL : |
|
|
message = "Set the target video quality"; |
|
|
break; |
|
974 |
|
|
975 |
case DLG_MODE_VBR_QUANT : |
ti.cbSize = sizeof(TOOLINFO); |
976 |
message = "Set the fixed quantizer for encoding"; |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
977 |
break; |
ti.hwnd = GetParent(hWnd); |
978 |
} |
ti.uId = (LPARAM)hWnd; |
979 |
lstrcpy(help, message); |
ti.lpszText = help; |
|
} |
|
|
else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500)) |
|
|
{ |
|
|
lstrcpy(help, XVID_HELP); |
|
|
} |
|
980 |
|
|
981 |
SetDlgItemText(hParent, IDC_STATIC_HELP, help); |
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
|
} |
|
982 |
} |
} |
983 |
|
|
984 |
return (CallNextHookEx(hHook, nCode, wParam, lParam)); |
return TRUE; |
985 |
} |
} |
986 |
|
|
987 |
|
|
1007 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
1008 |
|
|
1009 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
SetDlgItemInt(hDlg, IDC_CBRBUFFER, config->rc_buffersize, FALSE); |
|
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
|
|
|
|
hHook = SetWindowsHookEx(WH_GETMESSAGE, msg_proc, 0, GetCurrentThreadId()); |
|
1010 |
|
|
1011 |
main_slider(hDlg, config); |
InitCommonControls(); |
|
main_value(hDlg, config); |
|
|
break; |
|
1012 |
|
|
1013 |
case WM_ACTIVATE : |
if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1014 |
if (LOWORD(wParam) != WA_INACTIVE) |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1015 |
|
NULL, NULL, hInst, NULL)) |
1016 |
{ |
{ |
1017 |
hParent = hDlg; |
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
1018 |
|
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
1019 |
|
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
1020 |
|
|
1021 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1022 |
} |
} |
|
return 0; |
|
1023 |
|
|
1024 |
case WM_DESTROY : |
main_slider(hDlg, config); |
1025 |
UnhookWindowsHookEx(hHook); |
main_value(hDlg, config); |
1026 |
break; |
break; |
1027 |
|
|
1028 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1052 |
config_reg_set(config); |
config_reg_set(config); |
1053 |
} |
} |
1054 |
} |
} |
1055 |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
1056 |
|
{ |
1057 |
|
config_reg_default(config); |
1058 |
|
|
1059 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1060 |
|
|
1061 |
|
main_slider(hDlg, config); |
1062 |
|
main_value(hDlg, config); |
1063 |
|
} |
1064 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
1065 |
{ |
{ |
1066 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
1067 |
int max = 1; |
int max = 1; |
1068 |
|
|
1069 |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1135 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
1136 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
1137 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
1138 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"New Modulated HQ"); |
1139 |
|
|
1140 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1141 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1142 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1143 |
|
|
1144 |
|
#ifndef BFRAMES |
1145 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC1), FALSE); |
1146 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC2), FALSE); |
1147 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC3), FALSE); |
1148 |
|
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
1149 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
1150 |
|
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
1151 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DX50BVOP), FALSE); |
1152 |
|
EnableWindow(GetDlgItem(hDlg, IDC_DEBUG), FALSE); |
1153 |
|
#endif |
1154 |
|
} |
1155 |
|
else if (psi->page == DLG_2PASSALT) |
1156 |
|
{ |
1157 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
1158 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1159 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1160 |
|
} |
1161 |
|
else if (psi->page == DLG_CPU) |
1162 |
|
{ |
1163 |
|
#ifndef _SMP |
1164 |
|
|
1165 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1166 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1167 |
|
#endif |
1168 |
|
#ifndef BFRAMES |
1169 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP_STATIC), FALSE); |
1170 |
|
EnableWindow(GetDlgItem(hDlg, IDC_FRAMEDROP), FALSE); |
1171 |
|
#endif |
1172 |
|
} |
1173 |
|
|
1174 |
|
if (hTooltip) |
1175 |
|
{ |
1176 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1177 |
} |
} |
1178 |
|
|
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
1179 |
adv_upload(hDlg, psi->page, psi->config); |
adv_upload(hDlg, psi->page, psi->config); |
1180 |
adv_mode(hDlg, psi->config->mode); |
adv_mode(hDlg, psi->config->mode); |
1181 |
break; |
break; |
1185 |
{ |
{ |
1186 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1187 |
{ |
{ |
1188 |
|
case IDC_HINTEDME : |
1189 |
|
case IDC_USEALT : |
1190 |
|
case IDC_USEAUTO : |
1191 |
|
case IDC_USEAUTOBONUS : |
1192 |
case IDC_CREDITS_START : |
case IDC_CREDITS_START : |
1193 |
case IDC_CREDITS_END : |
case IDC_CREDITS_END : |
1194 |
case IDC_CREDITS_RATE_RADIO : |
case IDC_CREDITS_RATE_RADIO : |
1200 |
break; |
break; |
1201 |
} |
} |
1202 |
} |
} |
1203 |
if ((LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
if ((LOWORD(wParam) == IDC_HINT_BROWSE || LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
1204 |
{ |
{ |
1205 |
OPENFILENAME ofn; |
OPENFILENAME ofn; |
1206 |
char tmp[MAX_PATH]; |
char tmp[MAX_PATH]; |
1217 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1218 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1219 |
|
|
1220 |
// display save box for stats1 using 1st-pass |
if (LOWORD(wParam) == IDC_HINT_BROWSE) |
1221 |
if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
{ |
1222 |
|
ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; |
1223 |
|
if (GetOpenFileName(&ofn)) |
1224 |
|
{ |
1225 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, tmp); |
1226 |
|
} |
1227 |
|
} |
1228 |
|
else if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
1229 |
psi->config->mode == DLG_MODE_2PASS_1) |
psi->config->mode == DLG_MODE_2PASS_1) |
1230 |
{ |
{ |
1231 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
1251 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1252 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1253 |
{ |
{ |
|
case PSN_SETACTIVE : |
|
|
hParent = hDlg; |
|
|
break; |
|
|
|
|
1254 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1255 |
/* validate */ |
/* validate */ |
1256 |
adv_download(hDlg, psi->page, psi->config); |
adv_download(hDlg, psi->page, psi->config); |
1286 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
1287 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1288 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
|
break; |
|
1289 |
|
|
1290 |
case WM_ACTIVATE : |
if (hTooltip) |
|
if (LOWORD(wParam) != WA_INACTIVE) |
|
1291 |
{ |
{ |
1292 |
hParent = hDlg; |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1293 |
} |
} |
1294 |
return 0; |
break; |
1295 |
|
|
1296 |
case WM_COMMAND : |
case WM_COMMAND : |
1297 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1335 |
|
|
1336 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1337 |
{ |
{ |
1338 |
DEBUG("Couldn't save quant matrix"); |
DEBUGERR("Couldn't save quant matrix"); |
1339 |
} |
} |
1340 |
else |
else |
1341 |
{ |
{ |
1342 |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
1343 |
{ |
{ |
1344 |
DEBUG("Couldnt write quant matrix"); |
DEBUGERR("Couldnt write quant matrix"); |
1345 |
} |
} |
1346 |
} |
} |
1347 |
|
|
1357 |
|
|
1358 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1359 |
{ |
{ |
1360 |
DEBUG("Couldn't load quant matrix"); |
DEBUGERR("Couldn't load quant matrix"); |
1361 |
} |
} |
1362 |
else |
else |
1363 |
{ |
{ |
1364 |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
1365 |
{ |
{ |
1366 |
DEBUG("Couldnt read quant matrix"); |
DEBUGERR("Couldnt read quant matrix"); |
1367 |
} |
} |
1368 |
else |
else |
1369 |
{ |
{ |
1400 |
HFONT hFont; |
HFONT hFont; |
1401 |
LOGFONT lfData; |
LOGFONT lfData; |
1402 |
|
|
1403 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1404 |
|
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1405 |
|
|
1406 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1407 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1408 |
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)); |
1409 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |