23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
|
* 17.04.2002 re-enabled lumi masking in 1st pass |
27 |
|
* 15.04.2002 updated cbr support |
28 |
|
* 07.04.2002 min keyframe interval checkbox |
29 |
|
* 2-pass max bitrate and overflow customization |
30 |
|
* 04.04.2002 interlacing support |
31 |
|
* hinted ME support |
32 |
|
* 24.03.2002 daniel smith <danielsmith@astroboymail.com> |
33 |
|
* added Foxer's new CBR engine |
34 |
|
* - cbr_buffer is being used as reaction delay (quick hack) |
35 |
|
* 23.03.2002 daniel smith <danielsmith@astroboymail.com> |
36 |
|
* added load defaults button |
37 |
|
* merged foxer's alternative 2-pass code (2-pass alt tab) |
38 |
|
* added proper tooltips |
39 |
|
* moved registry data into reg_ints/reg_strs arrays |
40 |
|
* added DEBUGERR output on errors instead of returning |
41 |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
* 16.03.2002 daniel smith <danielsmith@astroboymail.com> |
42 |
* rewrote/restructured most of file |
* rewrote/restructured most of file |
43 |
* added tooltips (kind of - dirty message hook method) |
* added tooltips (kind of - dirty message hook method) |
64 |
#include "resource.h" |
#include "resource.h" |
65 |
|
|
66 |
|
|
67 |
|
/* registry info structs */ |
68 |
|
|
69 |
|
CONFIG reg; |
70 |
|
|
71 |
|
REG_INT const reg_ints[] = { |
72 |
|
{"mode", ®.mode, DLG_MODE_CBR}, |
73 |
|
{"quality", ®.quality, 85}, |
74 |
|
{"quant", ®.quant, 5}, |
75 |
|
{"rc_bitrate", ®.rc_bitrate, 900000}, |
76 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
77 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
78 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
79 |
|
|
80 |
|
{"motion_search", ®.motion_search, 5}, |
81 |
|
{"quant_type", ®.quant_type, 0}, |
82 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
83 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
84 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
85 |
|
{"lum_masking", ®.lum_masking, 0}, |
86 |
|
{"interlacing", ®.interlacing, 0}, |
87 |
|
|
88 |
|
{"min_iquant", ®.min_iquant, 1}, |
89 |
|
{"max_iquant", ®.max_iquant, 31}, |
90 |
|
{"min_pquant", ®.min_pquant, 1}, |
91 |
|
{"max_pquant", ®.max_pquant, 31}, |
92 |
|
|
93 |
|
{"desired_size", ®.desired_size, 570000}, |
94 |
|
{"keyframe_boost", ®.keyframe_boost, 20}, |
95 |
|
{"discard1pass", ®.discard1pass, 1}, |
96 |
|
{"dummy2pass", ®.dummy2pass, 0}, |
97 |
|
{"curve_compression_high", ®.curve_compression_high, 25}, |
98 |
|
{"curve_compression_low", ®.curve_compression_low, 10}, |
99 |
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
100 |
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
101 |
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 50}, |
102 |
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
103 |
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
104 |
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
105 |
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 300}, |
106 |
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 300}, |
107 |
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
108 |
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 240}, |
109 |
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
110 |
|
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
111 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
112 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
113 |
|
{"hinted_me", ®.hinted_me, 0}, |
114 |
|
|
115 |
|
{"credits_start", ®.credits_start, 0}, |
116 |
|
{"credits_start_begin", ®.credits_start_begin, 0}, |
117 |
|
{"credits_start_end", ®.credits_start_end, 0}, |
118 |
|
{"credits_end", ®.credits_end, 0}, |
119 |
|
{"credits_end_begin", ®.credits_end_begin, 0}, |
120 |
|
{"credits_end_end", ®.credits_end_end, 0}, |
121 |
|
|
122 |
|
{"credits_mode", ®.credits_mode, 0}, |
123 |
|
{"credits_rate", ®.credits_rate, 20}, |
124 |
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
125 |
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
126 |
|
{"credits_start_size", ®.credits_start_size, 10000}, |
127 |
|
{"credits_end_size", ®.credits_end_size, 10000} |
128 |
|
}; |
129 |
|
|
130 |
|
REG_STR const reg_strs[] = { |
131 |
|
{"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
132 |
|
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
133 |
|
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
134 |
|
// {"build", reg.build, XVID_BUILD} |
135 |
|
}; |
136 |
|
|
137 |
/* get config settings from registry */ |
/* get config settings from registry */ |
138 |
|
|
|
#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);} |
|
139 |
#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)));} |
140 |
|
|
141 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
143 |
HKEY hKey; |
HKEY hKey; |
144 |
DWORD size; |
DWORD size; |
145 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
146 |
|
int i; |
147 |
|
|
148 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = 0; |
149 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
151 |
|
|
152 |
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); |
153 |
|
|
154 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
155 |
REG_GET_N("bitrate", config->bitrate, 900000); |
{ |
156 |
REG_GET_N("quality", config->quality, 85); |
size = sizeof(int); |
157 |
REG_GET_N("quant", config->quant, 5); |
|
158 |
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) |
159 |
|
{ |
160 |
REG_GET_N("motion_search", config->motion_search, 5); |
*reg_ints[i].config_int = reg_ints[i].def; |
161 |
REG_GET_N("quant_type", config->quant_type, 0); |
} |
162 |
REG_GET_N("fourcc_used", config->fourcc_used, 0); |
} |
163 |
REG_GET_N("max_key_interval", config->max_key_interval, 300); |
|
164 |
REG_GET_N("lum_masking", config->lum_masking, 0); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
165 |
|
{ |
166 |
REG_GET_N("min_iquant", config->min_iquant, 1); |
size = MAX_PATH; |
167 |
REG_GET_N("max_iquant", config->max_iquant, 31); |
|
168 |
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) |
169 |
REG_GET_N("max_pquant", config->max_pquant, 31); |
{ |
170 |
|
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
171 |
REG_GET_N("desired_size", config->desired_size, 570000); |
} |
172 |
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); |
|
173 |
|
|
174 |
{ |
{ |
175 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
194 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
195 |
}; |
}; |
196 |
|
|
197 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
198 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
199 |
} |
} |
200 |
|
|
201 |
|
memcpy(config, ®, sizeof(CONFIG)); |
202 |
|
|
203 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
204 |
} |
} |
205 |
|
|
206 |
|
|
207 |
/* put config settings in registry */ |
/* put config settings in registry */ |
208 |
|
|
|
#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) |
|
209 |
#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))) |
210 |
|
|
211 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
212 |
{ |
{ |
213 |
HKEY hKey; |
HKEY hKey; |
214 |
DWORD dispo; |
DWORD dispo; |
215 |
|
int i; |
216 |
|
|
217 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
218 |
XVID_REG_KEY, |
XVID_REG_KEY, |
229 |
return; |
return; |
230 |
} |
} |
231 |
|
|
232 |
REG_SET_N("mode", config->mode); |
memcpy(®, config, sizeof(CONFIG)); |
233 |
REG_SET_N("bitrate", config->bitrate); |
|
234 |
REG_SET_N("quality", config->quality); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
235 |
REG_SET_N("quant", config->quant); |
{ |
236 |
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)); |
237 |
|
} |
238 |
REG_SET_N("motion_search", config->motion_search); |
|
239 |
REG_SET_N("quant_type", config->quant_type); |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
240 |
REG_SET_N("fourcc_used", config->fourcc_used); |
{ |
241 |
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); |
242 |
REG_SET_N("lum_masking", config->lum_masking); |
} |
243 |
|
|
244 |
REG_SET_N("min_iquant", config->min_iquant); |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
245 |
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); |
|
246 |
|
|
247 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
248 |
} |
} |
260 |
return; |
return; |
261 |
} |
} |
262 |
|
|
263 |
if (RegDeleteKey(XVID_REG_KEY, XVID_REG_CHILD)) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
264 |
{ |
{ |
265 |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
266 |
return; |
return; |
267 |
} |
} |
268 |
|
|
269 |
|
RegCloseKey(hKey); |
270 |
config_reg_get(config); |
config_reg_get(config); |
271 |
|
config_reg_set(config); |
272 |
} |
} |
273 |
|
|
274 |
|
|
292 |
{ |
{ |
293 |
default : |
default : |
294 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
295 |
config->bitrate = config_get_int(hDlg, IDC_VALUE, config->bitrate) * CONFIG_KBPS; |
config->rc_bitrate = config_get_int(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
296 |
break; |
break; |
297 |
|
|
298 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
309 |
} |
} |
310 |
|
|
311 |
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); |
|
312 |
} |
} |
313 |
|
|
314 |
|
|
327 |
|
|
328 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
329 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
330 |
value = config->bitrate / CONFIG_KBPS; |
value = config->rc_bitrate / CONFIG_KBPS; |
331 |
break; |
break; |
332 |
|
|
333 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
351 |
|
|
352 |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
353 |
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)); |
|
354 |
} |
} |
355 |
|
|
356 |
|
|
371 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
372 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
373 |
range = MAKELONG(0,10000); |
range = MAKELONG(0,10000); |
374 |
pos = config->bitrate / CONFIG_KBPS; |
pos = config->rc_bitrate / CONFIG_KBPS; |
375 |
break; |
break; |
376 |
|
|
377 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
425 |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
426 |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
427 |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
428 |
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
429 |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
430 |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
431 |
|
|
453 |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
454 |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
455 |
|
|
456 |
|
#define MOD_CBR |
457 |
|
|
458 |
void adv_mode(HWND hDlg, int mode) |
void adv_mode(HWND hDlg, int mode) |
459 |
{ |
{ |
460 |
// create arrays of controls to be disabled for each mode |
// create arrays of controls to be disabled for each mode |
461 |
const int cbr_disable[] = { |
const int cbr_disable[] = { |
462 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_KFBOOST, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
463 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
464 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
465 |
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, |
470 |
}; |
}; |
471 |
|
|
472 |
const int qual_disable[] = { |
const int qual_disable[] = { |
473 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
474 |
|
IDC_KFBOOST, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
475 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
476 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
477 |
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 |
478 |
}; |
}; |
479 |
|
|
480 |
const int quant_disable[] = { |
const int quant_disable[] = { |
481 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
482 |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
483 |
IDC_KFBOOST, IDC_MINKEY, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
IDC_KFBOOST, IDC_DISCARD1PASS, IDC_DUMMY2PASS, |
484 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
485 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_STATS2, IDC_STATS2_BROWSE, |
486 |
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 |
487 |
}; |
}; |
488 |
|
|
489 |
const int twopass1_disable[] = { |
const int twopass1_disable[] = { |
490 |
IDC_LUMMASK, IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
491 |
|
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
492 |
IDC_KFBOOST, IDC_DUMMY2PASS, |
IDC_KFBOOST, IDC_DUMMY2PASS, |
493 |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
494 |
IDC_STATS2, IDC_STATS2_BROWSE, |
IDC_STATS2, IDC_STATS2_BROWSE, |
497 |
}; |
}; |
498 |
|
|
499 |
const int twopass2_ext_disable[] = { |
const int twopass2_ext_disable[] = { |
500 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
501 |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, |
502 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
503 |
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 |
504 |
}; |
}; |
505 |
|
|
506 |
const int twopass2_int_disable[] = { |
const int twopass2_int_disable[] = { |
507 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
508 |
IDC_STATS2, IDC_STATS2_BROWSE |
IDC_STATS2, IDC_STATS2_BROWSE |
509 |
}; |
}; |
510 |
|
|
524 |
int i; |
int i; |
525 |
|
|
526 |
// first perform checkbox-based enable/disable |
// first perform checkbox-based enable/disable |
527 |
|
CONTROLDLG(IDC_HINTFILE, ISDLGSET(IDC_HINTEDME)); |
528 |
|
CONTROLDLG(IDC_HINT_BROWSE, ISDLGSET(IDC_HINTEDME)); |
529 |
|
|
530 |
|
CONTROLDLG(IDC_USEAUTO, ISDLGSET(IDC_USEALT)); |
531 |
|
CONTROLDLG(IDC_AUTOSTR, ISDLGSET(IDC_USEALT) && ISDLGSET(IDC_USEAUTO)); |
532 |
|
CONTROLDLG(IDC_USEAUTOBONUS, ISDLGSET(IDC_USEALT)); |
533 |
|
CONTROLDLG(IDC_BONUSBIAS, (ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTOBONUS)))); |
534 |
|
CONTROLDLG(IDC_CURVETYPE, ISDLGSET(IDC_USEALT)); |
535 |
|
CONTROLDLG(IDC_ALTCURVEHIGH, ISDLGSET(IDC_USEALT)); |
536 |
|
CONTROLDLG(IDC_ALTCURVELOW, ISDLGSET(IDC_USEALT)); |
537 |
|
CONTROLDLG(IDC_MINQUAL, ISDLGSET(IDC_USEALT) && !(ISDLGSET(IDC_USEAUTO))); |
538 |
|
|
539 |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_CREDITS_START_BEGIN, ISDLGSET(IDC_CREDITS_START)); |
540 |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
CONTROLDLG(IDC_CREDITS_START_END, ISDLGSET(IDC_CREDITS_START)); |
541 |
|
|
574 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
575 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
576 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
577 |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
578 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
579 |
|
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
580 |
break; |
break; |
581 |
|
|
582 |
case DLG_QUANT : |
case DLG_QUANT : |
588 |
|
|
589 |
case DLG_2PASS : |
case DLG_2PASS : |
590 |
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); |
|
591 |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
592 |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
593 |
|
|
597 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
598 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
599 |
|
|
600 |
|
CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
601 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); |
602 |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
603 |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
604 |
break; |
break; |
605 |
|
|
606 |
|
case DLG_2PASSALT : |
607 |
|
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
608 |
|
|
609 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
610 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
611 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
612 |
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
613 |
|
|
614 |
|
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
615 |
|
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
616 |
|
|
617 |
|
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
618 |
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
619 |
|
|
620 |
|
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
621 |
|
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
622 |
|
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
623 |
|
break; |
624 |
|
|
625 |
case DLG_CREDITS : |
case DLG_CREDITS : |
626 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
627 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
660 |
|
|
661 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
662 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
663 |
|
|
664 |
|
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
665 |
|
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
666 |
|
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
667 |
break; |
break; |
668 |
} |
} |
669 |
} |
} |
684 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
685 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
686 |
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
687 |
|
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->min_key_interval); |
688 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
689 |
|
config->interlacing = ISDLGSET(IDC_INTERLACING); |
690 |
break; |
break; |
691 |
|
|
692 |
case DLG_QUANT : |
case DLG_QUANT : |
703 |
|
|
704 |
case DLG_2PASS : |
case DLG_2PASS : |
705 |
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); |
|
706 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
707 |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
708 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
709 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
710 |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
711 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
712 |
|
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
713 |
|
|
714 |
|
if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
715 |
|
{ |
716 |
|
lstrcpy(config->hintfile, CONFIG_HINTFILE); |
717 |
|
} |
718 |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
719 |
{ |
{ |
720 |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
730 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
731 |
break; |
break; |
732 |
|
|
733 |
|
case DLG_2PASSALT : |
734 |
|
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
735 |
|
|
736 |
|
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
737 |
|
config->alt_curve_auto_str = config_get_int(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
738 |
|
|
739 |
|
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
740 |
|
config->alt_curve_bonus_bias = config_get_int(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
741 |
|
|
742 |
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
743 |
|
config->alt_curve_high_dist = config_get_int(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
744 |
|
config->alt_curve_low_dist = config_get_int(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
745 |
|
config->alt_curve_min_rel_qual = config_get_int(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
746 |
|
|
747 |
|
config->twopass_max_bitrate /= CONFIG_KBPS; |
748 |
|
config->twopass_max_bitrate = config_get_int(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
749 |
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
750 |
|
config->twopass_max_overflow_improvement = config_get_int(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
751 |
|
config->twopass_max_overflow_degradation = config_get_int(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
752 |
|
|
753 |
|
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
754 |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
755 |
|
break; |
756 |
|
|
757 |
case DLG_CREDITS : |
case DLG_CREDITS : |
758 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
759 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
798 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
799 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
800 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
801 |
|
|
802 |
|
config->rc_reaction_delay_factor = config_get_int(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
803 |
|
config->rc_averaging_period = config_get_int(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
804 |
|
config->rc_buffer = config_get_int(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
805 |
break; |
break; |
806 |
} |
} |
807 |
} |
} |
837 |
} |
} |
838 |
} |
} |
839 |
|
|
|
/* monitor mouse events to dialog controls for help text */ |
|
|
|
|
|
HHOOK hHook; |
|
|
HWND hParent; |
|
840 |
|
|
841 |
LRESULT CALLBACK msg_proc(int nCode, WPARAM wParam, LPARAM lParam) |
/* enumerates child windows, assigns tooltips */ |
|
{ |
|
|
MSG* pmsg = (MSG *)lParam; |
|
842 |
|
|
843 |
if (pmsg->message == WM_MOUSEMOVE) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
844 |
{ |
{ |
|
if (pmsg->hwnd == hParent) |
|
|
{ |
|
|
SetDlgItemText(hParent, IDC_STATIC_HELP, XVID_HELP); |
|
|
} |
|
|
else if (IsChild(hParent, pmsg->hwnd)) |
|
|
{ |
|
|
char *message; |
|
845 |
char help[500]; |
char help[500]; |
846 |
|
|
847 |
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) |
|
848 |
{ |
{ |
849 |
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; |
|
850 |
|
|
851 |
case DLG_MODE_VBR_QUANT : |
ti.cbSize = sizeof(TOOLINFO); |
852 |
message = "Set the fixed quantizer for encoding"; |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
853 |
break; |
ti.hwnd = GetParent(hWnd); |
854 |
} |
ti.uId = (LPARAM)hWnd; |
855 |
lstrcpy(help, message); |
ti.lpszText = help; |
|
} |
|
|
else if (!LoadString(hInst, GetDlgCtrlID(pmsg->hwnd), help, 500)) |
|
|
{ |
|
|
lstrcpy(help, XVID_HELP); |
|
|
} |
|
856 |
|
|
857 |
SetDlgItemText(hParent, IDC_STATIC_HELP, help); |
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
|
} |
|
858 |
} |
} |
859 |
|
|
860 |
return (CallNextHookEx(hHook, nCode, wParam, lParam)); |
return TRUE; |
861 |
} |
} |
862 |
|
|
863 |
|
|
883 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
884 |
|
|
885 |
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()); |
|
886 |
|
|
887 |
main_slider(hDlg, config); |
InitCommonControls(); |
|
main_value(hDlg, config); |
|
|
break; |
|
888 |
|
|
889 |
case WM_ACTIVATE : |
if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
890 |
if (LOWORD(wParam) != WA_INACTIVE) |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
891 |
|
NULL, NULL, hInst, NULL)) |
892 |
{ |
{ |
893 |
hParent = hDlg; |
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
894 |
|
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
895 |
|
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
896 |
|
|
897 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
898 |
} |
} |
|
return 0; |
|
899 |
|
|
900 |
case WM_DESTROY : |
main_slider(hDlg, config); |
901 |
UnhookWindowsHookEx(hHook); |
main_value(hDlg, config); |
902 |
break; |
break; |
903 |
|
|
904 |
case WM_HSCROLL : |
case WM_HSCROLL : |
928 |
config_reg_set(config); |
config_reg_set(config); |
929 |
} |
} |
930 |
} |
} |
931 |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
932 |
|
{ |
933 |
|
config_reg_default(config); |
934 |
|
|
935 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
936 |
|
|
937 |
|
main_slider(hDlg, config); |
938 |
|
main_value(hDlg, config); |
939 |
|
} |
940 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
941 |
{ |
{ |
942 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
1016 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1017 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1018 |
} |
} |
1019 |
|
else if (psi->page == DLG_2PASSALT) |
1020 |
|
{ |
1021 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
1022 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1023 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1024 |
|
} |
1025 |
|
|
1026 |
|
if (hTooltip) |
1027 |
|
{ |
1028 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1029 |
|
} |
1030 |
|
|
|
SetDlgItemText(hDlg, IDC_STATIC_HELP, XVID_HELP); |
|
1031 |
adv_upload(hDlg, psi->page, psi->config); |
adv_upload(hDlg, psi->page, psi->config); |
1032 |
adv_mode(hDlg, psi->config->mode); |
adv_mode(hDlg, psi->config->mode); |
1033 |
break; |
break; |
1037 |
{ |
{ |
1038 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1039 |
{ |
{ |
1040 |
|
case IDC_HINTEDME : |
1041 |
|
case IDC_USEALT : |
1042 |
|
case IDC_USEAUTO : |
1043 |
|
case IDC_USEAUTOBONUS : |
1044 |
case IDC_CREDITS_START : |
case IDC_CREDITS_START : |
1045 |
case IDC_CREDITS_END : |
case IDC_CREDITS_END : |
1046 |
case IDC_CREDITS_RATE_RADIO : |
case IDC_CREDITS_RATE_RADIO : |
1052 |
break; |
break; |
1053 |
} |
} |
1054 |
} |
} |
1055 |
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) |
1056 |
{ |
{ |
1057 |
OPENFILENAME ofn; |
OPENFILENAME ofn; |
1058 |
char tmp[MAX_PATH]; |
char tmp[MAX_PATH]; |
1069 |
ofn.nMaxFile = MAX_PATH; |
ofn.nMaxFile = MAX_PATH; |
1070 |
ofn.Flags = OFN_PATHMUSTEXIST; |
ofn.Flags = OFN_PATHMUSTEXIST; |
1071 |
|
|
1072 |
// display save box for stats1 using 1st-pass |
if (LOWORD(wParam) == IDC_HINT_BROWSE) |
1073 |
if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
{ |
1074 |
|
ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; |
1075 |
|
if (GetOpenFileName(&ofn)) |
1076 |
|
{ |
1077 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, tmp); |
1078 |
|
} |
1079 |
|
} |
1080 |
|
else if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
1081 |
psi->config->mode == DLG_MODE_2PASS_1) |
psi->config->mode == DLG_MODE_2PASS_1) |
1082 |
{ |
{ |
1083 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
1103 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1104 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1105 |
{ |
{ |
|
case PSN_SETACTIVE : |
|
|
hParent = hDlg; |
|
|
break; |
|
|
|
|
1106 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1107 |
/* validate */ |
/* validate */ |
1108 |
adv_download(hDlg, psi->page, psi->config); |
adv_download(hDlg, psi->page, psi->config); |
1138 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
1139 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1140 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
|
break; |
|
1141 |
|
|
1142 |
case WM_ACTIVATE : |
if (hTooltip) |
|
if (LOWORD(wParam) != WA_INACTIVE) |
|
1143 |
{ |
{ |
1144 |
hParent = hDlg; |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1145 |
} |
} |
1146 |
return 0; |
break; |
1147 |
|
|
1148 |
case WM_COMMAND : |
case WM_COMMAND : |
1149 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1187 |
|
|
1188 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1189 |
{ |
{ |
1190 |
DEBUG("Couldn't save quant matrix"); |
DEBUGERR("Couldn't save quant matrix"); |
1191 |
} |
} |
1192 |
else |
else |
1193 |
{ |
{ |
1194 |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
1195 |
{ |
{ |
1196 |
DEBUG("Couldnt write quant matrix"); |
DEBUGERR("Couldnt write quant matrix"); |
1197 |
} |
} |
1198 |
} |
} |
1199 |
|
|
1209 |
|
|
1210 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1211 |
{ |
{ |
1212 |
DEBUG("Couldn't load quant matrix"); |
DEBUGERR("Couldn't load quant matrix"); |
1213 |
} |
} |
1214 |
else |
else |
1215 |
{ |
{ |
1216 |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
1217 |
{ |
{ |
1218 |
DEBUG("Couldnt read quant matrix"); |
DEBUGERR("Couldnt read quant matrix"); |
1219 |
} |
} |
1220 |
else |
else |
1221 |
{ |
{ |
1252 |
HFONT hFont; |
HFONT hFont; |
1253 |
LOGFONT lfData; |
LOGFONT lfData; |
1254 |
|
|
1255 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1256 |
|
|
1257 |
xvid_init(NULL, 0, &init_param, 0); |
xvid_init(NULL, 0, &init_param, 0); |
1258 |
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)); |