Skip to content

Commit

Permalink
Refactor read_mv() calls out of ref-mv blocks.
Browse files Browse the repository at this point in the history
This is in preparation for full pell only read_mv() calls for intrabc.

Change-Id: I9e576ba0965164849a18afcabc16a3190799483e
  • Loading branch information
aconverse committed May 2, 2017
1 parent 69972ad commit 3d0bdc1
Showing 1 changed file with 20 additions and 30 deletions.
50 changes: 20 additions & 30 deletions av1/decoder/decodemv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1510,6 +1510,7 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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) {
Expand All @@ -1518,14 +1519,11 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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
Expand Down Expand Up @@ -1580,6 +1578,7 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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);
Expand All @@ -1589,14 +1588,11 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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;
Expand Down Expand Up @@ -1631,15 +1627,14 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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;
Expand All @@ -1653,15 +1648,13 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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;
Expand All @@ -1672,17 +1665,15 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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);
Expand All @@ -1694,15 +1685,14 @@ static INLINE int assign_mv(AV1_COMMON *cm, MACROBLOCKD *xd,
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;
Expand Down

0 comments on commit 3d0bdc1

Please sign in to comment.