Changes to use defined constants rather than hard-coded numbers

These changes have been made in preparation for the work on the
extended coding unit size experiment.

Change-Id: I83f289812426bb9aba6c4a5fedd2b0e0a4fe17cb
This commit is contained in:
Julia Robson 2015-11-02 12:24:57 +00:00
parent 42abac9374
commit 2a1f8c74aa
9 changed files with 36 additions and 24 deletions

View 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

View File

@ -17,13 +17,18 @@
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

View 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;
}

View 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 */

View 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;

View 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];

View 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,

View 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");

View 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;