[FFmpeg-devel] [PATCH 07/15] lavc/cngdec: replace pow(10, x) by exp10(x)

Ganesh Ajjanagadde gajjanagadde at gmail.com
Wed Dec 23 19:47:27 CET 2015


exp10, recently introduced, is superior for the purpose.

We may want to change the exp10 fallback to pow(10,) based; value may
change slightly here.

Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
 libavcodec/cngdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c
index c0295cd..aed4579 100644
--- a/libavcodec/cngdec.c
+++ b/libavcodec/cngdec.c
@@ -22,6 +22,7 @@
 #include <math.h>
 
 #include "libavutil/common.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "celp_filters.h"
 #include "internal.h"
@@ -112,7 +113,7 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data,
 
     if (avpkt->size) {
         int dbov = -avpkt->data[0];
-        p->target_energy = 1081109975 * pow(10, dbov / 10.0) * 0.75;
+        p->target_energy = 1081109975 * exp10(dbov / 10.0) * 0.75;
         memset(p->target_refl_coef, 0, p->order * sizeof(*p->target_refl_coef));
         for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) {
             p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0;
-- 
2.6.4



More information about the ffmpeg-devel mailing list