aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-11-01 08:45:27 +0100
committerLynne <dev@lynne.ee>2022-11-06 14:39:39 +0100
commit978963a77b27d52000f83c647ef46b6d0c390326 (patch)
tree41c0d775508b5d534ac69f3ab51819695c328f13 /libavcodec
parent6ba0aa1770ba29eb4126c6a706f6b0cd3809648f (diff)
downloadffmpeg-978963a77b27d52000f83c647ef46b6d0c390326.tar.gz
wma: convert to lavu/tx
Converts both the decoder and encoders.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/wma.c2
-rw-r--r--libavcodec/wma.h7
-rw-r--r--libavcodec/wmadec.c13
-rw-r--r--libavcodec/wmaenc.c9
4 files changed, 19 insertions, 12 deletions
diff --git a/libavcodec/wma.c b/libavcodec/wma.c
index ddf50d087c..41d16e52f8 100644
--- a/libavcodec/wma.c
+++ b/libavcodec/wma.c
@@ -369,7 +369,7 @@ int ff_wma_end(AVCodecContext *avctx)
int i;
for (i = 0; i < s->nb_block_sizes; i++)
- ff_mdct_end(&s->mdct_ctx[i]);
+ av_tx_uninit(&s->mdct_ctx[i]);
if (s->use_exp_vlc)
ff_free_vlc(&s->exp_vlc);
diff --git a/libavcodec/wma.h b/libavcodec/wma.h
index 80e52687fd..5dc604154d 100644
--- a/libavcodec/wma.h
+++ b/libavcodec/wma.h
@@ -24,9 +24,9 @@
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
+#include "libavutil/tx.h"
#include "avcodec.h"
-#include "fft.h"
#include "get_bits.h"
#include "put_bits.h"
@@ -115,8 +115,9 @@ typedef struct WMACodecContext {
float max_exponent[MAX_CHANNELS];
WMACoef coefs1[MAX_CHANNELS][BLOCK_MAX_SIZE];
DECLARE_ALIGNED(32, float, coefs)[MAX_CHANNELS][BLOCK_MAX_SIZE];
- DECLARE_ALIGNED(32, FFTSample, output)[BLOCK_MAX_SIZE * 2];
- FFTContext mdct_ctx[BLOCK_NB_SIZES];
+ DECLARE_ALIGNED(32, float, output)[BLOCK_MAX_SIZE * 2];
+ AVTXContext *mdct_ctx[BLOCK_NB_SIZES];
+ av_tx_fn mdct_fn[BLOCK_NB_SIZES];
const float *windows[BLOCK_NB_SIZES];
/* output buffer for one frame and the last for IMDCT windowing */
DECLARE_ALIGNED(32, float, frame_out)[MAX_CHANNELS][BLOCK_MAX_SIZE * 2];
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index 4bc6a28daf..15d6fb42b2 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -111,8 +111,9 @@ static av_cold int wma_decode_init(AVCodecContext *avctx)
/* init MDCT */
for (i = 0; i < s->nb_block_sizes; i++) {
- ret = ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1,
- 1, 1.0 / 32768.0);
+ float scale = 1.0 / 32768.0;
+ ret = av_tx_init(&s->mdct_ctx[i], &s->mdct_fn[i], AV_TX_FLOAT_MDCT,
+ 1, 1 << (s->frame_len_bits - i), &scale, AV_TX_FULL_IMDCT);
if (ret < 0)
return ret;
}
@@ -448,7 +449,8 @@ static int wma_decode_block(WMACodecContext *s)
int coef_nb_bits, total_gain;
int nb_coefs[MAX_CHANNELS];
float mdct_norm;
- FFTContext *mdct;
+ AVTXContext *mdct;
+ av_tx_fn mdct_fn;
#ifdef TRACE
ff_tlog(s->avctx, "***decode_block: %d:%d\n",
@@ -757,14 +759,15 @@ static int wma_decode_block(WMACodecContext *s)
}
next:
- mdct = &s->mdct_ctx[bsize];
+ mdct = s->mdct_ctx[bsize];
+ mdct_fn = s->mdct_fn[bsize];
for (ch = 0; ch < channels; ch++) {
int n4, index;
n4 = s->block_len / 2;
if (s->channel_coded[ch])
- mdct->imdct_calc(mdct, s->output, s->coefs[ch]);
+ mdct_fn(mdct, s->output, s->coefs[ch], sizeof(float));
else if (!(s->ms_stereo && ch == 1))
memset(s->output, 0, sizeof(s->output));
diff --git a/libavcodec/wmaenc.c b/libavcodec/wmaenc.c
index 90bb6949cb..2c647af13b 100644
--- a/libavcodec/wmaenc.c
+++ b/libavcodec/wmaenc.c
@@ -92,7 +92,9 @@ static av_cold int encode_init(AVCodecContext *avctx)
/* init MDCT */
for (i = 0; i < s->nb_block_sizes; i++) {
- ret = ff_mdct_init(&s->mdct_ctx[i], s->frame_len_bits - i + 1, 0, 1.0);
+ float scale = 1.0f;
+ ret = av_tx_init(&s->mdct_ctx[i], &s->mdct_fn[i], AV_TX_FLOAT_MDCT,
+ 0, 1 << (s->frame_len_bits - i), &scale, 0);
if (ret < 0)
return ret;
}
@@ -112,7 +114,8 @@ static int apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
const float *const *audio = (const float *const *) frame->extended_data;
int len = frame->nb_samples;
int window_index = s->frame_len_bits - s->block_len_bits;
- FFTContext *mdct = &s->mdct_ctx[window_index];
+ AVTXContext *mdct = s->mdct_ctx[window_index];
+ av_tx_fn mdct_fn = s->mdct_fn[window_index];
int ch;
const float *win = s->windows[window_index];
int window_len = 1 << s->block_len_bits;
@@ -124,7 +127,7 @@ static int apply_window_and_mdct(AVCodecContext *avctx, const AVFrame *frame)
s->fdsp->vector_fmul_reverse(&s->output[window_len], s->frame_out[ch],
win, len);
s->fdsp->vector_fmul(s->frame_out[ch], s->frame_out[ch], win, len);
- mdct->mdct_calc(mdct, s->coefs[ch], s->output);
+ mdct_fn(mdct, s->coefs[ch], s->output, sizeof(float));
if (!isfinite(s->coefs[ch][0])) {
av_log(avctx, AV_LOG_ERROR, "Input contains NaN/+-Inf\n");
return AVERROR(EINVAL);