Commit 7bb3a4f0 authored by Luc Trudeau's avatar Luc Trudeau

Use PLANE_TYPE to index angle_delta

This is important because only one angle delta
is used for both chroma planes. Using PLANE_TYPE
increases readability and reduces the chance of
people trying to access the angle_delta for
AOM_PLANE_V (i.e. 2).

Change-Id: I26f452e6fcee8bd7fd1e670e73f457d6937e0da9
parent 59b1263e
......@@ -271,7 +271,7 @@ typedef struct MB_MODE_INFO {
FILTER_INTRA_MODE_INFO filter_intra_mode_info;
#endif // CONFIG_FILTER_INTRA
// The actual prediction angle is the base angle + (angle_delta * step).
int8_t angle_delta[2];
int8_t angle_delta[PLANE_TYPES];
// interintra members
INTERINTRA_MODE interintra_mode;
......
......@@ -1905,8 +1905,8 @@ void av1_build_intra_predictors_for_interintra(const AV1_COMMON *cm,
BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, &xd->plane[plane]);
PREDICTION_MODE mode =
interintra_to_intra_mode[xd->mi[0]->mbmi.interintra_mode];
xd->mi[0]->mbmi.angle_delta[0] = 0;
xd->mi[0]->mbmi.angle_delta[1] = 0;
xd->mi[0]->mbmi.angle_delta[PLANE_TYPE_Y] = 0;
xd->mi[0]->mbmi.angle_delta[PLANE_TYPE_UV] = 0;
#if CONFIG_FILTER_INTRA
xd->mi[0]->mbmi.filter_intra_mode_info.use_filter_intra = 0;
#endif // CONFIG_FILTER_INTRA
......
......@@ -1643,7 +1643,7 @@ static void build_intra_predictors_high(
if (is_dr_mode) {
p_angle = mode_to_angle_map[mode] +
xd->mi[0]->mbmi.angle_delta[plane != 0] * ANGLE_STEP;
xd->mi[0]->mbmi.angle_delta[plane != AOM_PLANE_Y] * ANGLE_STEP;
if (p_angle <= 90)
need_above = 1, need_left = 0, need_above_left = 1;
else if (p_angle < 180)
......@@ -1655,7 +1655,6 @@ static void build_intra_predictors_high(
if (use_filter_intra) need_left = need_above = need_above_left = 1;
#endif // CONFIG_FILTER_INTRA
(void)plane;
assert(n_top_px >= 0);
assert(n_topright_px >= 0);
assert(n_left_px >= 0);
......@@ -1862,7 +1861,7 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
if (is_dr_mode) {
p_angle = mode_to_angle_map[mode] +
xd->mi[0]->mbmi.angle_delta[plane != 0] * ANGLE_STEP;
xd->mi[0]->mbmi.angle_delta[plane != AOM_PLANE_Y] * ANGLE_STEP;
if (p_angle <= 90)
need_above = 1, need_left = 0, need_above_left = 1;
else if (p_angle < 180)
......@@ -1874,8 +1873,6 @@ static void build_intra_predictors(const MACROBLOCKD *xd, const uint8_t *ref,
if (use_filter_intra) need_left = need_above = need_above_left = 1;
#endif // CONFIG_FILTER_INTRA
(void)xd;
(void)plane;
assert(n_top_px >= 0);
assert(n_topright_px >= 0);
assert(n_left_px >= 0);
......
......@@ -58,8 +58,8 @@ static INLINE int av1_is_directional_mode(PREDICTION_MODE mode,
}
static INLINE int av1_use_angle_delta(BLOCK_SIZE bsize) {
(void)bsize;
#if CONFIG_USE_ANGLE_DELTA_SUB8X8
(void)bsize;
return 1;
#else
return bsize >= BLOCK_8X8;
......
......@@ -798,26 +798,26 @@ static void read_intra_angle_info(MACROBLOCKD *const xd, aom_reader *r) {
FRAME_CONTEXT *const ec_ctx = xd->tile_ctx;
#endif // CONFIG_EXT_INTRA_MOD
mbmi->angle_delta[0] = 0;
mbmi->angle_delta[1] = 0;
mbmi->angle_delta[PLANE_TYPE_Y] = 0;
mbmi->angle_delta[PLANE_TYPE_UV] = 0;
if (!av1_use_angle_delta(bsize)) return;
if (av1_is_directional_mode(mbmi->mode, bsize)) {
#if CONFIG_EXT_INTRA_MOD
mbmi->angle_delta[0] =
mbmi->angle_delta[PLANE_TYPE_Y] =
read_angle_delta(r, ec_ctx->angle_delta_cdf[mbmi->mode - V_PRED]);
#else
mbmi->angle_delta[0] =
mbmi->angle_delta[PLANE_TYPE_Y] =
av1_read_uniform(r, 2 * MAX_ANGLE_DELTA + 1) - MAX_ANGLE_DELTA;
#endif // CONFIG_EXT_INTRA_MOD
}
if (av1_is_directional_mode(get_uv_mode(mbmi->uv_mode), bsize)) {
#if CONFIG_EXT_INTRA_MOD
mbmi->angle_delta[1] =
mbmi->angle_delta[PLANE_TYPE_UV] =
read_angle_delta(r, ec_ctx->angle_delta_cdf[mbmi->uv_mode - V_PRED]);
#else
mbmi->angle_delta[1] =
mbmi->angle_delta[PLANE_TYPE_UV] =
av1_read_uniform(r, 2 * MAX_ANGLE_DELTA + 1) - MAX_ANGLE_DELTA;
#endif // CONFIG_EXT_INTRA_MOD
}
......@@ -1935,8 +1935,8 @@ static void read_inter_block_mode_info(AV1Decoder *const pbi,
read_interintra_mode(xd, r, bsize_group);
mbmi->ref_frame[1] = INTRA_FRAME;
mbmi->interintra_mode = interintra_mode;
mbmi->angle_delta[0] = 0;
mbmi->angle_delta[1] = 0;
mbmi->angle_delta[PLANE_TYPE_Y] = 0;
mbmi->angle_delta[PLANE_TYPE_UV] = 0;
#if CONFIG_FILTER_INTRA
mbmi->filter_intra_mode_info.use_filter_intra = 0;
#endif // CONFIG_FILTER_INTRA
......
......@@ -784,24 +784,24 @@ static void write_intra_angle_info(const MACROBLOCKD *xd,
if (av1_is_directional_mode(mbmi->mode, bsize)) {
#if CONFIG_EXT_INTRA_MOD
aom_write_symbol(w, mbmi->angle_delta[0] + MAX_ANGLE_DELTA,
aom_write_symbol(w, mbmi->angle_delta[PLANE_TYPE_Y] + MAX_ANGLE_DELTA,
ec_ctx->angle_delta_cdf[mbmi->mode - V_PRED],
2 * MAX_ANGLE_DELTA + 1);
#else
(void)ec_ctx;
write_uniform(w, 2 * MAX_ANGLE_DELTA + 1,
MAX_ANGLE_DELTA + mbmi->angle_delta[0]);
MAX_ANGLE_DELTA + mbmi->angle_delta[PLANE_TYPE_Y]);
#endif // CONFIG_EXT_INTRA_MOD
}
if (av1_is_directional_mode(get_uv_mode(mbmi->uv_mode), bsize)) {
#if CONFIG_EXT_INTRA_MOD
aom_write_symbol(w, mbmi->angle_delta[1] + MAX_ANGLE_DELTA,
aom_write_symbol(w, mbmi->angle_delta[PLANE_TYPE_UV] + MAX_ANGLE_DELTA,
ec_ctx->angle_delta_cdf[mbmi->uv_mode - V_PRED],
2 * MAX_ANGLE_DELTA + 1);
#else
write_uniform(w, 2 * MAX_ANGLE_DELTA + 1,
MAX_ANGLE_DELTA + mbmi->angle_delta[1]);
MAX_ANGLE_DELTA + mbmi->angle_delta[PLANE_TYPE_UV]);
#endif
}
}
......
......@@ -843,28 +843,29 @@ static void sum_intra_stats(FRAME_COUNTS *counts, MACROBLOCKD *xd,
av1_use_angle_delta(bsize)) {
#if CONFIG_ENTROPY_STATS
++counts->angle_delta[mbmi->mode - V_PRED]
[mbmi->angle_delta[0] + MAX_ANGLE_DELTA];
[mbmi->angle_delta[PLANE_TYPE_Y] + MAX_ANGLE_DELTA];
#endif
if (allow_update_cdf)
update_cdf(fc->angle_delta_cdf[mbmi->mode - V_PRED],
mbmi->angle_delta[0] + MAX_ANGLE_DELTA,
mbmi->angle_delta[PLANE_TYPE_Y] + MAX_ANGLE_DELTA,
2 * MAX_ANGLE_DELTA + 1);
}
#endif // CONFIG_EXT_INTRA_MOD
if (!is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y))
if (!is_chroma_reference(mi_row, mi_col, bsize,
xd->plane[AOM_PLANE_U].subsampling_x,
xd->plane[AOM_PLANE_U].subsampling_y))
return;
#if CONFIG_EXT_INTRA_MOD
if (av1_is_directional_mode(get_uv_mode(mbmi->uv_mode), bsize) &&
av1_use_angle_delta(bsize)) {
#if CONFIG_ENTROPY_STATS
++counts->angle_delta[mbmi->uv_mode - V_PRED]
[mbmi->angle_delta[1] + MAX_ANGLE_DELTA];
[mbmi->angle_delta[PLANE_TYPE_UV] + MAX_ANGLE_DELTA];
#endif
if (allow_update_cdf)
update_cdf(fc->angle_delta_cdf[mbmi->uv_mode - V_PRED],
mbmi->angle_delta[1] + MAX_ANGLE_DELTA,
mbmi->angle_delta[PLANE_TYPE_UV] + MAX_ANGLE_DELTA,
2 * MAX_ANGLE_DELTA + 1);
}
#endif // CONFIG_EXT_INTRA_MOD
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment