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) |
66 |
#include "resource.h" |
#include "resource.h" |
67 |
|
|
68 |
|
|
69 |
|
/* registry info structs */ |
70 |
|
|
71 |
|
CONFIG reg; |
72 |
|
|
73 |
|
REG_INT const reg_ints[] = { |
74 |
|
{"mode", ®.mode, DLG_MODE_CBR}, |
75 |
|
{"quality", ®.quality, 85}, |
76 |
|
{"quant", ®.quant, 5}, |
77 |
|
{"rc_bitrate", ®.rc_bitrate, 900000}, |
78 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
79 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
80 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
81 |
|
|
82 |
|
{"motion_search", ®.motion_search, 5}, |
83 |
|
{"quant_type", ®.quant_type, 0}, |
84 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
85 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
86 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
87 |
|
{"lum_masking", ®.lum_masking, 0}, |
88 |
|
{"interlacing", ®.interlacing, 0}, |
89 |
|
#ifdef BFRAMES |
90 |
|
{"max_bframes", ®.max_bframes, 0}, |
91 |
|
{"bquant_ratio", ®.bquant_ratio, 200}, |
92 |
|
{"packed", ®.packed, 1}, |
93 |
|
#endif BFRAMES |
94 |
|
|
95 |
|
{"min_iquant", ®.min_iquant, 1}, |
96 |
|
{"max_iquant", ®.max_iquant, 31}, |
97 |
|
{"min_pquant", ®.min_pquant, 1}, |
98 |
|
{"max_pquant", ®.max_pquant, 31}, |
99 |
|
|
100 |
|
{"desired_size", ®.desired_size, 570000}, |
101 |
|
{"keyframe_boost", ®.keyframe_boost, 20}, |
102 |
|
{"discard1pass", ®.discard1pass, 1}, |
103 |
|
{"dummy2pass", ®.dummy2pass, 0}, |
104 |
|
{"curve_compression_high", ®.curve_compression_high, 25}, |
105 |
|
{"curve_compression_low", ®.curve_compression_low, 10}, |
106 |
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
107 |
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
108 |
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 50}, |
109 |
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
110 |
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
111 |
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
112 |
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 300}, |
113 |
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 300}, |
114 |
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
115 |
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 240}, |
116 |
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
117 |
|
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
118 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
119 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
120 |
|
{"hinted_me", ®.hinted_me, 0}, |
121 |
|
|
122 |
|
{"credits_start", ®.credits_start, 0}, |
123 |
|
{"credits_start_begin", ®.credits_start_begin, 0}, |
124 |
|
{"credits_start_end", ®.credits_start_end, 0}, |
125 |
|
{"credits_end", ®.credits_end, 0}, |
126 |
|
{"credits_end_begin", ®.credits_end_begin, 0}, |
127 |
|
{"credits_end_end", ®.credits_end_end, 0}, |
128 |
|
|
129 |
|
{"credits_mode", ®.credits_mode, 0}, |
130 |
|
{"credits_rate", ®.credits_rate, 20}, |
131 |
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
132 |
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
133 |
|
{"credits_start_size", ®.credits_start_size, 10000}, |
134 |
|
{"credits_end_size", ®.credits_end_size, 10000} |
135 |
|
}; |
136 |
|
|
137 |
|
REG_STR const reg_strs[] = { |
138 |
|
{"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
139 |
|
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
140 |
|
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
141 |
|
// {"build", reg.build, XVID_BUILD} |
142 |
|
}; |
143 |
|
|
144 |
/* get config settings from registry */ |
/* get config settings from registry */ |
145 |
|
|
|
#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);} |
|
146 |
#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)));} |
147 |
|
|
148 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
150 |
HKEY hKey; |
HKEY hKey; |
151 |
DWORD size; |
DWORD size; |
152 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
153 |
|
int i; |
154 |
|
|
155 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = 0; |
156 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
158 |
|
|
159 |
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); |
160 |
|
|
161 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
162 |
REG_GET_N("bitrate", config->bitrate, 900000); |
{ |
163 |
REG_GET_N("quality", config->quality, 85); |
size = sizeof(int); |
164 |
REG_GET_N("quant", config->quant, 5); |
|
165 |
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) |
166 |
|
{ |
167 |
REG_GET_N("motion_search", config->motion_search, 5); |
*reg_ints[i].config_int = reg_ints[i].def; |
168 |
REG_GET_N("quant_type", config->quant_type, 0); |
} |
169 |
REG_GET_N("fourcc_used", config->fourcc_used, 0); |
} |
170 |
REG_GET_N("max_key_interval", config->max_key_interval, 300); |
|
171 |
REG_GET_N("lum_masking", config->lum_masking, 0); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
172 |
|
{ |
173 |
REG_GET_N("min_iquant", config->min_iquant, 1); |
size = MAX_PATH; |
174 |
REG_GET_N("max_iquant", config->max_iquant, 31); |
|
175 |
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) |
176 |
REG_GET_N("max_pquant", config->max_pquant, 31); |
{ |
177 |
|
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
178 |
REG_GET_N("desired_size", config->desired_size, 570000); |
} |
179 |
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); |
|
180 |
|
|
181 |
{ |
{ |
182 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
201 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
202 |
}; |
}; |
203 |
|
|
204 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
205 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
206 |
} |
} |
207 |
|
|
208 |
|
memcpy(config, ®, sizeof(CONFIG)); |
209 |
|
|
210 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
211 |
} |
} |
212 |
|
|
213 |
|
|
214 |
/* put config settings in registry */ |
/* put config settings in registry */ |
215 |
|
|
|
#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) |
|
216 |
#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))) |
217 |
|
|
218 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
219 |
{ |
{ |
220 |
HKEY hKey; |
HKEY hKey; |
221 |
DWORD dispo; |
DWORD dispo; |
222 |
|
int i; |
223 |
|
|
224 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
225 |
XVID_REG_KEY, |
XVID_REG_KEY, |
236 |
return; |
return; |
237 |
} |
} |
238 |
|
|
239 |
REG_SET_N("mode", config->mode); |
memcpy(®, config, sizeof(CONFIG)); |
240 |
REG_SET_N("bitrate", config->bitrate); |
|
241 |
REG_SET_N("quality", config->quality); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
242 |
REG_SET_N("quant", config->quant); |
{ |
243 |
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)); |
244 |
|
} |
245 |
REG_SET_N("motion_search", config->motion_search); |
|
246 |
REG_SET_N("quant_type", config->quant_type); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
247 |
REG_SET_N("fourcc_used", config->fourcc_used); |
{ |
248 |
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); |
249 |
REG_SET_N("lum_masking", config->lum_masking); |
} |
250 |
|
|
251 |
REG_SET_N("min_iquant", config->min_iquant); |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
252 |
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); |
|
253 |
|
|
254 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
255 |
} |
} |
267 |
return; |
return; |
268 |
} |
} |
269 |
|
|
270 |
if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD)) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
271 |
{ |
{ |
272 |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
273 |
return; |
return; |
274 |
} |
} |
275 |
|
|
276 |
|
RegCloseKey(hKey); |
277 |
config_reg_get(config); |
config_reg_get(config); |
278 |
|
config_reg_set(config); |
279 |
} |
} |
280 |
|
|
281 |
|
|
282 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
283 |
|
|
284 |
int config_get_int(HWND hDlg, UINT item, int config) |
int config_get_int(HWND hDlg, INT item, int config) |
285 |
|
{ |
286 |
|
BOOL success = FALSE; |
287 |
|
|
288 |
|
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
289 |
|
|
290 |
|
return (success) ? tmp : config; |
291 |
|
} |
292 |
|
|
293 |
|
|
294 |
|
int config_get_uint(HWND hDlg, UINT item, int config) |
295 |
{ |
{ |
296 |
BOOL success = FALSE; |
BOOL success = FALSE; |
297 |
|
|
309 |
{ |
{ |
310 |
default : |
default : |
311 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
312 |
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; |
313 |
break; |
break; |
314 |
|
|
315 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
316 |
config->quality = config_get_int(hDlg, IDC_VALUE, config->quality); |
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
317 |
break; |
break; |
318 |
|
|
319 |
case DLG_MODE_VBR_QUANT : |
case DLG_MODE_VBR_QUANT : |
320 |
config->quant = config_get_int(hDlg, IDC_VALUE, config->quant); |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
321 |
break; |
break; |
322 |
|
|
323 |
case DLG_MODE_2PASS_2_INT : |
case DLG_MODE_2PASS_2_INT : |
324 |
config->desired_size = config_get_int(hDlg, IDC_VALUE, config->desired_size); |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
325 |
break; |
break; |
326 |
} |
} |
327 |
|
|
328 |
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); |
|
329 |
} |
} |
330 |
|
|
331 |
|
|
344 |
|
|
345 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
346 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
347 |
value = config->bitrate / CONFIG_KBPS; |
value = config->rc_bitrate / CONFIG_KBPS; |
348 |
break; |
break; |
349 |
|
|
350 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
368 |
|
|
369 |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
370 |
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)); |
|
371 |
} |
} |
372 |
|
|
373 |
|
|
388 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
389 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
390 |
range = MAKELONG(0,10000); |
range = MAKELONG(0,10000); |
391 |
pos = config->bitrate / CONFIG_KBPS; |
pos = config->rc_bitrate / CONFIG_KBPS; |
392 |
break; |
break; |
393 |
|
|
394 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
442 |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
443 |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
444 |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
445 |
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
446 |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
447 |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
448 |
|
|
470 |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
471 |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
472 |
|
|
473 |
|
#define MOD_CBR |
474 |
|
|
475 |
void adv_mode(HWND hDlg, int mode) |
void adv_mode(HWND hDlg, int mode) |
476 |
{ |
{ |
477 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
478 |
const int cbr_disable[] = { |
const short twopass_disable[] = { |
479 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
480 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
481 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS2, IDC_STATS2_BROWSE, |
482 |
|
}; |
483 |
|
|
484 |
|
const short cbr_disable[] = { |
485 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
486 |
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, |
487 |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
488 |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
490 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
491 |
}; |
}; |
492 |
|
|
493 |
const int qual_disable[] = { |
const short qual_disable[] = { |
494 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
495 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
|
496 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
497 |
}; |
}; |
498 |
|
|
499 |
const int quant_disable[] = { |
const short quant_disable[] = { |
500 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
501 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
502 |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
|
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
|
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
|
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
|
503 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
504 |
}; |
}; |
505 |
|
|
506 |
const int twopass1_disable[] = { |
const short twopass1_disable[] = { |
507 |
IDC_LUMMASK, IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
508 |
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, |
|
509 |
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, |
510 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
511 |
}; |
}; |
512 |
|
|
513 |
const int twopass2_ext_disable[] = { |
const short twopass2_ext_disable[] = { |
514 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
515 |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
516 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
517 |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
518 |
}; |
}; |
519 |
|
|
520 |
const int twopass2_int_disable[] = { |
const short twopass2_int_disable[] = { |
521 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
522 |
IDC_STATS2, IDC_STATS2_BROWSE |
IDC_STATS2, IDC_STATS2_BROWSE |
523 |
}; |
}; |
524 |
|
|
525 |
// store pointers in order so we can lookup using config->mode |
// store pointers in order so we can lookup using config->mode |
526 |
const int* modes[] = { |
const short* modes[] = { |
527 |
cbr_disable, qual_disable, quant_disable, |
cbr_disable, qual_disable, quant_disable, |
528 |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
529 |
}; |
}; |
530 |
|
|
531 |
// ditto modes[] |
// ditto modes[] |
532 |
const int lengths[] = { |
const int lengths[] = { |
533 |
sizeof(cbr_disable)/sizeof(int), sizeof(qual_disable)/sizeof(int), |
sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
534 |
sizeof(quant_disable)/sizeof(int), sizeof(twopass1_disable)/sizeof(int), |
sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), |
535 |
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 |
536 |
}; |
}; |
537 |
|
|
538 |
int i; |
int i; |
539 |
|
int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
540 |
|
int credits_start, credits_end, credits_rate, credits_quant, credits_size; |
541 |
|
int cpu_force; |
542 |
|
|
543 |
// first perform checkbox-based enable/disable |
// first perform checkbox-based enable/disable |
544 |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
hinted_me = ISDLGSET(IDC_HINTEDME); |
545 |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_HINTFILE, hinted_me); |
546 |
|
CONTROLDLG(IDC_HINT_BROWSE, hinted_me); |
547 |
CONTROLDLG(IDC_CREDITS_END_BEGIN, ISDLGSET(IDC_CREDITS_END)); |
|
548 |
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); |
549 |
|
use_alt_auto = ISDLGSET(IDC_USEAUTO); |
550 |
CONTROLDLG(IDC_CREDITS_RATE, ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); |
551 |
CONTROLDLG(IDC_CREDITS_QUANTI, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
CONTROLDLG(IDC_USEAUTO, use_alt); |
552 |
CONTROLDLG(IDC_CREDITS_QUANTP, ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); |
553 |
CONTROLDLG(IDC_CREDITS_START_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
CONTROLDLG(IDC_USEAUTOBONUS, use_alt); |
554 |
CONTROLDLG(IDC_CREDITS_END_SIZE, ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
555 |
|
CONTROLDLG(IDC_CURVETYPE, use_alt); |
556 |
CONTROLDLG(IDC_CPU_MMX, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); |
557 |
CONTROLDLG(IDC_CPU_MMXEXT, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_ALTCURVELOW, use_alt); |
558 |
CONTROLDLG(IDC_CPU_SSE, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); |
559 |
CONTROLDLG(IDC_CPU_SSE2, ISDLGSET(IDC_CPU_FORCE)); |
|
560 |
CONTROLDLG(IDC_CPU_3DNOW, ISDLGSET(IDC_CPU_FORCE)); |
credits_start = ISDLGSET(IDC_CREDITS_START); |
561 |
CONTROLDLG(IDC_CPU_3DNOWEXT, ISDLGSET(IDC_CPU_FORCE)); |
CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); |
562 |
|
CONTROLDLG(IDC_CREDITS_START_END, credits_start); |
563 |
|
|
564 |
|
credits_end = ISDLGSET(IDC_CREDITS_END); |
565 |
|
CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); |
566 |
|
CONTROLDLG(IDC_CREDITS_END_END, credits_end); |
567 |
|
|
568 |
|
credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); |
569 |
|
credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); |
570 |
|
credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); |
571 |
|
CONTROLDLG(IDC_CREDITS_RATE, credits_rate); |
572 |
|
CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); |
573 |
|
CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); |
574 |
|
CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); |
575 |
|
CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); |
576 |
|
|
577 |
|
cpu_force = ISDLGSET(IDC_CPU_FORCE); |
578 |
|
CONTROLDLG(IDC_CPU_MMX, cpu_force); |
579 |
|
CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); |
580 |
|
CONTROLDLG(IDC_CPU_SSE, cpu_force); |
581 |
|
CONTROLDLG(IDC_CPU_SSE2, cpu_force); |
582 |
|
CONTROLDLG(IDC_CPU_3DNOW, cpu_force); |
583 |
|
CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); |
584 |
|
|
585 |
// now perform codec mode enable/disable |
// now perform codec mode enable/disable |
586 |
for (i=0 ; i<lengths[mode] ; ++i) |
for (i=0 ; i<lengths[mode] ; ++i) |
587 |
{ |
{ |
588 |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
589 |
} |
} |
590 |
|
|
591 |
|
if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) |
592 |
|
{ |
593 |
|
for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) |
594 |
|
{ |
595 |
|
EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); |
596 |
|
} |
597 |
|
} |
598 |
} |
} |
599 |
|
|
600 |
|
|
609 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
610 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
611 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
612 |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
613 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
614 |
|
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
615 |
|
#ifdef BFRAMES |
616 |
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
617 |
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
618 |
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
619 |
|
#endif |
620 |
break; |
break; |
621 |
|
|
622 |
case DLG_QUANT : |
case DLG_QUANT : |
628 |
|
|
629 |
case DLG_2PASS : |
case DLG_2PASS : |
630 |
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); |
|
631 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
632 |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
633 |
|
|
637 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
638 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
639 |
|
|
640 |
|
CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
641 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); |
642 |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
643 |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
644 |
break; |
break; |
645 |
|
|
646 |
|
case DLG_2PASSALT : |
647 |
|
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
648 |
|
|
649 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
650 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
651 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
652 |
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
653 |
|
|
654 |
|
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
655 |
|
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
656 |
|
|
657 |
|
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
658 |
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
659 |
|
|
660 |
|
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
661 |
|
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
662 |
|
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
663 |
|
break; |
664 |
|
|
665 |
case DLG_CREDITS : |
case DLG_CREDITS : |
666 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
667 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
700 |
|
|
701 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
702 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
703 |
|
|
704 |
|
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
705 |
|
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
706 |
|
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
707 |
break; |
break; |
708 |
} |
} |
709 |
} |
} |
723 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
724 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
725 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
726 |
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); |
727 |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
728 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
729 |
|
config->interlacing = ISDLGSET(IDC_INTERLACING); |
730 |
|
#ifdef BFRAMES |
731 |
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
732 |
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
733 |
|
config->packed = ISDLGSET(IDC_PACKED); |
734 |
|
#endif |
735 |
break; |
break; |
736 |
|
|
737 |
case DLG_QUANT : |
case DLG_QUANT : |
738 |
config->min_iquant = config_get_int(hDlg, IDC_MINIQUANT, config->min_iquant); |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
739 |
config->max_iquant = config_get_int(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
740 |
config->min_pquant = config_get_int(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
741 |
config->max_pquant = config_get_int(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
742 |
|
|
743 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
CONSTRAINVAL(config->min_iquant, 1, 31); |
744 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
748 |
|
|
749 |
case DLG_2PASS : |
case DLG_2PASS : |
750 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
|
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); |
|
751 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
752 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
753 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
754 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
755 |
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); |
756 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
757 |
|
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
758 |
|
|
759 |
|
if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
760 |
|
{ |
761 |
|
lstrcpy(config->hintfile, CONFIG_HINTFILE); |
762 |
|
} |
763 |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
764 |
{ |
{ |
765 |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
775 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
776 |
break; |
break; |
777 |
|
|
778 |
|
case DLG_2PASSALT : |
779 |
|
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
780 |
|
|
781 |
|
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
782 |
|
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
783 |
|
|
784 |
|
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
785 |
|
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
786 |
|
|
787 |
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
788 |
|
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
789 |
|
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
790 |
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
791 |
|
|
792 |
|
config->twopass_max_bitrate /= CONFIG_KBPS; |
793 |
|
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
794 |
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
795 |
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
796 |
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
797 |
|
|
798 |
|
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
799 |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
800 |
|
break; |
801 |
|
|
802 |
case DLG_CREDITS : |
case DLG_CREDITS : |
803 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
804 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
805 |
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); |
806 |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
807 |
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); |
808 |
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); |
809 |
|
|
810 |
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
811 |
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
812 |
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
813 |
config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
814 |
config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
815 |
|
|
816 |
config->credits_mode = 0; |
config->credits_mode = 0; |
817 |
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; |
843 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
844 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
845 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
846 |
|
|
847 |
|
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
848 |
|
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
849 |
|
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
850 |
break; |
break; |
851 |
} |
} |
852 |
} |
} |
872 |
{ |
{ |
873 |
int temp; |
int temp; |
874 |
|
|
875 |
temp = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
876 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
877 |
temp = config->qmatrix_intra[i]; |
config->qmatrix_intra[i] = temp; |
878 |
|
|
879 |
temp = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
880 |
CONSTRAINVAL(temp, 1, 255); |
CONSTRAINVAL(temp, 1, 255); |
881 |
temp = config->qmatrix_inter[i]; |
config->qmatrix_inter[i] = temp; |
882 |
} |
} |
883 |
} |
} |
884 |
|
|
|
/* monitor mouse events to dialog controls for help text */ |
|
885 |
|
|
886 |
HHOOK hHook; |
/* enumerates child windows, assigns tooltips */ |
|
HWND hParent; |
|
|
|
|
|
LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam) |
|
|
{ |
|
|
MSG* pmsg = (MSG *)lParam; |
|
887 |
|
|
888 |
if (pmsg->message == WM_MOUSEMOVE) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
889 |
{ |
{ |
|
if (pmsg->hwnd == hParent) |
|
|
{ |
|
|
SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP); |
|
|
} |
|
|
else if (IsChild(hParent, pmsg->hwnd)) |
|
|
{ |
|
|
char *message; |
|
890 |
char help[500]; |
char help[500]; |
891 |
|
|
892 |
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) |
|
893 |
{ |
{ |
894 |
switch (mode) |
TOOLINFO ti; |
|
{ |
|
|
case DLG_MODE_2PASS_2_INT : |
|
|
if (item == IDC_VALUE) |
|
|
{ |
|
|
message = "Set the desired video size in Kilobytes"; |
|
|
break; |
|
|
} |
|
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
message = "Set the target video bitrate"; |
|
|
break; |
|
895 |
|
|
896 |
case DLG_MODE_VBR_QUAL : |
ti.cbSize = sizeof(TOOLINFO); |
897 |
message = "Set the target video quality"; |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
898 |
break; |
ti.hwnd = GetParent(hWnd); |
899 |
|
ti.uId = (LPARAM)hWnd; |
900 |
|
ti.lpszText = help; |
901 |
|
|
902 |
case DLG_MODE_VBR_QUANT : |
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
|
message = "Set the fixed quantizer for encoding"; |
|
|
break; |
|
|
} |
|
|
lstrcpy(help, message); |
|
|
} |
|
|
else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500)) |
|
|
{ |
|
|
lstrcpy(help, XVID_HELP); |
|
903 |
} |
} |
904 |
|
|
905 |
SetDlgItemText(hParent, IDC_STATIC_HELP, help); |
return TRUE; |
|
} |
|
|
} |
|
|
|
|
|
return (CallNextHookEx(hHook, nCode, wParam, lParam)); |
|
906 |
} |
} |
907 |
|
|
908 |
|
|
928 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
929 |
|
|
930 |
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); |
|
931 |
|
|
932 |
hHook = SetWindowsHookEx(WH_GETMESSAGE, msg_proc, 0, GetCurrentThreadId()); |
InitCommonControls(); |
933 |
|
|
934 |
main_slider(hDlg, config); |
if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
935 |
main_value(hDlg, config); |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
936 |
break; |
NULL, NULL, hInst, NULL)) |
|
|
|
|
case WM_ACTIVATE : |
|
|
if (LOWORD(wParam) != WA_INACTIVE) |
|
937 |
{ |
{ |
938 |
hParent = hDlg; |
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
939 |
|
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
940 |
|
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
941 |
|
|
942 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
943 |
} |
} |
|
return 0; |
|
944 |
|
|
945 |
case WM_DESTROY : |
main_slider(hDlg, config); |
946 |
UnhookWindowsHookEx(hHook); |
main_value(hDlg, config); |
947 |
break; |
break; |
948 |
|
|
949 |
case WM_HSCROLL : |
case WM_HSCROLL : |
973 |
config_reg_set(config); |
config_reg_set(config); |
974 |
} |
} |
975 |
} |
} |
976 |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
977 |
|
{ |
978 |
|
config_reg_default(config); |
979 |
|
|
980 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
981 |
|
|
982 |
|
main_slider(hDlg, config); |
983 |
|
main_value(hDlg, config); |
984 |
|
} |
985 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
986 |
{ |
{ |
987 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
988 |
int max = 1; |
int max = 1; |
989 |
|
|
990 |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1060 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1061 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1062 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1063 |
|
|
1064 |
|
#ifndef BFRAMES |
1065 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC1), FALSE); |
1066 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC2), FALSE); |
1067 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BSTATIC3), FALSE); |
1068 |
|
EnableWindow(GetDlgItem(hDlg, IDC_MAXBFRAMES), FALSE); |
1069 |
|
EnableWindow(GetDlgItem(hDlg, IDC_BQUANTRATIO), FALSE); |
1070 |
|
EnableWindow(GetDlgItem(hDlg, IDC_PACKED), FALSE); |
1071 |
|
#endif |
1072 |
|
} |
1073 |
|
else if (psi->page == DLG_2PASSALT) |
1074 |
|
{ |
1075 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
1076 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1077 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1078 |
|
} |
1079 |
|
|
1080 |
|
if (hTooltip) |
1081 |
|
{ |
1082 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1083 |
} |
} |
1084 |
|
|
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
1085 |
adv_upload(hDlg, psi->page, psi->config); |
adv_upload(hDlg, psi->page, psi->config); |
1086 |
adv_mode(hDlg, psi->config->mode); |
adv_mode(hDlg, psi->config->mode); |
1087 |
break; |
break; |
1091 |
{ |
{ |
1092 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1093 |
{ |
{ |
1094 |
|
case IDC_HINTEDME : |
1095 |
|
case IDC_USEALT : |
1096 |
|
case IDC_USEAUTO : |
1097 |
|
case IDC_USEAUTOBONUS : |
1098 |
case IDC_CREDITS_START : |
case IDC_CREDITS_START : |
1099 |
case IDC_CREDITS_END : |
case IDC_CREDITS_END : |
1100 |
case IDC_CREDITS_RATE_RADIO : |
case IDC_CREDITS_RATE_RADIO : |
1106 |
break; |
break; |
1107 |
} |
} |
1108 |
} |
} |
1109 |
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) |
1110 |
{ |
{ |
1111 |
OPENFILENAME ofn; |
OPENFILENAME ofn; |
1112 |
char tmp[MAX_PATH]; |
char tmp[MAX_PATH]; |
1123 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1124 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1125 |
|
|
1126 |
// display save box for stats1 using 1st-pass |
if (LOWORD(wParam) == IDC_HINT_BROWSE) |
1127 |
if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
{ |
1128 |
|
ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; |
1129 |
|
if (GetOpenFileName(&ofn)) |
1130 |
|
{ |
1131 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, tmp); |
1132 |
|
} |
1133 |
|
} |
1134 |
|
else if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
1135 |
psi->config->mode == DLG_MODE_2PASS_1) |
psi->config->mode == DLG_MODE_2PASS_1) |
1136 |
{ |
{ |
1137 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
1157 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1158 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1159 |
{ |
{ |
|
case PSN_SETACTIVE : |
|
|
hParent = hDlg; |
|
|
break; |
|
|
|
|
1160 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1161 |
/* validate */ |
/* validate */ |
1162 |
adv_download(hDlg, psi->page, psi->config); |
adv_download(hDlg, psi->page, psi->config); |
1192 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
1193 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1194 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
|
break; |
|
1195 |
|
|
1196 |
case WM_ACTIVATE : |
if (hTooltip) |
|
if (LOWORD(wParam) != WA_INACTIVE) |
|
1197 |
{ |
{ |
1198 |
hParent = hDlg; |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1199 |
} |
} |
1200 |
return 0; |
break; |
1201 |
|
|
1202 |
case WM_COMMAND : |
case WM_COMMAND : |
1203 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1241 |
|
|
1242 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1243 |
{ |
{ |
1244 |
DEBUG("Couldn't save quant matrix"); |
DEBUGERR("Couldn't save quant matrix"); |
1245 |
} |
} |
1246 |
else |
else |
1247 |
{ |
{ |
1248 |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
1249 |
{ |
{ |
1250 |
DEBUG("Couldnt write quant matrix"); |
DEBUGERR("Couldnt write quant matrix"); |
1251 |
} |
} |
1252 |
} |
} |
1253 |
|
|
1263 |
|
|
1264 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1265 |
{ |
{ |
1266 |
DEBUG("Couldn't load quant matrix"); |
DEBUGERR("Couldn't load quant matrix"); |
1267 |
} |
} |
1268 |
else |
else |
1269 |
{ |
{ |
1270 |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
1271 |
{ |
{ |
1272 |
DEBUG("Couldnt read quant matrix"); |
DEBUGERR("Couldnt read quant matrix"); |
1273 |
} |
} |
1274 |
else |
else |
1275 |
{ |
{ |
1306 |
HFONT hFont; |
HFONT hFont; |
1307 |
LOGFONT lfData; |
LOGFONT lfData; |
1308 |
|
|
1309 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1310 |
|
|
1311 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1312 |
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)); |