/* 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
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.
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
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;
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,
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,
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;
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,
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,
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;
}
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 */
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;
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];
}
#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,
}
#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,
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");
#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;