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 |
|
|
147 |
static const REG_INT reg_ints[] = { |
static const REG_INT reg_ints[] = { |
148 |
{"mode", ®.mode, RC_MODE_1PASS}, |
{"mode", ®.mode, RC_MODE_1PASS}, |
149 |
{"bitrate", ®.bitrate, 700}, |
{"bitrate", ®.bitrate, 700}, |
150 |
|
{"desired_size", ®.desired_size, 570000}, |
151 |
|
{"use_2pass_bitrate", ®.use_2pass_bitrate, 0}, |
152 |
|
|
153 |
{"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}, |
|
154 |
{"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}, |
|
155 |
{"lum_masking", ®.lum_masking, 0}, |
{"lum_masking", ®.lum_masking, 0}, |
156 |
{"interlacing", ®.interlacing, 0}, |
{"interlacing", ®.interlacing, 0}, |
157 |
{"qpel", ®.qpel, 0}, |
{"qpel", ®.qpel, 0}, |
158 |
{"gmc", ®.gmc, 0}, |
{"gmc", ®.gmc, 0}, |
159 |
{"chromame", ®.chromame, 0}, |
{"reduced_resolution", ®.reduced_resolution, 0}, |
160 |
{"use_bvop", ®.use_bvop, 0}, |
{"use_bvop", ®.use_bvop, 0}, |
161 |
{"max_bframes", ®.max_bframes, 2}, |
{"max_bframes", ®.max_bframes, 2}, |
162 |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
{"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ |
163 |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
{"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ |
164 |
{"packed", ®.packed, 0}, |
{"packed", ®.packed, 0}, |
165 |
{"closed_gov", ®.closed_gov, 1}, |
{"closed_gov", ®.closed_gov, 1}, |
|
{"debug", ®.debug, 0}, |
|
|
{"reduced_resolution", ®.reduced_resolution, 0}, |
|
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
|
166 |
|
|
167 |
{"min_iquant", ®.min_iquant, 2}, |
/* zones */ |
168 |
{"max_iquant", ®.max_iquant, 31}, |
{"num_zones", ®.num_zones, 1}, |
|
{"min_pquant", ®.min_pquant, 2}, |
|
|
{"max_pquant", ®.max_pquant, 31}, |
|
|
{"min_bquant", ®.min_bquant, 2}, |
|
|
{"max_bquant", ®.max_bquant, 31}, |
|
|
{"trellis_quant", ®.trellis_quant, 0}, |
|
169 |
|
|
170 |
{"desired_size", ®.desired_size, 570000}, |
/* single pass */ |
171 |
{"keyframe_boost", ®.keyframe_boost, 0}, |
{"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, |
172 |
|
{"rc_averaging_period", ®.rc_averaging_period, 100}, |
173 |
|
{"rc_buffer", ®.rc_buffer, 100}, |
174 |
|
|
175 |
|
/* 2pass1 */ |
176 |
{"discard1pass", ®.discard1pass, 1}, |
{"discard1pass", ®.discard1pass, 1}, |
177 |
|
|
178 |
|
/* 2pass2 */ |
179 |
|
{"keyframe_boost", ®.keyframe_boost, 0}, |
180 |
{"kftreshold", ®.kftreshold, 10}, |
{"kftreshold", ®.kftreshold, 10}, |
181 |
{"kfreduction", ®.kfreduction, 20}, |
{"kfreduction", ®.kfreduction, 20}, |
182 |
{"curve_compression_high", ®.curve_compression_high, 0}, |
{"curve_compression_high", ®.curve_compression_high, 0}, |
183 |
{"curve_compression_low", ®.curve_compression_low, 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}, |
|
184 |
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
{"bitrate_payback_delay", ®.bitrate_payback_delay, 250}, |
185 |
{"bitrate_payback_method", ®.bitrate_payback_method, 0}, |
{"bitrate_payback_method", ®.bitrate_payback_method, XVID_PAYBACK_BIAS }, |
186 |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
{"twopass_max_overflow_improvement", ®.twopass_max_overflow_improvement, 60}, |
187 |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
{"twopass_max_overflow_degradation", ®.twopass_max_overflow_degradation, 60}, |
188 |
{"num_zones", ®.num_zones, 1}, |
|
189 |
|
/* motion */ |
190 |
|
{"motion_search", ®.motion_search, 6}, |
191 |
|
{"vhq_mode", ®.vhq_mode, 0}, |
192 |
|
{"chromame", ®.chromame, 0}, |
193 |
|
{"max_key_interval", ®.max_key_interval, 300}, |
194 |
|
{"min_key_interval", ®.min_key_interval, 1}, |
195 |
|
{"frame_drop_ratio", ®.frame_drop_ratio, 0}, |
196 |
|
|
197 |
|
/* quant */ |
198 |
|
{"min_iquant", ®.min_iquant, 2}, |
199 |
|
{"max_iquant", ®.max_iquant, 31}, |
200 |
|
{"min_pquant", ®.min_pquant, 2}, |
201 |
|
{"max_pquant", ®.max_pquant, 31}, |
202 |
|
{"min_bquant", ®.min_bquant, 2}, |
203 |
|
{"max_bquant", ®.max_bquant, 31}, |
204 |
|
{"trellis_quant", ®.trellis_quant, 0}, |
205 |
|
|
206 |
|
/* debug */ |
207 |
|
{"fourcc_used", ®.fourcc_used, 0}, |
208 |
|
{"debug", ®.debug, 0x0}, |
209 |
|
{"vop_debug", ®.vop_debug, 0}, |
210 |
|
{"display_status", ®.display_status, 1}, |
211 |
}; |
}; |
212 |
|
|
213 |
static const REG_STR reg_strs[] = { |
static const REG_STR reg_strs[] = { |
439 |
} |
} |
440 |
|
|
441 |
|
|
442 |
|
#define HEX_BUF_SZ 16 |
443 |
|
unsigned int get_dlgitem_hex(HWND hDlg, UINT item, unsigned int def) |
444 |
|
{ |
445 |
|
char buf[HEX_BUF_SZ]; |
446 |
|
unsigned int value; |
447 |
|
|
448 |
|
if (GetDlgItemText(hDlg, item, buf, HEX_BUF_SZ) == 0) |
449 |
|
return def; |
450 |
|
|
451 |
|
if (sscanf(buf,"0x%x", &value)==1 || sscanf(buf,"%x", &value)==1) { |
452 |
|
return value; |
453 |
|
} |
454 |
|
|
455 |
|
return def; |
456 |
|
} |
457 |
|
|
458 |
|
void set_dlgitem_hex(HWND hDlg, UINT item, int value) |
459 |
|
{ |
460 |
|
char buf[HEX_BUF_SZ]; |
461 |
|
wsprintf(buf, "0x%x", value); |
462 |
|
SetDlgItemText(hDlg, item, buf); |
463 |
|
} |
464 |
|
|
465 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
466 |
/* QUANT MATRIX DIALOG ================================================================= */ |
/* QUANT MATRIX DIALOG ================================================================= */ |
467 |
/* ===================================================================================== */ |
/* ===================================================================================== */ |
630 |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); |
631 |
break; |
break; |
632 |
|
|
|
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; |
|
|
|
|
633 |
case IDD_ZONE : |
case IDD_ZONE : |
634 |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
EnableDlgWindow(hDlg, IDC_ZONE_FETCH, |
635 |
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); |
669 |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
void adv_mode(HWND hDlg, int idd, CONFIG * config) |
670 |
{ |
{ |
671 |
int profile; |
int profile; |
|
int use_alt, use_alt_auto, use_alt_auto_bonus; |
|
672 |
int weight_en, quant_en; |
int weight_en, quant_en; |
673 |
int cpu_force; |
int cpu_force; |
674 |
int custom_quant, bvops; |
int custom_quant, bvops; |
710 |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); |
711 |
break; |
break; |
712 |
|
|
|
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; |
|
|
|
|
713 |
case IDD_ZONE : |
case IDD_ZONE : |
714 |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); |
715 |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); |
797 |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); |
798 |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); |
799 |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, FALSE); |
800 |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == 0)); |
CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == XVID_PAYBACK_BIAS)); |
801 |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == 1)); |
CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == XVID_PAYBACK_PROP)); |
|
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); |
|
802 |
break; |
break; |
803 |
|
|
804 |
case IDD_ZONE : |
case IDD_ZONE : |
850 |
|
|
851 |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); |
852 |
|
|
|
CheckDlg(hDlg, IDC_DEBUG, config->debug); |
|
853 |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); |
854 |
|
set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
855 |
|
CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); |
856 |
|
CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); |
857 |
break; |
break; |
858 |
} |
} |
859 |
} |
} |
915 |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, NULL, FALSE); |
916 |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
config->curve_compression_low = GetDlgItemInt(hDlg, IDC_CURVECOMPL, NULL, FALSE); |
917 |
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
config->bitrate_payback_delay = config_get_uint(hDlg, IDC_PAYBACK, config->bitrate_payback_delay); |
918 |
config->bitrate_payback_method = IsDlgChecked(hDlg, IDC_PAYBACKPROP); |
config->bitrate_payback_method = IsDlgChecked(hDlg, IDC_PAYBACKPROP) ? XVID_PAYBACK_PROP : XVID_PAYBACK_BIAS; |
919 |
|
|
920 |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
CONSTRAINVAL(config->bitrate_payback_delay, 1, 10000); |
921 |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
CONSTRAINVAL(config->keyframe_boost, 0, 1000); |
923 |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
CONSTRAINVAL(config->curve_compression_low, 0, 100); |
924 |
break; |
break; |
925 |
|
|
|
case IDD_RC_2PASS2_ALT : |
|
|
config->use_alt_curve = IsDlgChecked(hDlg, IDC_USEALT); |
|
|
|
|
|
config->alt_curve_use_auto = IsDlgChecked(hDlg, IDC_USEAUTO); |
|
|
config->alt_curve_auto_str = config_get_uint(hDlg, IDC_AUTOSTR, config->alt_curve_auto_str); |
|
|
|
|
|
config->alt_curve_use_auto_bonus_bias = IsDlgChecked(hDlg, IDC_USEAUTOBONUS); |
|
|
config->alt_curve_bonus_bias = config_get_uint(hDlg, IDC_BONUSBIAS, config->alt_curve_bonus_bias); |
|
|
|
|
|
config->alt_curve_type = SendDlgItemMessage(hDlg, IDC_CURVETYPE, CB_GETCURSEL, 0, 0); |
|
|
config->alt_curve_high_dist = config_get_uint(hDlg, IDC_ALTCURVEHIGH, config->alt_curve_high_dist); |
|
|
config->alt_curve_low_dist = config_get_uint(hDlg, IDC_ALTCURVELOW, config->alt_curve_low_dist); |
|
|
config->alt_curve_min_rel_qual = config_get_uint(hDlg, IDC_MINQUAL, config->alt_curve_min_rel_qual); |
|
|
break; |
|
|
|
|
926 |
case IDD_ZONE : |
case IDD_ZONE : |
927 |
config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); |
config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); |
928 |
|
|
983 |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); |
984 |
|
|
985 |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); |
986 |
config->debug = IsDlgChecked(hDlg, IDC_DEBUG); |
config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); |
987 |
|
config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); |
988 |
|
config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); |
989 |
break; |
break; |
990 |
} |
} |
991 |
} |
} |
1018 |
switch (LOWORD(wParam)) |
switch (LOWORD(wParam)) |
1019 |
{ |
{ |
1020 |
case IDC_BVOP : |
case IDC_BVOP : |
|
case IDC_USEALT : |
|
|
case IDC_USEAUTO : |
|
|
case IDC_USEAUTOBONUS : |
|
1021 |
case IDC_ZONE_MODE_WEIGHT : |
case IDC_ZONE_MODE_WEIGHT : |
1022 |
case IDC_ZONE_MODE_QUANT : |
case IDC_ZONE_MODE_QUANT : |
1023 |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
case IDC_ZONE_BVOPTHRESHOLD_ENABLE : |
1216 |
ListView_SetItemText(hDlg, i, 2, tmp); |
ListView_SetItemText(hDlg, i, 2, tmp); |
1217 |
} |
} |
1218 |
|
|
1219 |
|
static int g_use_bitrate = 1; |
1220 |
|
|
1221 |
void main_mode(HWND hDlg, CONFIG * config) |
void main_mode(HWND hDlg, CONFIG * config) |
1222 |
{ |
{ |
1223 |
|
const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1224 |
|
const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1225 |
|
/* enable target rate/size control only for 1pass and 2pass modes*/ |
1226 |
|
const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; |
1227 |
|
|
1228 |
char buf[16]; |
char buf[16]; |
|
int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
|
|
int bitrate_en; |
|
1229 |
int max; |
int max; |
1230 |
|
|
1231 |
|
g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; |
1232 |
|
|
1233 |
|
if (g_use_bitrate) { |
1234 |
|
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); |
1235 |
|
|
1236 |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); |
1237 |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); |
1238 |
|
|
1245 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1246 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1247 |
|
|
1248 |
bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
}else{ |
1249 |
bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; |
SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); |
1250 |
|
} |
1251 |
|
|
1252 |
EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); |
1253 |
EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE, target_en); |
1254 |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, bitrate_en); |
|
1255 |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); |
1256 |
EnableDlgWindow(hDlg, IDC_SLIDER, bitrate_en); |
EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); |
1257 |
|
EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); |
1258 |
} |
} |
1259 |
|
|
1260 |
|
|
1261 |
|
|
1262 |
void main_upload(HWND hDlg, CONFIG * config) |
void main_upload(HWND hDlg, CONFIG * config) |
1263 |
{ |
{ |
1264 |
int i; |
int i; |
1265 |
|
|
1266 |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); |
1267 |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); |
1268 |
|
|
1269 |
|
if (g_use_bitrate) { |
1270 |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); |
1271 |
|
}else{ |
1272 |
|
SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); |
1273 |
|
} |
1274 |
|
|
1275 |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); |
1276 |
for (i=0; i < config->num_zones; i++) { |
for (i=0; i < config->num_zones; i++) { |
1284 |
{ |
{ |
1285 |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); |
1286 |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); |
1287 |
|
|
1288 |
|
if (g_use_bitrate) { |
1289 |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); |
1290 |
|
}else{ |
1291 |
|
config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); |
1292 |
|
} |
1293 |
} |
} |
|
|
|
|
|
|
1294 |
|
|
1295 |
|
|
1296 |
/* main dialog proc */ |
/* main dialog proc */ |
1298 |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; |
1299 |
static const int single_dlgs[] = { IDD_RC_CBR }; |
static const int single_dlgs[] = { IDD_RC_CBR }; |
1300 |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; |
1301 |
static const int pass2_dlgs[] = { IDD_RC_2PASS2, IDD_RC_2PASS2_ALT}; |
static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; |
1302 |
static const int zone_dlgs[] = { IDD_ZONE }; |
static const int zone_dlgs[] = { IDD_ZONE }; |
1303 |
static const int bitrate_dlgs[] = { IDD_CALC }; |
static const int bitrate_dlgs[] = { IDD_CALC }; |
1304 |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; |
1327 |
|
|
1328 |
InitCommonControls(); |
InitCommonControls(); |
1329 |
|
|
|
|
|
1330 |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, |
1331 |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
1332 |
NULL, NULL, g_hInst, NULL))) |
NULL, NULL, g_hInst, NULL))) |
1338 |
EnumChildWindows(hDlg, enum_tooltips, 0); |
EnumChildWindows(hDlg, enum_tooltips, 0); |
1339 |
} |
} |
1340 |
|
|
1341 |
|
SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); |
1342 |
|
|
1343 |
{ |
{ |
1344 |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); |
1345 |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; |
1360 |
LVCOLUMN lvc; |
LVCOLUMN lvc; |
1361 |
int i; |
int i; |
1362 |
|
|
1363 |
// Initialize the LVCOLUMN structure. |
/* Initialize the LVCOLUMN structure. */ |
1364 |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; |
1365 |
lvc.fmt = LVCFMT_LEFT; |
lvc.fmt = LVCFMT_LEFT; |
1366 |
|
|
1367 |
// Add the columns. |
/* Add the columns. */ |
1368 |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
for (i=0; i<sizeof(columns)/sizeof(char_int_t); i++) { |
1369 |
lvc.pszText = (char*)columns[i].name; |
lvc.pszText = (char*)columns[i].name; |
1370 |
lvc.cchTextMax = strlen(columns[i].name); |
lvc.cchTextMax = strlen(columns[i].name); |
1374 |
} |
} |
1375 |
} |
} |
1376 |
|
|
1377 |
|
/* XXX: main_mode needs RC_MODE_xxx, main_upload needs g_use_bitrate set correctly... */ |
1378 |
main_upload(hDlg, config); |
main_upload(hDlg, config); |
1379 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1380 |
|
main_upload(hDlg, config); |
1381 |
break; |
break; |
1382 |
|
|
1383 |
case WM_NOTIFY : |
case WM_NOTIFY : |
1425 |
} |
} |
1426 |
break; |
break; |
1427 |
|
|
1428 |
|
|
1429 |
|
case IDC_BITRATE_S : |
1430 |
|
/* alternate between bitrate/desired_length metrics */ |
1431 |
|
main_download(hDlg, config); |
1432 |
|
config->use_2pass_bitrate = !config->use_2pass_bitrate; |
1433 |
|
main_mode(hDlg, config); |
1434 |
|
main_upload(hDlg, config); |
1435 |
|
break; |
1436 |
|
|
1437 |
case IDC_BITRATE_CALC : |
case IDC_BITRATE_CALC : |
1438 |
main_download(hDlg, config); |
main_download(hDlg, config); |
1439 |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); |
1549 |
} |
} |
1550 |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
}else if (HIWORD(wParam) == LBN_SELCHANGE && |
1551 |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
(LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { |
1552 |
|
|
1553 |
|
main_download(hDlg, config); |
1554 |
main_mode(hDlg, config); |
main_mode(hDlg, config); |
1555 |
|
main_upload(hDlg, config); |
1556 |
|
|
1557 |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
}else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { |
1558 |
|
|
1559 |
|
if (g_use_bitrate) { |
1560 |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, |
1561 |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); |
1562 |
|
} |
1563 |
|
|
1564 |
}else { |
}else { |
1565 |
return 0; |
return 0; |
1566 |
} |
} |