more VfW options.
authorLoren Merritt <pengvado@videolan.org>
Sun, 12 Jun 2005 23:17:12 +0000 (23:17 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sun, 12 Jun 2005 23:17:12 +0000 (23:17 +0000)
patch mostly by celtic_druid.

git-svn-id: svn://svn.videolan.org/x264/trunk@261 df754926-b1dd-0310-bc7b-ec298dee348c

vfw/codec.c
vfw/config.c
vfw/resource.h
vfw/resource.rc
vfw/x264vfw.h

index 66604c6..0046b00 100644 (file)
@@ -197,10 +197,9 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
 
     param.rc.psz_stat_out = malloc (MAX_PATH);
     param.rc.psz_stat_in = malloc (MAX_PATH);
-
     param.i_threads = config->i_threads;
-  
-    param.i_log_level = X264_LOG_ERROR;
+
+    param.i_log_level = config->i_log_level - 1;
     param.pf_log = x264_log_vfw;
     param.p_log_private = malloc( sizeof( HWND ) );
     *( ( HWND * )param.p_log_private ) = NULL; /* error console window handle */
@@ -218,8 +217,13 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
     param.i_frame_reference = config->i_refmax;
     param.i_keyint_min = config->i_keyint_min;
     param.i_keyint_max = config->i_keyint_max;
+    param.i_scenecut_threshold = config->i_scenecut_threshold;
+    param.rc.i_qp_min = config->i_qp_min;
+    param.rc.i_qp_max = config->i_qp_max;
+    param.rc.i_qp_step = config->i_qp_step;
     param.b_deblocking_filter = config->b_filter;
     param.b_cabac = config->b_cabac;
+    param.analyse.b_chroma_me = config->b_chroma_me;
     param.rc.f_ip_factor = 1 + (float)config->i_key_boost / 100;
     param.rc.f_pb_factor = 1 + (float)config->i_b_red / 100;
     param.rc.f_qcompress = (float)config->i_curve_comp / 100;
@@ -231,7 +235,11 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
         param.analyse.b_weighted_bipred = 1;
     if( config->i_bframe > 1 && config->b_b_refs)
         param.b_bframe_pyramid = 1;
+    param.b_bframe_adaptive = config->b_bframe_adaptive;
+    param.i_bframe_bias = config->i_bframe_bias;
     param.analyse.i_subpel_refine = config->i_subpel_refine + 1; /* 0..4 -> 1..5 */
+    param.analyse.i_me_method = config->i_me_method;
+    param.analyse.i_me_range = config->i_me_range;
 
     /* bframe prediction - gui goes alphabetically, so 1=SPATIAL, 2=TEMPORAL */
     switch(config->i_direct_mv_pred) {
@@ -239,8 +247,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_a;
-
+    param.i_deblocking_filter_beta = config->i_inloop_b;
     param.analyse.inter = 0;
     if( config->b_bsub16x16 )
         param.analyse.inter |= X264_ANALYSE_BSUB16x16;
@@ -254,7 +261,6 @@ LRESULT compress_begin(CODEC * codec, BITMAPINFO * lpbiInput, BITMAPINFO * lpbiO
         param.analyse.inter |= X264_ANALYSE_I4x4;
     if( config->b_i8x8 )
         param.analyse.inter |= X264_ANALYSE_I8x8;
-
     param.analyse.b_transform_8x8 = config->b_dct8x8;
 
     switch( config->i_encoding_type )
index 63a49fa..fc48fbd 100644 (file)
@@ -88,18 +88,27 @@ static const reg_int_t reg_int_table[] =
     { "loop_filter",    &reg.b_filter,          1 },
     { "keyint_max",     &reg.i_keyint_max,      250 },
     { "keyint_min",     &reg.i_keyint_min,      25 },
+    { "scenecut",       &reg.i_scenecut_threshold, 40 },
+    { "qp_min",         &reg.i_qp_min,         10 },
+    { "qp_max",         &reg.i_qp_max,         51 },
+    { "qp_step",        &reg.i_qp_step,         4 },
     { "refmax",         &reg.i_refmax,          1 },
     { "bmax",           &reg.i_bframe,          2 },
     { "direct_pred",    &reg.i_direct_mv_pred,  1 },
     { "b_refs",         &reg.b_b_refs,          0 },
+    { "b_bias",         &reg.i_bframe_bias,     0 },
+    { "b_adapt",        &reg.b_bframe_adaptive, 1 },
     { "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 },
     { "sar_width",      &reg.i_sar_width,       1 },
     { "sar_height",     &reg.i_sar_height,      1 },
 
+    { "log_level",      &reg.i_log_level,       1 },
+
     /* analysis */
     { "i4x4",           &reg.b_i4x4,            1 },
     { "i8x8",           &reg.b_i8x8,            1 },
@@ -107,6 +116,9 @@ static const reg_int_t reg_int_table[] =
     { "psub16x16",      &reg.b_psub16x16,       1 },
     { "psub8x8",        &reg.b_psub8x8,         1 },
     { "bsub16x16",      &reg.b_bsub16x16,       1 },
+    { "me_method",      &reg.i_me_method,       1 },
+    { "me_range",       &reg.i_me_range,       16 },
+    { "chroma_me",      &reg.b_chroma_me,       1 },
     { "subpel",         &reg.i_subpel_refine,   4 }
 
 };
@@ -356,6 +368,11 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
                                 (HWND)lParam, callback_advanced,
                                 (LPARAM)config );
                 break;
+            case IDC_DEBUG :
+                DialogBoxParam( g_hInst, MAKEINTRESOURCE(IDD_DEBUG),
+                                (HWND)lParam, callback_debug,
+                                (LPARAM)config );
+                break;
             case IDC_DEFAULTS :
                 if( MessageBox( hDlg, X264_DEF_TEXT, X264_NAME, MB_YESNO ) == IDYES )
                 {
@@ -513,6 +530,71 @@ BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
 
     return 1;
 }
+static void debug_update_dlg( HWND hDlg, CONFIG * config )
+{
+    char fourcc[5];
+
+    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"None");
+    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Error");
+    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Warning");
+    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Info");
+    SendDlgItemMessage(hDlg, IDC_LOG, CB_ADDSTRING, 0, (LPARAM)"Debug");
+    SendDlgItemMessage(hDlg, IDC_LOG, CB_SETCURSEL, (config->i_log_level), 0);
+
+    memcpy( fourcc, config->fcc, 4 );
+    fourcc[4] = '\0';
+    SetDlgItemText( hDlg, IDC_FOURCC, fourcc );
+
+}
+BOOL CALLBACK callback_debug( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
+{
+    CONFIG* config = (CONFIG*)GetWindowLong(hDlg, GWL_USERDATA);
+
+    switch( uMsg )
+    {
+    case WM_INITDIALOG :
+        SetWindowLong( hDlg, GWL_USERDATA, lParam );
+        config = (CONFIG*)lParam;
+        debug_update_dlg( hDlg, config );
+        break;
+
+    case WM_COMMAND:
+        switch ( HIWORD( wParam ) )
+        {
+        case BN_CLICKED :
+            switch( LOWORD( wParam ) )
+            {
+            case IDOK :
+                EndDialog( hDlg, LOWORD( wParam ) );
+                break;
+            case IDCANCEL :
+                EndDialog( hDlg, LOWORD( wParam ) );
+                break;
+            }
+        case EN_CHANGE :
+            switch( LOWORD( wParam ) )
+            {
+            case IDC_FOURCC :
+                GetDlgItemText( hDlg, IDC_FOURCC, config->fcc, 5 );
+                break;
+            }
+            break;
+            case LBN_SELCHANGE :
+                switch ( LOWORD( wParam ) ) {
+                case IDC_LOG:
+                    config->i_log_level = SendDlgItemMessage(hDlg, IDC_LOG, CB_GETCURSEL, 0, 0);
+                    break;
+                }
+            break;
+        }
+        break;
+
+    default :
+        return 0;
+    }
+
+    return 1;
+}
 
 static void set_dlgitem_int(HWND hDlg, UINT item, int value)
 {
@@ -523,7 +605,14 @@ static void set_dlgitem_int(HWND hDlg, UINT item, int value)
 
 static void adv_update_dlg( HWND hDlg, CONFIG * config )
 {
-    char fourcc[5];
+    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Diamond Search");
+    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Hexagonal Search");
+    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Uneven Multi-Hexagon");
+    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_ADDSTRING, 0, (LPARAM)"Exhaustive Search");
+
+    SetDlgItemInt( hDlg, IDC_MERANGE, config->i_me_range, FALSE );
+    CheckDlgButton( hDlg,IDC_CHROMAME,
+                    config->b_chroma_me ? BST_CHECKED: BST_UNCHECKED );
 
     SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Spatial");
     SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_ADDSTRING, 0, (LPARAM)"Temporal");
@@ -540,6 +629,8 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
                     config->b_filter ? BST_CHECKED: BST_UNCHECKED );
     CheckDlgButton( hDlg,IDC_WBPRED,
                     config->b_b_wpred ? BST_CHECKED: BST_UNCHECKED );
+    CheckDlgButton( hDlg,IDC_BADAPT,
+                    config->b_bframe_adaptive ? BST_CHECKED: BST_UNCHECKED );
     CheckDlgButton( hDlg,IDC_BREFS,
                     config->b_b_refs ? BST_CHECKED: BST_UNCHECKED );
     CheckDlgButton( hDlg,IDC_P16X16,
@@ -557,8 +648,18 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
 
     SetDlgItemInt( hDlg, IDC_KEYINTMIN, config->i_keyint_min, FALSE );
     SetDlgItemInt( hDlg, IDC_KEYINTMAX, config->i_keyint_max, FALSE );
+    SetDlgItemInt( hDlg, IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
     SetDlgItemInt( hDlg, IDC_REFFRAMES, config->i_refmax, FALSE );
     SetDlgItemInt( hDlg, IDC_BFRAME, config->i_bframe, FALSE );
+    SetDlgItemInt( hDlg, IDC_QPMIN, config->i_qp_min, FALSE );
+    SetDlgItemInt( hDlg, IDC_QPMAX, config->i_qp_max, FALSE );
+    SetDlgItemInt( hDlg, IDC_QPSTEP, config->i_qp_step, FALSE );
+
+    SetDlgItemInt( hDlg, IDC_BBIAS, config->i_bframe_bias, TRUE );
+    SendDlgItemMessage( hDlg, IDC_BBIASSLIDER, TBM_SETRANGE, TRUE,
+                        (LPARAM) MAKELONG( -100, 100 ) );
+    SendDlgItemMessage( hDlg, IDC_BBIASSLIDER, TBM_SETPOS, TRUE,
+                        config->i_bframe_bias );
 
     SetDlgItemInt( hDlg, IDC_SAR_W, config->i_sar_width,  FALSE );
     SetDlgItemInt( hDlg, IDC_SAR_H, config->i_sar_height, FALSE );
@@ -569,22 +670,31 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
 
     SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_SETCURSEL, (config->i_direct_mv_pred), 0);
     SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_SETCURSEL, (config->i_subpel_refine), 0);
+    SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_SETCURSEL, (config->i_me_method), 0);
 
     SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_SETRANGE, TRUE,
                         (LPARAM) MAKELONG( -6, 6 ) );
     SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_SETPOS, TRUE,
                         config->i_inloop_a );
     set_dlgitem_int( hDlg, IDC_LOOPA_TXT, config->i_inloop_a);
+    SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_SETRANGE, TRUE,
+                        (LPARAM) MAKELONG( -6, 6 ) );
+    SendDlgItemMessage( hDlg, IDC_INLOOP_B, TBM_SETPOS, TRUE,
+                        config->i_inloop_b );
+    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_BADAPT ), config->i_bframe > 0 );
+    EnableWindow( GetDlgItem( hDlg, IDC_BBIAS ), config->i_bframe > 0 );
+    EnableWindow( GetDlgItem( hDlg, IDC_BBIASSLIDER ), config->i_bframe > 0 );
     EnableWindow( GetDlgItem( hDlg, IDC_DIRECTPRED ), config->i_bframe > 0 );
     EnableWindow( GetDlgItem( hDlg, IDC_I8X8 ), config->b_dct8x8 );
+    EnableWindow( GetDlgItem( hDlg, IDC_MERANGE ), config->i_me_method > 1 );
+    EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_A ), config->b_filter );
+    EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_B ), config->b_filter );
 
-    memcpy( fourcc, config->fcc, 4 );
-    fourcc[4] = '\0';
-    SetDlgItemText( hDlg, IDC_FOURCC, fourcc );
 }
 
 /* advanced configuration dialog process */
@@ -615,6 +725,8 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
                 break;
             case IDC_LOOPFILTER :
                 config->b_filter = ( IsDlgButtonChecked( hDlg, IDC_LOOPFILTER ) == BST_CHECKED );
+                EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_A ), config->b_filter );
+                EnableWindow( GetDlgItem( hDlg, IDC_INLOOP_B ), config->b_filter );
                 break;
             case IDC_BREFS :
                 config->b_b_refs = ( IsDlgButtonChecked( hDlg, IDC_BREFS ) == BST_CHECKED );
@@ -622,6 +734,9 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
             case IDC_WBPRED :
                 config->b_b_wpred = ( IsDlgButtonChecked( hDlg, IDC_WBPRED ) == BST_CHECKED );
                 break;
+            case IDC_BADAPT :
+                config->b_bframe_adaptive = ( IsDlgButtonChecked( hDlg, IDC_BADAPT ) == BST_CHECKED );
+                break;
             case IDC_P16X16 :
                 config->b_psub16x16 = ( IsDlgButtonChecked( hDlg, IDC_P16X16 ) == BST_CHECKED );
                 EnableWindow( GetDlgItem( hDlg, IDC_P8X8 ), config->b_psub16x16 );
@@ -642,6 +757,9 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
                 config->b_dct8x8 = ( IsDlgButtonChecked( hDlg, IDC_DCT8X8 ) == BST_CHECKED );
                 EnableWindow( GetDlgItem( hDlg, IDC_I8X8 ), config->b_dct8x8 );
                 break;
+            case IDC_CHROMAME :
+                config->b_chroma_me = ( IsDlgButtonChecked( hDlg, IDC_CHROMAME ) == BST_CHECKED );
+                break;
             }
             break;
         case EN_CHANGE :
@@ -653,6 +771,54 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
             case IDC_KEYINTMAX :
                 config->i_keyint_max = GetDlgItemInt( hDlg, IDC_KEYINTMAX, FALSE, FALSE );
                 break;
+            case IDC_SCENECUT :
+                config->i_scenecut_threshold = GetDlgItemInt( hDlg, IDC_SCENECUT, FALSE, TRUE );
+                if( config->i_scenecut_threshold > 100 )
+                {
+                    config->i_scenecut_threshold = 100;
+                    SetDlgItemInt( hDlg, IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
+                } else if ( config->i_scenecut_threshold < -1 )
+                {
+                    config->i_scenecut_threshold = -1;
+                    SetDlgItemInt( hDlg, IDC_SCENECUT, config->i_scenecut_threshold, TRUE );
+                }
+                break;
+            case IDC_QPMIN :
+                config->i_qp_min = GetDlgItemInt( hDlg, IDC_QPMIN, FALSE, FALSE );
+                if( config->i_qp_min > 51 )
+                {
+                    config->i_qp_min = 51;
+                    SetDlgItemInt( hDlg, IDC_QPMIN, config->i_qp_min, FALSE );
+                } else if ( config->i_qp_min < 1 )
+                {
+                    config->i_qp_min = 1;
+                    SetDlgItemInt( hDlg, IDC_QPMIN, config->i_qp_min, FALSE );
+                }
+                break;
+            case IDC_QPMAX :
+                config->i_qp_max = GetDlgItemInt( hDlg, IDC_QPMAX, FALSE, FALSE );
+                if( config->i_qp_max > 51 )
+                {
+                    config->i_qp_max = 51;
+                    SetDlgItemInt( hDlg, IDC_QPMAX, config->i_qp_max, FALSE );
+                } else if ( config->i_qp_max < 1 )
+                {
+                    config->i_qp_max = 1;
+                    SetDlgItemInt( hDlg, IDC_QPMAX, config->i_qp_max, FALSE );
+                }
+                break;
+            case IDC_QPSTEP :
+                config->i_qp_step = GetDlgItemInt( hDlg, IDC_QPSTEP, FALSE, FALSE );
+                if( config->i_qp_step > 50 )
+                {
+                    config->i_qp_step = 50;
+                    SetDlgItemInt( hDlg, IDC_QPSTEP, config->i_qp_step, FALSE );
+                } else if ( config->i_qp_step < 1 )
+                {
+                    config->i_qp_step = 1;
+                    SetDlgItemInt( hDlg, IDC_QPSTEP, config->i_qp_step, FALSE );
+                }
+                break;
             case IDC_SAR_W :
                 config->i_sar_width = GetDlgItemInt( hDlg, IDC_SAR_W, FALSE, FALSE );
                 break;
@@ -667,9 +833,19 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
                     SetDlgItemInt( hDlg, IDC_REFFRAMES, config->i_refmax, FALSE );
                 }
                 break;
-            case IDC_FOURCC :
-                GetDlgItemText( hDlg, IDC_FOURCC, config->fcc, 5 );
+            case IDC_MERANGE :
+                config->i_me_range = GetDlgItemInt( hDlg, IDC_MERANGE, FALSE, FALSE );
+                if( config->i_me_range > 64 )
+                {
+                    config->i_me_range = 64;
+                    SetDlgItemInt( hDlg, IDC_MERANGE, config->i_me_range, FALSE );
+                } else if( config->i_me_range < 4 )
+                {
+                    config->i_me_range = 4;
+                    SetDlgItemInt( hDlg, IDC_MERANGE, config->i_me_range, FALSE );
+                }
                 break;
+
             case IDC_BFRAME :
                 config->i_bframe = GetDlgItemInt( hDlg, IDC_BFRAME, FALSE, FALSE );
                 if( config->i_bframe > 5 )
@@ -680,6 +856,23 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
                 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 );
+                EnableWindow( GetDlgItem( hDlg, IDC_BADAPT ), config->i_bframe > 0 );
+                EnableWindow( GetDlgItem( hDlg, IDC_BBIAS ), config->i_bframe > 0 );
+                EnableWindow( GetDlgItem( hDlg, IDC_BBIASSLIDER ), config->i_bframe > 0 );
+                break;
+            case IDC_BBIAS :
+                config->i_bframe_bias = GetDlgItemInt( hDlg, IDC_BBIAS, FALSE, TRUE );
+                SendDlgItemMessage(hDlg, IDC_BBIASSLIDER, TBM_SETPOS, 1,
+                config->i_bframe_bias);
+                if( config->i_bframe_bias > 100 )
+                {
+                    config->i_bframe_bias = 100;
+                    SetDlgItemInt( hDlg, IDC_BBIAS, config->i_bframe_bias, TRUE );
+                } else if ( config->i_bframe_bias < -100 )
+                {
+                    config->i_bframe_bias = -100;
+                    SetDlgItemInt( hDlg, IDC_BBIAS, config->i_bframe_bias, TRUE );
+                }
                 break;
             case IDC_IPRATIO :
                 config->i_key_boost = GetDlgItemInt( hDlg, IDC_IPRATIO, FALSE, FALSE );
@@ -730,6 +923,10 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
                 case IDC_SUBPEL:
                     config->i_subpel_refine = SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_GETCURSEL, 0, 0);
                     break;
+                case IDC_ME_METHOD:
+                    config->i_me_method = SendDlgItemMessage(hDlg, IDC_ME_METHOD, CB_GETCURSEL, 0, 0);
+                    EnableWindow( GetDlgItem( hDlg, IDC_MERANGE ), config->i_me_method > 1 );
+                    break;
                 }
             break;
         }
@@ -739,6 +936,14 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
                 config->i_inloop_a = SendDlgItemMessage( hDlg, IDC_INLOOP_A, TBM_GETPOS, 0, 0 );
                 set_dlgitem_int( hDlg, IDC_LOOPA_TXT, config->i_inloop_a);
         }
+        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);
+        }
+        if( (HWND) lParam == GetDlgItem( hDlg, IDC_BBIASSLIDER ) ) {
+                config->i_bframe_bias = SendDlgItemMessage( hDlg, IDC_BBIASSLIDER, TBM_GETPOS, 0, 0 );
+                set_dlgitem_int( hDlg, IDC_BBIAS, config->i_bframe_bias);
+        }
         break;
         case WM_CLOSE:
             EndDialog( hDlg, LOWORD( wParam ) );
index 2dbcfd0..87c1fe1 100644 (file)
@@ -7,6 +7,7 @@
 #define IDD_ADVANCED                    102
 #define IDD_ABOUT                       103
 #define IDD_ERRCONSOLE                  104
+#define IDD_DEBUG                       105
 #define IDC_BITRATESLIDER               1002
 #define IDC_BITRATEEDIT                 1003
 #define IDC_BITRATESLIDER2              1004
 #define IDC_SAR_H                       1063
 #define IDC_I8X8                        1064
 #define IDC_DCT8X8                      1065
+#define IDC_ME_METHOD                   1066
+#define IDC_CHROMAME                    1067
+#define IDC_MERANGE                     1068
+#define IDC_BADAPT                      1070
+#define IDC_BBIASSLIDER                 1072
+#define IDC_BBIAS                       1073
+#define IDC_QPMIN                       1074
+#define IDC_QPMAX                       1075
+#define IDC_QPSTEP                      1076
+#define IDC_INLOOP_B                    1077
+#define IDC_LOOPB_TXT                   1078
+#define IDC_LOG                         1079
+#define IDC_DEBUG                       1084
+#define IDC_CPU_MMX                     1086
+#define IDC_SCENECUT                    1087
 
 // Next default values for new objects
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        105
+#define _APS_NEXT_RESOURCE_VALUE        106
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1066
+#define _APS_NEXT_CONTROL_VALUE         1088
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 1b8c1bb..b1da1ea 100644 (file)
@@ -24,29 +24,42 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_CAN
 #pragma code_page(1252)
 #endif //_WIN32
 
-#ifdef APSTUDIO_INVOKED
 /////////////////////////////////////////////////////////////////////////////
 //
-// TEXTINCLUDE
+// Dialog
 //
 
-1 TEXTINCLUDE DISCARDABLE 
+IDD_DEBUG DIALOG DISCARDABLE  0, 0, 186, 95
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION
+CAPTION "Debug"
+FONT 8, "MS Sans Serif"
 BEGIN
-    "resource.h\0"
+    DEFPUSHBUTTON   "OK",IDOK,129,7,50,14
+    PUSHBUTTON      "Cancel",IDCANCEL,129,24,50,14
+    COMBOBOX        IDC_LOG,48,14,48,55,CBS_DROPDOWNLIST | WS_VSCROLL |
+                    WS_TABSTOP
+    LTEXT           "Log Mode",IDC_STATIC,13,17,33,8
+    LTEXT           "FourCC:",IDC_STATIC,13,36,26,14,SS_CENTERIMAGE
+    EDITTEXT        IDC_FOURCC,48,36,25,14,ES_AUTOHSCROLL
 END
 
-2 TEXTINCLUDE DISCARDABLE 
-BEGIN
-    "#include ""afxres.h""\r\n"
-    "\0"
-END
 
-3 TEXTINCLUDE DISCARDABLE 
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO DISCARDABLE
 BEGIN
-    "\r\n"
-    "\0"
+    IDD_DEBUG, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 179
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 88
+    END
 END
-
 #endif    // APSTUDIO_INVOKED
 
 
@@ -101,74 +114,106 @@ BEGIN
     CONTROL         "Update statsfile",IDC_UPDATESTATS,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,112,167,80,10
     LTEXT           "Statsfile name:",IDC_STATIC,20,185,52,8
-    EDITTEXT        IDC_STATSFILE,72,184,100,13,ES_AUTOHSCROLL | WS_TABSTOP
+    EDITTEXT        IDC_STATSFILE,72,184,100,13,ES_AUTOHSCROLL
     PUSHBUTTON      "...",IDC_STATSFILE_BROWSE,177,185,18,11
-    LTEXT           "Threads",IDC_THREADS,23,214,27,8
-    EDITTEXT        IDC_THREADEDIT,52,211,19,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Threads",IDC_THREADS,102,214,27,8
+    EDITTEXT        IDC_THREADEDIT,132,211,19,14,ES_AUTOHSCROLL | ES_NUMBER
+    PUSHBUTTON      "Debug",IDC_DEBUG,7,214,57,14
 END
 
-IDD_ADVANCED DIALOG DISCARDABLE  0, 0, 302, 306
+IDD_ADVANCED DIALOG DISCARDABLE  0, 0, 489, 247
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "x264 Advanced Settings"
 FONT 8, "MS Sans Serif"
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,245,290,50,14
-    GROUPBOX        "H.264 Features",IDC_STATIC,7,7,145,88
+    DEFPUSHBUTTON   "OK",IDOK,432,231,50,14
+    GROUPBOX        "H.264 Features",IDC_STATIC,7,7,145,91
     CONTROL         "CABAC",IDC_CABAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
-                    16,23,61,10
-    GROUPBOX        "",IDC_STATIC,12,39,113,28
+                    16,18,39,10
+    GROUPBOX        "",IDC_STATIC,12,36,136,40
     CONTROL         "Deblocking filter",IDC_LOOPFILTER,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,16,38,64,10
-    LTEXT           "Strength",IDC_STATIC,22,51,37,8
+                    BS_AUTOCHECKBOX | WS_TABSTOP,16,35,64,10
+    LTEXT           "Strength",IDC_STATIC,16,48,51,10,SS_CENTERIMAGE
     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_TABSTOP,71,48,50,10
+    LTEXT           "0",IDC_LOOPA_TXT,130,48,8,10,SS_CENTERIMAGE
+    LTEXT           "Max ref frames:",IDC_STATIC,16,80,52,14,SS_CENTERIMAGE
+    EDITTEXT        IDC_REFFRAMES,122,80,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    GROUPBOX        "B-frames",IDC_STATIC,7,98,290,36
+    LTEXT           "Max consecutive:",IDC_STATIC,16,116,60,8
+    EDITTEXT        IDC_BFRAME,80,113,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Direct mode:",IDC_STATIC,300,200,43,12,SS_CENTERIMAGE
+    COMBOBOX        IDC_DIRECTPRED,420,200,55,67,CBS_DROPDOWNLIST |
+                    WS_VSCROLL | WS_TABSTOP
+    COMBOBOX        IDC_SUBPEL,383,152,93,77,CBS_DROPDOWNLIST | CBS_SORT |
                     WS_VSCROLL | WS_TABSTOP
     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,107
-    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,210,288,73
+                    BS_LEFTTEXT | WS_TABSTOP,113,108,71,10
+    CONTROL         "Weighted biprediction",IDC_WBPRED,"Button",
+                    BS_AUTOCHECKBOX | WS_TABSTOP,165,168,82,12
+    GROUPBOX        "More Encoder Settings",IDC_STATIC,155,7,141,91
+    LTEXT           "Max IDR-frame interval:",IDC_STATIC,164,18,95,14,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_KEYINTMAX,262,18,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Min IDR-frame interval:",IDC_STATIC,164,36,90,14,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_KEYINTMIN,262,36,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    GROUPBOX        "Ratecontrol",IDC_STATIC,300,7,182,128
+    LTEXT           "Keyframe boost (%):",IDC_STATIC,362,18,68,14,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_IPRATIO,444,18,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "B-frames reduction (%):",IDC_STATIC,362,36,75,14,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_PBRATIO,444,36,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Bitrate variability (%):",IDC_STATIC,362,54,75,14,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_CURVECOMP,444,54,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    GROUPBOX        "Analysis:",IDC_STATIC,7,136,475,90
     CONTROL         "8x16, 16x8 and 8x8 P-frame search",IDC_P16X16,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,17,226,127,10
+                    BS_AUTOCHECKBOX | WS_TABSTOP,17,152,127,12
     CONTROL         "4x8, 8x4 and 4x4 P-frame search",IDC_P8X8,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,165,226,119,10
+                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,165,152,119,12
     CONTROL         "8x16, 16x8 and 8x8 B-frame search",IDC_B16X16,"Button",
-                    BS_AUTOCHECKBOX | WS_TABSTOP,17,242,127,10
+                    BS_AUTOCHECKBOX | BS_VCENTER | WS_TABSTOP,17,168,127,12
     CONTROL         "4x4 Intra search",IDC_I4X4,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,165,242,82,10
-    LTEXT           "Partition decision quality:",IDC_STATIC,128,263,80,8
-    COMBOBOX        IDC_SUBPEL,215,261,70,77,CBS_DROPDOWNLIST | CBS_SORT | 
-                    WS_VSCROLL | WS_TABSTOP
-    EDITTEXT        IDC_SAR_W,84,170,21,14,ES_AUTOHSCROLL | ES_NUMBER
-    EDITTEXT        IDC_SAR_H,118,170,21,14,ES_AUTOHSCROLL | ES_NUMBER
-    LTEXT           "Pixel Aspect Ratio",IDC_STATIC,16,172,58,8
-    LTEXT           ":",IDC_STATIC,109,172,8,8
+                    WS_TABSTOP,165,184,82,12
+    LTEXT           "Partition decision quality:",IDC_STATIC,300,152,80,12,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_SAR_W,232,79,21,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_SAR_H,266,79,21,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Pixel Aspect Ratio",IDC_STATIC,164,79,58,14,
+                    SS_CENTERIMAGE
+    LTEXT           ":",IDC_STATIC,257,81,8,8
     CONTROL         "8x8 Intra search",IDC_I8X8,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,17,257,67,10
+                    BS_VCENTER | WS_TABSTOP,17,184,67,12
     CONTROL         "8x8 DCT",IDC_DCT8X8,"Button",BS_AUTOCHECKBOX | 
-                    WS_TABSTOP,17,270,44,10
+                    WS_TABSTOP,17,200,44,12
+    LTEXT           "ME Method",IDC_STATIC,300,168,38,12,SS_CENTERIMAGE
+    CONTROL         "Chroma ME",IDC_CHROMAME,"Button",BS_AUTOCHECKBOX |
+                    WS_TABSTOP,165,200,53,12
+    LTEXT           "ME Range",IDC_STATIC,300,184,35,12,SS_CENTERIMAGE
+    EDITTEXT        IDC_MERANGE,384,184,24,14,ES_AUTOHSCROLL | ES_NUMBER
+    COMBOBOX        IDC_ME_METHOD,384,168,92,67,CBS_DROPDOWNLIST |
+                    WS_VSCROLL | WS_TABSTOP
+    CONTROL         "Adaptive",IDC_BADAPT,"Button",BS_AUTOCHECKBOX |
+                    BS_LEFTTEXT | WS_TABSTOP,141,120,43,10
+    LTEXT           "Bias",IDC_STATIC,227,119,14,10,SS_CENTERIMAGE
+    CONTROL         "Slider1",IDC_BBIASSLIDER,"msctls_trackbar32",TBS_BOTH |
+                    TBS_NOTICKS | WS_TABSTOP,215,106,73,10
+    EDITTEXT        IDC_BBIAS,255,117,29,14,ES_AUTOHSCROLL
+    LTEXT           "Min QP",IDC_STATIC,362,72,24,14,SS_CENTERIMAGE
+    LTEXT           "Max QP",IDC_STATIC,362,90,26,14,SS_CENTERIMAGE
+    LTEXT           "Max QP Step",IDC_STATIC,362,108,43,14,SS_CENTERIMAGE
+    EDITTEXT        IDC_QPMIN,444,72,25,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_QPMAX,444,90,25,14,ES_AUTOHSCROLL
+    EDITTEXT        IDC_QPSTEP,444,108,25,14,ES_AUTOHSCROLL
+    CONTROL         "Slider2",IDC_INLOOP_B,"msctls_trackbar32",TBS_NOTICKS |
+                    WS_TABSTOP,71,62,50,10
+    LTEXT           "Threshold",IDC_STATIC,16,62,48,10,SS_CENTERIMAGE
+    LTEXT           "0",IDC_LOOPB_TXT,130,62,8,10
+    LTEXT           "Scene Cut Threshold",IDC_STATIC,164,52,68,14,
+                    SS_CENTERIMAGE
+    EDITTEXT        IDC_SCENECUT,262,54,25,14,ES_AUTOHSCROLL
 END
 
 IDD_ABOUT DIALOG DISCARDABLE  0, 0, 213, 130
@@ -178,22 +223,24 @@ FONT 8, "MS Sans Serif"
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,158,109,48,14
     CTEXT           "Copyright 2005 Laurent Aimar, Justin Clay, Min Chen,\nEric Petit, Måns Rullgård, Loren Merritt\n\nThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation",
-                    IDC_STATIC,7,47,199,51 
+                    IDC_STATIC,7,47,199,51
     PUSHBUTTON      "Visit Homepage",IDC_HOMEPAGE,7,109,77,14
-    CTEXT           "BUILD",IDC_BUILD,34,20,145,8,SS_CENTERIMAGE
-    LTEXT           "x264 - H.264/MPEG-4 AVC codec",IDC_X264,53,8,145,8,SS_CENTERIMAGE
+    CTEXT           "BUILD",IDC_BUILD,13,20,173,8,SS_CENTERIMAGE
+    LTEXT           "x264 - H.264/MPEG-4 AVC codec",IDC_X264,53,8,145,8,
+                    SS_CENTERIMAGE
 END
 
 IDD_ERRCONSOLE DIALOG DISCARDABLE  0, 0, 264, 130
-STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_VISIBLE
+STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
 CAPTION "x264 error console"
 FONT 8, "MS Sans Serif"
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,68,110,48,14,WS_TABSTOP
-    DEFPUSHBUTTON   "Copy",IDC_COPYCLIP,148,110,48,14,WS_TABSTOP
-    LISTBOX         IDC_CONSOLE,6,8,251,95,LBS_NOSEL | LBS_NOINTEGRALHEIGHT
+    DEFPUSHBUTTON   "OK",IDOK,68,110,48,14
+    DEFPUSHBUTTON   "Copy",IDC_COPYCLIP,148,110,48,14
+    LISTBOX         IDC_CONSOLE,6,8,251,95,LBS_NOINTEGRALHEIGHT | LBS_NOSEL
 END
 
+
 /////////////////////////////////////////////////////////////////////////////
 //
 // DESIGNINFO
@@ -213,9 +260,9 @@ BEGIN
     IDD_ADVANCED, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 295
+        RIGHTMARGIN, 482
         TOPMARGIN, 7
-        BOTTOMMARGIN, 290
+        BOTTOMMARGIN, 231
     END
 
     IDD_ABOUT, DIALOG
@@ -228,6 +275,32 @@ BEGIN
 END
 #endif    // APSTUDIO_INVOKED
 
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+    "#include ""afxres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
 #endif    // English (Canada) resources
 /////////////////////////////////////////////////////////////////////////////
 
index 5230091..68e408e 100644 (file)
@@ -50,6 +50,10 @@ typedef struct
     int i_refmax;
     int i_keyint_max;
     int i_keyint_min;
+    int i_scenecut_threshold;
+    int i_qp_min;
+    int i_qp_max;
+    int i_qp_step;
 
     int i_qp;
     int b_filter;
@@ -65,13 +69,19 @@ typedef struct
 
     int i_bframe;
     int i_subpel_refine;
+    int i_me_method;
+    int i_me_range;
+    int b_chroma_me;
     int i_direct_mv_pred;
     int i_threads;
 
     int i_inloop_a;
+    int i_inloop_b;
 
     int b_b_refs;
     int b_b_wpred;
+    int i_bframe_bias;
+    int b_bframe_adaptive;
 
     int i_key_boost;
     int i_b_red;
@@ -80,6 +90,8 @@ typedef struct
     int i_sar_width;
     int i_sar_height;
 
+    int i_log_level;
+
     /* vfw interface */
     int b_save;
     /* fourcc used */
@@ -121,6 +133,7 @@ void config_reg_save( CONFIG * config );
 
 /* Dialog callbacks */
 BOOL CALLBACK callback_about( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
+BOOL CALLBACK callback_debug( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
 BOOL CALLBACK callback_main ( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
 BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );
 BOOL CALLBACK callback_err_console( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam );