From d3bbfee8e6226fe063322e611680ac87fd193682 Mon Sep 17 00:00:00 2001 From: David Barker Date: Thu, 7 Sep 2017 14:53:00 +0100 Subject: [PATCH] Don't read global motion for intra-only frames Save bits by not encoding global motion data when there's no previous frame to use as a reference. Use the same logic as for using the previous frame's motion vectors - ie, we don't read global motion information when the current frame is intra-only or when using error-resilient mode. This also fixes an undefined behaviour / segfault bug - see https://bugs.chromium.org/p/aomedia/issues/detail?id=731 for details BUG=aomedia:731 Change-Id: Icca90a1bccafd06de8a4056ca5353318fce416cb --- av1/decoder/decodeframe.c | 3 ++- av1/encoder/bitstream.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c index 082fd4d82..ddf2e1a11 100644 --- a/av1/decoder/decodeframe.c +++ b/av1/decoder/decodeframe.c @@ -4854,7 +4854,8 @@ static size_t read_uncompressed_header(AV1Decoder *pbi, #endif // CONFIG_EXT_TX #if CONFIG_GLOBAL_MOTION - read_global_motion(cm, rb); + if (!(frame_is_intra_only(cm) || cm->error_resilient_mode)) + read_global_motion(cm, rb); #endif read_tile_info(pbi, rb); diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c index d534ebbc8..9017eed2c 100644 --- a/av1/encoder/bitstream.c +++ b/av1/encoder/bitstream.c @@ -4600,7 +4600,8 @@ static void write_uncompressed_header(AV1_COMP *cpi, #endif // CONFIG_EXT_TX #if CONFIG_GLOBAL_MOTION - write_global_motion(cpi, wb); + if (!(frame_is_intra_only(cm) || cm->error_resilient_mode)) + write_global_motion(cpi, wb); #endif // CONFIG_GLOBAL_MOTION write_tile_info(cm, wb); -- GitLab