[FFmpeg-devel] [PATCH 5/9] avcodec/cos_tablegen: use rint instead of floor hack
Ganesh Ajjanagadde
gajjanagadde at gmail.com
Wed Dec 2 01:27:54 CET 2015
Signed-off-by: Ganesh Ajjanagadde <gajjanagadde at gmail.com>
---
libavcodec/cos_tablegen.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libavcodec/cos_tablegen.c b/libavcodec/cos_tablegen.c
index dbd0cc0..332216c 100644
--- a/libavcodec/cos_tablegen.c
+++ b/libavcodec/cos_tablegen.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <math.h>
+#include "libavutil/libm.h"
#include "libavutil/mathematics.h"
#define BITS 16
@@ -40,10 +41,9 @@ static int clip_f15(int v)
static void printval(double val, int fixed)
{
if (fixed) {
- /* lrint() isn't always available, so round and cast manually. */
double new_val = val * (double) (1 << 15);
- new_val = new_val >= 0 ? floor(new_val + 0.5) : ceil(new_val - 0.5);
+ new_val = rint(new_val);
printf(" "FIXEDFMT",", clip_f15((long int) new_val));
} else {
--
2.6.2
More information about the ffmpeg-devel
mailing list