Commit 7b46f42d authored by Loren Merritt's avatar Loren Merritt

New VfW option: "fast 1st pass" automatically disables some partitions and...

New VfW option: "fast 1st pass" automatically disables some partitions and reduces ME quality and number of reference frames.
Removed option direct_pred=none, since it provides no benefits.
Patch by Riccardo Stievano <walkunafraid at tin dot it>.


git-svn-id: svn://svn.videolan.org/x264/trunk@97 df754926-b1dd-0310-bc7b-ec298dee348c
parent 177e2113
......@@ -165,11 +165,10 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
param.i_bframe = config->i_bframe;
param.analyse.i_subpel_refine = config->i_subpel_refine + 1; /* 0..4 -> 1..5 */
/* bframe prediction - gui goes alphabetically, so 0=NONE, 1=SPATIAL, 2=TEMPORAL */
/* bframe prediction - gui goes alphabetically, so 1=SPATIAL, 2=TEMPORAL */
switch(config->i_direct_mv_pred) {
case 0: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_NONE; break;
case 1: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL; break;
case 2: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_TEMPORAL; break;
case 0: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_SPATIAL; break;
case 1: param.analyse.i_direct_mv_pred = X264_DIRECT_PRED_TEMPORAL; break;
}
param.i_deblocking_filter_alphac0 = config->i_inloop_a;
param.i_deblocking_filter_beta = config->i_inloop_b;
......@@ -197,8 +196,22 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
case 2: /* 2 PASS */
param.rc.psz_stat_out = param.rc.psz_stat_in = statsfile;
if (config->i_pass == 1)
{
param.rc.b_stat_write = 1;
else {
if (config->b_fast1pass)
{
/* adjust or turn off some flags to gain speed, if needed */
if (param.analyse.i_subpel_refine > 1)
param.analyse.i_subpel_refine --;
if (param.analyse.i_subpel_refine > 3)
param.analyse.i_subpel_refine = 3;
param.i_frame_reference = (param.i_frame_reference + 1) >> 1;
param.analyse.inter &= (~X264_ANALYSE_PSUB8x8);
param.analyse.inter &= (~X264_ANALYSE_BSUB16x16);
}
}
else
{
param.rc.i_bitrate = config->i_2passbitrate;
param.rc.b_stat_read = 1;
param.rc.b_cbr = 1;
......
......@@ -72,6 +72,7 @@ static const reg_int_t reg_int_table[] =
{ "encoding_type", &reg.i_encoding_type, 1 },
{ "passbitrate", &reg.i_2passbitrate, 800 },
{ "pass_number", &reg.i_pass, 1 },
{ "fast1pass", &reg.b_fast1pass, 1 },
/* Advance dialog */
{ "cabac", &reg.b_cabac, 1 },
......@@ -80,7 +81,7 @@ static const reg_int_t reg_int_table[] =
{ "keyint_min", &reg.i_keyint_max, 250},
{ "refmax", &reg.i_refmax, 1 },
{ "bmax", &reg.i_bframe, 0 },
{"direct_pred", &reg.i_direct_mv_pred, 2 },
{"direct_pred", &reg.i_direct_mv_pred, 1 },
{"inloop_a", &reg.i_inloop_a, 0 },
{"inloop_b", &reg.i_inloop_b, 0 },
......@@ -205,6 +206,7 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
EnableWindow( GetDlgItem( hDlg, IDC_2PASS2 ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_FAST1PASS ), FALSE );
break;
case 1 : /* 1 Pass, Quantizer Based */
......@@ -218,6 +220,7 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
EnableWindow( GetDlgItem( hDlg, IDC_2PASS2 ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), FALSE );
EnableWindow( GetDlgItem( hDlg, IDC_FAST1PASS ), FALSE );
break;
case 2 : /* 2 Pass */
......@@ -231,7 +234,7 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
EnableWindow( GetDlgItem( hDlg, IDC_2PASS2 ), TRUE );
EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE ), config->i_pass > 1 );
EnableWindow( GetDlgItem( hDlg, IDC_2PASSBITRATE_S ), config->i_pass > 1 );
EnableWindow( GetDlgItem( hDlg, IDC_FAST1PASS ), config->i_pass == 1);
break;
}
......@@ -242,7 +245,6 @@ static void main_enable_item( HWND hDlg, CONFIG * config )
SendDlgItemMessage( hDlg, IDC_2PASSBITRATE_S, TBM_SETRANGE, TRUE,
(LPARAM) MAKELONG( 0, BITRATE_MAX ) );
}
/* Updates the window from config */
......@@ -284,6 +286,7 @@ static void main_update_dlg( HWND hDlg, CONFIG * config )
config->i_qp );
SendDlgItemMessage( hDlg, IDC_2PASSBITRATE_S, TBM_SETPOS, TRUE,
config->i_2passbitrate );
CheckDlgButton( hDlg, IDC_FAST1PASS, config->b_fast1pass ? BST_CHECKED : BST_UNCHECKED );
}
......@@ -356,6 +359,9 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
main_enable_item( hDlg, config );
main_update_dlg( hDlg, config );
break;
case IDC_FAST1PASS :
config->b_fast1pass = ( IsDlgButtonChecked( hDlg, IDC_FAST1PASS ) == BST_CHECKED );
break;
}
break;
case EN_CHANGE :
......@@ -444,7 +450,6 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
{
char fourcc[5];
SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"None");
SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Spatial");
SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Temporal");
......
......@@ -56,6 +56,7 @@
#define IDC_INLOOP_B 1045
#define IDC_LOOPA_TXT 1047
#define IDC_LOOPB_TXT 1048
#define IDC_FAST1PASS 1049
// Next default values for new objects
//
......@@ -63,7 +64,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 104
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1049
#define _APS_NEXT_CONTROL_VALUE 1050
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
......@@ -78,7 +78,7 @@ BEGIN
GROUPBOX "",IDC_STATIC,7,57,211,47
LTEXT "0 (High Quality)",IDC_BITRATELOW2,14,70,50,8
LTEXT "51 (Low Quality)",IDC_BITRATEHIGH2,131,71,53,8
GROUPBOX "",IDC_STATIC,7,109,211,63
GROUPBOX "",IDC_STATIC,7,109,211,73
CONTROL "1 Pass, Bitrate",IDC_RADIOBITRATE,"Button",
BS_AUTORADIOBUTTON,13,7,58,10
CONTROL "1 Pass, Quantizer",IDC_RADIOQUANT,"Button",
......@@ -90,11 +90,13 @@ BEGIN
CONTROL "Second Pass",IDC_2PASS2,"Button",BS_AUTORADIOBUTTON,87,
126,58,10
CONTROL "Slider1",IDC_2PASSBITRATE_S,"msctls_trackbar32",
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,13,149,175,15
EDITTEXT IDC_2PASSBITRATE,189,149,27,14,ES_AUTOHSCROLL |
TBS_BOTH | TBS_NOTICKS | WS_TABSTOP,13,148,175,15
EDITTEXT IDC_2PASSBITRATE,189,148,27,14,ES_AUTOHSCROLL |
ES_NUMBER
LTEXT "0",IDC_BITRATELOW3,14,136,22,8
LTEXT "5000",IDC_BITRATEHIGH3,166,136,17,8
CONTROL "Fast first pass",IDC_FAST1PASS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
20,166,61,10
END
IDD_ADVANCED DIALOG DISCARDABLE 0, 0, 302, 258
......
......@@ -43,6 +43,8 @@ typedef struct
int i_2passbitrate;
int i_pass;
int b_fast1pass; /* turns off some flags during 1st pass */
/* Our config */
int i_refmax;
int i_keyint_max;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment