[FFmpeg-devel] [PATCH 03/11] avcodec/snowenc: use log2 instead of log() / log(2...)

Ganesh Ajjanagadde gajjanagadde at gmail.com
Thu Oct 29 05:20:01 CET 2015


This is likely more precise and conveys the intent better.
The expression has also been accordingly simplified.

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

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 7e8269c..fb0cd3f 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -1547,7 +1547,7 @@ static void calculate_visual_weight(SnowContext *s, Plane *p){
                 }
             }
 
-            b->qlog= (int)(log(352256.0/sqrt(error)) / log(pow(2.0, 1.0/QROOT))+0.5);
+            b->qlog= (int)(QROOT * log2(352256.0/sqrt(error)) + 0.5);
         }
     }
 }
-- 
2.6.2



More information about the ffmpeg-devel mailing list