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

Git pushed a commit to branch release/7.1
in repository ffmpeg.

commit 4007d2a532722e935675d5c9e0dc3de4dfaba1d5
Author:     Andreas Rheinhardt <[email protected]>
AuthorDate: Sun Nov 2 16:50:36 2025 +0100
Commit:     James Almer <[email protected]>
CommitDate: Mon Jan 12 20:53:17 2026 -0300

    avcodec/decode: Optimize lcevc away if disabled
    
    Signed-off-by: Andreas Rheinhardt <[email protected]>
    (cherry picked from commit 8e90f150ebccf3f30fe139245b7d22fd6f1ee4a9)
---
 libavcodec/Makefile   |  2 +-
 libavcodec/decode.c   | 12 ++++++++++++
 libavcodec/lcevcdec.c | 10 ----------
 3 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 153a9e3881..9d1c1fc30f 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -46,7 +46,6 @@ OBJS = ac3_parser.o                                           
          \
        get_buffer.o                                                     \
        imgconvert.o                                                     \
        jni.o                                                            \
-       lcevcdec.o                                                       \
        mathtables.o                                                     \
        mediacodec.o                                                     \
        mpeg12framerate.o                                                \
@@ -124,6 +123,7 @@ OBJS-$(CONFIG_IVIDSP)                  += ivi_dsp.o
 OBJS-$(CONFIG_JNI)                     += ffjni.o jni.o
 OBJS-$(CONFIG_JPEGTABLES)              += jpegtables.o
 OBJS-$(CONFIG_LCMS2)                   += fflcms2.o
+OBJS-$(CONFIG_LIBLCEVC_DEC)            += lcevcdec.o
 OBJS-$(CONFIG_LLAUDDSP)                += lossless_audiodsp.o
 OBJS-$(CONFIG_LLVIDDSP)                += lossless_videodsp.o
 OBJS-$(CONFIG_LLVIDENCDSP)             += lossless_videoencdsp.o
diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 9621f3dc7b..0ab0f4bb4d 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -92,12 +92,14 @@ typedef struct DecodeContext {
      */
     uint64_t side_data_pref_mask;
 
+#if CONFIG_LIBLCEVC_DEC
     struct {
         FFLCEVCContext *ctx;
         int frame;
         int width;
         int height;
     } lcevc;
+#endif
 } DecodeContext;
 
 static DecodeContext *decode_ctx(AVCodecInternal *avci)
@@ -1659,6 +1661,7 @@ int ff_attach_decode_data(AVFrame *frame)
 
 static void update_frame_props(AVCodecContext *avctx, AVFrame *frame)
 {
+#if CONFIG_LIBLCEVC_DEC
     AVCodecInternal    *avci = avctx->internal;
     DecodeContext        *dc = decode_ctx(avci);
 
@@ -1671,10 +1674,12 @@ static void update_frame_props(AVCodecContext *avctx, 
AVFrame *frame)
         frame->width  = frame->width  * 2 / 
FFMAX(frame->sample_aspect_ratio.den, 1);
         frame->height = frame->height * 2 / 
FFMAX(frame->sample_aspect_ratio.num, 1);
     }
+#endif
 }
 
 static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
 {
+#if CONFIG_LIBLCEVC_DEC
     AVCodecInternal    *avci = avctx->internal;
     DecodeContext        *dc = decode_ctx(avci);
 
@@ -1714,6 +1719,7 @@ static int attach_post_process_data(AVCodecContext 
*avctx, AVFrame *frame)
         fdd->post_process = ff_lcevc_process;
     }
     dc->lcevc.frame = 0;
+#endif
 
     return 0;
 }
@@ -2087,9 +2093,11 @@ int ff_decode_preinit(AVCodecContext *avctx)
 
     if (!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) {
         if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+#if CONFIG_LIBLCEVC_DEC
             ret = ff_lcevc_alloc(&dc->lcevc.ctx);
             if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
                 return ret;
+#endif
         }
     }
 
@@ -2335,13 +2343,17 @@ void ff_decode_internal_sync(AVCodecContext *dst, const 
AVCodecContext *src)
 
     dst_dc->initial_pict_type = src_dc->initial_pict_type;
     dst_dc->intra_only_flag   = src_dc->intra_only_flag;
+#if CONFIG_LIBLCEVC_DEC
     ff_refstruct_replace(&dst_dc->lcevc.ctx, src_dc->lcevc.ctx);
+#endif
 }
 
 void ff_decode_internal_uninit(AVCodecContext *avctx)
 {
+#if CONFIG_LIBLCEVC_DEC
     AVCodecInternal *avci = avctx->internal;
     DecodeContext *dc = decode_ctx(avci);
 
     ff_refstruct_unref(&dc->lcevc.ctx);
+#endif
 }
diff --git a/libavcodec/lcevcdec.c b/libavcodec/lcevcdec.c
index ba1887499a..41049f72fc 100644
--- a/libavcodec/lcevcdec.c
+++ b/libavcodec/lcevcdec.c
@@ -16,8 +16,6 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
-#include "config_components.h"
-
 #include "libavutil/avassert.h"
 #include "libavutil/frame.h"
 #include "libavutil/imgutils.h"
@@ -26,7 +24,6 @@
 #include "decode.h"
 #include "lcevcdec.h"
 
-#if CONFIG_LIBLCEVC_DEC
 static LCEVC_ColorFormat map_format(int format)
 {
     switch (format) {
@@ -255,11 +252,9 @@ static void lcevc_free(FFRefStructOpaque unused, void *obj)
         LCEVC_DestroyDecoder(lcevc->decoder);
     memset(lcevc, 0, sizeof(*lcevc));
 }
-#endif
 
 static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
 {
-#if CONFIG_LIBLCEVC_DEC
     LCEVC_AccelContextHandle dummy = { 0 };
     const int32_t event = LCEVC_Log;
 
@@ -278,7 +273,6 @@ static int lcevc_init(FFLCEVCContext *lcevc, void *logctx)
         return AVERROR_EXTERNAL;
     }
 
-#endif
     lcevc->initialized = 1;
 
     return 0;
@@ -297,7 +291,6 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
             return ret;
     }
 
-#if CONFIG_LIBLCEVC_DEC
     av_assert0(frame_ctx->frame);
 
 
@@ -310,7 +303,6 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
         return ret;
 
     av_frame_remove_side_data(frame, AV_FRAME_DATA_LCEVC);
-#endif
 
     return 0;
 }
@@ -318,11 +310,9 @@ int ff_lcevc_process(void *logctx, AVFrame *frame)
 int ff_lcevc_alloc(FFLCEVCContext **plcevc)
 {
     FFLCEVCContext *lcevc = NULL;
-#if CONFIG_LIBLCEVC_DEC
     lcevc = ff_refstruct_alloc_ext(sizeof(*lcevc), 0, NULL, lcevc_free);
     if (!lcevc)
         return AVERROR(ENOMEM);
-#endif
     *plcevc = lcevc;
     return 0;
 }

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

Reply via email to