[FFmpeg-devel] [PATCH] aacenc: avoid double in quantize_bands.

Ganesh Ajjanagadde gajjanag at gmail.com
Wed Mar 2 04:48:06 CET 2016


On Tue, Mar 1, 2016 at 4:55 PM, Reimar Döffinger
<Reimar.Doeffinger at gmx.de> wrote:
> I cannot see any point whatsoever to use
> double here instead of float.

There can be some negligible accuracy differences, but I do not see
any harm myself; aac anyway sticks to floats in most places.

> Using float allows for use of SIMD.

Not an accurate statement, there is SIMD for doubles as well. More
precise variant is "allows for more effective/efficient use of SIMD".

Patch itself LGTM, but I am not an aac maintainer.

> ---
>  libavcodec/aacenc_utils.h | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/libavcodec/aacenc_utils.h b/libavcodec/aacenc_utils.h
> index cb5bc8d..571b1e6 100644
> --- a/libavcodec/aacenc_utils.h
> +++ b/libavcodec/aacenc_utils.h
> @@ -66,10 +66,9 @@ static inline void quantize_bands(int *out, const float *in, const float *scaled
>                                    const float rounding)
>  {
>      int i;
> -    double qc;
>      for (i = 0; i < size; i++) {
> -        qc = scaled[i] * Q34;
> -        out[i] = (int)FFMIN(qc + rounding, (double)maxval);
> +        float qc = scaled[i] * Q34;
> +        out[i] = (int)FFMIN(qc + rounding, (float)maxval);
>          if (is_signed && in[i] < 0.0f) {
>              out[i] = -out[i];
>          }
> --
> 2.7.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list