]> granicus.if.org Git - libvpx/commitdiff
Changes to use defined constants rather than hard-coded numbers
authorJulia Robson <juliamrobson@gmail.com>
Mon, 2 Nov 2015 12:24:57 +0000 (12:24 +0000)
committerJulia Robson <juliamrobson@gmail.com>
Mon, 2 Nov 2015 16:02:55 +0000 (16:02 +0000)
These changes have been made in preparation for the work on the
extended coding unit size experiment.

Change-Id: I83f289812426bb9aba6c4a5fedd2b0e0a4fe17cb

vp9/common/vp9_blockd.h
vp9/common/vp9_enums.h
vp9/common/vp9_loopfilter.c
vp9/common/vp9_loopfilter.h
vp9/common/vp9_mvref_common.c
vp9/common/vp9_onyxc_int.h
vp9/common/vp9_reconintra.c
vp9/decoder/vp9_decodeframe.c
vpx_scale/yv12config.h

index 97504ee5c20591ec29137a64f0b6a096456cd893..5f3b9bbade4854a6d6fe538444043a9fa9970ef2 100644 (file)
@@ -423,30 +423,34 @@ typedef struct macroblockd {
   /* pointer to current frame */
   const YV12_BUFFER_CONFIG *cur_buf;
 
+  // The size of mc_buf contains a x2 for each dimension because the image may
+  // be no less than 2x smaller
   /* mc buffer */
-  DECLARE_ALIGNED(16, uint8_t, mc_buf[80 * 2 * 80 * 2]);
-
+  DECLARE_ALIGNED(16, uint8_t, mc_buf[(CODING_UNIT_SIZE + 16) * 2 *
+                                      (CODING_UNIT_SIZE + 16) * 2]);
 #if CONFIG_VP9_HIGHBITDEPTH
   /* Bit depth: 8, 10, 12 */
   int bd;
-  DECLARE_ALIGNED(16, uint16_t, mc_buf_high[80 * 2 * 80 * 2]);
+  DECLARE_ALIGNED(16, uint16_t, mc_buf_high[(CODING_UNIT_SIZE + 16) * 2 *
+                                            (CODING_UNIT_SIZE + 16) * 2]);
 #endif
 
   int lossless;
 
   int corrupted;
 
-  DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_MB_PLANE][64 * 64]);
+  DECLARE_ALIGNED(16, tran_low_t, dqcoeff[MAX_MB_PLANE][CODING_UNIT_SIZE *
+                                                        CODING_UNIT_SIZE]);
 #if CONFIG_PALETTE
   DECLARE_ALIGNED(16, uint8_t, color_index_map[2][64 * 64]);
   DECLARE_ALIGNED(16, uint8_t, palette_map_buffer[64 * 64]);
 #endif  // CONFIG_PALETTE
 
   ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
-  ENTROPY_CONTEXT left_context[MAX_MB_PLANE][16];
+  ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MI_BLOCK_SIZE];
 
   PARTITION_CONTEXT *above_seg_context;
-  PARTITION_CONTEXT left_seg_context[8];
+  PARTITION_CONTEXT left_seg_context[MI_BLOCK_SIZE];
 #if CONFIG_GLOBAL_MOTION
   Global_Motion_Params (*global_motion)[MAX_GLOBAL_MOTION_MODELS];
 #endif  // CONFIG_GLOBAL_MOTION
index 46cae53f7c85383ab2db546b192fbacc80a1c3ce..33a4ddcda55f9c38800c2e1cce1a460563fdd385 100644 (file)
 extern "C" {
 #endif
 
+#define CODING_UNIT_SIZE_LOG2 6
+
+#define CODING_UNIT_SIZE (1 << CODING_UNIT_SIZE_LOG2)
+
 #define MI_SIZE_LOG2 3
-#define MI_BLOCK_SIZE_LOG2 (6 - MI_SIZE_LOG2)  // 64 = 2^6
+#define MI_BLOCK_SIZE_LOG2 (CODING_UNIT_SIZE_LOG2 - MI_SIZE_LOG2)
 
 #define MI_SIZE (1 << MI_SIZE_LOG2)  // pixels per mi-unit
 #define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2)  // mi-units per max block
 
 #define MI_MASK (MI_BLOCK_SIZE - 1)
+#define MI_MASK_2 (MI_BLOCK_SIZE * 2 - 1)
 
 // Bitstream profiles indicated by 2-3 bits in the uncompressed header.
 // 00: Profile 0.  8-bit 4:2:0 only.
@@ -55,7 +60,8 @@ typedef enum BLOCK_SIZE {
   BLOCK_64X32,
   BLOCK_64X64,
   BLOCK_SIZES,
-  BLOCK_INVALID = BLOCK_SIZES
+  BLOCK_INVALID = BLOCK_SIZES,
+  BLOCK_LARGEST = BLOCK_SIZES - 1
 } BLOCK_SIZE;
 
 #if CONFIG_EXT_PARTITION
index 35295bdb5ec4dde9a656ce152e04d31aa34bd74b..99537600c2364424e2f876bbb1b8e7cbeb86b3ec 100644 (file)
@@ -1531,7 +1531,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
       const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
 
       // Filter level can vary per MI
-      if (!(lfl[(r << 3) + (c >> ss_x)] =
+      if (!(lfl[(r << MI_BLOCK_SIZE_LOG2) + (c >> ss_x)] =
             get_filter_level(&cm->lf_info, &mi[0].mbmi)))
         continue;
 
@@ -1593,7 +1593,8 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
                                      mask_8x8_c & border_mask,
                                      mask_4x4_c & border_mask,
                                      mask_4x4_int[r],
-                                     &cm->lf_info, &lfl[r << 3],
+                                     &cm->lf_info,
+                                     &lfl[r << MI_BLOCK_SIZE_LOG2],
                                      (int)cm->bit_depth);
     } else {
       filter_selectively_vert(dst->buf, dst->stride,
@@ -1601,7 +1602,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
                               mask_8x8_c & border_mask,
                               mask_4x4_c & border_mask,
                               mask_4x4_int[r],
-                              &cm->lf_info, &lfl[r << 3]);
+                              &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
     }
 #else
     filter_selectively_vert(dst->buf, dst->stride,
@@ -1609,7 +1610,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
                             mask_8x8_c & border_mask,
                             mask_4x4_c & border_mask,
                             mask_4x4_int[r],
-                            &cm->lf_info, &lfl[r << 3]);
+                            &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
 #endif  // CONFIG_VP9_HIGHBITDEPTH
     dst->buf += 8 * dst->stride;
     mi_8x8 += row_step_stride;
@@ -1642,7 +1643,8 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
                                       mask_8x8_r,
                                       mask_4x4_r,
                                       mask_4x4_int_r,
-                                      &cm->lf_info, &lfl[r << 3],
+                                      &cm->lf_info,
+                                      &lfl[r << MI_BLOCK_SIZE_LOG2],
                                       (int)cm->bit_depth);
     } else {
       filter_selectively_horiz(dst->buf, dst->stride,
@@ -1650,7 +1652,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
                                mask_8x8_r,
                                mask_4x4_r,
                                mask_4x4_int_r,
-                               &cm->lf_info, &lfl[r << 3]);
+                               &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
     }
 #else
     filter_selectively_horiz(dst->buf, dst->stride,
@@ -1658,7 +1660,7 @@ static void filter_block_plane_non420(VP9_COMMON *cm,
                              mask_8x8_r,
                              mask_4x4_r,
                              mask_4x4_int_r,
-                             &cm->lf_info, &lfl[r << 3]);
+                             &cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
 #endif  // CONFIG_VP9_HIGHBITDEPTH
     dst->buf += 8 * dst->stride;
   }
index ae6e24b379b51717411d39c416379bcfc6f3145f..290f4f42fa94765eb4180fc05a558118046a302e 100644 (file)
@@ -165,8 +165,8 @@ typedef struct {
   uint16_t left_uv[TX_SIZES];
   uint16_t above_uv[TX_SIZES];
   uint16_t int_4x4_uv;
-  uint8_t lfl_y[64];
-  uint8_t lfl_uv[16];
+  uint8_t lfl_y[MI_BLOCK_SIZE * MI_BLOCK_SIZE];
+  uint8_t lfl_uv[MI_BLOCK_SIZE / 2 * MI_BLOCK_SIZE / 2];
 } LOOP_FILTER_MASK;
 
 /* assorted loopfilter functions which get used elsewhere */
index 072b119a504d738790a0f2a96483f172b400cc8d..2caa7a6c3efcd95c037dbb4a6f9d3f180038c142 100644 (file)
@@ -666,7 +666,7 @@ static int is_right_available(BLOCK_SIZE bsize,
                                  b_height_log2_lookup[bsize]);
   int block[4] = {0};
 
-  if (bsize == BLOCK_64X64)
+  if (bsize == BLOCK_LARGEST)
     return 1;
   mi_row = mi_row % 8;
   mi_col = mi_col % 8;
index 581a5b372896c3f4d4a237f82de251d8cb840626..dbc8a699668caa2da729f731075760300a89a252 100644 (file)
@@ -339,7 +339,7 @@ static INLINE const vp9_prob* get_partition_probs(const VP9_COMMON *cm,
 
 static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
   const int above_idx = mi_col * 2;
-  const int left_idx = (mi_row * 2) & 15;
+  const int left_idx = (mi_row * 2) & MI_MASK_2;
   int i;
   for (i = 0; i < MAX_MB_PLANE; ++i) {
     struct macroblockd_plane *const pd = &xd->plane[i];
index f1128682c35a8ff3606f8b1fd6e1bcefe2aba98c..638ff96642bc5b0ddbdcd7def5eab4a32bebcc8c 100644 (file)
@@ -2438,7 +2438,7 @@ void vp9_build_interintra_predictors_sby(MACROBLOCKD *xd,
   }
 #endif  // CONFIG_VP9_HIGHBITDEPTH
   {
-    uint8_t intrapredictor[4096];
+    uint8_t intrapredictor[CODING_UNIT_SIZE * CODING_UNIT_SIZE];
     build_intra_predictors_for_interintra(
         xd, xd->plane[0].dst.buf, xd->plane[0].dst.stride,
         intrapredictor, bw,
@@ -2502,8 +2502,8 @@ void vp9_build_interintra_predictors_sbuv(MACROBLOCKD *xd,
   }
 #endif  // CONFIG_VP9_HIGHBITDEPTH
   {
-    uint8_t uintrapredictor[4096];
-    uint8_t vintrapredictor[4096];
+    uint8_t uintrapredictor[CODING_UNIT_SIZE * CODING_UNIT_SIZE];
+    uint8_t vintrapredictor[CODING_UNIT_SIZE * CODING_UNIT_SIZE];
     build_intra_predictors_for_interintra(
         xd, xd->plane[1].dst.buf, xd->plane[1].dst.stride,
         uintrapredictor, bw,
index a1f9e7199bc582e21a0069695a3a88108c9d1b89..945d327ef2aff41ddc1556129df4579e9c94c1c4 100644 (file)
@@ -2821,7 +2821,7 @@ static const uint8_t *decode_tiles(VP9Decoder *pbi,
                              0,
 #endif
                              mi_row, mi_col,
-                             &tile_data->bit_reader, BLOCK_64X64);
+                             &tile_data->bit_reader, BLOCK_LARGEST);
             /*
             printf("tile_data->xd.corrupted=%d\n", tile_data->xd.corrupted);
             printf("============================================\n");
index 42e85fff8b570fc1b2bcb2e18c5a742fb92fa9b1..2c17d80966340581d388527ff54729ddf10a57bf 100644 (file)
@@ -24,7 +24,7 @@ extern "C" {
 #define VP9INNERBORDERINPIXELS      96
 #define VP9_INTERP_EXTEND           4
 #define VP9_ENC_BORDER_IN_PIXELS    160
-#define VP9_DEC_BORDER_IN_PIXELS    32
+#define VP9_DEC_BORDER_IN_PIXELS    (CODING_UNIT_SIZE / 2)
 
 typedef struct yv12_buffer_config {
   int   y_width;