1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-11-23 21:54:53 +02:00

avcodec/decode: Optimize lcevc away if disabled

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt
2025-11-02 16:50:36 +01:00
parent 63685709b9
commit 8e90f150eb
3 changed files with 13 additions and 11 deletions

View File

@@ -94,12 +94,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)
@@ -1660,6 +1662,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);
@@ -1672,10 +1675,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);
@@ -1715,6 +1720,7 @@ static int attach_post_process_data(AVCodecContext *avctx, AVFrame *frame)
fdd->post_process = ff_lcevc_process;
}
dc->lcevc.frame = 0;
#endif
return 0;
}
@@ -2083,9 +2089,11 @@ av_cold 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
}
}
@@ -2326,15 +2334,19 @@ av_cold void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *
dst_dc->initial_pict_type = src_dc->initial_pict_type;
dst_dc->intra_only_flag = src_dc->intra_only_flag;
#if CONFIG_LIBLCEVC_DEC
av_refstruct_replace(&dst_dc->lcevc.ctx, src_dc->lcevc.ctx);
#endif
}
av_cold void ff_decode_internal_uninit(AVCodecContext *avctx)
{
#if CONFIG_LIBLCEVC_DEC
AVCodecInternal *avci = avctx->internal;
DecodeContext *dc = decode_ctx(avci);
av_refstruct_unref(&dc->lcevc.ctx);
#endif
}
static int attach_displaymatrix(AVCodecContext *avctx, AVFrame *frame, int orientation)