sonic: avoid float sqrt() for integer input & output
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Jun 2013 23:25:55 +0000 (01:25 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 22 Jun 2013 23:35:34 +0000 (01:35 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/sonic.c

index 85248b1..787cd55 100644 (file)
@@ -545,7 +545,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
     // generate taps
     s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
     for (i = 0; i < s->num_taps; i++)
-        s->tap_quant[i] = (int)(sqrt(i+1));
+        s->tap_quant[i] = ff_sqrt(i+1);
 
     s->channels = avctx->channels;
     s->samplerate = avctx->sample_rate;
@@ -820,7 +820,7 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
     // generate taps
     s->tap_quant = av_calloc(s->num_taps, sizeof(*s->tap_quant));
     for (i = 0; i < s->num_taps; i++)
-        s->tap_quant[i] = (int)(sqrt(i+1));
+        s->tap_quant[i] = ff_sqrt(i+1);
 
     s->predictor_k = av_calloc(s->num_taps, sizeof(*s->predictor_k));