60 |
#include <shlobj.h> |
#include <shlobj.h> |
61 |
#include <prsht.h> |
#include <prsht.h> |
62 |
|
|
63 |
#include <stdio.h> // sprintf |
#include <stdio.h> /* sprintf */ |
64 |
#include <xvid.h> // XviD API |
#include <xvid.h> /* XviD API */ |
65 |
|
|
66 |
#include "debug.h" |
#include "debug.h" |
|
#include "codec.h" |
|
67 |
#include "config.h" |
#include "config.h" |
68 |
#include "resource.h" |
#include "resource.h" |
69 |
|
|
76 |
HINSTANCE g_hInst; |
HINSTANCE g_hInst; |
77 |
HWND g_hTooltip; |
HWND g_hTooltip; |
78 |
|
|
79 |
|
int pp_dy, pp_duv, pp_dr, pp_fe; /* decoder options */ |
80 |
|
|
81 |
/* enumerates child windows, assigns tooltips */ |
/* enumerates child windows, assigns tooltips */ |
82 |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
BOOL CALLBACK enum_tooltips(HWND hWnd, LPARAM lParam) |
83 |
{ |
{ |
110 |
{ |
{ |
111 |
/* name p@l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
/* name p@l, w h fps obj Tvmv vmv vcv ac% vbv pkt kbps flags */ |
112 |
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
{ "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, |
113 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
114 |
/* if ac preidition is used, adaptive quantization must not be used */ |
/* if ac preidition is used, adaptive quantization must not be used */ |
115 |
|
/* <=qcif must be used */ |
116 |
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
117 |
{ "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, |
{ "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, |
118 |
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
126 |
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
127 |
{ "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, |
{ "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, |
128 |
{ "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, |
{ "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, |
129 |
|
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ |
130 |
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
131 |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
132 |
|
|
133 |
|
#ifdef DXN_PROFILES |
134 |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
135 |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
136 |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
137 |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
138 |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
139 |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
140 |
|
#endif |
141 |
|
|
142 |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
143 |
}; |
}; |
153 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
154 |
{"mode", ®.mode, RC_MODE_1PASS}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
155 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
156 |
|
{"desired_size", ®.desired_size, 570000}, |
157 |
|
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
158 |
|
|
159 |
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
/* profile */ |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
|
|
{"rc_buffer", ®.rc_buffer, 100}, |
|
|
|
|
|
{"motion_search", ®.motion_search, 6}, |
|
160 |
{"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}, |
|
161 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
162 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
163 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
164 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
165 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
166 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 1}, |
167 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
168 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
169 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
170 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 1}, |
171 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
172 |
{"debug", ®.debug, 0}, |
|
173 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
/* aspect ratio */ |
174 |
|
{"ar_mode", ®.ar_mode, 0}, |
175 |
|
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
176 |
|
{"par_x", ®.par_x, 1}, |
177 |
|
{"par_y", ®.par_y, 1}, |
178 |
|
{"ar_x", ®.ar_x, 4}, |
179 |
|
{"ar_y", ®.ar_y, 3}, |
180 |
|
|
181 |
|
/* zones */ |
182 |
|
{"num_zones", ®.num_zones, 1}, |
183 |
|
|
184 |
|
/* single pass */ |
185 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
186 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
187 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
188 |
|
|
189 |
|
/* 2pass1 */ |
190 |
|
{"discard1pass", ®.discard1pass, 1}, |
191 |
|
|
192 |
|
/* 2pass2 */ |
193 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
194 |
|
{"kfreduction", ®.kfreduction, 20}, |
195 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
196 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
197 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
198 |
|
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
199 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
200 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
201 |
|
|
202 |
|
/* motion */ |
203 |
|
{"motion_search", ®.motion_search, 6}, |
204 |
|
{"vhq_mode", ®.vhq_mode, 1}, |
205 |
|
{"chromame", ®.chromame, 1}, |
206 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
207 |
|
{"turbo", ®.turbo, 0}, |
208 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
209 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
210 |
|
|
211 |
|
/* quant */ |
212 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 2}, |
213 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
214 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 2}, |
217 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
218 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
219 |
|
|
220 |
{"desired_size", ®.desired_size, 570000}, |
/* debug */ |
221 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"fourcc_used", ®.fourcc_used, 0}, |
222 |
{"discard1pass", ®.discard1pass, 1}, |
{"debug", ®.debug, 0x0}, |
223 |
{"kftreshold", ®.kftreshold, 10}, |
{"vop_debug", ®.vop_debug, 0}, |
224 |
{"kfreduction", ®.kfreduction, 20}, |
{"display_status", ®.display_status, 1}, |
225 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
|
226 |
{"curve_compression_low", ®.curve_compression_low, 0}, |
/* decoder, shared with dshow */ |
227 |
{"use_alt_curve", ®.use_alt_curve, 0}, |
{"Deblock_Y", &pp_dy, 0}, |
228 |
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
{"Deblock_UV", &pp_duv, 0}, |
229 |
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
{"Dering", &pp_dr, 0}, |
230 |
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
{"FilmEffect", &pp_fe, 0}, |
231 |
{"alt_curve_bonus_bias", ®.alt_curve_bonus_bias, 50}, |
|
|
{"alt_curve_type", ®.alt_curve_type, 1}, |
|
|
{"alt_curve_high_dist", ®.alt_curve_high_dist, 500}, |
|
|
{"alt_curve_low_dist", ®.alt_curve_low_dist, 90}, |
|
|
{"alt_curve_min_rel_qual", ®.alt_curve_min_rel_qual, 50}, |
|
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
|
|
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
|
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
|
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
|
|
{"num_zones", ®.num_zones, 1}, |
|
232 |
}; |
}; |
233 |
|
|
234 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
243 |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
244 |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
245 |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
246 |
|
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
247 |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
248 |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
249 |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
275 |
|
|
276 |
#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)));} |
277 |
|
|
278 |
|
#define XVID_DLL_NAME "xvidcore.dll" |
279 |
|
|
280 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
281 |
{ |
{ |
282 |
char tmp[32]; |
char tmp[32]; |
284 |
DWORD size; |
DWORD size; |
285 |
int i,j; |
int i,j; |
286 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
287 |
|
HINSTANCE m_hdll; |
288 |
|
|
289 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
290 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
291 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
292 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
293 |
|
if (m_hdll != NULL) { |
294 |
|
|
295 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
296 |
|
(0, XVID_GBL_INFO, &info, NULL); |
297 |
|
|
298 |
|
FreeLibrary(m_hdll); |
299 |
|
} |
300 |
|
|
301 |
reg.cpu = info.cpu_flags; |
reg.cpu = info.cpu_flags; |
302 |
reg.num_threads = info.num_threads; |
reg.num_threads = info.num_threads; |
303 |
|
|
473 |
} |
} |
474 |
|
|
475 |
|
|
476 |
|
#define HEX_BUF_SZ 16 |
477 |
|
unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
478 |
|
{ |
479 |
|
char buf[HEX_BUF_SZ]; |
480 |
|
unsigned int value; |
481 |
|
|
482 |
|
if (GetDlgItemText(hDlg, item, buf, HEX_BUF_SZ) == 0) |
483 |
|
return def; |
484 |
|
|
485 |
|
if (sscanf(buf,"0x%x", &value)==1 || sscanf(buf,"%x", &value)==1) { |
486 |
|
return value; |
487 |
|
} |
488 |
|
|
489 |
|
return def; |
490 |
|
} |
491 |
|
|
492 |
|
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
493 |
|
{ |
494 |
|
char buf[HEX_BUF_SZ]; |
495 |
|
wsprintf(buf, "0x%x", value); |
496 |
|
SetDlgItemText(hDlg, item, buf); |
497 |
|
} |
498 |
|
|
499 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
500 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
501 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
657 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
658 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
659 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
660 |
|
|
661 |
|
break; |
662 |
|
case IDD_AR: |
663 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
664 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
665 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 NTSC"); |
666 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 PAL"); |
667 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 NTSC"); |
668 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom..."); |
669 |
break; |
break; |
670 |
|
|
671 |
case IDD_LEVEL : |
case IDD_LEVEL : |
673 |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
674 |
break; |
break; |
675 |
|
|
|
case IDD_RC_2PASS2_ALT : |
|
|
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"); |
|
|
break; |
|
|
|
|
676 |
case IDD_ZONE : |
case IDD_ZONE : |
677 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
|
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
|
678 |
break; |
break; |
679 |
|
|
680 |
case IDD_MOTION : |
case IDD_MOTION : |
711 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
712 |
{ |
{ |
713 |
int profile; |
int profile; |
|
int use_alt, use_alt_auto, use_alt_auto_bonus; |
|
714 |
int weight_en, quant_en; |
int weight_en, quant_en; |
715 |
int cpu_force; |
int cpu_force; |
716 |
int custom_quant, bvops; |
int custom_quant, bvops; |
717 |
|
int ar_mode, ar_par; |
718 |
|
|
719 |
switch(idd) { |
switch(idd) { |
720 |
case IDD_PROFILE : |
case IDD_PROFILE : |
741 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
742 |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
743 |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
744 |
|
break; |
745 |
|
|
746 |
|
case IDD_AR: |
747 |
|
ar_mode = IsDlgChecked(hDlg, IDC_PAR); |
748 |
|
EnableDlgWindow(hDlg, IDC_ASPECT_RATIO, ar_mode); |
749 |
|
|
750 |
|
ar_par = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
751 |
|
if (ar_par == 5) { /* custom par */ |
752 |
|
SetDlgItemInt(hDlg, IDC_PARY, config->par_y, FALSE); |
753 |
|
SetDlgItemInt(hDlg, IDC_PARX, config->par_x, FALSE); |
754 |
|
|
755 |
|
EnableDlgWindow(hDlg, IDC_PARX, ar_mode); |
756 |
|
EnableDlgWindow(hDlg, IDC_PARY, ar_mode); |
757 |
|
} else { |
758 |
|
SetDlgItemInt(hDlg, IDC_PARX, PARS[ar_par][0], FALSE); |
759 |
|
SetDlgItemInt(hDlg, IDC_PARY, PARS[ar_par][1], FALSE); |
760 |
|
EnableDlgWindow(hDlg, IDC_PARX, FALSE); |
761 |
|
EnableDlgWindow(hDlg, IDC_PARY, FALSE); |
762 |
|
} |
763 |
|
|
764 |
|
ar_mode = IsDlgChecked(hDlg, IDC_AR); |
765 |
|
|
766 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
767 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
768 |
|
|
769 |
|
EnableDlgWindow(hDlg, IDC_ARX, ar_mode); |
770 |
|
EnableDlgWindow(hDlg, IDC_ARY, ar_mode); |
771 |
|
break; |
772 |
|
|
773 |
case IDD_LEVEL : |
case IDD_LEVEL : |
774 |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
781 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
782 |
break; |
break; |
783 |
|
|
|
case IDD_RC_2PASS2_ALT : |
|
|
use_alt = IsDlgChecked(hDlg, IDC_USEALT); |
|
|
use_alt_auto = IsDlgChecked(hDlg, IDC_USEAUTO); |
|
|
use_alt_auto_bonus = IsDlgChecked(hDlg, IDC_USEAUTOBONUS); |
|
|
EnableDlgWindow(hDlg, IDC_USEAUTO, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_AUTOSTR, use_alt && use_alt_auto); |
|
|
EnableDlgWindow(hDlg, IDC_USEAUTOBONUS, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_BONUSBIAS, use_alt && !use_alt_auto_bonus); |
|
|
EnableDlgWindow(hDlg, IDC_CURVETYPE, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_ALTCURVEHIGH, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_ALTCURVELOW, use_alt); |
|
|
EnableDlgWindow(hDlg, IDC_MINQUAL, use_alt && !use_alt_auto); |
|
|
break; |
|
|
|
|
784 |
case IDD_ZONE : |
case IDD_ZONE : |
785 |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
786 |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
839 |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
840 |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
841 |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
842 |
|
|
843 |
|
break; |
844 |
|
case IDD_AR: |
845 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR : IDC_AR); |
846 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
847 |
|
SetDlgItemInt(hDlg, IDC_ARX, config->ar_x, FALSE); |
848 |
|
SetDlgItemInt(hDlg, IDC_ARY, config->ar_y, FALSE); |
849 |
break; |
break; |
850 |
|
|
851 |
case IDD_LEVEL : |
case IDD_LEVEL : |
866 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
867 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
868 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
869 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
870 |
|
|
871 |
|
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
872 |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
873 |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
874 |
|
|
875 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
876 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
877 |
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)); |
|
|
break; |
|
|
|
|
|
case IDD_RC_2PASS2_ALT : |
|
|
CheckDlg(hDlg, IDC_USEALT, config->use_alt_curve); |
|
|
|
|
|
SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_SETCURSEL, config->alt_curve_type, 0); |
|
|
SetDlgItemInt(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist, FALSE); |
|
|
SetDlgItemInt(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual, FALSE); |
|
|
|
|
|
CheckDlg(hDlg, IDC_USEAUTO, config->alt_curve_use_auto); |
|
|
SetDlgItemInt(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str, FALSE); |
|
|
|
|
|
CheckDlg(hDlg, IDC_USEAUTOBONUS, config->alt_curve_use_auto_bonus_bias); |
|
|
SetDlgItemInt(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias, FALSE); |
|
878 |
break; |
break; |
879 |
|
|
880 |
case IDD_ZONE : |
case IDD_ZONE : |
881 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame, FALSE); |
|
SendDlgItemMessage(hDlg, IDC_ZONE_FRAME, EM_SETREADONLY, config->cur_zone==0?TRUE:FALSE, 0); |
|
882 |
|
|
883 |
CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); |
884 |
CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); |
CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); |
886 |
set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
887 |
set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
888 |
|
|
889 |
|
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
890 |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
891 |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
892 |
|
|
897 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
898 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
899 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
900 |
|
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
901 |
|
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
902 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
903 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
|
SetDlgItemInt(hDlg, IDC_MINKEY, config->min_key_interval, FALSE); |
|
904 |
break; |
break; |
905 |
|
|
906 |
case IDD_QUANT : |
case IDD_QUANT : |
926 |
|
|
927 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
928 |
|
|
|
CheckDlg(hDlg, IDC_DEBUG, config->debug); |
|
929 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
930 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
931 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
932 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
933 |
|
break; |
934 |
|
|
935 |
|
case IDD_DEC : |
936 |
|
CheckDlg(hDlg, IDC_DEC_DY, pp_dy); |
937 |
|
CheckDlg(hDlg, IDC_DEC_DUV, pp_duv); |
938 |
|
CheckDlg(hDlg, IDC_DEC_DR, pp_dr); |
939 |
|
CheckDlg(hDlg, IDC_DEC_FE, pp_fe); |
940 |
break; |
break; |
941 |
} |
} |
942 |
} |
} |
966 |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
967 |
break; |
break; |
968 |
|
|
969 |
|
case IDD_AR: |
970 |
|
config->ar_mode = IsDlgChecked(hDlg, IDC_PAR) ? 0:1; |
971 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
972 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
973 |
|
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
974 |
|
if (config->display_aspect_ratio == 5) { |
975 |
|
config->par_x = config_get_uint(hDlg, IDC_PARX, config->par_x); |
976 |
|
config->par_y = config_get_uint(hDlg, IDC_PARY, config->par_y); |
977 |
|
} |
978 |
|
break; |
979 |
|
|
980 |
case IDD_LEVEL : |
case IDD_LEVEL : |
981 |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
982 |
break; |
break; |
998 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
999 |
|
|
1000 |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
config->keyframe_boost = GetDlgItemInt(hDlg, IDC_KFBOOST, NULL, FALSE); |
|
config->kftreshold = GetDlgItemInt(hDlg, IDC_KFTRESHOLD, NULL, FALSE); |
|
1001 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
1002 |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
1003 |
|
|
1004 |
|
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
1005 |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
config->twopass_max_overflow_improvement = config_get_uint(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement); |
1006 |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
config->twopass_max_overflow_degradation = config_get_uint(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation); |
1007 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
1008 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
1009 |
|
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
1010 |
|
|
1011 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
1012 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, 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 = IsDlgChecked(hDlg, IDC_PAYBACKPROP); |
|
|
|
|
|
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
|
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
|
1013 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
1014 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
|
break; |
|
1015 |
|
|
1016 |
case IDD_RC_2PASS2_ALT : |
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
|
config->use_alt_curve = IsDlgChecked(hDlg, IDC_USEALT); |
|
1017 |
|
|
|
config->alt_curve_use_auto = IsDlgChecked(hDlg, IDC_USEAUTO); |
|
|
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
|
|
|
|
|
config->alt_curve_use_auto_bonus_bias = IsDlgChecked(hDlg, IDC_USEAUTOBONUS); |
|
|
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
|
|
|
|
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
|
|
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
|
|
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
|
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
|
1018 |
break; |
break; |
1019 |
|
|
1020 |
case IDD_ZONE : |
case IDD_ZONE : |
1029 |
config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); |
1030 |
config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); |
1031 |
|
|
1032 |
|
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
1033 |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
1034 |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
1035 |
|
|
1040 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1041 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1042 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1043 |
|
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1044 |
|
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
1045 |
|
|
1046 |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
1047 |
|
|
1048 |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
|
config->min_key_interval = config_get_uint(hDlg, IDC_MINKEY, config->min_key_interval); |
|
1049 |
break; |
break; |
1050 |
|
|
1051 |
case IDD_QUANT : |
case IDD_QUANT : |
1079 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
1080 |
|
|
1081 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
1082 |
config->debug = IsDlgChecked(hDlg, IDC_DEBUG); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1083 |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1084 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1085 |
|
break; |
1086 |
|
|
1087 |
|
case IDD_DEC : |
1088 |
|
pp_dy = IsDlgChecked(hDlg, IDC_DEC_DY); |
1089 |
|
pp_duv = IsDlgChecked(hDlg, IDC_DEC_DUV); |
1090 |
|
pp_dr = IsDlgChecked(hDlg, IDC_DEC_DR); |
1091 |
|
pp_fe = IsDlgChecked(hDlg, IDC_DEC_FE); |
1092 |
break; |
break; |
1093 |
} |
} |
1094 |
} |
} |
1121 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1122 |
{ |
{ |
1123 |
case IDC_BVOP : |
case IDC_BVOP : |
|
case IDC_USEALT : |
|
|
case IDC_USEAUTO : |
|
|
case IDC_USEAUTOBONUS : |
|
1124 |
case IDC_ZONE_MODE_WEIGHT : |
case IDC_ZONE_MODE_WEIGHT : |
1125 |
case IDC_ZONE_MODE_QUANT : |
case IDC_ZONE_MODE_QUANT : |
1126 |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1127 |
case IDC_CPU_AUTO : |
case IDC_CPU_AUTO : |
1128 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1129 |
|
case IDC_AR : |
1130 |
|
case IDC_PAR : |
1131 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1132 |
break; |
break; |
1133 |
|
|
1167 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1168 |
break; |
break; |
1169 |
|
|
1170 |
|
case IDC_AR_DEFAULT: |
1171 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_PAR); |
1172 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, 0, 0); |
1173 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1174 |
|
break; |
1175 |
|
case IDC_AR_4_3: |
1176 |
|
SetDlgItemInt(hDlg, IDC_ARX, 4, FALSE); |
1177 |
|
SetDlgItemInt(hDlg, IDC_ARY, 3, FALSE); |
1178 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1179 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1180 |
|
break; |
1181 |
|
case IDC_AR_16_9: |
1182 |
|
SetDlgItemInt(hDlg, IDC_ARX, 16, FALSE); |
1183 |
|
SetDlgItemInt(hDlg, IDC_ARY, 9, FALSE); |
1184 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1185 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1186 |
|
break; |
1187 |
|
case IDC_AR_235_100: |
1188 |
|
SetDlgItemInt(hDlg, IDC_ARX, 235, FALSE); |
1189 |
|
SetDlgItemInt(hDlg, IDC_ARY, 100, FALSE); |
1190 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1191 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1192 |
|
break; |
1193 |
|
|
1194 |
default : |
default : |
1195 |
return TRUE; |
return TRUE; |
1196 |
} |
} |
1197 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1198 |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1199 |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1200 |
LOWORD(wParam) == IDC_QUANTTYPE)) |
LOWORD(wParam) == IDC_QUANTTYPE || |
1201 |
|
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
1202 |
{ |
{ |
1203 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1204 |
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
}else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_ZONE_WEIGHT || LOWORD(wParam)==IDC_ZONE_QUANT)) { |
1205 |
|
|
1206 |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1207 |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1208 |
}else { |
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1209 |
return 0; |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1210 |
|
if(LOWORD(wParam)==IDC_PARX) |
1211 |
|
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1212 |
|
else |
1213 |
|
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1214 |
} |
} |
1215 |
|
} else |
1216 |
|
return 0; |
1217 |
break; |
break; |
1218 |
|
|
1219 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1334 |
} |
} |
1335 |
|
|
1336 |
if (s->mode == RC_ZONE_WEIGHT) { |
if (s->mode == RC_ZONE_WEIGHT) { |
1337 |
sprintf(tmp,"%.2f",(float)s->weight/100); |
sprintf(tmp,"W %.2f",(float)s->weight/100); |
1338 |
}else if (s->mode == RC_ZONE_QUANT) { |
}else if (s->mode == RC_ZONE_QUANT) { |
1339 |
sprintf(tmp,"( %.2f )",(float)s->quant/100); |
sprintf(tmp,"Q %.2f",(float)s->quant/100); |
1340 |
}else { |
}else { |
1341 |
strcpy(tmp,"EXT"); |
strcpy(tmp,"EXT"); |
1342 |
} |
} |
1343 |
ListView_SetItemText(hDlg, i, 1, tmp); |
ListView_SetItemText(hDlg, i, 1, tmp); |
1344 |
|
|
1345 |
tmp[0] = '\0'; |
tmp[0] = '\0'; |
1346 |
|
if (s->type==XVID_TYPE_IVOP) |
1347 |
|
strcat(tmp, "K "); |
1348 |
|
|
1349 |
if (s->greyscale) |
if (s->greyscale) |
1350 |
strcat(tmp, "G "); |
strcat(tmp, "G "); |
1351 |
|
|
1355 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1356 |
} |
} |
1357 |
|
|
1358 |
|
static int g_use_bitrate = 1; |
1359 |
|
|
1360 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1361 |
{ |
{ |
1362 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1363 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1364 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1365 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1366 |
|
|
1367 |
char buf[16]; |
char buf[16]; |
|
int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
int bitrate_en; |
|
1368 |
int max; |
int max; |
1369 |
|
|
1370 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1371 |
|
|
1372 |
|
if (g_use_bitrate) { |
1373 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1374 |
|
|
1375 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1376 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1377 |
|
|
1384 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1385 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1386 |
|
|
1387 |
bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
}else{ |
1388 |
bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1389 |
|
} |
1390 |
|
|
1391 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1392 |
|
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1393 |
|
|
1394 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1395 |
EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1396 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, bitrate_en); |
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
|
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, bitrate_en); |
|
|
EnableDlgWindow(hDlg, IDC_SLIDER, bitrate_en); |
|
1397 |
} |
} |
1398 |
|
|
1399 |
|
|
1400 |
|
|
1401 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1402 |
{ |
{ |
|
int i; |
|
1403 |
|
|
1404 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1405 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
|
1406 |
|
|
1407 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
if (g_use_bitrate) { |
1408 |
for (i=0; i < config->num_zones; i++) { |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1409 |
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
}else{ |
1410 |
} |
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1411 |
} |
} |
1412 |
|
|
1413 |
|
zones_update(hDlg, config);} |
1414 |
|
|
1415 |
|
|
1416 |
/* downloads data from main dialog */ |
/* downloads data from main dialog */ |
1417 |
void main_download(HWND hDlg, CONFIG * config) |
void main_download(HWND hDlg, CONFIG * config) |
1418 |
{ |
{ |
1419 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1420 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1421 |
|
|
1422 |
|
if (g_use_bitrate) { |
1423 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1424 |
|
}else{ |
1425 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1426 |
|
} |
1427 |
} |
} |
|
|
|
|
|
|
1428 |
|
|
1429 |
|
|
1430 |
/* main dialog proc */ |
/* main dialog proc */ |
1431 |
|
|
1432 |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL, IDD_AR }; |
1433 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1434 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1435 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2, IDD_RC_2PASS2_ALT}; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1436 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1437 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int decoder_dlgs[] = { IDD_DEC }; |
1438 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1439 |
|
|
1440 |
|
|
1461 |
|
|
1462 |
InitCommonControls(); |
InitCommonControls(); |
1463 |
|
|
|
|
|
1464 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1465 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1466 |
NULL, NULL, g_hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1472 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1473 |
} |
} |
1474 |
|
|
1475 |
|
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1476 |
|
|
1477 |
{ |
{ |
1478 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1479 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1488 |
|
|
1489 |
const static char_int_t columns[] = { |
const static char_int_t columns[] = { |
1490 |
{"Frame #", 64}, |
{"Frame #", 64}, |
1491 |
{"Weight (Q)", 72}, |
{"Weight/Quant", 82}, |
1492 |
{"Modifiers", 120}}; |
{"Modifiers", 120}}; |
1493 |
|
|
1494 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1495 |
int i; |
int i; |
1496 |
|
|
1497 |
// Initialize the LVCOLUMN structure. |
/* Initialize the LVCOLUMN structure. */ |
1498 |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
1499 |
lvc.fmt = LVCFMT_LEFT; |
lvc.fmt = LVCFMT_LEFT; |
1500 |
|
|
1501 |
// Add the columns. |
/* Add the columns. */ |
1502 |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
1503 |
lvc.pszText = (char*)columns[i].name; |
lvc.pszText = (char*)columns[i].name; |
1504 |
lvc.cchTextMax = strlen(columns[i].name); |
lvc.cchTextMax = strlen(columns[i].name); |
1508 |
} |
} |
1509 |
} |
} |
1510 |
|
|
1511 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1512 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1513 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1514 |
|
main_upload(hDlg, config); |
1515 |
break; |
break; |
1516 |
|
|
1517 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1518 |
{ |
{ |
1519 |
NMHDR * n = (NMHDR*)lParam; |
NMHDR * n = (NMHDR*)lParam; |
|
int idc = (int)wParam; |
|
1520 |
|
|
1521 |
if (n->code == NM_DBLCLK) { |
if (n->code == NM_DBLCLK) { |
1522 |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1524 |
|
|
1525 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1526 |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
if (config->cur_zone >= 0 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1527 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1528 |
} |
} |
1529 |
break; |
break; |
1530 |
} |
} |
1558 |
} |
} |
1559 |
break; |
break; |
1560 |
|
|
1561 |
case IDC_BITRATE_CALC : |
|
1562 |
|
case IDC_BITRATE_S : |
1563 |
|
/* alternate between bitrate/desired_length metrics */ |
1564 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1565 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1566 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
main_mode(hDlg, config); |
1567 |
|
main_upload(hDlg, config); |
1568 |
|
break; |
1569 |
|
|
1570 |
|
case IDC_DECODER : |
1571 |
|
main_download(hDlg, config); |
1572 |
|
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
1573 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1574 |
break; |
break; |
1575 |
|
|
1578 |
int i, sel, new_frame; |
int i, sel, new_frame; |
1579 |
|
|
1580 |
if (config->num_zones >= MAX_ZONES) { |
if (config->num_zones >= MAX_ZONES) { |
1581 |
MessageBox(hDlg, "MAX_ZONES", "Warning", 0); |
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1582 |
break; |
break; |
1583 |
} |
} |
1584 |
|
|
1591 |
new_frame = config->ci.ciActiveFrame; |
new_frame = config->ci.ciActiveFrame; |
1592 |
}else{ |
}else{ |
1593 |
sel = config->num_zones-1; |
sel = config->num_zones-1; |
1594 |
new_frame = config->zones[sel].frame + 1; |
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1595 |
} |
} |
1596 |
}else{ |
}else{ |
1597 |
new_frame = config->zones[sel].frame + 1; |
new_frame = config->zones[sel].frame + 1; |
1598 |
} |
} |
1599 |
|
|
|
if (sel+1<config->num_zones && config->zones[sel+1].frame==new_frame) { |
|
|
MessageBox(hDlg, "CANT ADD HERE", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1600 |
for(i=config->num_zones-1; i>sel; i--) { |
for(i=config->num_zones-1; i>sel; i--) { |
1601 |
config->zones[i+1] = config->zones[i]; |
config->zones[i+1] = config->zones[i]; |
1602 |
} |
} |
1605 |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1606 |
config->zones[sel+1].weight = 100; |
config->zones[sel+1].weight = 100; |
1607 |
config->zones[sel+1].quant = 500; |
config->zones[sel+1].quant = 500; |
1608 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1609 |
config->zones[sel+1].greyscale = 0; |
config->zones[sel+1].greyscale = 0; |
1610 |
config->zones[sel+1].chroma_opt = 0; |
config->zones[sel+1].chroma_opt = 0; |
1611 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1612 |
|
|
1613 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0x00000000, LVIS_SELECTED); |
1614 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[sel+1], sel+1, TRUE); |
zones_update(hDlg, config); |
1615 |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel+1, 0xffffffff, LVIS_SELECTED); |
1616 |
break; |
break; |
1617 |
} |
} |
1621 |
int i, sel; |
int i, sel; |
1622 |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1623 |
|
|
1624 |
if (sel == -1) { |
if (sel == -1 || config->num_zones < 1) { |
1625 |
MessageBox(hDlg, "Nothing selected", "Warning", 0); |
/*MessageBox(hDlg, "Nothing selected", "Warning", 0);*/ |
|
break; |
|
|
} |
|
|
|
|
|
if (sel == 0) { |
|
|
MessageBox(hDlg, "Can't remove first zone", "Warning", 0); |
|
1626 |
break; |
break; |
1627 |
} |
} |
1628 |
|
|
1629 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) |
1630 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
|
} |
|
|
config->num_zones--; |
|
|
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
|
1631 |
|
|
1632 |
|
config->num_zones--; |
1633 |
|
|
1634 |
sel--; |
zones_update(hDlg, config); |
|
if (sel==0 && config->num_zones>1) { |
|
|
sel=1; |
|
|
} |
|
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
|
1635 |
break; |
break; |
1636 |
} |
} |
1637 |
|
|
1639 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1640 |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
config->cur_zone = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1641 |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
if (config->cur_zone != -1 && adv_dialog(hDlg, config, zone_dlgs, sizeof(zone_dlgs)/sizeof(int))) { |
1642 |
main_insert_zone(GetDlgItem(hDlg, IDC_ZONES), &config->zones[config->cur_zone], config->cur_zone, FALSE); |
zones_update(hDlg, config); |
1643 |
} |
} |
1644 |
break; |
break; |
1645 |
|
|
1666 |
} |
} |
1667 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1668 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1669 |
|
|
1670 |
|
main_download(hDlg, config); |
1671 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1672 |
|
main_upload(hDlg, config); |
1673 |
|
|
1674 |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1675 |
|
|
1676 |
|
if (g_use_bitrate) { |
1677 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1678 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1679 |
|
} |
1680 |
|
|
1681 |
}else { |
}else { |
1682 |
return 0; |
return 0; |
1683 |
} |
} |
1713 |
char core[100]; |
char core[100]; |
1714 |
HFONT hFont; |
HFONT hFont; |
1715 |
LOGFONT lfData; |
LOGFONT lfData; |
1716 |
|
HINSTANCE m_hdll; |
1717 |
|
|
1718 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1719 |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1720 |
|
|
1721 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
1722 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1723 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
1724 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
1725 |
XVID_MAJOR(info.actual_version), |
if (m_hdll != NULL) { |
1726 |
XVID_MINOR(info.actual_version), |
|
1727 |
XVID_PATCH(info.actual_version), |
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
1728 |
|
(0, XVID_GBL_INFO, &info, NULL); |
1729 |
|
|
1730 |
|
wsprintf(core, "xvidcore.dll version %d.%d.%d (\"%s\")", |
1731 |
|
XVID_VERSION_MAJOR(info.actual_version), |
1732 |
|
XVID_VERSION_MINOR(info.actual_version), |
1733 |
|
XVID_VERSION_PATCH(info.actual_version), |
1734 |
info.build); |
info.build); |
1735 |
|
|
1736 |
|
FreeLibrary(m_hdll); |
1737 |
|
} else { |
1738 |
|
wsprintf(core, "xvidcore.dll not found!"); |
1739 |
|
} |
1740 |
|
|
1741 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1742 |
|
|
1743 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1755 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1756 |
} |
} |
1757 |
break; |
break; |
|
|
|
1758 |
case WM_CTLCOLORSTATIC : |
case WM_CTLCOLORSTATIC : |
1759 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1760 |
{ |
{ |
1781 |
|
|
1782 |
return 1; |
return 1; |
1783 |
} |
} |
1784 |
|
|
1785 |
|
static void |
1786 |
|
sort_zones(zone_t * zones, int zone_num, int * sel) |
1787 |
|
{ |
1788 |
|
int i, j; |
1789 |
|
zone_t tmp; |
1790 |
|
for (i = 0; i < zone_num; i++) { |
1791 |
|
int cur = i; |
1792 |
|
int min_f = zones[i].frame; |
1793 |
|
for (j = i + 1; j < zone_num; j++) { |
1794 |
|
if (zones[j].frame < min_f) { |
1795 |
|
min_f = zones[j].frame; |
1796 |
|
cur = j; |
1797 |
|
} |
1798 |
|
} |
1799 |
|
if (cur != i) { |
1800 |
|
tmp = zones[i]; |
1801 |
|
zones[i] = zones[cur]; |
1802 |
|
zones[cur] = tmp; |
1803 |
|
if (i == *sel) *sel = cur; |
1804 |
|
else if (cur == *sel) *sel = i; |
1805 |
|
} |
1806 |
|
} |
1807 |
|
} |
1808 |
|
|
1809 |
|
|
1810 |
|
static void |
1811 |
|
zones_update(HWND hDlg, CONFIG * config) |
1812 |
|
{ |
1813 |
|
int i, sel; |
1814 |
|
|
1815 |
|
sel = ListView_GetNextItem(GetDlgItem(hDlg, IDC_ZONES), -1, LVNI_SELECTED); |
1816 |
|
|
1817 |
|
sort_zones(config->zones, config->num_zones, &sel); |
1818 |
|
|
1819 |
|
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1820 |
|
|
1821 |
|
for (i = 0; i < config->num_zones; i++) |
1822 |
|
main_insert_zone(GetDlgItem(hDlg,IDC_ZONES), &config->zones[i], i, TRUE); |
1823 |
|
|
1824 |
|
if (sel == -1 && config->num_zones > 0) sel = 0; |
1825 |
|
if (sel >= config->num_zones) sel = config->num_zones-1; |
1826 |
|
|
1827 |
|
config->cur_zone = sel; |
1828 |
|
ListView_SetItemState(GetDlgItem(hDlg, IDC_ZONES), sel, 0xffffffff, LVIS_SELECTED); |
1829 |
|
} |