shithub: dav1d

Download patch

ref: 5a4fea2c136464ddbc38f00f98619bea9ca68d19
parent: 7cc54b91a4f5351a70149eb1e97ea2f71b0bf873
author: Ronald S. Bultje <rsbultje@gmail.com>
date: Sat Nov 17 16:11:53 EST 2018

Add frame_hdr/seq_hdr to Dav1dPicture

--- a/include/dav1d/picture.h
+++ b/include/dav1d/picture.h
@@ -67,6 +67,9 @@
      */
     void *data[3];
     struct Dav1dRef *ref; ///< allocation origin
+    struct Dav1dRef *frame_hdr_ref, *seq_hdr_ref;
+    Dav1dSequenceHeader *seq_hdr;
+    Dav1dFrameHeader *frame_hdr;
 
     /**
      * Number of bytes between 2 lines in data[] for luma [0] or chroma [1].
--- a/src/decode.c
+++ b/src/decode.c
@@ -3123,6 +3123,12 @@
     f->sr_cur.p.p.fullrange = f->seq_hdr->color_range;
     f->sr_cur.p.m = f->tile[0].data.m;
     f->sr_cur.p.p.spatial_id = f->frame_hdr->spatial_id;
+    f->sr_cur.p.frame_hdr = f->frame_hdr;
+    f->sr_cur.p.frame_hdr_ref = f->frame_hdr_ref;
+    dav1d_ref_inc(f->frame_hdr_ref);
+    f->sr_cur.p.seq_hdr = f->seq_hdr;
+    f->sr_cur.p.seq_hdr_ref = f->seq_hdr_ref;
+    dav1d_ref_inc(f->seq_hdr_ref);
 
     if (f->frame_hdr->super_res.enabled) {
         res = dav1d_picture_alloc_copy(&f->cur, f->frame_hdr->width[0], &f->sr_cur.p);
--- a/src/picture.c
+++ b/src/picture.c
@@ -180,6 +180,12 @@
         dst->p = src->p;
         dst->m = src->m;
         dst->p.w = w;
+        dst->frame_hdr = src->frame_hdr;
+        dst->frame_hdr_ref = src->frame_hdr_ref;
+        if (dst->frame_hdr_ref) dav1d_ref_inc(dst->frame_hdr_ref);
+        dst->seq_hdr = src->seq_hdr;
+        dst->seq_hdr_ref = src->seq_hdr_ref;
+        if (dst->seq_hdr_ref) dav1d_ref_inc(dst->seq_hdr_ref);
     }
 
     return res;
@@ -193,6 +199,8 @@
     if (src->ref) {
         validate_input(src->data[0] != NULL);
         dav1d_ref_inc(src->ref);
+        if (src->frame_hdr_ref) dav1d_ref_inc(src->frame_hdr_ref);
+        if (src->seq_hdr_ref) dav1d_ref_inc(src->seq_hdr_ref);
     }
     *dst = *src;
 }
@@ -224,6 +232,8 @@
     if (p->ref) {
         validate_input(p->data[0] != NULL);
         dav1d_ref_dec(&p->ref);
+        dav1d_ref_dec(&p->seq_hdr_ref);
+        dav1d_ref_dec(&p->frame_hdr_ref);
     }
     memset(p, 0, sizeof(*p));
 }