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

Ganesh Ajjanagadde gajjanagadde at gmail.com
Wed Dec 23 19:47:28 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/dcaenc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dcaenc.c b/libavcodec/dcaenc.c
index 6fcfb1a..cb880bd 100644
--- a/libavcodec/dcaenc.c
+++ b/libavcodec/dcaenc.c
@@ -24,6 +24,7 @@
 #include "libavutil/avassert.h"
 #include "libavutil/channel_layout.h"
 #include "libavutil/common.h"
+#include "libavutil/libm.h"
 #include "avcodec.h"
 #include "dca.h"
 #include "dcadata.h"
@@ -179,7 +180,7 @@ static int encode_init(AVCodecContext *avctx)
             cos_table[2048-i] = cos_table[i];
         }
         for (i = 0; i < 2048; i++) {
-            cb_to_level[i] = (int32_t)(0x7fffffff * pow(10, -0.005 * i));
+            cb_to_level[i] = (int32_t)(0x7fffffff * exp10(-0.005 * i));
         }
 
         for (k = 0; k < 32; k++) {
@@ -205,7 +206,7 @@ static int encode_init(AVCodecContext *avctx)
         }
 
         for (i = 0; i < 256; i++) {
-            double add = 1 + pow(10, -0.01 * i);
+            double add = 1 + exp10(-0.01 * i);
             cb_to_add[i] = (int32_t)(100 * log10(add));
         }
         for (j = 0; j < 8; j++) {
-- 
2.6.4



More information about the ffmpeg-devel mailing list