From: Fiona Glaser Date: Sat, 26 Apr 2008 02:43:57 +0000 (-0600) Subject: compute missing nnz count in subme7 cavlc X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79f03a3ba1fa908b9044845d8b52b376997c74e9;p=libx264 compute missing nnz count in subme7 cavlc --- diff --git a/encoder/cavlc.c b/encoder/cavlc.c index 6ccbfdbb..54bc567e 100644 --- a/encoder/cavlc.c +++ b/encoder/cavlc.c @@ -282,18 +282,17 @@ static inline void x264_macroblock_luma_write_cavlc( x264_t *h, bs_t *s, int i8s for( i8 = i8start; i8 <= i8end; i8++ ) if( h->mb.i_cbp_luma & (1 << i8) ) for( i4 = 0; i4 < 4; i4++ ) - { for( i = 0; i < 16; i++ ) h->dct.luma4x4[i4+i8*4][i] = h->dct.luma8x8[i8][i4+i*4]; - h->mb.cache.non_zero_count[x264_scan8[i4+i8*4]] = - array_non_zero_count( h->dct.luma4x4[i4+i8*4], 16 ); - } } for( i8 = i8start; i8 <= i8end; i8++ ) if( h->mb.i_cbp_luma & (1 << i8) ) for( i4 = 0; i4 < 4; i4++ ) + { + h->mb.cache.non_zero_count[x264_scan8[i4+i8*4]] = array_non_zero_count( h->dct.luma4x4[i4+i8*4], 16 ); block_residual_write_cavlc( h, s, i4+i8*4, h->dct.luma4x4[i4+i8*4], 16 ); + } } /***************************************************************************** @@ -646,7 +645,10 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s ) /* AC Luma */ if( h->mb.i_cbp_luma != 0 ) for( i = 0; i < 16; i++ ) + { + h->mb.cache.non_zero_count[x264_scan8[i]] = array_non_zero_count( h->dct.luma4x4[i]+1, 15 ); block_residual_write_cavlc( h, s, i, h->dct.luma4x4[i]+1, 15 ); + } } else if( h->mb.i_cbp_luma != 0 || h->mb.i_cbp_chroma != 0 ) { @@ -660,7 +662,10 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s ) block_residual_write_cavlc( h, s, BLOCK_INDEX_CHROMA_DC, h->dct.chroma_dc[1], 4 ); if( h->mb.i_cbp_chroma&0x02 ) /* Chroma AC residual present */ for( i = 16; i < 24; i++ ) + { + h->mb.cache.non_zero_count[x264_scan8[i]] = array_non_zero_count( h->dct.luma4x4[i]+1, 15 ); block_residual_write_cavlc( h, s, i, h->dct.luma4x4[i]+1, 15 ); + } } #ifndef RDO_SKIP_BS @@ -725,10 +730,10 @@ int x264_partition_size_cavlc( x264_t *h, int i8, int i_pixel ) for( j = (i_pixel < PIXEL_8x8); j >= 0; j-- ) { x264_macroblock_luma_write_cavlc( h, &s, i8, i8 ); - + h->mb.cache.non_zero_count[x264_scan8[16+i8]] = array_non_zero_count( h->dct.luma4x4[16+i8]+1, 15 ); block_residual_write_cavlc( h, &s, 16+i8, h->dct.luma4x4[16+i8]+1, 15 ); + h->mb.cache.non_zero_count[x264_scan8[20+i8]] = array_non_zero_count( h->dct.luma4x4[20+i8]+1, 15 ); block_residual_write_cavlc( h, &s, 20+i8, h->dct.luma4x4[20+i8]+1, 15 ); - i8 += x264_pixel_size[i_pixel].h >> 3; } @@ -777,7 +782,10 @@ static int x264_i8x8_chroma_size_cavlc( x264_t *h ) { int i; for( i = 16; i < 24; i++ ) + { + h->mb.cache.non_zero_count[x264_scan8[i]] = array_non_zero_count( h->dct.luma4x4[i]+1, 15 ); block_residual_write_cavlc( h, &h->out.bs, i, h->dct.luma4x4[i]+1, 15 ); + } } } return h->out.bs.i_bits_encoded;