Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Lynne <dev@lynne.ee>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 5/6] twinvq: convert to lavu/tx
Date: Sat, 24 Sep 2022 01:19:36 +0200 (CEST)
Message-ID: <NCgdYSD--3-2@lynne.ee> (raw)
In-Reply-To: <NCgdOA8--3-2@lynne.ee-NCgdR4N----2>

[-- Attachment #1: Type: text/plain, Size: 17 bytes --]

Patch attached.


[-- Attachment #2: 0005-twinvq-convert-to-lavu-tx.patch --]
[-- Type: text/x-diff, Size: 2877 bytes --]

From 685ac65ce0f391fd1d3a06e191c9659dacd375be Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Sat, 24 Sep 2022 01:07:44 +0200
Subject: [PATCH 5/6] twinvq: convert to lavu/tx

---
 libavcodec/twinvq.c | 12 +++++++-----
 libavcodec/twinvq.h |  6 ++++--
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c
index da10923d78..8cd3c91e14 100644
--- a/libavcodec/twinvq.c
+++ b/libavcodec/twinvq.c
@@ -328,7 +328,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;
@@ -357,7 +358,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,
@@ -543,8 +544,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;
     }
 
@@ -745,7 +747,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 b3c881cfac..72b9ba8198 100644
--- a/libavcodec/twinvq.h
+++ b/libavcodec/twinvq.h
@@ -25,10 +25,11 @@
 #include <math.h>
 #include <stdint.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,
@@ -136,7 +137,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;
 
-- 
2.37.2.609.g9ff673ca1a


[-- Attachment #3: Type: text/plain, Size: 251 bytes --]

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

  parent reply	other threads:[~2022-09-23 23:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-23 23:14 [FFmpeg-devel] [PATCH 1/6] opus: convert encoder and decoder " Lynne
     [not found] ` <NCgcUxK--3-2@lynne.ee-NCgcZNj----2>
2022-09-23 23:15   ` [FFmpeg-devel] [PATCH 2/6] atrac9dec: switch " Lynne
     [not found]   ` <NCgciJh--3-2@lynne.ee-NCgclLI----2>
2022-09-23 23:18     ` [FFmpeg-devel] [PATCH 3/6] ac3: convert encoder and decoder " Lynne
     [not found]     ` <NCgdFqI--B-2@lynne.ee-NCgdIwE----2>
2022-09-23 23:18       ` [FFmpeg-devel] [PATCH 4/6] vorbisdec: convert " Lynne
     [not found]       ` <NCgdOA8--3-2@lynne.ee-NCgdR4N----2>
2022-09-23 23:19         ` Lynne [this message]
     [not found]         ` <NCgdYSD--3-2@lynne.ee-NCgdaK4----2>
2022-09-23 23:20           ` [FFmpeg-devel] [PATCH 6/6] wmaprodec: " Lynne
2022-09-25 12:38             ` Andreas Rheinhardt
2022-09-24 18:42 ` [FFmpeg-devel] [PATCH 1/6] opus: convert encoder and decoder " Martin Storsjö
2022-09-24 19:26   ` Hendrik Leppkes
2022-09-24 19:31     ` Hendrik Leppkes
2022-09-24 19:40       ` Martin Storsjö
2022-09-24 21:57         ` Lynne
2022-09-25 19:55           ` Martin Storsjö
2022-09-25 20:45             ` Lynne
     [not found]         ` <NClNyyy--3-2@lynne.ee-NClVNO6----2>
2022-09-25  7:54           ` Lynne
2022-09-25 12:34             ` Andreas Rheinhardt
2022-09-25 21:08               ` Lynne
2022-09-25 21:17                 ` Andreas Rheinhardt
2022-09-25 21:46                   ` Lynne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=NCgdYSD--3-2@lynne.ee \
    --to=dev@lynne.ee \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git