vp8/postproc: fix implicit float conversion
authorJames Zern <jzern@google.com>
Fri, 22 Jul 2016 23:01:09 +0000 (16:01 -0700)
committerJames Zern <jzern@google.com>
Fri, 22 Jul 2016 23:01:52 +0000 (16:01 -0700)
float->int as reported by -Wfloat-conversion

Change-Id: I0089e8847b218c47526bcfbb0fffd9aad7c5adb3

vp8/common/postproc.c

index 3a3b334..b0e89ee 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 
-#define RGB_TO_YUV(t)                                                   \
-  ((0.257 * (float)(t >> 16)) + (0.504 * (float)(t >> 8 & 0xff)) +      \
-   (0.098 * (float)(t & 0xff)) + 16),                                   \
-      (-(0.148 * (float)(t >> 16)) - (0.291 * (float)(t >> 8 & 0xff)) + \
-       (0.439 * (float)(t & 0xff)) + 128),                              \
-      ((0.439 * (float)(t >> 16)) - (0.368 * (float)(t >> 8 & 0xff)) -  \
-       (0.071 * (float)(t & 0xff)) + 128)
+#define RGB_TO_YUV(t)                                     \
+  (unsigned char)((0.257 * (float)(t >> 16)) +            \
+                  (0.504 * (float)(t >> 8 & 0xff)) +      \
+                  (0.098 * (float)(t & 0xff)) + 16),      \
+  (unsigned char)(-(0.148 * (float)(t >> 16)) -           \
+                  (0.291 * (float)(t >> 8 & 0xff)) +      \
+                  (0.439 * (float)(t & 0xff)) + 128),     \
+  (unsigned char)((0.439 * (float)(t >> 16)) -            \
+                  (0.368 * (float)(t >> 8 & 0xff)) -      \
+                  (0.071 * (float)(t & 0xff)) + 128)
 
 /* global constants */
 #if CONFIG_POSTPROC_VISUALIZER