Re: [PATCH] v4l: Fix colorspace conversion error in sample code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu 8 August 2013 17:01:10 Laurent Pinchart wrote:
> 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 <laurent.pinchart@xxxxxxxxxxxxxxxx>

Acked-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>

Regards,

	Hans

> ---
>  Documentation/DocBook/media/v4l/pixfmt.xml | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/DocBook/media/v4l/pixfmt.xml b/Documentation/DocBook/media/v4l/pixfmt.xml
> index 99b8d2a..4babd4d 100644
> --- a/Documentation/DocBook/media/v4l/pixfmt.xml
> +++ b/Documentation/DocBook/media/v4l/pixfmt.xml
> @@ -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;
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux