Commit 9f97e90e authored by Loren Merritt's avatar Loren Merritt

VfW: expose B pyramid and weighted B prediction.

patch by Riccardo Stievano.


git-svn-id: svn://svn.videolan.org/x264/trunk@157 df754926-b1dd-0310-bc7b-ec298dee348c
parent 4fbdc5c1
......@@ -223,8 +223,10 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
param.rc.f_qcompress = (float)config->i_curve_comp / 100;
param.i_bframe = config->i_bframe;
if( config->i_bframe > 1 )
if( config->i_bframe > 1 && config->b_b_wpred)
param.analyse.b_weighted_bipred = 1;
if( config->i_bframe > 1 && config->b_b_refs)
param.b_bframe_pyramid = 1;
param.analyse.i_subpel_refine = config->i_subpel_refine + 1; /* 0..4 -> 1..5 */
/* bframe prediction - gui goes alphabetically, so 1=SPATIAL, 2=TEMPORAL */
......@@ -233,7 +235,7 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
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;
param.i_deblocking_filter_beta = config->i_inloop_a;
if( config->b_bsub16x16 )
param.analyse.inter |= X264_ANALYSE_BSUB16x16;
......@@ -283,6 +285,7 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
{
statsfilename_renumber( param.rc.psz_stat_out, config->stats, 1 );
param.rc.b_stat_write = 1;
param.rc.i_qp_constant = 24;
if( config->b_fast1pass )
{
/* adjust or turn off some flags to gain speed, if needed */
......
......@@ -82,10 +82,11 @@ static const reg_int_t reg_int_table[] =
{ "keyint_max", &reg.i_keyint_max, 250 },
{ "keyint_min", &reg.i_keyint_min, 25 },
{ "refmax", &reg.i_refmax, 1 },
{ "bmax", &reg.i_bframe, 0 },
{ "bmax", &reg.i_bframe, 2 },
{ "direct_pred", &reg.i_direct_mv_pred, 1 },
{ "b_refs", &reg.b_b_refs, 0 },
{ "b_wpred", &reg.b_b_wpred, 1 },
{ "inloop_a", &reg.i_inloop_a, 0 },
{ "inloop_b", &reg.i_inloop_b, 0 },
{ "key_boost", &reg.i_key_boost, 40 },
{ "b_red", &reg.i_b_red, 30 },
{ "curve_comp", &reg.i_curve_comp, 60 },
......@@ -512,6 +513,10 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
config->b_cabac ? BST_CHECKED : BST_UNCHECKED );
CheckDlgButton( hDlg,IDC_LOOPFILTER,
config->b_filter ? BST_CHECKED: BST_UNCHECKED );
CheckDlgButton( hDlg,IDC_WBPRED,
config->b_b_wpred ? BST_CHECKED: BST_UNCHECKED );
CheckDlgButton( hDlg,IDC_BREFS,
config->b_b_refs ? BST_CHECKED: BST_UNCHECKED );
CheckDlgButton( hDlg,IDC_P16X16,
config->b_psub16x16 ? BST_CHECKED: BST_UNCHECKED );
CheckDlgButton( hDlg,IDC_P8X8,
......@@ -534,17 +539,14 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_SETRANGE, TRUE,
(LPARAM) MAKELONG( -6, 6 ) );
SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_SETRANGE, TRUE,
(LPARAM) MAKELONG( -6, 6 ) );
SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_SETPOS, TRUE,
config->i_inloop_a );
SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_SETPOS, TRUE,
config->i_inloop_b );
set_dlgitem_int( hDlg, IDC_LOOPA_TXT, config->i_inloop_a);
set_dlgitem_int( hDlg, IDC_LOOPB_TXT, config->i_inloop_b);
EnableWindow( GetDlgItem( hDlg, IDC_P8X8 ), config->b_psub16x16 );
EnableWindow( GetDlgItem( hDlg, IDC_BREFS ), config->i_bframe > 1 );
EnableWindow( GetDlgItem( hDlg, IDC_WBPRED ), config->i_bframe > 1 );
EnableWindow( GetDlgItem( hDlg, IDC_DIRECTPRED ), config->i_bframe > 0 );
memcpy( fourcc, config->fcc, 4 );
fourcc[4] = '\0';
......@@ -580,6 +582,12 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
case IDC_LOOPFILTER :
config->b_filter = ( IsDlgButtonChecked( hDlg, IDC_LOOPFILTER ) == BST_CHECKED );
break;
case IDC_BREFS :
config->b_b_refs = ( IsDlgButtonChecked( hDlg, IDC_BREFS ) == BST_CHECKED );
break;
case IDC_WBPRED :
config->b_b_wpred = ( IsDlgButtonChecked( hDlg, IDC_WBPRED ) == BST_CHECKED );
break;
case IDC_P16X16 :
config->b_psub16x16 = ( IsDlgButtonChecked( hDlg, IDC_P16X16 ) == BST_CHECKED );
EnableWindow( GetDlgItem( hDlg, IDC_P8X8 ), config->b_psub16x16 );
......@@ -617,6 +625,14 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
break;
case IDC_BFRAME :
config->i_bframe = GetDlgItemInt( hDlg, IDC_BFRAME, FALSE, FALSE );
if( config->i_bframe > 5 )
{
config->i_bframe = 5;
SetDlgItemInt( hDlg, IDC_BFRAME, config->i_bframe, FALSE );
}
EnableWindow( GetDlgItem( hDlg, IDC_BREFS ), config->i_bframe > 1 );
EnableWindow( GetDlgItem( hDlg, IDC_WBPRED ), config->i_bframe > 1 );
EnableWindow( GetDlgItem( hDlg, IDC_DIRECTPRED ), config->i_bframe > 0 );
break;
case IDC_IPRATIO :
config->i_key_boost = GetDlgItemInt( hDlg, IDC_IPRATIO, FALSE, FALSE );
......@@ -675,10 +691,6 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
if( (HWND) lParam == GetDlgItem( hDlg, IDC_INLOOP_A ) ) {
config->i_inloop_a = SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_GETPOS, 0, 0 );
set_dlgitem_int( hDlg, IDC_LOOPA_TXT, config->i_inloop_a);
} else if ( (HWND) lParam == GetDlgItem( hDlg, IDC_INLOOP_B ) ) {
config->i_inloop_b = SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_GETPOS, 0, 0 );
set_dlgitem_int( hDlg, IDC_LOOPB_TXT, config->i_inloop_b);
}
break;
case WM_CLOSE:
......
......@@ -54,9 +54,7 @@
#define IDC_2PASS1 1041
#define IDC_2PASS2 1042
#define IDC_INLOOP_A 1044
#define IDC_INLOOP_B 1045
#define IDC_LOOPA_TXT 1047
#define IDC_LOOPB_TXT 1048
#define IDC_FAST1PASS 1049
#define IDC_IPRATIO 1050
#define IDC_PBRATIO 1051
......@@ -66,6 +64,8 @@
#define IDC_STATSFILE_BROWSE 1055
#define IDC_CONSOLE 1056
#define IDC_COPYCLIP 1057
#define IDC_BREFS 1058
#define IDC_WBPRED 1059
// Next default values for new objects
//
......@@ -73,7 +73,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1058
#define _APS_NEXT_CONTROL_VALUE 1060
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
......@@ -105,58 +105,59 @@ BEGIN
PUSHBUTTON "...",IDC_STATSFILE_BROWSE,177,185,18,11
END
IDD_ADVANCED DIALOG DISCARDABLE 0, 0, 302, 262
IDD_ADVANCED DIALOG DISCARDABLE 0, 0, 302, 267
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "x264 Advanced Settings"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",IDOK,245,243,50,14
GROUPBOX "H.264 Features",IDC_STATIC,7,7,288,79
DEFPUSHBUTTON "OK",IDOK,245,250,50,14
GROUPBOX "H.264 Features",IDC_STATIC,7,7,145,88
CONTROL "CABAC",IDC_CABAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
16,23,61,10
CONTROL "Slider1",IDC_INLOOP_A,"msctls_trackbar32",TBS_NOTICKS |
WS_TABSTOP,56,53,47,10
GROUPBOX "",IDC_STATIC,7,40,115,41
LTEXT "Strength",IDC_STATIC,15,53,39,8
CONTROL "Slider1",IDC_INLOOP_B,"msctls_trackbar32",TBS_NOTICKS |
WS_TABSTOP,56,66,47,10
LTEXT "Threshold",IDC_STATIC,15,66,39,8
LTEXT "0",IDC_LOOPA_TXT,109,53,8,8
LTEXT "0",IDC_LOOPB_TXT,109,66,8,8
GROUPBOX "",IDC_STATIC,12,39,113,28
CONTROL "Deblocking filter",IDC_LOOPFILTER,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,16,39,69,10
LTEXT "Max reference frames:",IDC_STATIC,184,23,80,8
EDITTEXT IDC_REFFRAMES,263,20,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Max B-frames:",IDC_STATIC,210,43,51,8
EDITTEXT IDC_BFRAME,263,40,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "B-frames prediction mode:",IDC_STATIC,143,65,87,8
COMBOBOX IDC_DIRECTPRED,232,63,58,67,CBS_DROPDOWNLIST | CBS_SORT |
BS_AUTOCHECKBOX | WS_TABSTOP,16,38,64,10
LTEXT "Strength",IDC_STATIC,22,51,37,8
CONTROL "Slider1",IDC_INLOOP_A,"msctls_trackbar32",TBS_NOTICKS |
WS_TABSTOP,56,52,47,10
LTEXT "0",IDC_LOOPA_TXT,109,51,8,8
LTEXT "Max reference frames:",IDC_STATIC,16,76,80,8
EDITTEXT IDC_REFFRAMES,114,73,25,14,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "B-frames",IDC_STATIC,159,7,136,88
LTEXT "Max consecutive:",IDC_STATIC,168,25,80,8
EDITTEXT IDC_BFRAME,258,22,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Direct mode:",IDC_STATIC,168,46,50,8
COMBOBOX IDC_DIRECTPRED,229,44,55,67,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
GROUPBOX "More Encoder Settings",IDC_STATIC,7,88,145,74
LTEXT "Max IDR-frame interval:",IDC_STATIC,16,103,95,8
EDITTEXT IDC_KEYINTMAX,114,100,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Min IDR-frame interval:",IDC_STATIC,16,123,90,8
EDITTEXT IDC_KEYINTMIN,114,120,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "FourCC:",IDC_STATIC,16,143,26,8
EDITTEXT IDC_FOURCC,114,140,25,14,ES_AUTOHSCROLL
GROUPBOX "Ratecontrol",IDC_STATIC,159,88,136,74
LTEXT "Keyframe boost (%):",IDC_STATIC,168,103,68,8
EDITTEXT IDC_IPRATIO,258,100,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "B-frames reduction (%):",IDC_STATIC,168,123,75,8
EDITTEXT IDC_PBRATIO,258,120,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Bitrate variability (%):",IDC_STATIC,168,143,75,8
EDITTEXT IDC_CURVECOMP,258,140,25,14,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Macroblock Partitions",IDC_STATIC,7,164,288,76
CONTROL "Use as references",IDC_BREFS,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,64,80,10
CONTROL "Weighted biprediction",IDC_WBPRED,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,168,79,82,10
GROUPBOX "More Encoder Settings",IDC_STATIC,7,98,145,74
LTEXT "Max IDR-frame interval:",IDC_STATIC,16,113,95,8
EDITTEXT IDC_KEYINTMAX,114,110,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Min IDR-frame interval:",IDC_STATIC,16,133,90,8
EDITTEXT IDC_KEYINTMIN,114,130,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "FourCC:",IDC_STATIC,16,153,26,8
EDITTEXT IDC_FOURCC,114,150,25,14,ES_AUTOHSCROLL
GROUPBOX "Ratecontrol",IDC_STATIC,159,98,136,74
LTEXT "Keyframe boost (%):",IDC_STATIC,168,113,68,8
EDITTEXT IDC_IPRATIO,258,110,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "B-frames reduction (%):",IDC_STATIC,168,133,75,8
EDITTEXT IDC_PBRATIO,258,130,25,14,ES_AUTOHSCROLL | ES_NUMBER
LTEXT "Bitrate variability (%):",IDC_STATIC,168,153,75,8
EDITTEXT IDC_CURVECOMP,258,150,25,14,ES_AUTOHSCROLL | ES_NUMBER
GROUPBOX "Macroblock Partitions",IDC_STATIC,7,174,288,73
CONTROL "8x16, 16x8 and 8x8 P-frame search",IDC_P16X16,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,181,127,10
BS_AUTOCHECKBOX | WS_TABSTOP,17,190,127,10
CONTROL "4x8, 8x4 and 4x4 P-frame search",IDC_P8X8,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,165,181,119,10
BS_AUTOCHECKBOX | WS_TABSTOP,165,190,119,10
CONTROL "8x16, 16x8 and 8x8 B-frame search",IDC_B16X16,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,17,197,127,10
BS_AUTOCHECKBOX | WS_TABSTOP,17,206,127,10
CONTROL "4x4 Intra search",IDC_I4X4,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,165,197,82,10
LTEXT "Partition decision quality:",IDC_STATIC,17,218,95,8
COMBOBOX IDC_SUBPEL,104,216,70,77,CBS_DROPDOWNLIST | CBS_SORT |
WS_TABSTOP,165,206,82,10
LTEXT "Partition decision quality:",IDC_STATIC,17,227,95,8
COMBOBOX IDC_SUBPEL,104,225,70,77,CBS_DROPDOWNLIST | CBS_SORT |
WS_VSCROLL | WS_TABSTOP
END
......
......@@ -66,8 +66,10 @@ typedef struct
int i_direct_mv_pred;
int i_inloop_a;
int i_inloop_b;
int b_b_refs;
int b_b_wpred;
int i_key_boost;
int i_b_red;
int i_curve_comp;
......
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