shithub: libvpx

Download patch

ref: e63099d199b492710cd2d74f02f56071ba8a6749
parent: 1c6df34c06cc87d49dc4ea4e814133834e46339a
author: Jingning Han <jingning@google.com>
date: Tue Apr 9 16:34:25 EDT 2013

Make SB Decoding units size-independent

Unify the sb32x32 and sb64x64 decoding units, which also allow for
other rectangular block sizes.

Change-Id: Ia5187ab2af56f98c3f99272bdf4dbcabe798ad5d

--- a/vp9/decoder/vp9_decodframe.c
+++ b/vp9/decoder/vp9_decodframe.c
@@ -625,7 +625,7 @@
   }
 
   // dequantization and idct
-  eobtotal = vp9_decode_sb64_tokens(pbi, xd, bc);
+  eobtotal = vp9_decode_tokens(pbi, xd, bc, BLOCK_SIZE_SB64X64);
   if (eobtotal == 0) {  // skip loopfilter
     for (n = 0; n < 16; n++) {
       const int x_idx = n & 3, y_idx = n >> 2;
@@ -704,7 +704,7 @@
   }
 
   // dequantization and idct
-  eobtotal = vp9_decode_sb_tokens(pbi, xd, bc);
+  eobtotal = vp9_decode_tokens(pbi, xd, bc, BLOCK_SIZE_SB32X32);
   if (eobtotal == 0) {  // skip loopfilter
     mi->mbmi.mb_skip_coeff = 1;
     if (mb_col + 1 < pc->mb_cols)
@@ -766,7 +766,7 @@
 #if CONFIG_NEWBINTRAMODES
     if (mode != B_PRED)
 #endif
-      eobtotal = vp9_decode_mb_tokens(pbi, xd, bc);
+      eobtotal = vp9_decode_tokens(pbi, xd, bc, BLOCK_SIZE_MB16X16);
   }
 
   //mode = xd->mode_info_context->mbmi.mode;
--- a/vp9/decoder/vp9_detokenize.c
+++ b/vp9/decoder/vp9_detokenize.c
@@ -401,7 +401,7 @@
 static INLINE int decode_block_plane(VP9D_COMP* const pbi,
                                      MACROBLOCKD* const xd,
                                      BOOL_DECODER* const bc,
-                                     BLOCK_SIZE_LG2 block_size,
+                                     int block_size,
                                      int segment_id,
                                      int plane,
                                      int is_split) {
@@ -408,19 +408,19 @@
   // block and transform sizes, in number of 4x4 blocks log 2 ("*_b")
   // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
   const TX_SIZE tx_size = xd->mode_info_context->mbmi.txfm_size;
-  const BLOCK_SIZE_LG2 block_size_b = block_size;
-  const BLOCK_SIZE_LG2 txfrm_size_b = tx_size * 2;
+  const int block_size_b = block_size;
+  const int txfrm_size_b = tx_size * 2;
 
   // subsampled size of the block
   const int ss_sum = xd->plane[plane].subsampling_x +
                      xd->plane[plane].subsampling_y;
-  const BLOCK_SIZE_LG2 ss_block_size = block_size_b - ss_sum;
+  const int ss_block_size = block_size_b - ss_sum;
 
   // size of the transform to use. scale the transform down if it's larger
   // than the size of the subsampled data, or forced externally by the mb mode.
   const int ss_max = MAX(xd->plane[plane].subsampling_x,
                          xd->plane[plane].subsampling_y);
-  const BLOCK_SIZE_LG2 ss_txfrm_size = txfrm_size_b > ss_block_size || is_split
+  const int ss_txfrm_size = txfrm_size_b > ss_block_size || is_split
                                        ? txfrm_size_b - ss_max * 2
                                        : txfrm_size_b;
   const TX_SIZE ss_tx_size = ss_txfrm_size / 2;
@@ -477,22 +477,12 @@
       tx_size == TX_8X8 && (mode == I8X8_PRED || mode == SPLITMV));
 }
 
-int vp9_decode_sb64_tokens(VP9D_COMP* const pbi,
-                           MACROBLOCKD* const xd,
-                           BOOL_DECODER* const bc) {
-  return decode_blocks(pbi, xd, bc, BLOCK_64X64_LG2);
-}
-
-int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
+int vp9_decode_tokens(VP9D_COMP* const pbi,
                          MACROBLOCKD* const xd,
-                         BOOL_DECODER* const bc) {
-  return decode_blocks(pbi, xd, bc, BLOCK_32X32_LG2);
-}
-
-int vp9_decode_mb_tokens(VP9D_COMP* const pbi,
-                         MACROBLOCKD* const xd,
-                         BOOL_DECODER* const bc) {
-  return decode_blocks(pbi, xd, bc, BLOCK_16X16_LG2);
+                         BOOL_DECODER* const bc,
+                         BLOCK_SIZE_TYPE bsize) {
+  const int bwl = mb_width_log2(bsize) + 2, bhl = mb_height_log2(bsize) + 2;
+  return decode_blocks(pbi, xd, bc, bwl + bhl);
 }
 
 #if CONFIG_NEWBINTRAMODES
--- a/vp9/decoder/vp9_detokenize.h
+++ b/vp9/decoder/vp9_detokenize.h
@@ -14,16 +14,10 @@
 
 #include "vp9/decoder/vp9_onyxd_int.h"
 
-int vp9_decode_mb_tokens(VP9D_COMP* const, MACROBLOCKD* const,
-                         BOOL_DECODER* const);
-
-int vp9_decode_sb_tokens(VP9D_COMP* const pbi,
-                         MACROBLOCKD* const xd,
-                         BOOL_DECODER* const bc);
-
-int vp9_decode_sb64_tokens(VP9D_COMP* const pbi,
-                           MACROBLOCKD* const xd,
-                           BOOL_DECODER* const bc);
+int vp9_decode_tokens(VP9D_COMP* const pbi,
+                      MACROBLOCKD* const xd,
+                      BOOL_DECODER* const bc,
+                      BLOCK_SIZE_TYPE bsize);
 
 int vp9_decode_mb_tokens_4x4_uv(VP9D_COMP* const dx, MACROBLOCKD* const xd,
                                 BOOL_DECODER* const bc);