* [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332
@ 2016-04-08 19:36 Laurent Pinchart
2016-04-08 19:36 ` [PATCH 1/3] Add support for NV16 and NV61 formats Laurent Pinchart
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Laurent Pinchart @ 2016-04-08 19:36 UTC (permalink / raw)
To: linux-media; +Cc: javier, sakari.ailus
Hello,
The subject says it all, please see individual patches.
Laurent Pinchart (3):
Add support for NV16 and NV61 formats
Add support for YUV420 format
Add support for RGB332 format
raw2rgbpnm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] Add support for NV16 and NV61 formats
2016-04-08 19:36 [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Laurent Pinchart
@ 2016-04-08 19:36 ` Laurent Pinchart
2016-04-08 19:36 ` [PATCH 2/3] Add support for YUV420 format Laurent Pinchart
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2016-04-08 19:36 UTC (permalink / raw)
To: linux-media; +Cc: javier, sakari.ailus
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
raw2rgbpnm.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/raw2rgbpnm.c b/raw2rgbpnm.c
index 96835c3591f5..aa4127330ebe 100644
--- a/raw2rgbpnm.c
+++ b/raw2rgbpnm.c
@@ -81,6 +81,8 @@ static const struct format_info {
{ V4L2_PIX_FMT_Y41P, 12, "Y41P (12 YUV 4:1:1)", 0, 0 },
{ V4L2_PIX_FMT_NV12, 12, "NV12 (12 Y/CbCr 4:2:0)", 0, 0 },
{ V4L2_PIX_FMT_NV21, 12, "NV21 (12 Y/CrCb 4:2:0)", 0, 0 },
+ { V4L2_PIX_FMT_NV16, 16, "NV16 (16 Y/CbCr 4:2:2)", 0, 0 },
+ { V4L2_PIX_FMT_NV61, 16, "NV61 (16 Y/CrCb 4:2:2)", 0, 1 },
{ V4L2_PIX_FMT_YUV410, -1, "YUV410 (9 YUV 4:1:0)", 0, 0 },
{ V4L2_PIX_FMT_YUV420, 12, "YUV420 (12 YUV 4:2:0)", 0, 0 },
{ V4L2_PIX_FMT_YYUV, 12, "YYUV (16 YUV 4:2:2)", 0, 0 },
@@ -289,6 +291,39 @@ static void raw_to_rgb(const struct format_info *info,
}
break;
+ case V4L2_PIX_FMT_NV16:
+ case V4L2_PIX_FMT_NV61:
+ src_luma = src;
+ src_chroma = &src[src_size[0] * src_size[1]];
+ src_stride = src_stride * 8 / 16;
+
+ cb_pos = info->cb_pos;
+ cr_pos = 1 - info->cb_pos;
+
+ for (src_y = 0, dst_y = 0; dst_y < src_size[1]; src_y++, dst_y++) {
+ for (dst_x = 0, src_x = 0; dst_x < src_size[0]; ) {
+ cb = src_chroma[dst_y*src_stride + dst_x + cb_pos];
+ cr = src_chroma[dst_y*src_stride + dst_x + cr_pos];
+
+ a = src_luma[dst_y*src_stride + dst_x];
+ yuv_to_rgb(a,cb,cr, &r, &g, &b);
+ rgb[src_y*rgb_stride+3*src_x+0] = swaprb ? b : r;
+ rgb[src_y*rgb_stride+3*src_x+1] = g;
+ rgb[src_y*rgb_stride+3*src_x+2] = swaprb ? r : b;
+ src_x++;
+ dst_x++;
+
+ a = src_luma[dst_y*src_stride + dst_x];
+ yuv_to_rgb(a,cb,cr, &r, &g, &b);
+ rgb[src_y*rgb_stride+3*src_x+0] = swaprb ? b : r;
+ rgb[src_y*rgb_stride+3*src_x+1] = g;
+ rgb[src_y*rgb_stride+3*src_x+2] = swaprb ? r : b;
+ src_x++;
+ dst_x++;
+ }
+ }
+ break;
+
case V4L2_PIX_FMT_Y12:
shift += 2;
case V4L2_PIX_FMT_Y10:
--
2.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] Add support for YUV420 format
2016-04-08 19:36 [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Laurent Pinchart
2016-04-08 19:36 ` [PATCH 1/3] Add support for NV16 and NV61 formats Laurent Pinchart
@ 2016-04-08 19:36 ` Laurent Pinchart
2016-04-08 19:36 ` [PATCH 3/3] Add support for RGB332 format Laurent Pinchart
2016-04-08 20:23 ` [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Sakari Ailus
3 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2016-04-08 19:36 UTC (permalink / raw)
To: linux-media; +Cc: javier, sakari.ailus
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
raw2rgbpnm.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/raw2rgbpnm.c b/raw2rgbpnm.c
index aa4127330ebe..ac3ee31feb8e 100644
--- a/raw2rgbpnm.c
+++ b/raw2rgbpnm.c
@@ -215,6 +215,7 @@ static void raw_to_rgb(const struct format_info *info,
unsigned int src_stride = src_size[0] * info->bpp / 8;
unsigned int rgb_stride = src_size[0] * 3;
unsigned char *src_luma, *src_chroma;
+ unsigned char *src_cb, *src_cr;
unsigned char *buf;
unsigned int pixel;
int r, g, b, a, cr, cb;
@@ -324,6 +325,28 @@ static void raw_to_rgb(const struct format_info *info,
}
break;
+ case V4L2_PIX_FMT_YUV420:
+ src_luma = src;
+ src_cb = &src[src_size[0] * src_size[1]];
+ src_cr = &src[src_size[0] * src_size[1] / 4 * 5];
+ src_stride = src_stride * 8 / 12;
+
+ for (src_y = 0, dst_y = 0; dst_y < src_size[1]; src_y++, dst_y++) {
+ for (dst_x = 0, src_x = 0; dst_x < src_size[0]; ) {
+ a = src_luma[dst_y*src_stride + dst_x];
+ cb = src_cb[(dst_y/2)*src_stride/2 + dst_x/2];
+ cr = src_cr[(dst_y/2)*src_stride/2 + dst_x/2];
+
+ yuv_to_rgb(a,cb,cr, &r, &g, &b);
+ rgb[src_y*rgb_stride+3*src_x+0] = swaprb ? b : r;
+ rgb[src_y*rgb_stride+3*src_x+1] = g;
+ rgb[src_y*rgb_stride+3*src_x+2] = swaprb ? r : b;
+ src_x++;
+ dst_x++;
+ }
+ }
+ break;
+
case V4L2_PIX_FMT_Y12:
shift += 2;
case V4L2_PIX_FMT_Y10:
--
2.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] Add support for RGB332 format
2016-04-08 19:36 [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Laurent Pinchart
2016-04-08 19:36 ` [PATCH 1/3] Add support for NV16 and NV61 formats Laurent Pinchart
2016-04-08 19:36 ` [PATCH 2/3] Add support for YUV420 format Laurent Pinchart
@ 2016-04-08 19:36 ` Laurent Pinchart
2016-04-08 20:23 ` [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Sakari Ailus
3 siblings, 0 replies; 5+ messages in thread
From: Laurent Pinchart @ 2016-04-08 19:36 UTC (permalink / raw)
To: linux-media; +Cc: javier, sakari.ailus
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
raw2rgbpnm.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/raw2rgbpnm.c b/raw2rgbpnm.c
index ac3ee31feb8e..0cffcced928a 100644
--- a/raw2rgbpnm.c
+++ b/raw2rgbpnm.c
@@ -432,6 +432,21 @@ static void raw_to_rgb(const struct format_info *info,
}
free(buf);
break;
+ case V4L2_PIX_FMT_RGB332:
+ for (src_y = 0, dst_y = 0; dst_y < src_size[1]; src_y++, dst_y++) {
+ for (src_x = 0, dst_x = 0; dst_x < src_size[0]; ) {
+ pixel = src[dst_y*src_stride + dst_x];
+ r = (pixel << 0) & 0xe0;
+ g = (pixel << 3) & 0xe0;
+ b = (pixel << 6) & 0xc0;
+ rgb[src_y*rgb_stride+3*src_x+0] = swaprb ? b : r;
+ rgb[src_y*rgb_stride+3*src_x+1] = g;
+ rgb[src_y*rgb_stride+3*src_x+2] = swaprb ? r : b;
+ src_x++;
+ dst_x++;
+ }
+ }
+ break;
case V4L2_PIX_FMT_RGB555:
for (src_y = 0, dst_y = 0; dst_y < src_size[1]; src_y++, dst_y++) {
for (src_x = 0, dst_x = 0; dst_x < src_size[0]; ) {
--
2.7.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332
2016-04-08 19:36 [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Laurent Pinchart
` (2 preceding siblings ...)
2016-04-08 19:36 ` [PATCH 3/3] Add support for RGB332 format Laurent Pinchart
@ 2016-04-08 20:23 ` Sakari Ailus
3 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2016-04-08 20:23 UTC (permalink / raw)
To: Laurent Pinchart; +Cc: linux-media, javier
On Fri, Apr 08, 2016 at 10:36:11PM +0300, Laurent Pinchart wrote:
> Hello,
>
> The subject says it all, please see individual patches.
>
> Laurent Pinchart (3):
> Add support for NV16 and NV61 formats
> Add support for YUV420 format
> Add support for RGB332 format
>
> raw2rgbpnm.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 73 insertions(+)
Applied, thanks!
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-04-08 20:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-08 19:36 [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Laurent Pinchart
2016-04-08 19:36 ` [PATCH 1/3] Add support for NV16 and NV61 formats Laurent Pinchart
2016-04-08 19:36 ` [PATCH 2/3] Add support for YUV420 format Laurent Pinchart
2016-04-08 19:36 ` [PATCH 3/3] Add support for RGB332 format Laurent Pinchart
2016-04-08 20:23 ` [PATCH 0/3] raw2rgbpnm support for NV16/61, YUV420 and RGB332 Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).