Commit 707f8321 authored by Jingning Han's avatar Jingning Han

Make mv storage independent of ref frame index

The motion vector storage location in the reference frame is set
to be dependent on the relative frame position, instead of the
reference frame index.

Change-Id: Id8f7d1e6ba32a5ed9e182194178fd2a70094a309
parent 0e301ba4
......@@ -34,10 +34,27 @@ void av1_copy_frame_mvs(const AV1_COMMON *const cm, MODE_INFO *mi, int mi_row,
for (h = 0; h < y_mis; h++) {
MV_REF *mv = frame_mvs;
for (w = 0; w < x_mis; w++) {
#if CONFIG_MFMV
mv->ref_frame[0] = NONE_FRAME;
mv->ref_frame[1] = NONE_FRAME;
mv->mv[0].as_int = 0;
mv->mv[1].as_int = 0;
for (int idx = 0; idx < 2; ++idx) {
MV_REFERENCE_FRAME ref_frame = mi->mbmi.ref_frame[idx];
if (ref_frame > INTRA_FRAME) {
int8_t ref_idx = cm->ref_frame_side[ref_frame];
if (ref_idx < 0) continue;
mv->ref_frame[ref_idx] = ref_frame;
mv->mv[ref_idx].as_int = mi->mbmi.mv[idx].as_int;
}
}
#else
mv->ref_frame[0] = mi->mbmi.ref_frame[0];
mv->ref_frame[1] = mi->mbmi.ref_frame[1];
mv->mv[0].as_int = mi->mbmi.mv[0].as_int;
mv->mv[1].as_int = mi->mbmi.mv[1].as_int;
#endif
// (TODO:yunqing) The following 2 lines won't be used and can be removed.
mv->pred_mv[0].as_int = mi->mbmi.pred_mv[0].as_int;
mv->pred_mv[1].as_int = mi->mbmi.pred_mv[1].as_int;
......@@ -1689,6 +1706,19 @@ void av1_setup_motion_field(AV1_COMMON *cm) {
alt2_frame_index =
cm->buffer_pool->frame_bufs[alt2_buf_idx].cur_frame_offset;
memset(cm->ref_frame_side, 0, sizeof(cm->ref_frame_side));
for (int ref_frame = LAST_FRAME; ref_frame < INTER_REFS_PER_FRAME;
++ref_frame) {
int buf_idx = cm->frame_refs[ref_frame - LAST_FRAME].idx;
int frame_index = -1;
if (buf_idx >= 0)
frame_index = cm->buffer_pool->frame_bufs[buf_idx].cur_frame_offset;
if (frame_index > cur_frame_index)
cm->ref_frame_side[ref_frame] = 1;
else if (frame_index == cur_frame_index)
cm->ref_frame_side[ref_frame] = -1;
}
if (alt_frame_index < cur_frame_index) return;
int ref_stamp = MFMV_STACK_SIZE - 1;
......
......@@ -577,6 +577,8 @@ typedef struct AV1Common {
#endif
#if CONFIG_MFMV
TPL_MV_REF *tpl_mvs;
// TODO(jingning): This can be combined with sign_bias later.
int8_t ref_frame_side[TOTAL_REFS_PER_FRAME];
#endif
#if TXCOEFF_TIMER
......
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