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 |
|
|
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 |
{ "(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 }, |
140 |
}; |
}; |
141 |
|
|
150 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
151 |
{"mode", ®.mode, RC_MODE_1PASS}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
152 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
153 |
|
{"desired_size", ®.desired_size, 570000}, |
154 |
|
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
155 |
|
|
156 |
{"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}, |
|
157 |
{"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}, |
|
158 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
159 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
160 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
161 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
162 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
163 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 0}, |
164 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
165 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
166 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
167 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 0}, |
168 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
169 |
{"debug", ®.debug, 0}, |
{"aspect_ratio", ®.display_aspect_ratio, 0}, |
170 |
{"reduced_resolution", ®.reduced_resolution, 0}, |
|
171 |
|
/* zones */ |
172 |
|
{"num_zones", ®.num_zones, 1}, |
173 |
|
|
174 |
|
/* single pass */ |
175 |
|
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
176 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
177 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
178 |
|
|
179 |
|
/* 2pass1 */ |
180 |
|
{"discard1pass", ®.discard1pass, 1}, |
181 |
|
|
182 |
|
/* 2pass2 */ |
183 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
184 |
|
{"kfreduction", ®.kfreduction, 20}, |
185 |
|
{"kfthreshold", ®.kfthreshold, 1}, |
186 |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
187 |
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
188 |
|
{"overflow_control_strength", ®.overflow_control_strength, 5}, |
189 |
|
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 5}, |
190 |
|
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 5}, |
191 |
|
|
192 |
|
/* motion */ |
193 |
|
{"motion_search", ®.motion_search, 6}, |
194 |
|
{"vhq_mode", ®.vhq_mode, 0}, |
195 |
|
{"chromame", ®.chromame, 0}, |
196 |
|
{"cartoon_mode", ®.cartoon_mode, 0}, |
197 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
198 |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
199 |
|
|
200 |
|
/* quant */ |
201 |
{"min_iquant", ®.min_iquant, 2}, |
{"min_iquant", ®.min_iquant, 2}, |
202 |
{"max_iquant", ®.max_iquant, 31}, |
{"max_iquant", ®.max_iquant, 31}, |
203 |
{"min_pquant", ®.min_pquant, 2}, |
{"min_pquant", ®.min_pquant, 2}, |
206 |
{"max_bquant", ®.max_bquant, 31}, |
{"max_bquant", ®.max_bquant, 31}, |
207 |
{"trellis_quant", ®.trellis_quant, 0}, |
{"trellis_quant", ®.trellis_quant, 0}, |
208 |
|
|
209 |
{"desired_size", ®.desired_size, 570000}, |
/* debug */ |
210 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"fourcc_used", ®.fourcc_used, 0}, |
211 |
{"discard1pass", ®.discard1pass, 1}, |
{"debug", ®.debug, 0x0}, |
212 |
{"kftreshold", ®.kftreshold, 10}, |
{"vop_debug", ®.vop_debug, 0}, |
213 |
{"kfreduction", ®.kfreduction, 20}, |
{"display_status", ®.display_status, 1}, |
|
{"curve_compression_high", ®.curve_compression_high, 0}, |
|
|
{"curve_compression_low", ®.curve_compression_low, 0}, |
|
|
{"use_alt_curve", ®.use_alt_curve, 0}, |
|
|
{"alt_curve_use_auto", ®.alt_curve_use_auto, 1}, |
|
|
{"alt_curve_auto_str", ®.alt_curve_auto_str, 30}, |
|
|
{"alt_curve_use_auto_bonus_bias", ®.alt_curve_use_auto_bonus_bias, 1}, |
|
|
{"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}, |
|
214 |
}; |
}; |
215 |
|
|
216 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
225 |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
{"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, |
226 |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
{"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ |
227 |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
{"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ |
228 |
|
{"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, |
229 |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
{"zone%i_greyscale", &stmp.greyscale, 0}, |
230 |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
{"zone%i_chroma_opt", &stmp.chroma_opt, 0}, |
231 |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
{"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, |
443 |
} |
} |
444 |
|
|
445 |
|
|
446 |
|
#define HEX_BUF_SZ 16 |
447 |
|
unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
448 |
|
{ |
449 |
|
char buf[HEX_BUF_SZ]; |
450 |
|
unsigned int value; |
451 |
|
|
452 |
|
if (GetDlgItemText(hDlg, item, buf, HEX_BUF_SZ) == 0) |
453 |
|
return def; |
454 |
|
|
455 |
|
if (sscanf(buf,"0x%x", &value)==1 || sscanf(buf,"%x", &value)==1) { |
456 |
|
return value; |
457 |
|
} |
458 |
|
|
459 |
|
return def; |
460 |
|
} |
461 |
|
|
462 |
|
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
463 |
|
{ |
464 |
|
char buf[HEX_BUF_SZ]; |
465 |
|
wsprintf(buf, "0x%x", value); |
466 |
|
SetDlgItemText(hDlg, item, buf); |
467 |
|
} |
468 |
|
|
469 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
470 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
471 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
627 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"H.263"); |
628 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG"); |
629 |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_ADDSTRING, 0, (LPARAM)"MPEG-Custom"); |
630 |
|
|
631 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"1:1 (Default)"); |
632 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"4:3 (Anamorph)"); |
633 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"16:9 (Anamorph)"); |
634 |
|
/* reserved for future use if acceptance is there for DAR */ |
635 |
|
#if 0 |
636 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_ADDSTRING, 0, (LPARAM)"Custom"); |
637 |
|
#endif |
638 |
break; |
break; |
639 |
|
|
640 |
case IDD_LEVEL : |
case IDD_LEVEL : |
642 |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
643 |
break; |
break; |
644 |
|
|
|
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; |
|
|
|
|
645 |
case IDD_ZONE : |
case IDD_ZONE : |
646 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); |
|
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
|
647 |
break; |
break; |
648 |
|
|
649 |
case IDD_MOTION : |
case IDD_MOTION : |
680 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
681 |
{ |
{ |
682 |
int profile; |
int profile; |
|
int use_alt, use_alt_auto, use_alt_auto_bonus; |
|
683 |
int weight_en, quant_en; |
int weight_en, quant_en; |
684 |
int cpu_force; |
int cpu_force; |
685 |
int custom_quant, bvops; |
int custom_quant, bvops; |
721 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
722 |
break; |
break; |
723 |
|
|
|
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; |
|
|
|
|
724 |
case IDD_ZONE : |
case IDD_ZONE : |
725 |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
726 |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
779 |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
set_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
780 |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
CheckDlg(hDlg, IDC_PACKED, config->packed); |
781 |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
CheckDlg(hDlg, IDC_CLOSEDGOV, config->closed_gov); |
782 |
|
SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_SETCURSEL, (config->display_aspect_ratio), 0); |
783 |
break; |
break; |
784 |
|
|
785 |
case IDD_LEVEL : |
case IDD_LEVEL : |
800 |
case IDD_RC_2PASS2 : |
case IDD_RC_2PASS2 : |
801 |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
SetDlgItemText(hDlg, IDC_STATS, config->stats); |
802 |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
SetDlgItemInt(hDlg, IDC_KFBOOST, config->keyframe_boost, FALSE); |
|
SetDlgItemInt(hDlg, IDC_KFTRESHOLD, config->kftreshold, FALSE); |
|
803 |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
SetDlgItemInt(hDlg, IDC_KFREDUCTION, config->kfreduction, FALSE); |
804 |
|
|
805 |
|
SetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, config->overflow_control_strength, FALSE); |
806 |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERIMP, config->twopass_max_overflow_improvement, FALSE); |
807 |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
SetDlgItemInt(hDlg, IDC_OVERDEG, config->twopass_max_overflow_degradation, FALSE); |
808 |
|
|
809 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
810 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
811 |
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); |
|
812 |
break; |
break; |
813 |
|
|
814 |
case IDD_ZONE : |
case IDD_ZONE : |
815 |
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); |
|
816 |
|
|
817 |
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); |
818 |
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); |
820 |
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); |
821 |
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); |
822 |
|
|
823 |
|
CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); |
824 |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); |
825 |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); |
826 |
|
|
831 |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
SendDlgItemMessage(hDlg, IDC_MOTION, CB_SETCURSEL, config->motion_search, 0); |
832 |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
SendDlgItemMessage(hDlg, IDC_VHQ, CB_SETCURSEL, config->vhq_mode, 0); |
833 |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
CheckDlg(hDlg, IDC_CHROMAME, config->chromame); |
834 |
|
CheckDlg(hDlg, IDC_CARTOON, config->cartoon_mode); |
835 |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
SetDlgItemInt(hDlg, IDC_FRAMEDROP, config->frame_drop_ratio, FALSE); |
836 |
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); |
|
837 |
break; |
break; |
838 |
|
|
839 |
case IDD_QUANT : |
case IDD_QUANT : |
859 |
|
|
860 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
861 |
|
|
|
CheckDlg(hDlg, IDC_DEBUG, config->debug); |
|
862 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
863 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
864 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
865 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
866 |
break; |
break; |
867 |
} |
} |
868 |
} |
} |
890 |
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
config->bquant_offset = get_dlgitem_float(hDlg, IDC_BQUANTOFFSET, config->bquant_offset); |
891 |
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
config->packed = IsDlgChecked(hDlg, IDC_PACKED); |
892 |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
config->closed_gov = IsDlgChecked(hDlg, IDC_CLOSEDGOV); |
893 |
|
config->display_aspect_ratio = SendDlgItemMessage(hDlg, IDC_ASPECT_RATIO, CB_GETCURSEL, 0, 0); |
894 |
break; |
break; |
895 |
|
|
896 |
case IDD_LEVEL : |
case IDD_LEVEL : |
914 |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
lstrcpy(config->stats, CONFIG_2PASS_FILE); |
915 |
|
|
916 |
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); |
|
917 |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
config->kfreduction = GetDlgItemInt(hDlg, IDC_KFREDUCTION, NULL, FALSE); |
918 |
|
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
919 |
|
|
920 |
|
config->overflow_control_strength = GetDlgItemInt(hDlg, IDC_OVERFLOW_CONTROL_STRENGTH, NULL, FALSE); |
921 |
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); |
922 |
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); |
923 |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_improvement, 1, 80); |
924 |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
CONSTRAINVAL(config->twopass_max_overflow_degradation, 1, 80); |
925 |
|
CONSTRAINVAL(config->overflow_control_strength, 0, 100); |
926 |
|
|
927 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
928 |
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); |
|
929 |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
CONSTRAINVAL(config->curve_compression_high, 0, 100); |
930 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
|
break; |
|
|
|
|
|
case IDD_RC_2PASS2_ALT : |
|
|
config->use_alt_curve = IsDlgChecked(hDlg, IDC_USEALT); |
|
931 |
|
|
932 |
config->alt_curve_use_auto = IsDlgChecked(hDlg, IDC_USEAUTO); |
config->kfthreshold = config_get_uint(hDlg, IDC_MINKEY, config->kfthreshold); |
|
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
|
933 |
|
|
|
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); |
|
934 |
break; |
break; |
935 |
|
|
936 |
case IDD_ZONE : |
case IDD_ZONE : |
945 |
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); |
946 |
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); |
947 |
|
|
948 |
|
config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; |
949 |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); |
950 |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); |
951 |
|
|
956 |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
config->motion_search = SendDlgItemMessage(hDlg, IDC_MOTION, CB_GETCURSEL, 0, 0); |
957 |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
config->vhq_mode = SendDlgItemMessage(hDlg, IDC_VHQ, CB_GETCURSEL, 0, 0); |
958 |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
config->chromame = IsDlgChecked(hDlg, IDC_CHROMAME); |
959 |
|
config->cartoon_mode = IsDlgChecked(hDlg, IDC_CARTOON); |
960 |
|
|
961 |
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); |
962 |
|
|
963 |
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); |
|
964 |
break; |
break; |
965 |
|
|
966 |
case IDD_QUANT : |
case IDD_QUANT : |
994 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
995 |
|
|
996 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
997 |
config->debug = IsDlgChecked(hDlg, IDC_DEBUG); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
998 |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
999 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
1000 |
break; |
break; |
1001 |
} |
} |
1002 |
} |
} |
1029 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1030 |
{ |
{ |
1031 |
case IDC_BVOP : |
case IDC_BVOP : |
|
case IDC_USEALT : |
|
|
case IDC_USEAUTO : |
|
|
case IDC_USEAUTOBONUS : |
|
1032 |
case IDC_ZONE_MODE_WEIGHT : |
case IDC_ZONE_MODE_WEIGHT : |
1033 |
case IDC_ZONE_MODE_QUANT : |
case IDC_ZONE_MODE_QUANT : |
1034 |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1218 |
ListView_SetItemText(hDlg, i, 1, tmp); |
ListView_SetItemText(hDlg, i, 1, tmp); |
1219 |
|
|
1220 |
tmp[0] = '\0'; |
tmp[0] = '\0'; |
1221 |
|
if (s->type==XVID_TYPE_IVOP) |
1222 |
|
strcat(tmp, "K "); |
1223 |
|
|
1224 |
if (s->greyscale) |
if (s->greyscale) |
1225 |
strcat(tmp, "G "); |
strcat(tmp, "G "); |
1226 |
|
|
1230 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1231 |
} |
} |
1232 |
|
|
1233 |
|
static int g_use_bitrate = 1; |
1234 |
|
|
1235 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1236 |
{ |
{ |
1237 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1238 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1239 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1240 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1241 |
|
|
1242 |
char buf[16]; |
char buf[16]; |
|
int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
int bitrate_en; |
|
1243 |
int max; |
int max; |
1244 |
|
|
1245 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1246 |
|
|
1247 |
|
if (g_use_bitrate) { |
1248 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1249 |
|
|
1250 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1251 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1252 |
|
|
1259 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1260 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1261 |
|
|
1262 |
bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
}else{ |
1263 |
bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1264 |
|
} |
1265 |
|
|
1266 |
|
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1267 |
|
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1268 |
|
|
1269 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1270 |
EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1271 |
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); |
|
1272 |
} |
} |
1273 |
|
|
1274 |
|
|
1275 |
|
|
1276 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1277 |
{ |
{ |
1278 |
int i; |
int i; |
1279 |
|
|
1280 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1281 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1282 |
|
|
1283 |
|
if (g_use_bitrate) { |
1284 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1285 |
|
}else{ |
1286 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1287 |
|
} |
1288 |
|
|
1289 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1290 |
for (i=0; i < config->num_zones; i++) { |
for (i=0; i < config->num_zones; i++) { |
1298 |
{ |
{ |
1299 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1300 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1301 |
|
|
1302 |
|
if (g_use_bitrate) { |
1303 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1304 |
|
}else{ |
1305 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1306 |
|
} |
1307 |
} |
} |
|
|
|
|
|
|
1308 |
|
|
1309 |
|
|
1310 |
/* main dialog proc */ |
/* main dialog proc */ |
1312 |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
1313 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1314 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1315 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2, IDD_RC_2PASS2_ALT}; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1316 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1317 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int bitrate_dlgs[] = { IDD_CALC }; |
1318 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1341 |
|
|
1342 |
InitCommonControls(); |
InitCommonControls(); |
1343 |
|
|
|
|
|
1344 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1345 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1346 |
NULL, NULL, g_hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1352 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1353 |
} |
} |
1354 |
|
|
1355 |
|
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1356 |
|
|
1357 |
{ |
{ |
1358 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1359 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1374 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1375 |
int i; |
int i; |
1376 |
|
|
1377 |
// Initialize the LVCOLUMN structure. |
/* Initialize the LVCOLUMN structure. */ |
1378 |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
1379 |
lvc.fmt = LVCFMT_LEFT; |
lvc.fmt = LVCFMT_LEFT; |
1380 |
|
|
1381 |
// Add the columns. |
/* Add the columns. */ |
1382 |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
1383 |
lvc.pszText = (char*)columns[i].name; |
lvc.pszText = (char*)columns[i].name; |
1384 |
lvc.cchTextMax = strlen(columns[i].name); |
lvc.cchTextMax = strlen(columns[i].name); |
1388 |
} |
} |
1389 |
} |
} |
1390 |
|
|
1391 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1392 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1393 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1394 |
|
main_upload(hDlg, config); |
1395 |
break; |
break; |
1396 |
|
|
1397 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1398 |
{ |
{ |
1399 |
NMHDR * n = (NMHDR*)lParam; |
NMHDR * n = (NMHDR*)lParam; |
|
int idc = (int)wParam; |
|
1400 |
|
|
1401 |
if (n->code == NM_DBLCLK) { |
if (n->code == NM_DBLCLK) { |
1402 |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
NMLISTVIEW * nmlv = (NMLISTVIEW*) lParam; |
1438 |
} |
} |
1439 |
break; |
break; |
1440 |
|
|
1441 |
|
|
1442 |
|
case IDC_BITRATE_S : |
1443 |
|
/* alternate between bitrate/desired_length metrics */ |
1444 |
|
main_download(hDlg, config); |
1445 |
|
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1446 |
|
main_mode(hDlg, config); |
1447 |
|
main_upload(hDlg, config); |
1448 |
|
break; |
1449 |
|
|
1450 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_CALC : |
1451 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1452 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1453 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
//SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1454 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1455 |
break; |
break; |
1456 |
|
|
1459 |
int i, sel, new_frame; |
int i, sel, new_frame; |
1460 |
|
|
1461 |
if (config->num_zones >= MAX_ZONES) { |
if (config->num_zones >= MAX_ZONES) { |
1462 |
MessageBox(hDlg, "MAX_ZONES", "Warning", 0); |
MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); |
1463 |
break; |
break; |
1464 |
} |
} |
1465 |
|
|
1472 |
new_frame = config->ci.ciActiveFrame; |
new_frame = config->ci.ciActiveFrame; |
1473 |
}else{ |
}else{ |
1474 |
sel = config->num_zones-1; |
sel = config->num_zones-1; |
1475 |
new_frame = config->zones[sel].frame + 1; |
new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; |
1476 |
} |
} |
1477 |
}else{ |
}else{ |
1478 |
new_frame = config->zones[sel].frame + 1; |
new_frame = config->zones[sel].frame + 1; |
1479 |
} |
} |
1480 |
|
|
|
if (sel+1<config->num_zones && config->zones[sel+1].frame==new_frame) { |
|
|
MessageBox(hDlg, "CANT ADD HERE", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1481 |
for(i=config->num_zones-1; i>sel; i--) { |
for(i=config->num_zones-1; i>sel; i--) { |
1482 |
config->zones[i+1] = config->zones[i]; |
config->zones[i+1] = config->zones[i]; |
1483 |
} |
} |
1486 |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
config->zones[sel+1].mode = RC_ZONE_WEIGHT; |
1487 |
config->zones[sel+1].weight = 100; |
config->zones[sel+1].weight = 100; |
1488 |
config->zones[sel+1].quant = 500; |
config->zones[sel+1].quant = 500; |
1489 |
|
config->zones[sel+1].type = XVID_TYPE_AUTO; |
1490 |
config->zones[sel+1].greyscale = 0; |
config->zones[sel+1].greyscale = 0; |
1491 |
config->zones[sel+1].chroma_opt = 0; |
config->zones[sel+1].chroma_opt = 0; |
1492 |
config->zones[sel+1].bvop_threshold = 0; |
config->zones[sel+1].bvop_threshold = 0; |
1507 |
break; |
break; |
1508 |
} |
} |
1509 |
|
|
|
if (sel == 0) { |
|
|
MessageBox(hDlg, "Can't remove first zone", "Warning", 0); |
|
|
break; |
|
|
} |
|
|
|
|
1510 |
for (i=sel; i<config->num_zones-1; i++) { |
for (i=sel; i<config->num_zones-1; i++) { |
1511 |
config->zones[i] = config->zones[i+1]; |
config->zones[i] = config->zones[i+1]; |
1512 |
} |
} |
1513 |
config->num_zones--; |
config->num_zones--; |
1514 |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); |
1515 |
|
|
|
|
|
1516 |
sel--; |
sel--; |
1517 |
if (sel==0 && config->num_zones>1) { |
if (sel==0 && config->num_zones>1) { |
1518 |
sel=1; |
sel=1; |
1552 |
} |
} |
1553 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1554 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1555 |
|
|
1556 |
|
main_download(hDlg, config); |
1557 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1558 |
|
main_upload(hDlg, config); |
1559 |
|
|
1560 |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1561 |
|
|
1562 |
|
if (g_use_bitrate) { |
1563 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1564 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1565 |
|
} |
1566 |
|
|
1567 |
}else { |
}else { |
1568 |
return 0; |
return 0; |
1569 |
} |
} |
1607 |
info.version = XVID_VERSION; |
info.version = XVID_VERSION; |
1608 |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
xvid_global(0, XVID_GBL_INFO, &info, NULL); |
1609 |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
wsprintf(core, "libxvidcore version %d.%d.%d (\"%s\")", |
1610 |
XVID_MAJOR(info.actual_version), |
XVID_VERSION_MAJOR(info.actual_version), |
1611 |
XVID_MINOR(info.actual_version), |
XVID_VERSION_MINOR(info.actual_version), |
1612 |
XVID_PATCH(info.actual_version), |
XVID_VERSION_PATCH(info.actual_version), |
1613 |
info.build); |
info.build); |
1614 |
|
|
1615 |
SetDlgItemText(hDlg, IDC_CORE, core); |
SetDlgItemText(hDlg, IDC_CORE, core); |