Commit 2452329a authored by Thomas Davies's avatar Thomas Davies

EC_ADAPT: use tile context for MV data.

Change-Id: I71c9bedfae2304c201fe6621a20c03f4e26a85cf
parent 456e0864
......@@ -1189,6 +1189,11 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
int is_compound, int allow_hp, aom_reader *r) {
int i;
int ret = 1;
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
#if CONFIG_REF_MV
MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi;
#if CONFIG_CB4X4
......@@ -1203,6 +1208,7 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
(void)block;
#endif // CONFIG_REF_MV
(void)ref_frame;
(void)cm;
switch (mode) {
#if CONFIG_EXT_INTER
......@@ -1221,10 +1227,10 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc[nmv_ctx],
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &ec_ctx->nmvc[nmv_ctx],
mv_counts, allow_hp);
#else
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts,
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &ec_ctx->nmvc, mv_counts,
allow_hp);
#endif
ret = ret && is_mv_valid(&mv[i].as_mv);
......@@ -1290,10 +1296,10 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc[nmv_ctx],
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &ec_ctx->nmvc[nmv_ctx],
mv_counts, allow_hp);
#else
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &cm->fc->nmvc, mv_counts,
read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, &ec_ctx->nmvc, mv_counts,
allow_hp);
#endif
ret = ret && is_mv_valid(&mv[i].as_mv);
......@@ -1332,11 +1338,11 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc[nmv_ctx],
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc[nmv_ctx],
mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc, mv_counts,
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc, mv_counts,
allow_hp);
#endif
assert(is_compound);
......@@ -1353,12 +1359,12 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
mv[0].as_int = nearest_mv[0].as_int;
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc->nmvc[nmv_ctx],
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &ec_ctx->nmvc[nmv_ctx],
mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
mv[0].as_int = nearest_mv[0].as_int;
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc->nmvc, mv_counts,
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &ec_ctx->nmvc, mv_counts,
allow_hp);
#endif
assert(is_compound);
......@@ -1374,12 +1380,12 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
mv[0].as_int = near_mv[0].as_int;
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc->nmvc[nmv_ctx],
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &ec_ctx->nmvc[nmv_ctx],
mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
mv[0].as_int = near_mv[0].as_int;
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &cm->fc->nmvc, mv_counts,
read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, &ec_ctx->nmvc, mv_counts,
allow_hp);
#endif
assert(is_compound);
......@@ -1395,11 +1401,11 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context_counts *const mv_counts =
counts ? &counts->mv[nmv_ctx] : NULL;
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc[nmv_ctx],
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc[nmv_ctx],
mv_counts, allow_hp);
#else
nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL;
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &cm->fc->nmvc, mv_counts,
read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc, mv_counts,
allow_hp);
#endif
assert(is_compound);
......
......@@ -1244,17 +1244,22 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
#endif
aom_writer *w) {
AV1_COMMON *const cm = &cpi->common;
#if !CONFIG_REF_MV
nmv_context *nmvc = &cm->fc->nmvc;
#endif
#if CONFIG_DELTA_Q
#if CONFIG_DELTA_Q || CONFIG_EC_ADAPT
MACROBLOCK *const x = &cpi->td.mb;
MACROBLOCKD *const xd = &x->e_mbd;
#else
const MACROBLOCK *x = &cpi->td.mb;
const MACROBLOCKD *xd = &x->e_mbd;
#endif
#if CONFIG_EC_ADAPT
FRAME_CONTEXT *ec_ctx = xd->tile_ctx;
#else
FRAME_CONTEXT *ec_ctx = cm->fc;
#endif
#if !CONFIG_REF_MV
nmv_context *nmvc = &ec_ctx->nmvc;
#endif
const struct segmentation *const seg = &cm->seg;
struct segmentation_probs *const segp = &cm->fc->seg;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
......@@ -1465,7 +1470,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], ref,
mbmi->ref_mv_idx);
nmv_context *nmvc = &cm->fc->nmvc[nmv_ctx];
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
#endif
av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv,
#if CONFIG_EXT_INTER
......@@ -1490,7 +1495,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1,
mbmi->ref_mv_idx);
nmv_context *nmvc = &cm->fc->nmvc[nmv_ctx];
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
#endif
av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[1].as_mv,
&mi->bmi[j].ref_mv[1].as_mv,
......@@ -1504,7 +1509,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0,
mbmi->ref_mv_idx);
nmv_context *nmvc = &cm->fc->nmvc[nmv_ctx];
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
#endif
av1_encode_mv(cpi, w, &mi->bmi[j].as_mv[0].as_mv,
&mi->bmi[j].ref_mv[0].as_mv,
......@@ -1529,7 +1534,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
int nmv_ctx = av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], ref,
mbmi->ref_mv_idx);
nmv_context *nmvc = &cm->fc->nmvc[nmv_ctx];
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
#endif
ref_mv = mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0];
#if CONFIG_EXT_INTER
......@@ -1555,7 +1560,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx);
nmv_context *nmvc = &cm->fc->nmvc[nmv_ctx];
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
#endif
av1_encode_mv(cpi, w, &mbmi->mv[1].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[1]][0].as_mv,
......@@ -1569,7 +1574,7 @@ static void pack_inter_mode_mvs(AV1_COMP *cpi, const MODE_INFO *mi,
int nmv_ctx =
av1_nmv_ctx(mbmi_ext->ref_mv_count[rf_type],
mbmi_ext->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx);
nmv_context *nmvc = &cm->fc->nmvc[nmv_ctx];
nmv_context *nmvc = &ec_ctx->nmvc[nmv_ctx];
#endif
av1_encode_mv(cpi, w, &mbmi->mv[0].as_mv,
&mbmi_ext->ref_mvs[mbmi->ref_frame[0]][0].as_mv,
......
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