[FFmpeg-cvslog] atrac3: convert to lavu/tx

Lynne git at videolan.org
Sun Nov 6 15:41:57 EET 2022


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Tue Nov  1 09:09:35 2022 +0100| [b59e6b5d99a851b4cf54ddfa5e8a666f05f01ed9] | committer: Lynne

atrac3: convert to lavu/tx

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b59e6b5d99a851b4cf54ddfa5e8a666f05f01ed9
---

 configure           |  2 --
 libavcodec/atrac3.c | 13 ++++++++-----
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index 930e8c1b5a..af53716646 100755
--- a/configure
+++ b/configure
@@ -2792,8 +2792,6 @@ asv1_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
 asv2_decoder_select="blockdsp bswapdsp idctdsp"
 asv2_encoder_select="aandcttables bswapdsp fdctdsp pixblockdsp"
 atrac1_decoder_select="sinewin"
-atrac3_decoder_select="mdct"
-atrac3al_decoder_select="mdct"
 atrac3p_decoder_select="mdct sinewin"
 atrac3pal_decoder_select="mdct sinewin"
 av1_decoder_select="av1_frame_split_bsf cbs_av1"
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;
     }



More information about the ffmpeg-cvslog mailing list