Signed-off-by: James Almer <jamr...@gmail.com>
---
 configure                 |  1 +
 libavcodec/hevc/hevcdec.c |  3 +++
 libavcodec/hevc/refs.c    | 15 ++++++++++++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 84f63bbb87..3b7cf05bb5 100755
--- a/configure
+++ b/configure
@@ -2975,6 +2975,7 @@ hap_decoder_select="snappy texturedsp"
 hap_encoder_deps="libsnappy"
 hap_encoder_select="texturedspenc"
 hevc_decoder_select="bswapdsp cabac dovi_rpudec golomb hevcparse hevc_sei 
videodsp"
+hevc_decoder_suggest="liblcevc_dec"
 huffyuv_decoder_select="bswapdsp huffyuvdsp llviddsp"
 huffyuv_encoder_select="bswapdsp huffman huffyuvencdsp llvidencdsp"
 hymt_decoder_select="huffyuv_decoder"
diff --git a/libavcodec/hevc/hevcdec.c b/libavcodec/hevc/hevcdec.c
index 4077ed3ac5..41bb7fdfe1 100644
--- a/libavcodec/hevc/hevcdec.c
+++ b/libavcodec/hevc/hevcdec.c
@@ -3459,6 +3459,9 @@ do_output:
     if (ff_container_fifo_read(s->output_fifo, frame) >= 0) {
         if (!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_FILM_GRAIN))
             av_frame_remove_side_data(frame, AV_FRAME_DATA_FILM_GRAIN_PARAMS);
+        if (!CONFIG_LIBLCEVC_DEC &&
+            !(avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS))
+            av_frame_remove_side_data(frame, AV_FRAME_DATA_LCEVC);
 
         return 0;
     }
diff --git a/libavcodec/hevc/refs.c b/libavcodec/hevc/refs.c
index 65abd09a21..88c5c5ea52 100644
--- a/libavcodec/hevc/refs.c
+++ b/libavcodec/hevc/refs.c
@@ -83,10 +83,23 @@ static HEVCFrame *alloc_frame(HEVCContext *s)
         if (frame->f)
             continue;
 
+        ret = ff_progress_frame_alloc(s->avctx, &frame->tf);
+        if (ret < 0)
+            return NULL;
+
+        if (CONFIG_LIBLCEVC_DEC && s->sei.common.lcevc.info && 
!s->avctx->hwaccel &&
+            !(s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) 
{
+            HEVCSEILCEVC *lcevc = &s->sei.common.lcevc;
+            ret = ff_frame_new_side_data_from_buf(s->avctx, frame->tf.f,
+                                                  AV_FRAME_DATA_LCEVC, 
&lcevc->info);
+            if (ret < 0)
+                goto fail;
+        }
+
         ret = ff_progress_frame_get_buffer(s->avctx, &frame->tf,
                                            AV_GET_BUFFER_FLAG_REF);
         if (ret < 0)
-            return NULL;
+            goto fail;
 
         frame->rpl = ff_refstruct_allocz(s->pkt.nb_nals * sizeof(*frame->rpl));
         if (!frame->rpl)
-- 
2.46.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to