From 9b47cb08b5ecf9a38ba82f299304c95c178f4690 Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Fri, 21 May 2010 10:33:45 +0400 Subject: [PATCH] Fix different output with differing sync-lookahead Also reduce memory consumption. --- encoder/encoder.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index c72114b7..de062515 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -603,8 +603,9 @@ static int x264_validate_parameters( x264_t *h ) if( h->param.rc.b_stat_read ) h->param.rc.i_lookahead = 0; #ifdef HAVE_PTHREAD - if( h->param.i_sync_lookahead ) - h->param.i_sync_lookahead = x264_clip3( h->param.i_sync_lookahead, h->i_thread_frames + h->param.i_bframe, X264_LOOKAHEAD_MAX ); + if( h->param.i_sync_lookahead < 0 ) + h->param.i_sync_lookahead = h->param.i_bframe + 1; + h->param.i_sync_lookahead = X264_MIN( h->param.i_sync_lookahead, X264_LOOKAHEAD_MAX ); if( h->param.rc.b_stat_read || h->i_thread_frames == 1 ) h->param.i_sync_lookahead = 0; #else @@ -937,7 +938,6 @@ x264_t *x264_encoder_open( x264_param_t *param ) h->frames.i_delay = X264_MAX( h->frames.i_delay, h->param.rc.i_lookahead ); i_slicetype_length = h->frames.i_delay; h->frames.i_delay += h->i_thread_frames - 1; - h->frames.i_delay = X264_MIN( h->frames.i_delay, X264_LOOKAHEAD_MAX ); h->frames.i_delay += h->param.i_sync_lookahead; h->frames.i_delay += h->param.b_vfr_input && (h->param.rc.i_rc_method == X264_RC_ABR || h->param.rc.b_stat_write || h->param.rc.i_vbv_buffer_size); -- 2.47.3