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

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


ffmpeg | branch: master | Lynne <dev at lynne.ee> | Sat Oct 29 11:05:06 2022 +0200| [7af43a46d9c373e3561ea081869663a26047c35a] | committer: Lynne

twinvq: convert to lavu/tx

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

 configure           |  4 ++--
 libavcodec/twinvq.c | 12 +++++++-----
 libavcodec/twinvq.h |  6 ++++--
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 5da3ce17a1..d45b24df6e 100755
--- a/configure
+++ b/configure
@@ -2876,7 +2876,7 @@ lscr_decoder_select="inflate_wrapper"
 magicyuv_decoder_select="llviddsp"
 magicyuv_encoder_select="llvidencdsp"
 mdec_decoder_select="blockdsp bswapdsp idctdsp"
-metasound_decoder_select="lsp mdct sinewin"
+metasound_decoder_select="lsp sinewin"
 mimic_decoder_select="blockdsp bswapdsp hpeldsp idctdsp"
 mjpeg_decoder_select="blockdsp hpeldsp exif idctdsp jpegtables"
 mjpeg_encoder_select="jpegtables mpegvideoenc"
@@ -2974,7 +2974,7 @@ truehd_encoder_select="lpc audio_frame_queue"
 truemotion2_decoder_select="bswapdsp"
 truespeech_decoder_select="bswapdsp"
 tscc_decoder_select="inflate_wrapper"
-twinvq_decoder_select="mdct lsp sinewin"
+twinvq_decoder_select="lsp sinewin"
 txd_decoder_select="texturedsp"
 utvideo_decoder_select="bswapdsp llviddsp"
 utvideo_encoder_select="bswapdsp huffman llvidencdsp"
diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index 3ed053bee2..85eca9fc5c 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -329,7 +329,8 @@ static const uint8_t wtype_to_wsize[] = { 0, 0, 2, 2, 2, 1, 0, 1, 1 };
 static void imdct_and_window(TwinVQContext *tctx, enum TwinVQFrameType ftype,
                              int wtype, float *in, float *prev, int ch)
 {
-    FFTContext *mdct = &tctx->mdct_ctx[ftype];
+    AVTXContext *tx = tctx->tx[ftype];
+    av_tx_fn tx_fn = tctx->tx_fn[ftype];
     const TwinVQModeTab *mtab = tctx->mtab;
     int bsize = mtab->size / mtab->fmode[ftype].sub;
     int size  = mtab->size;
@@ -358,7 +359,7 @@ static void imdct_and_window(TwinVQContext *tctx, enum TwinVQFrameType ftype,
 
         wsize = types_sizes[wtype_to_wsize[sub_wtype]];
 
-        mdct->imdct_half(mdct, buf1 + bsize * j, in + bsize * j);
+        tx_fn(tx, buf1 + bsize * j, in + bsize * j, sizeof(float));
 
         tctx->fdsp->vector_fmul_window(out2, prev_buf + (bsize - wsize) / 2,
                                       buf1 + bsize * j,
@@ -544,8 +545,9 @@ static av_cold int init_mdct_win(TwinVQContext *tctx)
 
     for (i = 0; i < 3; i++) {
         int bsize = tctx->mtab->size / tctx->mtab->fmode[i].sub;
-        if ((ret = ff_mdct_init(&tctx->mdct_ctx[i], av_log2(bsize) + 1, 1,
-                                -sqrt(norm / bsize) / (1 << 15))))
+        const float scale = -sqrt(norm / bsize) / (1 << 15);
+        if ((ret = av_tx_init(&tctx->tx[i], &tctx->tx_fn[i], AV_TX_FLOAT_MDCT,
+                              1, bsize, &scale, 0)))
             return ret;
     }
 
@@ -746,7 +748,7 @@ av_cold int ff_twinvq_decode_close(AVCodecContext *avctx)
     int i;
 
     for (i = 0; i < 3; i++) {
-        ff_mdct_end(&tctx->mdct_ctx[i]);
+        av_tx_uninit(&tctx->tx[i]);
         av_freep(&tctx->cos_tabs[i]);
     }
 
diff --git a/libavcodec/twinvq.h b/libavcodec/twinvq.h
index f71d4d1232..3ce096f90a 100644
--- a/libavcodec/twinvq.h
+++ b/libavcodec/twinvq.h
@@ -26,10 +26,11 @@
 #include <stdint.h>
 
 #include "libavutil/attributes_internal.h"
+#include "libavutil/tx.h"
 #include "libavutil/common.h"
 #include "libavutil/float_dsp.h"
 #include "avcodec.h"
-#include "fft.h"
+#include "internal.h"
 
 enum TwinVQCodec {
     TWINVQ_CODEC_VQF,
@@ -137,7 +138,8 @@ typedef struct TwinVQModeTab {
 typedef struct TwinVQContext {
     AVCodecContext *avctx;
     AVFloatDSPContext *fdsp;
-    FFTContext mdct_ctx[3];
+    AVTXContext *tx[3];
+    av_tx_fn tx_fn[3];
 
     const TwinVQModeTab *mtab;
 



More information about the ffmpeg-cvslog mailing list