dca_lbr: convert to lavu/tx

Fully converts the DCA decoder to lavu/tx.
pull/388/head
Lynne 2 years ago
parent e0661fc805
commit 055413788f
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 1
      configure
  2. 10
      libavcodec/dca_lbr.c
  3. 5
      libavcodec/dca_lbr.h

1
configure vendored

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

@ -953,12 +953,14 @@ static int parse_ts2_chunk(DCALbrDecoder *s, LBRChunk *chunk, int ch1, int ch2)
static int init_sample_rate(DCALbrDecoder *s) static int init_sample_rate(DCALbrDecoder *s)
{ {
double scale = (-1.0 / (1 << 17)) * sqrt(1 << (2 - s->limited_range)); 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 i, br_per_ch = s->bit_rate_scaled / s->nchannels_total;
int ret; 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) if (ret < 0)
return ret; return ret;
@ -1714,7 +1716,7 @@ static void transform_channel(DCALbrDecoder *s, int ch, float *output)
base_func_synth(s, ch, values[0], sf); 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 // Long window and overlap-add
s->fdsp->vector_fmul_add(output, result[0], s->window, 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; s->ts_size = 0;
av_freep(&s->fdsp); av_freep(&s->fdsp);
ff_mdct_end(&s->imdct); av_tx_uninit(&s->imdct);
} }

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

Loading…
Cancel
Save