aacenc: convert to lavu/tx

pull/388/head
Lynne 2 years ago
parent fbe6a51b11
commit 8f3e062314
No known key found for this signature in database
GPG Key ID: A2FEA5F03F034464
  1. 2
      configure
  2. 19
      libavcodec/aacenc.c
  3. 6
      libavcodec/aacenc.h

2
configure vendored

@ -2765,7 +2765,7 @@ rdft_select="fft"
# decoders / encoders # decoders / encoders
aac_decoder_select="adts_header mpeg4audio sinewin" aac_decoder_select="adts_header mpeg4audio sinewin"
aac_fixed_decoder_select="adts_header mpeg4audio" aac_fixed_decoder_select="adts_header mpeg4audio"
aac_encoder_select="audio_frame_queue iirfilter lpc mdct sinewin" aac_encoder_select="audio_frame_queue iirfilter lpc sinewin"
aac_latm_decoder_select="aac_decoder aac_latm_parser" aac_latm_decoder_select="aac_decoder aac_latm_parser"
ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert" ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert"
ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp" ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp"

@ -475,15 +475,15 @@ static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce,
float *audio) float *audio)
{ {
int i; int i;
const float *output = sce->ret_buf; float *output = sce->ret_buf;
apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio); apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio);
if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE) if (sce->ics.window_sequence[0] != EIGHT_SHORT_SEQUENCE)
s->mdct1024.mdct_calc(&s->mdct1024, sce->coeffs, output); s->mdct1024_fn(s->mdct1024, sce->coeffs, output, sizeof(float));
else else
for (i = 0; i < 1024; i += 128) for (i = 0; i < 1024; i += 128)
s->mdct128.mdct_calc(&s->mdct128, &sce->coeffs[i], output + i*2); s->mdct128_fn(s->mdct128, &sce->coeffs[i], output + i*2, sizeof(float));
memcpy(audio, audio + 1024, sizeof(audio[0]) * 1024); memcpy(audio, audio + 1024, sizeof(audio[0]) * 1024);
memcpy(sce->pcoeffs, sce->coeffs, sizeof(sce->pcoeffs)); memcpy(sce->pcoeffs, sce->coeffs, sizeof(sce->pcoeffs));
} }
@ -939,7 +939,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
if (s->options.ltp && s->coder->update_ltp) { if (s->options.ltp && s->coder->update_ltp) {
s->coder->update_ltp(s, sce); s->coder->update_ltp(s, sce);
apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, &sce->ltp_state[0]); apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, &sce->ltp_state[0]);
s->mdct1024.mdct_calc(&s->mdct1024, sce->lcoeffs, sce->ret_buf); s->mdct1024_fn(s->mdct1024, sce->lcoeffs, sce->ret_buf, sizeof(float));
} }
for (k = 0; k < 1024; k++) { for (k = 0; k < 1024; k++) {
@ -1176,8 +1176,8 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
av_log(avctx, AV_LOG_INFO, "Qavg: %.3f\n", s->lambda_count ? s->lambda_sum / s->lambda_count : NAN); av_log(avctx, AV_LOG_INFO, "Qavg: %.3f\n", s->lambda_count ? s->lambda_sum / s->lambda_count : NAN);
ff_mdct_end(&s->mdct1024); av_tx_uninit(&s->mdct1024);
ff_mdct_end(&s->mdct128); av_tx_uninit(&s->mdct128);
ff_psy_end(&s->psy); ff_psy_end(&s->psy);
ff_lpc_end(&s->lpc); ff_lpc_end(&s->lpc);
if (s->psypp) if (s->psypp)
@ -1192,6 +1192,7 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s) static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
{ {
int ret = 0; int ret = 0;
float scale = 32768.0f;
s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT);
if (!s->fdsp) if (!s->fdsp)
@ -1200,9 +1201,11 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
// window init // window init
ff_aac_float_common_init(); ff_aac_float_common_init();
if ((ret = ff_mdct_init(&s->mdct1024, 11, 0, 32768.0)) < 0) if ((ret = av_tx_init(&s->mdct1024, &s->mdct1024_fn, AV_TX_FLOAT_MDCT, 0,
1024, &scale, 0)) < 0)
return ret; return ret;
if ((ret = ff_mdct_init(&s->mdct128, 8, 0, 32768.0)) < 0) if ((ret = av_tx_init(&s->mdct128, &s->mdct128_fn, AV_TX_FLOAT_MDCT, 0,
128, &scale, 0)) < 0)
return ret; return ret;
return 0; return 0;

@ -109,8 +109,10 @@ typedef struct AACEncContext {
AVClass *av_class; AVClass *av_class;
AACEncOptions options; ///< encoding options AACEncOptions options; ///< encoding options
PutBitContext pb; PutBitContext pb;
FFTContext mdct1024; ///< long (1024 samples) frame transform context AVTXContext *mdct1024; ///< long (1024 samples) frame transform context
FFTContext mdct128; ///< short (128 samples) frame transform context av_tx_fn mdct1024_fn;
AVTXContext *mdct128; ///< short (128 samples) frame transform context
av_tx_fn mdct128_fn;
AVFloatDSPContext *fdsp; AVFloatDSPContext *fdsp;
AACPCEInfo pce; ///< PCE data, if needed AACPCEInfo pce; ///< PCE data, if needed
float *planar_samples[16]; ///< saved preprocessed input float *planar_samples[16]; ///< saved preprocessed input

Loading…
Cancel
Save