--- trunk/xvidcore/vfw/src/config.c 2004/04/18 07:55:11 1437 +++ trunk/xvidcore/vfw/src/config.c 2004/07/13 12:22:46 1490 @@ -169,13 +169,15 @@ } named_int_t; -#define NO_AUDIO 5 +#define NO_AUDIO 7 static const named_int_t audio_type_list[] = { { "MP3-CBR", 1000, 48000/1152/6 }, { "MP3-VBR", 24, 48000/1152/6 }, { "OGG", /*?*/1000, 48000*(0.7F/1024 + 0.3F/180) }, { "AC3", 64, 48000/1536/6 }, { "DTS", 21, /*?*/48000/1152/6 }, + { "AAC", 21, 48000/1024/6 }, + { "HE-AAC", 42, 48000/1024/6 }, { "(None)", 0, 0 }, }; @@ -198,6 +200,7 @@ {"quant_type", ®.quant_type, 0}, {"lum_masking", ®.lum_masking, 0}, {"interlacing", ®.interlacing, 0}, + {"tff", ®.tff, 0}, {"qpel", ®.qpel, 0}, {"gmc", ®.gmc, 0}, {"reduced_resolution", ®.reduced_resolution, 0}, @@ -839,6 +842,7 @@ EnableDlgWindow(hDlg, IDC_QUANTMATRIX, custom_quant); EnableDlgWindow(hDlg, IDC_LUMMASK, profiles[profile].flags&PROFILE_ADAPTQUANT); EnableDlgWindow(hDlg, IDC_INTERLACING, profiles[profile].flags&PROFILE_INTERLACE); + EnableDlgWindow(hDlg, IDC_TFF, IsDlgChecked(hDlg, IDC_INTERLACING)); EnableDlgWindow(hDlg, IDC_QPEL, profiles[profile].flags&PROFILE_QPEL); EnableDlgWindow(hDlg, IDC_GMC, profiles[profile].flags&PROFILE_GMC); EnableDlgWindow(hDlg, IDC_REDUCED, profiles[profile].flags&PROFILE_REDUCED); @@ -935,7 +939,11 @@ /* step 2: calculate audio_size (kbytes)*/ if (audio_type!=NO_AUDIO) { if (audio_mode==0) { - audio_size = (duration * audio_rate) / 8; + audio_size = (int)( (1000.0 * duration * audio_rate) / (8.0*1024) ); + SetDlgItemInt(hDlg, IDC_BITRATE_ASIZE, audio_size, TRUE); + }else{ + int tmp_rate = (int)( (audio_size * 8.0 * 1024) / (1000.0 * duration) ); + SetDlgItemInt(hDlg, IDC_BITRATE_ARATE, tmp_rate, TRUE); } }else{ audio_size = 0; @@ -975,8 +983,8 @@ overhead /= 1024; break; - case 3 : /* OGM: inaccurate model */ - overhead = (int)(0.0039F * (target_size - subtitle_size)); + case 3 : /* alexnoe formula */ + overhead = (int)( (target_size - subtitle_size) * (28.0/4224.0 + (1.0/255.0)) ); break; default : /* (none) */ @@ -1048,6 +1056,7 @@ SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_SETCURSEL, config->quant_type, 0); CheckDlg(hDlg, IDC_LUMMASK, config->lum_masking); CheckDlg(hDlg, IDC_INTERLACING, config->interlacing); + CheckDlg(hDlg, IDC_TFF, config->tff); CheckDlg(hDlg, IDC_QPEL, config->qpel); CheckDlg(hDlg, IDC_GMC, config->gmc); CheckDlg(hDlg, IDC_REDUCED, config->reduced_resolution); @@ -1194,6 +1203,7 @@ config->quant_type = SendDlgItemMessage(hDlg, IDC_QUANTTYPE, CB_GETCURSEL, 0, 0); config->lum_masking = IsDlgChecked(hDlg, IDC_LUMMASK); config->interlacing = IsDlgChecked(hDlg, IDC_INTERLACING); + config->tff = IsDlgChecked(hDlg, IDC_TFF); config->qpel = IsDlgChecked(hDlg, IDC_QPEL); config->gmc = IsDlgChecked(hDlg, IDC_GMC); config->reduced_resolution = IsDlgChecked(hDlg, IDC_REDUCED); @@ -1396,6 +1406,7 @@ { switch (LOWORD(wParam)) { + case IDC_INTERLACING : case IDC_BVOP : case IDC_ZONE_MODE_WEIGHT : case IDC_ZONE_MODE_QUANT : @@ -1420,9 +1431,9 @@ ofn.hwndOwner = hDlg; if (LOWORD(wParam)==IDC_BITRATE_SSELECT) { - ofn.lpstrFilter = "Subtitle files (*.sub, *.ssa)\0*.sub;*.ssa\0All files (*.*)\0*.*\0\0"; + ofn.lpstrFilter = "Subtitle files (*.sub, *.ssa, *.txt, *.dat)\0*.sub;*.ssa;*.txt;*.dat\0All files (*.*)\0*.*\0\0"; }else{ - ofn.lpstrFilter = "Audio files (*.mp3, *.ac3)\0*.mp3; *.ac3\0All files (*.*)\0*.*\0\0"; + ofn.lpstrFilter = "Audio files (*.mp3, *.ac3, *.aac, *.ogg, *.wav)\0*.mp3; *.ac3; *.aac; *.ogg; *.wav\0All files (*.*)\0*.*\0\0"; } ofn.lpstrFile = filename; @@ -2012,6 +2023,8 @@ case IDC_DEFAULTS : config_reg_default(config); + SendDlgItemMessage(hDlg, IDC_PROFILE, CB_SETCURSEL, config->profile, 0); + SendDlgItemMessage(hDlg, IDC_MODE, CB_SETCURSEL, config->mode, 0); main_mode(hDlg, config); main_upload(hDlg, config); break;