From patchwork Thu Dec 16 11:29:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 5080 Return-path: Envelope-to: mchehab@gaivota Delivery-date: Thu, 16 Dec 2010 09:31:33 -0200 Received: from mchehab by gaivota with local (Exim 4.72) (envelope-from ) id 1PTC3Z-0003O6-1j for mchehab@gaivota; Thu, 16 Dec 2010 09:31:33 -0200 Received: from casper.infradead.org [85.118.1.10] by gaivota with IMAP (fetchmail-6.3.17) for (single-drop); Thu, 16 Dec 2010 09:31:33 -0200 (BRST) Received: from vger.kernel.org ([209.132.180.67]) by casper.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PTC2d-0001Mg-Ld; Thu, 16 Dec 2010 11:30:36 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755448Ab0LPLae (ORCPT + 1 other); Thu, 16 Dec 2010 06:30:34 -0500 Received: from smtp208.alice.it ([82.57.200.104]:39731 "EHLO smtp208.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754691Ab0LPLad (ORCPT ); Thu, 16 Dec 2010 06:30:33 -0500 Received: from jcn (87.11.136.121) by smtp208.alice.it (8.5.124.08) id 4C1A27160CD13560; Thu, 16 Dec 2010 12:30:32 +0100 Received: from ao2 by jcn with local (Exim 4.72) (envelope-from ) id 1PTC2Y-0002hI-AB; Thu, 16 Dec 2010 12:30:30 +0100 From: Antonio Ospite To: linux-media@vger.kernel.org Cc: Antonio Ospite , openkinect@googlegroups.com, Steven Toth Subject: [RFC, PATCH] Add 10 bit packed greyscale format. Date: Thu, 16 Dec 2010 12:29:44 +0100 Message-Id: <1292498984-9198-1-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.7.2.3 X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Sender: Mauro Carvalho Chehab A 10 bits per pixel greyscale format in a packed array representation is supplied for instance by Kinect sensor device. Signed-off-by: Antonio Ospite --- Hi, This is the first attempt to add v4l support for the 10bpp packed array format used by the Kinect sensor device for depth data and for IR mode (in this mode the device streams the image as seen by the monochrome sensor). This version is mainly to start the discussion about the format and how it should be seen by v4l, the doubts I still have are about: 1. The name of the format: is Y10P OK? Moreover, "packed" here is used in a _stronger_ meaning compared to the other packed formats, and I also saw the name "compact array" used somewhere for these kind of objects. 2. The actual order of the bits, please check the documentation below to see if I got it right. And maybe I should not mention the unpacked version of the data as this depends on the unpacking algorithm, what do you think? 3. The way to illustrate the packed array concept in the documentation: I used a bit-field syntax like in hardware registers docs, does this look meaningful to you? Or should I find a way to clearly show the difference between _byte_alignment_ and _element_alignment_. If you could point to some literature about packed array representations I'd be happy to take a look at it. After these issues are addressed, I am going to submit changes to libv4l as well. Thanks, Antonio Ospite http://ao2.it include/linux/videodev2.h | 1 + Documentation/DocBook/v4l/videodev2.h.xml | 1 + Documentation/DocBook/v4l/pixfmt-y10p.xml | 47 +++++++++++++++++++++++++++++ Documentation/DocBook/media-entities.tmpl | 1 + Documentation/DocBook/v4l/pixfmt.xml | 1 + 5 files changed, 51 insertions(+), 0 deletions(-) create mode 100644 Documentation/DocBook/v4l/pixfmt-y10p.xml diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 5f6f470..7682581 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h @@ -288,6 +288,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ +#define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale as a packed array */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ /* Palette formats */ diff --git a/Documentation/DocBook/v4l/videodev2.h.xml b/Documentation/DocBook/v4l/videodev2.h.xml index 325b23b..773496c 100644 --- a/Documentation/DocBook/v4l/videodev2.h.xml +++ b/Documentation/DocBook/v4l/videodev2.h.xml @@ -289,6 +289,7 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_Y4 v4l2_fourcc('Y', '0', '4', ' ') /* 4 Greyscale */ #define V4L2_PIX_FMT_Y6 v4l2_fourcc('Y', '0', '6', ' ') /* 6 Greyscale */ #define V4L2_PIX_FMT_Y10 v4l2_fourcc('Y', '1', '0', ' ') /* 10 Greyscale */ +#define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale as a packed array */ #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 Greyscale */ /* Palette formats */ diff --git a/Documentation/DocBook/v4l/pixfmt-y10p.xml b/Documentation/DocBook/v4l/pixfmt-y10p.xml new file mode 100644 index 0000000..363f1e5 --- /dev/null +++ b/Documentation/DocBook/v4l/pixfmt-y10p.xml @@ -0,0 +1,47 @@ + + + V4L2_PIX_FMT_Y10P ('Y10P') + &manvol; + + + V4L2_PIX_FMT_Y10P + Grey-scale image as a packed array + + + Description + + This is a packed grey-scale image with a depth of 10 bits per pixel. Pixels + are stored in a packed array of 10bit bits per pixel, thus with no padding + between them. When unpacked to a Y10 format the least significant byte is + stored at lower memory addresses (little-endian). + + + <constant>V4L2_PIX_FMT_Y10P</constant> 4 pixel data stream taking 5 bytes + + + Packed representation + pixels cross the byte boundary and have a ratio of 5 bytes for each 4 + pixels. + + + + + + start: + Y'00[1:0] + Y'00[9:2] + Y'01[1:0] + Y'01[9:2] + Y'02[1:0] + Y'02[9:2] + Y'03[1:0] + Y'03[9:2] + + + + + + + + + diff --git a/Documentation/DocBook/media-entities.tmpl b/Documentation/DocBook/media-entities.tmpl index be34dcb..2b18de5 100644 --- a/Documentation/DocBook/media-entities.tmpl +++ b/Documentation/DocBook/media-entities.tmpl @@ -253,6 +253,7 @@ + diff --git a/Documentation/DocBook/v4l/pixfmt.xml b/Documentation/DocBook/v4l/pixfmt.xml index d7c4671..3682701 100644 --- a/Documentation/DocBook/v4l/pixfmt.xml +++ b/Documentation/DocBook/v4l/pixfmt.xml @@ -592,6 +592,7 @@ information. &sub-packed-yuv; &sub-grey; &sub-y10; + &sub-y10p; &sub-y16; &sub-yuyv; &sub-uyvy;