shithub: dav1d

Download patch

ref: 04199ada5ee70345e1c6e8f18182264e2c26b6a2
parent: dce4e788614bf8c2e353b7157e7b59b34b177779
author: James Almer <[email protected]>
date: Sun Feb 17 18:48:54 EST 2019

picture: use the input picture metadata buffer references in dav1d_picture_alloc_copy()

The references in the Dav1dContext may not necessarely apply to the picture being copied.

--- a/src/picture.c
+++ b/src/picture.c
@@ -101,6 +101,8 @@
                                     const int w, const int h,
                                     Dav1dSequenceHeader *seq_hdr, Dav1dRef *seq_hdr_ref,
                                     Dav1dFrameHeader *frame_hdr,  Dav1dRef *frame_hdr_ref,
+                                    Dav1dContentLightLevel *content_light, Dav1dRef *content_light_ref,
+                                    Dav1dMasteringDisplay *mastering_display, Dav1dRef *mastering_display_ref,
                                     const int bpc, const Dav1dDataProps *props,
                                     Dav1dPicAllocator *const p_allocator,
                                     const size_t extra, void **const extra_ptr)
@@ -150,13 +152,13 @@
     if (extra && extra_ptr)
         *extra_ptr = &pic_ctx->extra_ptr;
 
-    p->content_light = c->content_light;
-    p->content_light_ref = c->content_light_ref;
-    if (c->content_light_ref) dav1d_ref_inc(c->content_light_ref);
+    p->content_light = content_light;
+    p->content_light_ref = content_light_ref;
+    if (content_light_ref) dav1d_ref_inc(content_light_ref);
 
-    p->mastering_display = c->mastering_display;
-    p->mastering_display_ref = c->mastering_display_ref;
-    if (c->mastering_display_ref) dav1d_ref_inc(c->mastering_display_ref);
+    p->mastering_display = mastering_display;
+    p->mastering_display_ref = mastering_display_ref;
+    if (mastering_display_ref) dav1d_ref_inc(mastering_display_ref);
 
     return 0;
 }
@@ -171,6 +173,8 @@
         picture_alloc_with_edges(c, &p->p, f->frame_hdr->width[1], f->frame_hdr->height,
                                  f->seq_hdr, f->seq_hdr_ref,
                                  f->frame_hdr, f->frame_hdr_ref,
+                                 c->content_light, c->content_light_ref,
+                                 c->mastering_display, c->mastering_display_ref,
                                  bpc, &f->tile[0].data.m, &c->allocator,
                                  p->t != NULL ? sizeof(atomic_int) * 2 : 0,
                                  (void **) &p->progress);
@@ -191,6 +195,8 @@
     const int res = picture_alloc_with_edges(c, dst, w, src->p.h,
                                              src->seq_hdr, src->seq_hdr_ref,
                                              src->frame_hdr, src->frame_hdr_ref,
+                                             src->content_light, src->content_light_ref,
+                                             src->mastering_display, src->mastering_display_ref,
                                              src->p.bpc, &src->m, &pic_ctx->allocator,
                                              0, NULL);
     return res;