On Fri, 21 Sep 2012 11:23:31 -0400, Justin Ruggles <[email protected]> 
wrote:
> ---
>  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,

The function name is a bit strange when output is float. Or is it
referring to something different?

>      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]));
> +        }

No simple way to avoid the memcpy?

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to