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

Git pushed a commit to branch master
in repository ffmpeg.

commit c500c786ab5c9777586f4a808ea573ed9374e14d
Author:     James Almer <[email protected]>
AuthorDate: Fri May 29 14:08:57 2026 -0300
Commit:     James Almer <[email protected]>
CommitDate: Tue Jun 2 19:50:39 2026 -0300

    avcodec/libaomdec: use the ITU-T T35 parsing helpers
    
    Signed-off-by: James Almer <[email protected]>
---
 configure              |  1 +
 libavcodec/libaomdec.c | 42 +++++++++++++++---------------------------
 2 files changed, 16 insertions(+), 27 deletions(-)

diff --git a/configure b/configure
index 4ac57f299a..7ef7adc53d 100755
--- a/configure
+++ b/configure
@@ -3822,6 +3822,7 @@ hevc_videotoolbox_encoder_select="atsc_a53 
videotoolbox_encoder"
 prores_videotoolbox_encoder_deps="pthreads"
 prores_videotoolbox_encoder_select="videotoolbox_encoder"
 libaom_av1_decoder_deps="libaom"
+libaom_av1_decoder_select="itut_t35"
 libaom_av1_encoder_deps="libaom"
 libaom_av1_encoder_select="extract_extradata_bsf dovi_rpuenc"
 libaribb24_decoder_deps="libaribb24"
diff --git a/libavcodec/libaomdec.c b/libavcodec/libaomdec.c
index 79b299bac8..33925d4cb4 100644
--- a/libavcodec/libaomdec.c
+++ b/libavcodec/libaomdec.c
@@ -143,40 +143,28 @@ static int set_pix_fmt(AVCodecContext *avctx, struct 
aom_image *img)
     }
 }
 
-static int decode_metadata_itu_t_t35(AVFrame *frame,
+static int decode_metadata_itu_t_t35(AVCodecContext *avctx, AVFrame *frame,
                                      const uint8_t *buffer, size_t buffer_size)
 {
+    FFITUTT35 itut35 = { 0 };
+    int ret;
+
     if (buffer_size < 6)
         return AVERROR(EINVAL);
 
-    GetByteContext bc;
-    bytestream2_init(&bc, buffer, buffer_size);
-
-    const int country_code = bytestream2_get_byteu(&bc);
-    const int provider_code = bytestream2_get_be16u(&bc);
-    const int provider_oriented_code = bytestream2_get_be16u(&bc);
-    const int application_identifier = bytestream2_get_byteu(&bc);
-
-    // See "HDR10+ AV1 Metadata Handling Specification" v1.0.1, Section 2.1.
-    if (country_code == ITU_T_T35_COUNTRY_CODE_US
-        && provider_code == ITU_T_T35_PROVIDER_CODE_SAMSUNG
-        && provider_oriented_code == 0x0001
-        && application_identifier == 0x04) {
-        // HDR10+
-        AVDynamicHDRPlus *hdr_plus = 
av_dynamic_hdr_plus_create_side_data(frame);
-        if (!hdr_plus)
-            return AVERROR(ENOMEM);
-
-        int res = av_dynamic_hdr_plus_from_t35(hdr_plus, bc.buffer,
-                                               
bytestream2_get_bytes_left(&bc));
-        if (res < 0)
-            return res;
-    }
+    ret = ff_itut_t35_parse_buffer(&itut35, buffer, buffer_size, 0);
+    if (ret <= 0)
+        return ret;
+
+    ret = ff_itut_t35_parse_payload_to_frame(&itut35, NULL, avctx, frame);
+    if (ret < 0)
+        return ret;
 
     return 0;
 }
 
-static int decode_metadata(AVFrame *frame, const struct aom_image *img)
+static int decode_metadata(AVCodecContext *avctx, AVFrame *frame,
+                           const struct aom_image *img)
 {
     const size_t num_metadata = aom_img_num_metadata(img);
     for (size_t i = 0; i < num_metadata; ++i) {
@@ -186,7 +174,7 @@ static int decode_metadata(AVFrame *frame, const struct 
aom_image *img)
 
         switch (metadata->type) {
         case OBU_METADATA_TYPE_ITUT_T35: {
-            int res = decode_metadata_itu_t_t35(frame, metadata->payload, 
metadata->sz);
+            int res = decode_metadata_itu_t_t35(avctx, frame, 
metadata->payload, metadata->sz);
             if (res < 0)
                 return res;
             break;
@@ -276,7 +264,7 @@ static int aom_decode(AVCodecContext *avctx, AVFrame 
*picture,
             av_image_copy(picture->data, picture->linesize, planes,
                           stride, avctx->pix_fmt, img->d_w, img->d_h);
         }
-        ret = decode_metadata(picture, img);
+        ret = decode_metadata(avctx, picture, img);
         if (ret < 0) {
             av_log(avctx, AV_LOG_ERROR, "Failed to decode metadata\n");
             return ret;

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

Reply via email to