From: Lynne <dev@lynne.ee>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: [FFmpeg-devel] [PATCH 2/6] atrac9dec: switch to lavu/tx
Date: Sat, 24 Sep 2022 01:15:58 +0200 (CEST)
Message-ID: <NCgciJh--3-2@lynne.ee> (raw)
In-Reply-To: <NCgcUxK--3-2@lynne.ee-NCgcZNj----2>
[-- Attachment #1: Type: text/plain, Size: 17 bytes --]
Patch attached.
[-- Attachment #2: 0002-atrac9dec-switch-to-lavu-tx.patch --]
[-- Type: text/x-diff, Size: 3040 bytes --]
From 5a310246569e19efd50b37016a80fe6171df0329 Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Sat, 24 Sep 2022 00:51:18 +0200
Subject: [PATCH 2/6] atrac9dec: switch to lavu/tx
---
libavcodec/atrac9dec.c | 21 +++++++++++++--------
1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/libavcodec/atrac9dec.c b/libavcodec/atrac9dec.c
index d3a5d05799..60962b1676 100644
--- a/libavcodec/atrac9dec.c
+++ b/libavcodec/atrac9dec.c
@@ -25,8 +25,8 @@
#include "codec_internal.h"
#include "decode.h"
#include "get_bits.h"
-#include "fft.h"
#include "atrac9tab.h"
+#include "libavutil/tx.h"
#include "libavutil/lfg.h"
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
@@ -86,7 +86,8 @@ typedef struct ATRAC9BlockData {
typedef struct ATRAC9Context {
AVCodecContext *avctx;
AVFloatDSPContext *fdsp;
- FFTContext imdct;
+ AVTXContext *tx;
+ av_tx_fn tx_fn;
ATRAC9BlockData block[5];
AVLFG lfg;
@@ -101,7 +102,7 @@ typedef struct ATRAC9Context {
uint8_t alloc_curve[48][48];
DECLARE_ALIGNED(32, float, imdct_win)[256];
- DECLARE_ALIGNED(32, float, temp)[256];
+ DECLARE_ALIGNED(32, float, temp)[2048];
} ATRAC9Context;
static VLC sf_vlc[2][8]; /* Signed/unsigned, length */
@@ -778,7 +779,7 @@ imdct:
const ptrdiff_t offset = wsize*frame_idx*sizeof(float);
float *dst = (float *)(frame->extended_data[dst_idx] + offset);
- s->imdct.imdct_half(&s->imdct, s->temp, c->coeffs);
+ s->tx_fn(s->tx, s->temp, c->coeffs, sizeof(float));
s->fdsp->vector_fmul_window(dst, c->prev_win, s->temp,
s->imdct_win, wsize >> 1);
memcpy(c->prev_win, s->temp + (wsize >> 1), sizeof(float)*wsize >> 1);
@@ -834,7 +835,7 @@ static av_cold int atrac9_decode_close(AVCodecContext *avctx)
{
ATRAC9Context *s = avctx->priv_data;
- ff_mdct_end(&s->imdct);
+ av_tx_uninit(&s->tx);
av_freep(&s->fdsp);
return 0;
@@ -896,10 +897,11 @@ static av_cold void atrac9_init_static(void)
static av_cold int atrac9_decode_init(AVCodecContext *avctx)
{
+ float scale;
static AVOnce static_table_init = AV_ONCE_INIT;
GetBitContext gb;
ATRAC9Context *s = avctx->priv_data;
- int version, block_config_idx, superframe_idx, alloc_c_len;
+ int err, version, block_config_idx, superframe_idx, alloc_c_len;
s->avctx = avctx;
@@ -959,8 +961,11 @@ static av_cold int atrac9_decode_init(AVCodecContext *avctx)
s->frame_count = 1 << superframe_idx;
s->frame_log2 = at9_tab_sri_frame_log2[s->samplerate_idx];
- if (ff_mdct_init(&s->imdct, s->frame_log2 + 1, 1, 1.0f / 32768.0f))
- return AVERROR(ENOMEM);
+ scale = 1.0f / 32768.0;
+ err = av_tx_init(&s->tx, &s->tx_fn, AV_TX_FLOAT_MDCT, 1,
+ 1 << s->frame_log2, &scale, 0);
+ if (err < 0)
+ return err;
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!s->fdsp)
--
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".
next prev parent reply other threads:[~2022-09-23 23:16 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 ` Lynne [this message]
[not found] ` <NCgciJh--3-2@lynne.ee-NCgclLI----2>
2022-09-23 23:18 ` [FFmpeg-devel] [PATCH 3/6] ac3: " 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 ` [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=NCgciJh--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