Save global motion params even in error-resilient-mode The error-resilient-mode flag is currently set per frame, so we can encode a non-error-resilient frame immediately after an error-resilient frame. As of https://aomedia-review.googlesource.com/c/21783 , this case causes the decoder to read uninitialized memory. This happens because the error-resilient frame no longer sets up cm->cur_frame->global_motion. Then, on the non-error-resilient frame, that is renamed to cm->prev_frame->global_motion and we try to use it as a reference for delta encoding. Fix this by always writing cm->cur_frame->global_motion. Change-Id: I0d4f13bf413ca15da210e06d5ce1780331c005da
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index fc50e73..f9cb46a 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c
@@ -4400,9 +4400,8 @@ cm->global_motion[frame].wmmat[3]); */ } - if (!cm->error_resilient_mode) - memcpy(cm->cur_frame->global_motion, cm->global_motion, - TOTAL_REFS_PER_FRAME * sizeof(WarpedMotionParams)); + memcpy(cm->cur_frame->global_motion, cm->global_motion, + TOTAL_REFS_PER_FRAME * sizeof(WarpedMotionParams)); } #endif // CONFIG_GLOBAL_MOTION
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c index 0ea1d56..c87916d 100644 --- a/av1/encoder/encodeframe.c +++ b/av1/encoder/encodeframe.c
@@ -5328,9 +5328,8 @@ } cpi->global_motion_search_done = 1; } - if (!cm->error_resilient_mode) - memcpy(cm->cur_frame->global_motion, cm->global_motion, - TOTAL_REFS_PER_FRAME * sizeof(WarpedMotionParams)); + memcpy(cm->cur_frame->global_motion, cm->global_motion, + TOTAL_REFS_PER_FRAME * sizeof(WarpedMotionParams)); #endif // CONFIG_GLOBAL_MOTION for (i = 0; i < MAX_SEGMENTS; ++i) {