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 );
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;
#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 );
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;
{
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 ) )
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++ )