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 6/6] wmaprodec: convert to lavu/tx
Date: Sat, 24 Sep 2022 01:20:36 +0200 (CEST)
Message-ID: <NCgdm5i--3-2@lynne.ee> (raw)
In-Reply-To: <NCgdYSD--3-2@lynne.ee-NCgdaK4----2>

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

Patch attached.


[-- Attachment #2: 0006-wmaprodec-convert-to-lavu-tx.patch --]
[-- Type: text/x-diff, Size: 3427 bytes --]

From 4ad73f29065051c68991eb96aeae7f771039209a Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Sat, 24 Sep 2022 01:08:00 +0200
Subject: [PATCH 6/6] wmaprodec: convert to lavu/tx

---
 libavcodec/wmaprodec.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c
index 701dfa955c..68e17e0743 100644
--- a/libavcodec/wmaprodec.c
+++ b/libavcodec/wmaprodec.c
@@ -89,6 +89,7 @@
 #include <inttypes.h>
 
 #include "libavutil/audio_fifo.h"
+#include "libavutil/tx.h"
 #include "libavutil/ffmath.h"
 #include "libavutil/float_dsp.h"
 #include "libavutil/intfloat.h"
@@ -185,7 +186,8 @@ typedef struct WMAProDecodeCtx {
     uint8_t          frame_data[MAX_FRAMESIZE +
                       AV_INPUT_BUFFER_PADDING_SIZE];///< compressed frame data
     PutBitContext    pb;                            ///< context for filling the frame_data buffer
-    FFTContext       mdct_ctx[WMAPRO_BLOCK_SIZES];  ///< MDCT context per block size
+    AVTXContext *tx[WMAPRO_BLOCK_SIZES];            ///< MDCT context per block size
+    av_tx_fn tx_fn[WMAPRO_BLOCK_SIZES];
     DECLARE_ALIGNED(32, float, tmp)[WMAPRO_BLOCK_MAX_SIZE]; ///< IMDCT output buffer
     const float*     windows[WMAPRO_BLOCK_SIZES];   ///< windows for the different block sizes
 
@@ -287,7 +289,7 @@ static av_cold int decode_end(WMAProDecodeCtx *s)
     av_freep(&s->fdsp);
 
     for (i = 0; i < WMAPRO_BLOCK_SIZES; i++)
-        ff_mdct_end(&s->mdct_ctx[i]);
+        av_tx_uninit(&s->tx[i]);
 
     return 0;
 }
@@ -552,12 +554,13 @@ static av_cold int decode_init(WMAProDecodeCtx *s, AVCodecContext *avctx, int nu
         return AVERROR(ENOMEM);
 
     /** init MDCT, FIXME: only init needed sizes */
-    for (int i = 0; i < WMAPRO_BLOCK_SIZES; i++) {
-        ret = ff_mdct_init(&s->mdct_ctx[i], WMAPRO_BLOCK_MIN_BITS + 1 + i, 1,
-                           1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + i - 1))
-                           / (1ll << (s->bits_per_sample - 1)));
-        if (ret < 0)
-            return ret;
+    for (i = 0; i < WMAPRO_BLOCK_SIZES; i++) {
+        const float scale = 1.0 / (1 << (WMAPRO_BLOCK_MIN_BITS + i - 1))
+                                / (1ll << (s->bits_per_sample - 1));
+        int err = av_tx_init(&s->tx[i], &s->tx_fn[i], AV_TX_FLOAT_MDCT, 1,
+                             1 << (WMAPRO_BLOCK_MIN_BITS + i), &scale, 0);
+        if (err < 0)
+            return err;
     }
 
     /** init MDCT windows: simple sine window */
@@ -1386,7 +1389,8 @@ static int decode_subframe(WMAProDecodeCtx *s)
             get_bits_count(&s->gb) - s->subframe_offset);
 
     if (transmit_coeffs) {
-        FFTContext *mdct = &s->mdct_ctx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS];
+        AVTXContext *tx = s->tx[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS];
+        av_tx_fn tx_fn = s->tx_fn[av_log2(subframe_len) - WMAPRO_BLOCK_MIN_BITS];
         /** reconstruct the per channel data */
         inverse_channel_transform(s);
         for (i = 0; i < s->channels_for_cur_subframe; i++) {
@@ -1412,7 +1416,7 @@ static int decode_subframe(WMAProDecodeCtx *s)
             }
 
             /** apply imdct (imdct_half == DCTIV with reverse) */
-            mdct->imdct_half(mdct, s->channel[c].coeffs, s->tmp);
+            tx_fn(tx, s->channel[c].coeffs, s->tmp, sizeof(float));
         }
     }
 
-- 
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:20 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         ` [FFmpeg-devel] [PATCH 5/6] twinvq: " Lynne
     [not found]         ` <NCgdYSD--3-2@lynne.ee-NCgdaK4----2>
2022-09-23 23:20           ` Lynne [this message]
2022-09-25 12:38             ` [FFmpeg-devel] [PATCH 6/6] wmaprodec: " 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=NCgdm5i--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