From 81e75e91cad61079ce9579d133316b1faf78f357 Mon Sep 17 00:00:00 2001 From: Jason Garrett-Glaser Date: Wed, 26 May 2010 12:40:31 -0700 Subject: [PATCH] Fix 10L in r1612 Stats need to be calculated before deblock strength, not after. Broke ref stats in x264cli (no affect on actual output). --- encoder/encoder.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index ea14cefc..52017ff0 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -1893,19 +1893,6 @@ static int x264_slice_write( x264_t *h ) /* save cache */ x264_macroblock_cache_save( h ); - /* calculate deblock strength values (actual deblocking is done per-row along with hpel) */ - if( b_deblock ) - { - int mvy_limit = 4 >> h->sh.b_mbaff; - uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&h->sh.b_mbaff][h->mb.i_mb_x]; - x264_macroblock_cache_load_deblock( h ); - if( IS_INTRA( h->mb.type[h->mb.i_mb_xy] ) ) - memset( bs, 3, 2*4*4*sizeof(uint8_t) ); - else - h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv, - bs, mvy_limit, h->sh.i_type == SLICE_TYPE_B ); - } - /* accumulate mb stats */ h->stat.frame.i_mb_count[h->mb.i_type]++; @@ -1959,6 +1946,19 @@ static int x264_slice_write( x264_t *h ) } } + /* calculate deblock strength values (actual deblocking is done per-row along with hpel) */ + if( b_deblock ) + { + int mvy_limit = 4 >> h->sh.b_mbaff; + uint8_t (*bs)[4][4] = h->deblock_strength[h->mb.i_mb_y&h->sh.b_mbaff][h->mb.i_mb_x]; + x264_macroblock_cache_load_deblock( h ); + if( IS_INTRA( h->mb.type[h->mb.i_mb_xy] ) ) + memset( bs, 3, 2*4*4*sizeof(uint8_t) ); + else + h->loopf.deblock_strength( h->mb.cache.non_zero_count, h->mb.cache.ref, h->mb.cache.mv, + bs, mvy_limit, h->sh.i_type == SLICE_TYPE_B ); + } + x264_ratecontrol_mb( h, mb_size ); if( h->sh.b_mbaff ) -- 2.47.3