60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
|
63 |
#include <xvid.h> // XviD API |
#include <stdio.h> /* sprintf */ |
64 |
|
#include <xvid.h> /* XviD API */ |
65 |
|
|
66 |
#include "codec.h" |
#include "debug.h" |
67 |
#include "config.h" |
#include "config.h" |
68 |
#include "resource.h" |
#include "resource.h" |
69 |
|
|
70 |
|
|
71 |
|
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
72 |
|
#define IsDlgChecked(hwnd,idc) (IsDlgButtonChecked(hwnd,idc) == BST_CHECKED) |
73 |
|
#define CheckDlg(hwnd,idc,value) CheckDlgButton(hwnd,idc, value?BST_CHECKED:BST_UNCHECKED) |
74 |
|
#define EnableDlgWindow(hwnd,idc,state) EnableWindow(GetDlgItem(hwnd,idc),state) |
75 |
|
|
76 |
/* registry info structs */ |
HINSTANCE g_hInst; |
77 |
|
HWND g_hTooltip; |
78 |
|
|
79 |
|
/* enumerates child windows, assigns tooltips */ |
80 |
|
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
81 |
|
{ |
82 |
|
char help[500]; |
83 |
|
|
84 |
|
if (LoadString(g_hInst, GetDlgCtrlID(hWnd), help, 500)) |
85 |
|
{ |
86 |
|
TOOLINFO ti; |
87 |
|
ti.cbSize = sizeof(TOOLINFO); |
88 |
|
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
89 |
|
ti.hwnd = GetParent(hWnd); |
90 |
|
ti.uId = (LPARAM)hWnd; |
91 |
|
ti.lpszText = help; |
92 |
|
SendMessage(g_hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
93 |
|
} |
94 |
|
|
95 |
|
return TRUE; |
96 |
|
} |
97 |
|
|
98 |
|
|
99 |
|
/* ===================================================================================== */ |
100 |
|
/* MPEG-4 PROFILES/LEVELS ============================================================== */ |
101 |
|
/* ===================================================================================== */ |
102 |
|
|
103 |
|
|
104 |
|
|
105 |
|
/* default vbv_occupancy is (64/170)*vbv_buffer_size */ |
106 |
|
|
107 |
|
const profile_t profiles[] = |
108 |
|
{ |
109 |
|
/* name p@l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
110 |
|
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
111 |
|
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
112 |
|
/* if ac preidition is used, adaptive quantization must not be used */ |
113 |
|
/* <=qcif must be used */ |
114 |
|
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
115 |
|
{ "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, |
116 |
|
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
117 |
|
|
118 |
|
{ "ARTS @ L1", 0x91, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 8192, 64, PROFILE_ARTS }, |
119 |
|
{ "ARTS @ L2", 0x92, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 16384, 128, PROFILE_ARTS }, |
120 |
|
{ "ARTS @ L3", 0x93, 352, 288, 30, 4, 792, 396, 11880, 100, 40*16368, 16384, 384, PROFILE_ARTS }, |
121 |
|
{ "ARTS @ L4", 0x94, 352, 288, 30, 16, 792, 396, 11880, 100, 80*16368, 16384, 2000, PROFILE_ARTS }, |
122 |
|
|
123 |
|
{ "AS @ L0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
124 |
|
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
125 |
|
{ "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, |
126 |
|
{ "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, |
127 |
|
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ |
128 |
|
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
129 |
|
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
130 |
|
|
131 |
|
#ifdef DXN_PROFILES |
132 |
|
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
133 |
|
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
134 |
|
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
135 |
|
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
136 |
|
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
137 |
|
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
138 |
|
#endif |
139 |
|
|
140 |
|
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
141 |
|
}; |
142 |
|
|
143 |
|
|
144 |
|
/* ===================================================================================== */ |
145 |
|
/* REGISTRY ============================================================================ */ |
146 |
|
/* ===================================================================================== */ |
147 |
|
|
148 |
|
/* registry info structs */ |
149 |
CONFIG reg; |
CONFIG reg; |
150 |
|
|
151 |
REG_INT const reg_ints[] = { |
static const REG_INT reg_ints[] = { |
152 |
{"mode", ®.mode, DLG_MODE_CBR}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
153 |
{"quality", ®.quality, 85}, |
{"bitrate", ®.bitrate, 700}, |
154 |
{"quant", ®.quant, 5}, |
{"desired_size", ®.desired_size, 570000}, |
155 |
{"rc_bitrate", ®.rc_bitrate, 900000}, |
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
|
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
|
|
{"rc_buffer", ®.rc_buffer, 100}, |
|
156 |
|
|
157 |
{"motion_search", ®.motion_search, 6}, |
/* profile */ |
158 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
|
{"fourcc_used", ®.fourcc_used, 0}, |
|
|
{"vhq_mode", ®.vhq_mode, 0}, |
|
|
{"max_key_interval", ®.max_key_interval, 300}, |
|
|
{"min_key_interval", ®.min_key_interval, 1}, |
|
159 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
160 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
161 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
162 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
|
{"chromame", ®.chromame, 0}, |
|
|
//added by koepi for gruel's greyscale_mode |
|
|
{"greyscale", ®.greyscale, 0}, |
|
|
// end of koepi's additions |
|
|
{"max_bframes", ®.max_bframes, -1}, |
|
|
{"bquant_ratio", ®.bquant_ratio, 150}, |
|
|
{"bquant_offset", ®.bquant_offset, 100}, |
|
|
{"packed", ®.packed, 0}, |
|
|
{"dx50bvop", ®.dx50bvop, 1}, |
|
|
{"debug", ®.debug, 0}, |
|
163 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
164 |
{"chroma_opt", ®.chroma_opt, 0}, |
{"use_bvop", ®.use_bvop, 1}, |
165 |
|
{"max_bframes", ®.max_bframes, 2}, |
166 |
|
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
167 |
|
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
168 |
|
{"packed", ®.packed, 1}, |
169 |
|
{"closed_gov", ®.closed_gov, 1}, |
170 |
|
|
171 |
|
/* aspect ratio */ |
172 |
|
{"ar_mode", ®.ar_mode, 0}, |
173 |
|
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
174 |
|
{"par_x", ®.par_x, 1}, |
175 |
|
{"par_y", ®.par_y, 1}, |
176 |
|
{"ar_x", ®.ar_x, 4}, |
177 |
|
{"ar_y", ®.ar_y, 3}, |
178 |
|
|
179 |
|
/* zones */ |
180 |
|
{"num_zones", ®.num_zones, 1}, |
181 |
|
|
182 |
|
/* single pass */ |
183 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
184 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
185 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
186 |
|
|
187 |
|
/* 2pass1 */ |
188 |
|
{"discard1pass", ®.discard1pass, 1}, |
189 |
|
|
190 |
|
/* 2pass2 */ |
191 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
192 |
|
{"kfreduction", ®.kfreduction, 20}, |
193 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
194 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
195 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
196 |
|
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
197 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
198 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
199 |
|
|
200 |
|
/* motion */ |
201 |
|
{"motion_search", ®.motion_search, 6}, |
202 |
|
{"vhq_mode", ®.vhq_mode, 1}, |
203 |
|
{"chromame", ®.chromame, 1}, |
204 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
205 |
|
{"turbo", ®.turbo, 0}, |
206 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
207 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
208 |
|
|
209 |
|
/* quant */ |
210 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 2}, |
211 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
212 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 2}, |
213 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.max_pquant, 31}, |
214 |
|
{"min_bquant", ®.min_bquant, 2}, |
215 |
|
{"max_bquant", ®.max_bquant, 31}, |
216 |
|
{"trellis_quant", ®.trellis_quant, 0}, |
217 |
|
|
218 |
{"desired_size", ®.desired_size, 570000}, |
/* debug */ |
219 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"fourcc_used", ®.fourcc_used, 0}, |
220 |
{"discard1pass", ®.discard1pass, 1}, |
{"debug", ®.debug, 0x0}, |
221 |
{"dummy2pass", ®.dummy2pass, 0}, |
{"vop_debug", ®.vop_debug, 0}, |
222 |
// added by koepi for new two-pass curve treatment |
{"display_status", ®.display_status, 1}, |
223 |
{"kftreshold", ®.kftreshold, 10}, |
}; |
224 |
{"kfreduction", ®.kfreduction, 20}, |
|
225 |
// end of koepi's additions |
static const REG_STR reg_strs[] = { |
226 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"profile", reg.profile_name, "(unrestricted)"}, |
227 |
{"curve_compression_low", ®.curve_compression_low, 0}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
228 |
{"use_alt_curve", ®.use_alt_curve, 0}, |
}; |
229 |
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
|
230 |
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
|
231 |
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
zone_t stmp; |
232 |
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
static const REG_INT reg_zone[] = { |
233 |
{"alt_curve_type", ®.alt_curve_type, 1}, |
{"zone%i_frame", &stmp.frame, 0}, |
234 |
{"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
235 |
{"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
236 |
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
237 |
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
238 |
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
239 |
{"twopass_max_bitrate", ®.twopass_max_bitrate, 10000 * CONFIG_KBPS}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
240 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
241 |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
}; |
242 |
{"hinted_me", ®.hinted_me, 0}, |
|
243 |
|
static const BYTE default_qmatrix_intra[] = { |
244 |
{"credits_start", ®.credits_start, 0}, |
8, 17,18,19,21,23,25,27, |
245 |
{"credits_start_begin", ®.credits_start_begin, 0}, |
17,18,19,21,23,25,27,28, |
246 |
{"credits_start_end", ®.credits_start_end, 0}, |
20,21,22,23,24,26,28,30, |
247 |
{"credits_end", ®.credits_end, 0}, |
21,22,23,24,26,28,30,32, |
248 |
{"credits_end_begin", ®.credits_end_begin, 0}, |
22,23,24,26,28,30,32,35, |
249 |
{"credits_end_end", ®.credits_end_end, 0}, |
23,24,26,28,30,32,35,38, |
250 |
|
25,26,28,30,32,35,38,41, |
251 |
// added by koepi for greyscale credits |
27,28,30,32,35,38,41,45 |
|
{"credits_greyscale", ®.credits_greyscale, 0}, |
|
|
// end of koepi's addition |
|
|
{"credits_mode", ®.credits_mode, 0}, |
|
|
{"credits_rate", ®.credits_rate, 20}, |
|
|
{"credits_quant_i", ®.credits_quant_i, 20}, |
|
|
{"credits_quant_p", ®.credits_quant_p, 20}, |
|
|
{"credits_start_size", ®.credits_start_size, 10000}, |
|
|
{"credits_end_size", ®.credits_end_size, 10000}, |
|
|
|
|
|
/* decoder */ |
|
|
{"deblock_y", ®.deblock_y, 0}, |
|
|
{"deblock_uv", ®.deblock_uv, 0} |
|
252 |
}; |
}; |
253 |
|
|
254 |
REG_STR const reg_strs[] = { |
static const BYTE default_qmatrix_inter[] = { |
255 |
{"hintfile", reg.hintfile, CONFIG_HINTFILE}, |
16,17,18,19,20,21,22,23, |
256 |
{"stats1", reg.stats1, CONFIG_2PASS_1_FILE}, |
17,18,19,20,21,22,23,24, |
257 |
{"stats2", reg.stats2, CONFIG_2PASS_2_FILE} |
18,19,20,21,22,23,24,25, |
258 |
// {"build", reg.build, XVID_BUILD} |
19,20,21,22,23,24,26,27, |
259 |
|
20,21,22,23,25,26,27,28, |
260 |
|
21,22,23,24,26,27,28,30, |
261 |
|
22,23,24,26,27,28,30,31, |
262 |
|
23,24,25,27,28,30,31,33 |
263 |
}; |
}; |
264 |
|
|
265 |
/* get config settings from registry */ |
|
266 |
|
|
267 |
#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)));} |
268 |
|
|
269 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
270 |
{ |
{ |
271 |
|
char tmp[32]; |
272 |
HKEY hKey; |
HKEY hKey; |
273 |
DWORD size; |
DWORD size; |
274 |
int i; |
int i,j; |
275 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
276 |
|
|
277 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
282 |
|
|
283 |
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); |
284 |
|
|
285 |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
/* read integer values */ |
286 |
{ |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT); i++) { |
287 |
size = sizeof(int); |
size = sizeof(int); |
288 |
|
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) { |
|
if (RegQueryValueEx(hKey, reg_ints[i].reg_value, 0, 0, (LPBYTE)reg_ints[i].config_int, &size) != ERROR_SUCCESS) |
|
|
{ |
|
289 |
*reg_ints[i].config_int = reg_ints[i].def; |
*reg_ints[i].config_int = reg_ints[i].def; |
290 |
} |
} |
291 |
} |
} |
292 |
|
|
293 |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
/* read string values */ |
294 |
{ |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR); i++) { |
295 |
size = MAX_PATH; |
size = MAX_PATH; |
296 |
|
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) { |
|
if (RegQueryValueEx(hKey, reg_strs[i].reg_value, 0, 0, (LPBYTE)reg_strs[i].config_str, &size) != ERROR_SUCCESS) |
|
|
{ |
|
297 |
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
memcpy(reg_strs[i].config_str, reg_strs[i].def, MAX_PATH); |
298 |
} |
} |
299 |
} |
} |
300 |
|
|
301 |
{ |
reg.profile = 0; |
302 |
BYTE default_qmatrix_intra[] = { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
303 |
8, 17,18,19,21,23,25,27, |
if (strcmpi(profiles[i].name, reg.profile_name) == 0) { |
304 |
17,18,19,21,23,25,27,28, |
reg.profile = i; |
305 |
20,21,22,23,24,26,28,30, |
} |
306 |
21,22,23,24,26,28,30,32, |
} |
307 |
22,23,24,26,28,30,32,35, |
|
308 |
23,24,26,28,30,32,35,38, |
memcpy(config, ®, sizeof(CONFIG)); |
|
25,26,28,30,32,35,38,41, |
|
|
27,28,30,32,35,38,41,45 |
|
|
}; |
|
309 |
|
|
|
BYTE default_qmatrix_inter[] = { |
|
|
16,17,18,19,20,21,22,23, |
|
|
17,18,19,20,21,22,23,24, |
|
|
18,19,20,21,22,23,24,25, |
|
|
19,20,21,22,23,24,26,27, |
|
|
20,21,22,23,25,26,27,28, |
|
|
21,22,23,24,26,27,28,30, |
|
|
22,23,24,26,27,28,30,31, |
|
|
23,24,25,27,28,30,31,33 |
|
|
}; |
|
310 |
|
|
311 |
REG_GET_B("qmatrix_intra", reg.qmatrix_intra, default_qmatrix_intra); |
/* read quant matrices */ |
312 |
REG_GET_B("qmatrix_inter", reg.qmatrix_inter, default_qmatrix_inter); |
REG_GET_B("qmatrix_intra", config->qmatrix_intra, default_qmatrix_intra); |
313 |
|
REG_GET_B("qmatrix_inter", config->qmatrix_inter, default_qmatrix_inter); |
314 |
|
|
315 |
|
|
316 |
|
/* read zones */ |
317 |
|
if (config->num_zones>MAX_ZONES) { |
318 |
|
config->num_zones=MAX_ZONES; |
319 |
|
}else if (config->num_zones<=0) { |
320 |
|
config->num_zones = 1; |
321 |
} |
} |
322 |
|
|
323 |
memcpy(config, ®, sizeof(CONFIG)); |
for (i=0; i<config->num_zones; i++) { |
324 |
|
for (j=0; j<sizeof(reg_zone)/sizeof(REG_INT); j++) { |
325 |
|
size = sizeof(int); |
326 |
|
|
327 |
|
wsprintf(tmp, reg_zone[j].reg_value, i); |
328 |
|
if (RegQueryValueEx(hKey, tmp, 0, 0, (LPBYTE)reg_zone[j].config_int, &size) != ERROR_SUCCESS) |
329 |
|
*reg_zone[j].config_int = reg_zone[j].def; |
330 |
|
} |
331 |
|
|
332 |
|
memcpy(&config->zones[i], &stmp, sizeof(zone_t)); |
333 |
|
} |
334 |
|
|
335 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
336 |
} |
} |
342 |
|
|
343 |
void config_reg_set(CONFIG * config) |
void config_reg_set(CONFIG * config) |
344 |
{ |
{ |
345 |
|
char tmp[64]; |
346 |
HKEY hKey; |
HKEY hKey; |
347 |
DWORD dispo; |
DWORD dispo; |
348 |
int i; |
int i,j; |
349 |
|
|
350 |
if (RegCreateKeyEx( |
if (RegCreateKeyEx( |
351 |
XVID_REG_KEY, |
XVID_REG_KEY, |
358 |
&hKey, |
&hKey, |
359 |
&dispo) != ERROR_SUCCESS) |
&dispo) != ERROR_SUCCESS) |
360 |
{ |
{ |
361 |
DEBUG1("Couldn't create XVID_REG_SUBKEY - ", GetLastError()); |
DPRINTF("Couldn't create XVID_REG_SUBKEY - GetLastError=%i", GetLastError()); |
362 |
return; |
return; |
363 |
} |
} |
364 |
|
|
365 |
memcpy(®, config, sizeof(CONFIG)); |
memcpy(®, config, sizeof(CONFIG)); |
366 |
|
|
367 |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT) ; ++i) |
/* set integer values */ |
368 |
{ |
for (i=0 ; i<sizeof(reg_ints)/sizeof(REG_INT); i++) { |
369 |
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
RegSetValueEx(hKey, reg_ints[i].reg_value, 0, REG_DWORD, (LPBYTE)reg_ints[i].config_int, sizeof(int)); |
370 |
} |
} |
371 |
|
|
372 |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR) ; ++i) |
/* set string values */ |
373 |
{ |
strcpy(reg.profile_name, profiles[reg.profile].name); |
374 |
|
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR); i++) { |
375 |
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
RegSetValueEx(hKey, reg_strs[i].reg_value, 0, REG_SZ, reg_strs[i].config_str, lstrlen(reg_strs[i].config_str)+1); |
376 |
} |
} |
377 |
|
|
378 |
REG_SET_B("qmatrix_intra", reg.qmatrix_intra); |
/* set quant matrices */ |
379 |
REG_SET_B("qmatrix_inter", reg.qmatrix_inter); |
REG_SET_B("qmatrix_intra", config->qmatrix_intra); |
380 |
|
REG_SET_B("qmatrix_inter", config->qmatrix_inter); |
381 |
|
|
382 |
|
/* set seections */ |
383 |
|
for (i=0; i<config->num_zones; i++) { |
384 |
|
memcpy(&stmp, &config->zones[i], sizeof(zone_t)); |
385 |
|
for (j=0; j<sizeof(reg_zone)/sizeof(REG_INT); j++) { |
386 |
|
wsprintf(tmp, reg_zone[j].reg_value, i); |
387 |
|
RegSetValueEx(hKey, tmp, 0, REG_DWORD, (LPBYTE)reg_zone[j].config_int, sizeof(int)); |
388 |
|
} |
389 |
|
} |
390 |
|
|
391 |
RegCloseKey(hKey); |
RegCloseKey(hKey); |
392 |
} |
} |
398 |
{ |
{ |
399 |
HKEY hKey; |
HKEY hKey; |
400 |
|
|
401 |
if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) |
if (RegOpenKeyEx(XVID_REG_KEY, XVID_REG_PARENT, 0, KEY_ALL_ACCESS, &hKey)) { |
402 |
{ |
DPRINTF("Couldn't open registry key for deletion - GetLastError=%i", GetLastError()); |
|
DEBUG1("Couldn't open registry key for deletion - ", GetLastError()); |
|
403 |
return; |
return; |
404 |
} |
} |
405 |
|
|
406 |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) |
if (RegDeleteKey(hKey, XVID_REG_CHILD)) { |
407 |
{ |
DPRINTF("Couldn't delete registry key - GetLastError=%i", GetLastError()); |
|
DEBUG1("Couldn't delete registry key - ", GetLastError()); |
|
408 |
return; |
return; |
409 |
} |
} |
410 |
|
|
415 |
|
|
416 |
|
|
417 |
/* leaves current config value if dialog item is empty */ |
/* leaves current config value if dialog item is empty */ |
|
|
|
418 |
int config_get_int(HWND hDlg, INT item, int config) |
int config_get_int(HWND hDlg, INT item, int config) |
419 |
{ |
{ |
420 |
BOOL success = FALSE; |
BOOL success = FALSE; |
|
|
|
421 |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
int tmp = GetDlgItemInt(hDlg, item, &success, TRUE); |
|
|
|
422 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
423 |
} |
} |
424 |
|
|
426 |
int config_get_uint(HWND hDlg, UINT item, int config) |
int config_get_uint(HWND hDlg, UINT item, int config) |
427 |
{ |
{ |
428 |
BOOL success = FALSE; |
BOOL success = FALSE; |
|
|
|
429 |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
int tmp = GetDlgItemInt(hDlg, item, &success, FALSE); |
|
|
|
430 |
return (success) ? tmp : config; |
return (success) ? tmp : config; |
431 |
} |
} |
432 |
|
|
433 |
|
|
434 |
/* downloads data from main dialog */ |
/* we use "100 base" floats */ |
435 |
|
|
436 |
void main_download(HWND hDlg, CONFIG * config) |
#define FLOAT_BUF_SZ 20 |
437 |
|
int get_dlgitem_float(HWND hDlg, UINT item, int def) |
438 |
{ |
{ |
439 |
switch(config->mode) |
char buf[FLOAT_BUF_SZ]; |
|
{ |
|
|
default : |
|
|
case DLG_MODE_CBR : |
|
|
config->rc_bitrate = config_get_uint(hDlg, IDC_VALUE, config->rc_bitrate) * CONFIG_KBPS; |
|
|
break; |
|
|
|
|
|
case DLG_MODE_VBR_QUAL : |
|
|
config->quality = config_get_uint(hDlg, IDC_VALUE, config->quality); |
|
|
break; |
|
440 |
|
|
441 |
case DLG_MODE_VBR_QUANT : |
if (GetDlgItemText(hDlg, item, buf, FLOAT_BUF_SZ) == 0) |
442 |
config->quant = config_get_uint(hDlg, IDC_VALUE, config->quant); |
return def; |
|
break; |
|
443 |
|
|
444 |
case DLG_MODE_2PASS_2_INT : |
return (int)(atof(buf)*100); |
|
config->desired_size = config_get_uint(hDlg, IDC_VALUE, config->desired_size); |
|
|
break; |
|
445 |
} |
} |
446 |
|
|
447 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
void set_dlgitem_float(HWND hDlg, UINT item, int value) |
448 |
|
{ |
449 |
|
char buf[FLOAT_BUF_SZ]; |
450 |
|
sprintf(buf, "%.2f", (float)value/100); |
451 |
|
SetDlgItemText(hDlg, item, buf); |
452 |
} |
} |
453 |
|
|
454 |
|
|
455 |
/* updates the edit box */ |
#define HEX_BUF_SZ 16 |
456 |
|
unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
|
void main_value(HWND hDlg, CONFIG* config) |
|
457 |
{ |
{ |
458 |
char* text; |
char buf[HEX_BUF_SZ]; |
459 |
int value; |
unsigned int value; |
|
int enabled = TRUE; |
|
|
|
|
|
switch (config->mode) |
|
|
{ |
|
|
default : |
|
|
enabled = FALSE; |
|
|
|
|
|
case DLG_MODE_CBR : |
|
|
text = "Bitrate (Kbps):"; |
|
|
value = config->rc_bitrate / CONFIG_KBPS; |
|
|
break; |
|
|
|
|
|
case DLG_MODE_VBR_QUAL : |
|
|
text = "Quality:"; |
|
|
value = config->quality; |
|
|
break; |
|
460 |
|
|
461 |
case DLG_MODE_VBR_QUANT : |
if (GetDlgItemText(hDlg, item, buf, HEX_BUF_SZ) == 0) |
462 |
text = "Quantizer:"; |
return def; |
|
value = config->quant; |
|
|
break; |
|
463 |
|
|
464 |
case DLG_MODE_2PASS_2_INT : |
if (sscanf(buf,"0x%x", &value)==1 || sscanf(buf,"%x", &value)==1) { |
465 |
text = "Desired size (Kbtyes):"; |
return value; |
|
value = config->desired_size; |
|
|
break; |
|
466 |
} |
} |
467 |
|
|
468 |
SetDlgItemText(hDlg, IDC_VALUE_STATIC, text); |
return def; |
|
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
|
|
|
|
|
EnableWindow(GetDlgItem(hDlg, IDC_VALUE_STATIC), enabled); |
|
|
EnableWindow(GetDlgItem(hDlg, IDC_VALUE), enabled); |
|
469 |
} |
} |
470 |
|
|
471 |
|
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
472 |
|
{ |
473 |
|
char buf[HEX_BUF_SZ]; |
474 |
|
wsprintf(buf, "0x%x", value); |
475 |
|
SetDlgItemText(hDlg, item, buf); |
476 |
|
} |
477 |
|
|
478 |
/* updates the slider */ |
/* ===================================================================================== */ |
479 |
|
/* QUANT MATRIX DIALOG ================================================================= */ |
480 |
|
/* ===================================================================================== */ |
481 |
|
|
482 |
void main_slider(HWND hDlg, CONFIG * config) |
void quant_upload(HWND hDlg, CONFIG* config) |
483 |
{ |
{ |
484 |
char* text; |
int i; |
485 |
long range; |
|
486 |
int pos; |
for (i=0 ; i<64; i++) { |
487 |
int enabled = TRUE; |
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
488 |
|
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
489 |
|
} |
490 |
|
} |
491 |
|
|
492 |
switch (config->mode) |
|
493 |
|
void quant_download(HWND hDlg, CONFIG* config) |
494 |
{ |
{ |
495 |
default : |
int i; |
|
enabled = FALSE; |
|
496 |
|
|
497 |
case DLG_MODE_CBR : |
for (i=0; i<64; i++) { |
498 |
text = "Bitrate (Kbps):"; |
int temp; |
|
range = MAKELONG(0,10000); |
|
|
pos = config->rc_bitrate / CONFIG_KBPS; |
|
|
break; |
|
499 |
|
|
500 |
case DLG_MODE_VBR_QUAL : |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
501 |
text = "Quality:"; |
CONSTRAINVAL(temp, 1, 255); |
502 |
range = MAKELONG(0,100); |
config->qmatrix_intra[i] = temp; |
|
pos = config->quality; |
|
|
break; |
|
503 |
|
|
504 |
case DLG_MODE_VBR_QUANT : |
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
505 |
text = "Quantizer:"; |
CONSTRAINVAL(temp, 1, 255); |
506 |
range = MAKELONG(1,31); |
config->qmatrix_inter[i] = temp; |
507 |
pos = config->quant; |
} |
|
break; |
|
508 |
} |
} |
509 |
|
|
|
SetDlgItemText(hDlg, IDC_SLIDER_STATIC, text); |
|
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, range); |
|
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, pos); |
|
510 |
|
|
511 |
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER_STATIC), enabled); |
void quant_loadsave(HWND hDlg, CONFIG * config, int save) |
512 |
EnableWindow(GetDlgItem(hDlg, IDC_SLIDER), enabled); |
{ |
513 |
} |
char file[MAX_PATH]; |
514 |
|
OPENFILENAME ofn; |
515 |
|
HANDLE hFile; |
516 |
|
DWORD read=128, wrote=0; |
517 |
|
BYTE quant_data[128]; |
518 |
|
|
519 |
|
strcpy(file, "\\matrix"); |
520 |
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
521 |
|
ofn.lStructSize = sizeof(OPENFILENAME); |
522 |
|
|
523 |
/* load advanced options property sheet */ |
ofn.hwndOwner = hDlg; |
524 |
|
ofn.lpstrFilter = "All files (*.*)\0*.*\0\0"; |
525 |
|
ofn.lpstrFile = file; |
526 |
|
ofn.nMaxFile = MAX_PATH; |
527 |
|
ofn.Flags = OFN_PATHMUSTEXIST; |
528 |
|
|
529 |
void adv_dialog(HWND hParent, CONFIG * config) |
if (save) { |
530 |
{ |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
531 |
PROPSHEETINFO psi[DLG_COUNT]; |
if (GetSaveFileName(&ofn)) { |
532 |
PROPSHEETPAGE psp[DLG_COUNT]; |
hFile = CreateFile(file, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); |
|
PROPSHEETHEADER psh; |
|
|
CONFIG temp; |
|
|
int i; |
|
533 |
|
|
534 |
config->save = FALSE; |
quant_download(hDlg, config); |
535 |
memcpy(&temp, config, sizeof(CONFIG)); |
memcpy(quant_data, config->qmatrix_intra, 64); |
536 |
|
memcpy(quant_data+64, config->qmatrix_inter, 64); |
537 |
|
|
538 |
for (i=0 ; i<DLG_COUNT ; ++i) |
if (hFile == INVALID_HANDLE_VALUE) { |
539 |
{ |
DPRINTF("Couldn't save quant matrix"); |
540 |
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
}else{ |
541 |
psp[i].dwFlags = 0; |
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) { |
542 |
psp[i].hInstance = hInst; |
DPRINTF("Couldnt write quant matrix"); |
543 |
psp[i].pfnDlgProc = adv_proc; |
} |
544 |
psp[i].lParam = (LPARAM)&psi[i]; |
} |
545 |
psp[i].pfnCallback = NULL; |
CloseHandle(hFile); |
546 |
|
} |
547 |
|
}else{ |
548 |
|
ofn.Flags |= OFN_FILEMUSTEXIST; |
549 |
|
if (GetOpenFileName(&ofn)) { |
550 |
|
hFile = CreateFile(file, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); |
551 |
|
|
552 |
psi[i].page = i; |
if (hFile == INVALID_HANDLE_VALUE) { |
553 |
psi[i].config = &temp; |
DPRINTF("Couldn't load quant matrix"); |
554 |
|
} else { |
555 |
|
if (!ReadFile(hFile, quant_data, 128, &read, 0)) { |
556 |
|
DPRINTF("Couldnt read quant matrix"); |
557 |
|
}else{ |
558 |
|
memcpy(config->qmatrix_intra, quant_data, 64); |
559 |
|
memcpy(config->qmatrix_inter, quant_data+64, 64); |
560 |
|
quant_upload(hDlg, config); |
561 |
|
} |
562 |
|
} |
563 |
|
CloseHandle(hFile); |
564 |
|
} |
565 |
|
} |
566 |
} |
} |
567 |
|
|
568 |
psp[DLG_GLOBAL].pszTemplate = MAKEINTRESOURCE(IDD_GLOBAL); |
/* quantization matrix dialog proc */ |
|
psp[DLG_QUANT].pszTemplate = MAKEINTRESOURCE(IDD_QUANT); |
|
|
psp[DLG_2PASS].pszTemplate = MAKEINTRESOURCE(IDD_2PASS); |
|
|
psp[DLG_2PASSALT].pszTemplate = MAKEINTRESOURCE(IDD_2PASSALT); |
|
|
psp[DLG_CREDITS].pszTemplate = MAKEINTRESOURCE(IDD_CREDITS); |
|
|
psp[DLG_CPU].pszTemplate = MAKEINTRESOURCE(IDD_CPU); |
|
569 |
|
|
570 |
psh.dwSize = sizeof(PROPSHEETHEADER); |
BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
571 |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
{ |
572 |
psh.hwndParent = hParent; |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
|
psh.hInstance = hInst; |
|
|
psh.pszCaption = (LPSTR) "XviD Configuration"; |
|
|
psh.nPages = DLG_COUNT; |
|
|
psh.nStartPage = DLG_GLOBAL; |
|
|
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
|
|
psh.pfnCallback = NULL; |
|
573 |
|
|
574 |
PropertySheet(&psh); |
switch (uMsg) |
575 |
|
{ |
576 |
|
case WM_INITDIALOG : |
577 |
|
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
578 |
|
config = (CONFIG*)lParam; |
579 |
|
quant_upload(hDlg, config); |
580 |
|
|
581 |
if (temp.save) |
if (g_hTooltip) |
582 |
{ |
{ |
583 |
memcpy(config, &temp, sizeof(CONFIG)); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
} |
|
584 |
} |
} |
585 |
|
break; |
586 |
|
|
587 |
|
case WM_COMMAND : |
588 |
|
|
589 |
/* enable/disable advanced controls based on encoder mode */ |
if (HIWORD(wParam) == BN_CLICKED) { |
590 |
|
switch(LOWORD(wParam)) { |
591 |
|
case IDOK : |
592 |
|
quant_download(hDlg, config); |
593 |
|
EndDialog(hDlg, IDOK); |
594 |
|
break; |
595 |
|
|
596 |
#define CONTROLDLG(X,Y) EnableWindow(GetDlgItem(hDlg, (X)), (Y)) |
case IDCANCEL : |
597 |
#define ISDLGSET(X) (IsDlgButtonChecked(hDlg, (X)) == BST_CHECKED) |
EndDialog(hDlg, IDCANCEL); |
598 |
|
break; |
599 |
|
|
600 |
#define MOD_CBR |
case IDC_SAVE : |
601 |
|
quant_loadsave(hDlg, config, 1); |
602 |
|
break; |
603 |
|
|
604 |
void adv_mode(HWND hDlg, int mode) |
case IDC_LOAD : |
605 |
{ |
quant_loadsave(hDlg, config, 0); |
606 |
// create arrays of controls to be disabled for each mode |
break; |
|
const short twopass_disable[] = { |
|
|
IDC_KFBOOST, IDC_DUMMY2PASS, IDC_USEALT, |
|
|
// added by koepi for new curve treatment |
|
|
IDC_KFTRESHOLD, IDC_KFREDUCTION, |
|
|
//end of koepi's additions |
|
|
IDC_CURVECOMPH, IDC_CURVECOMPL, IDC_PAYBACK, IDC_PAYBACKBIAS, IDC_PAYBACKPROP, |
|
|
IDC_STATS2, IDC_STATS2_BROWSE, |
|
|
}; |
|
607 |
|
|
608 |
const short cbr_disable[] = { |
default : |
609 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
return FALSE; |
610 |
IDC_CREDITS_START, IDC_CREDITS_END, IDC_CREDITS_START_BEGIN, IDC_CREDITS_START_END, |
} |
611 |
IDC_CREDITS_END_BEGIN, IDC_CREDITS_END_END, IDC_CREDITS_RATE_RADIO, |
break; |
612 |
IDC_CREDITS_QUANT_RADIO, IDC_CREDITS_QUANT_STATIC, IDC_CREDITS_SIZE_RADIO, |
} |
613 |
IDC_CREDITS_QUANTI, IDC_CREDITS_QUANTP, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
return FALSE; |
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, IDC_CREDITS_GREYSCALE, IDC_HINTFILE |
|
|
}; |
|
614 |
|
|
615 |
const short qual_disable[] = { |
default : |
616 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
return FALSE; |
617 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
} |
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
|
|
IDC_HINTFILE |
|
|
}; |
|
618 |
|
|
619 |
const short quant_disable[] = { |
return TRUE; |
620 |
IDC_STATS1, IDC_STATS1_BROWSE, IDC_DISCARD1PASS, IDC_HINTEDME, |
} |
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
|
|
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
|
|
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE, |
|
|
IDC_HINTFILE |
|
|
}; |
|
621 |
|
|
|
const short twopass1_disable[] = { |
|
|
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
|
|
IDC_MINIQUANT, IDC_MAXIQUANT, IDC_MINPQUANT, IDC_MAXPQUANT, |
|
|
IDC_CREDITS_RATE_RADIO, IDC_CREDITS_RATE, IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, |
|
|
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
|
|
}; |
|
622 |
|
|
623 |
const short twopass2_ext_disable[] = { |
/* ===================================================================================== */ |
624 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
/* ADVANCED DIALOG PAGES ================================================================ */ |
625 |
IDC_CREDITS_RATE_RADIO, |
/* ===================================================================================== */ |
626 |
IDC_CREDITS_SIZE_RADIO, IDC_CREDITS_END_STATIC, IDC_CREDITS_RATE, |
|
627 |
IDC_CREDITS_START_SIZE, IDC_CREDITS_END_SIZE |
/* initialise pages */ |
628 |
}; |
void adv_init(HWND hDlg, int idd, CONFIG * config) |
629 |
|
{ |
630 |
|
unsigned int i; |
631 |
|
|
632 |
|
switch(idd) { |
633 |
|
case IDD_PROFILE : |
634 |
|
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
635 |
|
SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
636 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
637 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
638 |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
639 |
|
|
640 |
const short twopass2_int_disable[] = { |
break; |
641 |
IDC_CBR_REACTIONDELAY, IDC_CBR_AVERAGINGPERIOD, IDC_CBR_BUFFER, |
case IDD_AR: |
642 |
IDC_STATS2, IDC_STATS2_BROWSE |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
643 |
}; |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
644 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 NTSC"); |
645 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 PAL"); |
646 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 NTSC"); |
647 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom..."); |
648 |
|
break; |
649 |
|
|
650 |
// store pointers in order so we can lookup using config->mode |
case IDD_LEVEL : |
651 |
const short* modes[] = { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
652 |
cbr_disable, qual_disable, quant_disable, |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
653 |
twopass1_disable, twopass2_ext_disable, twopass2_int_disable |
break; |
|
}; |
|
654 |
|
|
655 |
// ditto modes[] |
case IDD_ZONE : |
656 |
const int lengths[] = { |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
657 |
sizeof(cbr_disable)/sizeof(short), sizeof(qual_disable)/sizeof(short), |
break; |
|
sizeof(quant_disable)/sizeof(short), sizeof(twopass1_disable)/sizeof(short), |
|
|
sizeof(twopass2_ext_disable)/sizeof(short), sizeof(twopass2_int_disable)/sizeof(short), 0 |
|
|
}; |
|
658 |
|
|
659 |
int i; |
case IDD_MOTION : |
660 |
int hinted_me, use_alt, use_alt_auto, use_alt_auto_bonus; |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
661 |
int credits_start, credits_end, credits_rate, credits_quant, credits_size; |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
662 |
int cpu_force; |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
663 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
664 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
665 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
666 |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
667 |
|
|
668 |
// first perform checkbox-based enable/disable |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"0 - Off"); |
669 |
hinted_me = ISDLGSET(IDC_HINTEDME); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"1 - Mode Decision"); |
670 |
CONTROLDLG(IDC_HINTFILE, hinted_me); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search"); |
671 |
CONTROLDLG(IDC_HINT_BROWSE, hinted_me); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search"); |
672 |
|
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
673 |
use_alt = ISDLGSET(IDC_USEALT) && (mode == DLG_MODE_2PASS_2_EXT || mode == DLG_MODE_2PASS_2_INT); |
break; |
674 |
use_alt_auto = ISDLGSET(IDC_USEAUTO); |
|
675 |
use_alt_auto_bonus = ISDLGSET(IDC_USEAUTOBONUS); |
case IDD_DEBUG : |
676 |
CONTROLDLG(IDC_USEAUTO, use_alt); |
/* force threads disabled */ |
677 |
CONTROLDLG(IDC_AUTOSTR, use_alt && use_alt_auto); |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
678 |
CONTROLDLG(IDC_USEAUTOBONUS, use_alt); |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
679 |
CONTROLDLG(IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
|
680 |
CONTROLDLG(IDC_CURVETYPE, use_alt); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
681 |
CONTROLDLG(IDC_ALTCURVEHIGH, use_alt); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
682 |
CONTROLDLG(IDC_ALTCURVELOW, use_alt); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
683 |
CONTROLDLG(IDC_MINQUAL, use_alt && !use_alt_auto); |
break; |
684 |
|
} |
|
credits_start = ISDLGSET(IDC_CREDITS_START); |
|
|
CONTROLDLG(IDC_CREDITS_START_BEGIN, credits_start); |
|
|
CONTROLDLG(IDC_CREDITS_START_END, credits_start); |
|
|
|
|
|
credits_end = ISDLGSET(IDC_CREDITS_END); |
|
|
CONTROLDLG(IDC_CREDITS_END_BEGIN, credits_end); |
|
|
CONTROLDLG(IDC_CREDITS_END_END, credits_end); |
|
|
|
|
|
credits_rate = ISDLGSET(IDC_CREDITS_RATE_RADIO); |
|
|
credits_quant = ISDLGSET(IDC_CREDITS_QUANT_RADIO); |
|
|
credits_size = ISDLGSET(IDC_CREDITS_SIZE_RADIO); |
|
|
CONTROLDLG(IDC_CREDITS_RATE, credits_rate); |
|
|
CONTROLDLG(IDC_CREDITS_QUANTI, credits_quant); |
|
|
CONTROLDLG(IDC_CREDITS_QUANTP, credits_quant); |
|
|
CONTROLDLG(IDC_CREDITS_START_SIZE, credits_size); |
|
|
CONTROLDLG(IDC_CREDITS_END_SIZE, credits_size); |
|
|
|
|
|
cpu_force = ISDLGSET(IDC_CPU_FORCE); |
|
|
CONTROLDLG(IDC_CPU_MMX, cpu_force); |
|
|
CONTROLDLG(IDC_CPU_MMXEXT, cpu_force); |
|
|
CONTROLDLG(IDC_CPU_SSE, cpu_force); |
|
|
CONTROLDLG(IDC_CPU_SSE2, cpu_force); |
|
|
CONTROLDLG(IDC_CPU_3DNOW, cpu_force); |
|
|
CONTROLDLG(IDC_CPU_3DNOWEXT, cpu_force); |
|
|
|
|
|
// now perform codec mode enable/disable |
|
|
for (i=0 ; i<lengths[mode] ; ++i) |
|
|
{ |
|
|
EnableWindow(GetDlgItem(hDlg, modes[mode][i]), FALSE); |
|
685 |
} |
} |
686 |
|
|
687 |
if (mode != DLG_MODE_2PASS_2_EXT && mode != DLG_MODE_2PASS_2_INT) |
|
688 |
{ |
/* enable/disable controls based on encoder-mode or user selection */ |
689 |
for (i=0 ; i<sizeof(twopass_disable)/sizeof(short) ; ++i) |
|
690 |
|
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
691 |
{ |
{ |
692 |
EnableWindow(GetDlgItem(hDlg, twopass_disable[i]), FALSE); |
int profile; |
693 |
} |
int weight_en, quant_en; |
694 |
|
int cpu_force; |
695 |
|
int custom_quant, bvops; |
696 |
|
int ar_mode, ar_par; |
697 |
|
|
698 |
|
switch(idd) { |
699 |
|
case IDD_PROFILE : |
700 |
|
profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0); |
701 |
|
EnableDlgWindow(hDlg, IDC_BVOP, profiles[profile].flags&PROFILE_BVOP); |
702 |
|
|
703 |
|
EnableDlgWindow(hDlg, IDC_QUANTTYPE_S, profiles[profile].flags&PROFILE_MPEGQUANT); |
704 |
|
EnableDlgWindow(hDlg, IDC_QUANTTYPE_S, profiles[profile].flags&PROFILE_MPEGQUANT); |
705 |
|
EnableDlgWindow(hDlg, IDC_QUANTTYPE, profiles[profile].flags&PROFILE_MPEGQUANT); |
706 |
|
custom_quant = (profiles[profile].flags&PROFILE_MPEGQUANT) && SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0)==QUANT_MODE_CUSTOM; |
707 |
|
EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); |
708 |
|
EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); |
709 |
|
EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); |
710 |
|
EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); |
711 |
|
EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); |
712 |
|
EnableDlgWindow(hDlg, IDC_REDUCED, profiles[profile].flags&PROFILE_REDUCED); |
713 |
|
|
714 |
|
bvops = (profiles[profile].flags&PROFILE_BVOP) && IsDlgChecked(hDlg, IDC_BVOP); |
715 |
|
EnableDlgWindow(hDlg, IDC_MAXBFRAMES, bvops); |
716 |
|
EnableDlgWindow(hDlg, IDC_BQUANTRATIO, bvops); |
717 |
|
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET, bvops); |
718 |
|
EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S, bvops); |
719 |
|
EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S, bvops); |
720 |
|
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
721 |
|
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
722 |
|
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
723 |
|
break; |
724 |
|
|
725 |
|
case IDD_AR: |
726 |
|
ar_mode = IsDlgChecked(hDlg, IDC_PAR); |
727 |
|
EnableDlgWindow(hDlg, IDC_ASPECT_RATIO, ar_mode); |
728 |
|
|
729 |
|
ar_par = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
730 |
|
if (ar_par == 5) { /* custom par */ |
731 |
|
SetDlgItemInt(hDlg, IDC_PARY, config->par_y, FALSE); |
732 |
|
SetDlgItemInt(hDlg, IDC_PARX, config->par_x, FALSE); |
733 |
|
|
734 |
|
EnableDlgWindow(hDlg, IDC_PARX, ar_mode); |
735 |
|
EnableDlgWindow(hDlg, IDC_PARY, ar_mode); |
736 |
|
} else { |
737 |
|
SetDlgItemInt(hDlg, IDC_PARX, PARS[ar_par][0], FALSE); |
738 |
|
SetDlgItemInt(hDlg, IDC_PARY, PARS[ar_par][1], FALSE); |
739 |
|
EnableDlgWindow(hDlg, IDC_PARX, FALSE); |
740 |
|
EnableDlgWindow(hDlg, IDC_PARY, FALSE); |
741 |
|
} |
742 |
|
|
743 |
|
ar_mode = IsDlgChecked(hDlg, IDC_AR); |
744 |
|
|
745 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
746 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
747 |
|
|
748 |
|
EnableDlgWindow(hDlg, IDC_ARX, ar_mode); |
749 |
|
EnableDlgWindow(hDlg, IDC_ARY, ar_mode); |
750 |
|
break; |
751 |
|
|
752 |
|
case IDD_LEVEL : |
753 |
|
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
754 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_WIDTH, profiles[profile].width, FALSE); |
755 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_HEIGHT, profiles[profile].height, FALSE); |
756 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_FPS, profiles[profile].fps, FALSE); |
757 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_VMV, profiles[profile].max_vmv_buffer_sz, FALSE); |
758 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_VCV, profiles[profile].vcv_decoder_rate, FALSE); |
759 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_VBV, profiles[profile].max_vbv_size, FALSE); |
760 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
761 |
|
break; |
762 |
|
|
763 |
|
case IDD_ZONE : |
764 |
|
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
765 |
|
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
766 |
|
EnableDlgWindow(hDlg, IDC_ZONE_WEIGHT, weight_en); |
767 |
|
EnableDlgWindow(hDlg, IDC_ZONE_QUANT, quant_en); |
768 |
|
EnableDlgWindow(hDlg, IDC_ZONE_SLIDER, weight_en|quant_en); |
769 |
|
|
770 |
|
if (weight_en) { |
771 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(001,200)); |
772 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, 100)); |
773 |
|
SetDlgItemText(hDlg, IDC_ZONE_MIN, "0.01"); |
774 |
|
SetDlgItemText(hDlg, IDC_ZONE_MAX, "2.00"); |
775 |
|
}else if (quant_en) { |
776 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(100,3100)); |
777 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, get_dlgitem_float(hDlg, IDC_ZONE_QUANT, 100)); |
778 |
|
SetDlgItemText(hDlg, IDC_ZONE_MIN, "1"); |
779 |
|
SetDlgItemText(hDlg, IDC_ZONE_MAX, "31"); |
780 |
|
} |
781 |
|
|
782 |
|
bvops = (profiles[config->profile].flags&PROFILE_BVOP) && config->use_bvop; |
783 |
|
EnableDlgWindow(hDlg, IDC_ZONE_BVOPTHRESHOLD_S, bvops); |
784 |
|
EnableDlgWindow(hDlg, IDC_ZONE_BVOPTHRESHOLD, bvops); |
785 |
|
break; |
786 |
|
|
787 |
|
case IDD_DEBUG : |
788 |
|
cpu_force = IsDlgChecked(hDlg, IDC_CPU_FORCE); |
789 |
|
EnableDlgWindow(hDlg, IDC_CPU_MMX, cpu_force); |
790 |
|
EnableDlgWindow(hDlg, IDC_CPU_MMXEXT, cpu_force); |
791 |
|
EnableDlgWindow(hDlg, IDC_CPU_SSE, cpu_force); |
792 |
|
EnableDlgWindow(hDlg, IDC_CPU_SSE2, cpu_force); |
793 |
|
EnableDlgWindow(hDlg, IDC_CPU_3DNOW, cpu_force); |
794 |
|
EnableDlgWindow(hDlg, IDC_CPU_3DNOWEXT, cpu_force); |
795 |
|
break; |
796 |
} |
} |
797 |
} |
} |
798 |
|
|
799 |
|
|
800 |
/* upload config data into dialog */ |
/* upload config data into dialog */ |
801 |
|
void adv_upload(HWND hDlg, int idd, CONFIG * config) |
|
void adv_upload(HWND hDlg, int page, CONFIG * config) |
|
802 |
{ |
{ |
803 |
switch (page) |
switch (idd) |
804 |
{ |
{ |
805 |
case DLG_GLOBAL : |
case IDD_PROFILE : |
806 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_SETCURSEL, config->profile, 0); |
807 |
|
|
808 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
809 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); |
810 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); |
811 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
CheckDlg(hDlg, IDC_QPEL, config->qpel); |
812 |
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
CheckDlg(hDlg, IDC_GMC, config->gmc); |
813 |
CheckDlgButton(hDlg, IDC_LUMMASK, config->lum_masking ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_REDUCED, config->reduced_resolution); |
814 |
CheckDlgButton(hDlg, IDC_INTERLACING, config->interlacing ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_BVOP, config->use_bvop); |
815 |
|
|
816 |
CheckDlgButton(hDlg, IDC_QPEL, config->qpel ? BST_CHECKED : BST_UNCHECKED); |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE); |
817 |
CheckDlgButton(hDlg, IDC_GMC, config->gmc ? BST_CHECKED : BST_UNCHECKED); |
set_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
818 |
CheckDlgButton(hDlg, IDC_CHROMAME, config->chromame ? BST_CHECKED : BST_UNCHECKED); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
819 |
// added by koepi for gruel's greyscale_mode |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
820 |
CheckDlgButton(hDlg, IDC_GREYSCALE, config->greyscale ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
|
// end of koepi's addition |
|
|
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, TRUE); |
|
|
SetDlgItemInt(hDlg, IDC_BQUANTRATIO, config->bquant_ratio, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_BQUANTOFFSET, config->bquant_offset, FALSE); |
|
|
CheckDlgButton(hDlg, IDC_PACKED, config->packed ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_DX50BVOP, config->dx50bvop ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_DEBUG, config->debug ? BST_CHECKED : BST_UNCHECKED); |
|
821 |
|
|
822 |
CheckDlgButton(hDlg, IDC_REDUCED, config->reduced_resolution ? BST_CHECKED : BST_UNCHECKED); |
break; |
823 |
|
case IDD_AR: |
824 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR : IDC_AR); |
825 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
826 |
|
SetDlgItemInt(hDlg, IDC_ARX, config->ar_x, FALSE); |
827 |
|
SetDlgItemInt(hDlg, IDC_ARY, config->ar_y, FALSE); |
828 |
break; |
break; |
829 |
|
|
830 |
case DLG_QUANT : |
case IDD_LEVEL : |
831 |
SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_SETCURSEL, config->profile, 0); |
|
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
|
832 |
break; |
break; |
833 |
|
|
834 |
case DLG_2PASS : |
case IDD_RC_CBR : |
835 |
|
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
836 |
|
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
837 |
|
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
838 |
|
break; |
839 |
|
|
840 |
|
case IDD_RC_2PASS1 : |
841 |
|
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
842 |
|
CheckDlg(hDlg, IDC_DISCARD1PASS, config->discard1pass); |
843 |
|
break; |
844 |
|
|
845 |
|
case IDD_RC_2PASS2 : |
846 |
|
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
847 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
CheckDlgButton(hDlg, IDC_DISCARD1PASS, config->discard1pass ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_DUMMY2PASS, config->dummy2pass ? BST_CHECKED : BST_UNCHECKED); |
|
|
// added by koepi for new 2pass curve treatment |
|
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
848 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
849 |
// end of koepi's additions |
|
850 |
|
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
851 |
|
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
852 |
|
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
853 |
|
|
854 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
855 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
856 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
|
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
|
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
|
|
|
|
|
CheckDlgButton(hDlg, IDC_HINTEDME, config->hinted_me ? BST_CHECKED : BST_UNCHECKED); |
|
|
SetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile); |
|
|
SetDlgItemText(hDlg, IDC_STATS1, config->stats1); |
|
|
SetDlgItemText(hDlg, IDC_STATS2, config->stats2); |
|
857 |
break; |
break; |
858 |
|
|
859 |
case DLG_2PASSALT : |
case IDD_ZONE : |
860 |
CheckDlgButton(hDlg, IDC_USEALT, config->use_alt_curve ? BST_CHECKED : BST_UNCHECKED); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
861 |
|
|
862 |
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); |
863 |
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); |
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
|
864 |
|
|
865 |
CheckDlgButton(hDlg, IDC_USEAUTO, config->alt_curve_use_auto ? BST_CHECKED : BST_UNCHECKED); |
set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
866 |
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
867 |
|
|
868 |
CheckDlgButton(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias ? BST_CHECKED : BST_UNCHECKED); |
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
869 |
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
870 |
|
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
871 |
|
|
872 |
SetDlgItemInt(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate / CONFIG_KBPS, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold, TRUE); |
|
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
|
873 |
break; |
break; |
874 |
|
|
875 |
case DLG_CREDITS : |
case IDD_MOTION : |
876 |
CheckDlgButton(hDlg, IDC_CREDITS_START, config->credits_start ? BST_CHECKED : BST_UNCHECKED); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
877 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, config->credits_start_begin, FALSE); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
878 |
SetDlgItemInt(hDlg, IDC_CREDITS_START_END, config->credits_start_end, FALSE); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
879 |
CheckDlgButton(hDlg, IDC_CREDITS_END, config->credits_end ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
880 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin, FALSE); |
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
881 |
SetDlgItemInt(hDlg, IDC_CREDITS_END_END, config->credits_end_end, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
882 |
|
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
883 |
// added by koepi for credits greyscale |
break; |
|
CheckDlgButton(hDlg, IDC_CREDITS_GREYSCALE, config->credits_greyscale ? BST_CHECKED : BST_UNCHECKED); |
|
|
// end of koepi's addition |
|
|
SetDlgItemInt(hDlg, IDC_CREDITS_RATE, config->credits_rate, FALSE); |
|
|
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); |
|
884 |
|
|
885 |
if (config->credits_mode == CREDITS_MODE_RATE) |
case IDD_QUANT : |
886 |
{ |
SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); |
887 |
CheckDlgButton(hDlg, IDC_CREDITS_RATE_RADIO, BST_CHECKED); |
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
888 |
} |
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
889 |
else if (config->credits_mode == CREDITS_MODE_QUANT) |
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
890 |
{ |
SetDlgItemInt(hDlg, IDC_MINBQUANT, config->min_bquant, FALSE); |
891 |
CheckDlgButton(hDlg, IDC_CREDITS_QUANT_RADIO, BST_CHECKED); |
SetDlgItemInt(hDlg, IDC_MAXBQUANT, config->max_bquant, FALSE); |
892 |
} |
CheckDlg(hDlg, IDC_TRELLISQUANT, config->trellis_quant); |
|
else // CREDITS_MODE_SIZE |
|
|
{ |
|
|
CheckDlgButton(hDlg, IDC_CREDITS_SIZE_RADIO, BST_CHECKED); |
|
|
} |
|
893 |
break; |
break; |
894 |
|
|
895 |
case DLG_CPU : |
case IDD_DEBUG : |
896 |
CheckDlgButton(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX)); |
897 |
CheckDlgButton(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT)); |
898 |
CheckDlgButton(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE)); |
899 |
CheckDlgButton(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_SSE2, (config->cpu & XVID_CPU_SSE2)); |
900 |
CheckDlgButton(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_3DNOW, (config->cpu & XVID_CPU_3DNOW)); |
901 |
CheckDlgButton(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT) ? BST_CHECKED : BST_UNCHECKED); |
CheckDlg(hDlg, IDC_CPU_3DNOWEXT, (config->cpu & XVID_CPU_3DNOWEXT)); |
902 |
|
|
903 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
904 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
905 |
|
|
906 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
907 |
CheckDlgButton(hDlg, IDC_CHROMA_OPT, (config->chroma_opt) ? BST_CHECKED : BST_UNCHECKED); |
|
908 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
909 |
SetDlgItemInt(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor, FALSE); |
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
910 |
SetDlgItemInt(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period, FALSE); |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
911 |
SetDlgItemInt(hDlg, IDC_CBR_BUFFER, config->rc_buffer, FALSE); |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
912 |
break; |
break; |
913 |
} |
} |
914 |
} |
} |
915 |
|
|
916 |
|
|
917 |
/* download config data from dialog |
/* download config data from dialog */ |
|
replaces invalid values instead of alerting user for now |
|
|
*/ |
|
918 |
|
|
919 |
#define CONSTRAINVAL(X,Y,Z) if((X)<(Y)) X=Y; if((X)>(Z)) X=Z; |
void adv_download(HWND hDlg, int idd, CONFIG * config) |
|
|
|
|
void adv_download(HWND hDlg, int page, CONFIG * config) |
|
920 |
{ |
{ |
921 |
switch (page) |
switch (idd) |
922 |
{ |
{ |
923 |
case DLG_GLOBAL : |
case IDD_PROFILE : |
924 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE_PROFILE, CB_GETCURSEL, 0, 0); |
925 |
|
|
926 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
927 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
928 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
929 |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
930 |
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
931 |
config->lum_masking = ISDLGSET(IDC_LUMMASK); |
config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); |
932 |
config->interlacing = ISDLGSET(IDC_INTERLACING); |
|
933 |
|
config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP); |
934 |
config->qpel = ISDLGSET(IDC_QPEL); |
config->max_bframes = config_get_uint(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
935 |
config->gmc = ISDLGSET(IDC_GMC); |
config->bquant_ratio = get_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
936 |
config->chromame = ISDLGSET(IDC_CHROMAME); |
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
937 |
// added by koepi for gruel's greyscale_mode |
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
938 |
config->greyscale = ISDLGSET(IDC_GREYSCALE); |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
|
// end of koepi's addition |
|
|
config->max_bframes = config_get_int(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
|
|
config->bquant_ratio = config_get_uint(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
|
|
config->bquant_offset = config_get_uint(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
|
|
config->packed = ISDLGSET(IDC_PACKED); |
|
|
config->dx50bvop = ISDLGSET(IDC_DX50BVOP); |
|
|
config->debug = ISDLGSET(IDC_DEBUG); |
|
|
config->reduced_resolution = ISDLGSET(IDC_REDUCED); |
|
939 |
break; |
break; |
940 |
|
|
941 |
case DLG_QUANT : |
case IDD_AR: |
942 |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
config->ar_mode = IsDlgChecked(hDlg, IDC_PAR) ? 0:1; |
943 |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
944 |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
945 |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
946 |
|
if (config->display_aspect_ratio == 5) { |
947 |
|
config->par_x = config_get_uint(hDlg, IDC_PARX, config->par_x); |
948 |
|
config->par_y = config_get_uint(hDlg, IDC_PARY, config->par_y); |
949 |
|
} |
950 |
|
break; |
951 |
|
|
952 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
case IDD_LEVEL : |
953 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
|
CONSTRAINVAL(config->min_pquant, 1, 31); |
|
|
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
|
954 |
break; |
break; |
955 |
|
|
956 |
case DLG_2PASS : |
case IDD_RC_CBR : |
957 |
|
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
958 |
|
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
959 |
|
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
960 |
|
break; |
961 |
|
|
962 |
|
case IDD_RC_2PASS1 : |
963 |
|
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
964 |
|
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
965 |
|
config->discard1pass = IsDlgChecked(hDlg, IDC_DISCARD1PASS); |
966 |
|
break; |
967 |
|
|
968 |
|
case IDD_RC_2PASS2 : |
969 |
|
if (GetDlgItemText(hDlg, IDC_STATS, config->stats, MAX_PATH) == 0) |
970 |
|
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
971 |
|
|
972 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
|
// added by koepi for the new 2pass curve treatment |
|
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
|
973 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
974 |
//end of koepi's additions |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
|
config->discard1pass = ISDLGSET(IDC_DISCARD1PASS); |
|
|
config->dummy2pass = ISDLGSET(IDC_DUMMY2PASS); |
|
|
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
|
|
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
|
|
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
|
|
config->bitrate_payback_method = ISDLGSET(IDC_PAYBACKPROP); |
|
|
config->hinted_me = ISDLGSET(IDC_HINTEDME); |
|
975 |
|
|
976 |
if (GetDlgItemText(hDlg, IDC_HINTFILE, config->hintfile, MAX_PATH) == 0) |
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
977 |
{ |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
978 |
lstrcpy(config->hintfile, CONFIG_HINTFILE); |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
979 |
} |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
980 |
if (GetDlgItemText(hDlg, IDC_STATS1, config->stats1, MAX_PATH) == 0) |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
981 |
{ |
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
|
lstrcpy(config->stats1, CONFIG_2PASS_1_FILE); |
|
|
} |
|
|
if (GetDlgItemText(hDlg, IDC_STATS2, config->stats2, MAX_PATH) == 0) |
|
|
{ |
|
|
lstrcpy(config->stats2, CONFIG_2PASS_2_FILE); |
|
|
} |
|
982 |
|
|
983 |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
984 |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
985 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
986 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
987 |
|
|
988 |
|
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
989 |
|
|
990 |
break; |
break; |
991 |
|
|
992 |
case DLG_2PASSALT : |
case IDD_ZONE : |
993 |
config->use_alt_curve = ISDLGSET(IDC_USEALT); |
config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); |
994 |
|
|
995 |
config->alt_curve_use_auto = ISDLGSET(IDC_USEAUTO); |
if (IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT)) { |
996 |
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
config->zones[config->cur_zone].mode = RC_ZONE_WEIGHT; |
997 |
|
}else if (IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT)) { |
998 |
|
config->zones[config->cur_zone].mode = RC_ZONE_QUANT; |
999 |
|
} |
1000 |
|
|
1001 |
config->alt_curve_use_auto_bonus_bias = ISDLGSET(IDC_USEAUTOBONUS); |
config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
1002 |
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
1003 |
|
|
1004 |
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
1005 |
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
1006 |
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
|
|
|
|
|
config->twopass_max_bitrate /= CONFIG_KBPS; |
|
|
config->twopass_max_bitrate = config_get_uint(hDlg, IDC_MAXBITRATE, config->twopass_max_bitrate); |
|
|
config->twopass_max_bitrate *= CONFIG_KBPS; |
|
|
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
|
|
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
|
1007 |
|
|
1008 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
config->zones[config->cur_zone].bvop_threshold = config_get_int(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold); |
|
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
|
1009 |
break; |
break; |
1010 |
|
|
1011 |
case DLG_CREDITS : |
case IDD_MOTION : |
1012 |
config->credits_start = ISDLGSET(IDC_CREDITS_START); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1013 |
config->credits_start_begin = GetDlgItemInt(hDlg, IDC_CREDITS_START_BEGIN, NULL, FALSE); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1014 |
config->credits_start_end = config_get_uint(hDlg, IDC_CREDITS_START_END, config->credits_start_end); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1015 |
config->credits_end = ISDLGSET(IDC_CREDITS_END); |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1016 |
config->credits_end_begin = config_get_uint(hDlg, IDC_CREDITS_END_BEGIN, config->credits_end_begin); |
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
|
config->credits_end_end = config_get_uint(hDlg, IDC_CREDITS_END_END, config->credits_end_end); |
|
1017 |
|
|
1018 |
// added by koepi for gruel's greyscale_mode |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
|
config->credits_greyscale = ISDLGSET(IDC_CREDITS_GREYSCALE); |
|
|
// end of koepi's addition |
|
|
config->credits_rate = config_get_uint(hDlg, IDC_CREDITS_RATE, config->credits_rate); |
|
|
config->credits_quant_i = config_get_uint(hDlg, IDC_CREDITS_QUANTI, config->credits_quant_i); |
|
|
config->credits_quant_p = config_get_uint(hDlg, IDC_CREDITS_QUANTP, config->credits_quant_p); |
|
|
config->credits_start_size = config_get_uint(hDlg, IDC_CREDITS_START_SIZE, config->credits_start_size); |
|
|
config->credits_end_size = config_get_uint(hDlg, IDC_CREDITS_END_SIZE, config->credits_end_size); |
|
1019 |
|
|
1020 |
config->credits_mode = 0; |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
1021 |
config->credits_mode = ISDLGSET(IDC_CREDITS_RATE_RADIO) ? CREDITS_MODE_RATE : config->credits_mode; |
break; |
|
config->credits_mode = ISDLGSET(IDC_CREDITS_QUANT_RADIO) ? CREDITS_MODE_QUANT : config->credits_mode; |
|
|
config->credits_mode = ISDLGSET(IDC_CREDITS_SIZE_RADIO) ? CREDITS_MODE_SIZE : config->credits_mode; |
|
1022 |
|
|
1023 |
CONSTRAINVAL(config->credits_rate, 1, 100); |
case IDD_QUANT : |
1024 |
CONSTRAINVAL(config->credits_quant_i, 1, 31); |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
1025 |
CONSTRAINVAL(config->credits_quant_p, 1, 31); |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
1026 |
|
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
1027 |
|
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
1028 |
|
config->min_bquant = config_get_uint(hDlg, IDC_MINBQUANT, config->min_bquant); |
1029 |
|
config->max_bquant = config_get_uint(hDlg, IDC_MAXBQUANT, config->max_bquant); |
1030 |
|
|
1031 |
if (config->credits_start_begin > config->credits_start_end) |
CONSTRAINVAL(config->min_iquant, 1, 31); |
1032 |
{ |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
1033 |
config->credits_start_begin = config->credits_start_end; |
CONSTRAINVAL(config->min_pquant, 1, 31); |
1034 |
config->credits_start = 0; |
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
1035 |
} |
CONSTRAINVAL(config->min_bquant, 1, 31); |
1036 |
if (config->credits_end_begin > config->credits_end_end) |
CONSTRAINVAL(config->max_bquant, config->min_bquant, 31); |
1037 |
{ |
|
1038 |
config->credits_end_begin = config->credits_end_end; |
config->trellis_quant = IsDlgChecked(hDlg, IDC_TRELLISQUANT); |
|
config->credits_end = 0; |
|
|
} |
|
1039 |
break; |
break; |
1040 |
|
|
1041 |
case DLG_CPU : |
case IDD_DEBUG : |
1042 |
config->cpu = 0; |
config->cpu = 0; |
1043 |
config->cpu |= ISDLGSET(IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
1044 |
config->cpu |= ISDLGSET(IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT: 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT : 0; |
1045 |
config->cpu |= ISDLGSET(IDC_CPU_SSE) ? XVID_CPU_SSE: 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE) ? XVID_CPU_SSE : 0; |
1046 |
config->cpu |= ISDLGSET(IDC_CPU_SSE2) ? XVID_CPU_SSE2: 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_SSE2) ? XVID_CPU_SSE2 : 0; |
1047 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOW) ? XVID_CPU_3DNOW: 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOW) ? XVID_CPU_3DNOW : 0; |
1048 |
config->cpu |= ISDLGSET(IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT: 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT : 0; |
1049 |
config->cpu |= ISDLGSET(IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
1050 |
|
|
1051 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
1052 |
config->chroma_opt = ISDLGSET(IDC_CHROMA_OPT); |
|
1053 |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
1054 |
config->rc_reaction_delay_factor = config_get_uint(hDlg, IDC_CBR_REACTIONDELAY, config->rc_reaction_delay_factor); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1055 |
config->rc_averaging_period = config_get_uint(hDlg, IDC_CBR_AVERAGINGPERIOD, config->rc_averaging_period); |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1056 |
config->rc_buffer = config_get_uint(hDlg, IDC_CBR_BUFFER, config->rc_buffer); |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1057 |
break; |
break; |
1058 |
} |
} |
1059 |
} |
} |
1060 |
|
|
1061 |
|
|
|
void quant_upload(HWND hDlg, CONFIG* config) |
|
|
{ |
|
|
int i; |
|
|
|
|
|
for (i=0 ; i<64 ; ++i) |
|
|
{ |
|
|
SetDlgItemInt(hDlg, IDC_QINTRA00 + i, config->qmatrix_intra[i], FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_QINTER00 + i, config->qmatrix_inter[i], FALSE); |
|
|
} |
|
|
} |
|
|
|
|
1062 |
|
|
1063 |
void quant_download(HWND hDlg, CONFIG* config) |
/* advanced dialog proc */ |
|
{ |
|
|
int i; |
|
1064 |
|
|
1065 |
for (i=0 ; i<64 ; ++i) |
BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1066 |
{ |
{ |
1067 |
int temp; |
PROPSHEETINFO *psi; |
1068 |
|
|
1069 |
temp = config_get_uint(hDlg, i + IDC_QINTRA00, config->qmatrix_intra[i]); |
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
|
CONSTRAINVAL(temp, 1, 255); |
|
|
config->qmatrix_intra[i] = temp; |
|
1070 |
|
|
1071 |
temp = config_get_uint(hDlg, i + IDC_QINTER00, config->qmatrix_inter[i]); |
switch (uMsg) |
1072 |
CONSTRAINVAL(temp, 1, 255); |
{ |
1073 |
config->qmatrix_inter[i] = temp; |
case WM_INITDIALOG : |
1074 |
} |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
1075 |
} |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
1076 |
|
|
1077 |
|
if (g_hTooltip) |
1078 |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
1079 |
|
|
1080 |
/* enumerates child windows, assigns tooltips */ |
adv_init(hDlg, psi->idd, psi->config); |
1081 |
|
break; |
1082 |
|
|
1083 |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
case WM_COMMAND : |
1084 |
|
if (HIWORD(wParam) == BN_CLICKED) |
1085 |
{ |
{ |
1086 |
char help[500]; |
switch (LOWORD(wParam)) |
|
|
|
|
if (LoadString(hInst, GetDlgCtrlID(hWnd), help, 500)) |
|
1087 |
{ |
{ |
1088 |
TOOLINFO ti; |
case IDC_BVOP : |
1089 |
|
case IDC_ZONE_MODE_WEIGHT : |
1090 |
ti.cbSize = sizeof(TOOLINFO); |
case IDC_ZONE_MODE_QUANT : |
1091 |
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND; |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1092 |
ti.hwnd = GetParent(hWnd); |
case IDC_CPU_AUTO : |
1093 |
ti.uId = (LPARAM)hWnd; |
case IDC_CPU_FORCE : |
1094 |
ti.lpszText = help; |
case IDC_AR : |
1095 |
|
case IDC_PAR : |
1096 |
SendMessage(hTooltip, TTM_ADDTOOL, 0, (LPARAM)&ti); |
adv_mode(hDlg, psi->idd, psi->config); |
1097 |
} |
break; |
1098 |
|
|
1099 |
return TRUE; |
case IDC_QUANTMATRIX : |
1100 |
} |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
1101 |
|
break; |
1102 |
|
|
1103 |
|
case IDC_STATS_BROWSE : |
1104 |
|
{ |
1105 |
|
OPENFILENAME ofn; |
1106 |
|
char tmp[MAX_PATH]; |
1107 |
|
|
1108 |
|
GetDlgItemText(hDlg, IDC_STATS, tmp, MAX_PATH); |
1109 |
|
|
1110 |
/* --- decoder options dialog --- */ |
memset(&ofn, 0, sizeof(OPENFILENAME)); |
1111 |
|
ofn.lStructSize = sizeof(OPENFILENAME); |
1112 |
|
|
1113 |
#define DEC_DLG_COUNT 1 |
ofn.hwndOwner = hDlg; |
1114 |
#define DEC_DLG_POSTPROC 0 |
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
1115 |
|
ofn.lpstrFile = tmp; |
1116 |
|
ofn.nMaxFile = MAX_PATH; |
1117 |
|
ofn.Flags = OFN_PATHMUSTEXIST; |
1118 |
|
|
1119 |
/* decoder dialog: upload config data */ |
if (psi->idd == IDD_RC_2PASS1) { |
1120 |
|
ofn.Flags |= OFN_OVERWRITEPROMPT; |
1121 |
|
}else{ |
1122 |
|
ofn.Flags |= OFN_FILEMUSTEXIST; |
1123 |
|
} |
1124 |
|
|
1125 |
void dec_upload(HWND hDlg, int page, CONFIG * config) |
if (GetSaveFileName(&ofn)) |
|
{ |
|
|
switch (page) |
|
1126 |
{ |
{ |
1127 |
case DEC_DLG_POSTPROC : |
SetDlgItemText(hDlg, IDC_STATS, tmp); |
|
CheckDlgButton(hDlg, IDC_DEBLOCK_Y, config->deblock_y ? BST_CHECKED : BST_UNCHECKED); |
|
|
CheckDlgButton(hDlg, IDC_DEBLOCK_UV, config->deblock_uv ? BST_CHECKED : BST_UNCHECKED); |
|
|
break; |
|
1128 |
} |
} |
1129 |
} |
} |
1130 |
|
|
1131 |
|
case IDC_ZONE_FETCH : |
1132 |
|
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1133 |
|
break; |
1134 |
|
|
1135 |
/* dec dialog: download config data */ |
case IDC_AR_DEFAULT: |
1136 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_PAR); |
1137 |
void dec_download(HWND hDlg, int page, CONFIG * config) |
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, 0, 0); |
1138 |
{ |
adv_mode(hDlg, psi->idd, psi->config); |
1139 |
switch (page) |
break; |
1140 |
{ |
case IDC_AR_4_3: |
1141 |
case DEC_DLG_POSTPROC : |
SetDlgItemInt(hDlg, IDC_ARX, 4, FALSE); |
1142 |
config->deblock_y = ISDLGSET(IDC_DEBLOCK_Y); |
SetDlgItemInt(hDlg, IDC_ARY, 3, FALSE); |
1143 |
config->deblock_uv = ISDLGSET(IDC_DEBLOCK_UV); |
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1144 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1145 |
|
break; |
1146 |
|
case IDC_AR_16_9: |
1147 |
|
SetDlgItemInt(hDlg, IDC_ARX, 16, FALSE); |
1148 |
|
SetDlgItemInt(hDlg, IDC_ARY, 9, FALSE); |
1149 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1150 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1151 |
break; |
break; |
1152 |
|
case IDC_AR_235_100: |
1153 |
|
SetDlgItemInt(hDlg, IDC_ARX, 235, FALSE); |
1154 |
|
SetDlgItemInt(hDlg, IDC_ARY, 100, FALSE); |
1155 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1156 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1157 |
|
break; |
1158 |
|
|
1159 |
|
default : |
1160 |
|
return TRUE; |
1161 |
} |
} |
1162 |
|
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1163 |
|
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1164 |
|
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1165 |
|
LOWORD(wParam) == IDC_QUANTTYPE || |
1166 |
|
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
1167 |
|
{ |
1168 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1169 |
|
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
1170 |
|
|
1171 |
|
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1172 |
|
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1173 |
|
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1174 |
|
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1175 |
|
if(LOWORD(wParam)==IDC_PARX) |
1176 |
|
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1177 |
|
else |
1178 |
|
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1179 |
} |
} |
1180 |
|
} else |
1181 |
|
return 0; |
1182 |
|
break; |
1183 |
|
|
1184 |
/* decoder dialog proc */ |
case WM_HSCROLL : |
1185 |
|
if((HWND)lParam == GetDlgItem(hDlg, IDC_ZONE_SLIDER)) { |
1186 |
BOOL CALLBACK dec_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
int idc = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT) ? IDC_ZONE_WEIGHT : IDC_ZONE_QUANT; |
1187 |
{ |
set_dlgitem_float(hDlg, idc, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0) ); |
1188 |
PROPSHEETINFO *psi; |
break; |
|
|
|
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
|
|
|
|
|
switch (uMsg) |
|
|
{ |
|
|
case WM_INITDIALOG : |
|
|
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
|
|
|
|
|
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
|
|
|
|
|
if (hTooltip) |
|
|
{ |
|
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
1189 |
} |
} |
1190 |
|
return 0; |
1191 |
|
|
|
dec_upload(hDlg, psi->page, psi->config); |
|
|
break; |
|
1192 |
|
|
1193 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1194 |
switch (((NMHDR *)lParam)->code) |
switch (((NMHDR *)lParam)->code) |
1195 |
{ |
{ |
1196 |
|
case PSN_SETACTIVE : |
1197 |
|
OutputDebugString("PSN_SET"); |
1198 |
|
adv_upload(hDlg, psi->idd, psi->config); |
1199 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1200 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1201 |
|
break; |
1202 |
|
|
1203 |
case PSN_KILLACTIVE : |
case PSN_KILLACTIVE : |
1204 |
/* validate */ |
OutputDebugString("PSN_KILL"); |
1205 |
dec_download(hDlg, psi->page, psi->config); |
adv_download(hDlg, psi->idd, psi->config); |
1206 |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1207 |
break; |
break; |
1208 |
|
|
1209 |
case PSN_APPLY : |
case PSN_APPLY : |
1210 |
/* apply */ |
OutputDebugString("PSN_APPLY"); |
|
dec_download(hDlg, psi->page, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
1211 |
psi->config->save = TRUE; |
psi->config->save = TRUE; |
1212 |
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
1213 |
break; |
break; |
1214 |
} |
} |
1215 |
break; |
break; |
1222 |
} |
} |
1223 |
|
|
1224 |
|
|
1225 |
void dec_dialog(HWND hParent, CONFIG * config) |
|
1226 |
|
|
1227 |
|
/* load advanced options property sheet |
1228 |
|
returns true, if the user accepted the changes |
1229 |
|
or fasle if changes were canceled. |
1230 |
|
|
1231 |
|
*/ |
1232 |
|
BOOL adv_dialog(HWND hParent, CONFIG * config, const int * dlgs, int size) |
1233 |
{ |
{ |
1234 |
PROPSHEETINFO psi[DEC_DLG_COUNT]; |
PROPSHEETINFO psi[6]; |
1235 |
PROPSHEETPAGE psp[DEC_DLG_COUNT]; |
PROPSHEETPAGE psp[6]; |
1236 |
PROPSHEETHEADER psh; |
PROPSHEETHEADER psh; |
1237 |
CONFIG temp; |
CONFIG temp; |
1238 |
int i; |
int i; |
1240 |
config->save = FALSE; |
config->save = FALSE; |
1241 |
memcpy(&temp, config, sizeof(CONFIG)); |
memcpy(&temp, config, sizeof(CONFIG)); |
1242 |
|
|
1243 |
for (i=0 ; i<DEC_DLG_COUNT ; ++i) |
for (i=0; i<size; i++) |
1244 |
{ |
{ |
1245 |
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
psp[i].dwSize = sizeof(PROPSHEETPAGE); |
1246 |
psp[i].dwFlags = 0; |
psp[i].dwFlags = 0; |
1247 |
psp[i].hInstance = hInst; |
psp[i].hInstance = g_hInst; |
1248 |
psp[i].pfnDlgProc = dec_proc; |
psp[i].pfnDlgProc = adv_proc; |
1249 |
psp[i].lParam = (LPARAM)&psi[i]; |
psp[i].lParam = (LPARAM)&psi[i]; |
1250 |
psp[i].pfnCallback = NULL; |
psp[i].pfnCallback = NULL; |
1251 |
|
psp[i].pszTemplate = MAKEINTRESOURCE(dlgs[i]); |
1252 |
|
|
1253 |
psi[i].page = i; |
psi[i].idd = dlgs[i]; |
1254 |
psi[i].config = &temp; |
psi[i].config = &temp; |
1255 |
} |
} |
1256 |
|
|
|
psp[DEC_DLG_POSTPROC].pszTemplate = MAKEINTRESOURCE(IDD_POSTPROC); |
|
|
|
|
1257 |
psh.dwSize = sizeof(PROPSHEETHEADER); |
psh.dwSize = sizeof(PROPSHEETHEADER); |
1258 |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW; |
1259 |
psh.hwndParent = hParent; |
psh.hwndParent = hParent; |
1260 |
psh.hInstance = hInst; |
psh.hInstance = g_hInst; |
1261 |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
psh.pszCaption = (LPSTR) "XviD Configuration"; |
1262 |
psh.nPages = DEC_DLG_COUNT; |
psh.nPages = size; |
1263 |
psh.nStartPage = DEC_DLG_POSTPROC; |
psh.nStartPage = 0; |
1264 |
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
psh.ppsp = (LPCPROPSHEETPAGE)&psp; |
1265 |
psh.pfnCallback = NULL; |
psh.pfnCallback = NULL; |
|
|
|
1266 |
PropertySheet(&psh); |
PropertySheet(&psh); |
1267 |
|
|
1268 |
if (temp.save) |
if (temp.save) |
1269 |
|
memcpy(config, &temp, sizeof(CONFIG)); |
1270 |
|
|
1271 |
|
return temp.save; |
1272 |
|
} |
1273 |
|
|
1274 |
|
/* ===================================================================================== */ |
1275 |
|
/* MAIN DIALOG ========================================================================= */ |
1276 |
|
/* ===================================================================================== */ |
1277 |
|
|
1278 |
|
|
1279 |
|
void main_insert_zone(HWND hDlg, zone_t * s, int i, BOOL insert) |
1280 |
|
{ |
1281 |
|
char tmp[32]; |
1282 |
|
|
1283 |
|
wsprintf(tmp,"%i",s->frame); |
1284 |
|
|
1285 |
|
if (insert) { |
1286 |
|
LVITEM lvi; |
1287 |
|
|
1288 |
|
lvi.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM | LVIF_STATE; |
1289 |
|
lvi.state = 0; |
1290 |
|
lvi.stateMask = 0; |
1291 |
|
lvi.iImage = 0; |
1292 |
|
lvi.pszText = tmp; |
1293 |
|
lvi.cchTextMax = strlen(tmp); |
1294 |
|
lvi.iItem = i; |
1295 |
|
lvi.iSubItem = 0; |
1296 |
|
ListView_InsertItem(hDlg, &lvi); |
1297 |
|
}else{ |
1298 |
|
ListView_SetItemText(hDlg, i, 0, tmp); |
1299 |
|
} |
1300 |
|
|
1301 |
|
if (s->mode == RC_ZONE_WEIGHT) { |
1302 |
|
sprintf(tmp,"%.2f",(float)s->weight/100); |
1303 |
|
}else if (s->mode == RC_ZONE_QUANT) { |
1304 |
|
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
1305 |
|
}else { |
1306 |
|
strcpy(tmp,"EXT"); |
1307 |
|
} |
1308 |
|
ListView_SetItemText(hDlg, i, 1, tmp); |
1309 |
|
|
1310 |
|
tmp[0] = '\0'; |
1311 |
|
if (s->type==XVID_TYPE_IVOP) |
1312 |
|
strcat(tmp, "K "); |
1313 |
|
|
1314 |
|
if (s->greyscale) |
1315 |
|
strcat(tmp, "G "); |
1316 |
|
|
1317 |
|
if (s->chroma_opt) |
1318 |
|
strcat(tmp, "C "); |
1319 |
|
|
1320 |
|
ListView_SetItemText(hDlg, i, 2, tmp); |
1321 |
|
} |
1322 |
|
|
1323 |
|
static int g_use_bitrate = 1; |
1324 |
|
|
1325 |
|
void main_mode(HWND hDlg, CONFIG * config) |
1326 |
|
{ |
1327 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1328 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1329 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1330 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1331 |
|
|
1332 |
|
char buf[16]; |
1333 |
|
int max; |
1334 |
|
|
1335 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1336 |
|
|
1337 |
|
if (g_use_bitrate) { |
1338 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1339 |
|
|
1340 |
|
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1341 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1342 |
|
|
1343 |
|
max = profiles[profile].max_bitrate; |
1344 |
|
if (max == 0) max = DEFAULT_MAX_KBPS; |
1345 |
|
wsprintf(buf, "%i kbps", max); |
1346 |
|
SetDlgItemText(hDlg, IDC_BITRATE_MAX, buf); |
1347 |
|
|
1348 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(DEFAULT_MIN_KBPS, max)); |
1349 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1350 |
|
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1351 |
|
|
1352 |
|
}else{ |
1353 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1354 |
|
} |
1355 |
|
|
1356 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1357 |
|
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1358 |
|
|
1359 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1360 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1361 |
|
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
1362 |
|
} |
1363 |
|
|
1364 |
|
|
1365 |
|
|
1366 |
|
void main_upload(HWND hDlg, CONFIG * config) |
1367 |
|
{ |
1368 |
|
int i; |
1369 |
|
|
1370 |
|
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1371 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1372 |
|
|
1373 |
|
if (g_use_bitrate) { |
1374 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1375 |
|
}else{ |
1376 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1377 |
|
} |
1378 |
|
|
1379 |
|
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1380 |
|
for (i=0; i < config->num_zones; i++) { |
1381 |
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
1382 |
|
} |
1383 |
|
} |
1384 |
|
|
1385 |
|
|
1386 |
|
/* downloads data from main dialog */ |
1387 |
|
void main_download(HWND hDlg, CONFIG * config) |
1388 |
{ |
{ |
1389 |
memcpy(config, &temp, sizeof(CONFIG)); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1390 |
|
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1391 |
|
|
1392 |
|
if (g_use_bitrate) { |
1393 |
|
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1394 |
|
}else{ |
1395 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1396 |
} |
} |
1397 |
} |
} |
1398 |
|
|
1399 |
|
|
|
|
|
1400 |
/* main dialog proc */ |
/* main dialog proc */ |
1401 |
|
|
1402 |
|
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL, IDD_AR }; |
1403 |
|
static const int single_dlgs[] = { IDD_RC_CBR }; |
1404 |
|
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1405 |
|
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1406 |
|
static const int zone_dlgs[] = { IDD_ZONE }; |
1407 |
|
static const int bitrate_dlgs[] = { IDD_CALC }; |
1408 |
|
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1409 |
|
|
1410 |
|
|
1411 |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1412 |
{ |
{ |
1413 |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
1414 |
|
unsigned int i; |
1415 |
|
|
1416 |
switch (uMsg) |
switch (uMsg) |
1417 |
{ |
{ |
1418 |
case WM_INITDIALOG : |
case WM_INITDIALOG : |
1419 |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
|
1420 |
config = (CONFIG*)lParam; |
config = (CONFIG*)lParam; |
1421 |
|
|
1422 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - CBR"); |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) |
1423 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quality"); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"1 Pass - quantizer"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 1st pass"); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Ext."); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"2 Pass - 2nd pass Int."); |
|
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null - test speed"); |
|
1424 |
|
|
1425 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Single pass"); |
1426 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Twopass - 1st pass"); |
1427 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Twopass - 2nd pass"); |
1428 |
|
#ifdef _DEBUG |
1429 |
|
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null test speed"); |
1430 |
|
#endif |
1431 |
|
|
1432 |
InitCommonControls(); |
InitCommonControls(); |
1433 |
|
|
1434 |
if ((hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1435 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1436 |
NULL, NULL, hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1437 |
{ |
{ |
1438 |
SetWindowPos(hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
SetWindowPos(g_hTooltip, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE); |
1439 |
SendMessage(hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
SendMessage(g_hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
1440 |
SendMessage(hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
SendMessage(g_hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
1441 |
|
|
1442 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1443 |
} |
} |
1444 |
|
|
1445 |
main_slider(hDlg, config); |
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
|
main_value(hDlg, config); |
|
|
break; |
|
1446 |
|
|
|
case WM_HSCROLL : |
|
|
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) |
|
|
{ |
|
|
SetDlgItemInt(hDlg, IDC_VALUE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
|
|
} |
|
|
else |
|
1447 |
{ |
{ |
1448 |
return 0; |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1449 |
|
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1450 |
|
ListView_SetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES), ext_style); |
1451 |
} |
} |
|
break; |
|
1452 |
|
|
|
case WM_COMMAND : |
|
|
if (LOWORD(wParam) == IDC_MODE && HIWORD(wParam) == LBN_SELCHANGE) |
|
|
{ |
|
|
main_download(hDlg, config); |
|
|
main_slider(hDlg, config); |
|
|
main_value(hDlg, config); |
|
|
} |
|
|
else if (LOWORD(wParam) == IDC_ADVANCED && HIWORD(wParam) == BN_CLICKED) |
|
1453 |
{ |
{ |
1454 |
adv_dialog(hDlg, config); |
typedef struct { |
1455 |
|
char * name; |
1456 |
|
int value; |
1457 |
|
} char_int_t; |
1458 |
|
|
1459 |
if (config->save) |
const static char_int_t columns[] = { |
1460 |
{ |
{"Frame #", 64}, |
1461 |
config_reg_set(config); |
{"Weight (Q)", 72}, |
1462 |
} |
{"Modifiers", 120}}; |
|
} |
|
|
else if (LOWORD(wParam) == IDC_DECODER && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
dec_dialog(hDlg, config); |
|
1463 |
|
|
1464 |
if (config->save) |
LVCOLUMN lvc; |
1465 |
{ |
int i; |
1466 |
config_reg_set(config); |
|
1467 |
|
/* Initialize the LVCOLUMN structure. */ |
1468 |
|
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
1469 |
|
lvc.fmt = LVCFMT_LEFT; |
1470 |
|
|
1471 |
|
/* Add the columns. */ |
1472 |
|
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
1473 |
|
lvc.pszText = (char*)columns[i].name; |
1474 |
|
lvc.cchTextMax = strlen(columns[i].name); |
1475 |
|
lvc.iSubItem = i; |
1476 |
|
lvc.cx = columns[i].value; /* column width, pixels */ |
1477 |
|
ListView_InsertColumn(GetDlgItem(hDlg,IDC_ZONES), i, &lvc); |
1478 |
} |
} |
1479 |
} |
} |
|
else if (LOWORD(wParam) == IDC_DEFAULTS && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
config_reg_default(config); |
|
1480 |
|
|
1481 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1482 |
|
main_upload(hDlg, config); |
1483 |
|
main_mode(hDlg, config); |
1484 |
|
main_upload(hDlg, config); |
1485 |
|
break; |
1486 |
|
|
1487 |
main_slider(hDlg, config); |
case WM_NOTIFY : |
|
main_value(hDlg, config); |
|
|
} |
|
|
else if (HIWORD(wParam) == EN_UPDATE && LOWORD(wParam) == IDC_VALUE) |
|
1488 |
{ |
{ |
1489 |
int value = config_get_uint(hDlg, IDC_VALUE, 1); |
NMHDR * n = (NMHDR*)lParam; |
|
int max = 1; |
|
1490 |
|
|
1491 |
max = (config->mode == DLG_MODE_CBR) ? 10000 : |
if (n->code == NM_DBLCLK) { |
1492 |
((config->mode == DLG_MODE_VBR_QUAL) ? 100 : |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1493 |
((config->mode == DLG_MODE_VBR_QUANT) ? 31 : 1<<30)); |
config->cur_zone = nmlv->iItem; |
1494 |
|
|
1495 |
if (value < 1) |
main_download(hDlg, config); |
1496 |
{ |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1497 |
value = 1; |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
1498 |
} |
} |
1499 |
if (value > max) |
break; |
|
{ |
|
|
value = max; |
|
|
SetDlgItemInt(hDlg, IDC_VALUE, value, FALSE); |
|
1500 |
} |
} |
1501 |
|
|
1502 |
if (config->mode != DLG_MODE_2PASS_2_INT) |
if (n->code == NM_RCLICK) { |
1503 |
{ |
OutputDebugString("Right click"); |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, value); |
|
|
} |
|
|
} |
|
|
else if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
main_download(hDlg, config); |
|
|
config->save = TRUE; |
|
|
EndDialog(hDlg, IDOK); |
|
|
} |
|
|
else if (LOWORD(wParam) == IDCANCEL) |
|
|
{ |
|
|
config->save = FALSE; |
|
|
EndDialog(hDlg, IDCANCEL); |
|
1504 |
} |
} |
1505 |
break; |
break; |
|
|
|
|
default : |
|
|
return 0; |
|
1506 |
} |
} |
1507 |
|
|
1508 |
return 1; |
case WM_COMMAND : |
1509 |
} |
if (HIWORD(wParam) == BN_CLICKED) { |
1510 |
|
|
1511 |
|
switch(LOWORD(wParam)) { |
1512 |
|
case IDC_PROFILE_ADV : |
1513 |
|
main_download(hDlg, config); |
1514 |
|
adv_dialog(hDlg, config, profile_dlgs, sizeof(profile_dlgs)/sizeof(int)); |
1515 |
|
|
1516 |
/* advanced dialog proc */ |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1517 |
|
main_mode(hDlg, config); |
1518 |
|
break; |
1519 |
|
|
1520 |
BOOL CALLBACK adv_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
case IDC_MODE_ADV : |
1521 |
{ |
main_download(hDlg, config); |
1522 |
PROPSHEETINFO *psi; |
if (config->mode == RC_MODE_1PASS) { |
1523 |
|
adv_dialog(hDlg, config, single_dlgs, sizeof(single_dlgs)/sizeof(int)); |
1524 |
|
}else if (config->mode == RC_MODE_2PASS1) { |
1525 |
|
adv_dialog(hDlg, config, pass1_dlgs, sizeof(pass1_dlgs)/sizeof(int)); |
1526 |
|
}else if (config->mode == RC_MODE_2PASS2) { |
1527 |
|
adv_dialog(hDlg, config, pass2_dlgs, sizeof(pass2_dlgs)/sizeof(int)); |
1528 |
|
} |
1529 |
|
break; |
1530 |
|
|
|
psi = (PROPSHEETINFO*)GetWindowLong(hDlg, GWL_USERDATA); |
|
1531 |
|
|
1532 |
switch (uMsg) |
case IDC_BITRATE_S : |
1533 |
{ |
/* alternate between bitrate/desired_length metrics */ |
1534 |
case WM_INITDIALOG : |
main_download(hDlg, config); |
1535 |
psi = (PROPSHEETINFO*) ((LPPROPSHEETPAGE)lParam)->lParam; |
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1536 |
|
main_mode(hDlg, config); |
1537 |
|
main_upload(hDlg, config); |
1538 |
|
break; |
1539 |
|
|
1540 |
SetWindowLong(hDlg, GWL_USERDATA, (LPARAM)psi); |
case IDC_BITRATE_CALC : |
1541 |
|
main_download(hDlg, config); |
1542 |
|
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1543 |
|
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1544 |
|
main_mode(hDlg, config); |
1545 |
|
break; |
1546 |
|
|
1547 |
if (psi->page == DLG_GLOBAL) |
case IDC_ADD : |
1548 |
{ |
{ |
1549 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"0 - None"); |
int i, sel, new_frame; |
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"1 - Very Low"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"2 - Low"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"3 - Medium"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"4 - High"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"5 - Very High"); |
|
|
SendDlgItemMessage(hDlg, IDC_MOTION, CB_ADDSTRING, 0, (LPARAM)"6 - Ultra High"); |
|
1550 |
|
|
1551 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
if (config->num_zones >= MAX_ZONES) { |
1552 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1553 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
break; |
1554 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"Modulated"); |
} |
|
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"New Modulated HQ"); |
|
1555 |
|
|
1556 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"XVID"); |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DIVX"); |
|
|
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_ADDSTRING, 0, (LPARAM)"DX50"); |
|
1557 |
|
|
1558 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"0 - Off"); |
if (sel<0) { |
1559 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"1 - Mode Decision"); |
if (config->ci_valid && config->ci.ciActiveFrame>0) { |
1560 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"2 - Limited Search"); |
for(sel=0; sel<config->num_zones-1 && config->zones[sel].frame<config->ci.ciActiveFrame; sel++) ; |
1561 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"3 - Medium Search"); |
sel--; |
1562 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
new_frame = config->ci.ciActiveFrame; |
1563 |
/* XXX: reduced resolution is not ready for prime-time */ |
}else{ |
1564 |
ShowWindow(GetDlgItem(hDlg, IDC_REDUCED), SW_HIDE); |
sel = config->num_zones-1; |
1565 |
|
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1566 |
} |
} |
1567 |
else if (psi->page == DLG_2PASSALT) |
}else{ |
1568 |
{ |
new_frame = config->zones[sel].frame + 1; |
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Low"); |
|
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"Medium"); |
|
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_ADDSTRING, 0, (LPARAM)"High"); |
|
|
} |
|
|
else if (psi->page == DLG_CPU) |
|
|
{ |
|
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
|
|
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
|
1569 |
} |
} |
1570 |
|
|
1571 |
if (hTooltip) |
for(i=config->num_zones-1; i>sel; i--) { |
1572 |
{ |
config->zones[i+1] = config->zones[i]; |
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
1573 |
} |
} |
1574 |
|
config->num_zones++; |
1575 |
|
config->zones[sel+1].frame = new_frame; |
1576 |
|
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1577 |
|
config->zones[sel+1].weight = 100; |
1578 |
|
config->zones[sel+1].quant = 500; |
1579 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1580 |
|
config->zones[sel+1].greyscale = 0; |
1581 |
|
config->zones[sel+1].chroma_opt = 0; |
1582 |
|
config->zones[sel+1].bvop_threshold = 0; |
1583 |
|
|
1584 |
adv_upload(hDlg, psi->page, psi->config); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1585 |
adv_mode(hDlg, psi->config->mode); |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
1586 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1587 |
break; |
break; |
1588 |
|
} |
1589 |
|
|
1590 |
case WM_COMMAND : |
case IDC_REMOVE : |
|
if (HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
switch (LOWORD(wParam)) |
|
1591 |
{ |
{ |
1592 |
case IDC_HINTEDME : |
int i, sel; |
1593 |
case IDC_USEALT : |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1594 |
case IDC_USEAUTO : |
|
1595 |
case IDC_USEAUTOBONUS : |
if (sel == -1) { |
1596 |
case IDC_CREDITS_START : |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
|
case IDC_CREDITS_END : |
|
|
case IDC_CREDITS_RATE_RADIO : |
|
|
case IDC_CREDITS_QUANT_RADIO : |
|
|
case IDC_CREDITS_SIZE_RADIO : |
|
|
case IDC_CPU_AUTO : |
|
|
case IDC_CPU_FORCE : |
|
|
adv_mode(hDlg, psi->config->mode); |
|
1597 |
break; |
break; |
1598 |
} |
} |
|
} |
|
|
if ((LOWORD(wParam) == IDC_HINT_BROWSE || LOWORD(wParam) == IDC_STATS1_BROWSE || LOWORD(wParam) == IDC_STATS2_BROWSE) && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
OPENFILENAME ofn; |
|
|
char tmp[MAX_PATH]; |
|
|
int hComponent = (LOWORD(wParam) == IDC_STATS1_BROWSE ? IDC_STATS1 : IDC_STATS2); |
|
|
|
|
|
GetDlgItemText(hDlg, hComponent, tmp, MAX_PATH); |
|
|
|
|
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
|
|
ofn.lStructSize = sizeof(OPENFILENAME); |
|
|
|
|
|
ofn.hwndOwner = hDlg; |
|
|
ofn.lpstrFilter = "bitrate curve (*.stats)\0*.stats\0All files (*.*)\0*.*\0\0"; |
|
|
ofn.lpstrFile = tmp; |
|
|
ofn.nMaxFile = MAX_PATH; |
|
|
ofn.Flags = OFN_PATHMUSTEXIST; |
|
1599 |
|
|
1600 |
if (LOWORD(wParam) == IDC_HINT_BROWSE) |
for (i=sel; i<config->num_zones-1; i++) { |
1601 |
{ |
config->zones[i] = config->zones[i+1]; |
|
ofn.lpstrFilter = "motion hints (*.mvh)\0*.mvh\0All files (*.*)\0*.*\0\0"; |
|
|
if (GetOpenFileName(&ofn)) |
|
|
{ |
|
|
SetDlgItemText(hDlg, IDC_HINTFILE, tmp); |
|
|
} |
|
1602 |
} |
} |
1603 |
else if (LOWORD(wParam) == IDC_STATS1_BROWSE && |
config->num_zones--; |
1604 |
psi->config->mode == DLG_MODE_2PASS_1) |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
|
{ |
|
|
ofn.Flags |= OFN_OVERWRITEPROMPT; |
|
|
if (GetSaveFileName(&ofn)) |
|
|
{ |
|
|
SetDlgItemText(hDlg, hComponent, tmp); |
|
|
} |
|
|
} |
|
|
else |
|
|
{ |
|
|
ofn.Flags |= OFN_FILEMUSTEXIST; |
|
|
if (GetOpenFileName(&ofn)) { |
|
|
SetDlgItemText(hDlg, hComponent, tmp); |
|
|
} |
|
|
} |
|
|
} |
|
|
else if (LOWORD(wParam) == IDC_QUANTMATRIX && HIWORD(wParam) == BN_CLICKED) |
|
|
{ |
|
|
DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_QUANTMATRIX), hDlg, quantmatrix_proc, (LPARAM)psi->config); |
|
|
} |
|
|
break; |
|
1605 |
|
|
1606 |
case WM_NOTIFY : |
sel--; |
1607 |
switch (((NMHDR *)lParam)->code) |
if (sel==0 && config->num_zones>1) { |
1608 |
{ |
sel=1; |
|
case PSN_KILLACTIVE : |
|
|
/* validate */ |
|
|
adv_download(hDlg, psi->page, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
|
break; |
|
|
|
|
|
case PSN_APPLY : |
|
|
/* apply */ |
|
|
adv_download(hDlg, psi->page, psi->config); |
|
|
SetWindowLong(hDlg, DWL_MSGRESULT, FALSE); |
|
|
psi->config->save = TRUE; |
|
|
break; |
|
1609 |
} |
} |
1610 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
1611 |
break; |
break; |
|
|
|
|
default : |
|
|
return 0; |
|
1612 |
} |
} |
1613 |
|
|
1614 |
return 1; |
case IDC_EDIT : |
1615 |
|
main_download(hDlg, config); |
1616 |
|
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1617 |
|
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1618 |
|
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
1619 |
} |
} |
1620 |
|
break; |
1621 |
|
|
1622 |
|
case IDC_ADVANCED : |
1623 |
|
main_download(hDlg, config); |
1624 |
|
adv_dialog(hDlg, config, adv_dlgs, sizeof(adv_dlgs)/sizeof(int)); |
1625 |
|
break; |
1626 |
|
|
1627 |
/* quantization matrix dialog proc */ |
case IDC_DEFAULTS : |
1628 |
|
config_reg_default(config); |
1629 |
BOOL CALLBACK quantmatrix_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
main_upload(hDlg, config); |
|
{ |
|
|
CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA); |
|
|
|
|
|
switch (uMsg) |
|
|
{ |
|
|
case WM_INITDIALOG : |
|
|
SetWindowLong(hDlg, GWL_USERDATA, lParam); |
|
|
config = (CONFIG*)lParam; |
|
|
quant_upload(hDlg, config); |
|
|
|
|
|
if (hTooltip) |
|
|
{ |
|
|
EnumChildWindows(hDlg, enum_tooltips, 0); |
|
|
} |
|
1630 |
break; |
break; |
1631 |
|
|
1632 |
case WM_COMMAND : |
case IDOK : |
1633 |
if (LOWORD(wParam) == IDOK && HIWORD(wParam) == BN_CLICKED) |
main_download(hDlg, config); |
1634 |
{ |
config->save = TRUE; |
|
quant_download(hDlg, config); |
|
1635 |
EndDialog(hDlg, IDOK); |
EndDialog(hDlg, IDOK); |
1636 |
} |
break; |
1637 |
else if (LOWORD(wParam) == IDCANCEL) |
|
1638 |
{ |
case IDCANCEL : |
1639 |
|
config->save = FALSE; |
1640 |
EndDialog(hDlg, IDCANCEL); |
EndDialog(hDlg, IDCANCEL); |
1641 |
|
break; |
1642 |
} |
} |
1643 |
else if ((LOWORD(wParam) == IDC_LOAD || LOWORD(wParam) == IDC_SAVE) && HIWORD(wParam) == BN_CLICKED) |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1644 |
{ |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
|
OPENFILENAME ofn; |
|
|
char file[MAX_PATH]; |
|
|
|
|
|
HANDLE hFile; |
|
|
DWORD read=128, wrote=0; |
|
|
BYTE quant_data[128]; |
|
|
|
|
|
strcpy(file, "\\matrix"); |
|
|
memset(&ofn, 0, sizeof(OPENFILENAME)); |
|
|
ofn.lStructSize = sizeof(OPENFILENAME); |
|
|
|
|
|
ofn.hwndOwner = hDlg; |
|
|
ofn.lpstrFilter = "All files (*.*)\0*.*\0\0"; |
|
|
ofn.lpstrFile = file; |
|
|
ofn.nMaxFile = MAX_PATH; |
|
|
ofn.Flags = OFN_PATHMUSTEXIST; |
|
1645 |
|
|
1646 |
if (LOWORD(wParam) == IDC_SAVE) |
main_download(hDlg, config); |
1647 |
{ |
main_mode(hDlg, config); |
1648 |
ofn.Flags |= OFN_OVERWRITEPROMPT; |
main_upload(hDlg, config); |
|
if (GetSaveFileName(&ofn)) |
|
|
{ |
|
|
hFile = CreateFile(file, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); |
|
|
|
|
|
quant_download(hDlg, config); |
|
|
memcpy(quant_data, config->qmatrix_intra, 64); |
|
|
memcpy(quant_data+64, config->qmatrix_inter, 64); |
|
1649 |
|
|
1650 |
if (hFile == INVALID_HANDLE_VALUE) |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
|
{ |
|
|
DEBUGERR("Couldn't save quant matrix"); |
|
|
} |
|
|
else |
|
|
{ |
|
|
if (!WriteFile(hFile, quant_data, 128, &wrote, 0)) |
|
|
{ |
|
|
DEBUGERR("Couldnt write quant matrix"); |
|
|
} |
|
|
} |
|
1651 |
|
|
1652 |
CloseHandle(hFile); |
if (g_use_bitrate) { |
1653 |
|
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1654 |
|
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1655 |
} |
} |
|
} |
|
|
else |
|
|
{ |
|
|
ofn.Flags |= OFN_FILEMUSTEXIST; |
|
|
if (GetOpenFileName(&ofn)) |
|
|
{ |
|
|
hFile = CreateFile(file, GENERIC_READ, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); |
|
1656 |
|
|
1657 |
if (hFile == INVALID_HANDLE_VALUE) |
}else { |
1658 |
{ |
return 0; |
|
DEBUGERR("Couldn't load quant matrix"); |
|
|
} |
|
|
else |
|
|
{ |
|
|
if (!ReadFile(hFile, quant_data, 128, &read, 0)) |
|
|
{ |
|
|
DEBUGERR("Couldnt read quant matrix"); |
|
|
} |
|
|
else |
|
|
{ |
|
|
memcpy(config->qmatrix_intra, quant_data, 64); |
|
|
memcpy(config->qmatrix_inter, quant_data+64, 64); |
|
|
quant_upload(hDlg, config); |
|
|
} |
|
1659 |
} |
} |
1660 |
|
break; |
1661 |
|
|
1662 |
CloseHandle(hFile); |
case WM_HSCROLL : |
1663 |
} |
if((HWND)lParam == GetDlgItem(hDlg, IDC_SLIDER)) { |
1664 |
} |
SetDlgItemInt(hDlg, IDC_BITRATE, SendMessage((HWND)lParam, TBM_GETPOS, 0, 0), FALSE); |
|
} |
|
1665 |
break; |
break; |
1666 |
|
} |
1667 |
|
return 0; |
1668 |
|
|
1669 |
default : |
default : |
1670 |
return 0; |
return 0; |
1674 |
} |
} |
1675 |
|
|
1676 |
|
|
1677 |
/* about dialog proc */ |
|
1678 |
|
/* ===================================================================================== */ |
1679 |
|
/* ABOUT DIALOG ======================================================================== */ |
1680 |
|
/* ===================================================================================== */ |
1681 |
|
|
1682 |
BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK about_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1683 |
{ |
{ |
1697 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1698 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
1699 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
1700 |
XVID_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1701 |
XVID_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1702 |
XVID_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1703 |
info.build); |
info.build); |
1704 |
|
|
1705 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1706 |
|
|
1707 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1708 |
|
|
1709 |
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) |
if (GetObject(hFont, sizeof(LOGFONT), &lfData)) { |
|
{ |
|
1710 |
lfData.lfUnderline = 1; |
lfData.lfUnderline = 1; |
1711 |
|
|
1712 |
hFont = CreateFontIndirect(&lfData); |
hFont = CreateFontIndirect(&lfData); |
1713 |
if (hFont) |
if (hFont) { |
|
{ |
|
1714 |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_SETFONT, (WPARAM)hFont, 1L); |
1715 |
} |
} |
1716 |
} |
} |