shithub: libvpx

Download patch

ref: b2542417cd4dc81c49faa242c3bfdacab853ba6c
parent: 5e2791b54da066cc8543c066813373c9274ff53f
author: James Zern <[email protected]>
date: Fri Jul 22 12:01:09 EDT 2016

vp8/postproc: fix implicit float conversion

float->int as reported by -Wfloat-conversion

Change-Id: I0089e8847b218c47526bcfbb0fffd9aad7c5adb3

--- a/vp8/common/postproc.c
+++ b/vp8/common/postproc.c
@@ -24,13 +24,16 @@
 #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