aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLynne <dev@lynne.ee>2022-11-01 09:50:50 +0100
committerLynne <dev@lynne.ee>2022-11-06 14:39:41 +0100
commit774ea6a00bc5ef17adaae85b861c3c49d269308b (patch)
tree9055269fee39428497737df4d502c0d7ad666678
parent34330adb29d67099ea86435a79161c872d720b7b (diff)
downloadffmpeg-774ea6a00bc5ef17adaae85b861c3c49d269308b.tar.gz
vorbisenc: convert to lavu/tx
-rwxr-xr-xconfigure2
-rw-r--r--libavcodec/vorbisenc.c20
2 files changed, 13 insertions, 9 deletions
diff --git a/configure b/configure
index 2517324516..1ff9b0de62 100755
--- a/configure
+++ b/configure
@@ -2974,7 +2974,7 @@ vbn_decoder_select="texturedsp"
vbn_encoder_select="texturedspenc"
vc1_decoder_select="blockdsp h264qpel intrax8 mpegvideodec msmpeg4dec vc1dsp"
vc1image_decoder_select="vc1_decoder"
-vorbis_encoder_select="audio_frame_queue mdct"
+vorbis_encoder_select="audio_frame_queue"
vp3_decoder_select="hpeldsp vp3dsp videodsp"
vp4_decoder_select="vp3_decoder"
vp5_decoder_select="h264chroma hpeldsp videodsp vp3dsp vp56dsp"
diff --git a/libavcodec/vorbisenc.c b/libavcodec/vorbisenc.c
index dcafe7d591..378a3b38da 100644
--- a/libavcodec/vorbisenc.c
+++ b/libavcodec/vorbisenc.c
@@ -26,11 +26,11 @@
#include <float.h>
#include "libavutil/float_dsp.h"
+#include "libavutil/tx.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
-#include "fft.h"
#include "mathops.h"
#include "vorbis.h"
#include "vorbis_data.h"
@@ -107,7 +107,8 @@ typedef struct vorbis_enc_context {
int channels;
int sample_rate;
int log2_blocksize[2];
- FFTContext mdct[2];
+ AVTXContext *mdct[2];
+ av_tx_fn mdct_fn[2];
const float *win[2];
int have_saved;
float *saved;
@@ -251,6 +252,7 @@ static int ready_residue(vorbis_enc_residue *rc, vorbis_enc_context *venc)
static av_cold int dsp_init(AVCodecContext *avctx, vorbis_enc_context *venc)
{
int ret = 0;
+ float scale = 1.0f;
venc->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!venc->fdsp)
@@ -260,9 +262,11 @@ static av_cold int dsp_init(AVCodecContext *avctx, vorbis_enc_context *venc)
venc->win[0] = ff_vorbis_vwin[venc->log2_blocksize[0] - 6];
venc->win[1] = ff_vorbis_vwin[venc->log2_blocksize[1] - 6];
- if ((ret = ff_mdct_init(&venc->mdct[0], venc->log2_blocksize[0], 0, 1.0)) < 0)
+ if ((ret = av_tx_init(&venc->mdct[0], &venc->mdct_fn[0], AV_TX_FLOAT_MDCT,
+ 0, 1 << (venc->log2_blocksize[0] - 1), &scale, 0)) < 0)
return ret;
- if ((ret = ff_mdct_init(&venc->mdct[1], venc->log2_blocksize[1], 0, 1.0)) < 0)
+ if ((ret = av_tx_init(&venc->mdct[1], &venc->mdct_fn[1], AV_TX_FLOAT_MDCT,
+ 0, 1 << (venc->log2_blocksize[1] - 1), &scale, 0)) < 0)
return ret;
return 0;
@@ -1022,8 +1026,8 @@ static int apply_window_and_mdct(vorbis_enc_context *venc)
fdsp->vector_fmul_reverse(offset, offset, win, window_len);
fdsp->vector_fmul_scalar(offset, offset, 1/n, window_len);
- venc->mdct[1].mdct_calc(&venc->mdct[1], venc->coeffs + channel * window_len,
- venc->samples + channel * window_len * 2);
+ venc->mdct_fn[1](venc->mdct[1], venc->coeffs + channel * window_len,
+ venc->samples + channel * window_len * 2, sizeof(float));
}
return 1;
}
@@ -1256,8 +1260,8 @@ static av_cold int vorbis_encode_close(AVCodecContext *avctx)
av_freep(&venc->scratch);
av_freep(&venc->fdsp);
- ff_mdct_end(&venc->mdct[0]);
- ff_mdct_end(&venc->mdct[1]);
+ av_tx_uninit(&venc->mdct[0]);
+ av_tx_uninit(&venc->mdct[1]);
ff_af_queue_close(&venc->afq);
ff_bufqueue_discard_all(&venc->bufqueue);