All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: Dave Stevenson <linux-media@destevenson.freeserve.co.uk>,
	Sakari Ailus <sakari.ailus@linux.intel.com>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v2 1/7] v4l: Correct the ordering of LSBs of the 10-bit raw packed formats
Date: Tue, 21 Jun 2016 08:24:57 +0200	[thread overview]
Message-ID: <5768DDB9.30900@xs4all.nl> (raw)
In-Reply-To: <5768545E.4070706@destevenson.freeserve.co.uk>

On 06/20/2016 10:38 PM, Dave Stevenson wrote:
> Hi Hans.
> 
> On 20/06/16 18:03, Hans Verkuil wrote:
>> On 06/20/2016 06:20 PM, Sakari Ailus wrote:
>>> The 10-bit packed raw bayer format documented that the data of the first
>>> pixel of a four-pixel group was found in the first byte and the two
>>> highest bits of the fifth byte. This was not entirely correct. The two
>>> bits in the fifth byte are the two lowest bits. The second pixel occupies
>>> the second byte and third and fourth least significant bits and so on.
>>>
>>> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>> As mentioned, this needs confirmation. I wonder, isn't this specified in the UVC
>> spec?

I can't find anything in the uvc spec. This format was apparently added for an
Intel R200 3D camera, so I suspect it followed the SMIA/CSI standard and that
the doc is indeed wrong.

So:

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

Regards,

	Hans

>>
>> Regards,
>>
>> 	Hans
> I'm assuming this is intended to be the same format as generated by many 
> Bayer sensors.
> Those are defined in both the SMIA CCP2 (section 7.9), and MIPI CSI2 
> (section 11.4.4) specs. Whilst nominally restricted, they are both 
> available via unofficial websites if you Google for them (I'm happy to 
> send links, but didn't want to break mailing list rules by just posting 
> them).
> CSI2 draft spec Figure 98 "RAW10 Data Transmission on CSI-2 Bus Bitwise 
> Illustration" is probably the clearest confirmation of the bit ordering.
> 
> dcraw from http://www.cybercom.net/~dcoffin/dcraw/ can consume Raw10 via 
> nokia_load_raw
>      for (dp=data, col=0; col < raw_width; dp+=5, col+=4)
>        FORC4 RAW(row,col+c) = (dp[c] << 2) | (dp[4] >> (c << 1) & 3);
> 
> And checking against the Raspberry Pi hardware simulator, the RAW10 
> parser code has
>              for (i = 0; i < width; i++) {
>                 switch ((i + tile_x) & 3) {
>                    case 0:  val = (buf[0] << 2) | (buf[4] & 3); break;
>                    case 1:  val = (buf[1] << 2) | ((buf[4] >> 2) & 3); 
> break;
>                    case 2:  val = (buf[2] << 2) | ((buf[4] >> 4) & 3); 
> break;
>                    default: val = (buf[3] << 2) | ((buf[4] >> 6) & 3);
> 
> 
> All of those agree with Sakari's update that the first pixel's LSBits 
> are in bits 1..0 of byte 5, 2nd pixel in bits 3..2, etc.
> 
> Regards,
>    Dave
> (working on the Pi CSI2 receiver V4L2 driver as there is now sufficient 
> data in the public domain to do it. I'll be wanting these formats!)
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  reply	other threads:[~2016-06-21  6:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 16:20 [PATCH v2 0/7] New raw bayer format definitions, fixes Sakari Ailus
2016-06-20 16:20 ` [PATCH v2 1/7] v4l: Correct the ordering of LSBs of the 10-bit raw packed formats Sakari Ailus
2016-06-20 17:03   ` Hans Verkuil
2016-06-20 20:38     ` Dave Stevenson
2016-06-21  6:24       ` Hans Verkuil [this message]
2016-06-20 16:20 ` [PATCH v2 2/7] v4l: Fix number of zeroed high order bits in 12-bit raw format defs Sakari Ailus
2016-06-20 16:54   ` Hans Verkuil
2016-06-20 16:20 ` [PATCH v2 3/7] v4l: Clean up raw bayer pixel format definitions Sakari Ailus
2016-06-20 16:54   ` Hans Verkuil
2016-06-20 16:20 ` [PATCH v2 4/7] v4l: Add packed Bayer raw12 pixel formats Sakari Ailus
2016-06-20 16:20 ` [PATCH v2 5/7] media: Add 1X14 14-bit raw bayer media bus code definitions Sakari Ailus
2016-06-20 16:20 ` [PATCH v2 6/7] v4l: Add 14-bit raw bayer pixel format definitions Sakari Ailus
2016-06-27 14:45   ` [PATCH v2.1 6/9] " Sakari Ailus
2016-07-08  9:24     ` Hans Verkuil
2016-06-20 16:20 ` [PATCH v2 7/7] v4l: Add packed Bayer raw14 pixel formats Sakari Ailus
2016-06-27 14:57 ` [PATCH v2.1 8/9] media: Add 1X16 16-bit raw bayer media bus code definitions Sakari Ailus
2016-06-27 14:57   ` [PATCH v2.1 9/9] v4l: Add 16-bit raw bayer pixel format definitions Sakari Ailus
2016-07-07  6:48     ` [PATCH v2.2 09/10] v4l: 16-bit BGGR is always 16 bits Sakari Ailus
2016-07-07  6:48       ` [PATCH v2.2 10/10] v4l: Add 16-bit raw bayer pixel format definitions Sakari Ailus
2016-07-13 13:48         ` Lad, Prabhakar
2016-07-13 13:47       ` [PATCH v2.2 09/10] v4l: 16-bit BGGR is always 16 bits Lad, Prabhakar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5768DDB9.30900@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=linux-media@destevenson.freeserve.co.uk \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.