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