diff options
author | Lynne <dev@lynne.ee> | 2022-11-01 09:09:35 +0100 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2022-11-06 14:39:40 +0100 |
commit | b59e6b5d99a851b4cf54ddfa5e8a666f05f01ed9 (patch) | |
tree | 9b71710a209d023adabc0672075988889e5ceceb /libavcodec/atrac3.c | |
parent | 5f52094f3d4adc69745fc830bef9a1287ee0d92d (diff) | |
download | ffmpeg-b59e6b5d99a851b4cf54ddfa5e8a666f05f01ed9.tar.gz |
atrac3: convert to lavu/tx
Diffstat (limited to 'libavcodec/atrac3.c')
-rw-r--r-- | libavcodec/atrac3.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 12ba55d34d..7415da590b 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -40,12 +40,12 @@ #include "libavutil/libm.h" #include "libavutil/mem_internal.h" #include "libavutil/thread.h" +#include "libavutil/tx.h" #include "avcodec.h" #include "bytestream.h" #include "codec_internal.h" #include "decode.h" -#include "fft.h" #include "get_bits.h" #include "atrac.h" @@ -115,7 +115,8 @@ typedef struct ATRAC3Context { //@} AtracGCContext gainc_ctx; - FFTContext mdct_ctx; + AVTXContext *mdct_ctx; + av_tx_fn mdct_fn; void (*vector_fmul)(float *dst, const float *src0, const float *src1, int len); } ATRAC3Context; @@ -147,7 +148,7 @@ static void imlt(ATRAC3Context *q, float *input, float *output, int odd_band) FFSWAP(float, input[i], input[255 - i]); } - q->mdct_ctx.imdct_calc(&q->mdct_ctx, output, input); + q->mdct_fn(q->mdct_ctx, output, input, sizeof(float)); /* Perform windowing on the output. */ q->vector_fmul(output, output, mdct_window, MDCT_SIZE); @@ -201,7 +202,7 @@ static av_cold int atrac3_decode_close(AVCodecContext *avctx) av_freep(&q->units); av_freep(&q->decoded_bytes_buffer); - ff_mdct_end(&q->mdct_ctx); + av_tx_uninit(&q->mdct_ctx); return 0; } @@ -879,6 +880,7 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) const uint8_t *edata_ptr = avctx->extradata; ATRAC3Context *q = avctx->priv_data; AVFloatDSPContext *fdsp; + float scale = 1.0 / 32768; int channels = avctx->ch_layout.nb_channels; if (channels < MIN_CHANNELS || channels > MAX_CHANNELS) { @@ -977,7 +979,8 @@ static av_cold int atrac3_decode_init(AVCodecContext *avctx) avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; /* initialize the MDCT transform */ - if ((ret = ff_mdct_init(&q->mdct_ctx, 9, 1, 1.0 / 32768)) < 0) { + if ((ret = av_tx_init(&q->mdct_ctx, &q->mdct_fn, AV_TX_FLOAT_MDCT, 1, 256, + &scale, AV_TX_FULL_IMDCT)) < 0) { av_log(avctx, AV_LOG_ERROR, "Error initializing MDCT\n"); return ret; } |