Refactor read_mv() calls out of ref-mv blocks. This is in preparation for full pell only read_mv() calls for intrabc. Change-Id: I9e576ba0965164849a18afcabc16a3190799483e
diff --git a/av1/decoder/decodemv.c b/av1/decoder/decodemv.c index e099ee0..f670b32 100644 --- a/av1/decoder/decodemv.c +++ b/av1/decoder/decodemv.c
@@ -1510,6 +1510,7 @@ case NEWMV: { FRAME_COUNTS *counts = xd->counts; #if !CONFIG_REF_MV + nmv_context *const nmvc = &ec_ctx->nmvc; nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; #endif for (i = 0; i < 1 + is_compound; ++i) { @@ -1518,14 +1519,11 @@ int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx); + nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; - 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, &ec_ctx->nmvc, mv_counts, - allow_hp); #endif + read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, nmvc, mv_counts, allow_hp); ret = ret && is_mv_valid(&mv[i].as_mv); #if CONFIG_REF_MV @@ -1580,6 +1578,7 @@ case NEW_NEWMV: { FRAME_COUNTS *counts = xd->counts; #if !CONFIG_REF_MV + nmv_context *const nmvc = &ec_ctx->nmvc; nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; #endif assert(is_compound); @@ -1589,14 +1588,11 @@ int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], i, mbmi->ref_mv_idx); + nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; - 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, &ec_ctx->nmvc, mv_counts, - allow_hp); #endif + read_mv(r, &mv[i].as_mv, &ref_mv[i].as_mv, nmvc, mv_counts, allow_hp); ret = ret && is_mv_valid(&mv[i].as_mv); } break; @@ -1631,15 +1627,14 @@ int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); + nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; - read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc[nmv_ctx], - mv_counts, allow_hp); #else + nmv_context *const nmvc = &ec_ctx->nmvc; nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; - read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc, mv_counts, - allow_hp); #endif + read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); ret = ret && is_mv_valid(&mv[0].as_mv); mv[1].as_int = nearest_mv[1].as_int; @@ -1653,15 +1648,13 @@ xd->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); 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, &ec_ctx->nmvc[nmv_ctx], - mv_counts, allow_hp); + nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; #else + nmv_context *const nmvc = &ec_ctx->nmvc; 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, &ec_ctx->nmvc, mv_counts, - allow_hp); #endif + mv[0].as_int = nearest_mv[0].as_int; + read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); ret = ret && is_mv_valid(&mv[1].as_mv); break; @@ -1672,17 +1665,15 @@ int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 1, mbmi->ref_mv_idx); + nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; 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, &ec_ctx->nmvc[nmv_ctx], - mv_counts, allow_hp); #else + nmv_context *const nmvc = &ec_ctx->nmvc; 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, &ec_ctx->nmvc, mv_counts, - allow_hp); #endif + mv[0].as_int = near_mv[0].as_int; + read_mv(r, &mv[1].as_mv, &ref_mv[1].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); ret = ret && is_mv_valid(&mv[1].as_mv); @@ -1694,15 +1685,14 @@ int8_t rf_type = av1_ref_frame_type(mbmi->ref_frame); int nmv_ctx = av1_nmv_ctx(xd->ref_mv_count[rf_type], xd->ref_mv_stack[rf_type], 0, mbmi->ref_mv_idx); + nmv_context *const nmvc = &ec_ctx->nmvc[nmv_ctx]; nmv_context_counts *const mv_counts = counts ? &counts->mv[nmv_ctx] : NULL; - read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc[nmv_ctx], - mv_counts, allow_hp); #else + nmv_context *const nmvc = &ec_ctx->nmvc; nmv_context_counts *const mv_counts = counts ? &counts->mv : NULL; - read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, &ec_ctx->nmvc, mv_counts, - allow_hp); #endif + read_mv(r, &mv[0].as_mv, &ref_mv[0].as_mv, nmvc, mv_counts, allow_hp); assert(is_compound); ret = ret && is_mv_valid(&mv[0].as_mv); mv[1].as_int = near_mv[1].as_int;