[FFmpeg-devel] [PATCH 06/13] avcodec/h264dec: export LCEVC metadata as frame side data

James Almer jamrial at gmail.com
Sat Aug 31 19:31:07 EEST 2024


Signed-off-by: James Almer <jamrial at gmail.com>
---
 configure               | 2 +-
 libavcodec/h264_slice.c | 8 ++++++++
 libavcodec/h264dec.c    | 2 ++
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 261ab6252e..84f63bbb87 100755
--- a/configure
+++ b/configure
@@ -2970,7 +2970,7 @@ h263i_decoder_select="h263_decoder"
 h263p_decoder_select="h263_decoder"
 h263p_encoder_select="h263_encoder"
 h264_decoder_select="cabac golomb h264chroma h264dsp h264parse h264pred h264qpel h264_sei videodsp"
-h264_decoder_suggest="error_resilience"
+h264_decoder_suggest="error_resilience liblcevc_dec"
 hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index a66b75ca80..89172dc05a 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -518,6 +518,14 @@ static int h264_frame_start(H264Context *h)
 
     pic->needs_fg = h->sei.common.film_grain_characteristics.present && !h->avctx->hwaccel &&
         !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN);
+    if (CONFIG_LIBLCEVC_DEC && h->sei.common.lcevc.info && !h->avctx->hwaccel &&
+        !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) {
+        HEVCSEILCEVC *lcevc = &h->sei.common.lcevc;
+        ret = ff_frame_new_side_data_from_buf(h->avctx, pic->f,
+                                              AV_FRAME_DATA_LCEVC, &lcevc->info);
+        if (ret < 0)
+            return ret;
+    }
 
     if ((ret = alloc_picture(h, pic)) < 0)
         return ret;
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index 0154fe17b6..976b21c30e 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -904,6 +904,8 @@ static int output_frame(H264Context *h, AVFrame *dst, H264Picture *srcp)
 
     if (!(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN))
         av_frame_remove_side_data(dst, AV_FRAME_DATA_FILM_GRAIN_PARAMS);
+    if (!CONFIG_LIBLCEVC_DEC && !(h->avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS))
+        av_frame_remove_side_data(dst, AV_FRAME_DATA_LCEVC);
 
     return 0;
 fail:
-- 
2.46.0



More information about the ffmpeg-devel mailing list