[x264-devel] commit: compute missing nnz count in subme7 cavlc (Jason Garrett-Glaser )

git version control git at videolan.org
Sun Apr 27 11:16:38 CEST 2008


x264 | branch: master | Jason Garrett-Glaser <darkshikari at gmail.com> | Fri Apr 25 20:43:57 2008 -0600| [a9057b503939d763a9f17111c41672bfca8beb7e]

compute missing nnz count in subme7 cavlc

> http://git.videolan.org/gitweb.cgi/x264.git/?a=commit;h=a9057b503939d763a9f17111c41672bfca8beb7e
---

 encoder/cavlc.c |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/encoder/cavlc.c b/encoder/cavlc.c
index 6ccbfdb..54bc567 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;



More information about the x264-devel mailing list