summaryrefslogtreecommitdiff
path: root/libavcodec/vp9recon.c
diff options
context:
space:
mode:
authorLinjie Fu <linjie.fu@intel.com>2020-03-17 22:53:58 +0800
committerRonald S. Bultje <rsbultje@gmail.com>2020-05-05 08:22:28 -0400
commit9473268cfb580dccd3f1f3be338cd22661ef791e (patch)
tree0c155f390e2cfb4b72dc5400781f9d0b56616086 /libavcodec/vp9recon.c
parent486ed509bcf245bf25aac19f2eead04ba684c837 (diff)
lavc/vp9: fix reference frame dimensions check for SINGLE_REFERENCE mode
With the description in frame size with refs semantics (SPEC 7.2.5), it is a requirement of bitstream conformance that for at least one reference frame has the valid dimensions. Modify the check to make sure the decoder works well in SINGLE_REFERENCE mode that not all reference frames have valid dimensions. Check and error out if invalid reference frame is used in inter_recon. One of the failure case is a 480x272 inter frame (SINGLE_REFERENCE mode) with following reference pool: 0. 960x544 LAST valid 1. 1920x1088 GOLDEN invalid, but not used in single reference mode 2. 1920x1088 ALTREF invalid, but not used in single reference mode 3~7 ... Unused Identical logic in libvpx: <https://github.com/webmproject/libvpx/blob/master/vp9/decoder/vp9_decodeframe.c#L736> Signed-off-by: Linjie Fu <linjie.fu@intel.com> Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Diffstat (limited to 'libavcodec/vp9recon.c')
-rw-r--r--libavcodec/vp9recon.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/vp9recon.c b/libavcodec/vp9recon.c
index 49bb04e1f4..9a4e7c7a03 100644
--- a/libavcodec/vp9recon.c
+++ b/libavcodec/vp9recon.c
@@ -572,6 +572,16 @@ static av_always_inline void inter_recon(VP9TileData *td, int bytesperpixel)
VP9Block *b = td->b;
int row = td->row, col = td->col;
+ if (s->mvscale[b->ref[0]][0] == REF_INVALID_SCALE ||
+ (b->comp && s->mvscale[b->ref[1]][0] == REF_INVALID_SCALE)) {
+ if (!s->td->error_info) {
+ s->td->error_info = AVERROR_INVALIDDATA;
+ av_log(NULL, AV_LOG_ERROR, "Bitstream not supported, "
+ "reference frame has invalid dimensions\n");
+ }
+ return;
+ }
+
if (s->mvscale[b->ref[0]][0] || (b->comp && s->mvscale[b->ref[1]][0])) {
if (bytesperpixel == 1) {
inter_pred_scaled_8bpp(td);