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

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

diff --git a/libavcodec/texturedsp.c b/libavcodec/texturedsp.c
index f32d1b3..c5e6cc6 100644
--- a/libavcodec/texturedsp.c
+++ b/libavcodec/texturedsp.c
@@ -28,6 +28,7 @@
 #include "libavutil/attributes.h"
 #include "libavutil/common.h"
 #include "libavutil/intreadwrite.h"
+#include "libavutil/libm.h"
 
 #include "texturedsp.h"
 
@@ -528,7 +529,7 @@ static inline void rgtc2_block_internal(uint8_t *dst, ptrdiff_t stride,
 
             int d = (255 * 255 - r * r - g * g) / 2;
             if (d > 0)
-                b = rint(sqrtf(d));
+                b = lrint(sqrtf(d));
 
             p[0] = r;
             p[1] = g;
-- 
2.6.4



More information about the ffmpeg-devel mailing list