[FFmpeg-devel] [PATCH 5/5] lavc/snowenc: replace rint by lrint

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sat Dec 26 01:00:20 CET 2015


avoids float to int cast, and is slightly superior in terms of rounding
("Dutch/Gauss rounding").

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

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index 90b6439..26a8383 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -19,6 +19,7 @@
  */
 
 #include "libavutil/intmath.h"
+#include "libavutil/libm.h"
 #include "libavutil/log.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
@@ -1470,7 +1471,7 @@ static void update_last_header_values(SnowContext *s){
 }
 
 static int qscale2qlog(int qscale){
-    return rint(QROOT*log2(qscale / (float)FF_QP2LAMBDA))
+    return lrint(QROOT*log2(qscale / (float)FF_QP2LAMBDA))
            + 61*QROOT/8; ///< 64 > 60
 }
 
-- 
2.6.4



More information about the ffmpeg-devel mailing list