diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-05-06 13:28:19 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2024-05-07 00:01:39 +0200 |
commit | 8762aa4d62522f993a6f4b03902feb3e6a875b32 (patch) | |
tree | cf595dc62396f20b45f5ae031741bfdbddd55ecc /libavcodec/aac/aacdec_float.c | |
parent | 0fc3d8e4d6d38da5f456ca958647b4ac34926c67 (diff) | |
download | ffmpeg-8762aa4d62522f993a6f4b03902feb3e6a875b32.tar.gz |
avcodec/aac/aacdec: Move init functions to aacdec_fixed/float
This allows to merge it with AACDecDSP.init and remove the latter
(it is called only once anyway); it also allows to make
the fixed/float AACDecDSP and AACDecProc implementations internal
to aacdec_fixed/float.c (which also fixes a violation of our
naming conventions). And it some linker errors when either decoder
is disabled.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/aac/aacdec_float.c')
-rw-r--r-- | libavcodec/aac/aacdec_float.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/libavcodec/aac/aacdec_float.c b/libavcodec/aac/aacdec_float.c index 5efc0c1e54..d48a21eef2 100644 --- a/libavcodec/aac/aacdec_float.c +++ b/libavcodec/aac/aacdec_float.c @@ -68,18 +68,6 @@ static void init_tables_float_fn(void) ff_aac_float_common_init(); } -static int init(AACDecContext *ac) -{ - static AVOnce init_float_once = AV_ONCE_INIT; - ff_thread_once(&init_float_once, init_tables_float_fn); - - ac->fdsp = avpriv_float_dsp_alloc(ac->avctx->flags & AV_CODEC_FLAG_BITEXACT); - if (!ac->fdsp) - return AVERROR(ENOMEM); - - return 0; -} - static const float cce_scale[] = { 1.09050773266525765921, //2^(1/8) 1.18920711500272106672, //2^(1/4) @@ -163,3 +151,23 @@ static inline float *VMUL4S(float *dst, const float *v, unsigned idx, #include "aacdec_float_prediction.h" #include "aacdec_dsp_template.c" #include "aacdec_proc_template.c" + +av_cold int ff_aac_decode_init_float(AVCodecContext *avctx) +{ + static AVOnce init_float_once = AV_ONCE_INIT; + AACDecContext *ac = avctx->priv_data; + + ac->is_fixed = 0; + avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; + + ac->dsp = aac_dsp; + ac->proc = aac_proc; + + ac->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); + if (!ac->fdsp) + return AVERROR(ENOMEM); + + ff_thread_once(&init_float_once, init_tables_float_fn); + + return ff_aac_decode_init(avctx); +} |