Commit a1f80e31 authored by Nathan E. Egge's avatar Nathan E. Egge Committed by Nathan Egge

Pass FRAME_CONTEXT when reading intra modes.

Modify the function signatures of read_intra_mode_y() and
 read_intra_mode_uv() to take a FRAME_CONTEXT instead of an AV1_COMMON
 which pushes the CONFIG_EC_ADAPT ifdef into the calling function.

Change-Id: I89029273bcbdd200a5b928ad91ba9a6a22cf0a62
parent 476c63c1
......@@ -138,39 +138,21 @@ static int read_delta_lflevel(AV1_COMMON *cm, MACROBLOCKD *xd, aom_reader *r,
#endif
#endif
static PREDICTION_MODE read_intra_mode_y(AV1_COMMON *cm, MACROBLOCKD *xd,
static PREDICTION_MODE read_intra_mode_y(FRAME_CONTEXT *ec_ctx, MACROBLOCKD *xd,
aom_reader *r, int size_group) {
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
const PREDICTION_MODE y_mode =
read_intra_mode(r, ec_ctx->y_mode_cdf[size_group]);
FRAME_COUNTS *counts = xd->counts;
#if CONFIG_EC_ADAPT
(void)cm;
#endif
if (counts) ++counts->y_mode[size_group][y_mode];
return y_mode;
}
static PREDICTION_MODE read_intra_mode_uv(AV1_COMMON *cm, MACROBLOCKD *xd,
aom_reader *r,
static PREDICTION_MODE read_intra_mode_uv(FRAME_CONTEXT *ec_ctx,
MACROBLOCKD *xd, aom_reader *r,
PREDICTION_MODE y_mode) {
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
const PREDICTION_MODE uv_mode =
read_intra_mode(r, ec_ctx->uv_mode_cdf[y_mode]);
FRAME_COUNTS *counts = xd->counts;
#if CONFIG_EC_ADAPT
(void)cm;
#endif
if (counts) ++counts->uv_mode[y_mode][uv_mode];
return uv_mode;
}
......@@ -1105,9 +1087,9 @@ static void read_intra_frame_mode_info(AV1_COMMON *const cm,
#if CONFIG_CB4X4
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y)) {
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
#else
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
#endif
#if CONFIG_CFL
......@@ -1395,37 +1377,45 @@ static void read_intra_block_mode_info(AV1_COMMON *const cm, const int mi_row,
mbmi->ref_frame[0] = INTRA_FRAME;
mbmi->ref_frame[1] = NONE_FRAME;
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
#if CONFIG_CB4X4
(void)i;
mbmi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
mbmi->mode = read_intra_mode_y(ec_ctx, xd, r, size_group_lookup[bsize]);
#else
switch (bsize) {
case BLOCK_4X4:
for (i = 0; i < 4; ++i)
mi->bmi[i].as_mode = read_intra_mode_y(cm, xd, r, 0);
mi->bmi[i].as_mode = read_intra_mode_y(ec_ctx, xd, r, 0);
mbmi->mode = mi->bmi[3].as_mode;
break;
case BLOCK_4X8:
mi->bmi[0].as_mode = mi->bmi[2].as_mode = read_intra_mode_y(cm, xd, r, 0);
mi->bmi[0].as_mode = mi->bmi[2].as_mode =
read_intra_mode_y(ec_ctx, xd, r, 0);
mi->bmi[1].as_mode = mi->bmi[3].as_mode = mbmi->mode =
read_intra_mode_y(cm, xd, r, 0);
read_intra_mode_y(ec_ctx, xd, r, 0);
break;
case BLOCK_8X4:
mi->bmi[0].as_mode = mi->bmi[1].as_mode = read_intra_mode_y(cm, xd, r, 0);
mi->bmi[0].as_mode = mi->bmi[1].as_mode =
read_intra_mode_y(ec_ctx, xd, r, 0);
mi->bmi[2].as_mode = mi->bmi[3].as_mode = mbmi->mode =
read_intra_mode_y(cm, xd, r, 0);
read_intra_mode_y(ec_ctx, xd, r, 0);
break;
default:
mbmi->mode = read_intra_mode_y(cm, xd, r, size_group_lookup[bsize]);
mbmi->mode = read_intra_mode_y(ec_ctx, xd, r, size_group_lookup[bsize]);
}
#endif
#if CONFIG_CB4X4
if (is_chroma_reference(mi_row, mi_col, bsize, xd->plane[1].subsampling_x,
xd->plane[1].subsampling_y)) {
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
#else
mbmi->uv_mode = read_intra_mode_uv(cm, xd, r, mbmi->mode);
mbmi->uv_mode = read_intra_mode_uv(ec_ctx, xd, r, mbmi->mode);
(void)mi_row;
(void)mi_col;
#endif
......
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