104 |
/* MPEG-4 PROFILES/LEVELS ============================================================== */ |
/* MPEG-4 PROFILES/LEVELS ============================================================== */ |
105 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
106 |
|
|
107 |
|
#define DXN_PROFILES |
108 |
|
|
109 |
/* default vbv_occupancy is (64/170)*vbv_buffer_size */ |
/* default vbv_occupancy is (64/170)*vbv_buffer_size */ |
110 |
|
|
111 |
|
#define PROFILE_S (PROFILE_4MV) |
112 |
|
#define PROFILE_ARTS (PROFILE_4MV|PROFILE_ADAPTQUANT) |
113 |
|
#define PROFILE_AS (PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_MPEGQUANT|PROFILE_INTERLACE|PROFILE_QPEL|PROFILE_GMC) |
114 |
|
|
115 |
const profile_t profiles[] = |
const profile_t profiles[] = |
116 |
{ |
{ |
117 |
/* 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 bps vbv_peak dbf flags */ |
118 |
{ "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, 64000, 0, -1, PROFILE_S }, |
119 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
120 |
/* if ac preidition is used, adaptive quantization must not be used */ |
/* if ac preidition is used, adaptive quantization must not be used */ |
121 |
/* <=qcif must be used */ |
/* <=qcif must be used */ |
122 |
{ "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, 64000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT }, |
123 |
{ "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, 128000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT }, |
124 |
{ "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, 384000, 0, -1, PROFILE_S|PROFILE_ADAPTQUANT }, |
125 |
|
|
126 |
{ "ARTS @ L1", 0x91, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 8192, 64, PROFILE_ARTS }, |
#if 0 /* since rrv encoding is no longer support, these profiles have little use */ |
127 |
{ "ARTS @ L2", 0x92, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 16384, 128, PROFILE_ARTS }, |
{ "ARTS @ L1", 0x91, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 8192, 64000, 0, -1, PROFILE_ARTS }, |
128 |
{ "ARTS @ L3", 0x93, 352, 288, 30, 4, 792, 396, 11880, 100, 40*16368, 16384, 384, PROFILE_ARTS }, |
{ "ARTS @ L2", 0x92, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 16384, 128000, 0, -1, PROFILE_ARTS }, |
129 |
{ "ARTS @ L4", 0x94, 352, 288, 30, 16, 792, 396, 11880, 100, 80*16368, 16384, 2000, PROFILE_ARTS }, |
{ "ARTS @ L3", 0x93, 352, 288, 30, 4, 792, 396, 11880, 100, 40*16368, 16384, 384000, 0, -1, PROFILE_ARTS }, |
130 |
|
{ "ARTS @ L4", 0x94, 352, 288, 30, 16, 792, 396, 11880, 100, 80*16368, 16384, 2000000, 0, -1, PROFILE_ARTS }, |
131 |
{ "AS @ L0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
#endif |
132 |
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, |
|
133 |
{ "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, |
{ "AS @ L0", 0xf0, 176, 144, 30, 1, 297, 99, 2970, 100, 10*16368, 2048, 128000, 0, -1, PROFILE_AS }, |
134 |
{ "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, |
{ "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128000, 0, -1, PROFILE_AS }, |
135 |
|
{ "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384000, 0, -1, PROFILE_AS }, |
136 |
|
{ "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768000, 0, -1, PROFILE_AS }, |
137 |
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ |
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ |
138 |
{ "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, 3000000, 0, -1, PROFILE_AS }, |
139 |
{ "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, 8000000, 0, -1, PROFILE_AS }, |
140 |
|
|
141 |
#ifdef DXN_PROFILES |
#ifdef DXN_PROFILES |
142 |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
// information provided by DivXNetworks, USA. |
143 |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
// "DivX Certified Profile Compatibility v1.1", February 2005 |
144 |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Handheld", 0x00, 176, 144, 15, 1, 198, 99, 1485, 100, 32*8192, -1, 537600, 800000, 0, PROFILE_ADAPTQUANT|PROFILE_DXN }, |
145 |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN Portable NTSC",0x00, 352, 240, 30, 1, 990, 330, 36000, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN }, |
146 |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN Portable PAL", 0x00, 352, 288, 25, 1, 1188, 396, 36000, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_DXN }, |
147 |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT NTSC", 0x00, 720, 480, 30, 1, 4050, 1350, 40500, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN }, |
148 |
|
{ "DXN HT PAL", 0x00, 720, 576, 25, 1, 4860, 1620, 40500, 100, 384*8192, -1, 4854000, 8000000, 1, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN }, |
149 |
|
{ "DXN HDTV", 0x00, 1280, 720, 30, 1,10800, 3600, 108000, 100, 768*8192, -1, 9708400, 16000000, 2, PROFILE_4MV|PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE|PROFILE_DXN }, |
150 |
#endif |
#endif |
151 |
|
|
152 |
{ "(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, -1, 0, 0, -1, 0xffffffff & ~PROFILE_DXN }, |
153 |
}; |
}; |
154 |
|
|
155 |
|
|
156 |
|
const quality_t quality_table[] = |
157 |
|
{ |
158 |
|
/* name | m vhq bf cme tbo kfi fdr | iquant pquant bquant trellis */ |
159 |
|
{ "Real-time", 1, 0, 0, 0, 0, 300, 0, 1, 31, 1, 31, 1, 31, 0 }, |
160 |
|
{ QUALITY_GENERAL_STRING, 6, 1, 0, 1, 0, 300, 0, 1, 31, 1, 31, 1, 31, 1 }, |
161 |
|
}; |
162 |
|
|
163 |
|
const int quality_table_num = sizeof(quality_table)/sizeof(quality_t); |
164 |
|
|
165 |
typedef struct { |
typedef struct { |
166 |
char * name; |
char * name; |
167 |
float value; |
float value; |
186 |
} named_int_t; |
} named_int_t; |
187 |
|
|
188 |
|
|
189 |
#define NO_AUDIO 5 |
#define NO_AUDIO 7 |
190 |
static const named_int_t audio_type_list[] = { |
static const named_int_t audio_type_list[] = { |
191 |
{ "MP3-CBR", 1000, 48000/1152/6 }, |
{ "MP3-CBR", 1000, 48000/1152/6 }, |
192 |
{ "MP3-VBR", 24, 48000/1152/6 }, |
{ "MP3-VBR", 24, 48000/1152/6 }, |
193 |
{ "OGG", /*?*/1000, 48000*(0.7F/1024 + 0.3F/180) }, |
{ "OGG", /*?*/1000, 48000*(0.7F/1024 + 0.3F/180) }, |
194 |
{ "AC3", 64, 48000/1536/6 }, |
{ "AC3", 64, 48000/1536/6 }, |
195 |
{ "DTS", 21, /*?*/48000/1152/6 }, |
{ "DTS", 21, /*?*/48000/1152/6 }, |
196 |
|
{ "AAC", 21, 48000/1024/6 }, |
197 |
|
{ "HE-AAC", 42, 48000/1024/6 }, |
198 |
{ "(None)", 0, 0 }, |
{ "(None)", 0, 0 }, |
199 |
}; |
}; |
200 |
|
|
217 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
218 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
219 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
220 |
|
{"tff", ®.tff, 0}, |
221 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
222 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
|
{"reduced_resolution", ®.reduced_resolution, 0}, |
|
223 |
{"use_bvop", ®.use_bvop, 1}, |
{"use_bvop", ®.use_bvop, 1}, |
224 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
225 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
226 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
227 |
{"packed", ®.packed, 1}, |
{"packed", ®.packed, 1}, |
|
{"closed_gov", ®.closed_gov, 1}, |
|
228 |
|
|
229 |
/* aspect ratio */ |
/* aspect ratio */ |
230 |
{"ar_mode", ®.ar_mode, 0}, |
{"ar_mode", ®.ar_mode, 0}, |
270 |
{"audio_size", ®.audio_size, 0}, |
{"audio_size", ®.audio_size, 0}, |
271 |
|
|
272 |
/* motion */ |
/* motion */ |
273 |
{"motion_search", ®.motion_search, 6}, |
{"motion_search", ®.quality_user.motion_search, 6}, |
274 |
{"vhq_mode", ®.vhq_mode, 1}, |
{"vhq_mode", ®.quality_user.vhq_mode, 1}, |
275 |
{"chromame", ®.chromame, 1}, |
{"vhq_bframe", ®.quality_user.vhq_bframe, 0}, |
276 |
{"cartoon_mode", ®.cartoon_mode, 0}, |
{"chromame", ®.quality_user.chromame, 1}, |
277 |
{"turbo", ®.turbo, 0}, |
{"turbo", ®.quality_user.turbo, 0}, |
278 |
{"max_key_interval", ®.max_key_interval, 300}, |
{"max_key_interval", ®.quality_user.max_key_interval, 300}, |
279 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.quality_user.frame_drop_ratio, 0}, |
280 |
|
|
281 |
/* quant */ |
/* quant */ |
282 |
{"min_iquant", ®.min_iquant, 1}, |
{"min_iquant", ®.quality_user.min_iquant, 1}, |
283 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.quality_user.max_iquant, 31}, |
284 |
{"min_pquant", ®.min_pquant, 1}, |
{"min_pquant", ®.quality_user.min_pquant, 1}, |
285 |
{"max_pquant", ®.max_pquant, 31}, |
{"max_pquant", ®.quality_user.max_pquant, 31}, |
286 |
{"min_bquant", ®.min_bquant, 1}, |
{"min_bquant", ®.quality_user.min_bquant, 1}, |
287 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.quality_user.max_bquant, 31}, |
288 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.quality_user.trellis_quant, 1}, |
289 |
|
|
290 |
/* debug */ |
/* debug */ |
291 |
{"fourcc_used", ®.fourcc_used, 0}, |
{"fourcc_used", ®.fourcc_used, 0}, |
304 |
}; |
}; |
305 |
|
|
306 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
307 |
{"profile", reg.profile_name, "AS @ L5"}, |
{"profile", reg.profile_name, "(unrestricted)"}, |
308 |
|
{"quality", reg.quality_name, QUALITY_GENERAL_STRING}, |
309 |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
{"stats", reg.stats, CONFIG_2PASS_FILE}, |
310 |
}; |
}; |
311 |
|
|
320 |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
321 |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
322 |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
323 |
|
{"zone%i_cartoon_mode", &stmp.cartoon_mode, 0}, |
324 |
}; |
}; |
325 |
|
|
326 |
static const BYTE default_qmatrix_intra[] = { |
static const BYTE default_qmatrix_intra[] = { |
393 |
} |
} |
394 |
} |
} |
395 |
|
|
396 |
|
/* find profile table index */ |
397 |
reg.profile = 0; |
reg.profile = 0; |
398 |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
for (i=0; i<sizeof(profiles)/sizeof(profile_t); i++) { |
399 |
if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) { |
if (lstrcmpi(profiles[i].name, reg.profile_name) == 0) { |
401 |
} |
} |
402 |
} |
} |
403 |
|
|
404 |
|
/* find quality table index */ |
405 |
|
reg.quality = quality_table_num; |
406 |
|
for (i=0; i<quality_table_num; i++) { |
407 |
|
if (lstrcmpi(quality_table[i].name, reg.quality_name) == 0) { |
408 |
|
reg.quality = i; |
409 |
|
} |
410 |
|
} |
411 |
|
|
412 |
memcpy(config, ®, sizeof(CONFIG)); |
memcpy(config, ®, sizeof(CONFIG)); |
413 |
|
|
414 |
|
|
475 |
|
|
476 |
/* set string values */ |
/* set string values */ |
477 |
strcpy(reg.profile_name, profiles[reg.profile].name); |
strcpy(reg.profile_name, profiles[reg.profile].name); |
478 |
|
strcpy(reg.quality_name, |
479 |
|
reg.quality<quality_table_num ? quality_table[reg.quality].name : QUALITY_USER_STRING); |
480 |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR); i++) { |
for (i=0 ; i<sizeof(reg_strs)/sizeof(REG_STR); i++) { |
481 |
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); |
482 |
} |
} |
576 |
SetDlgItemText(hDlg, item, buf); |
SetDlgItemText(hDlg, item, buf); |
577 |
} |
} |
578 |
|
|
579 |
|
static void set_dlgitem_float1000(HWND hDlg, UINT item, int value) |
580 |
|
{ |
581 |
|
char buf[FLOAT_BUF_SZ]; |
582 |
|
sprintf(buf, "%.3f", (float)value/1000); |
583 |
|
SetDlgItemText(hDlg, item, buf); |
584 |
|
} |
585 |
|
|
586 |
#define HEX_BUF_SZ 16 |
#define HEX_BUF_SZ 16 |
587 |
static unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
static unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
836 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_ADDSTRING, 0, (LPARAM)"4 - Wide Search"); |
837 |
break; |
break; |
838 |
|
|
839 |
case IDD_DEBUG : |
case IDD_ENC : |
840 |
/* force threads disabled */ |
/* force threads disabled */ |
841 |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS_STATIC), FALSE); |
842 |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
EnableWindow(GetDlgItem(hDlg, IDC_NUMTHREADS), FALSE); |
876 |
EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); |
EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); |
877 |
EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); |
EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); |
878 |
EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); |
EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); |
879 |
|
EnableDlgWindow(hDlg, IDC_TFF, IsDlgChecked(hDlg, IDC_INTERLACING)); |
880 |
EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); |
EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); |
881 |
EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); |
EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); |
|
EnableDlgWindow(hDlg, IDC_REDUCED, profiles[profile].flags&PROFILE_REDUCED); |
|
882 |
|
|
883 |
bvops = (profiles[profile].flags&PROFILE_BVOP) && IsDlgChecked(hDlg, IDC_BVOP); |
bvops = (profiles[profile].flags&PROFILE_BVOP) && IsDlgChecked(hDlg, IDC_BVOP); |
884 |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES, bvops); |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES, bvops); |
887 |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S, bvops); |
EnableDlgWindow(hDlg, IDC_MAXBFRAMES_S, bvops); |
888 |
EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTRATIO_S, bvops); |
889 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
890 |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
EnableDlgWindow(hDlg, IDC_PACKED, bvops && !(profiles[profile].flags & PROFILE_DXN)); |
|
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
|
891 |
break; |
break; |
892 |
|
|
893 |
case IDD_AR: |
case IDD_AR: |
925 |
SetDlgItemInt(hDlg, IDC_LEVEL_VMV, profiles[profile].max_vmv_buffer_sz, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_VMV, profiles[profile].max_vmv_buffer_sz, FALSE); |
926 |
SetDlgItemInt(hDlg, IDC_LEVEL_VCV, profiles[profile].vcv_decoder_rate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_VCV, profiles[profile].vcv_decoder_rate, FALSE); |
927 |
SetDlgItemInt(hDlg, IDC_LEVEL_VBV, profiles[profile].max_vbv_size, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_VBV, profiles[profile].max_vbv_size, FALSE); |
928 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
set_dlgitem_float1000(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate); |
929 |
|
SetDlgItemInt(hDlg, IDC_LEVEL_PEAKRATE, profiles[profile].vbv_peakrate, FALSE); |
930 |
|
|
931 |
|
{ |
932 |
|
int en_dim = profiles[profile].width && profiles[profile].height; |
933 |
|
int en_vmv = profiles[profile].max_vmv_buffer_sz; |
934 |
|
int en_vcv = profiles[profile].vcv_decoder_rate; |
935 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_LEVEL_G, en_dim || en_vmv || en_vcv); |
936 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_DIM_S, en_dim); |
937 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_WIDTH, en_dim); |
938 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_HEIGHT,en_dim); |
939 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_FPS, en_dim); |
940 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VMV_S, en_vmv); |
941 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VMV, en_vmv); |
942 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VCV_S, en_vcv); |
943 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VCV, en_vcv); |
944 |
|
} |
945 |
|
{ |
946 |
|
int en_vbv = profiles[profile].max_vbv_size; |
947 |
|
int en_br = profiles[profile].max_bitrate; |
948 |
|
int en_pr = profiles[profile].vbv_peakrate; |
949 |
|
|
950 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VBV_G, en_vbv || en_br || en_pr); |
951 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VBV_S, en_vbv); |
952 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_VBV, en_vbv); |
953 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_BITRATE_S, en_br); |
954 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_BITRATE, en_br); |
955 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE_S, en_pr); |
956 |
|
EnableDlgWindow(hDlg, IDC_LEVEL_PEAKRATE, en_pr); |
957 |
|
} |
958 |
break; |
break; |
959 |
|
|
960 |
case IDD_BITRATE : |
case IDD_BITRATE : |
1000 |
/* step 2: calculate audio_size (kbytes)*/ |
/* step 2: calculate audio_size (kbytes)*/ |
1001 |
if (audio_type!=NO_AUDIO) { |
if (audio_type!=NO_AUDIO) { |
1002 |
if (audio_mode==0) { |
if (audio_mode==0) { |
1003 |
audio_size = (duration * audio_rate) / 8; |
int new_audio_size = (int)( (1000.0 * duration * audio_rate) / (8.0*1024) ); |
1004 |
|
|
1005 |
|
/* this check is needed to avoid a loop */ |
1006 |
|
if (new_audio_size!=audio_size) { |
1007 |
|
audio_size = new_audio_size; |
1008 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ASIZE, new_audio_size, TRUE); |
1009 |
|
} |
1010 |
|
}else{ |
1011 |
|
int tmp_rate = (int)( (audio_size * 8.0 * 1024) / (1000.0 * duration) ); |
1012 |
|
SetDlgItemInt(hDlg, IDC_BITRATE_ARATE, tmp_rate, TRUE); |
1013 |
} |
} |
1014 |
}else{ |
}else{ |
1015 |
audio_size = 0; |
audio_size = 0; |
1049 |
overhead /= 1024; |
overhead /= 1024; |
1050 |
break; |
break; |
1051 |
|
|
1052 |
case 3 : /* OGM: inaccurate model */ |
case 3 : /* alexnoe formula */ |
1053 |
overhead = (int)(0.0039F * (target_size - subtitle_size)); |
overhead = (int)( (target_size - subtitle_size) * (28.0/4224.0 + (1.0/255.0)) ); |
1054 |
break; |
break; |
1055 |
|
|
1056 |
default : /* (none) */ |
default : /* (none) */ |
1065 |
if (vsize > 0) { |
if (vsize > 0) { |
1066 |
SetDlgItemInt(hDlg, IDC_BITRATE_VSIZE, vsize, TRUE); |
SetDlgItemInt(hDlg, IDC_BITRATE_VSIZE, vsize, TRUE); |
1067 |
/* convert from kbytes to kbits-per-second */ |
/* convert from kbytes to kbits-per-second */ |
1068 |
SetDlgItemInt(hDlg, IDC_BITRATE_VRATE, (vsize * 8 * 128) / (duration * 125), TRUE); |
SetDlgItemInt(hDlg, IDC_BITRATE_VRATE, (int)(((__int64)vsize * 8 * 128) / (duration * 125)), TRUE); |
1069 |
}else{ |
}else{ |
1070 |
SetDlgItemText(hDlg, IDC_BITRATE_VSIZE, "Overflow"); |
SetDlgItemText(hDlg, IDC_BITRATE_VSIZE, "Overflow"); |
1071 |
SetDlgItemText(hDlg, IDC_BITRATE_VRATE, "Overflow"); |
SetDlgItemText(hDlg, IDC_BITRATE_VRATE, "Overflow"); |
1098 |
EnableDlgWindow(hDlg, IDC_ZONE_BVOPTHRESHOLD, bvops); |
EnableDlgWindow(hDlg, IDC_ZONE_BVOPTHRESHOLD, bvops); |
1099 |
break; |
break; |
1100 |
|
|
1101 |
case IDD_DEBUG : |
case IDD_COMMON : |
1102 |
cpu_force = IsDlgChecked(hDlg, IDC_CPU_FORCE); |
cpu_force = IsDlgChecked(hDlg, IDC_CPU_FORCE); |
1103 |
EnableDlgWindow(hDlg, IDC_CPU_MMX, cpu_force); |
EnableDlgWindow(hDlg, IDC_CPU_MMX, cpu_force); |
1104 |
EnableDlgWindow(hDlg, IDC_CPU_MMXEXT, cpu_force); |
EnableDlgWindow(hDlg, IDC_CPU_MMXEXT, cpu_force); |
1122 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); |
1123 |
CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); |
CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); |
1124 |
CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); |
CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); |
1125 |
|
CheckDlg(hDlg, IDC_TFF, config->tff); |
1126 |
CheckDlg(hDlg, IDC_QPEL, config->qpel); |
CheckDlg(hDlg, IDC_QPEL, config->qpel); |
1127 |
CheckDlg(hDlg, IDC_GMC, config->gmc); |
CheckDlg(hDlg, IDC_GMC, config->gmc); |
|
CheckDlg(hDlg, IDC_REDUCED, config->reduced_resolution); |
|
1128 |
CheckDlg(hDlg, IDC_BVOP, config->use_bvop); |
CheckDlg(hDlg, IDC_BVOP, config->use_bvop); |
1129 |
|
|
1130 |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXBFRAMES, config->max_bframes, FALSE); |
1131 |
set_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
set_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
1132 |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
1133 |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
|
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
|
1134 |
|
|
1135 |
break; |
break; |
1136 |
case IDD_AR: |
case IDD_AR: |
1199 |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
1200 |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
1201 |
|
|
1202 |
|
CheckDlg(hDlg, IDC_CARTOON, config->zones[config->cur_zone].cartoon_mode); |
1203 |
|
|
1204 |
SetDlgItemInt(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold, TRUE); |
SetDlgItemInt(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold, TRUE); |
1205 |
break; |
break; |
1206 |
|
|
1207 |
case IDD_MOTION : |
case IDD_MOTION : |
1208 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
{ |
1209 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
const int userdef = (config->quality==quality_table_num); |
1210 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
const quality_t* quality_preset = userdef ? &config->quality_user : &quality_table[config->quality]; |
1211 |
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
|
1212 |
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, quality_preset->motion_search, 0); |
1213 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, quality_preset->vhq_mode, 0); |
1214 |
SetDlgItemInt(hDlg, IDC_MAXKEY, config->max_key_interval, FALSE); |
CheckDlg(hDlg, IDC_VHQ_BFRAME, quality_preset->vhq_bframe); |
1215 |
|
CheckDlg(hDlg, IDC_CHROMAME, quality_preset->chromame); |
1216 |
|
CheckDlg(hDlg, IDC_TURBO, quality_preset->turbo); |
1217 |
|
SetDlgItemInt(hDlg, IDC_FRAMEDROP, quality_preset->frame_drop_ratio, FALSE); |
1218 |
|
SetDlgItemInt(hDlg, IDC_MAXKEY, quality_preset->max_key_interval, FALSE); |
1219 |
|
|
1220 |
|
EnableDlgWindow(hDlg, IDC_MOTION, userdef); |
1221 |
|
EnableDlgWindow(hDlg, IDC_VHQ, userdef); |
1222 |
|
EnableDlgWindow(hDlg, IDC_VHQ_BFRAME, userdef); |
1223 |
|
EnableDlgWindow(hDlg, IDC_CHROMAME, userdef); |
1224 |
|
EnableDlgWindow(hDlg, IDC_TURBO, userdef); |
1225 |
|
EnableDlgWindow(hDlg, IDC_FRAMEDROP, userdef); |
1226 |
|
EnableDlgWindow(hDlg, IDC_MAXKEY, userdef); |
1227 |
break; |
break; |
1228 |
|
} |
1229 |
|
|
1230 |
case IDD_QUANT : |
case IDD_QUANT : |
1231 |
SetDlgItemInt(hDlg, IDC_MINIQUANT, config->min_iquant, FALSE); |
{ |
1232 |
SetDlgItemInt(hDlg, IDC_MAXIQUANT, config->max_iquant, FALSE); |
const int userdef = (config->quality==quality_table_num); |
1233 |
SetDlgItemInt(hDlg, IDC_MINPQUANT, config->min_pquant, FALSE); |
const quality_t* quality_preset = userdef ? &config->quality_user : &quality_table[config->quality]; |
1234 |
SetDlgItemInt(hDlg, IDC_MAXPQUANT, config->max_pquant, FALSE); |
|
1235 |
SetDlgItemInt(hDlg, IDC_MINBQUANT, config->min_bquant, FALSE); |
SetDlgItemInt(hDlg, IDC_MINIQUANT, quality_preset->min_iquant, FALSE); |
1236 |
SetDlgItemInt(hDlg, IDC_MAXBQUANT, config->max_bquant, FALSE); |
SetDlgItemInt(hDlg, IDC_MAXIQUANT, quality_preset->max_iquant, FALSE); |
1237 |
CheckDlg(hDlg, IDC_TRELLISQUANT, config->trellis_quant); |
SetDlgItemInt(hDlg, IDC_MINPQUANT, quality_preset->min_pquant, FALSE); |
1238 |
|
SetDlgItemInt(hDlg, IDC_MAXPQUANT, quality_preset->max_pquant, FALSE); |
1239 |
|
SetDlgItemInt(hDlg, IDC_MINBQUANT, quality_preset->min_bquant, FALSE); |
1240 |
|
SetDlgItemInt(hDlg, IDC_MAXBQUANT, quality_preset->max_bquant, FALSE); |
1241 |
|
CheckDlg(hDlg, IDC_TRELLISQUANT, quality_preset->trellis_quant); |
1242 |
|
|
1243 |
|
EnableDlgWindow(hDlg, IDC_MINIQUANT, userdef); |
1244 |
|
EnableDlgWindow(hDlg, IDC_MAXIQUANT, userdef); |
1245 |
|
EnableDlgWindow(hDlg, IDC_MINPQUANT, userdef); |
1246 |
|
EnableDlgWindow(hDlg, IDC_MAXPQUANT, userdef); |
1247 |
|
EnableDlgWindow(hDlg, IDC_MINBQUANT, userdef); |
1248 |
|
EnableDlgWindow(hDlg, IDC_MAXBQUANT, userdef); |
1249 |
|
EnableDlgWindow(hDlg, IDC_TRELLISQUANT, userdef); |
1250 |
break; |
break; |
1251 |
|
} |
1252 |
|
|
1253 |
case IDD_DEBUG : |
case IDD_COMMON : |
1254 |
CheckDlg(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX)); |
CheckDlg(hDlg, IDC_CPU_MMX, (config->cpu & XVID_CPU_MMX)); |
1255 |
CheckDlg(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT)); |
CheckDlg(hDlg, IDC_CPU_MMXEXT, (config->cpu & XVID_CPU_MMXEXT)); |
1256 |
CheckDlg(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE)); |
CheckDlg(hDlg, IDC_CPU_SSE, (config->cpu & XVID_CPU_SSE)); |
1260 |
|
|
1261 |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
CheckRadioButton(hDlg, IDC_CPU_AUTO, IDC_CPU_FORCE, |
1262 |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
config->cpu & XVID_CPU_FORCE ? IDC_CPU_FORCE : IDC_CPU_AUTO ); |
1263 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1264 |
|
break; |
1265 |
|
|
1266 |
|
case IDD_ENC: |
1267 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
|
|
|
1268 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
|
1269 |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
1270 |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
1271 |
break; |
break; |
1296 |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); |
1297 |
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); |
1298 |
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); |
1299 |
|
config->tff = IsDlgChecked(hDlg, IDC_TFF); |
1300 |
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
config->qpel = IsDlgChecked(hDlg, IDC_QPEL); |
1301 |
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
config->gmc = IsDlgChecked(hDlg, IDC_GMC); |
|
config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); |
|
1302 |
|
|
1303 |
config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP); |
config->use_bvop = IsDlgChecked(hDlg, IDC_BVOP); |
1304 |
config->max_bframes = config_get_uint(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
config->max_bframes = config_get_uint(hDlg, IDC_MAXBFRAMES, config->max_bframes); |
1305 |
config->bquant_ratio = get_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
config->bquant_ratio = get_dlgitem_float(hDlg, IDC_BQUANTRATIO, config->bquant_ratio); |
1306 |
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
1307 |
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
|
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
|
1308 |
break; |
break; |
1309 |
|
|
1310 |
case IDD_AR: |
case IDD_AR: |
1409 |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
1410 |
|
|
1411 |
config->zones[config->cur_zone].bvop_threshold = config_get_int(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold); |
config->zones[config->cur_zone].bvop_threshold = config_get_int(hDlg, IDC_ZONE_BVOPTHRESHOLD, config->zones[config->cur_zone].bvop_threshold); |
1412 |
|
config->zones[config->cur_zone].cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1413 |
break; |
break; |
1414 |
|
|
1415 |
case IDD_MOTION : |
case IDD_MOTION : |
1416 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
if (config->quality==quality_table_num) { |
1417 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->quality_user.motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1418 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->quality_user.vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1419 |
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
config->quality_user.vhq_bframe = IsDlgButtonChecked(hDlg, IDC_VHQ_BFRAME); |
1420 |
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
config->quality_user.chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1421 |
|
config->quality_user.turbo = IsDlgChecked(hDlg, IDC_TURBO); |
1422 |
|
|
1423 |
config->frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio); |
config->quality_user.frame_drop_ratio = config_get_uint(hDlg, IDC_FRAMEDROP, config->quality_user.frame_drop_ratio); |
1424 |
|
|
1425 |
config->max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->max_key_interval); |
config->quality_user.max_key_interval = config_get_uint(hDlg, IDC_MAXKEY, config->quality_user.max_key_interval); |
1426 |
|
} |
1427 |
break; |
break; |
1428 |
|
|
1429 |
case IDD_QUANT : |
case IDD_QUANT : |
1430 |
config->min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->min_iquant); |
if (config->quality==quality_table_num) { |
1431 |
config->max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->max_iquant); |
config->quality_user.min_iquant = config_get_uint(hDlg, IDC_MINIQUANT, config->quality_user.min_iquant); |
1432 |
config->min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->min_pquant); |
config->quality_user.max_iquant = config_get_uint(hDlg, IDC_MAXIQUANT, config->quality_user.max_iquant); |
1433 |
config->max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->max_pquant); |
config->quality_user.min_pquant = config_get_uint(hDlg, IDC_MINPQUANT, config->quality_user.min_pquant); |
1434 |
config->min_bquant = config_get_uint(hDlg, IDC_MINBQUANT, config->min_bquant); |
config->quality_user.max_pquant = config_get_uint(hDlg, IDC_MAXPQUANT, config->quality_user.max_pquant); |
1435 |
config->max_bquant = config_get_uint(hDlg, IDC_MAXBQUANT, config->max_bquant); |
config->quality_user.min_bquant = config_get_uint(hDlg, IDC_MINBQUANT, config->quality_user.min_bquant); |
1436 |
|
config->quality_user.max_bquant = config_get_uint(hDlg, IDC_MAXBQUANT, config->quality_user.max_bquant); |
1437 |
CONSTRAINVAL(config->min_iquant, 1, 31); |
|
1438 |
CONSTRAINVAL(config->max_iquant, config->min_iquant, 31); |
CONSTRAINVAL(config->quality_user.min_iquant, 1, 31); |
1439 |
CONSTRAINVAL(config->min_pquant, 1, 31); |
CONSTRAINVAL(config->quality_user.max_iquant, config->quality_user.min_iquant, 31); |
1440 |
CONSTRAINVAL(config->max_pquant, config->min_pquant, 31); |
CONSTRAINVAL(config->quality_user.min_pquant, 1, 31); |
1441 |
CONSTRAINVAL(config->min_bquant, 1, 31); |
CONSTRAINVAL(config->quality_user.max_pquant, config->quality_user.min_pquant, 31); |
1442 |
CONSTRAINVAL(config->max_bquant, config->min_bquant, 31); |
CONSTRAINVAL(config->quality_user.min_bquant, 1, 31); |
1443 |
|
CONSTRAINVAL(config->quality_user.max_bquant, config->quality_user.min_bquant, 31); |
1444 |
|
|
1445 |
config->trellis_quant = IsDlgChecked(hDlg, IDC_TRELLISQUANT); |
config->quality_user.trellis_quant = IsDlgChecked(hDlg, IDC_TRELLISQUANT); |
1446 |
|
} |
1447 |
break; |
break; |
1448 |
|
|
1449 |
case IDD_DEBUG : |
case IDD_COMMON : |
1450 |
config->cpu = 0; |
config->cpu = 0; |
1451 |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMX) ? XVID_CPU_MMX : 0; |
1452 |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_MMXEXT) ? XVID_CPU_MMXEXT : 0; |
1455 |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOW) ? XVID_CPU_3DNOW : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOW) ? XVID_CPU_3DNOW : 0; |
1456 |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_3DNOWEXT) ? XVID_CPU_3DNOWEXT : 0; |
1457 |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
config->cpu |= IsDlgChecked(hDlg, IDC_CPU_FORCE) ? XVID_CPU_FORCE : 0; |
1458 |
|
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1459 |
|
break; |
1460 |
|
|
1461 |
|
case IDD_ENC : |
1462 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
|
|
|
1463 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
|
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
|
1464 |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1465 |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1466 |
break; |
break; |
1503 |
{ |
{ |
1504 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1505 |
{ |
{ |
1506 |
|
case IDC_INTERLACING : |
1507 |
|
case IDC_VHQ_BFRAME : |
1508 |
case IDC_BVOP : |
case IDC_BVOP : |
1509 |
case IDC_ZONE_MODE_WEIGHT : |
case IDC_ZONE_MODE_WEIGHT : |
1510 |
case IDC_ZONE_MODE_QUANT : |
case IDC_ZONE_MODE_QUANT : |
1801 |
strcat(tmp, "G "); |
strcat(tmp, "G "); |
1802 |
|
|
1803 |
if (s->chroma_opt) |
if (s->chroma_opt) |
1804 |
|
strcat(tmp, "O "); |
1805 |
|
|
1806 |
|
if (s->cartoon_mode) |
1807 |
strcat(tmp, "C "); |
strcat(tmp, "C "); |
1808 |
|
|
1809 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1830 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1831 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1832 |
|
|
1833 |
max = profiles[profile].max_bitrate; |
max = profiles[profile].max_bitrate / 1000; |
1834 |
if (max == 0) max = DEFAULT_MAX_KBPS; |
if (max == 0) max = DEFAULT_MAX_KBPS; |
1835 |
wsprintf(buf, "%i kbps", max); |
wsprintf(buf, "%i kbps", max); |
1836 |
SetDlgItemText(hDlg, IDC_BITRATE_MAX, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MAX, buf); |
1866 |
|
|
1867 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1868 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1869 |
|
SendDlgItemMessage(hDlg, IDC_QUALITY, CB_SETCURSEL, config->quality, 0); |
1870 |
|
|
1871 |
g_use_bitrate = config->use_2pass_bitrate; |
g_use_bitrate = config->use_2pass_bitrate; |
1872 |
|
|
1887 |
{ |
{ |
1888 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1889 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1890 |
|
config->quality = SendDlgItemMessage(hDlg, IDC_QUALITY, CB_GETCURSEL, 0, 0); |
1891 |
|
|
1892 |
if (g_use_bitrate) { |
if (g_use_bitrate) { |
1893 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1907 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1908 |
static const int bitrate_dlgs[] = { IDD_BITRATE }; |
static const int bitrate_dlgs[] = { IDD_BITRATE }; |
1909 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1910 |
static const int decoder_dlgs[] = { IDD_DEC }; |
static const int quality_dlgs[] = { IDD_MOTION, IDD_QUANT }; |
1911 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int other_dlgs[] = { IDD_ENC, IDD_DEC, IDD_COMMON }; |
1912 |
|
|
1913 |
|
|
1914 |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
BOOL CALLBACK main_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
1932 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null test speed"); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_ADDSTRING, 0, (LPARAM)"Null test speed"); |
1933 |
#endif |
#endif |
1934 |
|
|
1935 |
|
for (i=0; i<quality_table_num; i++) |
1936 |
|
SendDlgItemMessage(hDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)quality_table[i].name); |
1937 |
|
SendDlgItemMessage(hDlg, IDC_QUALITY, CB_ADDSTRING, 0, (LPARAM)QUALITY_USER_STRING); |
1938 |
|
|
1939 |
InitCommonControls(); |
InitCommonControls(); |
1940 |
|
|
1941 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1944 |
{ |
{ |
1945 |
SetWindowPos(g_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); |
1946 |
SendMessage(g_hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
SendMessage(g_hTooltip, TTM_SETDELAYTIME, TTDT_AUTOMATIC, MAKELONG(1500, 0)); |
1947 |
|
#if (_WIN32_IE >= 0x0300) |
1948 |
SendMessage(g_hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
SendMessage(g_hTooltip, TTM_SETMAXTIPWIDTH, 0, 400); |
1949 |
|
#endif |
1950 |
|
|
1951 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1952 |
} |
} |
1955 |
|
|
1956 |
{ |
{ |
1957 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1958 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
#if (_WIN32_IE >= 0x0300) |
1959 |
|
ext_style |= LVS_EX_FULLROWSELECT; |
1960 |
|
#endif |
1961 |
|
#if( _WIN32_IE >= 0x0400 ) |
1962 |
|
ext_style |= LVS_EX_FLATSB ; |
1963 |
|
#endif |
1964 |
ListView_SetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES), ext_style); |
ListView_SetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES), ext_style); |
1965 |
} |
} |
1966 |
|
|
2054 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
2055 |
break; |
break; |
2056 |
|
|
2057 |
case IDC_DECODER : |
case IDC_OTHER : |
2058 |
main_download(hDlg, config); |
main_download(hDlg, config); |
2059 |
adv_dialog(hDlg, config, decoder_dlgs, sizeof(decoder_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, other_dlgs, sizeof(other_dlgs)/sizeof(int)); |
2060 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
2061 |
break; |
break; |
2062 |
|
|
2130 |
} |
} |
2131 |
break; |
break; |
2132 |
|
|
2133 |
case IDC_ADVANCED : |
case IDC_QUALITY_ADV : |
2134 |
main_download(hDlg, config); |
main_download(hDlg, config); |
2135 |
adv_dialog(hDlg, config, adv_dlgs, sizeof(adv_dlgs)/sizeof(int)); |
|
2136 |
|
if (config->quality < quality_table_num) { |
2137 |
|
int result = MessageBox(hDlg, |
2138 |
|
"The built-in quality presets are read-only. Would you like to copy the values\n" |
2139 |
|
"of the selected preset into the \"" QUALITY_USER_STRING "\" preset for editing?", |
2140 |
|
"Question", MB_YESNOCANCEL|MB_DEFBUTTON2|MB_ICONQUESTION); |
2141 |
|
|
2142 |
|
if (result==0 || result==IDCANCEL) break; |
2143 |
|
if (result==IDYES) { |
2144 |
|
memcpy(&config->quality_user, &quality_table[config->quality], sizeof(quality_t)); |
2145 |
|
config->quality = quality_table_num; |
2146 |
|
} |
2147 |
|
} |
2148 |
|
adv_dialog(hDlg, config, quality_dlgs, sizeof(quality_dlgs)/sizeof(int)); |
2149 |
|
SendDlgItemMessage(hDlg, IDC_QUALITY, CB_SETCURSEL, config->quality, 0); |
2150 |
break; |
break; |
2151 |
|
|
2152 |
case IDC_DEFAULTS : |
case IDC_DEFAULTS : |
2220 |
} |
} |
2221 |
|
|
2222 |
|
|
2223 |
|
/* ===================================================================================== */ |
2224 |
|
/* LICENSE DIALOG ====================================================================== */ |
2225 |
|
/* ===================================================================================== */ |
2226 |
|
|
2227 |
|
static BOOL CALLBACK license_proc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) |
2228 |
|
{ |
2229 |
|
switch (uMsg) |
2230 |
|
{ |
2231 |
|
case WM_INITDIALOG : |
2232 |
|
{ |
2233 |
|
HRSRC hRSRC; |
2234 |
|
HGLOBAL hGlobal = NULL; |
2235 |
|
if ((hRSRC = FindResource(g_hInst, MAKEINTRESOURCE(IDR_GPL), "TEXT"))) { |
2236 |
|
if ((hGlobal = LoadResource(g_hInst, hRSRC))) { |
2237 |
|
LPVOID lpData; |
2238 |
|
if ((lpData = LockResource(hGlobal))) { |
2239 |
|
SendDlgItemMessage(hDlg, IDC_LICENSE_TEXT, WM_SETFONT, (WPARAM)GetStockObject(ANSI_FIXED_FONT), MAKELPARAM(TRUE, 0)); |
2240 |
|
SetDlgItemText(hDlg, IDC_LICENSE_TEXT, lpData); |
2241 |
|
SendDlgItemMessage(hDlg, IDC_LICENSE_TEXT, EM_SETSEL, (WPARAM)-1, (LPARAM)0); |
2242 |
|
} |
2243 |
|
} |
2244 |
|
} |
2245 |
|
SetWindowLong(hDlg, GWL_USERDATA, (LONG)hGlobal); |
2246 |
|
} |
2247 |
|
break; |
2248 |
|
|
2249 |
|
case WM_DESTROY : |
2250 |
|
{ |
2251 |
|
HGLOBAL hGlobal = (HGLOBAL)GetWindowLong(hDlg, GWL_USERDATA); |
2252 |
|
if (hGlobal) { |
2253 |
|
FreeResource(hGlobal); |
2254 |
|
} |
2255 |
|
} |
2256 |
|
break; |
2257 |
|
|
2258 |
|
case WM_COMMAND : |
2259 |
|
if (HIWORD(wParam) == BN_CLICKED) { |
2260 |
|
switch(LOWORD(wParam)) { |
2261 |
|
case IDOK : |
2262 |
|
case IDCANCEL : |
2263 |
|
EndDialog(hDlg, 0); |
2264 |
|
break; |
2265 |
|
default : |
2266 |
|
return 0; |
2267 |
|
} |
2268 |
|
break; |
2269 |
|
} |
2270 |
|
break; |
2271 |
|
|
2272 |
|
default : |
2273 |
|
return 0; |
2274 |
|
} |
2275 |
|
|
2276 |
|
return 1; |
2277 |
|
} |
2278 |
|
|
2279 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
2280 |
/* ABOUT DIALOG ======================================================================== */ |
/* ABOUT DIALOG ======================================================================== */ |
2342 |
return 0; |
return 0; |
2343 |
|
|
2344 |
case WM_COMMAND : |
case WM_COMMAND : |
2345 |
if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) |
if (LOWORD(wParam) == IDC_WEBSITE && HIWORD(wParam) == STN_CLICKED) { |
|
{ |
|
2346 |
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
ShellExecute(hDlg, "open", XVID_WEBSITE, NULL, NULL, SW_SHOWNORMAL); |
2347 |
} |
}else if (LOWORD(wParam) == IDC_LICENSE) { |
2348 |
else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) |
DialogBoxParam(g_hInst, MAKEINTRESOURCE(IDD_LICENSE), hDlg, license_proc, (LPARAM)0); |
2349 |
{ |
} else if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { |
2350 |
EndDialog(hDlg, LOWORD(wParam)); |
EndDialog(hDlg, LOWORD(wParam)); |
2351 |
} |
} |
2352 |
break; |
break; |