0

I'm working with a 10 bit RAW bayer pixel format used by the MIPI-CSI and ISP hardware ("IPU3") on an Intel platform.

The memory layout of the RAW format is described here: https://www.kernel.org/doc/html/v5.0/media/uapi/v4l/pixfmt-srggb10-ipu3.html#v4l2-pix-fmt-ipu3-sbggr10

The format is described as "little endian", which I'm not even sure how to interpret here as the pixel values cross byte boundaries somewhat arbitrarily. I guess it just means, "However the pixel value is split on byte boundaries, the least significant bits come first in memory"?

As it doesn't say anything to the contrary, I'm assuming the bits within a byte are still ordered most-to-least significant, where byte 7 is the MSB and byte 0 is the LSB.

From the example table in the documentation I linked, I would interpret the order of the first 2 bytes worth of bits in the image to be:

   (7-0)  (7-2)(1-0)
|bbbbbbbb|ggggggBB|

where "b" are the least significant bits of the first blue pixel value, "B" are the 2 most significant bits of that same first blue pixel value, and "g" are the least significant bits of the first green pixel.

I know other 10+ bit RAW formats have discontiguous pixels in memory, though usually its something like "we always have the 8 most significant bits for all 4 (eg. BGGR) before a fifth byte with the 2 least significant bits of each".

I'm just worried I could be misreading something and it's actually supposed to be:

|bbbbbbbb|BBgggggg|

How do you folks interpret this?

mthiffau
  • 123
  • 1
  • 10
  • IMHO, the pixels **must** be contiguous in memory, apart from the last byte, because 25 pixels of 10-bits each make 250 bits, which they pack into 32 bytes, i.e. 256 bits with 6 bits of padding at the very end. – Mark Setchell Jun 16 '22 at 19:31
  • 1
    From software point of view, we can't really tell how bits within a byte are physically stored. Logically bits in byte are ordered as binary number (the most left binary digit is the most significant). My guess is that `|bbbbbbbb|ggggggBB|` is correct (but it's just a guess). You may share a raw video frame and post a question about parsing it. – Rotem Jun 16 '22 at 20:50

0 Answers0