Commit cba7da74 authored by David Barker's avatar David Barker

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
parent 0fbd2b79
......@@ -4400,9 +4400,8 @@ static void read_global_motion(AV1_COMMON *cm, struct aom_read_bit_buffer *rb) {
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
......
......@@ -5328,9 +5328,8 @@ static void encode_frame_internal(AV1_COMP *cpi) {
}
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) {
......
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