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 |
|
|
108 |
{ |
{ |
109 |
/* 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 */ |
110 |
{ "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 }, |
111 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 |
/* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 */ |
112 |
/* if ac preidition is used, adaptive quantization must not be used */ |
/* if ac preidition is used, adaptive quantization must not be used */ |
113 |
|
/* <=qcif must be used */ |
114 |
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
{ "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, |
115 |
{ "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, |
{ "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, |
116 |
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
{ "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, |
124 |
{ "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 }, |
125 |
{ "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 }, |
126 |
{ "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 }, |
127 |
|
/* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ |
128 |
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
{ "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, |
129 |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
{ "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, |
130 |
|
|
131 |
|
#ifdef DXN_PROFILES |
132 |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
{ "DXN Handheld", 0x00, 176, 144, 15, -1, 198, 99, 1485, 100, 16*16368, -1, 128, PROFILE_ADAPTQUANT }, |
133 |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable NTSC", 0x00, 352, 240, 30, -1, 990, 330, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
134 |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
{ "DXN Portable PAL", 0x00, 352, 288, 25, -1, 1188, 396, 9900, 100, 64*16368, -1, 768, PROFILE_ADAPTQUANT|PROFILE_BVOP }, |
135 |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT NTSC", 0x00, 720, 480, 30, -1, 4050, 1350, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
136 |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HT PAL", 0x00, 720, 576, 25, -1, 4860, 1620, 40500, 100, 192*16368, -1, 4000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
137 |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
{ "DXN HDTV", 0x00, 1280, 720, 30, -1,10800, 3600, 108000, 100, 384*16368, -1, 8000, PROFILE_ADAPTQUANT|PROFILE_BVOP|PROFILE_INTERLACE }, |
138 |
|
#endif |
139 |
|
|
140 |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
{ "(unrestricted)", 0x00, 0, 0, 0, 0, 0, 0, 0, 100, 0*16368, 0, 0, 0xffffffff }, |
141 |
}; |
}; |
151 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
152 |
{"mode", ®.mode, RC_MODE_1PASS}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
153 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
154 |
/* {"desired_size", ®.desired_size, 570000}, not used */ |
{"desired_size", ®.desired_size, 570000}, |
155 |
|
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
|
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
|
|
{"rc_buffer", ®.rc_buffer, 100}, |
|
156 |
|
|
157 |
{"motion_search", ®.motion_search, 6}, |
/* profile */ |
158 |
{"quant_type", ®.quant_type, 0}, |
{"quant_type", ®.quant_type, 0}, |
|
{"fourcc_used", ®.fourcc_used, 0}, |
|
|
{"vhq_mode", ®.vhq_mode, 0}, |
|
|
{"max_key_interval", ®.max_key_interval, 300}, |
|
|
{"min_key_interval", ®.min_key_interval, 1}, |
|
159 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
160 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
161 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
162 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
163 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
164 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 1}, |
165 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
166 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
167 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
168 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 1}, |
169 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
170 |
{"vop_debug", ®.vop_debug, 0}, |
|
171 |
{"debug", ®.debug, 0x0}, |
/* aspect ratio */ |
172 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
{"ar_mode", ®.ar_mode, 0}, |
173 |
|
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
174 |
|
{"par_x", ®.par_x, 1}, |
175 |
|
{"par_y", ®.par_y, 1}, |
176 |
|
{"ar_x", ®.ar_x, 4}, |
177 |
|
{"ar_y", ®.ar_y, 3}, |
178 |
|
|
179 |
|
/* zones */ |
180 |
|
{"num_zones", ®.num_zones, 1}, |
181 |
|
|
182 |
|
/* single pass */ |
183 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
184 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
185 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
186 |
|
|
187 |
|
/* 2pass1 */ |
188 |
|
{"discard1pass", ®.discard1pass, 1}, |
189 |
|
|
190 |
|
/* 2pass2 */ |
191 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
192 |
|
{"kfreduction", ®.kfreduction, 20}, |
193 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
194 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
195 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
196 |
|
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
197 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
198 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
199 |
|
|
200 |
|
/* motion */ |
201 |
|
{"motion_search", ®.motion_search, 6}, |
202 |
|
{"vhq_mode", ®.vhq_mode, 1}, |
203 |
|
{"chromame", ®.chromame, 1}, |
204 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
205 |
|
{"turbo", ®.turbo, 0}, |
206 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
207 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
208 |
|
|
209 |
|
/* quant */ |
210 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 2}, |
211 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
212 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 2}, |
215 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
216 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
217 |
|
|
218 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
/* debug */ |
219 |
{"discard1pass", ®.discard1pass, 1}, |
{"fourcc_used", ®.fourcc_used, 0}, |
220 |
{"kftreshold", ®.kftreshold, 10}, |
{"debug", ®.debug, 0x0}, |
221 |
{"kfreduction", ®.kfreduction, 20}, |
{"vop_debug", ®.vop_debug, 0}, |
222 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"display_status", ®.display_status, 1}, |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
|
|
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
|
|
{"bitrate_payback_method", ®.bitrate_payback_method, XVID_PAYBACK_BIAS }, |
|
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
|
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
|
|
|
|
|
{"num_zones", ®.num_zones, 1}, |
|
223 |
}; |
}; |
224 |
|
|
225 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
234 |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
235 |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
236 |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
237 |
|
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
238 |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
239 |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
240 |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
266 |
|
|
267 |
#define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} |
#define REG_GET_B(X, Y, Z) size=sizeof((Z));if(RegQueryValueEx(hKey, X, 0, 0, Y, &size) != ERROR_SUCCESS) {memcpy(Y, Z, sizeof((Z)));} |
268 |
|
|
269 |
|
#define XVID_DLL_NAME "xvidcore.dll" |
270 |
|
|
271 |
void config_reg_get(CONFIG * config) |
void config_reg_get(CONFIG * config) |
272 |
{ |
{ |
273 |
char tmp[32]; |
char tmp[32]; |
275 |
DWORD size; |
DWORD size; |
276 |
int i,j; |
int i,j; |
277 |
xvid_gbl_info_t info; |
xvid_gbl_info_t info; |
278 |
|
HINSTANCE m_hdll; |
279 |
|
|
280 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
281 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
282 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
283 |
|
m_hdll = LoadLibrary(XVID_DLL_NAME); |
284 |
|
if (m_hdll != NULL) { |
285 |
|
|
286 |
|
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
287 |
|
(0, XVID_GBL_INFO, &info, NULL); |
288 |
|
|
289 |
|
FreeLibrary(m_hdll); |
290 |
|
} |
291 |
|
|
292 |
reg.cpu = info.cpu_flags; |
reg.cpu = info.cpu_flags; |
293 |
reg.num_threads = info.num_threads; |
reg.num_threads = info.num_threads; |
294 |
|
|
648 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
649 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
650 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
651 |
|
|
652 |
|
break; |
653 |
|
case IDD_AR: |
654 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Square (default)"); |
655 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 PAL"); |
656 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 NTSC"); |
657 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 PAL"); |
658 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 NTSC"); |
659 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom..."); |
660 |
break; |
break; |
661 |
|
|
662 |
case IDD_LEVEL : |
case IDD_LEVEL : |
665 |
break; |
break; |
666 |
|
|
667 |
case IDD_ZONE : |
case IDD_ZONE : |
668 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
|
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
|
669 |
break; |
break; |
670 |
|
|
671 |
case IDD_MOTION : |
case IDD_MOTION : |
705 |
int weight_en, quant_en; |
int weight_en, quant_en; |
706 |
int cpu_force; |
int cpu_force; |
707 |
int custom_quant, bvops; |
int custom_quant, bvops; |
708 |
|
int ar_mode, ar_par; |
709 |
|
|
710 |
switch(idd) { |
switch(idd) { |
711 |
case IDD_PROFILE : |
case IDD_PROFILE : |
732 |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
EnableDlgWindow(hDlg, IDC_BQUANTOFFSET_S, bvops); |
733 |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
EnableDlgWindow(hDlg, IDC_PACKED, bvops); |
734 |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
EnableDlgWindow(hDlg, IDC_CLOSEDGOV, bvops); |
735 |
|
break; |
736 |
|
|
737 |
|
case IDD_AR: |
738 |
|
ar_mode = IsDlgChecked(hDlg, IDC_PAR); |
739 |
|
EnableDlgWindow(hDlg, IDC_ASPECT_RATIO, ar_mode); |
740 |
|
|
741 |
|
ar_par = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
742 |
|
if (ar_par == 5) { /* custom par */ |
743 |
|
SetDlgItemInt(hDlg, IDC_PARY, config->par_y, FALSE); |
744 |
|
SetDlgItemInt(hDlg, IDC_PARX, config->par_x, FALSE); |
745 |
|
|
746 |
|
EnableDlgWindow(hDlg, IDC_PARX, ar_mode); |
747 |
|
EnableDlgWindow(hDlg, IDC_PARY, ar_mode); |
748 |
|
} else { |
749 |
|
SetDlgItemInt(hDlg, IDC_PARX, PARS[ar_par][0], FALSE); |
750 |
|
SetDlgItemInt(hDlg, IDC_PARY, PARS[ar_par][1], FALSE); |
751 |
|
EnableDlgWindow(hDlg, IDC_PARX, FALSE); |
752 |
|
EnableDlgWindow(hDlg, IDC_PARY, FALSE); |
753 |
|
} |
754 |
|
|
755 |
|
ar_mode = IsDlgChecked(hDlg, IDC_AR); |
756 |
|
|
757 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
758 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
759 |
|
|
760 |
|
EnableDlgWindow(hDlg, IDC_ARX, ar_mode); |
761 |
|
EnableDlgWindow(hDlg, IDC_ARY, ar_mode); |
762 |
|
break; |
763 |
|
|
764 |
case IDD_LEVEL : |
case IDD_LEVEL : |
765 |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
830 |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
831 |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
832 |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
833 |
|
|
834 |
|
break; |
835 |
|
case IDD_AR: |
836 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, config->ar_mode == 0 ? IDC_PAR : IDC_AR); |
837 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
838 |
|
SetDlgItemInt(hDlg, IDC_ARX, config->ar_x, FALSE); |
839 |
|
SetDlgItemInt(hDlg, IDC_ARY, config->ar_y, FALSE); |
840 |
break; |
break; |
841 |
|
|
842 |
case IDD_LEVEL : |
case IDD_LEVEL : |
857 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
858 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
859 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
860 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
861 |
|
|
862 |
|
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
863 |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
864 |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
865 |
|
|
866 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
867 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
868 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_MINKEY, config->kfthreshold, FALSE); |
|
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == XVID_PAYBACK_BIAS)); |
|
|
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == XVID_PAYBACK_PROP)); |
|
869 |
break; |
break; |
870 |
|
|
871 |
case IDD_ZONE : |
case IDD_ZONE : |
872 |
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); |
|
873 |
|
|
874 |
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); |
875 |
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); |
877 |
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); |
878 |
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); |
879 |
|
|
880 |
|
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
881 |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
882 |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
883 |
|
|
888 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
889 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
890 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
891 |
|
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
892 |
|
CheckDlg(hDlg, IDC_TURBO, config->turbo); |
893 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
894 |
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); |
|
895 |
break; |
break; |
896 |
|
|
897 |
case IDD_QUANT : |
case IDD_QUANT : |
917 |
|
|
918 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
919 |
|
|
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
|
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
|
920 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
921 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
922 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
923 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
924 |
break; |
break; |
925 |
} |
} |
926 |
} |
} |
950 |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
951 |
break; |
break; |
952 |
|
|
953 |
|
case IDD_AR: |
954 |
|
config->ar_mode = IsDlgChecked(hDlg, IDC_PAR) ? 0:1; |
955 |
|
config->ar_x = config_get_uint(hDlg, IDC_ARX, config->ar_x); |
956 |
|
config->ar_y = config_get_uint(hDlg, IDC_ARY, config->ar_y); |
957 |
|
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
958 |
|
if (config->display_aspect_ratio == 5) { |
959 |
|
config->par_x = config_get_uint(hDlg, IDC_PARX, config->par_x); |
960 |
|
config->par_y = config_get_uint(hDlg, IDC_PARY, config->par_y); |
961 |
|
} |
962 |
|
break; |
963 |
|
|
964 |
case IDD_LEVEL : |
case IDD_LEVEL : |
965 |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_GETCURSEL, 0, 0); |
966 |
break; |
break; |
982 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
983 |
|
|
984 |
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); |
|
985 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
986 |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
987 |
|
|
988 |
|
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
989 |
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); |
990 |
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); |
991 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
992 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
993 |
|
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
994 |
|
|
995 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
996 |
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) ? XVID_PAYBACK_PROP : XVID_PAYBACK_BIAS; |
|
|
|
|
|
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
|
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
|
997 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
998 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
999 |
|
|
1000 |
|
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
1001 |
|
|
1002 |
break; |
break; |
1003 |
|
|
1004 |
case IDD_ZONE : |
case IDD_ZONE : |
1013 |
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); |
1014 |
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); |
1015 |
|
|
1016 |
|
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
1017 |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
1018 |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
1019 |
|
|
1024 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
1025 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
1026 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
1027 |
|
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
1028 |
|
config->turbo = IsDlgChecked(hDlg, IDC_TURBO); |
1029 |
|
|
1030 |
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); |
1031 |
|
|
1032 |
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); |
|
1033 |
break; |
break; |
1034 |
|
|
1035 |
case IDD_QUANT : |
case IDD_QUANT : |
1063 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
1064 |
|
|
1065 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
|
1066 |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
1067 |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
1068 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1069 |
break; |
break; |
1070 |
} |
} |
1071 |
} |
} |
1103 |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1104 |
case IDC_CPU_AUTO : |
case IDC_CPU_AUTO : |
1105 |
case IDC_CPU_FORCE : |
case IDC_CPU_FORCE : |
1106 |
|
case IDC_AR : |
1107 |
|
case IDC_PAR : |
1108 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1109 |
break; |
break; |
1110 |
|
|
1144 |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
SetDlgItemInt(hDlg, IDC_ZONE_FRAME, psi->config->ci.ciActiveFrame, FALSE); |
1145 |
break; |
break; |
1146 |
|
|
1147 |
|
case IDC_AR_DEFAULT: |
1148 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_PAR); |
1149 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, 0, 0); |
1150 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1151 |
|
break; |
1152 |
|
case IDC_AR_4_3: |
1153 |
|
SetDlgItemInt(hDlg, IDC_ARX, 4, FALSE); |
1154 |
|
SetDlgItemInt(hDlg, IDC_ARY, 3, FALSE); |
1155 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1156 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1157 |
|
break; |
1158 |
|
case IDC_AR_16_9: |
1159 |
|
SetDlgItemInt(hDlg, IDC_ARX, 16, FALSE); |
1160 |
|
SetDlgItemInt(hDlg, IDC_ARY, 9, FALSE); |
1161 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1162 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1163 |
|
break; |
1164 |
|
case IDC_AR_235_100: |
1165 |
|
SetDlgItemInt(hDlg, IDC_ARX, 235, FALSE); |
1166 |
|
SetDlgItemInt(hDlg, IDC_ARY, 100, FALSE); |
1167 |
|
CheckRadioButton(hDlg, IDC_AR, IDC_PAR, IDC_AR); |
1168 |
|
adv_mode(hDlg, psi->idd, psi->config); |
1169 |
|
break; |
1170 |
|
|
1171 |
default : |
default : |
1172 |
return TRUE; |
return TRUE; |
1173 |
} |
} |
1174 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1175 |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
(LOWORD(wParam) == IDC_PROFILE_PROFILE || |
1176 |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
LOWORD(wParam) == IDC_LEVEL_PROFILE || |
1177 |
LOWORD(wParam) == IDC_QUANTTYPE)) |
LOWORD(wParam) == IDC_QUANTTYPE || |
1178 |
|
LOWORD(wParam) == IDC_ASPECT_RATIO)) |
1179 |
{ |
{ |
1180 |
adv_mode(hDlg, psi->idd, psi->config); |
adv_mode(hDlg, psi->idd, psi->config); |
1181 |
}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)) { |
1182 |
|
|
1183 |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_ZONE_SLIDER, TBM_SETPOS, TRUE, |
1184 |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
get_dlgitem_float(hDlg, LOWORD(wParam), 100)); |
1185 |
}else { |
} else if (HIWORD(wParam) == EN_UPDATE && (LOWORD(wParam)==IDC_PARX || LOWORD(wParam)==IDC_PARY)) { |
1186 |
return 0; |
if (5 == SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0)) { |
1187 |
|
if(LOWORD(wParam)==IDC_PARX) |
1188 |
|
psi->config->par_x = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_x); |
1189 |
|
else |
1190 |
|
psi->config->par_y = config_get_uint(hDlg, LOWORD(wParam), psi->config->par_y); |
1191 |
} |
} |
1192 |
|
} else |
1193 |
|
return 0; |
1194 |
break; |
break; |
1195 |
|
|
1196 |
case WM_HSCROLL : |
case WM_HSCROLL : |
1320 |
ListView_SetItemText(hDlg, i, 1, tmp); |
ListView_SetItemText(hDlg, i, 1, tmp); |
1321 |
|
|
1322 |
tmp[0] = '\0'; |
tmp[0] = '\0'; |
1323 |
|
if (s->type==XVID_TYPE_IVOP) |
1324 |
|
strcat(tmp, "K "); |
1325 |
|
|
1326 |
if (s->greyscale) |
if (s->greyscale) |
1327 |
strcat(tmp, "G "); |
strcat(tmp, "G "); |
1328 |
|
|
1332 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1333 |
} |
} |
1334 |
|
|
1335 |
|
static int g_use_bitrate = 1; |
1336 |
|
|
1337 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1338 |
{ |
{ |
1339 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1340 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1341 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1342 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1343 |
|
|
1344 |
char buf[16]; |
char buf[16]; |
|
int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
int bitrate_en; |
|
1345 |
int max; |
int max; |
1346 |
|
|
1347 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1348 |
|
|
1349 |
|
if (g_use_bitrate) { |
1350 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1351 |
|
|
1352 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1353 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1354 |
|
|
1361 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1362 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1363 |
|
|
1364 |
bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
}else{ |
1365 |
bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1366 |
|
} |
1367 |
|
|
1368 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1369 |
|
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1370 |
|
|
1371 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1372 |
EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1373 |
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); |
|
1374 |
} |
} |
1375 |
|
|
1376 |
|
|
1377 |
|
|
1378 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1379 |
{ |
{ |
1380 |
int i; |
int i; |
1381 |
|
|
1382 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1383 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1384 |
|
|
1385 |
|
if (g_use_bitrate) { |
1386 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1387 |
|
}else{ |
1388 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1389 |
|
} |
1390 |
|
|
1391 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1392 |
for (i=0; i < config->num_zones; i++) { |
for (i=0; i < config->num_zones; i++) { |
1400 |
{ |
{ |
1401 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1402 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1403 |
|
|
1404 |
|
if (g_use_bitrate) { |
1405 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1406 |
|
}else{ |
1407 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1408 |
|
} |
1409 |
} |
} |
|
|
|
|
|
|
1410 |
|
|
1411 |
|
|
1412 |
/* main dialog proc */ |
/* main dialog proc */ |
1413 |
|
|
1414 |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL, IDD_AR }; |
1415 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1416 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1417 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1443 |
|
|
1444 |
InitCommonControls(); |
InitCommonControls(); |
1445 |
|
|
|
|
|
1446 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1447 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1448 |
NULL, NULL, g_hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1454 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1455 |
} |
} |
1456 |
|
|
1457 |
|
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1458 |
|
|
1459 |
{ |
{ |
1460 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1461 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1490 |
} |
} |
1491 |
} |
} |
1492 |
|
|
1493 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1494 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1495 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1496 |
|
main_upload(hDlg, config); |
1497 |
break; |
break; |
1498 |
|
|
1499 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1500 |
{ |
{ |
1501 |
NMHDR * n = (NMHDR*)lParam; |
NMHDR * n = (NMHDR*)lParam; |
|
int idc = (int)wParam; |
|
1502 |
|
|
1503 |
if (n->code == NM_DBLCLK) { |
if (n->code == NM_DBLCLK) { |
1504 |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1540 |
} |
} |
1541 |
break; |
break; |
1542 |
|
|
1543 |
|
|
1544 |
|
case IDC_BITRATE_S : |
1545 |
|
/* alternate between bitrate/desired_length metrics */ |
1546 |
|
main_download(hDlg, config); |
1547 |
|
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1548 |
|
main_mode(hDlg, config); |
1549 |
|
main_upload(hDlg, config); |
1550 |
|
break; |
1551 |
|
|
1552 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_CALC : |
1553 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1554 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1555 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1556 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1557 |
break; |
break; |
1558 |
|
|
1561 |
int i, sel, new_frame; |
int i, sel, new_frame; |
1562 |
|
|
1563 |
if (config->num_zones >= MAX_ZONES) { |
if (config->num_zones >= MAX_ZONES) { |
1564 |
MessageBox(hDlg, "MAX_ZONES", "Warning", 0); |
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1565 |
break; |
break; |
1566 |
} |
} |
1567 |
|
|
1574 |
new_frame = config->ci.ciActiveFrame; |
new_frame = config->ci.ciActiveFrame; |
1575 |
}else{ |
}else{ |
1576 |
sel = config->num_zones-1; |
sel = config->num_zones-1; |
1577 |
new_frame = config->zones[sel].frame + 1; |
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1578 |
} |
} |
1579 |
}else{ |
}else{ |
1580 |
new_frame = config->zones[sel].frame + 1; |
new_frame = config->zones[sel].frame + 1; |
1581 |
} |
} |
1582 |
|
|
|
if (sel+1<config->num_zones && config->zones[sel+1].frame==new_frame) { |
|
|
MessageBox(hDlg, "CANT ADD HERE", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1583 |
for(i=config->num_zones-1; i>sel; i--) { |
for(i=config->num_zones-1; i>sel; i--) { |
1584 |
config->zones[i+1] = config->zones[i]; |
config->zones[i+1] = config->zones[i]; |
1585 |
} |
} |
1588 |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1589 |
config->zones[sel+1].weight = 100; |
config->zones[sel+1].weight = 100; |
1590 |
config->zones[sel+1].quant = 500; |
config->zones[sel+1].quant = 500; |
1591 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1592 |
config->zones[sel+1].greyscale = 0; |
config->zones[sel+1].greyscale = 0; |
1593 |
config->zones[sel+1].chroma_opt = 0; |
config->zones[sel+1].chroma_opt = 0; |
1594 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1609 |
break; |
break; |
1610 |
} |
} |
1611 |
|
|
|
if (sel == 0) { |
|
|
MessageBox(hDlg, "Can't remove first zone", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1612 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) { |
1613 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1614 |
} |
} |
1615 |
config->num_zones--; |
config->num_zones--; |
1616 |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
1617 |
|
|
|
|
|
1618 |
sel--; |
sel--; |
1619 |
if (sel==0 && config->num_zones>1) { |
if (sel==0 && config->num_zones>1) { |
1620 |
sel=1; |
sel=1; |
1654 |
} |
} |
1655 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1656 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1657 |
|
|
1658 |
|
main_download(hDlg, config); |
1659 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1660 |
|
main_upload(hDlg, config); |
1661 |
|
|
1662 |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1663 |
|
|
1664 |
|
if (g_use_bitrate) { |
1665 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1666 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1667 |
|
} |
1668 |
|
|
1669 |
}else { |
}else { |
1670 |
return 0; |
return 0; |
1671 |
} |
} |
1701 |
char core[100]; |
char core[100]; |
1702 |
HFONT hFont; |
HFONT hFont; |
1703 |
LOGFONT lfData; |
LOGFONT lfData; |
1704 |
|
HINSTANCE m_hdll; |
1705 |
|
|
1706 |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
SetDlgItemText(hDlg, IDC_BUILD, XVID_BUILD); |
1707 |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
SetDlgItemText(hDlg, IDC_SPECIAL_BUILD, XVID_SPECIAL_BUILD); |
1708 |
|
|
1709 |
memset(&info, 0, sizeof(info)); |
memset(&info, 0, sizeof(info)); |
1710 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1711 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
|
1712 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
m_hdll = LoadLibrary(XVID_DLL_NAME); |
1713 |
XVID_MAJOR(info.actual_version), |
if (m_hdll != NULL) { |
1714 |
XVID_MINOR(info.actual_version), |
|
1715 |
XVID_PATCH(info.actual_version), |
((int (__cdecl *)(void *, int, void *, void *))GetProcAddress(m_hdll, "xvid_global")) |
1716 |
|
(0, XVID_GBL_INFO, &info, NULL); |
1717 |
|
|
1718 |
|
wsprintf(core, "xvidcore.dll version %d.%d.%d (\"%s\")", |
1719 |
|
XVID_VERSION_MAJOR(info.actual_version), |
1720 |
|
XVID_VERSION_MINOR(info.actual_version), |
1721 |
|
XVID_VERSION_PATCH(info.actual_version), |
1722 |
info.build); |
info.build); |
1723 |
|
|
1724 |
|
FreeLibrary(m_hdll); |
1725 |
|
} else { |
1726 |
|
wsprintf(core, "xvidcore.dll not found!"); |
1727 |
|
} |
1728 |
|
|
1729 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |
1730 |
|
|
1731 |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
hFont = (HFONT)SendDlgItemMessage(hDlg, IDC_WEBSITE, WM_GETFONT, 0, 0L); |
1743 |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
SetDlgItemText(hDlg, IDC_WEBSITE, XVID_WEBSITE); |
1744 |
} |
} |
1745 |
break; |
break; |
|
|
|
1746 |
case WM_CTLCOLORSTATIC : |
case WM_CTLCOLORSTATIC : |
1747 |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
if ((HWND)lParam == GetDlgItem(hDlg, IDC_WEBSITE)) |
1748 |
{ |
{ |