From 1ec07ecba73fd5061088c8db8a09324318278756 Mon Sep 17 00:00:00 2001 From: James Almer Date: Thu, 7 Apr 2022 22:53:39 -0300 Subject: obu: check that the frame referenced by existing_frame_idx is showable From section 6.8.2 in the AV1 spec: "It is a requirement of bitstream conformance that when show_existing_frame is used to show a previous frame, that the value of showable_frame for the previous frame was equal to 1." --- src/obu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/obu.c b/src/obu.c index 4145988..d0f8fcf 100644 --- a/src/obu.c +++ b/src/obu.c @@ -396,6 +396,7 @@ static int parse_frame_hdr(Dav1dContext *const c, GetBits *const gb) { if (hdr->show_frame) { if (seqhdr->decoder_model_info_present && !seqhdr->equal_picture_interval) hdr->frame_presentation_delay = dav1d_get_bits(gb, seqhdr->frame_presentation_delay_length); + hdr->showable_frame = hdr->frame_type != DAV1D_FRAME_TYPE_KEY; } else hdr->showable_frame = dav1d_get_bits(gb, 1); hdr->error_resilient_mode = @@ -1556,6 +1557,11 @@ int dav1d_parse_obus(Dav1dContext *const c, Dav1dData *const in, const int globa if (c->seq_hdr && c->frame_hdr) { if (c->frame_hdr->show_existing_frame) { if (!c->refs[c->frame_hdr->existing_frame_idx].p.p.data[0]) goto error; + if (c->strict_std_compliance && + !c->refs[c->frame_hdr->existing_frame_idx].p.p.frame_hdr->showable_frame) + { + goto error; + } if (c->n_fc == 1) { dav1d_thread_picture_ref(&c->out, &c->refs[c->frame_hdr->existing_frame_idx].p); -- cgit v1.2.3