shithub: dav1d

Download patch

ref: 41874f89efd630cb8362c7d04f664c360a46b73a
parent: e5bca59c7bab44b9bef8403b0396b2600fa1932c
author: Fred Barbier <frederic.barbier@allegrodvt.com>
date: Wed Dec 12 09:52:25 EST 2018

Allow redundant sequence header

--- a/src/obu.c
+++ b/src/obu.c
@@ -1233,7 +1233,6 @@
         if (!ref) return -ENOMEM;
         Dav1dSequenceHeader *seq_hdr = ref->data;
         memset(seq_hdr, 0, sizeof(*seq_hdr));
-        c->frame_hdr = NULL;
         if ((res = parse_seq_hdr(c, &gb, seq_hdr)) < 0) {
             dav1d_ref_dec(&ref);
             return res;
@@ -1245,7 +1244,10 @@
         // If we have read a sequence header which is different from
         // the old one, this is a new video sequence and can't use any
         // previous state. Free that state.
-        if (c->seq_hdr && memcmp(seq_hdr, c->seq_hdr, sizeof(*seq_hdr))) {
+        if (!c->seq_hdr)
+            c->frame_hdr = NULL;
+        else if (memcmp(seq_hdr, c->seq_hdr, sizeof(*seq_hdr))) {
+            c->frame_hdr = NULL;
             for (int i = 0; i < 8; i++) {
                 if (c->refs[i].p.p.data[0])
                     dav1d_thread_picture_unref(&c->refs[i].p);