Commit ccdf3805cf for ffmpeg
commit ccdf3805cf3c436e464a5cbe979ef159649cbb7e
Author: lusoris <lusoris@proton.me>
Date: Thu Oct 15 22:06:35 2026 +0200
avcodec/adpcm: guard helpers with decoder configuration
GCC 14.4.0 and 16.2.1 report -Wunused-function for decoder helpers left
compiled when their users are disabled. Guard the escape, hvqm2, hvqm4,
circus, XA, SWF, Sanyo and Citrix helpers with the configuration macros
of the decoders that use them.
This changes which helpers are compiled, without changing decoding when
the corresponding decoder is enabled.
Signed-off-by: lusoris <lusoris@proton.me>
diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c
index 3c294d9120..d3d796fe18 100644
--- a/libavcodec/adpcm.c
+++ b/libavcodec/adpcm.c
@@ -455,6 +455,7 @@ static inline int16_t adpcm_agm_expand_nibble(ADPCMChannelStatus *c, int8_t nibb
return pred;
}
+#if CONFIG_ADPCM_IMA_ESCAPE_DECODER
static inline int16_t adpcm_ima_escape_expand_nibble(ADPCMChannelStatus *c, int8_t nibble)
{
int step_index;
@@ -477,6 +478,7 @@ static inline int16_t adpcm_ima_escape_expand_nibble(ADPCMChannelStatus *c, int8
return (int16_t)c->predictor;
}
+#endif
static inline int16_t adpcm_ima_expand_nibble(ADPCMChannelStatus *c, int8_t nibble, int shift)
{
@@ -614,8 +616,10 @@ int16_t ff_adpcm_ima_qt_expand_nibble(ADPCMChannelStatus *c, int nibble)
return c->predictor;
}
-static void decode_adpcm_ima_hvqm2(AVCodecContext *avctx, int16_t *outbuf, int samples_to_do,
- int frame_format, GetByteContext *gb)
+#if CONFIG_ADPCM_IMA_HVQM2_DECODER
+static void decode_adpcm_ima_hvqm2(AVCodecContext *avctx, int16_t *outbuf,
+ int samples_to_do, int frame_format,
+ GetByteContext *gb)
{
ADPCMDecodeContext *c = avctx->priv_data;
int st = avctx->ch_layout.nb_channels == 2;
@@ -650,9 +654,12 @@ static void decode_adpcm_ima_hvqm2(AVCodecContext *avctx, int16_t *outbuf, int s
bytestream2_seek(gb, 0, SEEK_END);
}
+#endif
-static void decode_adpcm_ima_hvqm4(AVCodecContext *avctx, int16_t *outbuf, int samples_to_do,
- int frame_format, GetByteContext *gb)
+#if CONFIG_ADPCM_IMA_HVQM4_DECODER
+static void decode_adpcm_ima_hvqm4(AVCodecContext *avctx, int16_t *outbuf,
+ int samples_to_do, int frame_format,
+ GetByteContext *gb)
{
ADPCMDecodeContext *c = avctx->priv_data;
int st = avctx->ch_layout.nb_channels == 2;
@@ -693,6 +700,7 @@ static void decode_adpcm_ima_hvqm4(AVCodecContext *avctx, int16_t *outbuf, int s
bytestream2_seek(gb, 0, SEEK_END);
}
+#endif
static inline int16_t adpcm_ms_expand_nibble(ADPCMChannelStatus *c, int nibble)
{
@@ -826,6 +834,7 @@ static inline int16_t adpcm_mtaf_expand_nibble(ADPCMChannelStatus *c, uint8_t ni
return c->predictor;
}
+#if CONFIG_ADPCM_CIRCUS_DECODER
static inline int16_t adpcm_circus_expand_nibble(ADPCMChannelStatus *c, uint8_t nibble)
{
int32_t sample = c->predictor;
@@ -846,6 +855,7 @@ static inline int16_t adpcm_circus_expand_nibble(ADPCMChannelStatus *c, uint8_t
return sample;
}
+#endif
static inline int16_t adpcm_zork_expand_nibble(ADPCMChannelStatus *c, uint8_t nibble)
{
@@ -882,6 +892,7 @@ static inline int16_t adpcm_zork_expand_nibble(ADPCMChannelStatus *c, uint8_t ni
return sample;
}
+#if CONFIG_ADPCM_XA_DECODER
static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
const uint8_t *in, ADPCMChannelStatus *left,
ADPCMChannelStatus *right, int channels, int sample_offset)
@@ -969,7 +980,9 @@ static int xa_decode(AVCodecContext *avctx, int16_t *out0, int16_t *out1,
return 0;
}
+#endif
+#if CONFIG_ADPCM_SWF_DECODER
static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_size, int16_t *samples)
{
ADPCMDecodeContext *c = avctx->priv_data;
@@ -1027,6 +1040,7 @@ static void adpcm_swf_decode(AVCodecContext *avctx, const uint8_t *buf, int buf_
}
}
}
+#endif
int16_t ff_adpcm_argo_expand_nibble(ADPCMChannelStatus *cs, int nibble, int shift, int flag)
{
@@ -1045,6 +1059,7 @@ int16_t ff_adpcm_argo_expand_nibble(ADPCMChannelStatus *cs, int nibble, int shif
return sample;
}
+#if CONFIG_ADPCM_SANYO_DECODER
static int adpcm_sanyo_expand3(ADPCMChannelStatus *c, int bits)
{
int sign, delta, add;
@@ -1210,7 +1225,9 @@ static int adpcm_sanyo_expand5(ADPCMChannelStatus *c, int bits)
c->step = av_clip(c->step, 1, 1024);
return c->predictor;
}
+#endif
+#if CONFIG_ADPCM_IMA_CITRIX_DECODER
static int adpcm_citrix_expand(ADPCMChannelStatus *c, int bits)
{
int step = ff_adpcm_step_table[c->step_index];
@@ -1223,6 +1240,7 @@ static int adpcm_citrix_expand(ADPCMChannelStatus *c, int bits)
c->predictor = av_clip_int16(c->predictor + add);
return c->predictor;
}
+#endif
/**
* Get the number of samples (per channel) that will be decoded from the packet.