Unconditionally use LAST_FRAME for prev_frame.
BUG=aomedia:78
Change-Id: Id85cf22302317d33b593345fd31090a6620f4101
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 71674ec..261a564 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -662,9 +662,8 @@
// Returns 1 if this frame really can use MVs from some previous frame.
static INLINE int frame_can_use_prev_frame_mvs(const AV1_COMMON *cm) {
- return (frame_might_use_prev_frame_mvs(cm) && cm->last_show_frame &&
- cm->prev_frame && !cm->prev_frame->intra_only &&
- cm->width == cm->prev_frame->width &&
+ return (frame_might_use_prev_frame_mvs(cm) && cm->prev_frame &&
+ !cm->prev_frame->intra_only && cm->width == cm->prev_frame->width &&
cm->height == cm->prev_frame->height);
}
#endif
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 7e082de..0288a20 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -2973,6 +2973,11 @@
else
cm->use_ref_frame_mvs = 0;
+ cm->prev_frame =
+ cm->frame_refs[LAST_FRAME - LAST_FRAME].idx != INVALID_IDX
+ ? &cm->buffer_pool
+ ->frame_bufs[cm->frame_refs[LAST_FRAME - LAST_FRAME].idx]
+ : NULL;
cm->use_prev_frame_mvs =
cm->use_ref_frame_mvs && frame_can_use_prev_frame_mvs(cm);
#endif
@@ -3233,6 +3238,7 @@
if (cm->use_adapt_scan == 0) av1_init_scan_order(cm);
#endif // CONFIG_ADAPT_SCAN
+#if !CONFIG_TEMPMV_SIGNALING
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -3251,6 +3257,7 @@
->frame_bufs[cm->frame_refs[LAST_FRAME - LAST_FRAME].idx]
: NULL;
}
+#endif
#if CONFIG_TEMPMV_SIGNALING
if (cm->use_prev_frame_mvs && !frame_can_use_prev_frame_mvs(cm)) {
@@ -3429,7 +3436,9 @@
uint8_t clear_data[MAX_AV1_HEADER_SIZE];
size_t first_partition_size;
YV12_BUFFER_CONFIG *new_fb;
+#if !CONFIG_TEMPMV_SIGNALING
RefBuffer *last_fb_ref_buf = &cm->frame_refs[LAST_FRAME - LAST_FRAME];
+#endif
#if CONFIG_ADAPT_SCAN
av1_deliver_eob_threshold(cm, xd);
@@ -3489,6 +3498,7 @@
cm->setup_mi(cm);
+#if !CONFIG_TEMPMV_SIGNALING
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -3505,6 +3515,7 @@
? &cm->buffer_pool->frame_bufs[last_fb_ref_buf->idx]
: NULL;
}
+#endif
#if CONFIG_TEMPMV_SIGNALING
if (cm->use_prev_frame_mvs && !frame_can_use_prev_frame_mvs(cm)) {
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 9925ef3..c53bac4 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -4170,6 +4170,11 @@
av1_initialize_me_consts(cpi, x, cm->base_qindex);
init_encode_frame_mb_context(cpi);
+#if CONFIG_TEMPMV_SIGNALING
+ cm->prev_frame = last_fb_buf_idx != INVALID_IDX
+ ? &cm->buffer_pool->frame_bufs[last_fb_buf_idx]
+ : NULL;
+#else
// NOTE(zoeliu): As cm->prev_frame can take neither a frame of
// show_exisiting_frame=1, nor can it take a frame not used as
// a reference, it is probable that by the time it is being
@@ -4186,6 +4191,7 @@
? &cm->buffer_pool->frame_bufs[last_fb_buf_idx]
: NULL;
}
+#endif
#if CONFIG_TEMPMV_SIGNALING
cm->use_prev_frame_mvs &= frame_can_use_prev_frame_mvs(cm);