mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
[media] v4l: Fix colorspace conversion error in sample code
The sample code erroneously scales the y1, pb and pr variables from the [0.0 .. 1.0] and [-0.5 .. 0.5] ranges to [0 .. 255] and [-128 .. 127]. Fix it. Signed-off-by: Laurent Pinchart <[email protected]> Acked-by: Hans Verkuil <[email protected]> Signed-off-by: Mauro Carvalho Chehab <[email protected]>
This commit is contained in:
parent
5045b49519
commit
3f359a7cb1
1 changed files with 3 additions and 3 deletions
|
|
@ -391,9 +391,9 @@ clamp (double x)
|
|||
else return r;
|
||||
}
|
||||
|
||||
y1 = (255 / 219.0) * (Y1 - 16);
|
||||
pb = (255 / 224.0) * (Cb - 128);
|
||||
pr = (255 / 224.0) * (Cr - 128);
|
||||
y1 = (Y1 - 16) / 219.0;
|
||||
pb = (Cb - 128) / 224.0;
|
||||
pr = (Cr - 128) / 224.0;
|
||||
|
||||
r = 1.0 * y1 + 0 * pb + 1.402 * pr;
|
||||
g = 1.0 * y1 - 0.344 * pb - 0.714 * pr;
|
||||
|
|
|
|||
Loading…
Reference in a new issue