]> granicus.if.org Git - libx264/commitdiff
oops, scenecut detection failed to activate when using threads and not using B-frames
authorLoren Merritt <pengvado@videolan.org>
Thu, 22 Feb 2007 05:01:38 +0000 (05:01 +0000)
committerLoren Merritt <pengvado@videolan.org>
Thu, 22 Feb 2007 05:01:38 +0000 (05:01 +0000)
git-svn-id: svn://svn.videolan.org/x264/trunk@623 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/encoder.c
encoder/slicetype.c

index 9ebef483a8c2afcb4a0d69b27aa904fb65795876..e247e1e36558f9e7b7161b57d08c92f24f6f79aa 100644 (file)
@@ -431,6 +431,8 @@ static int x264_validate_parameters( x264_t *h )
     h->mb.b_direct_auto_write = h->param.analyse.i_direct_mv_pred == X264_DIRECT_PRED_AUTO
                                 && h->param.i_bframe
                                 && ( h->param.rc.b_stat_write || !h->param.rc.b_stat_read );
+    if( h->param.i_scenecut_threshold < 0 )
+        h->param.b_pre_scenecut = 0;
 
     h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 );
     h->param.i_deblocking_filter_beta    = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 );
@@ -635,7 +637,8 @@ x264_t *x264_encoder_open   ( x264_param_t *param )
     h->frames.b_have_lowres = !h->param.rc.b_stat_read
         && ( h->param.rc.i_rc_method == X264_RC_ABR
           || h->param.rc.i_rc_method == X264_RC_CRF
-          || h->param.b_bframe_adaptive );
+          || h->param.b_bframe_adaptive
+          || h->param.b_pre_scenecut );
 
     h->frames.i_last_idr = - h->param.i_keyint_max;
     h->frames.i_input    = 0;
@@ -720,7 +723,8 @@ int x264_encoder_reconfig( x264_t *h, x264_param_t *param )
 #define COPY(var) h->param.var = param->var
     COPY( i_frame_reference ); // but never uses more refs than initially specified
     COPY( i_bframe_bias );
-    COPY( i_scenecut_threshold );
+    if( h->param.i_scenecut_threshold >= 0 && param->i_scenecut_threshold >= 0 )
+        COPY( i_scenecut_threshold ); // can't turn it on or off, only vary the threshold
     COPY( b_deblocking_filter );
     COPY( i_deblocking_filter_alphac0 );
     COPY( i_deblocking_filter_beta );
index c8685b92f4d0c73e9a84e15f133a20a68b21192f..d3e1194ee9190a4f8213e42754296b6ac4bdab6a 100644 (file)
@@ -373,6 +373,8 @@ void x264_slicetype_analyse( x264_t *h )
     int cost1p0, cost2p0, cost1b1, cost2p1;
     int idr_frame_type;
 
+    assert( h->frames.b_have_lowres );
+
     if( !h->frames.last_nonb )
         return;
     frames[0] = h->frames.last_nonb;
@@ -390,7 +392,7 @@ void x264_slicetype_analyse( x264_t *h )
     {
 no_b_frames:
         frames[1]->i_type = X264_TYPE_P;
-        if( h->param.b_pre_scenecut && h->param.i_scenecut_threshold >= 0 )
+        if( h->param.b_pre_scenecut )
         {
             x264_slicetype_frame_cost( h, &a, frames, 0, 1, 1, 0 );
             if( scenecut( h, frames[1], 1 ) )
@@ -449,7 +451,8 @@ void x264_slicetype_decide( x264_t *h )
             h->frames.next[i]->i_type =
                 x264_ratecontrol_slice_type( h, h->frames.next[i]->i_frame );
     }
-    else if( h->param.i_bframe && h->param.b_bframe_adaptive )
+    else if( (h->param.i_bframe && h->param.b_bframe_adaptive)
+             || h->param.b_pre_scenecut )
         x264_slicetype_analyse( h );
 
     for( bframes = 0;; bframes++ )