threads option in vfw.
authorLoren Merritt <pengvado@videolan.org>
Sat, 11 Jun 2005 20:32:22 +0000 (20:32 +0000)
committerLoren Merritt <pengvado@videolan.org>
Sat, 11 Jun 2005 20:32:22 +0000 (20:32 +0000)
patch by celtic_druid.

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

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

index b6c623b..c015dd9 100644 (file)
@@ -197,6 +197,8 @@ 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.pf_log = x264_log_vfw;
index 4ad2f8f..7bd7d97 100644 (file)
@@ -81,6 +81,7 @@ static const reg_int_t reg_int_table[] =
     { "pass_number",    &reg.i_pass,            1 },
     { "fast1pass",      &reg.b_fast1pass,       1 },
     { "updatestats",    &reg.b_updatestats,     1 },
+    { "threads",        &reg.i_threads,         1 },
 
     /* Advance dialog */
     { "cabac",          &reg.b_cabac,           1 },
@@ -276,6 +277,7 @@ static void main_update_dlg( HWND hDlg, CONFIG * config )
     SetDlgItemInt( hDlg, IDC_QUANTEDIT, config->i_qp, FALSE );
     SetDlgItemInt( hDlg, IDC_2PASSBITRATE, config->i_2passbitrate, FALSE );
     SetDlgItemText( hDlg, IDC_STATSFILE, config->stats );
+    SetDlgItemInt( hDlg, IDC_THREADEDIT, config->i_threads, FALSE );
 
     switch( config->i_encoding_type )
     {
@@ -419,6 +421,19 @@ BOOL CALLBACK callback_main( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam
         case EN_CHANGE :
             switch( LOWORD( wParam ) )
             {
+            case IDC_THREADEDIT :
+                config->i_threads = GetDlgItemInt( hDlg, IDC_THREADEDIT, FALSE, FALSE );
+                if (config->i_threads < 1)
+                {
+                    config->i_threads = 1;
+                    SetDlgItemInt( hDlg, IDC_THREADEDIT, config->i_threads, FALSE );
+                }
+                else if (config->i_threads > 4)
+                {
+                    config->i_threads = 4;
+                    SetDlgItemInt( hDlg, IDC_THREADEDIT, config->i_threads, FALSE );
+                }                        
+                break;
             case IDC_BITRATEEDIT :
                 config->bitrate = GetDlgItemInt( hDlg, IDC_BITRATEEDIT, FALSE, FALSE );
                 SendDlgItemMessage( hDlg, IDC_BITRATESLIDER, TBM_SETPOS, TRUE, config->bitrate );
index c4c5f27..0771ea0 100644 (file)
@@ -66,6 +66,8 @@
 #define IDC_COPYCLIP                    1057
 #define IDC_BREFS                       1058
 #define IDC_WBPRED                      1059
+#define IDC_THREADS                     1060
+#define IDC_THREADEDIT                  1061
 
 // Next default values for new objects
 // 
@@ -73,7 +75,7 @@
 #ifndef APSTUDIO_READONLY_SYMBOLS
 #define _APS_NEXT_RESOURCE_VALUE        105
 #define _APS_NEXT_COMMAND_VALUE         40001
-#define _APS_NEXT_CONTROL_VALUE         1060
+#define _APS_NEXT_CONTROL_VALUE         1062
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif
index 45d7f8b..43efd98 100644 (file)
@@ -55,13 +55,13 @@ END
 // Dialog
 //
 
-IDD_MAINCONFIG DIALOG DISCARDABLE  0, 0, 225, 231
+IDD_MAINCONFIG DIALOG DISCARDABLE  0, 0, 225, 253
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "x264 Configuration"
 FONT 8, "MS Sans Serif"
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,120,210,46,14
-    PUSHBUTTON      "Cancel",IDCANCEL,168,210,50,14
+    DEFPUSHBUTTON   "OK",IDOK,120,232,46,14
+    PUSHBUTTON      "Cancel",IDCANCEL,168,232,50,14
     CONTROL         "Slider1",IDC_BITRATESLIDER,"msctls_trackbar32",TBS_BOTH | 
                     TBS_NOTICKS | WS_TABSTOP,13,31,175,15
     EDITTEXT        IDC_BITRATEEDIT,189,32,26,14,ES_AUTOHSCROLL | ES_NUMBER
@@ -69,8 +69,8 @@ BEGIN
     GROUPBOX        "",IDC_STATIC,7,7,211,47
     LTEXT           "0",IDC_BITRATELOW,16,20,22,8
     LTEXT           "5000",IDC_BITRATEHIGH,166,20,17,8
-    PUSHBUTTON      "Load Defaults",IDC_DEFAULTS,7,210,57,14
-    PUSHBUTTON      "Advanced",IDC_ADVANCED,67,210,49,14
+    PUSHBUTTON      "Load Defaults",IDC_DEFAULTS,7,232,57,14
+    PUSHBUTTON      "Advanced",IDC_ADVANCED,67,232,49,14
     CONTROL         "Slider1",IDC_QUANTSLIDER,"msctls_trackbar32",TBS_BOTH | 
                     TBS_NOTICKS | WS_TABSTOP,13,81,175,15
     EDITTEXT        IDC_QUANTEDIT,189,82,26,14,ES_AUTOHSCROLL | ES_NUMBER
@@ -103,6 +103,8 @@ BEGIN
     LTEXT           "Statsfile name:",IDC_STATIC,20,185,52,8
     EDITTEXT        IDC_STATSFILE,72,184,100,13,ES_AUTOHSCROLL | WS_TABSTOP
     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
 END
 
 IDD_ADVANCED DIALOG DISCARDABLE  0, 0, 302, 267
@@ -197,7 +199,7 @@ BEGIN
         LEFTMARGIN, 7
         RIGHTMARGIN, 218
         TOPMARGIN, 7
-        BOTTOMMARGIN, 224
+        BOTTOMMARGIN, 246
     END
 
     IDD_ADVANCED, DIALOG
index 2fb24bf..0e73da8 100644 (file)
@@ -64,6 +64,7 @@ typedef struct
     int i_bframe;
     int i_subpel_refine;
     int i_direct_mv_pred;
+    int i_threads;
 
     int i_inloop_a;