summaryrefslogtreecommitdiff
path: root/tests/image.c
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-08-23 16:25:39 +0200
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-08-23 19:00:37 +0200
commitdd6a0d87ffacb35c74abdf1019b88dbf6760b88b (patch)
tree61bc3bd1c906fd31105a36eeb65963255a3b0d58 /tests/image.c
parent73323ba76ad697939b0afe2cae53d1e5959eb36e (diff)
tests: image: fix conversion from RGB to YUV.
Fix RGB to YUV conversion to preserve full data range.
Diffstat (limited to 'tests/image.c')
-rw-r--r--tests/image.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/image.c b/tests/image.c
index 3abcaf82..361874cf 100644
--- a/tests/image.c
+++ b/tests/image.c
@@ -276,9 +276,9 @@ static inline guint32 argb2yuv(guint32 color)
const gint32 g = (color >> 8) & 0xff;
const gint32 b = (color ) & 0xff;
- const guint32 y = (( 263 * r + 516 * g + 100 * b) >> 10) + 16;
- const guint32 u = ((-152 * r - 298 * g + 450 * b) >> 10) + 128;
- const guint32 v = (( 450 * r - 376 * g - 73 * b) >> 10) + 128;
+ const guint32 y = (( 306 * r + 601 * g + 116 * b) >> 10);
+ const guint32 u = ((-172 * r - 339 * g + 512 * b) >> 10) + 128;
+ const guint32 v = (( 512 * r - 428 * g - 83 * b) >> 10) + 128;
return (y << 16) | (u << 8) | v;
}