Commit 2b4ea11a authored by Fergus Simpson's avatar Fergus Simpson

Use last_show_frame in use_prev_frame_mvs calc

Without tempmv-signaling configured, using the previous frame's MVs
requires that the last frame was a show frame. With tempmv-signaling
configured, cm->show_last_frame is not checked when calculating
use_prev_frame_mvs. This patch adds that check and resolves mismatches
seen with random resizing and random superres.

Includes a couple fixes too - cm's last_width, last_height, and
last_show_frame were updated under different conditions. Now they're all
updated at the same time.

Change-Id: Ibdfb196cb6e9d002fd57cb4df10a899b60faac00
parent c5c0cbaa
......@@ -4986,15 +4986,15 @@ static void encode_frame_internal(AV1_COMP *cpi) {
#if CONFIG_TEMPMV_SIGNALING
if (cm->prev_frame) {
cm->use_prev_frame_mvs &= !cm->error_resilient_mode &&
cm->use_prev_frame_mvs &=
!cm->error_resilient_mode &&
#if CONFIG_FRAME_SUPERRES
cm->width == cm->last_width &&
cm->height == cm->last_height &&
cm->width == cm->last_width && cm->height == cm->last_height &&
#else
cm->width == cm->prev_frame->buf.y_crop_width &&
cm->height == cm->prev_frame->buf.y_crop_height &&
cm->width == cm->prev_frame->buf.y_crop_width &&
cm->height == cm->prev_frame->buf.y_crop_height &&
#endif // CONFIG_FRAME_SUPERRES
!cm->intra_only && !cm->prev_frame->intra_only;
!cm->intra_only && !cm->prev_frame->intra_only && cm->last_show_frame;
} else {
cm->use_prev_frame_mvs = 0;
}
......
......@@ -4539,9 +4539,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
#endif
}
cm->last_width = cm->width;
cm->last_height = cm->height;
++cm->current_video_frame;
#if CONFIG_EC_ADAPT
......@@ -4848,13 +4845,6 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
cm->seg.update_data = 0;
cm->lf.mode_ref_delta_update = 0;
// keep track of the last coded dimensions
cm->last_width = cm->width;
cm->last_height = cm->height;
// reset to normal state now that we are done.
if (!cm->show_existing_frame) cm->last_show_frame = cm->show_frame;
if (cm->show_frame) {
#if CONFIG_EXT_REFS
// TODO(zoeliu): We may only swamp mi and prev_mi for those frames that are
......@@ -4868,9 +4858,18 @@ static void encode_frame_to_data_rate(AV1_COMP *cpi, size_t *size,
#if CONFIG_EXT_REFS
// NOTE: Shall not refer to any frame not used as reference.
if (cm->is_reference_frame)
if (cm->is_reference_frame) {
#endif // CONFIG_EXT_REFS
cm->prev_frame = cm->cur_frame;
// keep track of the last coded dimensions
cm->last_width = cm->width;
cm->last_height = cm->height;
// reset to normal state now that we are done.
cm->last_show_frame = cm->show_frame;
#if CONFIG_EXT_REFS
}
#endif // CONFIG_EXT_REFS
#if CONFIG_EC_ADAPT
aom_free(tile_ctxs);
aom_free(cdf_ptrs);
......
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