[PATCH] qcap: Don't clip intermediate values in YUV to RGB conversion code.
Lei Zhang
thestig at google.com
Wed Dec 10 18:26:59 CST 2008
Hi,
The YUV to RGB conversion code follows the formula here. [1] But it's
rounding some of the intermediate values. I.e. yuv_gu and yuv_gv will
never be negative.
[1] http://www.fourcc.org/fccyvrgb.php
-------------- next part --------------
From 77050ce10b1e9da022451e93a6af22e722494dee Mon Sep 17 00:00:00 2001
From: Lei Zhang <thestig at google.com>
Date: Tue, 9 Dec 2008 16:35:32 -0800
Subject: [PATCH] qcap: Don't clip intermediate values in YUV to RGB conversion code.
---
dlls/qcap/yuv.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/qcap/yuv.c b/dlls/qcap/yuv.c
index 358a711..04ca58e 100644
--- a/dlls/qcap/yuv.c
+++ b/dlls/qcap/yuv.c
@@ -68,21 +68,21 @@ void YUV_Init(void) {
for (y_ = 0; y_ <= 255; y_++)
{
y = ((float) 255 / 219) * (y_ - 16);
- yuv_xy[y_] = ValidRange((int) (y));
+ yuv_xy[y_] = (int) (y);
}
for (cb = 0; cb <= 255; cb++)
{
u = ((float) 255 / 224) * (cb - 128);
- yuv_gu[cb] = - ValidRange((int) (0.344 * u));
- yuv_bu[cb] = ValidRange((int) (1.772 * u));
+ yuv_gu[cb] = (int) (-0.344 * u);
+ yuv_bu[cb] = (int) (1.772 * u);
}
for (cr = 0; cr <= 255; cr++)
{
v = ((float) 255 / 224) * (cr - 128);
- yuv_rv[cr] = ValidRange((int) (1.402 * v));
- yuv_gv[cr] = - ValidRange((int) (0.714 * v));
+ yuv_rv[cr] = (int) (1.402 * v);
+ yuv_gv[cr] = (int) (-0.714 * v);
}
TRACE("Filled hash table\n");
}
--
1.5.4.5
More information about the wine-patches
mailing list