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

Ganesh Ajjanagadde gajjanagadde at gmail.com
Sat Dec 26 01:00:19 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/dds.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dds.c b/libavcodec/dds.c
index d473fd1..9577b67 100644
--- a/libavcodec/dds.c
+++ b/libavcodec/dds.c
@@ -28,6 +28,7 @@
 
 #include <stdint.h>
 
+#include "libavutil/libm.h"
 #include "libavutil/imgutils.h"
 
 #include "avcodec.h"
@@ -508,7 +509,7 @@ static void run_postproc(AVCodecContext *avctx, AVFrame *frame)
 
             int d = (255 * 255 - x * x - y * y) / 2;
             if (d > 0)
-                z = rint(sqrtf(d));
+                z = lrint(sqrtf(d));
 
             src[0] = x;
             src[1] = y;
-- 
2.6.4



More information about the ffmpeg-devel mailing list