]> granicus.if.org Git - libx264/commitdiff
VfW: Support ip_factor and pb_factor, some cleanups.
authorLoren Merritt <pengvado@videolan.org>
Mon, 17 Jan 2005 04:29:24 +0000 (04:29 +0000)
committerLoren Merritt <pengvado@videolan.org>
Mon, 17 Jan 2005 04:29:24 +0000 (04:29 +0000)
patch by Riccardo Stievano <walkunafraid at tin dot it>

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

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

index 55b0ba6de66ec052a0c06adc3a0bab942b6e8434..e2d2ef184e1eb9f89c9e1b0841ca622ea7c393d2 100644 (file)
@@ -158,9 +158,11 @@ 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_keyint_max = config->i_keyint_max;
     param.b_deblocking_filter = config->b_filter;
     param.b_cabac = config->b_cabac;
+    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.i_bframe = config->i_bframe;
     param.analyse.i_subpel_refine = config->i_subpel_refine + 1; /* 0..4 -> 1..5 */
index 0fcdfc62aeb92f662b5cd3e1baf4c96f7e117237..d6a65cdfde11d02b67def329a360b14dd9cbdb1a 100644 (file)
@@ -84,6 +84,8 @@ static const reg_int_t reg_int_table[] =
     {"direct_pred",     &reg.i_direct_mv_pred,  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 },
 
     /* analysis */
     {"i4x4",            &reg.b_i4x4,            1 },
@@ -472,10 +474,12 @@ static void adv_update_dlg( HWND hDlg, CONFIG * config )
     CheckDlgButton( hDlg,IDC_I4X4,
                     config->b_i4x4 ? BST_CHECKED: BST_UNCHECKED );
 
-    SetDlgItemInt( hDlg, IDC_IDRFRAMES, config->i_keyint_min, FALSE );
-    SetDlgItemInt( hDlg, IDC_IFRAMES, config->i_keyint_max, FALSE );
-    SetDlgItemInt( hDlg, IDC_KEYFRAME, config->i_refmax, FALSE );
+    SetDlgItemInt( hDlg, IDC_KEYINTMIN, config->i_keyint_min, FALSE );
+    SetDlgItemInt( hDlg, IDC_KEYINTMAX, config->i_keyint_max, FALSE );
+    SetDlgItemInt( hDlg, IDC_REFFRAMES, config->i_refmax, FALSE );
     SetDlgItemInt( hDlg, IDC_BFRAME, config->i_bframe, FALSE );
+    SetDlgItemInt( hDlg, IDC_IPRATIO, config->i_key_boost, FALSE );
+    SetDlgItemInt( hDlg, IDC_PBRATIO, config->i_b_red, FALSE );
 
     SendDlgItemMessage(hDlg, IDC_DIRECTPRED, CB_SETCURSEL, (config->i_direct_mv_pred), 0);
     SendDlgItemMessage(hDlg, IDC_SUBPEL, CB_SETCURSEL, (config->i_subpel_refine), 0);
@@ -548,14 +552,14 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
         case EN_CHANGE :
             switch( LOWORD( wParam ) )
             {
-            case IDC_IDRFRAMES :
-                config->i_keyint_min = GetDlgItemInt( hDlg, IDC_IDRFRAMES, FALSE, FALSE );
+            case IDC_KEYINTMIN :
+                config->i_keyint_min = GetDlgItemInt( hDlg, IDC_KEYINTMIN, FALSE, FALSE );
                 break;
-            case IDC_IFRAMES :
-                config->i_keyint_max = GetDlgItemInt( hDlg, IDC_IFRAMES, FALSE, FALSE );
+            case IDC_KEYINTMAX :
+                config->i_keyint_max = GetDlgItemInt( hDlg, IDC_KEYINTMAX, FALSE, FALSE );
                 break;
-            case IDC_KEYFRAME :
-                config->i_refmax = GetDlgItemInt( hDlg, IDC_KEYFRAME, FALSE, FALSE );
+            case IDC_REFFRAMES :
+                config->i_refmax = GetDlgItemInt( hDlg, IDC_REFFRAMES, FALSE, FALSE );
                 break;
             case IDC_FOURCC :
                 GetDlgItemText( hDlg, IDC_FOURCC, config->fcc, 5 );
@@ -563,6 +567,32 @@ BOOL CALLBACK callback_advanced( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lPa
             case IDC_BFRAME :
                 config->i_bframe = GetDlgItemInt( hDlg, IDC_BFRAME, FALSE, FALSE );
                 break;
+            case IDC_IPRATIO :
+                config->i_key_boost = GetDlgItemInt( hDlg, IDC_IPRATIO, FALSE, FALSE );
+                if (config->i_key_boost < 0)
+                {
+                    config->i_key_boost = 0;
+                    SetDlgItemInt( hDlg, IDC_IPRATIO, config->i_key_boost, FALSE );
+                }
+                else if (config->i_key_boost > 60)
+                {
+                    config->i_key_boost = 60;
+                    SetDlgItemInt( hDlg, IDC_IPRATIO, config->i_key_boost, FALSE );
+                }                        
+                break;
+            case IDC_PBRATIO :
+                config->i_b_red = GetDlgItemInt( hDlg, IDC_PBRATIO, FALSE, FALSE );
+                if (config->i_b_red < 0)
+                {
+                    config->i_b_red = 0;
+                    SetDlgItemInt( hDlg, IDC_PBRATIO, config->i_b_red, FALSE );
+                }
+                else if (config->i_b_red > 50)
+                {
+                    config->i_b_red = 50;
+                    SetDlgItemInt( hDlg, IDC_PBRATIO, config->i_b_red, FALSE );
+                }                        
+                break;
             }
             break;
             case LBN_SELCHANGE :
index 089adb1f0f8e81c63b7c9ae15fb4f8454a2b4f80..c7909471dfb92f9f389bf4c85b3bd700509db18a 100644 (file)
 #define IDC_BITRATEHIGH                 1011
 #define IDC_BFRAMES                     1012
 #define IDC_BITRATEHIGH2                1012
-#define IDC_IDRFRAMES                   1012
+#define IDC_KEYINTMIN                   1012
 #define IDC_BFRAMES2                    1013
-#define IDC_IFRAMES                     1013
+#define IDC_KEYINTMAX                   1013
 #define IDC_BITRATELOW3                 1013
 #define IDC_EDIT3                       1014
-#define IDC_KEYFRAME                    1014
+#define IDC_REFFRAMES                   1014
 #define IDC_BITRATEHIGH3                1014
 #define IDC_BFRAME                      1015
 #define IDC_DEFAULTS                    1016
@@ -57,6 +57,8 @@
 #define IDC_LOOPA_TXT                   1047
 #define IDC_LOOPB_TXT                   1048
 #define IDC_FAST1PASS                   1049
+#define IDC_IPRATIO                     1050
+#define IDC_PBRATIO                     1051
 
 // Next default values for new objects
 // 
@@ -64,7 +66,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        104
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1050
+#define _APS_NEXT_CONTROL_VALUE         1052
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index b0f93bf3ba0443b5c31aeeccc841090063c4c2c9..4f6f088b977aa040c9a6955a1319609a802aa06c 100644 (file)
@@ -107,15 +107,19 @@ BEGIN
     DEFPUSHBUTTON   "OK",IDOK,245,237,50,14
     CONTROL         "CABAC",IDC_CABAC,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
                     16,23,61,10
-    EDITTEXT        IDC_IDRFRAMES,68,126,22,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_KEYINTMIN,68,126,22,14,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "Intra closer than",IDC_STATIC,13,128,53,8
     GROUPBOX        "H.264 features",IDC_STATIC,7,7,288,228
-    EDITTEXT        IDC_KEYFRAME,255,20,33,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_REFFRAMES,255,20,33,14,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "Max Reference Frames:",IDC_STATIC,170,24,80,8
-    EDITTEXT        IDC_IFRAMES,114,107,24,14,ES_AUTOHSCROLL | ES_NUMBER
+    EDITTEXT        IDC_KEYINTMAX,114,107,24,14,ES_AUTOHSCROLL | ES_NUMBER
     LTEXT           "Max IDR-Keyframe Interval:",IDC_STATIC,13,110,95,8
-    EDITTEXT        IDC_FOURCC,223,107,25,14,ES_AUTOHSCROLL
-    LTEXT           "FourCC:",IDC_STATIC,193,110,26,8
+    EDITTEXT        IDC_IPRATIO,258,99,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "Keyframe boost (%):",IDC_STATIC,188,102,68,8
+    EDITTEXT        IDC_PBRATIO,258,119,25,14,ES_AUTOHSCROLL | ES_NUMBER
+    LTEXT           "B-frames reduction (%):",IDC_STATIC,178,122,75,8
+    EDITTEXT        IDC_FOURCC,258,139,25,14,ES_AUTOHSCROLL
+    LTEXT           "FourCC:",IDC_STATIC,224,142,26,8
     CONTROL         "8x16, 16x8 and 8x8 B-frame search",IDC_B16X16,"Button",
                     BS_AUTOCHECKBOX | WS_TABSTOP,17,189,127,10
     EDITTEXT        IDC_BFRAME,256,40,33,14,ES_AUTOHSCROLL | ES_NUMBER
@@ -129,7 +133,7 @@ BEGIN
     COMBOBOX        IDC_SUBPEL,117,208,70,77,CBS_DROPDOWN | CBS_SORT | 
                     WS_VSCROLL | WS_TABSTOP
     LTEXT           "Subpixel refinement precision",IDC_STATIC,17,211,92,8
-    COMBOBOX        IDC_DIRECTPRED,220,63,70,67,CBS_DROPDOWN | CBS_SORT | 
+    COMBOBOX        IDC_DIRECTPRED,220,63,70,67,CBS_DROPDOWNLIST | CBS_SORT | 
                     WS_VSCROLL | WS_TABSTOP
     LTEXT           "B-frame prediction mode:",IDC_STATIC,133,65,84,8
     CONTROL         "Slider1",IDC_INLOOP_A,"msctls_trackbar32",TBS_NOTICKS | 
@@ -141,8 +145,7 @@ BEGIN
     LTEXT           "Strength (B)",IDC_STATIC,15,66,39,8
     LTEXT           "frames are coded as non-IDR",IDC_STATIC,93,128,
                     60,16
-    GROUPBOX        "More Encoder Settings",IDC_STATIC,7,93,145,66
-    GROUPBOX        "VfW settings",IDC_STATIC,151,93,144,66
+    GROUPBOX        "More Encoder Settings",IDC_STATIC,7,88,288,71
     LTEXT           "0",IDC_LOOPA_TXT,109,53,8,8
     LTEXT           "0",IDC_LOOPB_TXT,109,66,8,8
     GROUPBOX        "Macroblock Partitions",IDC_STATIC,7,154,288,81
@@ -156,11 +159,11 @@ CAPTION "About x264"
 FONT 8, "MS Sans Serif"
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,158,109,48,14
-    CTEXT           "Copyright 2004 Laurent Aimar, Justin Clay, Min Chen\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
+    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 
     PUSHBUTTON      "Visit Homepage",IDC_HOMEPAGE,7,109,77,14
-    CTEXT           "BUILD",IDC_BUILD,40,18,122,8,SS_CENTERIMAGE
-    LTEXT           "x264 H.264 Codec",IDC_X264,68,8,66,8,SS_CENTERIMAGE
+    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
 END
 
 
index 9c2bf5c05d52a92dd14c0501d0f60761689d48c1..7d63f7e06406d84e3e05536b5b2a5ca8ef3831a7 100644 (file)
@@ -66,6 +66,9 @@ typedef struct
 
     int i_inloop_a;
     int i_inloop_b;
+    
+    int i_key_boost;
+    int i_b_red;
 
     /* vfw interface */
     int b_save;