From: Jason Garrett-Glaser Date: Sat, 24 Apr 2010 20:55:51 +0000 (-0700) Subject: Don't calculate ref/partition stats if not necessary X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=dffb848b6b36dd9fd811dae9f2e1f6e9b99065f1;p=x264.git Don't calculate ref/partition stats if not necessary --- diff --git a/encoder/encoder.c b/encoder/encoder.c index 3370eb45..244acfde 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1885,24 +1885,27 @@ static int x264_slice_write( x264_t *h ) x264_macroblock_cache_save( h ); /* accumulate mb stats */ - h->stat.frame.i_mb_count[h->mb.i_type]++; int b_intra = IS_INTRA( h->mb.i_type ); - if( !b_intra && !IS_SKIP( h->mb.i_type ) && !IS_DIRECT( h->mb.i_type ) ) + if( h->param.i_log_level >= X264_LOG_INFO || h->param.rc.b_stat_write ) { - if( h->mb.i_partition != D_8x8 ) - h->stat.frame.i_mb_partition[h->mb.i_partition] += 4; - else - for( int i = 0; i < 4; i++ ) - h->stat.frame.i_mb_partition[h->mb.i_sub_partition[i]] ++; - if( h->param.i_frame_reference > 1 ) - for( int i_list = 0; i_list <= (h->sh.i_type == SLICE_TYPE_B); i_list++ ) - for( int i = 0; i < 4; i++ ) - { - int i_ref = h->mb.cache.ref[i_list][ x264_scan8[4*i] ]; - if( i_ref >= 0 ) - h->stat.frame.i_mb_count_ref[i_list][i_ref] ++; - } + h->stat.frame.i_mb_count[h->mb.i_type]++; + if( !b_intra && !IS_SKIP( h->mb.i_type ) && !IS_DIRECT( h->mb.i_type ) ) + { + if( h->mb.i_partition != D_8x8 ) + h->stat.frame.i_mb_partition[h->mb.i_partition] += 4; + else + for( int i = 0; i < 4; i++ ) + h->stat.frame.i_mb_partition[h->mb.i_sub_partition[i]] ++; + if( h->param.i_frame_reference > 1 ) + for( int i_list = 0; i_list <= (h->sh.i_type == SLICE_TYPE_B); i_list++ ) + for( int i = 0; i < 4; i++ ) + { + int i_ref = h->mb.cache.ref[i_list][ x264_scan8[4*i] ]; + if( i_ref >= 0 ) + h->stat.frame.i_mb_count_ref[i_list][i_ref] ++; + } + } } if( h->param.i_log_level >= X264_LOG_INFO )