[FFmpeg-devel] [PATCH v1 19/19] avcodec/vvc/sei: add decode_mastering_display_colour_volume

toqsxw at gmail.com toqsxw at gmail.com
Tue Apr 1 20:16:16 EEST 2025


From: Wu Jianhua <toqsxw at outlook.com>

Signed-off-by: Wu Jianhua <toqsxw at outlook.com>
---
 libavcodec/vvc/sei.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/libavcodec/vvc/sei.c b/libavcodec/vvc/sei.c
index 7763dd401c..4c5c54f36c 100644
--- a/libavcodec/vvc/sei.c
+++ b/libavcodec/vvc/sei.c
@@ -158,6 +158,24 @@ static int decode_ambient_viewing_environment(H2645SEIAmbientViewingEnvironment
     return 0;
 }
 
+static int decode_mastering_display_colour_volume(H2645SEIMasteringDisplay *h, const SEIRawMasteringDisplayColourVolume *s)
+{
+    h->present = 1;
+
+    for (int c = 0; c < 3; c++) {
+        h->display_primaries[c][0] = s->display_primaries_x[c];
+        h->display_primaries[c][1] = s->display_primaries_y[c];
+    }
+
+    h->white_point[0] = s->white_point_x;
+    h->white_point[1] = s->white_point_y;
+
+    h->max_luminance  = s->max_display_mastering_luminance;
+    h->min_luminance  = s->min_display_mastering_luminance;
+
+    return 0;
+}
+
 int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameContext *fc)
 {
     H2645SEI *c  = &s->common;
@@ -192,6 +210,9 @@ int ff_vvc_sei_decode(VVCSEI *s, const H266RawSEI *sei, const struct VVCFrameCon
         case SEI_TYPE_AMBIENT_VIEWING_ENVIRONMENT:
             return decode_ambient_viewing_environment(&s->common.ambient_viewing_environment, payload);
 
+        case SEI_TYPE_MASTERING_DISPLAY_COLOUR_VOLUME:
+            return decode_mastering_display_colour_volume(&s->common.mastering_display, payload);
+
         default:
             av_log(fc->log_ctx, AV_LOG_DEBUG, "Skipped %s SEI %d\n",
                 sei->nal_unit_header.nal_unit_type == VVC_PREFIX_SEI_NUT ?
-- 
2.44.0.windows.1



More information about the ffmpeg-devel mailing list