diff options
author | James Almer <jamrial@gmail.com> | 2022-04-08 04:53:39 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2022-04-08 22:28:29 +0300 |
commit | 1ec07ecba73fd5061088c8db8a09324318278756 (patch) | |
tree | 58c99a60b378cbc455608941e83c50b24db8a487 | |
parent | cabb94df3f6e19f0deceb02f8e60459d6f40c69b (diff) |
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."
-rw-r--r-- | src/obu.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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); |