[vlc-commits] [Git][videolan/vlc][3.0.x] 3 commits: codec: dav1d: apply HDR MDCV

Tristan Matthews (@tmatth) gitlab at videolan.org
Wed Feb 8 18:51:31 UTC 2023



Tristan Matthews pushed to branch 3.0.x at VideoLAN / VLC


Commits:
fb59da1c by Francois Cartegnie at 2023-02-06T23:26:58+00:00
codec: dav1d: apply HDR MDCV

(Cherry-picked from 8a1cad5e825d74275dfd0f187a8e2c6baa005cb2)
Signed-off-by: Vibhoothi <mindfreeze at videolan.org>

- - - - -
606724cc by Francois Cartegnie at 2023-02-06T23:28:14+00:00
codec: dav1d: apply HDR CLL

(Cherry-picked from c1973ce55e426b793054d8ad22cd0b473af0aff2)
Signed-off-by: Vibhoothi <mindfreeze at videolan.org>

- - - - -
8132db81 by Francois Cartegnie at 2023-02-06T23:28:41+00:00
codec: dav1d: MDCV contains SmDm

logical :/

(Cherry-picked from 8634945c56cdfbc75c64815e913448d8ea7926ac)
Signed-off-by: Vibhoothi <mindfreeze at videolan.org>

- - - - -


1 changed file:

- modules/codec/dav1d.c


Changes:

=====================================
modules/codec/dav1d.c
=====================================
@@ -148,6 +148,33 @@ static int NewPicture(Dav1dPicture *img, void *cookie)
         v->b_color_range_full = img->seq_hdr->color_range;
     }
 
+    const Dav1dMasteringDisplay *md = img->mastering_display;
+    if( dec->fmt_in.video.mastering.max_luminance == 0 && md )
+    {
+        const uint8_t RGB2GBR[3] = {2,0,1};
+        for( size_t i=0;i<6; i++ )
+        {
+            v->mastering.primaries[i] =
+                    50000 * (double) md->primaries[RGB2GBR[i >> 1]][i % 2]
+                          / (double)(1 << 16);
+        }
+        v->mastering.min_luminance = 10000 * (double)md->min_luminance
+                                           / (double) (1<<14);
+        v->mastering.max_luminance = 10000 * (double) md->max_luminance
+                                           / (double) (1<<8);
+        v->mastering.white_point[0] = 50000 * (double)md->white_point[0]
+                                            / (double) (1<<16);
+        v->mastering.white_point[1] = 50000 * (double)md->white_point[1]
+                                            / (double) (1<<16);
+    }
+
+    const Dav1dContentLightLevel *cll = img->content_light;
+    if( dec->fmt_in.video.lighting.MaxCLL == 0 && cll )
+    {
+        v->lighting.MaxCLL = cll->max_content_light_level;
+        v->lighting.MaxFALL = cll->max_frame_average_light_level;
+    }
+
     v->projection_mode = dec->fmt_in.video.projection_mode;
     v->multiview_mode = dec->fmt_in.video.multiview_mode;
     v->pose = dec->fmt_in.video.pose;
@@ -269,7 +296,6 @@ static int Decode(decoder_t *dec, block_t *block)
             }
             pic->b_progressive = true; /* codec does not support interlacing */
             pic->date = img.m.timestamp;
-            /* TODO udpate the color primaries and such */
             decoder_QueueVideo(dec, pic);
             dav1d_picture_unref(&img);
         }
@@ -382,6 +408,8 @@ static int OpenDecoder(vlc_object_t *p_this)
     dec->fmt_out.video.transfer    = dec->fmt_in.video.transfer;
     dec->fmt_out.video.space       = dec->fmt_in.video.space;
     dec->fmt_out.video.b_color_range_full = dec->fmt_in.video.b_color_range_full;
+    dec->fmt_out.video.mastering   = dec->fmt_in.video.mastering;
+    dec->fmt_out.video.lighting    = dec->fmt_in.video.lighting;
 
     return VLC_SUCCESS;
 }



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6a661074216638cf9f3e25c6b9dc842e0a81fd0a...8132db81e580bb7f29b678cbbaff55f167494313

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/6a661074216638cf9f3e25c6b9dc842e0a81fd0a...8132db81e580bb7f29b678cbbaff55f167494313
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list