1
0

dca_lbr: convert to lavu/tx

Fully converts the DCA decoder to lavu/tx.
This commit is contained in:
Lynne 2022-10-30 11:14:38 +01:00
parent e0661fc805
commit 055413788f
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
3 changed files with 9 additions and 7 deletions

1
configure vendored
View File

@ -2807,7 +2807,6 @@ comfortnoise_encoder_select="lpc"
cook_decoder_select="audiodsp sinewin"
cri_decoder_select="mjpeg_decoder"
cscd_decoder_suggest="zlib"
dca_decoder_select="mdct"
dca_encoder_select="mdct"
dds_decoder_select="texturedsp"
dirac_decoder_select="dirac_parse dwt golomb videodsp mpegvideoenc"

View File

@ -953,12 +953,14 @@ static int parse_ts2_chunk(DCALbrDecoder *s, LBRChunk *chunk, int ch1, int ch2)
static int init_sample_rate(DCALbrDecoder *s)
{
double scale = (-1.0 / (1 << 17)) * sqrt(1 << (2 - s->limited_range));
float scale_t = scale;
int i, br_per_ch = s->bit_rate_scaled / s->nchannels_total;
int ret;
ff_mdct_end(&s->imdct);
av_tx_uninit(&s->imdct);
ret = ff_mdct_init(&s->imdct, s->freq_range + 6, 1, scale);
ret = av_tx_init(&s->imdct, &s->imdct_fn, AV_TX_FLOAT_MDCT, 1,
1 << (s->freq_range + 5), &scale_t, AV_TX_FULL_IMDCT);
if (ret < 0)
return ret;
@ -1714,7 +1716,7 @@ static void transform_channel(DCALbrDecoder *s, int ch, float *output)
base_func_synth(s, ch, values[0], sf);
s->imdct.imdct_calc(&s->imdct, result[0], values[0]);
s->imdct_fn(s->imdct, result[0], values[0], sizeof(float));
// Long window and overlap-add
s->fdsp->vector_fmul_add(output, result[0], s->window,
@ -1834,5 +1836,5 @@ av_cold void ff_dca_lbr_close(DCALbrDecoder *s)
s->ts_size = 0;
av_freep(&s->fdsp);
ff_mdct_end(&s->imdct);
av_tx_uninit(&s->imdct);
}

View File

@ -23,13 +23,13 @@
#include "libavutil/float_dsp.h"
#include "libavutil/mem_internal.h"
#include "libavutil/tx.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dca.h"
#include "dca_exss.h"
#include "dcadsp.h"
#include "fft.h"
#define DCA_LBR_CHANNELS 6
#define DCA_LBR_CHANNELS_TOTAL 32
@ -119,7 +119,8 @@ typedef struct DCALbrDecoder {
DCALbrTone tones[DCA_LBR_TONES]; ///< Circular buffer of tones
int ntones; ///< Circular buffer head position
FFTContext imdct;
AVTXContext *imdct;
av_tx_fn imdct_fn;
AVFloatDSPContext *fdsp;
DCADSPContext *dcadsp;
} DCALbrDecoder;