This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit cf5284b491d4fcf9d1fd42b051448a9f927265f2
Author:     James Almer <[email protected]>
AuthorDate: Fri May 29 18:43:16 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Tue Jun 2 19:50:39 2026 -0300

    avcodec/itut35: add support for HDR Vivid
    
    Needed by h2645_sei.
    
    Signed-off-by: James Almer <[email protected]>
---
 libavcodec/Makefile |  2 +-
 libavcodec/itut35.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 libavcodec/itut35.h |  1 +
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 2920adee5b..bdda6364f5 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -126,7 +126,7 @@ OBJS-$(CONFIG_HUFFYUVENCDSP)           += huffyuvencdsp.o
 OBJS-$(CONFIG_IDCTDSP)                 += idctdsp.o simple_idct.o jrevdct.o
 OBJS-$(CONFIG_INFLATE_WRAPPER)         += zlib_wrapper.o
 OBJS-$(CONFIG_INTRAX8)                 += intrax8.o intrax8dsp.o 
msmpeg4_vc1_data.o
-OBJS-$(CONFIG_ITUT_T35)                += itut35.o aom_film_grain.o
+OBJS-$(CONFIG_ITUT_T35)                += itut35.o aom_film_grain.o 
dynamic_hdr_vivid.o
 OBJS-$(CONFIG_IVIDSP)                  += ivi_dsp.o
 OBJS-$(CONFIG_JNI)                     += ffjni.o jni.o
 OBJS-$(CONFIG_JPEGTABLES)              += jpegtables.o
diff --git a/libavcodec/itut35.c b/libavcodec/itut35.c
index 0345bc6f4e..0f978b2097 100644
--- a/libavcodec/itut35.c
+++ b/libavcodec/itut35.c
@@ -26,6 +26,7 @@
 #include "atsc_a53.h"
 #include "bytestream.h"
 #include "decode.h"
+#include "dynamic_hdr_vivid.h"
 #include "dovi_rpu.h"
 #include "itut35.h"
 #include "version.h"
@@ -123,6 +124,24 @@ int ff_itut_t35_parse_buffer(FFITUTT35 *const itut_t35, 
const uint8_t *buf,
             return 0;
         }
         break;
+    case ITU_T_T35_COUNTRY_CODE_CN:
+        if (bytestream2_get_bytes_left(&gb) < 2)
+            return AVERROR_INVALIDDATA;
+        provider_code = bytestream2_get_be16u(&gb);
+
+        switch (provider_code) {
+        case ITU_T_T35_PROVIDER_CODE_HDR_VIVID:
+            if (bytestream2_get_bytes_left(&gb) < 2)
+                return AVERROR_INVALIDDATA;
+
+            provider_oriented_code = bytestream2_get_be16u(&gb);
+            if (provider_oriented_code != 0x0005)
+                return 0; //ignore
+            break;
+        default: // ignore unsupported provider codes
+            return 0;
+        }
+        break;
 
     default: // ignore unsupported country codes
         return 0;
@@ -254,6 +273,32 @@ int ff_itut_t35_parse_payload_to_struct(FFITUTT35 *const 
itut_t35, FFITUTT35Aux
             break;
         }
         break;
+    case ITU_T_T35_COUNTRY_CODE_CN:
+        switch (itut_t35->provider_code) {
+        case ITU_T_T35_PROVIDER_CODE_HDR_VIVID: {
+            size_t size;
+            AVDynamicHDRVivid *hdr_vivid = av_dynamic_hdr_vivid_alloc(&size);
+            if (!hdr_vivid)
+                return AVERROR(ENOMEM);
+
+            ret = ff_parse_itu_t_t35_to_dynamic_hdr_vivid(hdr_vivid, 
itut_t35->payload,
+                                                          
itut_t35->payload_size);
+            if (ret < 0) {
+                av_free(hdr_vivid);
+                return ret;
+            }
+
+            metadata->hdr_vivid = av_buffer_create((uint8_t *)hdr_vivid, size, 
NULL, NULL, 0);
+            if (!metadata->hdr_vivid) {
+                av_free(hdr_vivid);
+                return AVERROR(ENOMEM);
+            }
+            break;
+        }
+        default:
+            break;
+        }
+        break;
 
     default:
         // ignore unsupported provider codes
@@ -328,6 +373,13 @@ FF_ENABLE_DEPRECATION_WARNINGS
             return ret;
     }
 
+    if (metadata.hdr_vivid) {
+        ret = ff_frame_new_side_data_from_buf(avctx, frame, 
AV_FRAME_DATA_DYNAMIC_HDR_VIVID,
+                                              &metadata.hdr_vivid);
+        if (ret < 0)
+            return ret;
+    }
+
     ff_itut_t35_unref(&metadata);
 
     return 0;
diff --git a/libavcodec/itut35.h b/libavcodec/itut35.h
index abe56dd849..374433a4ff 100644
--- a/libavcodec/itut35.h
+++ b/libavcodec/itut35.h
@@ -63,6 +63,7 @@ typedef struct FFITUTT35Meta {
     AVBufferRef *lcevc;
     AVBufferRef *hdr_plus;
     AVBufferRef *hdr_smpte2094_app5;
+    AVBufferRef *hdr_vivid;
     AVBufferRef *dovi;
     AVFilmGrainAFGS1Params aom_film_grain;
 } FFITUTT35Meta;

_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to