--- branches/dev-api-4/xvidcore/vfw/src/config.c 2003/05/17 13:37:49 1032 +++ branches/dev-api-4/xvidcore/vfw/src/config.c 2003/06/13 11:52:14 1069 @@ -60,11 +60,10 @@ #include #include -#include // sprintf -#include // XviD API +#include /* sprintf */ +#include /* XviD API */ #include "debug.h" -#include "codec.h" #include "config.h" #include "resource.h" @@ -111,6 +110,7 @@ { "Simple @ L0", 0x08, 176, 144, 15, 1, 198, 99, 1485, 100, 10*16368, 2048, 64, 0 }, /* simple@l0: max f_code=1, intra_dc_vlc_threshold=0 /* if ac preidition is used, adaptive quantization must not be used */ + /* <=qcif must be used */ { "Simple @ L1", 0x01, 176, 144, 15, 4, 198, 99, 1485, 100, 10*16368, 2048, 64, PROFILE_ADAPTQUANT }, { "Simple @ L2", 0x02, 352, 288, 15, 4, 792, 396, 5940, 100, 40*16368, 4096, 128, PROFILE_ADAPTQUANT }, { "Simple @ L3", 0x03, 352, 288, 15, 4, 792, 396, 11880, 100, 40*16368, 8192, 384, PROFILE_ADAPTQUANT }, @@ -124,6 +124,7 @@ { "AS @ L1", 0xf1, 176, 144, 30, 4, 297, 99, 2970, 100, 10*16368, 2048, 128, PROFILE_AS }, { "AS @ L2", 0xf2, 352, 288, 15, 4, 1188, 396, 5940, 100, 40*16368, 4096, 384, PROFILE_AS }, { "AS @ L3", 0xf3, 352, 288, 30, 4, 1188, 396, 11880, 100, 40*16368, 4096, 768, PROFILE_AS }, + /* ISMA Profile 1, (ASP) @ L3b (CIF, 1.5 Mb/s) CIF(352x288), 30fps, 1.5Mbps max ??? */ { "AS @ L4", 0xf4, 352, 576, 30, 4, 2376, 792, 23760, 50, 80*16368, 8192, 3000, PROFILE_AS }, { "AS @ L5", 0xf5, 720, 576, 30, 4, 4860, 1620, 48600, 25, 112*16368, 16384, 8000, PROFILE_AS }, @@ -148,62 +149,67 @@ static const REG_INT reg_ints[] = { {"mode", ®.mode, RC_MODE_1PASS}, {"bitrate", ®.bitrate, 700}, + {"desired_size", ®.desired_size, 570000}, + {"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}, - - {"motion_search", ®.motion_search, 6}, - {"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}, + /* profile */ + {"quant_type", ®.quant_type, 0}, {"lum_masking", ®.lum_masking, 0}, {"interlacing", ®.interlacing, 0}, {"qpel", ®.qpel, 0}, {"gmc", ®.gmc, 0}, - {"chromame", ®.chromame, 0}, + {"reduced_resolution", ®.reduced_resolution, 0}, {"use_bvop", ®.use_bvop, 0}, {"max_bframes", ®.max_bframes, 2}, {"bquant_ratio", ®.bquant_ratio, 150}, /* 100-base float */ {"bquant_offset", ®.bquant_offset, 100}, /* 100-base float */ {"packed", ®.packed, 0}, {"closed_gov", ®.closed_gov, 1}, - {"vop_debug", ®.vop_debug, 0}, - {"debug", ®.debug, 0x0}, - {"reduced_resolution", ®.reduced_resolution, 0}, - {"frame_drop_ratio", ®.frame_drop_ratio, 0}, - {"min_iquant", ®.min_iquant, 2}, - {"max_iquant", ®.max_iquant, 31}, - {"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}, + /* zones */ + {"num_zones", ®.num_zones, 1}, + + /* single pass */ + {"rc_reaction_delay_factor",®.rc_reaction_delay_factor, 16}, + {"rc_averaging_period", ®.rc_averaging_period, 100}, + {"rc_buffer", ®.rc_buffer, 100}, - {"desired_size", ®.desired_size, 570000}, + /* 2pass1 */ + {"discard1pass", ®.discard1pass, 1}, + + /* 2pass2 */ {"keyframe_boost", ®.keyframe_boost, 0}, - {"discard1pass", ®.discard1pass, 1}, {"kftreshold", ®.kftreshold, 10}, {"kfreduction", ®.kfreduction, 20}, {"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}, + {"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}, + + /* motion */ + {"motion_search", ®.motion_search, 6}, + {"vhq_mode", ®.vhq_mode, 0}, + {"chromame", ®.chromame, 0}, + {"max_key_interval", ®.max_key_interval, 300}, + {"min_key_interval", ®.min_key_interval, 1}, + {"frame_drop_ratio", ®.frame_drop_ratio, 0}, + + /* quant */ + {"min_iquant", ®.min_iquant, 2}, + {"max_iquant", ®.max_iquant, 31}, + {"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}, + + /* debug */ + {"fourcc_used", ®.fourcc_used, 0}, + {"debug", ®.debug, 0x0}, + {"vop_debug", ®.vop_debug, 0}, + {"display_status", ®.display_status, 1}, }; static const REG_STR reg_strs[] = { @@ -218,6 +224,7 @@ {"zone%i_mode", &stmp.mode, RC_ZONE_WEIGHT}, {"zone%i_weight", &stmp.weight, 100}, /* 100-base float */ {"zone%i_quant", &stmp.quant, 500}, /* 100-base float */ + {"zone%i_type", &stmp.type, XVID_TYPE_AUTO}, {"zone%i_greyscale", &stmp.greyscale, 0}, {"zone%i_chroma_opt", &stmp.chroma_opt, 0}, {"zone%i_bvop_threshold", &stmp.bvop_threshold, 0}, @@ -626,15 +633,8 @@ SendDlgItemMessage(hDlg, IDC_LEVEL_PROFILE, CB_ADDSTRING, 0, (LPARAM)profiles[i].name); break; - 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; - case IDD_ZONE : - EnableDlgWindow(hDlg, IDC_ZONE_FETCH, - config->cur_zone>0 && config->ci_valid && config->ci.ciActiveFrame>0); + EnableDlgWindow(hDlg, IDC_ZONE_FETCH, config->ci_valid); break; case IDD_MOTION : @@ -671,7 +671,6 @@ void adv_mode(HWND hDlg, int idd, CONFIG * config) { int profile; - int use_alt, use_alt_auto, use_alt_auto_bonus; int weight_en, quant_en; int cpu_force; int custom_quant, bvops; @@ -713,20 +712,6 @@ SetDlgItemInt(hDlg, IDC_LEVEL_BITRATE, profiles[profile].max_bitrate, FALSE); break; - 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; - case IDD_ZONE : weight_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_WEIGHT); quant_en = IsDlgChecked(hDlg, IDC_ZONE_MODE_QUANT); @@ -814,36 +799,20 @@ SetDlgItemInt(hDlg, IDC_CURVECOMPH, config->curve_compression_high, FALSE); SetDlgItemInt(hDlg, IDC_CURVECOMPL, config->curve_compression_low, FALSE); SetDlgItemInt(hDlg, IDC_PAYBACK, config->bitrate_payback_delay, 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); + CheckDlgButton(hDlg, IDC_PAYBACKBIAS, (config->bitrate_payback_method == XVID_PAYBACK_BIAS)); + CheckDlgButton(hDlg, IDC_PAYBACKPROP, (config->bitrate_payback_method == XVID_PAYBACK_PROP)); break; case IDD_ZONE : 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); CheckDlgButton(hDlg, IDC_ZONE_MODE_WEIGHT, config->zones[config->cur_zone].mode == RC_ZONE_WEIGHT); CheckDlgButton(hDlg, IDC_ZONE_MODE_QUANT, config->zones[config->cur_zone].mode == RC_ZONE_QUANT); set_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); set_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); - + CheckDlgButton(hDlg, IDC_ZONE_FORCEIVOP, config->zones[config->cur_zone].type==XVID_TYPE_IVOP); CheckDlgButton(hDlg, IDC_ZONE_GREYSCALE, config->zones[config->cur_zone].greyscale); CheckDlgButton(hDlg, IDC_ZONE_CHROMAOPT, config->zones[config->cur_zone].chroma_opt); @@ -882,9 +851,10 @@ SetDlgItemInt(hDlg, IDC_NUMTHREADS, config->num_threads, FALSE); - CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); - set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); SendDlgItemMessage(hDlg, IDC_FOURCC, CB_SETCURSEL, config->fourcc_used, 0); + set_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); + CheckDlg(hDlg, IDC_VOPDEBUG, config->vop_debug); + CheckDlg(hDlg, IDC_DISPLAY_STATUS, config->display_status); break; } } @@ -946,7 +916,7 @@ config->curve_compression_high = GetDlgItemInt(hDlg, IDC_CURVECOMPH, 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); + 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); @@ -954,21 +924,6 @@ CONSTRAINVAL(config->curve_compression_low, 0, 100); break; - 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; - case IDD_ZONE : config->zones[config->cur_zone].frame = config_get_uint(hDlg, IDC_ZONE_FRAME, config->zones[config->cur_zone].frame); @@ -981,6 +936,7 @@ config->zones[config->cur_zone].weight = get_dlgitem_float(hDlg, IDC_ZONE_WEIGHT, config->zones[config->cur_zone].weight); config->zones[config->cur_zone].quant = get_dlgitem_float(hDlg, IDC_ZONE_QUANT, config->zones[config->cur_zone].quant); + config->zones[config->cur_zone].type = IsDlgButtonChecked(hDlg, IDC_ZONE_FORCEIVOP)?XVID_TYPE_IVOP:XVID_TYPE_AUTO; config->zones[config->cur_zone].greyscale = IsDlgButtonChecked(hDlg, IDC_ZONE_GREYSCALE); config->zones[config->cur_zone].chroma_opt = IsDlgButtonChecked(hDlg, IDC_ZONE_CHROMAOPT); @@ -1029,8 +985,9 @@ config->num_threads = config_get_uint(hDlg, IDC_NUMTHREADS, config->num_threads); config->fourcc_used = SendDlgItemMessage(hDlg, IDC_FOURCC, CB_GETCURSEL, 0, 0); - config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); config->debug = get_dlgitem_hex(hDlg, IDC_DEBUG, config->debug); + config->vop_debug = IsDlgChecked(hDlg, IDC_VOPDEBUG); + config->display_status = IsDlgChecked(hDlg, IDC_DISPLAY_STATUS); break; } } @@ -1063,9 +1020,6 @@ switch (LOWORD(wParam)) { case IDC_BVOP : - case IDC_USEALT : - case IDC_USEAUTO : - case IDC_USEAUTOBONUS : case IDC_ZONE_MODE_WEIGHT : case IDC_ZONE_MODE_QUANT : case IDC_ZONE_BVOPTHRESHOLD_ENABLE : @@ -1255,6 +1209,9 @@ ListView_SetItemText(hDlg, i, 1, tmp); tmp[0] = '\0'; + if (s->type==XVID_TYPE_IVOP) + strcat(tmp, "K "); + if (s->greyscale) strcat(tmp, "G "); @@ -1264,43 +1221,61 @@ ListView_SetItemText(hDlg, i, 2, tmp); } +static int g_use_bitrate = 1; void main_mode(HWND hDlg, CONFIG * config) { + const int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); + const int rc_mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); + /* enable target rate/size control only for 1pass and 2pass modes*/ + const int target_en = rc_mode==RC_MODE_1PASS || rc_mode==RC_MODE_2PASS2; + char buf[16]; - int profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); - int bitrate_en; int max; - - wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); - SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); - max = profiles[profile].max_bitrate; - if (max == 0) max = DEFAULT_MAX_KBPS; - wsprintf(buf, "%i kbps", max); - SetDlgItemText(hDlg, IDC_BITRATE_MAX, buf); - - SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(DEFAULT_MIN_KBPS, max)); - SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, - config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); - - bitrate_en = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); - bitrate_en = bitrate_en==RC_MODE_1PASS || bitrate_en==RC_MODE_2PASS2; - - EnableDlgWindow(hDlg, IDC_BITRATE_S, bitrate_en); - EnableDlgWindow(hDlg, IDC_BITRATE, bitrate_en); - EnableDlgWindow(hDlg, IDC_BITRATE_MIN, bitrate_en); - EnableDlgWindow(hDlg, IDC_BITRATE_MAX, bitrate_en); - EnableDlgWindow(hDlg, IDC_SLIDER, bitrate_en); + g_use_bitrate = rc_mode==RC_MODE_1PASS || config->use_2pass_bitrate; + + if (g_use_bitrate) { + SetDlgItemText(hDlg, IDC_BITRATE_S, "Target bitrate (kbps):"); + + wsprintf(buf, "%i kbps", DEFAULT_MIN_KBPS); + SetDlgItemText(hDlg, IDC_BITRATE_MIN, buf); + + max = profiles[profile].max_bitrate; + if (max == 0) max = DEFAULT_MAX_KBPS; + wsprintf(buf, "%i kbps", max); + SetDlgItemText(hDlg, IDC_BITRATE_MAX, buf); + + SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETRANGE, TRUE, MAKELONG(DEFAULT_MIN_KBPS, max)); + SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, + config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); + + }else{ + SetDlgItemText(hDlg, IDC_BITRATE_S, "Target size (kbytes):"); + } + + EnableDlgWindow(hDlg, IDC_BITRATE_S, target_en); + EnableDlgWindow(hDlg, IDC_BITRATE, target_en); + + EnableDlgWindow(hDlg, IDC_BITRATE_MIN, target_en && g_use_bitrate); + EnableDlgWindow(hDlg, IDC_BITRATE_MAX, target_en && g_use_bitrate); + EnableDlgWindow(hDlg, IDC_SLIDER, target_en && g_use_bitrate); } + + void main_upload(HWND hDlg, CONFIG * config) { int i; SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); - SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); - SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); + SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); + + if (g_use_bitrate) { + SetDlgItemInt(hDlg, IDC_BITRATE, config->bitrate, FALSE); + }else{ + SetDlgItemInt(hDlg, IDC_BITRATE, config->desired_size, FALSE); + } ListView_DeleteAllItems(GetDlgItem(hDlg,IDC_ZONES)); for (i=0; i < config->num_zones; i++) { @@ -1314,10 +1289,13 @@ { config->profile = SendDlgItemMessage(hDlg, IDC_PROFILE, CB_GETCURSEL, 0, 0); config->mode = SendDlgItemMessage(hDlg, IDC_MODE, CB_GETCURSEL, 0, 0); - config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); -} - + if (g_use_bitrate) { + config->bitrate = config_get_uint(hDlg, IDC_BITRATE, config->bitrate); + }else{ + config->desired_size = config_get_uint(hDlg, IDC_BITRATE, config->desired_size); + } +} /* main dialog proc */ @@ -1325,7 +1303,7 @@ static const int profile_dlgs[] = { IDD_PROFILE, IDD_LEVEL }; static const int single_dlgs[] = { IDD_RC_CBR }; static const int pass1_dlgs[] = { IDD_RC_2PASS1 }; -static const int pass2_dlgs[] = { IDD_RC_2PASS2, IDD_RC_2PASS2_ALT}; +static const int pass2_dlgs[] = { IDD_RC_2PASS2 }; static const int zone_dlgs[] = { IDD_ZONE }; static const int bitrate_dlgs[] = { IDD_CALC }; static const int adv_dlgs[] = { IDD_MOTION, IDD_QUANT, IDD_DEBUG}; @@ -1354,7 +1332,6 @@ InitCommonControls(); - if ((g_hTooltip = CreateWindow(TOOLTIPS_CLASS, NULL, TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, g_hInst, NULL))) @@ -1366,6 +1343,8 @@ EnumChildWindows(hDlg, enum_tooltips, 0); } + SetClassLong(GetDlgItem(hDlg, IDC_BITRATE_S), GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND)); + { DWORD ext_style = ListView_GetExtendedListViewStyle(GetDlgItem(hDlg,IDC_ZONES)); ext_style |= LVS_EX_FULLROWSELECT | LVS_EX_FLATSB ; @@ -1386,11 +1365,11 @@ LVCOLUMN lvc; int i; - // Initialize the LVCOLUMN structure. + /* Initialize the LVCOLUMN structure. */ lvc.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; lvc.fmt = LVCFMT_LEFT; - // Add the columns. + /* Add the columns. */ for (i=0; iuse_2pass_bitrate = !config->use_2pass_bitrate; + main_mode(hDlg, config); + main_upload(hDlg, config); + break; + case IDC_BITRATE_CALC : main_download(hDlg, config); adv_dialog(hDlg, config, bitrate_dlgs, sizeof(bitrate_dlgs)/sizeof(int)); @@ -1461,7 +1451,7 @@ int i, sel, new_frame; if (config->num_zones >= MAX_ZONES) { - MessageBox(hDlg, "MAX_ZONES", "Warning", 0); + MessageBox(hDlg, "Exceeded maximum number of zones.\nIncrease config.h:MAX_ZONES and rebuild.", "Warning", 0); break; } @@ -1474,17 +1464,12 @@ new_frame = config->ci.ciActiveFrame; }else{ sel = config->num_zones-1; - new_frame = config->zones[sel].frame + 1; + new_frame = sel<0 ? 0 : config->zones[sel].frame + 1; } }else{ new_frame = config->zones[sel].frame + 1; } - if (sel+1num_zones && config->zones[sel+1].frame==new_frame) { - MessageBox(hDlg, "CANT ADD HERE", "Warning", 0); - break; - } - for(i=config->num_zones-1; i>sel; i--) { config->zones[i+1] = config->zones[i]; } @@ -1493,6 +1478,7 @@ config->zones[sel+1].mode = RC_ZONE_WEIGHT; config->zones[sel+1].weight = 100; config->zones[sel+1].quant = 500; + config->zones[sel+1].type = XVID_TYPE_AUTO; config->zones[sel+1].greyscale = 0; config->zones[sel+1].chroma_opt = 0; config->zones[sel+1].bvop_threshold = 0; @@ -1513,18 +1499,12 @@ break; } - if (sel == 0) { - MessageBox(hDlg, "Can't remove first zone", "Warning", 0); - break; - } - for (i=sel; inum_zones-1; i++) { config->zones[i] = config->zones[i+1]; } config->num_zones--; ListView_DeleteItem(GetDlgItem(hDlg, IDC_ZONES), sel); - sel--; if (sel==0 && config->num_zones>1) { sel=1; @@ -1564,11 +1544,18 @@ } }else if (HIWORD(wParam) == LBN_SELCHANGE && (LOWORD(wParam)==IDC_PROFILE || LOWORD(wParam)==IDC_MODE)) { + + main_download(hDlg, config); main_mode(hDlg, config); + main_upload(hDlg, config); + }else if (HIWORD(wParam)==EN_UPDATE && LOWORD(wParam)==IDC_BITRATE) { - SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, - config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); + if (g_use_bitrate) { + SendDlgItemMessage(hDlg, IDC_SLIDER, TBM_SETPOS, TRUE, + config_get_uint(hDlg, IDC_BITRATE, DEFAULT_MIN_KBPS) ); + } + }else { return 0; }