shithub: libvpx

Download patch

ref: d53fc9ee4e56212f7e42cbaa4f0c99b8d443d602
parent: e862c6f9eb2ed9316b904685a5173a5062770a63
parent: 08fd41ccd70214c58aa436add4c955ad7c0af58c
author: Dmitry Kovalev <dkovalev@google.com>
date: Thu Jul 25 09:57:28 EDT 2013

Merge "Adding lookup table for size group."

--- a/vp9/common/vp9_common_data.c
+++ b/vp9/common/vp9_common_data.c
@@ -31,6 +31,11 @@
 const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES] =
   {1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8};
 
+// MIN(3, MIN(b_width_log2(bsize), b_height_log2(bsize)))
+const int size_group_lookup[BLOCK_SIZE_TYPES] =
+  {0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 3};
+
+
 const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES] = {
   {  // 4X4
     // 4X4, 4X8,8X4,8X8,8X16,16X8,16X16,16X32,32X16,32X32,32X64,64X32,64X64
--- a/vp9/common/vp9_common_data.h
+++ b/vp9/common/vp9_common_data.h
@@ -21,8 +21,9 @@
 extern const int num_8x8_blocks_high_lookup[BLOCK_SIZE_TYPES];
 extern const int num_4x4_blocks_high_lookup[BLOCK_SIZE_TYPES];
 extern const int num_4x4_blocks_wide_lookup[BLOCK_SIZE_TYPES];
-extern const PARTITION_TYPE
-  partition_lookup[][BLOCK_SIZE_TYPES];
+extern const int size_group_lookup[BLOCK_SIZE_TYPES];
+
+extern const PARTITION_TYPE partition_lookup[][BLOCK_SIZE_TYPES];
 
 
 extern const BLOCK_SIZE_TYPE subsize_lookup[PARTITION_TYPES][BLOCK_SIZE_TYPES];
--- a/vp9/decoder/vp9_decodemv.c
+++ b/vp9/decoder/vp9_decodemv.c
@@ -385,15 +385,14 @@
   VP9_COMMON *const cm = &pbi->common;
   MB_MODE_INFO *const mbmi = &mi->mbmi;
   const BLOCK_SIZE_TYPE bsize = mi->mbmi.sb_type;
-  const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
 
   if (bsize >= BLOCK_SIZE_SB8X8) {
-    const int size_group = MIN(3, MIN(bwl, bhl));
+    const int size_group = size_group_lookup[bsize];
     mbmi->mode = read_intra_mode(r, cm->fc.y_mode_prob[size_group]);
     cm->counts.y_mode[size_group][mbmi->mode]++;
   } else {
      // Only 4x4, 4x8, 8x4 blocks
-     const int bw = 1 << bwl, bh = 1 << bhl;
+     const int bw = 1 << b_width_log2(bsize), bh = 1 << b_height_log2(bsize);
      int idx, idy;
 
      for (idy = 0; idy < 2; idy += bh) {
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -443,9 +443,7 @@
 #endif
 
     if (bsize >= BLOCK_SIZE_SB8X8) {
-      const int bwl = b_width_log2(bsize), bhl = b_height_log2(bsize);
-      const int bsl = MIN(bwl, bhl);
-      write_intra_mode(bc, mode, pc->fc.y_mode_prob[MIN(3, bsl)]);
+      write_intra_mode(bc, mode, pc->fc.y_mode_prob[size_group_lookup[bsize]]);
     } else {
       int idx, idy;
       int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];