vorbisdec: convert to lavu/tx
This also fixes not checking the return values on transform init. Total decoder speedup on Zen 3: 9%
This commit is contained in:
parent
469cd8d7fa
commit
60c704677a
1
configure
vendored
1
configure
vendored
@ -2983,7 +2983,6 @@ vbn_decoder_select="texturedsp"
|
||||
vbn_encoder_select="texturedspenc"
|
||||
vc1_decoder_select="blockdsp h264qpel intrax8 mpegvideodec msmpeg4dec vc1dsp"
|
||||
vc1image_decoder_select="vc1_decoder"
|
||||
vorbis_decoder_select="mdct"
|
||||
vorbis_encoder_select="audio_frame_queue mdct"
|
||||
vp3_decoder_select="hpeldsp vp3dsp videodsp"
|
||||
vp4_decoder_select="vp3_decoder"
|
||||
|
@ -31,12 +31,12 @@
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/float_dsp.h"
|
||||
#include "libavutil/tx.h"
|
||||
|
||||
#define BITSTREAM_READER_LE
|
||||
#include "avcodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "decode.h"
|
||||
#include "fft.h"
|
||||
#include "get_bits.h"
|
||||
#include "vorbis.h"
|
||||
#include "vorbisdsp.h"
|
||||
@ -130,7 +130,9 @@ typedef struct vorbis_context_s {
|
||||
VorbisDSPContext dsp;
|
||||
AVFloatDSPContext *fdsp;
|
||||
|
||||
FFTContext mdct[2];
|
||||
AVTXContext *mdct[2];
|
||||
av_tx_fn mdct_fn[2];
|
||||
|
||||
uint8_t first_frame;
|
||||
int64_t initial_pts;
|
||||
uint32_t version;
|
||||
@ -202,8 +204,8 @@ static void vorbis_free(vorbis_context *vc)
|
||||
av_freep(&vc->residues);
|
||||
av_freep(&vc->modes);
|
||||
|
||||
ff_mdct_end(&vc->mdct[0]);
|
||||
ff_mdct_end(&vc->mdct[1]);
|
||||
av_tx_uninit(&vc->mdct[0]);
|
||||
av_tx_uninit(&vc->mdct[1]);
|
||||
|
||||
if (vc->codebooks)
|
||||
for (i = 0; i < vc->codebook_count; ++i) {
|
||||
@ -964,6 +966,8 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
|
||||
{
|
||||
GetBitContext *gb = &vc->gb;
|
||||
unsigned bl0, bl1;
|
||||
float scale = -1.0;
|
||||
int ret;
|
||||
|
||||
if ((get_bits(gb, 8) != 'v') || (get_bits(gb, 8) != 'o') ||
|
||||
(get_bits(gb, 8) != 'r') || (get_bits(gb, 8) != 'b') ||
|
||||
@ -1009,8 +1013,16 @@ static int vorbis_parse_id_hdr(vorbis_context *vc)
|
||||
|
||||
vc->previous_window = -1;
|
||||
|
||||
ff_mdct_init(&vc->mdct[0], bl0, 1, -1.0);
|
||||
ff_mdct_init(&vc->mdct[1], bl1, 1, -1.0);
|
||||
ret = av_tx_init(&vc->mdct[0], &vc->mdct_fn[0], AV_TX_FLOAT_MDCT, 1,
|
||||
vc->blocksize[0] >> 1, &scale, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = av_tx_init(&vc->mdct[1], &vc->mdct_fn[1], AV_TX_FLOAT_MDCT, 1,
|
||||
vc->blocksize[1] >> 1, &scale, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
vc->fdsp = avpriv_float_dsp_alloc(vc->avctx->flags & AV_CODEC_FLAG_BITEXACT);
|
||||
if (!vc->fdsp)
|
||||
return AVERROR(ENOMEM);
|
||||
@ -1585,7 +1597,8 @@ static inline int vorbis_residue_decode(vorbis_context *vc, vorbis_residue *vr,
|
||||
static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
|
||||
{
|
||||
GetBitContext *gb = &vc->gb;
|
||||
FFTContext *mdct;
|
||||
AVTXContext *mdct;
|
||||
av_tx_fn mdct_fn;
|
||||
int previous_window = vc->previous_window;
|
||||
unsigned mode_number, blockflag, blocksize;
|
||||
int i, j;
|
||||
@ -1707,12 +1720,13 @@ static int vorbis_parse_audio_packet(vorbis_context *vc, float **floor_ptr)
|
||||
|
||||
// Dotproduct, MDCT
|
||||
|
||||
mdct = &vc->mdct[blockflag];
|
||||
mdct = vc->mdct[blockflag];
|
||||
mdct_fn = vc->mdct_fn[blockflag];
|
||||
|
||||
for (j = vc->audio_channels-1;j >= 0; j--) {
|
||||
ch_res_ptr = vc->channel_residues + res_chan[j] * blocksize / 2;
|
||||
vc->fdsp->vector_fmul(floor_ptr[j], floor_ptr[j], ch_res_ptr, blocksize / 2);
|
||||
mdct->imdct_half(mdct, ch_res_ptr, floor_ptr[j]);
|
||||
mdct_fn(mdct, ch_res_ptr, floor_ptr[j], sizeof(float));
|
||||
}
|
||||
|
||||
// Overlap/add, save data for next overlapping
|
||||
|
Loading…
Reference in New Issue
Block a user