[NORMATIVE, fwd-kf] Reload adapted CDFs for fwd keyframes Instead of calling av1_setup_past_independence() when we display a forward-coded keyframe, we can instead reload the frame context which we had just after decoding that keyframe. This is a much less fragile approach (it removes several issues we encountered on our internal testing), and should give better coding gains. BUG=aomedia:1510 Change-Id: Ia67b20bc4128b85b11829bc84e0c383f36ae4a52
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 07718c4..8d14139 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -2544,7 +2544,8 @@ } #if CONFIG_FWD_KF -static void show_existing_frame_reset(AV1Decoder *const pbi) { +static void show_existing_frame_reset(AV1Decoder *const pbi, + int existing_frame_idx) { AV1_COMMON *const cm = &pbi->common; BufferPool *const pool = cm->buffer_pool; RefCntBuffer *const frame_bufs = pool->frame_bufs; @@ -2613,7 +2614,8 @@ unlock_buffer_pool(pool); pbi->hold_ref_buf = 1; - av1_setup_past_independence(cm); + // Reload the adapted CDFs from when we originally coded this keyframe + *cm->fc = cm->frame_contexts[existing_frame_idx]; } #endif // CONFIG_FWD_KF @@ -2685,7 +2687,7 @@ #if CONFIG_FWD_KF if (cm->reset_decoder_state) { - show_existing_frame_reset(pbi); + show_existing_frame_reset(pbi, existing_frame_idx); } else { #endif // CONFIG_FWD_KF pbi->refresh_frame_flags = 0;