]> granicus.if.org Git - libvpx/commitdiff
Make tx partition entropy coder account for block size
authorJingning Han <jingning@google.com>
Thu, 18 Jun 2015 19:39:09 +0000 (12:39 -0700)
committerJingning Han <jingning@google.com>
Thu, 18 Jun 2015 21:56:30 +0000 (21:56 +0000)
This commit allows the entropy coder for transform block partition
to account for its relative position with respect to the block size.

Change-Id: I2b5019c378bfb58c11b926fa50c0db1933f35852

vp9/common/vp9_blockd.h
vp9/common/vp9_entropymode.c
vp9/common/vp9_onyxc_int.h
vp9/decoder/vp9_decodemv.c
vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_encodeframe.c
vp9/encoder/vp9_rdopt.c

index d559d43648000e9dc352d9ae1ff35bc62698aeac..142b2145e97e40f78710d04faecaaee9404e1c1b 100644 (file)
@@ -29,7 +29,7 @@ extern "C" {
 #define BLOCK_SIZE_GROUPS 4
 #define SKIP_CONTEXTS 3
 #define INTER_MODE_CONTEXTS 7
-#define TXFM_PARTITION_CONTEXTS 9
+#define TXFM_PARTITION_CONTEXTS 12
 
 /* Segment Feature Masks */
 #define MAX_MV_REF_CANDIDATES 2
index abd489871c96e8151351a280b179f950b63fdd28..15185e8a2292d1aa08fa24877c663ae43c615539 100644 (file)
@@ -303,8 +303,7 @@ void tx_counts_to_branch_counts_8x8(const unsigned int *tx_count_8x8p,
 }
 
 static const vp9_prob default_txfm_partition_probs[TXFM_PARTITION_CONTEXTS] = {
-    // 64, 128, 192, 64, 128, 192, 64, 128, 192,
-    192, 128, 64, 192, 128, 64, 192, 128, 64,
+    141, 139, 175, 87, 196, 165, 177, 75, 220, 179, 205, 197
 };
 
 static const vp9_prob default_skip_probs[SKIP_CONTEXTS] = {
index a748723f2f43265d6a4d7715242b357c50e1ccc8..d1ad5c080cddd56f50eb4ad94b8519307ed07356 100644 (file)
@@ -441,12 +441,16 @@ static void txfm_partition_update(TXFM_CONTEXT *above_ctx,
   }
 }
 
+static int max_tx_size_offset[TX_SIZES] = {0, 0, 2, 6};
+
 static int txfm_partition_context(const TXFM_CONTEXT *above_ctx,
                                   const TXFM_CONTEXT *left_ctx,
+                                  TX_SIZE max_tx_size,
                                   TX_SIZE tx_size) {
   int above = *above_ctx < tx_size;
   int left = *left_ctx < tx_size;
-  return (tx_size - 1) * 3 + above + left;
+  return max_tx_size_offset[max_tx_size] +
+      2 * (max_tx_size - tx_size) + (above || left);
 }
 
 #ifdef __cplusplus
index 4c13ac519192e809b771b1a642902f2ec566bf4b..0ea7337e3536678c42ff036f74d7a6d50239536c 100644 (file)
@@ -73,6 +73,7 @@ static void read_tx_size_inter(VP9_COMMON *cm, MACROBLOCKD *xd,
   int i, j;
   int ctx = txfm_partition_context(xd->above_txfm_context + (blk_col / 2),
                                    xd->left_txfm_context + (blk_row / 2),
+                                   mbmi->max_tx_size,
                                    tx_size);
   if (xd->mb_to_bottom_edge < 0)
     max_blocks_high += xd->mb_to_bottom_edge >> 5;
index 71d61b773a80f3f297a8005bc1c9514b189f1e92..e7477476896c102da00b429ebfa28a77c05b280e 100644 (file)
@@ -85,6 +85,7 @@ static void write_tx_size_inter(const VP9_COMMON *cm, MACROBLOCKD *xd,
   int max_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
   int ctx = txfm_partition_context(xd->above_txfm_context + (blk_col / 2),
                                    xd->left_txfm_context + (blk_row / 2),
+                                   mbmi->max_tx_size,
                                    tx_size);
   if (xd->mb_to_bottom_edge < 0)
     max_blocks_high += xd->mb_to_bottom_edge >> 5;
index ea3f47739a471d92228645db98c617a5668c8370..4b13aa3742af17f5908d26110994d7f68bebc04a 100644 (file)
@@ -4080,6 +4080,7 @@ static void update_txfm_count(MACROBLOCKD *xd, FRAME_COUNTS *counts,
   int max_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type];
   int ctx = txfm_partition_context(xd->above_txfm_context + (blk_col / 2),
                                    xd->left_txfm_context + (blk_row / 2),
+                                   mbmi->max_tx_size,
                                    tx_size);
   TX_SIZE plane_tx_size = mbmi->inter_tx_size[tx_idx];
 
index 49550672ae26a85e03d38636fbdc72297564f8b8..912a92a6b338ed6a4e9a5d5fb0bdbf975dbff22f 100644 (file)
@@ -1326,6 +1326,7 @@ static void select_tx_block(const VP9_COMP *cpi, MACROBLOCK *x,
   TXFM_CONTEXT stxa[8], stxl[8];
   int ctx = txfm_partition_context(txa + (blk_col / 2),
                                    txl + (blk_row / 2),
+                                   mbmi->max_tx_size,
                                    tx_size);
   int zero_blk_rate;