Some minor optimizations in RD refinement
authorFiona Glaser <fiona@x264.com>
Wed, 22 Oct 2008 07:37:00 +0000 (00:37 -0700)
committerFiona Glaser <fiona@x264.com>
Wed, 22 Oct 2008 07:37:00 +0000 (00:37 -0700)
Don't write b subpartition in CABAC RDO
Calculate nonzero count in i4x4 CAVLC RDO

encoder/cabac.c
encoder/cavlc.c

index 2f0f02a..111b82e 100644 (file)
@@ -1047,7 +1047,6 @@ static void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int
     }
     else if( i_mb_type == B_8x8 )
     {
-        x264_cabac_mb_sub_b_partition( cb, h->mb.i_sub_partition[i8] );
         x264_cabac_mb8x8_mvd( h, cb, 0, i8 );
         x264_cabac_mb8x8_mvd( h, cb, 1, i8 );
     }
index 8e27aa2..df084e2 100644 (file)
@@ -701,8 +701,7 @@ static int x264_partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode )
     {
         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] );
+        h->mb.cache.non_zero_count[x264_scan8[i4+i8*4]] = array_non_zero_count( h->dct.luma4x4[i4+i8*4] );
         block_residual_write_cavlc( h, &h->out.bs, i4+i8*4, h->dct.luma4x4[i4+i8*4], 16 );
     }
     return h->out.bs.i_bits_encoded;
@@ -711,6 +710,7 @@ static int x264_partition_i8x8_size_cavlc( x264_t *h, int i8, int i_mode )
 static int x264_partition_i4x4_size_cavlc( x264_t *h, int i4, int i_mode )
 {
     h->out.bs.i_bits_encoded = cavlc_intra4x4_pred_size( h, i4, i_mode );
+    h->mb.cache.non_zero_count[x264_scan8[i4]] = array_non_zero_count( h->dct.luma4x4[i4] );
     block_residual_write_cavlc( h, &h->out.bs, i4, h->dct.luma4x4[i4], 16 );
     return h->out.bs.i_bits_encoded;
 }