diff --git a/configure b/configure index 0d3a9e7f7f..037e86c233 100755 --- a/configure +++ b/configure @@ -2765,7 +2765,7 @@ rdft_select="fft" # decoders / encoders aac_decoder_select="adts_header mpeg4audio sinewin" 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" ac3_decoder_select="ac3_parser ac3dsp bswapdsp fmtconvert" ac3_fixed_decoder_select="ac3_parser ac3dsp bswapdsp" diff --git a/libavcodec/aacenc.c b/libavcodec/aacenc.c index 6fe738e172..5bc60c7390 100644 --- a/libavcodec/aacenc.c +++ b/libavcodec/aacenc.c @@ -475,15 +475,15 @@ static void apply_window_and_mdct(AACEncContext *s, SingleChannelElement *sce, float *audio) { int i; - const float *output = sce->ret_buf; + float *output = sce->ret_buf; apply_window[sce->ics.window_sequence[0]](s->fdsp, sce, audio); 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 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(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) { s->coder->update_ltp(s, sce); 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++) { @@ -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); - ff_mdct_end(&s->mdct1024); - ff_mdct_end(&s->mdct128); + av_tx_uninit(&s->mdct1024); + av_tx_uninit(&s->mdct128); ff_psy_end(&s->psy); ff_lpc_end(&s->lpc); 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) { int ret = 0; + float scale = 32768.0f; s->fdsp = avpriv_float_dsp_alloc(avctx->flags & AV_CODEC_FLAG_BITEXACT); if (!s->fdsp) @@ -1200,9 +1201,11 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s) // window 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; - 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 0; diff --git a/libavcodec/aacenc.h b/libavcodec/aacenc.h index f5a2b78c6d..b030c652ae 100644 --- a/libavcodec/aacenc.h +++ b/libavcodec/aacenc.h @@ -109,8 +109,10 @@ typedef struct AACEncContext { AVClass *av_class; AACEncOptions options; ///< encoding options PutBitContext pb; - FFTContext mdct1024; ///< long (1024 samples) frame transform context - FFTContext mdct128; ///< short (128 samples) frame transform context + AVTXContext *mdct1024; ///< long (1024 samples) frame transform context + av_tx_fn mdct1024_fn; + AVTXContext *mdct128; ///< short (128 samples) frame transform context + av_tx_fn mdct128_fn; AVFloatDSPContext *fdsp; AACPCEInfo pce; ///< PCE data, if needed float *planar_samples[16]; ///< saved preprocessed input