---
libavcodec/aacdec.c | 36 +++++++++++++-----------------------
libavcodec/aacsbr.c | 5 ++---
2 files changed, 15 insertions(+), 26 deletions(-)
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 1c59ec5..385c8ae 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -843,13 +843,8 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
}
}
- if (avctx->request_sample_fmt == AV_SAMPLE_FMT_FLT) {
- avctx->sample_fmt = AV_SAMPLE_FMT_FLT;
- output_scale_factor = 1.0 / 32768.0;
- } else {
- avctx->sample_fmt = AV_SAMPLE_FMT_S16;
- output_scale_factor = 1.0;
- }
+ avctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
+ output_scale_factor = 1.0 / 32768.0;
AAC_INIT_VLC_STATIC( 0, 304);
AAC_INIT_VLC_STATIC( 1, 270);
@@ -2473,6 +2468,8 @@ static int aac_decode_frame_int(AVCodecContext *avctx,
void *data,
samples <<= multiplier;
if (samples) {
+ int ch;
+
/* get output buffer */
ac->frame.nb_samples = samples;
if ((err = avctx->get_buffer(avctx, &ac->frame)) < 0) {
@@ -2480,16 +2477,11 @@ static int aac_decode_frame_int(AVCodecContext *avctx,
void *data,
err = -1;
goto fail;
}
-
- if (avctx->sample_fmt == AV_SAMPLE_FMT_FLT)
- ac->fmt_conv.float_interleave((float *)ac->frame.data[0],
- (const float **)ac->output_data,
- samples, avctx->channels);
- else
- ac->fmt_conv.float_to_int16_interleave((int16_t
*)ac->frame.data[0],
- (const float
**)ac->output_data,
- samples, avctx->channels);
-
+ for (ch = 0; ch < avctx->channels; ch++) {
+ memcpy((float *)ac->frame.extended_data[ch],
+ ac->output_data[ch],
+ samples * sizeof(*ac->output_data[ch]));
+ }
*(AVFrame *)data = ac->frame;
}
*got_frame_ptr = !!samples;
@@ -2847,9 +2839,8 @@ AVCodec ff_aac_decoder = {
.close = aac_decode_close,
.decode = aac_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("AAC (Advanced Audio Coding)"),
- .sample_fmts = (const enum AVSampleFormat[]) {
- AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
- },
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
.capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
.channel_layouts = aac_channel_layout,
};
@@ -2868,9 +2859,8 @@ AVCodec ff_aac_latm_decoder = {
.close = aac_decode_close,
.decode = latm_decode_frame,
.long_name = NULL_IF_CONFIG_SMALL("AAC LATM (Advanced Audio Coding
LATM syntax)"),
- .sample_fmts = (const enum AVSampleFormat[]) {
- AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE
- },
+ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP,
+ AV_SAMPLE_FMT_NONE },
.capabilities = CODEC_CAP_CHANNEL_CONF | CODEC_CAP_DR1,
.channel_layouts = aac_channel_layout,
};
diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c
index 5eca115..c47a763 100644
--- a/libavcodec/aacsbr.c
+++ b/libavcodec/aacsbr.c
@@ -148,9 +148,8 @@ av_cold void ff_aac_sbr_ctx_init(AACContext *ac,
SpectralBandReplication *sbr)
/* SBR requires samples to be scaled to +/-32768.0 to work correctly.
* mdct scale factors are adjusted to scale up from +/-1.0 at analysis
* and scale back down at synthesis. */
- mdct_scale = ac->avctx->sample_fmt == AV_SAMPLE_FMT_FLT ? 32768.0f : 1.0f;
- ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * mdct_scale));
- ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * mdct_scale);
+ ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * 32768.0));
+ ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * 32768.0);
ff_ps_ctx_init(&sbr->ps);
ff_sbrdsp_init(&sbr->dsp);
}
--
1.7.1
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel