[SCM] libav/experimental: Don't use pow/powf functions where we just need integer arithmetic. approved by Benjamin

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 15:46:23 UTC 2013


The following commit has been merged in the experimental branch:
commit 5c4b1b253848eaf098301c67ba426d326579bb68
Author: Alexander Strasser <eclipse7 at gmx.net>
Date:   Fri Feb 10 11:59:38 2006 +0000

    Don't use pow/powf functions where we just need integer arithmetic.
    approved by Benjamin
    
    Originally committed as revision 4973 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavcodec/cook.c b/libavcodec/cook.c
index 4140be1..07368ca 100644
--- a/libavcodec/cook.c
+++ b/libavcodec/cook.c
@@ -185,8 +185,8 @@ static void init_pow2table(COOKContext *q){
     int i;
     q->pow2tab[63] = 1.0;
     for (i=1 ; i<64 ; i++){
-        q->pow2tab[63+i]=(float)pow(2.0,(double)i);
-        q->pow2tab[63-i]=1.0/(float)pow(2.0,(double)i);
+        q->pow2tab[63+i]=(float)((uint64_t)1<<i);
+        q->pow2tab[63-i]=1.0/(float)((uint64_t)1<<i);
     }
 }
 
@@ -195,8 +195,8 @@ static void init_rootpow2table(COOKContext *q){
     int i;
     q->rootpow2tab[63] = 1.0;
     for (i=1 ; i<64 ; i++){
-        q->rootpow2tab[63+i]=sqrt((float)powf(2.0,(float)i));
-        q->rootpow2tab[63-i]=sqrt(1.0/(float)powf(2.0,(float)i));
+        q->rootpow2tab[63+i]=sqrt((float)((uint64_t)1<<i));
+        q->rootpow2tab[63-i]=sqrt(1.0/(float)((uint64_t)1<<i));
     }
 }
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list