23 |
* |
* |
24 |
* History: |
* History: |
25 |
* |
* |
26 |
* ... ??? |
* 15.06.2002 added bframes options |
27 |
* 05.03.2002 Version 0.01; Min Chen <chenm001@163.com> |
* 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> |
44 |
|
* rewrote/restructured most of file |
45 |
|
* added tooltips (kind of - dirty message hook method) |
46 |
|
* split tabs into a main dialog / advanced prop sheet |
47 |
|
* advanced controls are now enabled/disabled by mode |
48 |
|
* added modulated quantization, DX50 fourcc |
49 |
|
* 11.03.2002 Min Chen <chenm001@163.com> |
50 |
|
* now get Core Version use xvid_init() |
51 |
|
* 05.03.2002 Min Chen <chenm001@163.com> |
52 |
* Add Core version display to about box |
* Add Core version display to about box |
53 |
* |
* 01.12.2001 inital version; (c)2001 peter ross <pross@xvid.org> |
|
* 01.12.2001 inital version; (c)2001 peter ross <suxen_drol@hotmail.com> |
|
54 |
* |
* |
55 |
*************************************************************************/ |
*************************************************************************/ |
56 |
|
|
57 |
|
|
58 |
#include <windows.h> |
#include <windows.h> |
59 |
|
#include <commctrl.h> |
60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
#ifdef _SMP |
63 |
|
#include <pthread.h> |
64 |
|
#endif |
65 |
|
|
66 |
|
#include <xvid.h> // XviD API |
67 |
|
|
68 |
#include "codec.h" |
#include "codec.h" |
69 |
#include "config.h" |
#include "config.h" |
70 |
#include "resource.h" |
#include "resource.h" |
71 |
#include "xvid.h" // cpu masks |
|
72 |
#include <stdio.h> // sprintf() |
|
73 |
|
|
74 |
|
/* registry info structs */ |
75 |
|
|
76 |
|
CONFIG reg; |
77 |
|
|
78 |
|
REG_INT const reg_ints[] = { |
79 |
|
{"mode", ®.mode, DLG_MODE_CBR}, |
80 |
|
{"quality", ®.quality, 85}, |
81 |
|
{"quant", ®.quant, 5}, |
82 |
|
{"rc_bitrate", ®.rc_bitrate, 900000}, |
83 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
84 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
85 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
86 |
|
|
87 |
|
{"motion_search", ®.motion_search, 6}, |
88 |
|
{"quant_type", ®.quant_type, 0}, |
89 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
90 |
|
{"vhq_mode", ®.vhq_mode, 0}, |
91 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
92 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
93 |
|
{"lum_masking", ®.lum_masking, 0}, |
94 |
|
{"interlacing", ®.interlacing, 0}, |
95 |
|
{"qpel", ®.qpel, 0}, |
96 |
|
{"gmc", ®.gmc, 0}, |
97 |
|
{"chromame", ®.chromame, 0}, |
98 |
|
//added by koepi for gruel's greyscale_mode |
99 |
|
{"greyscale", ®.greyscale, 0}, |
100 |
|
// end of koepi's additions |
101 |
|
{"max_bframes", ®.max_bframes, -1}, |
102 |
|
{"bquant_ratio", ®.bquant_ratio, 150}, |
103 |
|
{"bquant_offset", ®.bquant_offset, 100}, |
104 |
|
{"packed", ®.packed, 0}, |
105 |
|
{"dx50bvop", ®.dx50bvop, 1}, |
106 |
|
{"debug", ®.debug, 0}, |
107 |
|
{"reduced_resolution", ®.reduced_resolution, 0}, |
108 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
109 |
|
|
110 |
|
{"min_iquant", ®.min_iquant, 2}, |
111 |
|
{"max_iquant", ®.max_iquant, 31}, |
112 |
|
{"min_pquant", ®.min_pquant, 2}, |
113 |
|
{"max_pquant", ®.max_pquant, 31}, |
114 |
|
|
115 |
|
{"desired_size", ®.desired_size, 570000}, |
116 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
117 |
|
{"discard1pass", ®.discard1pass, 1}, |
118 |
|
{"dummy2pass", ®.dummy2pass, 0}, |
119 |
|
// added by koepi for new two-pass curve treatment |
120 |
|
{"kftreshold", ®.kftreshold, 10}, |
121 |
|
{"kfreduction", ®.kfreduction, 20}, |
122 |
|
// end of koepi's additions |
123 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
124 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
125 |
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
126 |
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
127 |
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
128 |
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
129 |
|
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
130 |
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
131 |
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
132 |
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, |
133 |
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
134 |
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
135 |
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
136 |
|
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
137 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
138 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
139 |
|
{"hinted_me", ®.hinted_me, 0}, |
140 |
|
|
141 |
|
{"credits_start", ®.credits_start, 0}, |
142 |
|
{"credits_start_begin", ®.credits_start_begin, 0}, |
143 |
|
{"credits_start_end", ®.credits_start_end, 0}, |
144 |
|
{"credits_end", ®.credits_end, 0}, |
145 |
|
{"credits_end_begin", ®.credits_end_begin, 0}, |
146 |
|
{"credits_end_end", ®.credits_end_end, 0}, |
147 |
|
|
148 |
|
// added by koepi for greyscale credits |
149 |
|
{"credits_greyscale", ®.credits_greyscale, 0}, |
150 |
|
// end of koepi's addition |
151 |
|
{"credits_mode", ®.credits_mode, 0}, |
152 |
|
{"credits_rate", ®.credits_rate, 20}, |
153 |
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
154 |
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
155 |
|
{"credits_start_size", ®.credits_start_size, 10000}, |
156 |
|
{"credits_end_size", ®.credits_end_size, 10000}, |
157 |
|
|
158 |
|
/* decoder */ |
159 |
|
{"deblock_y", ®.deblock_y, 0}, |
160 |
|
{"deblock_uv", ®.deblock_uv, 0} |
161 |
|
}; |
162 |
|
|
163 |
|
REG_STR const reg_strs[] = { |
164 |
|
{"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
165 |
|
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
166 |
|
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
167 |
|
// {"build", reg.build, XVID_BUILD} |
168 |
|
}; |
169 |
|
|
170 |
/* get config settings from registry */ |
/* get config settings from registry */ |
171 |
|
|
|
#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);} |
|
172 |
#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)));} |
173 |
|
|
174 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
176 |
HKEY hKey; |
HKEY hKey; |
177 |
DWORD size; |
DWORD size; |
178 |
XVID_INIT_PARAM init_param; |
XVID_INIT_PARAM init_param; |
179 |
|
int i; |
180 |
|
|
181 |
init_param.cpu_flags = 0; |
init_param.cpu_flags = XVID_CPU_CHKONLY; |
182 |
xvid_init(0, 0, &init_param, NULL); |
xvid_init(0, 0, &init_param, NULL); |
183 |
config->cpu = init_param.cpu_flags; |
reg.cpu = init_param.cpu_flags; |
184 |
|
|
185 |
|
#ifdef _SMP |
186 |
|
reg.num_threads = pthread_num_processors_np(); |
187 |
|
#endif |
188 |
|
|
189 |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_SUBKEY, 0, KEY_READ, &hKey); |
RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT "\\" XVID_REG_CHILD, 0, KEY_READ, &hKey); |
190 |
|
|
191 |
|
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
192 |
|
{ |
193 |
|
size = sizeof(int); |
194 |
|
|
195 |
|
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) |
196 |
|
{ |
197 |
|
*reg_ints[i].config_int = reg_ints[i].def; |
198 |
|
} |
199 |
|
} |
200 |
|
|
201 |
REG_GET_N("mode", config->mode, DLG_MODE_CBR) |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
202 |
REG_GET_N("bitrate", config->bitrate, 900000) |
{ |
203 |
REG_GET_N("quality", config->quality, 85) |
size = MAX_PATH; |
|
REG_GET_N("quant", config->quant, 5) |
|
|
|
|
|
REG_GET_S("stats1", config->stats1, CONFIG_2PASS_1_FILE) |
|
|
REG_GET_S("stats2", config->stats2, CONFIG_2PASS_2_FILE) |
|
|
REG_GET_N("discard1pass", config->discard1pass, 1) |
|
|
REG_GET_N("dummy2pass", config->dummy2pass, 0) |
|
|
REG_GET_N("desired_size", config->desired_size, 570000) |
|
|
|
|
|
REG_GET_N("min_iquant", config->min_iquant, 1) |
|
|
REG_GET_N("max_iquant", config->max_iquant, 31) |
|
|
|
|
|
REG_GET_N("keyframe_boost", config->keyframe_boost, 20) |
|
|
REG_GET_N("min_key_interval", config->min_key_interval, 6) |
|
|
REG_GET_N("bitrate_payback_delay", config->bitrate_payback_delay, 240) |
|
|
REG_GET_N("bitrate_payback_method", config->bitrate_payback_method, 0) |
|
|
REG_GET_N("curve_compression_high", config->curve_compression_high, 25) |
|
|
REG_GET_N("curve_compression_low", config->curve_compression_low, 15) |
|
|
|
|
|
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, 10) |
|
|
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) |
|
|
|
|
|
REG_GET_N("motion_search", config->motion_search, 5) |
|
|
REG_GET_N("quant_type", config->quant_type, 0) |
|
|
REG_GET_N("max_key_interval", config->max_key_interval, 300) |
|
|
|
|
|
REG_GET_N("rc_buffersize", config->rc_buffersize, 2048000) |
|
|
|
|
|
REG_GET_N("max_quant", config->max_quant, 31) |
|
|
REG_GET_N("min_quant", config->min_quant, 1) |
|
|
REG_GET_N("lum_masking", config->lum_masking, 0) |
|
204 |
|
|
205 |
REG_GET_N("fourcc_used", config->fourcc_used, 0) |
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) |
206 |
|
{ |
207 |
|
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
208 |
|
} |
209 |
|
} |
210 |
|
|
211 |
{ |
{ |
212 |
BYTE default_qmatrix_intra[] = { |
BYTE default_qmatrix_intra[] = { |
231 |
23,24,25,27,28,30,31,33 |
23,24,25,27,28,30,31,33 |
232 |
}; |
}; |
233 |
|
|
234 |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra) |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
235 |
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter) |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
236 |
} |
} |
237 |
|
|
238 |
|
memcpy(config, ®, sizeof(CONFIG)); |
239 |
|
|
240 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
241 |
} |
} |
242 |
|
|
243 |
|
|
244 |
/* put config settings in registry */ |
/* put config settings in registry */ |
245 |
|
|
|
#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) |
|
246 |
#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))) |
247 |
|
|
248 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
249 |
{ |
{ |
250 |
HKEY hKey; |
HKEY hKey; |
251 |
DWORD dispo; |
DWORD dispo; |
252 |
|
int i; |
253 |
|
|
254 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
255 |
XVID_REG_KEY, |
XVID_REG_KEY, |
256 |
XVID_REG_SUBKEY, |
XVID_REG_PARENT "\\" XVID_REG_CHILD, |
257 |
0, |
0, |
258 |
XVID_REG_CLASS, |
XVID_REG_CLASS, |
259 |
REG_OPTION_NON_VOLATILE, |
REG_OPTION_NON_VOLATILE, |
266 |
return; |
return; |
267 |
} |
} |
268 |
|
|
269 |
REG_SET_N("mode", config->mode); |
memcpy(®, config, sizeof(CONFIG)); |
|
REG_SET_N("bitrate", config->bitrate); |
|
|
REG_SET_N("quality", config->quality); |
|
|
REG_SET_N("quant", config->quant); |
|
|
|
|
|
REG_SET_S("stats1", config->stats1); |
|
|
REG_SET_S("stats2", config->stats2); |
|
|
REG_SET_N("discard1pass", config->discard1pass); |
|
|
REG_SET_N("dummy2pass", config->dummy2pass); |
|
|
REG_SET_N("desired_size", config->desired_size); |
|
|
|
|
|
REG_SET_N("min_iquant", config->min_iquant); |
|
|
REG_SET_N("max_iquant", config->max_iquant); |
|
|
|
|
|
REG_SET_N("keyframe_boost", config->keyframe_boost); |
|
|
REG_SET_N("min_key_interval", config->min_key_interval); |
|
|
REG_SET_N("bitrate_payback_delay", config->bitrate_payback_delay); |
|
|
REG_SET_N("bitrate_payback_method", config->bitrate_payback_method); |
|
|
REG_SET_N("curve_compression_high", config->curve_compression_high); |
|
|
REG_SET_N("curve_compression_low", config->curve_compression_low); |
|
|
|
|
|
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); |
|
|
|
|
|
REG_SET_N("motion_search", config->motion_search); |
|
|
REG_SET_N("quant_type", config->quant_type); |
|
|
REG_SET_N("max_key_interval", config->max_key_interval); |
|
|
|
|
|
REG_SET_N("rc_buffersize", config->rc_buffersize); |
|
|
|
|
|
REG_SET_N("max_quant", config->max_quant); |
|
|
REG_SET_N("min_quant", config->min_quant); |
|
|
REG_SET_N("lum_masking", config->lum_masking); |
|
270 |
|
|
271 |
REG_SET_N("fourcc_used", config->fourcc_used); |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
272 |
|
{ |
273 |
|
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
274 |
|
} |
275 |
|
|
276 |
|
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
277 |
|
{ |
278 |
|
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
279 |
|
} |
280 |
|
|
281 |
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
282 |
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
REG_SET_B("qmatrix_inter", reg.qmatrix_inter); |
283 |
|
|
284 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
285 |
} |
} |
286 |
|
|
287 |
|
|
288 |
/* enable/disable dialog controls based on encoder mode */ |
/* clear XviD registry key, load defaults */ |
|
|
|
|
#define ENABLE(X) EnableWindow(GetDlgItem(hDlg, (X)), TRUE); |
|
|
#define DISABLE(X) EnableWindow(GetDlgItem(hDlg, (X)), FALSE); |
|
|
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
|
289 |
|
|
290 |
void config_mode(HWND hDlg) |
void config_reg_default(CONFIG * config) |
291 |
{ |
{ |
292 |
XVID_INIT_PARAM init_param; |
HKEY hKey; |
|
LONG mode; |
|
|
|
|
|
mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
|
293 |
|
|
294 |
if (mode == DLG_MODE_VBR_QUAL || mode == DLG_MODE_VBR_QUANT || |
if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) |
|
mode == DLG_MODE_2PASS_1 || mode == DLG_MODE_2PASS_2_INT) |
|
|
{ |
|
|
ENABLE(IDC_CREDITS); |
|
|
} |
|
|
else |
|
295 |
{ |
{ |
296 |
DISABLE(IDC_CREDITS); |
DEBUG1("Couldn't open registry key for deletion - ", GetLastError()); |
297 |
|
return; |
298 |
} |
} |
299 |
|
|
300 |
if (mode == DLG_MODE_VBR_QUAL || mode == DLG_MODE_VBR_QUANT || mode == DLG_MODE_CBR) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
|
{ |
|
|
ENABLE(IDC_VALUE_STATIC); |
|
|
ENABLE(IDC_VALUE); |
|
|
ENABLE(IDC_SLIDER_STATIC); |
|
|
ENABLE(IDC_SLIDER); |
|
|
} |
|
|
else |
|
301 |
{ |
{ |
302 |
DISABLE(IDC_VALUE_STATIC); |
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
303 |
DISABLE(IDC_VALUE); |
return; |
|
DISABLE(IDC_SLIDER_STATIC); |
|
|
DISABLE(IDC_SLIDER); |
|
304 |
} |
} |
305 |
|
|
306 |
if (mode == DLG_MODE_2PASS_1 || mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT) |
RegCloseKey(hKey); |
307 |
{ |
config_reg_get(config); |
308 |
ENABLE(IDC_2PASS_STATS1_STATIC); |
config_reg_set(config); |
|
ENABLE(IDC_2PASS_STATS1); |
|
|
ENABLE(IDC_2PASS_STATS1_BROWSE); |
|
|
ENABLE(IDC_2PASS_INT); |
|
|
} |
|
|
else |
|
|
{ |
|
|
DISABLE(IDC_2PASS_STATS1_STATIC); |
|
|
DISABLE(IDC_2PASS_STATS1); |
|
|
DISABLE(IDC_2PASS_STATS1_BROWSE); |
|
|
DISABLE(IDC_2PASS_INT); |
|
309 |
} |
} |
310 |
|
|
|
if (mode == DLG_MODE_2PASS_1) |
|
|
{ |
|
|
ENABLE(IDC_DISCARD1PASS); |
|
|
} |
|
|
else |
|
|
{ |
|
|
DISABLE(IDC_DISCARD1PASS); |
|
|
} |
|
311 |
|
|
312 |
if (mode == DLG_MODE_2PASS_2_EXT) |
/* leaves current config value if dialog item is empty */ |
313 |
{ |
|
314 |
ENABLE(IDC_2PASS_STATS1_STATIC); |
int config_get_int(HWND hDlg, INT item, int config) |
|
ENABLE(IDC_2PASS_STATS2); |
|
|
ENABLE(IDC_2PASS_STATS2_BROWSE); |
|
|
} |
|
|
else |
|
315 |
{ |
{ |
316 |
DISABLE(IDC_2PASS_STATS1_STATIC); |
BOOL success = FALSE; |
|
DISABLE(IDC_2PASS_STATS2); |
|
|
DISABLE(IDC_2PASS_STATS2_BROWSE); |
|
|
} |
|
317 |
|
|
318 |
if (ISDLGSET(IDC_CPU_FORCE)) { |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
|
ENABLE(IDC_CPU_MMX); |
|
|
ENABLE(IDC_CPU_MMXEXT); |
|
|
ENABLE(IDC_CPU_SSE); |
|
|
ENABLE(IDC_CPU_SSE2); |
|
|
ENABLE(IDC_CPU_3DNOW); |
|
|
ENABLE(IDC_CPU_3DNOWEXT); |
|
|
} else { |
|
|
xvid_init(0, 0, &init_param, NULL); |
|
319 |
|
|
320 |
CheckDlgButton(hDlg, IDC_CPU_MMX, init_param.cpu_flags & XVID_CPU_MMX ? BST_CHECKED : BST_UNCHECKED); |
return (success) ? tmp : config; |
|
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, init_param.cpu_flags & XVID_CPU_MMXEXT ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_SSE, init_param.cpu_flags & XVID_CPU_SSE ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, init_param.cpu_flags & XVID_CPU_SSE2 ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, init_param.cpu_flags & XVID_CPU_3DNOW ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, init_param.cpu_flags & XVID_CPU_3DNOWEXT ? BST_CHECKED : BST_UNCHECKED); |
|
|
|
|
|
DISABLE(IDC_CPU_MMX); |
|
|
DISABLE(IDC_CPU_MMXEXT); |
|
|
DISABLE(IDC_CPU_SSE); |
|
|
DISABLE(IDC_CPU_SSE2); |
|
|
DISABLE(IDC_CPU_3DNOW); |
|
|
DISABLE(IDC_CPU_3DNOWEXT); |
|
|
} |
|
321 |
} |
} |
322 |
|
|
323 |
|
|
324 |
/* upload config data into dialog */ |
int config_get_uint(HWND hDlg, UINT item, int config) |
|
|
|
|
void config_upload(HWND hDlg, int page, CONFIG * config) |
|
|
{ |
|
|
switch (page) |
|
325 |
{ |
{ |
326 |
case DLG_MAIN : |
BOOL success = FALSE; |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
|
config_mode(hDlg); |
|
327 |
|
|
328 |
config_slider(hDlg, config); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
config_value(hDlg, config); |
|
329 |
|
|
330 |
SetDlgItemText(hDlg, IDC_2PASS_STATS1, config->stats1); |
return (success) ? tmp : config; |
331 |
SetDlgItemText(hDlg, IDC_2PASS_STATS2, config->stats2); |
} |
|
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
|
|
break; |
|
332 |
|
|
|
case DLG_ADV : |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
|
|
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_SETCURSEL, config->quant_type, 0); |
|
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
|
333 |
|
|
334 |
SetDlgItemInt(hDlg, IDC_MINQ, config->min_quant, FALSE); |
/* downloads data from main dialog */ |
|
SetDlgItemInt(hDlg, IDC_MAXQ, config->max_quant, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
|
335 |
|
|
336 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
void main_download(HWND hDlg, CONFIG * config) |
337 |
|
{ |
338 |
|
switch(config->mode) |
339 |
|
{ |
340 |
|
default : |
341 |
|
case DLG_MODE_CBR : |
342 |
|
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
343 |
break; |
break; |
344 |
|
|
345 |
case DLG_DEBUG : |
case DLG_MODE_VBR_QUAL : |
346 |
SetDlgItemInt(hDlg, IDC_RC_BUFFERSIZE, config->rc_buffersize, FALSE); |
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
|
|
|
|
SetDlgItemInt(hDlg, IDC_IMINQ, config->min_iquant, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_IMAXQ, config->max_iquant, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
|
347 |
break; |
break; |
348 |
|
|
349 |
case DLG_CPU : |
case DLG_MODE_VBR_QUANT : |
350 |
CheckDlgButton(hDlg, IDC_CPU_MMX, config->cpu & XVID_CPU_MMX ? BST_CHECKED : BST_UNCHECKED); |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
351 |
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, config->cpu & XVID_CPU_MMXEXT ? BST_CHECKED : BST_UNCHECKED); |
break; |
|
CheckDlgButton(hDlg, IDC_CPU_SSE, config->cpu & XVID_CPU_SSE ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, config->cpu & XVID_CPU_SSE2 ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, config->cpu & XVID_CPU_3DNOW ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, config->cpu & XVID_CPU_3DNOWEXT ? BST_CHECKED : BST_UNCHECKED); |
|
352 |
|
|
353 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
case DLG_MODE_2PASS_2_INT : |
354 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
355 |
break; |
break; |
356 |
} |
} |
|
} |
|
357 |
|
|
358 |
|
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
359 |
|
} |
360 |
|
|
|
/* download config data from dialog |
|
|
replaces invalid values instead of alerting user for now |
|
|
*/ |
|
361 |
|
|
362 |
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
/* updates the edit box */ |
363 |
|
|
364 |
void config_download(HWND hDlg, int page, CONFIG * config) |
void main_value(HWND hDlg, CONFIG* config) |
365 |
{ |
{ |
366 |
|
char* text; |
367 |
int value; |
int value; |
368 |
|
int enabled = TRUE; |
369 |
|
|
370 |
switch (page) |
switch (config->mode) |
371 |
{ |
{ |
372 |
case DLG_MAIN : |
default : |
373 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
enabled = FALSE; |
|
|
|
|
value = config_get_int(hDlg, IDC_VALUE, 2); |
|
374 |
|
|
375 |
switch (SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_GETRANGEMAX, 0, 0)) |
case DLG_MODE_CBR : |
376 |
{ |
text = "Bitrate (Kbps):"; |
377 |
case 10000 : |
value = config->rc_bitrate / CONFIG_KBPS; |
|
CONSTRAINVAL(value, 1, 10000) |
|
|
config->bitrate = value * CONFIG_KBPS; |
|
378 |
break; |
break; |
379 |
|
|
380 |
case 100 : |
case DLG_MODE_VBR_QUAL : |
381 |
CONSTRAINVAL(value, 0, 100) |
text = "Quality:"; |
382 |
config->quality = value; |
value = config->quality; |
383 |
break; |
break; |
384 |
|
|
385 |
case 31 : |
case DLG_MODE_VBR_QUANT : |
386 |
CONSTRAINVAL(value, 1, 31) |
text = "Quantizer:"; |
387 |
config->quant = value; |
value = config->quant; |
388 |
break; |
break; |
|
} |
|
|
|
|
|
GetDlgItemText(hDlg, IDC_2PASS_STATS1, config->stats1, MAX_PATH); |
|
|
if (config->stats1[0] == '\0') |
|
|
{ |
|
|
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
|
|
} |
|
|
GetDlgItemText(hDlg, IDC_2PASS_STATS2, config->stats2, MAX_PATH); |
|
|
if (config->stats2[0] == '\0') |
|
|
{ |
|
|
lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); |
|
|
} |
|
389 |
|
|
390 |
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
case DLG_MODE_2PASS_2_INT : |
391 |
|
text = "Desired size (Kbtyes):"; |
392 |
|
value = config->desired_size; |
393 |
break; |
break; |
|
|
|
|
case DLG_ADV : |
|
|
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
|
|
config->quant_type = SendDlgItemMessage(hDlg, IDC_QTYPE, CB_GETCURSEL, 0, 0); |
|
|
config->max_key_interval = config_get_int(hDlg, IDC_MAXKEY, config->max_key_interval); |
|
|
|
|
|
config->min_quant = config_get_int(hDlg, IDC_MINQ, config->min_quant); |
|
|
config->max_quant = config_get_int(hDlg, IDC_MAXQ, config->max_quant); |
|
|
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
|
|
|
|
|
CONSTRAINVAL(config->min_quant, 1, 31) |
|
|
CONSTRAINVAL(config->max_quant, 1, 31) |
|
|
if(config->max_quant < config->min_quant) |
|
|
{ |
|
|
config->max_quant = config->min_quant; |
|
394 |
} |
} |
395 |
|
|
396 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
397 |
break; |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
|
|
|
|
case DLG_DEBUG: |
|
|
config->rc_buffersize = config_get_int(hDlg, IDC_RC_BUFFERSIZE, config->rc_buffersize); |
|
|
|
|
|
config->min_iquant = config_get_int(hDlg, IDC_IMINQ, config->min_iquant); |
|
|
config->max_iquant = config_get_int(hDlg, IDC_IMAXQ, config->max_iquant); |
|
|
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
|
|
|
|
|
CONSTRAINVAL(config->min_iquant, 1, 31) |
|
|
CONSTRAINVAL(config->min_iquant, 1, 31) |
|
|
if(config->max_iquant < config->min_iquant) |
|
|
{ |
|
|
config->max_iquant = config->min_iquant; |
|
|
} |
|
|
break; |
|
398 |
|
|
399 |
case DLG_CPU : |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
400 |
config->cpu = 0; |
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
|
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
|
|
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
|
|
break; |
|
|
} |
|
401 |
} |
} |
402 |
|
|
403 |
|
|
404 |
/* updates the slider */ |
/* updates the slider */ |
405 |
|
|
406 |
void config_slider(HWND hDlg, CONFIG* config) |
void main_slider(HWND hDlg, CONFIG * config) |
407 |
{ |
{ |
408 |
char* text; |
char* text; |
409 |
long range; |
long range; |
410 |
int pos; |
int pos; |
411 |
|
int enabled = TRUE; |
412 |
|
|
413 |
switch (config->mode) |
switch (config->mode) |
414 |
{ |
{ |
415 |
default : |
default : |
416 |
|
enabled = FALSE; |
417 |
|
|
418 |
case DLG_MODE_CBR : |
case DLG_MODE_CBR : |
419 |
text = "Bitrate (Kbps):"; |
text = "Bitrate (Kbps):"; |
420 |
range = MAKELONG(0,10000); |
range = MAKELONG(0,10000); |
421 |
pos = config->bitrate / CONFIG_KBPS; |
pos = config->rc_bitrate / CONFIG_KBPS; |
422 |
break; |
break; |
423 |
|
|
424 |
case DLG_MODE_VBR_QUAL : |
case DLG_MODE_VBR_QUAL : |
437 |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
438 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
439 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
440 |
|
|
441 |
|
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); |
442 |
|
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); |
443 |
} |
} |
444 |
|
|
445 |
|
|
446 |
/* updates the edit box */ |
/* load advanced options property sheet */ |
447 |
|
|
448 |
void config_value(HWND hDlg, CONFIG* config) |
void adv_dialog(HWND hParent, CONFIG * config) |
449 |
{ |
{ |
450 |
char* text; |
PROPSHEETINFO psi[DLG_COUNT]; |
451 |
int value; |
PROPSHEETPAGE psp[DLG_COUNT]; |
452 |
|
PROPSHEETHEADER psh; |
453 |
|
CONFIG temp; |
454 |
|
int i; |
455 |
|
|
456 |
switch (config->mode) |
config->save = FALSE; |
457 |
{ |
memcpy(&temp, config, sizeof(CONFIG)); |
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
text = "Bitrate (Kbps):"; |
|
|
value = config->bitrate / CONFIG_KBPS; |
|
|
break; |
|
458 |
|
|
459 |
case DLG_MODE_VBR_QUAL : |
for (i=0 ; i<DLG_COUNT ; ++i) |
460 |
text = "Quality:"; |
{ |
461 |
value = config->quality; |
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
462 |
break; |
psp[i].dwFlags = 0; |
463 |
|
psp[i].hInstance = hInst; |
464 |
|
psp[i].pfnDlgProc = adv_proc; |
465 |
|
psp[i].lParam = (LPARAM)&psi[i]; |
466 |
|
psp[i].pfnCallback = NULL; |
467 |
|
|
468 |
case DLG_MODE_VBR_QUANT : |
psi[i].page = i; |
469 |
text = "Quantizer:"; |
psi[i].config = &temp; |
|
value = config->quant; |
|
|
break; |
|
470 |
} |
} |
471 |
|
|
472 |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
473 |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
474 |
} |
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
475 |
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
476 |
|
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
477 |
|
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
478 |
|
|
479 |
|
psh.dwSize = sizeof(PROPSHEETHEADER); |
480 |
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
481 |
|
psh.hwndParent = hParent; |
482 |
|
psh.hInstance = hInst; |
483 |
|
psh.pszCaption = (LPSTR) "XviD Configuration"; |
484 |
|
psh.nPages = DLG_COUNT; |
485 |
|
psh.nStartPage = DLG_GLOBAL; |
486 |
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
487 |
|
psh.pfnCallback = NULL; |
488 |
|
|
489 |
/* leaves current config value if dialog item is empty */ |
PropertySheet(&psh); |
490 |
|
|
491 |
int config_get_int(HWND hDlg, UINT item, int config) |
if (temp.save) |
492 |
{ |
{ |
493 |
BOOL success = FALSE; |
memcpy(config, &temp, sizeof(CONFIG)); |
|
|
|
|
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
|
|
|
|
if(success) { |
|
|
return tmp; |
|
|
} else { |
|
|
return config; |
|
494 |
} |
} |
495 |
} |
} |
496 |
|
|
497 |
|
|
498 |
/* configure credits dialog controls */ |
/* enable/disable advanced controls based on encoder mode */ |
499 |
|
|
500 |
void credits_controls(HWND hDlg) |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
501 |
|
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
502 |
|
|
503 |
|
#define MOD_CBR |
504 |
|
|
505 |
|
void adv_mode(HWND hDlg, int mode) |
506 |
{ |
{ |
507 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_BEGIN), ISDLGSET(IDC_CREDITS_START)); |
// create arrays of controls to be disabled for each mode |
508 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_END), ISDLGSET(IDC_CREDITS_START)); |
const short twopass_disable[] = { |
509 |
|
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
510 |
|
// added by koepi for new curve treatment |
511 |
|
IDC_KFTRESHOLD, IDC_KFREDUCTION, |
512 |
|
//end of koepi's additions |
513 |
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
514 |
|
IDC_STATS2, IDC_STATS2_BROWSE, |
515 |
|
}; |
516 |
|
|
517 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_BEGIN), ISDLGSET(IDC_CREDITS_END)); |
const short cbr_disable[] = { |
518 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_END), ISDLGSET(IDC_CREDITS_END)); |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
519 |
|
IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
520 |
|
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
521 |
|
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
522 |
|
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
523 |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, IDC_CREDITS_GREYSCALE, IDC_HINTFILE |
524 |
|
}; |
525 |
|
|
526 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_RATE), ISDLGSET(IDC_CREDITS_RATE_RADIO)); |
const short qual_disable[] = { |
527 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_QUANTI), ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
528 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_QUANTP), ISDLGSET(IDC_CREDITS_QUANT_RADIO)); |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
529 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_START_SIZE), ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
530 |
EnableWindow(GetDlgItem(hDlg, IDC_CREDITS_END_SIZE), ISDLGSET(IDC_CREDITS_SIZE_RADIO)); |
IDC_HINTFILE |
531 |
} |
}; |
532 |
|
|
533 |
|
const short quant_disable[] = { |
534 |
|
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
535 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
536 |
|
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
537 |
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
538 |
|
IDC_HINTFILE |
539 |
|
}; |
540 |
|
|
541 |
void quant_upload(HWND hDlg, CONFIG* config) |
const short twopass1_disable[] = { |
542 |
{ |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
543 |
int i; |
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
544 |
|
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
545 |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
546 |
|
}; |
547 |
|
|
548 |
for (i=0 ; i<64 ; ++i) |
const short twopass2_ext_disable[] = { |
549 |
{ |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
550 |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
IDC_CREDITS_RATE_RADIO, |
551 |
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
552 |
} |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
553 |
} |
}; |
554 |
|
|
555 |
|
const short twopass2_int_disable[] = { |
556 |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
557 |
|
IDC_STATS2, IDC_STATS2_BROWSE |
558 |
|
}; |
559 |
|
|
560 |
void quant_download(HWND hDlg, CONFIG* config) |
// store pointers in order so we can lookup using config->mode |
561 |
{ |
const short* modes[] = { |
562 |
int i; |
cbr_disable, qual_disable, quant_disable, |
563 |
|
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
564 |
|
}; |
565 |
|
|
566 |
for (i=0 ; i<64 ; ++i) |
// ditto modes[] |
567 |
|
const int lengths[] = { |
568 |
|
sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
569 |
|
sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), |
570 |
|
sizeof(twopass2_ext_disable)/sizeof(short), sizeof(twopass2_int_disable)/sizeof(short), 0 |
571 |
|
}; |
572 |
|
|
573 |
|
int i; |
574 |
|
int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
575 |
|
int credits_start, credits_end, credits_rate, credits_quant, credits_size; |
576 |
|
int cpu_force; |
577 |
|
|
578 |
|
// first perform checkbox-based enable/disable |
579 |
|
hinted_me = ISDLGSET(IDC_HINTEDME); |
580 |
|
CONTROLDLG(IDC_HINTFILE, hinted_me); |
581 |
|
CONTROLDLG(IDC_HINT_BROWSE, hinted_me); |
582 |
|
|
583 |
|
use_alt = ISDLGSET(IDC_USEALT) && (mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT); |
584 |
|
use_alt_auto = ISDLGSET(IDC_USEAUTO); |
585 |
|
use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); |
586 |
|
CONTROLDLG(IDC_USEAUTO, use_alt); |
587 |
|
CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); |
588 |
|
CONTROLDLG(IDC_USEAUTOBONUS, use_alt); |
589 |
|
CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
590 |
|
CONTROLDLG(IDC_CURVETYPE, use_alt); |
591 |
|
CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); |
592 |
|
CONTROLDLG(IDC_ALTCURVELOW, use_alt); |
593 |
|
CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); |
594 |
|
|
595 |
|
credits_start = ISDLGSET(IDC_CREDITS_START); |
596 |
|
CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); |
597 |
|
CONTROLDLG(IDC_CREDITS_START_END, credits_start); |
598 |
|
|
599 |
|
credits_end = ISDLGSET(IDC_CREDITS_END); |
600 |
|
CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); |
601 |
|
CONTROLDLG(IDC_CREDITS_END_END, credits_end); |
602 |
|
|
603 |
|
credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); |
604 |
|
credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); |
605 |
|
credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); |
606 |
|
CONTROLDLG(IDC_CREDITS_RATE, credits_rate); |
607 |
|
CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); |
608 |
|
CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); |
609 |
|
CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); |
610 |
|
CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); |
611 |
|
|
612 |
|
cpu_force = ISDLGSET(IDC_CPU_FORCE); |
613 |
|
CONTROLDLG(IDC_CPU_MMX, cpu_force); |
614 |
|
CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); |
615 |
|
CONTROLDLG(IDC_CPU_SSE, cpu_force); |
616 |
|
CONTROLDLG(IDC_CPU_SSE2, cpu_force); |
617 |
|
CONTROLDLG(IDC_CPU_3DNOW, cpu_force); |
618 |
|
CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); |
619 |
|
|
620 |
|
// now perform codec mode enable/disable |
621 |
|
for (i=0 ; i<lengths[mode] ; ++i) |
622 |
{ |
{ |
623 |
config->qmatrix_intra[i] = config_get_int(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
624 |
CONSTRAINVAL(config->qmatrix_intra[i], 1, 255) |
} |
625 |
|
|
626 |
config->qmatrix_inter[i] = config_get_int(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) |
627 |
CONSTRAINVAL(config->qmatrix_inter[i], 1, 255) |
{ |
628 |
|
for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) |
629 |
|
{ |
630 |
|
EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); |
631 |
|
} |
632 |
} |
} |
633 |
} |
} |
634 |
|
|
635 |
|
|
636 |
/* dialog proc */ |
/* upload config data into dialog */ |
637 |
|
|
638 |
BOOL CALLBACK config_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
void adv_upload(HWND hDlg, int page, CONFIG * config) |
639 |
{ |
{ |
640 |
PROPSHEETINFO *psi; |
switch (page) |
|
|
|
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
|
|
|
|
|
switch (uMsg) |
|
641 |
{ |
{ |
642 |
case WM_INITDIALOG : |
case DLG_GLOBAL : |
643 |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
644 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
645 |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
646 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
647 |
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
648 |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
649 |
|
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
650 |
|
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
651 |
|
|
652 |
switch (psi->page) |
CheckDlgButton(hDlg, IDC_QPEL, config->qpel ? BST_CHECKED : BST_UNCHECKED); |
653 |
{ |
CheckDlgButton(hDlg, IDC_GMC, config->gmc ? BST_CHECKED : BST_UNCHECKED); |
654 |
case DLG_MAIN : |
CheckDlgButton(hDlg, IDC_CHROMAME, config->chromame ? BST_CHECKED : BST_UNCHECKED); |
655 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
// added by koepi for gruel's greyscale_mode |
656 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
657 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
// end of koepi's addition |
658 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
659 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
660 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
SetDlgItemInt(hDlg, IDC_BQUANTOFFSET, config->bquant_offset, FALSE); |
661 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
662 |
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
663 |
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
664 |
|
|
665 |
|
CheckDlgButton(hDlg, IDC_REDUCED, config->reduced_resolution ? BST_CHECKED : BST_UNCHECKED); |
666 |
|
break; |
667 |
|
|
668 |
|
case DLG_QUANT : |
669 |
|
SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); |
670 |
|
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
671 |
|
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
672 |
|
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
673 |
break; |
break; |
674 |
|
|
675 |
case DLG_ADV : |
case DLG_2PASS : |
676 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
677 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
678 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
679 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
// added by koepi for new 2pass curve treatment |
680 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
681 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
682 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
// end of koepi's additions |
683 |
|
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
684 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
685 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
686 |
SendDlgItemMessage(hDlg, IDC_QTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
687 |
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
688 |
|
|
689 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
690 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); |
691 |
|
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
692 |
|
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
693 |
break; |
break; |
694 |
|
|
695 |
case DLG_ABOUT : |
case DLG_2PASSALT : |
696 |
{ |
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
|
HFONT hFont; |
|
|
LOGFONT lfData; |
|
697 |
|
|
698 |
SetDlgItemText(hDlg, IDC_BUILD, __TIME__ ", " __DATE__); |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
699 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
700 |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
701 |
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
702 |
|
|
703 |
// |
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
704 |
{ |
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
|
char chTemp[64]; |
|
|
sprintf(chTemp,"Core Version %d.%d",(API_VERSION>>16),(API_VERSION&0xFFFFU)); |
|
|
SetDlgItemText(hDlg, IDC_CORE_VERSION, chTemp); |
|
|
} |
|
705 |
|
|
706 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
707 |
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
708 |
|
|
709 |
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
710 |
{ |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
711 |
lfData.lfUnderline = 1; |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
712 |
|
break; |
713 |
|
|
714 |
hFont = CreateFontIndirect(&lfData); |
case DLG_CREDITS : |
715 |
if (hFont) |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
716 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
717 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
718 |
|
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
719 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
720 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
721 |
|
|
722 |
|
// added by koepi for credits greyscale |
723 |
|
CheckDlgButton(hDlg, IDC_CREDITS_GREYSCALE, config->credits_greyscale ? BST_CHECKED : BST_UNCHECKED); |
724 |
|
// end of koepi's addition |
725 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
726 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
727 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
728 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); |
729 |
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); |
730 |
|
|
731 |
|
if (config->credits_mode == CREDITS_MODE_RATE) |
732 |
{ |
{ |
733 |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
734 |
|
} |
735 |
|
else if (config->credits_mode == CREDITS_MODE_QUANT) |
736 |
|
{ |
737 |
|
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
738 |
} |
} |
739 |
|
else // CREDITS_MODE_SIZE |
740 |
|
{ |
741 |
|
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
742 |
} |
} |
743 |
|
break; |
744 |
|
|
745 |
SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
case DLG_CPU : |
746 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); |
747 |
|
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); |
748 |
|
CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); |
749 |
|
CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); |
750 |
|
CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); |
751 |
|
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); |
752 |
|
|
753 |
|
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
754 |
|
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
755 |
|
|
756 |
|
#ifdef _SMP |
757 |
|
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
758 |
|
#endif |
759 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
760 |
|
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
761 |
|
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
762 |
|
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
763 |
|
break; |
764 |
} |
} |
765 |
} |
} |
766 |
|
|
|
config_upload(hDlg, psi->page, psi->config); |
|
|
config_mode(hDlg); |
|
|
break; |
|
767 |
|
|
768 |
case WM_CTLCOLORSTATIC : |
/* download config data from dialog |
769 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
replaces invalid values instead of alerting user for now |
770 |
|
*/ |
771 |
|
|
772 |
|
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
773 |
|
|
774 |
|
void adv_download(HWND hDlg, int page, CONFIG * config) |
775 |
{ |
{ |
776 |
SetBkMode((HDC)wParam, TRANSPARENT) ; |
switch (page) |
777 |
SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); |
{ |
778 |
return (BOOL)GetStockObject(NULL_BRUSH); |
case DLG_GLOBAL : |
779 |
} |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
780 |
return FALSE; |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
781 |
|
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
782 |
|
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
783 |
|
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
784 |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
785 |
|
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
786 |
|
config->interlacing = ISDLGSET(IDC_INTERLACING); |
787 |
|
|
788 |
case WM_COMMAND : |
config->qpel = ISDLGSET(IDC_QPEL); |
789 |
if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) |
config->gmc = ISDLGSET(IDC_GMC); |
790 |
|
config->chromame = ISDLGSET(IDC_CHROMAME); |
791 |
|
// added by koepi for gruel's greyscale_mode |
792 |
|
config->greyscale = ISDLGSET(IDC_GREYSCALE); |
793 |
|
// end of koepi's addition |
794 |
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
795 |
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
796 |
|
config->bquant_offset = config_get_uint(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
797 |
|
config->packed = ISDLGSET(IDC_PACKED); |
798 |
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
799 |
|
config->debug = ISDLGSET(IDC_DEBUG); |
800 |
|
config->reduced_resolution = ISDLGSET(IDC_REDUCED); |
801 |
|
break; |
802 |
|
|
803 |
|
case DLG_QUANT : |
804 |
|
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
805 |
|
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
806 |
|
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
807 |
|
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
808 |
|
|
809 |
|
CONSTRAINVAL(config->min_iquant, 1, 31); |
810 |
|
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
811 |
|
CONSTRAINVAL(config->min_pquant, 1, 31); |
812 |
|
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
813 |
|
break; |
814 |
|
|
815 |
|
case DLG_2PASS : |
816 |
|
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
817 |
|
// added by koepi for the new 2pass curve treatment |
818 |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
819 |
|
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
820 |
|
//end of koepi's additions |
821 |
|
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
822 |
|
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
823 |
|
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
824 |
|
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
825 |
|
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
826 |
|
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
827 |
|
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
828 |
|
|
829 |
|
if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
830 |
{ |
{ |
831 |
config_mode(hDlg); |
lstrcpy(config->hintfile, CONFIG_HINTFILE); |
|
config_download(hDlg, psi->page, psi->config); |
|
|
config_value(hDlg, psi->config); |
|
|
config_slider(hDlg, psi->config); |
|
832 |
} |
} |
833 |
else if ((LOWORD(wParam) == IDC_CPU_AUTO || LOWORD(wParam) == IDC_CPU_FORCE) && HIWORD(wParam) == BN_CLICKED) |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
834 |
{ |
{ |
835 |
config_mode(hDlg); |
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
836 |
} |
} |
837 |
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
if (GetDlgItemText(hDlg, IDC_STATS2, config->stats2, MAX_PATH) == 0) |
838 |
{ |
{ |
839 |
int value = config_get_int(hDlg, IDC_VALUE, 1); |
lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); |
840 |
int max = 1; |
} |
841 |
|
|
842 |
switch (SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0)) |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
843 |
{ |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
844 |
default : |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
845 |
case DLG_MODE_CBR : |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
|
max = 10000; |
|
846 |
break; |
break; |
847 |
|
|
848 |
case DLG_MODE_VBR_QUAL : |
case DLG_2PASSALT : |
849 |
max = 100; |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
|
break; |
|
850 |
|
|
851 |
case DLG_MODE_VBR_QUANT : |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
852 |
max = 31; |
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
853 |
|
|
854 |
|
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
855 |
|
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
856 |
|
|
857 |
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
858 |
|
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
859 |
|
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
860 |
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
861 |
|
|
862 |
|
config->twopass_max_bitrate /= CONFIG_KBPS; |
863 |
|
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
864 |
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
865 |
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
866 |
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
867 |
|
|
868 |
|
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
869 |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
870 |
break; |
break; |
|
} |
|
871 |
|
|
872 |
if (value < 1) |
case DLG_CREDITS : |
873 |
|
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
874 |
|
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
875 |
|
config->credits_start_end = config_get_uint(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
876 |
|
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
877 |
|
config->credits_end_begin = config_get_uint(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
878 |
|
config->credits_end_end = config_get_uint(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
879 |
|
|
880 |
|
// added by koepi for gruel's greyscale_mode |
881 |
|
config->credits_greyscale = ISDLGSET(IDC_CREDITS_GREYSCALE); |
882 |
|
// end of koepi's addition |
883 |
|
config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
884 |
|
config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
885 |
|
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
886 |
|
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
887 |
|
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
888 |
|
|
889 |
|
config->credits_mode = 0; |
890 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
891 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_QUANT_RADIO) ? CREDITS_MODE_QUANT : config->credits_mode; |
892 |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_SIZE_RADIO) ? CREDITS_MODE_SIZE : config->credits_mode; |
893 |
|
|
894 |
|
CONSTRAINVAL(config->credits_rate, 1, 100); |
895 |
|
CONSTRAINVAL(config->credits_quant_i, 1, 31); |
896 |
|
CONSTRAINVAL(config->credits_quant_p, 1, 31); |
897 |
|
|
898 |
|
if (config->credits_start_begin > config->credits_start_end) |
899 |
{ |
{ |
900 |
value = 1; |
config->credits_start_begin = config->credits_start_end; |
901 |
|
config->credits_start = 0; |
902 |
} |
} |
903 |
if (value > max) |
if (config->credits_end_begin > config->credits_end_end) |
904 |
{ |
{ |
905 |
value = max; |
config->credits_end_begin = config->credits_end_end; |
906 |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
config->credits_end = 0; |
907 |
} |
} |
908 |
|
break; |
909 |
|
|
910 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
case DLG_CPU : |
911 |
|
config->cpu = 0; |
912 |
|
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
913 |
|
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
914 |
|
config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; |
915 |
|
config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; |
916 |
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
917 |
|
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
918 |
|
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
919 |
|
|
920 |
|
#ifdef _SMP |
921 |
|
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
922 |
|
#endif |
923 |
|
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
924 |
|
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
925 |
|
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
926 |
|
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
927 |
|
break; |
928 |
|
} |
929 |
} |
} |
|
else if ((LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE || LOWORD(wParam) == IDC_2PASS_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
OPENFILENAME ofn; |
|
|
char tmp[MAX_PATH]; |
|
|
int hComponent = (LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE ? IDC_2PASS_STATS1 : IDC_2PASS_STATS2 ); |
|
930 |
|
|
|
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
|
931 |
|
|
932 |
memset(&ofn, 0, sizeof(OPENFILENAME)); |
void quant_upload(HWND hDlg, CONFIG* config) |
933 |
ofn.lStructSize = sizeof(OPENFILENAME); |
{ |
934 |
|
int i; |
935 |
|
|
936 |
ofn.hwndOwner = hDlg; |
for (i=0 ; i<64 ; ++i) |
937 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
{ |
938 |
ofn.lpstrFile = tmp; |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
939 |
ofn.nMaxFile = MAX_PATH; |
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
940 |
ofn.Flags = OFN_PATHMUSTEXIST; |
} |
941 |
|
} |
942 |
|
|
943 |
// display save box for stats1 using 1st-pass |
|
944 |
if (LOWORD(wParam) == IDC_2PASS_STATS1_BROWSE && |
void quant_download(HWND hDlg, CONFIG* config) |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0) == DLG_MODE_2PASS_1) |
|
945 |
{ |
{ |
946 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
int i; |
947 |
if (GetSaveFileName(&ofn)) |
|
948 |
|
for (i=0 ; i<64 ; ++i) |
949 |
{ |
{ |
950 |
SetDlgItemText(hDlg, hComponent, tmp); |
int temp; |
951 |
|
|
952 |
|
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
953 |
|
CONSTRAINVAL(temp, 1, 255); |
954 |
|
config->qmatrix_intra[i] = temp; |
955 |
|
|
956 |
|
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
957 |
|
CONSTRAINVAL(temp, 1, 255); |
958 |
|
config->qmatrix_inter[i] = temp; |
959 |
} |
} |
960 |
} |
} |
961 |
else |
|
962 |
|
|
963 |
|
/* enumerates child windows, assigns tooltips */ |
964 |
|
|
965 |
|
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
966 |
{ |
{ |
967 |
ofn.Flags |= OFN_FILEMUSTEXIST; |
char help[500]; |
968 |
if (GetOpenFileName(&ofn)) { |
|
969 |
SetDlgItemText(hDlg, hComponent, tmp); |
if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500)) |
970 |
} |
{ |
971 |
|
TOOLINFO ti; |
972 |
|
|
973 |
|
ti.cbSize = sizeof(TOOLINFO); |
974 |
|
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
975 |
|
ti.hwnd = GetParent(hWnd); |
976 |
|
ti.uId = (LPARAM)hWnd; |
977 |
|
ti.lpszText = help; |
978 |
|
|
979 |
|
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
980 |
} |
} |
981 |
|
|
982 |
|
return TRUE; |
983 |
} |
} |
984 |
else if (LOWORD(wParam) == IDC_CREDITS && HIWORD(wParam) == BN_CLICKED) |
|
985 |
|
|
986 |
|
|
987 |
|
/* --- decoder options dialog --- */ |
988 |
|
|
989 |
|
#define DEC_DLG_COUNT 1 |
990 |
|
#define DEC_DLG_POSTPROC 0 |
991 |
|
|
992 |
|
/* decoder dialog: upload config data */ |
993 |
|
|
994 |
|
void dec_upload(HWND hDlg, int page, CONFIG * config) |
995 |
{ |
{ |
996 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_CREDITS), hDlg, credits_proc, (LPARAM)psi->config); |
switch (page) |
|
} |
|
|
else if (LOWORD(wParam) == IDC_2PASS_INT && HIWORD(wParam) == BN_CLICKED) |
|
997 |
{ |
{ |
998 |
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_2PASS), hDlg, twopass_proc, (LPARAM)psi->config); |
case DEC_DLG_POSTPROC : |
999 |
|
CheckDlgButton(hDlg, IDC_DEBLOCK_Y, config->deblock_y ? BST_CHECKED : BST_UNCHECKED); |
1000 |
|
CheckDlgButton(hDlg, IDC_DEBLOCK_UV, config->deblock_uv ? BST_CHECKED : BST_UNCHECKED); |
1001 |
|
break; |
1002 |
} |
} |
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
|
1003 |
} |
} |
1004 |
else if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
|
1005 |
|
|
1006 |
|
/* dec dialog: download config data */ |
1007 |
|
|
1008 |
|
void dec_download(HWND hDlg, int page, CONFIG * config) |
1009 |
{ |
{ |
1010 |
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
switch (page) |
1011 |
} |
{ |
1012 |
|
case DEC_DLG_POSTPROC : |
1013 |
|
config->deblock_y = ISDLGSET(IDC_DEBLOCK_Y); |
1014 |
|
config->deblock_uv = ISDLGSET(IDC_DEBLOCK_UV); |
1015 |
break; |
break; |
1016 |
|
} |
1017 |
|
} |
1018 |
|
|
1019 |
case WM_HSCROLL: |
/* decoder dialog proc */ |
1020 |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
|
1021 |
|
BOOL CALLBACK dec_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1022 |
{ |
{ |
1023 |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
PROPSHEETINFO *psi; |
1024 |
} |
|
1025 |
else |
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
1026 |
|
|
1027 |
|
switch (uMsg) |
1028 |
{ |
{ |
1029 |
return 0; |
case WM_INITDIALOG : |
1030 |
|
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
1031 |
|
|
1032 |
|
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
1033 |
|
|
1034 |
|
if (hTooltip) |
1035 |
|
{ |
1036 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1037 |
} |
} |
1038 |
|
|
1039 |
|
dec_upload(hDlg, psi->page, psi->config); |
1040 |
break; |
break; |
1041 |
|
|
1042 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1044 |
{ |
{ |
1045 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1046 |
/* validate */ |
/* validate */ |
1047 |
config_download(hDlg, psi->page, psi->config); |
dec_download(hDlg, psi->page, psi->config); |
1048 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1049 |
break; |
break; |
1050 |
|
|
1051 |
case PSN_APPLY : |
case PSN_APPLY : |
1052 |
/* apply */ |
/* apply */ |
1053 |
config_download(hDlg, psi->page, psi->config); |
dec_download(hDlg, psi->page, psi->config); |
1054 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
config_reg_set(psi->config); |
|
1055 |
psi->config->save = TRUE; |
psi->config->save = TRUE; |
1056 |
break; |
break; |
1057 |
} |
} |
1065 |
} |
} |
1066 |
|
|
1067 |
|
|
1068 |
/* credits dialog proc */ |
void dec_dialog(HWND hParent, CONFIG * config) |
1069 |
|
{ |
1070 |
|
PROPSHEETINFO psi[DEC_DLG_COUNT]; |
1071 |
|
PROPSHEETPAGE psp[DEC_DLG_COUNT]; |
1072 |
|
PROPSHEETHEADER psh; |
1073 |
|
CONFIG temp; |
1074 |
|
int i; |
1075 |
|
|
1076 |
|
config->save = FALSE; |
1077 |
|
memcpy(&temp, config, sizeof(CONFIG)); |
1078 |
|
|
1079 |
BOOL CALLBACK credits_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
for (i=0 ; i<DEC_DLG_COUNT ; ++i) |
1080 |
|
{ |
1081 |
|
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
1082 |
|
psp[i].dwFlags = 0; |
1083 |
|
psp[i].hInstance = hInst; |
1084 |
|
psp[i].pfnDlgProc = dec_proc; |
1085 |
|
psp[i].lParam = (LPARAM)&psi[i]; |
1086 |
|
psp[i].pfnCallback = NULL; |
1087 |
|
|
1088 |
|
psi[i].page = i; |
1089 |
|
psi[i].config = &temp; |
1090 |
|
} |
1091 |
|
|
1092 |
|
psp[DEC_DLG_POSTPROC].pszTemplate = MAKEINTRESOURCE(IDD_POSTPROC); |
1093 |
|
|
1094 |
|
psh.dwSize = sizeof(PROPSHEETHEADER); |
1095 |
|
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
1096 |
|
psh.hwndParent = hParent; |
1097 |
|
psh.hInstance = hInst; |
1098 |
|
psh.pszCaption = (LPSTR) "XviD Configuration"; |
1099 |
|
psh.nPages = DEC_DLG_COUNT; |
1100 |
|
psh.nStartPage = DEC_DLG_POSTPROC; |
1101 |
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
1102 |
|
psh.pfnCallback = NULL; |
1103 |
|
|
1104 |
|
PropertySheet(&psh); |
1105 |
|
|
1106 |
|
if (temp.save) |
1107 |
|
{ |
1108 |
|
memcpy(config, &temp, sizeof(CONFIG)); |
1109 |
|
} |
1110 |
|
} |
1111 |
|
|
1112 |
|
|
1113 |
|
|
1114 |
|
/* main dialog proc */ |
1115 |
|
|
1116 |
|
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1117 |
{ |
{ |
1118 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
1119 |
|
|
1124 |
|
|
1125 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1126 |
|
|
1127 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
1128 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
1129 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
1130 |
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
1131 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
1132 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
1133 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
1134 |
|
|
1135 |
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size, FALSE); |
|
1136 |
|
|
1137 |
switch (config->credits_mode) |
InitCommonControls(); |
|
{ |
|
|
case CREDITS_MODE_RATE : |
|
|
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
|
|
break; |
|
1138 |
|
|
1139 |
case CREDITS_MODE_QUANT : |
if (hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1140 |
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1141 |
break; |
NULL, NULL, hInst, NULL)) |
1142 |
|
{ |
1143 |
|
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
1144 |
|
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
1145 |
|
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
1146 |
|
|
1147 |
case CREDITS_MODE_SIZE : |
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
|
|
break; |
|
1148 |
} |
} |
1149 |
|
|
1150 |
credits_controls(hDlg); |
main_slider(hDlg, config); |
1151 |
|
main_value(hDlg, config); |
1152 |
break; |
break; |
1153 |
|
|
1154 |
case WM_COMMAND : |
case WM_HSCROLL : |
1155 |
if (LOWORD(wParam) == IDCANCEL) |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
1156 |
{ |
{ |
1157 |
EndDialog(hDlg, IDCANCEL); |
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
1158 |
} |
} |
1159 |
else if (HIWORD(wParam) == BN_CLICKED) |
else |
|
{ |
|
|
switch (LOWORD(wParam)) |
|
1160 |
{ |
{ |
1161 |
case IDC_CREDITS_START : |
return 0; |
1162 |
case IDC_CREDITS_END : |
} |
|
case IDC_CREDITS_RATE_RADIO : |
|
|
case IDC_CREDITS_QUANT_RADIO : |
|
|
case IDC_CREDITS_SIZE_RADIO : |
|
|
credits_controls(hDlg); |
|
1163 |
break; |
break; |
1164 |
|
|
1165 |
case IDOK : |
case WM_COMMAND : |
1166 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) |
1167 |
config->credits_start_begin = config_get_int(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin); |
{ |
1168 |
config->credits_start_end = config_get_int(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
main_download(hDlg, config); |
1169 |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
main_slider(hDlg, config); |
1170 |
config->credits_end_begin = config_get_int(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
main_value(hDlg, config); |
1171 |
config->credits_end_end = config_get_int(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
} |
1172 |
|
else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
1173 |
config->credits_rate = config_get_int(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
{ |
1174 |
config->credits_quant_i = config_get_int(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
adv_dialog(hDlg, config); |
|
config->credits_quant_p = config_get_int(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
|
|
config->credits_start_size = config_get_int(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
|
|
config->credits_end_size = config_get_int(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
|
1175 |
|
|
1176 |
if (ISDLGSET(IDC_CREDITS_RATE_RADIO)) |
if (config->save) |
1177 |
{ |
{ |
1178 |
config->credits_mode = CREDITS_MODE_RATE; |
config_reg_set(config); |
1179 |
|
} |
1180 |
} |
} |
1181 |
if (ISDLGSET(IDC_CREDITS_QUANT_RADIO)) |
else if (LOWORD(wParam) == IDC_DECODER && HIWORD(wParam) == BN_CLICKED) |
1182 |
{ |
{ |
1183 |
config->credits_mode = CREDITS_MODE_QUANT; |
dec_dialog(hDlg, config); |
1184 |
|
|
1185 |
|
if (config->save) |
1186 |
|
{ |
1187 |
|
config_reg_set(config); |
1188 |
|
} |
1189 |
} |
} |
1190 |
if (ISDLGSET(IDC_CREDITS_SIZE_RADIO)) |
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
1191 |
{ |
{ |
1192 |
config->credits_mode = CREDITS_MODE_SIZE; |
config_reg_default(config); |
1193 |
|
|
1194 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1195 |
|
|
1196 |
|
main_slider(hDlg, config); |
1197 |
|
main_value(hDlg, config); |
1198 |
} |
} |
1199 |
|
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
1200 |
|
{ |
1201 |
|
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
1202 |
|
int max = 1; |
1203 |
|
|
1204 |
CONSTRAINVAL(config->credits_rate, 1, 100) |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
1205 |
CONSTRAINVAL(config->credits_quant_i, 1, 31) |
((config->mode == DLG_MODE_VBR_QUAL) ? 100 : |
1206 |
CONSTRAINVAL(config->credits_quant_p, 1, 31) |
((config->mode == DLG_MODE_VBR_QUANT) ? 31 : 1<<30)); |
1207 |
|
|
1208 |
if (config->credits_start_begin > config->credits_start_end) |
if (value < 1) |
1209 |
{ |
{ |
1210 |
config->credits_start_begin = config->credits_start_end; |
value = 1; |
|
config->credits_start = 0; |
|
1211 |
} |
} |
1212 |
if (config->credits_end_begin > config->credits_end_end) |
if (value > max) |
1213 |
{ |
{ |
1214 |
config->credits_end_begin = config->credits_end_end; |
value = max; |
1215 |
config->credits_end = 0; |
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
1216 |
} |
} |
1217 |
|
|
1218 |
|
if (config->mode != DLG_MODE_2PASS_2_INT) |
1219 |
|
{ |
1220 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
1221 |
|
} |
1222 |
|
} |
1223 |
|
else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1224 |
|
{ |
1225 |
|
main_download(hDlg, config); |
1226 |
|
config->save = TRUE; |
1227 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
|
break; |
|
1228 |
} |
} |
1229 |
|
else if (LOWORD(wParam) == IDCANCEL) |
1230 |
|
{ |
1231 |
|
config->save = FALSE; |
1232 |
|
EndDialog(hDlg, IDCANCEL); |
1233 |
} |
} |
1234 |
break; |
break; |
1235 |
|
|
1241 |
} |
} |
1242 |
|
|
1243 |
|
|
1244 |
/* 2-pass dialog proc */ |
/* advanced dialog proc */ |
1245 |
|
|
1246 |
BOOL CALLBACK twopass_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1247 |
{ |
{ |
1248 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
PROPSHEETINFO *psi; |
1249 |
|
|
1250 |
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
1251 |
|
|
1252 |
switch (uMsg) |
switch (uMsg) |
1253 |
{ |
{ |
1254 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1255 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
1256 |
|
|
1257 |
config = (CONFIG*)lParam; |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
1258 |
|
|
1259 |
SetDlgItemInt(hDlg, IDC_DESIRED, config->desired_size, FALSE); |
if (psi->page == DLG_GLOBAL) |
1260 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
{ |
1261 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
1262 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
1263 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
1264 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
1265 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
1266 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
1267 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
1268 |
|
|
1269 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
1270 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
1271 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
1272 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
1273 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"New Modulated HQ"); |
1274 |
|
|
1275 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
1276 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
1277 |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
1278 |
|
|
1279 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"0 - Off"); |
1280 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"1 - Mode Decision"); |
1281 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search"); |
1282 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search"); |
1283 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
1284 |
|
/* XXX: reduced resolution is not ready for prime-time */ |
1285 |
|
ShowWindow(GetDlgItem(hDlg, IDC_REDUCED), SW_HIDE); |
1286 |
|
} |
1287 |
|
else if (psi->page == DLG_2PASSALT) |
1288 |
|
{ |
1289 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
1290 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
1291 |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
1292 |
|
} |
1293 |
|
else if (psi->page == DLG_CPU) |
1294 |
|
{ |
1295 |
|
#ifndef _SMP |
1296 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
1297 |
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
1298 |
|
#endif |
1299 |
|
} |
1300 |
|
|
1301 |
|
if (hTooltip) |
1302 |
|
{ |
1303 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1304 |
|
} |
1305 |
|
|
1306 |
|
adv_upload(hDlg, psi->page, psi->config); |
1307 |
|
adv_mode(hDlg, psi->config->mode); |
1308 |
break; |
break; |
1309 |
|
|
1310 |
case WM_COMMAND : |
case WM_COMMAND : |
1311 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (HIWORD(wParam) == BN_CLICKED) |
1312 |
{ |
{ |
1313 |
config->desired_size = config_get_int(hDlg, IDC_DESIRED, config->desired_size); |
switch (LOWORD(wParam)) |
1314 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
{ |
1315 |
config->min_key_interval = config_get_int(hDlg, IDC_MINKEY, config->max_key_interval); |
case IDC_HINTEDME : |
1316 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
case IDC_USEALT : |
1317 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
case IDC_USEAUTO : |
1318 |
config->bitrate_payback_delay = config_get_int(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
case IDC_USEAUTOBONUS : |
1319 |
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
case IDC_CREDITS_START : |
1320 |
|
case IDC_CREDITS_END : |
1321 |
|
case IDC_CREDITS_RATE_RADIO : |
1322 |
|
case IDC_CREDITS_QUANT_RADIO : |
1323 |
|
case IDC_CREDITS_SIZE_RADIO : |
1324 |
|
case IDC_CPU_AUTO : |
1325 |
|
case IDC_CPU_FORCE : |
1326 |
|
adv_mode(hDlg, psi->config->mode); |
1327 |
|
break; |
1328 |
|
} |
1329 |
|
} |
1330 |
|
if ((LOWORD(wParam) == IDC_HINT_BROWSE || LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
1331 |
|
{ |
1332 |
|
OPENFILENAME ofn; |
1333 |
|
char tmp[MAX_PATH]; |
1334 |
|
int hComponent = (LOWORD(wParam) == IDC_STATS1_BROWSE ? IDC_STATS1 : IDC_STATS2); |
1335 |
|
|
1336 |
|
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
1337 |
|
|
1338 |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000) |
memset(&ofn, 0, sizeof(OPENFILENAME)); |
1339 |
CONSTRAINVAL(config->keyframe_boost, 0, 1000) |
ofn.lStructSize = sizeof(OPENFILENAME); |
|
CONSTRAINVAL(config->curve_compression_high, 0, 100) |
|
|
CONSTRAINVAL(config->curve_compression_low, 0, 100) |
|
1340 |
|
|
1341 |
EndDialog(hDlg, IDOK); |
ofn.hwndOwner = hDlg; |
1342 |
|
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
1343 |
|
ofn.lpstrFile = tmp; |
1344 |
|
ofn.nMaxFile = MAX_PATH; |
1345 |
|
ofn.Flags = OFN_PATHMUSTEXIST; |
1346 |
|
|
1347 |
|
if (LOWORD(wParam) == IDC_HINT_BROWSE) |
1348 |
|
{ |
1349 |
|
ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; |
1350 |
|
if (GetOpenFileName(&ofn)) |
1351 |
|
{ |
1352 |
|
SetDlgItemText(hDlg, IDC_HINTFILE, tmp); |
1353 |
} |
} |
1354 |
else if (LOWORD(wParam) == IDCANCEL) |
} |
1355 |
|
else if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
1356 |
|
psi->config->mode == DLG_MODE_2PASS_1) |
1357 |
{ |
{ |
1358 |
EndDialog(hDlg, IDCANCEL); |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
1359 |
|
if (GetSaveFileName(&ofn)) |
1360 |
|
{ |
1361 |
|
SetDlgItemText(hDlg, hComponent, tmp); |
1362 |
|
} |
1363 |
|
} |
1364 |
|
else |
1365 |
|
{ |
1366 |
|
ofn.Flags |= OFN_FILEMUSTEXIST; |
1367 |
|
if (GetOpenFileName(&ofn)) { |
1368 |
|
SetDlgItemText(hDlg, hComponent, tmp); |
1369 |
|
} |
1370 |
|
} |
1371 |
|
} |
1372 |
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
1373 |
|
{ |
1374 |
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
1375 |
|
} |
1376 |
|
break; |
1377 |
|
|
1378 |
|
case WM_NOTIFY : |
1379 |
|
switch (((NMHDR *)lParam)->code) |
1380 |
|
{ |
1381 |
|
case PSN_KILLACTIVE : |
1382 |
|
/* validate */ |
1383 |
|
adv_download(hDlg, psi->page, psi->config); |
1384 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1385 |
|
break; |
1386 |
|
|
1387 |
|
case PSN_APPLY : |
1388 |
|
/* apply */ |
1389 |
|
adv_download(hDlg, psi->page, psi->config); |
1390 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1391 |
|
psi->config->save = TRUE; |
1392 |
|
break; |
1393 |
} |
} |
1394 |
break; |
break; |
1395 |
|
|
1411 |
{ |
{ |
1412 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1413 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
|
1414 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
|
|
|
1415 |
quant_upload(hDlg, config); |
quant_upload(hDlg, config); |
1416 |
|
|
1417 |
|
if (hTooltip) |
1418 |
|
{ |
1419 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1420 |
|
} |
1421 |
break; |
break; |
1422 |
|
|
1423 |
case WM_COMMAND : |
case WM_COMMAND : |
1424 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
1425 |
{ |
{ |
1426 |
quant_download(hDlg, config); |
quant_download(hDlg, config); |
|
|
|
1427 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
1428 |
} |
} |
1429 |
else if (LOWORD(wParam) == IDCANCEL) |
else if (LOWORD(wParam) == IDCANCEL) |
1462 |
|
|
1463 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1464 |
{ |
{ |
1465 |
DEBUG("Couldn't save quant matrix"); |
DEBUGERR("Couldn't save quant matrix"); |
1466 |
} |
} |
1467 |
else |
else |
1468 |
{ |
{ |
1469 |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
1470 |
{ |
{ |
1471 |
DEBUG("Couldnt write quant matrix"); |
DEBUGERR("Couldnt write quant matrix"); |
1472 |
} |
} |
1473 |
} |
} |
1474 |
|
|
1484 |
|
|
1485 |
if (hFile == INVALID_HANDLE_VALUE) |
if (hFile == INVALID_HANDLE_VALUE) |
1486 |
{ |
{ |
1487 |
DEBUG("Couldn't load quant matrix"); |
DEBUGERR("Couldn't load quant matrix"); |
1488 |
} |
} |
1489 |
else |
else |
1490 |
{ |
{ |
1491 |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
1492 |
{ |
{ |
1493 |
DEBUG("Couldnt read quant matrix"); |
DEBUGERR("Couldnt read quant matrix"); |
1494 |
} |
} |
1495 |
else |
else |
1496 |
{ |
{ |
1512 |
|
|
1513 |
return 1; |
return 1; |
1514 |
} |
} |
1515 |
|
|
1516 |
|
|
1517 |
|
/* about dialog proc */ |
1518 |
|
|
1519 |
|
BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1520 |
|
{ |
1521 |
|
switch (uMsg) |
1522 |
|
{ |
1523 |
|
case WM_INITDIALOG : |
1524 |
|
{ |
1525 |
|
XVID_INIT_PARAM init_param; |
1526 |
|
char core[100]; |
1527 |
|
HFONT hFont; |
1528 |
|
LOGFONT lfData; |
1529 |
|
|
1530 |
|
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1531 |
|
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1532 |
|
|
1533 |
|
init_param.cpu_flags = XVID_CPU_CHKONLY; |
1534 |
|
xvid_init(NULL, 0, &init_param, 0); |
1535 |
|
wsprintf(core, "Core Version %d.%d", (init_param.api_version>>16),(init_param.api_version&0xFFFFU)); |
1536 |
|
SetDlgItemText(hDlg, IDC_CORE, core); |
1537 |
|
|
1538 |
|
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1539 |
|
|
1540 |
|
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
1541 |
|
{ |
1542 |
|
lfData.lfUnderline = 1; |
1543 |
|
|
1544 |
|
hFont = CreateFontIndirect(&lfData); |
1545 |
|
if (hFont) |
1546 |
|
{ |
1547 |
|
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
1548 |
|
} |
1549 |
|
} |
1550 |
|
|
1551 |
|
SetClassLong(GetDlgItem(hDlg, IDC_WEBSITE), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1552 |
|
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1553 |
|
} |
1554 |
|
break; |
1555 |
|
|
1556 |
|
case WM_CTLCOLORSTATIC : |
1557 |
|
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1558 |
|
{ |
1559 |
|
SetBkMode((HDC)wParam, TRANSPARENT) ; |
1560 |
|
SetTextColor((HDC)wParam, RGB(0x00,0x00,0xc0)); |
1561 |
|
return (BOOL)GetStockObject(NULL_BRUSH); |
1562 |
|
} |
1563 |
|
return 0; |
1564 |
|
|
1565 |
|
case WM_COMMAND : |
1566 |
|
if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
1567 |
|
{ |
1568 |
|
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
1569 |
|
} |
1570 |
|
else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) |
1571 |
|
{ |
1572 |
|
EndDialog(hDlg, LOWORD(wParam)); |
1573 |
|
} |
1574 |
|
break; |
1575 |
|
|
1576 |
|
default : |
1577 |
|
return 0; |
1578 |
|
} |
1579 |
|
|
1580 |
|
return 1; |
1581 |
|
} |