[x264-devel] commit: Fix another PCM bug (Jason Garrett-Glaser )
git at videolan.org
git at videolan.org
Fri Jul 16 01:01:51 CEST 2010
x264 | branch: stable | Jason Garrett-Glaser <darkshikari at gmail.com> | Thu Jul 15 13:20:50 2010 -0700| [6c486d23da46722377ec150ead899dd481551b28] | committer: Jason Garrett-Glaser
Fix another PCM bug
CABAC assumes that NNZ is 0 or 1, not the number of actual nonzero coefficients.
Didn't actually break the output; only had a tiny effect on RD.
> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=6c486d23da46722377ec150ead899dd481551b28
---
common/macroblock.c | 23 +++++++++++------------
1 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/common/macroblock.c b/common/macroblock.c
index 232c925..92c16c5 100644
--- a/common/macroblock.c
+++ b/common/macroblock.c
@@ -1160,22 +1160,11 @@ void x264_macroblock_cache_save( x264_t *h )
h->mb.i_cbp_luma = 0xf;
h->mb.cbp[i_mb_xy] = 0x72f; /* all set */
h->mb.b_transform_8x8 = 0;
- memset( nnz, 16, sizeof( *h->mb.non_zero_count ) );
for( int i = 0; i < 24; i++ )
- h->mb.cache.non_zero_count[x264_scan8[i]] = 16;
+ h->mb.cache.non_zero_count[x264_scan8[i]] = h->param.b_cabac ? 1 : 16;
}
else
{
- /* save non zero count */
- CP32( &nnz[0*4], &h->mb.cache.non_zero_count[x264_scan8[0]+0*8] );
- CP32( &nnz[1*4], &h->mb.cache.non_zero_count[x264_scan8[0]+1*8] );
- CP32( &nnz[2*4], &h->mb.cache.non_zero_count[x264_scan8[0]+2*8] );
- CP32( &nnz[3*4], &h->mb.cache.non_zero_count[x264_scan8[0]+3*8] );
- M16( &nnz[16+0*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+0*2]-1] ) >> 8;
- M16( &nnz[16+1*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+1*2]-1] ) >> 8;
- M16( &nnz[16+2*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+2*2]-1] ) >> 8;
- M16( &nnz[16+3*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+3*2]-1] ) >> 8;
-
if( h->mb.i_type != I_16x16 && h->mb.i_cbp_luma == 0 && h->mb.i_cbp_chroma == 0 )
h->mb.i_qp = h->mb.i_last_qp;
h->mb.qp[i_mb_xy] = h->mb.i_qp;
@@ -1183,6 +1172,16 @@ void x264_macroblock_cache_save( x264_t *h )
h->mb.i_last_qp = h->mb.i_qp;
}
+ /* save non zero count */
+ CP32( &nnz[0*4], &h->mb.cache.non_zero_count[x264_scan8[0]+0*8] );
+ CP32( &nnz[1*4], &h->mb.cache.non_zero_count[x264_scan8[0]+1*8] );
+ CP32( &nnz[2*4], &h->mb.cache.non_zero_count[x264_scan8[0]+2*8] );
+ CP32( &nnz[3*4], &h->mb.cache.non_zero_count[x264_scan8[0]+3*8] );
+ M16( &nnz[16+0*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+0*2]-1] ) >> 8;
+ M16( &nnz[16+1*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+1*2]-1] ) >> 8;
+ M16( &nnz[16+2*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+2*2]-1] ) >> 8;
+ M16( &nnz[16+3*2] ) = M32( &h->mb.cache.non_zero_count[x264_scan8[16+3*2]-1] ) >> 8;
+
if( h->mb.i_cbp_luma == 0 && h->mb.i_type != I_8x8 )
h->mb.b_transform_8x8 = 0;
h->mb.mb_transform_size[i_mb_xy] = h->mb.b_transform_8x8;
More information about the x264-devel
mailing list