]> git.videolan.org Git - x264.git/commitdiff
Add subpartition cost for sub-8x8 blocks
authorJason Garrett-Glaser <darkshikari@gmail.com>
Wed, 24 Jun 2009 21:39:15 +0000 (14:39 -0700)
committerJason Garrett-Glaser <darkshikari@gmail.com>
Fri, 26 Jun 2009 05:13:41 +0000 (22:13 -0700)
Improves sub-p8x8 mode decision.

encoder/cabac.c
encoder/cavlc.c

index 61a0e9bb1a9a72defa6bfce5f5ff26401dd5331b..ce4175a1b60b3cad90511a277df40a8902709537 100644 (file)
@@ -986,7 +986,8 @@ void x264_macroblock_write_cabac( x264_t *h, x264_cabac_t *cb )
 /*****************************************************************************
  * RD only; doesn't generate a valid bitstream
  * doesn't write cbp or chroma dc (I don't know how much this matters)
- * doesn't write ref or subpartition (never varies between calls, so no point in doing so)
+ * doesn't write ref (never varies between calls, so no point in doing so)
+ * only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO
  * works on all partition sizes except 16x16
  *****************************************************************************/
 static void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int i_pixel )
@@ -998,6 +999,7 @@ static void x264_partition_size_cabac( x264_t *h, x264_cabac_t *cb, int i8, int
     if( i_mb_type == P_8x8 )
     {
         x264_cabac_mb8x8_mvd( h, cb, i8 );
+        x264_cabac_mb_sub_p_partition( cb, h->mb.i_sub_partition[i8] );
     }
     else if( i_mb_type == P_L0 )
         x264_cabac_mb_mvd( h, cb, 0, 4*i8, 4>>b_8x16, 2<<b_8x16 );
index ca57e8be8188c7bb01e1738b31fa3d2ceee5b1ae..cbe85b0f158a33221b28208686fc8b56581c64ea 100644 (file)
@@ -552,7 +552,8 @@ void x264_macroblock_write_cavlc( x264_t *h, bs_t *s )
 /*****************************************************************************
  * RD only; doesn't generate a valid bitstream
  * doesn't write cbp or chroma dc (I don't know how much this matters)
- * doesn't write ref or subpartition (never varies between calls, so no point in doing so)
+ * doesn't write ref (never varies between calls, so no point in doing so)
+ * only writes subpartition for p8x8, needed for sub-8x8 mode decision RDO
  * works on all partition sizes except 16x16
  *****************************************************************************/
 static int x264_partition_size_cavlc( x264_t *h, int i8, int i_pixel )
@@ -565,6 +566,7 @@ static int x264_partition_size_cavlc( x264_t *h, int i8, int i_pixel )
     if( i_mb_type == P_8x8 )
     {
         cavlc_mb8x8_mvd( h, &h->out.bs, i8 );
+        bs_write_ue( &h->out.bs, sub_mb_type_p_to_golomb[ h->mb.i_sub_partition[i8] ] );
     }
     else if( i_mb_type == P_L0 )
         cavlc_mb_mvd( h, &h->out.bs, 0, 4*i8, 4>>b_8x16 );