mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
vorbisenc: convert to lavu/tx
This commit is contained in:
parent
34330adb29
commit
774ea6a00b
2
configure
vendored
2
configure
vendored
@ -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"
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user