[FFmpeg-cvslog] lavc/vaapi_encode_av1: insert HDR_CLL metadata if have

Haihao Xiang git at videolan.org
Sat May 11 10:26:00 EEST 2024


ffmpeg | branch: master | Haihao Xiang <haihao.xiang at intel.com> | Wed Apr 10 16:24:57 2024 +0800| [ceace488ff801636b5332fd65d9d2c292367ad42] | committer: Haihao Xiang

lavc/vaapi_encode_av1: insert HDR_CLL metadata if have

Only look for HDR_CLL on key frame on the output.

Signed-off-by: Haihao Xiang <haihao.xiang at intel.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ceace488ff801636b5332fd65d9d2c292367ad42
---

 libavcodec/vaapi_encode_av1.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/libavcodec/vaapi_encode_av1.c b/libavcodec/vaapi_encode_av1.c
index 4077d21202..b868f5b66a 100644
--- a/libavcodec/vaapi_encode_av1.c
+++ b/libavcodec/vaapi_encode_av1.c
@@ -707,6 +707,21 @@ static int vaapi_encode_av1_init_picture_params(AVCodecContext *avctx,
                                mdm->min_luminance.den);
             }
         }
+
+        sd = av_frame_get_side_data(pic->input_image,
+                                    AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
+        if (sd) {
+            AVContentLightMetadata *cllm = (AVContentLightMetadata *)sd->data;
+            AV1RawOBU               *obu = &priv->mh[priv->nb_mh++];
+            AV1RawMetadata           *md = &obu->obu.metadata;
+            AV1RawMetadataHDRCLL    *cll = &md->metadata.hdr_cll;
+
+            memset(obu, 0, sizeof(*obu));
+            obu->header.obu_type = AV1_OBU_METADATA;
+            md->metadata_type    = AV1_METADATA_TYPE_HDR_CLL;
+            cll->max_cll         = cllm->MaxCLL;
+            cll->max_fall        = cllm->MaxFALL;
+        }
     }
 
 end:



More information about the ffmpeg-cvslog mailing list