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

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


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sun Oct 30 11:50:41 2022 +0100| [61e1a7d958bce6b75e0bb5e7a17cd7d0e55b44b9] | committer: Lynne

nellymoserdec: convert to lavu/tx

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

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

diff --git a/configure b/configure
index 44889f7617..7ff572f097 100755
--- a/configure
+++ b/configure
@@ -2913,7 +2913,7 @@ mv30_decoder_select="aandcttables blockdsp"
 mvha_decoder_select="inflate_wrapper llviddsp"
 mwsc_decoder_select="inflate_wrapper"
 mxpeg_decoder_select="mjpeg_decoder"
-nellymoser_decoder_select="mdct sinewin"
+nellymoser_decoder_select="sinewin"
 nellymoser_encoder_select="audio_frame_queue mdct sinewin"
 notchlc_decoder_select="lzf"
 nuv_decoder_select="idctdsp"
diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c
index e6b52f8592..727cd4833d 100644
--- a/libavcodec/nellymoserdec.c
+++ b/libavcodec/nellymoserdec.c
@@ -35,12 +35,12 @@
 #include "libavutil/float_dsp.h"
 #include "libavutil/lfg.h"
 #include "libavutil/mem_internal.h"
+#include "libavutil/tx.h"
 
 #define BITSTREAM_READER_LE
 #include "avcodec.h"
 #include "codec_internal.h"
 #include "decode.h"
-#include "fft.h"
 #include "get_bits.h"
 #include "nellymoser.h"
 #include "sinewin.h"
@@ -52,7 +52,8 @@ typedef struct NellyMoserDecodeContext {
     GetBitContext   gb;
     float           scale_bias;
     AVFloatDSPContext *fdsp;
-    FFTContext      imdct_ctx;
+    AVTXContext    *imdct_ctx;
+    av_tx_fn        imdct_fn;
     DECLARE_ALIGNED(32, float, imdct_buf)[2][NELLY_BUF_LEN];
     float          *imdct_out;
     float          *imdct_prev;
@@ -105,7 +106,7 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
         memset(&aptr[NELLY_FILL_LEN], 0,
                (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float));
 
-        s->imdct_ctx.imdct_half(&s->imdct_ctx, s->imdct_out, aptr);
+        s->imdct_fn(s->imdct_ctx, s->imdct_out, aptr, sizeof(float));
         s->fdsp->vector_fmul_window(aptr, s->imdct_prev + NELLY_BUF_LEN / 2,
                                    s->imdct_out, ff_sine_128,
                                    NELLY_BUF_LEN / 2);
@@ -113,14 +114,19 @@ static void nelly_decode_block(NellyMoserDecodeContext *s,
     }
 }
 
-static av_cold int decode_init(AVCodecContext * avctx) {
+static av_cold int decode_init(AVCodecContext * avctx)
+{
+    int ret;
+    float scale = 1.0f;
     NellyMoserDecodeContext *s = avctx->priv_data;
 
     s->avctx = avctx;
     s->imdct_out = s->imdct_buf[0];
     s->imdct_prev = s->imdct_buf[1];
     av_lfg_init(&s->random_state, 0);
-    ff_mdct_init(&s->imdct_ctx, 8, 1, 1.0);
+    if ((ret = av_tx_init(&s->imdct_ctx, &s->imdct_fn, AV_TX_FLOAT_MDCT,
+                          1, 128, &scale, 0)) < 0)
+        return ret;
 
     s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
     if (!s->fdsp)
@@ -179,7 +185,7 @@ static int decode_tag(AVCodecContext *avctx, AVFrame *frame,
 static av_cold int decode_end(AVCodecContext * avctx) {
     NellyMoserDecodeContext *s = avctx->priv_data;
 
-    ff_mdct_end(&s->imdct_ctx);
+    av_tx_uninit(&s->imdct_ctx);
     av_freep(&s->fdsp);
 
     return 0;



More information about the ffmpeg-cvslog mailing list