Skip to contentSkip to conversation

New raw bayer format definitions, fixes

PATCH Superseded Sakari Ailus 2 participants 17 messages May 27, 2016 – Jun 20, 2016

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#1 lore raw

PATCH 1/6 v4l: Correct the ordering of LSBs of the 10-bit raw packed formats

In reply to Sakari Ailus

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.

---
 .../DocBook/media/v4l/pixfmt-srggb10p.xml          | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)
Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml +16 -16
index a8cc102..747822b 100644
@@ -47,10 +47,10 @@
 		  <entry>G<subscript>01high</subscript></entry>
 		  <entry>B<subscript>02high</subscript></entry>
 		  <entry>G<subscript>03high</subscript></entry>
-		  <entry>B<subscript>00low</subscript>(bits 7--6)
-			 G<subscript>01low</subscript>(bits 5--4)
-			 B<subscript>02low</subscript>(bits 3--2)
-			 G<subscript>03low</subscript>(bits 1--0)
+		  <entry>G<subscript>03low</subscript>(bits 7--6)
+			 B<subscript>02low</subscript>(bits 5--4)
+			 G<subscript>01low</subscript>(bits 3--2)
+			 B<subscript>00low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 		<row>
@@ -59,10 +59,10 @@
 		  <entry>R<subscript>11high</subscript></entry>
 		  <entry>G<subscript>12high</subscript></entry>
 		  <entry>R<subscript>13high</subscript></entry>
-		  <entry>G<subscript>10low</subscript>(bits 7--6)
-			 R<subscript>11low</subscript>(bits 5--4)
-			 G<subscript>12low</subscript>(bits 3--2)
-			 R<subscript>13low</subscript>(bits 1--0)
+		  <entry>R<subscript>13low</subscript>(bits 7--6)
+			 G<subscript>12low</subscript>(bits 5--4)
+			 R<subscript>11low</subscript>(bits 3--2)
+			 G<subscript>10low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 		<row>
@@ -71,10 +71,10 @@
 		  <entry>G<subscript>21high</subscript></entry>
 		  <entry>B<subscript>22high</subscript></entry>
 		  <entry>G<subscript>23high</subscript></entry>
-		  <entry>B<subscript>20low</subscript>(bits 7--6)
-			 G<subscript>21low</subscript>(bits 5--4)
-			 B<subscript>22low</subscript>(bits 3--2)
-			 G<subscript>23low</subscript>(bits 1--0)
+		  <entry>G<subscript>23low</subscript>(bits 7--6)
+			 B<subscript>22low</subscript>(bits 5--4)
+			 G<subscript>21low</subscript>(bits 3--2)
+			 B<subscript>20low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 		<row>
@@ -83,10 +83,10 @@
 		  <entry>R<subscript>31high</subscript></entry>
 		  <entry>G<subscript>32high</subscript></entry>
 		  <entry>R<subscript>33high</subscript></entry>
-		  <entry>G<subscript>30low</subscript>(bits 7--6)
-			 R<subscript>31low</subscript>(bits 5--4)
-			 G<subscript>32low</subscript>(bits 3--2)
-			 R<subscript>33low</subscript>(bits 1--0)
+		  <entry>R<subscript>33low</subscript>(bits 7--6)
+			 G<subscript>32low</subscript>(bits 5--4)
+			 R<subscript>31low</subscript>(bits 3--2)
+			 G<subscript>30low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 	      </tbody>
Signature · 1 line
1.9.1
#6 lore raw

PATCH 3/6 v4l: Add packed Bayer raw12 pixel formats

In reply to Sakari Ailus

These formats are compressed 12-bit raw bayer formats with four different pixel orders. They are similar to 10-bit variants. The formats added by this patch are

	V4L2_PIX_FMT_SBGGR12P
	V4L2_PIX_FMT_SGBRG12P
	V4L2_PIX_FMT_SGRBG12P
	V4L2_PIX_FMT_SRGGB12P
---
 .../DocBook/media/v4l/pixfmt-srggb12p.xml          | 103 +++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |   1 +
 include/uapi/linux/videodev2.h                     |   5 +
 3 files changed, 109 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml
Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml new file +103 -0
new file mode 100644
index 0000000..affa366
@@ -0,0 +1,103 @@
+    <refentry id="pixfmt-srggb12p">
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB12P ('pRCC'),
+	 V4L2_PIX_FMT_SGRBG12P ('pgCC'),
+	 V4L2_PIX_FMT_SGBRG12P ('pGCC'),
+	 V4L2_PIX_FMT_SBGGR12P ('pBCC'),
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB12P"><constant>V4L2_PIX_FMT_SRGGB12P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG12P"><constant>V4L2_PIX_FMT_SGRBG12P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG12P"><constant>V4L2_PIX_FMT_SGBRG12P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR12P"><constant>V4L2_PIX_FMT_SBGGR12P</constant></refname>
+	<refpurpose>12-bit packed Bayer formats</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are packed raw sRGB / Bayer
+	formats with 12 bits per colour. Every four consecutive colour
+	components are packed into 6 bytes. Each of the first 4 bytes
+	contain the 8 high order bits of the pixels, and the fifth and
+	sixth bytes contains the four least significants bits of each
+	pixel, in the same order.</para>
+
+	<para>Each n-pixel row contains n/2 green samples and n/2 blue
+	or red samples, with alternating green-red and green-blue
+	rows. They are conventionally described as GRGR... BGBG...,
+	RGRG... GBGB..., etc. Below is an example of one of these
+	formats:</para>
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR12P</constant> 4 &times; 4
+      pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte.
+	  <informaltable frame="topbot" colsep="1" rowsep="1">
+	    <tgroup cols="6" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00high</subscript></entry>
+		  <entry>G<subscript>01high</subscript></entry>
+		  <entry>G<subscript>01low</subscript>(bits 7--4)
+			 B<subscript>00low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>B<subscript>02high</subscript></entry>
+		  <entry>G<subscript>03high</subscript></entry>
+		  <entry>G<subscript>03low</subscript>(bits 7--4)
+			 B<subscript>02low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;6:</entry>
+		  <entry>G<subscript>10high</subscript></entry>
+		  <entry>R<subscript>11high</subscript></entry>
+		  <entry>R<subscript>11low</subscript>(bits 7--4)
+			 G<subscript>10low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>12high</subscript></entry>
+		  <entry>R<subscript>13high</subscript></entry>
+		  <entry>R<subscript>13low</subscript>(bits 7--4)
+			 G<subscript>12low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;12:</entry>
+		  <entry>B<subscript>20high</subscript></entry>
+		  <entry>G<subscript>21high</subscript></entry>
+		  <entry>G<subscript>21low</subscript>(bits 7--4)
+			 B<subscript>20low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>B<subscript>22high</subscript></entry>
+		  <entry>G<subscript>23high</subscript></entry>
+		  <entry>G<subscript>23low</subscript>(bits 7--4)
+			 B<subscript>22low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;18:</entry>
+		  <entry>G<subscript>30high</subscript></entry>
+		  <entry>R<subscript>31high</subscript></entry>
+		  <entry>R<subscript>31low</subscript>(bits 7--4)
+			 G<subscript>30low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>32high</subscript></entry>
+		  <entry>R<subscript>33high</subscript></entry>
+		  <entry>R<subscript>33low</subscript>(bits 7--4)
+			 G<subscript>32low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 5a08aee..457337e 100644
@@ -1593,6 +1593,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb10alaw8;
     &sub-srggb10dpcm8;
     &sub-srggb12;
+    &sub-srggb12p;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +5 -0
index 8f95191..7ace868 100644
@@ -576,6 +576,11 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
 #define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
 #define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
+	/* 12bit raw bayer packed, 6 bytes for every 4 pixels */
+#define V4L2_PIX_FMT_SBGGR12P v4l2_fourcc('p', 'B', 'C', 'C')
+#define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
+#define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
+#define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
Signature · 1 line
1.9.1
#0 lore raw

cover New raw bayer format definitions, fixes

Hi,

These patches fix and add new raw bayer format definitions. 12-bit packed V4L2 format definition is added as well as definitions of 14-bit media bus codes as well as unpacked and packed V4L2 formats.

No driver uses them right now, yet they're common formats needed by newer devices that use higher bit depths so adding them would make sense.

Signature · 2 lines
Kind regards,
Sakari
#4 lore raw

PATCH 2/6 v4l: Fix number of zeroed high order bits in 12-bit raw format defs

The number of high order bits in samples was documented to be 6 for 12-bit data. This is clearly wrong, fix it.

---
 Documentation/DocBook/media/v4l/pixfmt-srggb12.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/DocBook/media/v4l/pixfmt-srggb12.xml +1 -1
index 0c8e4ad..4394101 100644
@@ -31,7 +31,7 @@ pixel image</title>
 
       <formalpara>
 	<title>Byte Order.</title>
-	<para>Each cell is one byte, high 6 bits in high bytes are 0.
+	<para>Each cell is one byte, high 4 bits in high bytes are 0.
 	  <informaltable frame="none">
 	    <tgroup cols="5" align="center">
 	      <colspec align="left" colwidth="2*" />
Signature · 1 line
1.9.1
#11 lore raw

PATCH 5/6 v4l: Add 14-bit raw bayer pixel format definitions

In reply to Sakari Ailus

The formats added by this patch are:

	V4L2_PIX_FMT_SBGGR14
	V4L2_PIX_FMT_SGBRG14
	V4L2_PIX_FMT_SGRBG14
	V4L2_PIX_FMT_SRGGB14
---
 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml | 90 ++++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |  1 +
 include/uapi/linux/videodev2.h                     |  4 +
 3 files changed, 95 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +90 -0
new file mode 100644
index 0000000..7e82d7e
@@ -0,0 +1,90 @@
+    <refentry>
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB14 ('RG14'),
+	 V4L2_PIX_FMT_SGRBG14 ('BA14'),
+	 V4L2_PIX_FMT_SGBRG14 ('GB14'),
+	 V4L2_PIX_FMT_SBGGR14 ('BG14'),
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB14"><constant>V4L2_PIX_FMT_SRGGB14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG14"><constant>V4L2_PIX_FMT_SGRBG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG14"><constant>V4L2_PIX_FMT_SGBRG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR14"><constant>V4L2_PIX_FMT_SBGGR14</constant></refname>
+	<refpurpose>14-bit Bayer formats expanded to 16 bits</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are raw sRGB / Bayer formats with
+14 bits per colour. Each colour component is stored in a 16-bit word, with 2
+unused high bits filled with zeros. Each n-pixel row contains n/2 green samples
+and n/2 blue or red samples, with alternating red and blue rows. Bytes are
+stored in memory in little endian order. They are conventionally described
+as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these
+formats</para>
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR14</constant> 4 &times; 4
+pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte, high 2 bits in high bytes are 0.
+	  <informaltable frame="none">
+	    <tgroup cols="5" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00low</subscript></entry>
+		  <entry>B<subscript>00high</subscript></entry>
+		  <entry>G<subscript>01low</subscript></entry>
+		  <entry>G<subscript>01high</subscript></entry>
+		  <entry>B<subscript>02low</subscript></entry>
+		  <entry>B<subscript>02high</subscript></entry>
+		  <entry>G<subscript>03low</subscript></entry>
+		  <entry>G<subscript>03high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;8:</entry>
+		  <entry>G<subscript>10low</subscript></entry>
+		  <entry>G<subscript>10high</subscript></entry>
+		  <entry>R<subscript>11low</subscript></entry>
+		  <entry>R<subscript>11high</subscript></entry>
+		  <entry>G<subscript>12low</subscript></entry>
+		  <entry>G<subscript>12high</subscript></entry>
+		  <entry>R<subscript>13low</subscript></entry>
+		  <entry>R<subscript>13high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;16:</entry>
+		  <entry>B<subscript>20low</subscript></entry>
+		  <entry>B<subscript>20high</subscript></entry>
+		  <entry>G<subscript>21low</subscript></entry>
+		  <entry>G<subscript>21high</subscript></entry>
+		  <entry>B<subscript>22low</subscript></entry>
+		  <entry>B<subscript>22high</subscript></entry>
+		  <entry>G<subscript>23low</subscript></entry>
+		  <entry>G<subscript>23high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;24:</entry>
+		  <entry>G<subscript>30low</subscript></entry>
+		  <entry>G<subscript>30high</subscript></entry>
+		  <entry>R<subscript>31low</subscript></entry>
+		  <entry>R<subscript>31high</subscript></entry>
+		  <entry>G<subscript>32low</subscript></entry>
+		  <entry>G<subscript>32high</subscript></entry>
+		  <entry>R<subscript>33low</subscript></entry>
+		  <entry>R<subscript>33high</subscript></entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 457337e..29e9d7c 100644
@@ -1594,6 +1594,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb10dpcm8;
     &sub-srggb12;
     &sub-srggb12p;
+    &sub-srggb14;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +4 -0
index 7ace868..2c4b076 100644
@@ -581,6 +581,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
 #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
 #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
+#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') /* 14  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14  GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') /* 14  GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14  RGRG.. GBGB.. */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
Signature · 1 line
1.9.1
#15 lore raw

PATCH 6/6 v4l: Add packed Bayer raw14 pixel formats

In reply to Sakari Ailus

These formats are compressed 14-bit raw bayer formats with four different pixel orders. They are similar to 10-bit variants. The formats added by this patch are

	V4L2_PIX_FMT_SBGGR14P
	V4L2_PIX_FMT_SGBRG14P
	V4L2_PIX_FMT_SGRBG14P
	V4L2_PIX_FMT_SRGGB14P
---
 .../DocBook/media/v4l/pixfmt-srggb14p.xml          | 118 +++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |   1 +
 include/uapi/linux/videodev2.h                     |   5 +
 3 files changed, 124 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml
Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml new file +118 -0
new file mode 100644
index 0000000..ecb06ef
@@ -0,0 +1,118 @@
+    <refentry id="pixfmt-srggb14p">
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB14P ('pREE'),
+	 V4L2_PIX_FMT_SGRBG14P ('pgEE'),
+	 V4L2_PIX_FMT_SGBRG14P ('pGEE'),
+	 V4L2_PIX_FMT_SBGGR14P ('pBEE'),
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB14P"><constant>V4L2_PIX_FMT_SRGGB14P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG14P"><constant>V4L2_PIX_FMT_SGRBG14P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG14P"><constant>V4L2_PIX_FMT_SGBRG14P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR14P"><constant>V4L2_PIX_FMT_SBGGR14P</constant></refname>
+	<refpurpose>14-bit packed Bayer formats</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are packed raw sRGB / Bayer
+	formats with 14 bits per colour. Every four consecutive colour
+	components are packed into 7 bytes. Each of the first 4 bytes
+	contain the 8 high order bits of the pixels, and the fifth, sixth
+	and seventh bytes contains the six least significants bits of each
+	pixel, in the same order.</para>
+
+	<para>Each n-pixel row contains n/2 green samples and n/2 blue
+	or red samples, with alternating green-red and green-blue
+	rows. They are conventionally described as GRGR... BGBG...,
+	RGRG... GBGB..., etc. Below is an example of one of these
+	formats:</para>
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR14P</constant> 4 &times; 4
+      pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte. The bits in subscript denote bits
+	  of the sample. The bits of the cell byte can be found in
+	  parentheses.
+
+	  <informaltable frame="topbot" colsep="1" rowsep="1">
+	    <tgroup cols="7" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00 bits 13--8</subscript></entry>
+		  <entry>G<subscript>01 bits 13--8</subscript></entry>
+		  <entry>B<subscript>02 bits 13--8</subscript></entry>
+		  <entry>G<subscript>03 bits 13--8</subscript></entry>
+		  <entry>G<subscript>01 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>00 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>B<subscript>02 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>01 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>03 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>02 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;7:</entry>
+		  <entry>G<subscript>10 bits 13--8</subscript></entry>
+		  <entry>R<subscript>11 bits 13--8</subscript></entry>
+		  <entry>G<subscript>12 bits 13--8</subscript></entry>
+		  <entry>R<subscript>13 bits 13--8</subscript></entry>
+		  <entry>R<subscript>11 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>10 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>R<subscript>12 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>11 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>R<subscript>13 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>12 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;14:</entry>
+		  <entry>B<subscript>20 bits 13--8</subscript></entry>
+		  <entry>G<subscript>21 bits 13--8</subscript></entry>
+		  <entry>B<subscript>22 bits 13--8</subscript></entry>
+		  <entry>G<subscript>23 bits 13--8</subscript></entry>
+		  <entry>G<subscript>21 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>20 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>B<subscript>22 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>21 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>23 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>22 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;21:</entry>
+		  <entry>G<subscript>30 bits 13--8</subscript></entry>
+		  <entry>R<subscript>31 bits 13--8</subscript></entry>
+		  <entry>G<subscript>32 bits 13--8</subscript></entry>
+		  <entry>R<subscript>33 bits 13--8</subscript></entry>
+		  <entry>R<subscript>31 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>30 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>R<subscript>32 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>31 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>R<subscript>33 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>32 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 29e9d7c..296a50a 100644
@@ -1595,6 +1595,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb12;
     &sub-srggb12p;
     &sub-srggb14;
+    &sub-srggb14p;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +5 -0
index 2c4b076..63d141e 100644
@@ -585,6 +585,11 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14  GBGB.. RGRG.. */
 #define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') /* 14  GRGR.. BGBG.. */
 #define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14  RGRG.. GBGB.. */
+	/* 14bit raw bayer packed, 7 bytes for every 4 pixels */
+#define V4L2_PIX_FMT_SBGGR14P v4l2_fourcc('p', 'B', 'E', 'E')
+#define V4L2_PIX_FMT_SGBRG14P v4l2_fourcc('p', 'G', 'E', 'E')
+#define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E')
+#define V4L2_PIX_FMT_SRGGB14P v4l2_fourcc('p', 'R', 'E', 'E')
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
Signature · 1 line
1.9.1
#9 lore raw

PATCH 4/6 media: Add 1X14 14-bit raw bayer media bus code definitions

In reply to Sakari Ailus

From: Jouni Ukkonen <[email protected]>

The codes will be called:

	MEDIA_BUS_FMT_SBGGR14_1X14
	MEDIA_BUS_FMT_SGBRG14_1X14
	MEDIA_BUS_FMT_SGRBG14_1X14
	MEDIA_BUS_FMT_SRGGB14_1X14
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 162 +++++++++++++++++++--
 include/uapi/linux/media-bus-format.h              |   6 +-
 2 files changed, 154 insertions(+), 14 deletions(-)
Documentation/DocBook/media/v4l/subdev-formats.xml +149 -13
index 199c84e..6d45dc8 100644
@@ -1098,22 +1098,24 @@ see <xref linkend="colorspaces" />.</entry>
 
       <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-bayer">
 	<title>Bayer Formats</title>
-	<tgroup cols="15">
+	<tgroup cols="17">
 	  <colspec colname="id" align="left" />
 	  <colspec colname="code" align="center"/>
 	  <colspec colname="bit" />
-	  <colspec colnum="4" colname="b11" align="center" />
-	  <colspec colnum="5" colname="b10" align="center" />
-	  <colspec colnum="6" colname="b09" align="center" />
-	  <colspec colnum="7" colname="b08" align="center" />
-	  <colspec colnum="8" colname="b07" align="center" />
-	  <colspec colnum="9" colname="b06" align="center" />
-	  <colspec colnum="10" colname="b05" align="center" />
-	  <colspec colnum="11" colname="b04" align="center" />
-	  <colspec colnum="12" colname="b03" align="center" />
-	  <colspec colnum="13" colname="b02" align="center" />
-	  <colspec colnum="14" colname="b01" align="center" />
-	  <colspec colnum="15" colname="b00" align="center" />
+	  <colspec colnum="4" colname="b13" align="center" />
+	  <colspec colnum="5" colname="b12" align="center" />
+	  <colspec colnum="6" colname="b11" align="center" />
+	  <colspec colnum="7" colname="b10" align="center" />
+	  <colspec colnum="8" colname="b09" align="center" />
+	  <colspec colnum="9" colname="b08" align="center" />
+	  <colspec colnum="10" colname="b07" align="center" />
+	  <colspec colnum="11" colname="b06" align="center" />
+	  <colspec colnum="12" colname="b05" align="center" />
+	  <colspec colnum="13" colname="b04" align="center" />
+	  <colspec colnum="14" colname="b03" align="center" />
+	  <colspec colnum="15" colname="b02" align="center" />
+	  <colspec colnum="16" colname="b01" align="center" />
+	  <colspec colnum="17" colname="b00" align="center" />
 	  <spanspec namest="b11" nameend="b00" spanname="b0" />
 	  <thead>
 	    <row>
@@ -1126,6 +1128,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry></entry>
 	      <entry>Bit</entry>
+	      <entry>13</entry>
+	      <entry>12</entry>
 	      <entry>11</entry>
 	      <entry>10</entry>
 	      <entry>9</entry>
@@ -1149,6 +1153,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1166,6 +1172,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1183,6 +1191,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1200,6 +1210,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>7</subscript></entry>
 	      <entry>r<subscript>6</subscript></entry>
 	      <entry>r<subscript>5</subscript></entry>
@@ -1217,6 +1229,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1234,6 +1248,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1251,6 +1267,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1268,6 +1286,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>7</subscript></entry>
 	      <entry>r<subscript>6</subscript></entry>
 	      <entry>r<subscript>5</subscript></entry>
@@ -1285,6 +1305,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1302,6 +1324,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1319,6 +1343,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1336,6 +1362,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>7</subscript></entry>
 	      <entry>r<subscript>6</subscript></entry>
 	      <entry>r<subscript>5</subscript></entry>
@@ -1353,6 +1381,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
@@ -1370,6 +1400,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1387,6 +1419,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1404,6 +1438,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
@@ -1421,6 +1457,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>9</subscript></entry>
 	      <entry>b<subscript>8</subscript></entry>
 	      <entry>b<subscript>7</subscript></entry>
@@ -1438,6 +1476,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>1</subscript></entry>
 	      <entry>b<subscript>0</subscript></entry>
 	      <entry>0</entry>
@@ -1455,6 +1495,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>1</subscript></entry>
 	      <entry>b<subscript>0</subscript></entry>
 	      <entry>0</entry>
@@ -1472,6 +1514,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>9</subscript></entry>
 	      <entry>b<subscript>8</subscript></entry>
 	      <entry>b<subscript>7</subscript></entry>
@@ -1487,6 +1531,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>9</subscript></entry>
 	      <entry>b<subscript>8</subscript></entry>
 	      <entry>b<subscript>7</subscript></entry>
@@ -1504,6 +1550,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>9</subscript></entry>
 	      <entry>g<subscript>8</subscript></entry>
 	      <entry>g<subscript>7</subscript></entry>
@@ -1521,6 +1569,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>9</subscript></entry>
 	      <entry>g<subscript>8</subscript></entry>
 	      <entry>g<subscript>7</subscript></entry>
@@ -1538,6 +1588,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>9</subscript></entry>
 	      <entry>r<subscript>8</subscript></entry>
 	      <entry>r<subscript>7</subscript></entry>
@@ -1553,6 +1605,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SBGGR12_1X12</entry>
 	      <entry>0x3008</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>11</subscript></entry>
 	      <entry>b<subscript>10</subscript></entry>
 	      <entry>b<subscript>9</subscript></entry>
@@ -1570,6 +1624,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SGBRG12_1X12</entry>
 	      <entry>0x3010</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>11</subscript></entry>
 	      <entry>g<subscript>10</subscript></entry>
 	      <entry>g<subscript>9</subscript></entry>
@@ -1587,6 +1643,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SGRBG12_1X12</entry>
 	      <entry>0x3011</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>11</subscript></entry>
 	      <entry>g<subscript>10</subscript></entry>
 	      <entry>g<subscript>9</subscript></entry>
@@ -1604,6 +1662,84 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SRGGB12_1X12</entry>
 	      <entry>0x3012</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>r<subscript>11</subscript></entry>
+	      <entry>r<subscript>10</subscript></entry>
+	      <entry>r<subscript>9</subscript></entry>
+	      <entry>r<subscript>8</subscript></entry>
+	      <entry>r<subscript>7</subscript></entry>
+	      <entry>r<subscript>6</subscript></entry>
+	      <entry>r<subscript>5</subscript></entry>
+	      <entry>r<subscript>4</subscript></entry>
+	      <entry>r<subscript>3</subscript></entry>
+	      <entry>r<subscript>2</subscript></entry>
+	      <entry>r<subscript>1</subscript></entry>
+	      <entry>r<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SBGGR14-1X14">
+	      <entry>MEDIA_BUS_FMT_SBGGR14_1X14</entry>
+	      <entry>0x3019</entry>
+	      <entry></entry>
+	      <entry>b<subscript>13</subscript></entry>
+	      <entry>b<subscript>12</subscript></entry>
+	      <entry>b<subscript>11</subscript></entry>
+	      <entry>b<subscript>10</subscript></entry>
+	      <entry>b<subscript>9</subscript></entry>
+	      <entry>b<subscript>8</subscript></entry>
+	      <entry>b<subscript>7</subscript></entry>
+	      <entry>b<subscript>6</subscript></entry>
+	      <entry>b<subscript>5</subscript></entry>
+	      <entry>b<subscript>4</subscript></entry>
+	      <entry>b<subscript>3</subscript></entry>
+	      <entry>b<subscript>2</subscript></entry>
+	      <entry>b<subscript>1</subscript></entry>
+	      <entry>b<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SGBRG14-1X14">
+	      <entry>MEDIA_BUS_FMT_SGBRG14_1X14</entry>
+	      <entry>0x301a</entry>
+	      <entry></entry>
+	      <entry>g<subscript>13</subscript></entry>
+	      <entry>g<subscript>12</subscript></entry>
+	      <entry>g<subscript>11</subscript></entry>
+	      <entry>g<subscript>10</subscript></entry>
+	      <entry>g<subscript>9</subscript></entry>
+	      <entry>g<subscript>8</subscript></entry>
+	      <entry>g<subscript>7</subscript></entry>
+	      <entry>g<subscript>6</subscript></entry>
+	      <entry>g<subscript>5</subscript></entry>
+	      <entry>g<subscript>4</subscript></entry>
+	      <entry>g<subscript>3</subscript></entry>
+	      <entry>g<subscript>2</subscript></entry>
+	      <entry>g<subscript>1</subscript></entry>
+	      <entry>g<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SGRBG14-1X14">
+	      <entry>MEDIA_BUS_FMT_SGRBG14_1X14</entry>
+	      <entry>0x301b</entry>
+	      <entry></entry>
+	      <entry>g<subscript>13</subscript></entry>
+	      <entry>g<subscript>12</subscript></entry>
+	      <entry>g<subscript>11</subscript></entry>
+	      <entry>g<subscript>10</subscript></entry>
+	      <entry>g<subscript>9</subscript></entry>
+	      <entry>g<subscript>8</subscript></entry>
+	      <entry>g<subscript>7</subscript></entry>
+	      <entry>g<subscript>6</subscript></entry>
+	      <entry>g<subscript>5</subscript></entry>
+	      <entry>g<subscript>4</subscript></entry>
+	      <entry>g<subscript>3</subscript></entry>
+	      <entry>g<subscript>2</subscript></entry>
+	      <entry>g<subscript>1</subscript></entry>
+	      <entry>g<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SRGGB14-1X14">
+	      <entry>MEDIA_BUS_FMT_SRGGB14_1X14</entry>
+	      <entry>0x301c</entry>
+	      <entry></entry>
+	      <entry>r<subscript>13</subscript></entry>
+	      <entry>r<subscript>12</subscript></entry>
 	      <entry>r<subscript>11</subscript></entry>
 	      <entry>r<subscript>10</subscript></entry>
 	      <entry>r<subscript>9</subscript></entry>
include/uapi/linux/media-bus-format.h +5 -1
index 190d491..1dff459 100644
@@ -97,7 +97,7 @@
 #define MEDIA_BUS_FMT_YUV10_1X30		0x2016
 #define MEDIA_BUS_FMT_AYUV8_1X32		0x2017
 
-/* Bayer - next is	0x3019 */
+/* Bayer - next is	0x301d */
 #define MEDIA_BUS_FMT_SBGGR8_1X8		0x3001
 #define MEDIA_BUS_FMT_SGBRG8_1X8		0x3013
 #define MEDIA_BUS_FMT_SGRBG8_1X8		0x3002
@@ -122,6 +122,10 @@
 #define MEDIA_BUS_FMT_SGBRG12_1X12		0x3010
 #define MEDIA_BUS_FMT_SGRBG12_1X12		0x3011
 #define MEDIA_BUS_FMT_SRGGB12_1X12		0x3012
+#define MEDIA_BUS_FMT_SBGGR14_1X14		0x3019
+#define MEDIA_BUS_FMT_SGBRG14_1X14		0x301a
+#define MEDIA_BUS_FMT_SGRBG14_1X14		0x301b
+#define MEDIA_BUS_FMT_SRGGB14_1X14		0x301c
 
 /* JPEG compressed formats - next is	0x4002 */
 #define MEDIA_BUS_FMT_JPEG_1X8			0x4001
Signature · 1 line
1.9.1
Acked-by on v1 2/6
#5 lore raw

Re: [PATCH 2/6] v4l: Fix number of zeroed high order bits in 12-bit raw format defs

In reply to Sakari Ailus
Quoted 4 lines · Sakari Ailus

The number of high order bits in samples was documented to be 6 for 12-bit data. This is clearly wrong, fix it.

Thanks,

Hans

Quoted 18 lines
---
 Documentation/DocBook/media/v4l/pixfmt-srggb12.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/DocBook/media/v4l/pixfmt-srggb12.xml +1 -1
index 0c8e4ad..4394101 100644
@@ -31,7 +31,7 @@ pixel image</title>
 
       <formalpara>
 	<title>Byte Order.</title>
-	<para>Each cell is one byte, high 6 bits in high bytes are 0.
+	<para>Each cell is one byte, high 4 bits in high bytes are 0.
 	  <informaltable frame="none">
 	    <tgroup cols="5" align="center">
 	      <colspec align="left" colwidth="2*" />
#2 lore raw

Re: [PATCH 1/6] v4l: Correct the ordering of LSBs of the 10-bit raw packed formats

In reply to Sakari Ailus
Quoted 5 lines · Sakari Ailus

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.

This is used by the uvc driver. Has this been verified against a UVC webcam that supports this format? Laurent, do you have such a device?

Just in case UVC actually supports this as it is documented today.

Regards,

Hans

Quoted 71 lines
---
 .../DocBook/media/v4l/pixfmt-srggb10p.xml          | 32 +++++++++++-----------
 1 file changed, 16 insertions(+), 16 deletions(-)
Documentation/DocBook/media/v4l/pixfmt-srggb10p.xml +16 -16
index a8cc102..747822b 100644
@@ -47,10 +47,10 @@
 		  <entry>G<subscript>01high</subscript></entry>
 		  <entry>B<subscript>02high</subscript></entry>
 		  <entry>G<subscript>03high</subscript></entry>
-		  <entry>B<subscript>00low</subscript>(bits 7--6)
-			 G<subscript>01low</subscript>(bits 5--4)
-			 B<subscript>02low</subscript>(bits 3--2)
-			 G<subscript>03low</subscript>(bits 1--0)
+		  <entry>G<subscript>03low</subscript>(bits 7--6)
+			 B<subscript>02low</subscript>(bits 5--4)
+			 G<subscript>01low</subscript>(bits 3--2)
+			 B<subscript>00low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 		<row>
@@ -59,10 +59,10 @@
 		  <entry>R<subscript>11high</subscript></entry>
 		  <entry>G<subscript>12high</subscript></entry>
 		  <entry>R<subscript>13high</subscript></entry>
-		  <entry>G<subscript>10low</subscript>(bits 7--6)
-			 R<subscript>11low</subscript>(bits 5--4)
-			 G<subscript>12low</subscript>(bits 3--2)
-			 R<subscript>13low</subscript>(bits 1--0)
+		  <entry>R<subscript>13low</subscript>(bits 7--6)
+			 G<subscript>12low</subscript>(bits 5--4)
+			 R<subscript>11low</subscript>(bits 3--2)
+			 G<subscript>10low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 		<row>
@@ -71,10 +71,10 @@
 		  <entry>G<subscript>21high</subscript></entry>
 		  <entry>B<subscript>22high</subscript></entry>
 		  <entry>G<subscript>23high</subscript></entry>
-		  <entry>B<subscript>20low</subscript>(bits 7--6)
-			 G<subscript>21low</subscript>(bits 5--4)
-			 B<subscript>22low</subscript>(bits 3--2)
-			 G<subscript>23low</subscript>(bits 1--0)
+		  <entry>G<subscript>23low</subscript>(bits 7--6)
+			 B<subscript>22low</subscript>(bits 5--4)
+			 G<subscript>21low</subscript>(bits 3--2)
+			 B<subscript>20low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 		<row>
@@ -83,10 +83,10 @@
 		  <entry>R<subscript>31high</subscript></entry>
 		  <entry>G<subscript>32high</subscript></entry>
 		  <entry>R<subscript>33high</subscript></entry>
-		  <entry>G<subscript>30low</subscript>(bits 7--6)
-			 R<subscript>31low</subscript>(bits 5--4)
-			 G<subscript>32low</subscript>(bits 3--2)
-			 R<subscript>33low</subscript>(bits 1--0)
+		  <entry>R<subscript>33low</subscript>(bits 7--6)
+			 G<subscript>32low</subscript>(bits 5--4)
+			 R<subscript>31low</subscript>(bits 3--2)
+			 G<subscript>30low</subscript>(bits 1--0)
 		  </entry>
 		</row>
 	      </tbody>
Acked-by on v1 3/6
#7 lore raw

Re: [PATCH 3/6] v4l: Add packed Bayer raw12 pixel formats

In reply to Sakari Ailus
Quoted 23 lines · Sakari Ailus

These formats are compressed 12-bit raw bayer formats with four different pixel orders. They are similar to 10-bit variants. The formats added by this patch are

	V4L2_PIX_FMT_SBGGR12P
	V4L2_PIX_FMT_SGBRG12P
	V4L2_PIX_FMT_SGRBG12P
	V4L2_PIX_FMT_SRGGB12P
---
 .../DocBook/media/v4l/pixfmt-srggb12p.xml          | 103 +++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |   1 +
 include/uapi/linux/videodev2.h                     |   5 +
 3 files changed, 109 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml
Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml new file +0 -0
new file mode 100644
index 0000000..affa366

Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml line 6

Quoted 6 lines
Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml new file +6 -0
@@ -0,0 +1,103 @@
+    <refentry id="pixfmt-srggb12p">
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB12P ('pRCC'),
+	 V4L2_PIX_FMT_SGRBG12P ('pgCC'),
+	 V4L2_PIX_FMT_SGBRG12P ('pGCC'),
+	 V4L2_PIX_FMT_SBGGR12P ('pBCC'),

Nitpick: the last comma should be removed otherwise the title would end with it.

Looks good otherwise.

With the comma removed:

Regards,

Hans

Quoted 126 lines
Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml new file +97 -0
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB12P"><constant>V4L2_PIX_FMT_SRGGB12P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG12P"><constant>V4L2_PIX_FMT_SGRBG12P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG12P"><constant>V4L2_PIX_FMT_SGBRG12P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR12P"><constant>V4L2_PIX_FMT_SBGGR12P</constant></refname>
+	<refpurpose>12-bit packed Bayer formats</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are packed raw sRGB / Bayer
+	formats with 12 bits per colour. Every four consecutive colour
+	components are packed into 6 bytes. Each of the first 4 bytes
+	contain the 8 high order bits of the pixels, and the fifth and
+	sixth bytes contains the four least significants bits of each
+	pixel, in the same order.</para>
+
+	<para>Each n-pixel row contains n/2 green samples and n/2 blue
+	or red samples, with alternating green-red and green-blue
+	rows. They are conventionally described as GRGR... BGBG...,
+	RGRG... GBGB..., etc. Below is an example of one of these
+	formats:</para>
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR12P</constant> 4 &times; 4
+      pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte.
+	  <informaltable frame="topbot" colsep="1" rowsep="1">
+	    <tgroup cols="6" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00high</subscript></entry>
+		  <entry>G<subscript>01high</subscript></entry>
+		  <entry>G<subscript>01low</subscript>(bits 7--4)
+			 B<subscript>00low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>B<subscript>02high</subscript></entry>
+		  <entry>G<subscript>03high</subscript></entry>
+		  <entry>G<subscript>03low</subscript>(bits 7--4)
+			 B<subscript>02low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;6:</entry>
+		  <entry>G<subscript>10high</subscript></entry>
+		  <entry>R<subscript>11high</subscript></entry>
+		  <entry>R<subscript>11low</subscript>(bits 7--4)
+			 G<subscript>10low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>12high</subscript></entry>
+		  <entry>R<subscript>13high</subscript></entry>
+		  <entry>R<subscript>13low</subscript>(bits 7--4)
+			 G<subscript>12low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;12:</entry>
+		  <entry>B<subscript>20high</subscript></entry>
+		  <entry>G<subscript>21high</subscript></entry>
+		  <entry>G<subscript>21low</subscript>(bits 7--4)
+			 B<subscript>20low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>B<subscript>22high</subscript></entry>
+		  <entry>G<subscript>23high</subscript></entry>
+		  <entry>G<subscript>23low</subscript>(bits 7--4)
+			 B<subscript>22low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;18:</entry>
+		  <entry>G<subscript>30high</subscript></entry>
+		  <entry>R<subscript>31high</subscript></entry>
+		  <entry>R<subscript>31low</subscript>(bits 7--4)
+			 G<subscript>30low</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>32high</subscript></entry>
+		  <entry>R<subscript>33high</subscript></entry>
+		  <entry>R<subscript>33low</subscript>(bits 7--4)
+			 G<subscript>32low</subscript>(bits 3--0)
+		  </entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 5a08aee..457337e 100644
@@ -1593,6 +1593,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb10alaw8;
     &sub-srggb10dpcm8;
     &sub-srggb12;
+    &sub-srggb12p;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +5 -0
index 8f95191..7ace868 100644
@@ -576,6 +576,11 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG12 v4l2_fourcc('G', 'B', '1', '2') /* 12  GBGB.. RGRG.. */
 #define V4L2_PIX_FMT_SGRBG12 v4l2_fourcc('B', 'A', '1', '2') /* 12  GRGR.. BGBG.. */
 #define V4L2_PIX_FMT_SRGGB12 v4l2_fourcc('R', 'G', '1', '2') /* 12  RGRG.. GBGB.. */
+	/* 12bit raw bayer packed, 6 bytes for every 4 pixels */
+#define V4L2_PIX_FMT_SBGGR12P v4l2_fourcc('p', 'B', 'C', 'C')
+#define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
+#define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
+#define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
Acked-by on v1 4/6
#10 lore raw

Re: [PATCH 4/6] media: Add 1X14 14-bit raw bayer media bus code definitions

In reply to Sakari Ailus
Quoted 11 lines · Sakari Ailus

From: Jouni Ukkonen <[email protected]>

The codes will be called:

	MEDIA_BUS_FMT_SBGGR14_1X14
	MEDIA_BUS_FMT_SGBRG14_1X14
	MEDIA_BUS_FMT_SGRBG14_1X14
	MEDIA_BUS_FMT_SRGGB14_1X14

Hans

Quoted 409 lines
---
 Documentation/DocBook/media/v4l/subdev-formats.xml | 162 +++++++++++++++++++--
 include/uapi/linux/media-bus-format.h              |   6 +-
 2 files changed, 154 insertions(+), 14 deletions(-)
Documentation/DocBook/media/v4l/subdev-formats.xml +149 -13
index 199c84e..6d45dc8 100644
@@ -1098,22 +1098,24 @@ see <xref linkend="colorspaces" />.</entry>
 
       <table pgwide="0" frame="none" id="v4l2-mbus-pixelcode-bayer">
 	<title>Bayer Formats</title>
-	<tgroup cols="15">
+	<tgroup cols="17">
 	  <colspec colname="id" align="left" />
 	  <colspec colname="code" align="center"/>
 	  <colspec colname="bit" />
-	  <colspec colnum="4" colname="b11" align="center" />
-	  <colspec colnum="5" colname="b10" align="center" />
-	  <colspec colnum="6" colname="b09" align="center" />
-	  <colspec colnum="7" colname="b08" align="center" />
-	  <colspec colnum="8" colname="b07" align="center" />
-	  <colspec colnum="9" colname="b06" align="center" />
-	  <colspec colnum="10" colname="b05" align="center" />
-	  <colspec colnum="11" colname="b04" align="center" />
-	  <colspec colnum="12" colname="b03" align="center" />
-	  <colspec colnum="13" colname="b02" align="center" />
-	  <colspec colnum="14" colname="b01" align="center" />
-	  <colspec colnum="15" colname="b00" align="center" />
+	  <colspec colnum="4" colname="b13" align="center" />
+	  <colspec colnum="5" colname="b12" align="center" />
+	  <colspec colnum="6" colname="b11" align="center" />
+	  <colspec colnum="7" colname="b10" align="center" />
+	  <colspec colnum="8" colname="b09" align="center" />
+	  <colspec colnum="9" colname="b08" align="center" />
+	  <colspec colnum="10" colname="b07" align="center" />
+	  <colspec colnum="11" colname="b06" align="center" />
+	  <colspec colnum="12" colname="b05" align="center" />
+	  <colspec colnum="13" colname="b04" align="center" />
+	  <colspec colnum="14" colname="b03" align="center" />
+	  <colspec colnum="15" colname="b02" align="center" />
+	  <colspec colnum="16" colname="b01" align="center" />
+	  <colspec colnum="17" colname="b00" align="center" />
 	  <spanspec namest="b11" nameend="b00" spanname="b0" />
 	  <thead>
 	    <row>
@@ -1126,6 +1128,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry></entry>
 	      <entry>Bit</entry>
+	      <entry>13</entry>
+	      <entry>12</entry>
 	      <entry>11</entry>
 	      <entry>10</entry>
 	      <entry>9</entry>
@@ -1149,6 +1153,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1166,6 +1172,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1183,6 +1191,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1200,6 +1210,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>7</subscript></entry>
 	      <entry>r<subscript>6</subscript></entry>
 	      <entry>r<subscript>5</subscript></entry>
@@ -1217,6 +1229,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1234,6 +1248,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1251,6 +1267,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1268,6 +1286,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>7</subscript></entry>
 	      <entry>r<subscript>6</subscript></entry>
 	      <entry>r<subscript>5</subscript></entry>
@@ -1285,6 +1305,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1302,6 +1324,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1319,6 +1343,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>7</subscript></entry>
 	      <entry>g<subscript>6</subscript></entry>
 	      <entry>g<subscript>5</subscript></entry>
@@ -1336,6 +1362,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>7</subscript></entry>
 	      <entry>r<subscript>6</subscript></entry>
 	      <entry>r<subscript>5</subscript></entry>
@@ -1353,6 +1381,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
@@ -1370,6 +1400,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1387,6 +1419,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>7</subscript></entry>
 	      <entry>b<subscript>6</subscript></entry>
 	      <entry>b<subscript>5</subscript></entry>
@@ -1404,6 +1438,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
 	      <entry>0</entry>
@@ -1421,6 +1457,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>9</subscript></entry>
 	      <entry>b<subscript>8</subscript></entry>
 	      <entry>b<subscript>7</subscript></entry>
@@ -1438,6 +1476,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>1</subscript></entry>
 	      <entry>b<subscript>0</subscript></entry>
 	      <entry>0</entry>
@@ -1455,6 +1495,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>1</subscript></entry>
 	      <entry>b<subscript>0</subscript></entry>
 	      <entry>0</entry>
@@ -1472,6 +1514,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>9</subscript></entry>
 	      <entry>b<subscript>8</subscript></entry>
 	      <entry>b<subscript>7</subscript></entry>
@@ -1487,6 +1531,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>9</subscript></entry>
 	      <entry>b<subscript>8</subscript></entry>
 	      <entry>b<subscript>7</subscript></entry>
@@ -1504,6 +1550,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>9</subscript></entry>
 	      <entry>g<subscript>8</subscript></entry>
 	      <entry>g<subscript>7</subscript></entry>
@@ -1521,6 +1569,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>9</subscript></entry>
 	      <entry>g<subscript>8</subscript></entry>
 	      <entry>g<subscript>7</subscript></entry>
@@ -1538,6 +1588,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry></entry>
 	      <entry>-</entry>
 	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>r<subscript>9</subscript></entry>
 	      <entry>r<subscript>8</subscript></entry>
 	      <entry>r<subscript>7</subscript></entry>
@@ -1553,6 +1605,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SBGGR12_1X12</entry>
 	      <entry>0x3008</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>b<subscript>11</subscript></entry>
 	      <entry>b<subscript>10</subscript></entry>
 	      <entry>b<subscript>9</subscript></entry>
@@ -1570,6 +1624,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SGBRG12_1X12</entry>
 	      <entry>0x3010</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>11</subscript></entry>
 	      <entry>g<subscript>10</subscript></entry>
 	      <entry>g<subscript>9</subscript></entry>
@@ -1587,6 +1643,8 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SGRBG12_1X12</entry>
 	      <entry>0x3011</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
 	      <entry>g<subscript>11</subscript></entry>
 	      <entry>g<subscript>10</subscript></entry>
 	      <entry>g<subscript>9</subscript></entry>
@@ -1604,6 +1662,84 @@ see <xref linkend="colorspaces" />.</entry>
 	      <entry>MEDIA_BUS_FMT_SRGGB12_1X12</entry>
 	      <entry>0x3012</entry>
 	      <entry></entry>
+	      <entry>-</entry>
+	      <entry>-</entry>
+	      <entry>r<subscript>11</subscript></entry>
+	      <entry>r<subscript>10</subscript></entry>
+	      <entry>r<subscript>9</subscript></entry>
+	      <entry>r<subscript>8</subscript></entry>
+	      <entry>r<subscript>7</subscript></entry>
+	      <entry>r<subscript>6</subscript></entry>
+	      <entry>r<subscript>5</subscript></entry>
+	      <entry>r<subscript>4</subscript></entry>
+	      <entry>r<subscript>3</subscript></entry>
+	      <entry>r<subscript>2</subscript></entry>
+	      <entry>r<subscript>1</subscript></entry>
+	      <entry>r<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SBGGR14-1X14">
+	      <entry>MEDIA_BUS_FMT_SBGGR14_1X14</entry>
+	      <entry>0x3019</entry>
+	      <entry></entry>
+	      <entry>b<subscript>13</subscript></entry>
+	      <entry>b<subscript>12</subscript></entry>
+	      <entry>b<subscript>11</subscript></entry>
+	      <entry>b<subscript>10</subscript></entry>
+	      <entry>b<subscript>9</subscript></entry>
+	      <entry>b<subscript>8</subscript></entry>
+	      <entry>b<subscript>7</subscript></entry>
+	      <entry>b<subscript>6</subscript></entry>
+	      <entry>b<subscript>5</subscript></entry>
+	      <entry>b<subscript>4</subscript></entry>
+	      <entry>b<subscript>3</subscript></entry>
+	      <entry>b<subscript>2</subscript></entry>
+	      <entry>b<subscript>1</subscript></entry>
+	      <entry>b<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SGBRG14-1X14">
+	      <entry>MEDIA_BUS_FMT_SGBRG14_1X14</entry>
+	      <entry>0x301a</entry>
+	      <entry></entry>
+	      <entry>g<subscript>13</subscript></entry>
+	      <entry>g<subscript>12</subscript></entry>
+	      <entry>g<subscript>11</subscript></entry>
+	      <entry>g<subscript>10</subscript></entry>
+	      <entry>g<subscript>9</subscript></entry>
+	      <entry>g<subscript>8</subscript></entry>
+	      <entry>g<subscript>7</subscript></entry>
+	      <entry>g<subscript>6</subscript></entry>
+	      <entry>g<subscript>5</subscript></entry>
+	      <entry>g<subscript>4</subscript></entry>
+	      <entry>g<subscript>3</subscript></entry>
+	      <entry>g<subscript>2</subscript></entry>
+	      <entry>g<subscript>1</subscript></entry>
+	      <entry>g<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SGRBG14-1X14">
+	      <entry>MEDIA_BUS_FMT_SGRBG14_1X14</entry>
+	      <entry>0x301b</entry>
+	      <entry></entry>
+	      <entry>g<subscript>13</subscript></entry>
+	      <entry>g<subscript>12</subscript></entry>
+	      <entry>g<subscript>11</subscript></entry>
+	      <entry>g<subscript>10</subscript></entry>
+	      <entry>g<subscript>9</subscript></entry>
+	      <entry>g<subscript>8</subscript></entry>
+	      <entry>g<subscript>7</subscript></entry>
+	      <entry>g<subscript>6</subscript></entry>
+	      <entry>g<subscript>5</subscript></entry>
+	      <entry>g<subscript>4</subscript></entry>
+	      <entry>g<subscript>3</subscript></entry>
+	      <entry>g<subscript>2</subscript></entry>
+	      <entry>g<subscript>1</subscript></entry>
+	      <entry>g<subscript>0</subscript></entry>
+	    </row>
+	    <row id="MEDIA-BUS-FMT-SRGGB14-1X14">
+	      <entry>MEDIA_BUS_FMT_SRGGB14_1X14</entry>
+	      <entry>0x301c</entry>
+	      <entry></entry>
+	      <entry>r<subscript>13</subscript></entry>
+	      <entry>r<subscript>12</subscript></entry>
 	      <entry>r<subscript>11</subscript></entry>
 	      <entry>r<subscript>10</subscript></entry>
 	      <entry>r<subscript>9</subscript></entry>
include/uapi/linux/media-bus-format.h +5 -1
index 190d491..1dff459 100644
@@ -97,7 +97,7 @@
 #define MEDIA_BUS_FMT_YUV10_1X30		0x2016
 #define MEDIA_BUS_FMT_AYUV8_1X32		0x2017
 
-/* Bayer - next is	0x3019 */
+/* Bayer - next is	0x301d */
 #define MEDIA_BUS_FMT_SBGGR8_1X8		0x3001
 #define MEDIA_BUS_FMT_SGBRG8_1X8		0x3013
 #define MEDIA_BUS_FMT_SGRBG8_1X8		0x3002
@@ -122,6 +122,10 @@
 #define MEDIA_BUS_FMT_SGBRG12_1X12		0x3010
 #define MEDIA_BUS_FMT_SGRBG12_1X12		0x3011
 #define MEDIA_BUS_FMT_SRGGB12_1X12		0x3012
+#define MEDIA_BUS_FMT_SBGGR14_1X14		0x3019
+#define MEDIA_BUS_FMT_SGBRG14_1X14		0x301a
+#define MEDIA_BUS_FMT_SGRBG14_1X14		0x301b
+#define MEDIA_BUS_FMT_SRGGB14_1X14		0x301c
 
 /* JPEG compressed formats - next is	0x4002 */
 #define MEDIA_BUS_FMT_JPEG_1X8			0x4001
#12 lore raw

Re: [PATCH 5/6] v4l: Add 14-bit raw bayer pixel format definitions

In reply to Sakari Ailus
Quoted 22 lines · Sakari Ailus

The formats added by this patch are:

	V4L2_PIX_FMT_SBGGR14
	V4L2_PIX_FMT_SGBRG14
	V4L2_PIX_FMT_SGRBG14
	V4L2_PIX_FMT_SRGGB14
---
 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml | 90 ++++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |  1 +
 include/uapi/linux/videodev2.h                     |  4 +
 3 files changed, 95 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +0 -0
new file mode 100644
index 0000000..7e82d7e

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 6

Quoted 6 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +6 -0
@@ -0,0 +1,90 @@
+    <refentry>
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB14 ('RG14'),
+	 V4L2_PIX_FMT_SGRBG14 ('BA14'),
+	 V4L2_PIX_FMT_SGBRG14 ('GB14'),
+	 V4L2_PIX_FMT_SBGGR14 ('BG14'),

Same comma problem.

Quoted 10 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +10 -0
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB14"><constant>V4L2_PIX_FMT_SRGGB14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG14"><constant>V4L2_PIX_FMT_SGRBG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG14"><constant>V4L2_PIX_FMT_SGBRG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR14"><constant>V4L2_PIX_FMT_SBGGR14</constant></refname>
+	<refpurpose>14-bit Bayer formats expanded to 16 bits</refpurpose>
+      </refnamediv>

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 26

Quoted 10 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +10 -0
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are raw sRGB / Bayer formats with
+14 bits per colour. Each colour component is stored in a 16-bit word, with 2
+unused high bits filled with zeros. Each n-pixel row contains n/2 green samples
+and n/2 blue or red samples, with alternating red and blue rows. Bytes are
+stored in memory in little endian order. They are conventionally described
+as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these
+formats</para>

s/formats/formats:/

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 34

Quoted 8 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +8 -0
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR14</constant> 4 &times; 4
+pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte, high 2 bits in high bytes are 0.

s/high 2/the high 2/

Quoted 74 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +56 -0
+	  <informaltable frame="none">
+	    <tgroup cols="5" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00low</subscript></entry>
+		  <entry>B<subscript>00high</subscript></entry>
+		  <entry>G<subscript>01low</subscript></entry>
+		  <entry>G<subscript>01high</subscript></entry>
+		  <entry>B<subscript>02low</subscript></entry>
+		  <entry>B<subscript>02high</subscript></entry>
+		  <entry>G<subscript>03low</subscript></entry>
+		  <entry>G<subscript>03high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;8:</entry>
+		  <entry>G<subscript>10low</subscript></entry>
+		  <entry>G<subscript>10high</subscript></entry>
+		  <entry>R<subscript>11low</subscript></entry>
+		  <entry>R<subscript>11high</subscript></entry>
+		  <entry>G<subscript>12low</subscript></entry>
+		  <entry>G<subscript>12high</subscript></entry>
+		  <entry>R<subscript>13low</subscript></entry>
+		  <entry>R<subscript>13high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;16:</entry>
+		  <entry>B<subscript>20low</subscript></entry>
+		  <entry>B<subscript>20high</subscript></entry>
+		  <entry>G<subscript>21low</subscript></entry>
+		  <entry>G<subscript>21high</subscript></entry>
+		  <entry>B<subscript>22low</subscript></entry>
+		  <entry>B<subscript>22high</subscript></entry>
+		  <entry>G<subscript>23low</subscript></entry>
+		  <entry>G<subscript>23high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;24:</entry>
+		  <entry>G<subscript>30low</subscript></entry>
+		  <entry>G<subscript>30high</subscript></entry>
+		  <entry>R<subscript>31low</subscript></entry>
+		  <entry>R<subscript>31high</subscript></entry>
+		  <entry>G<subscript>32low</subscript></entry>
+		  <entry>G<subscript>32high</subscript></entry>
+		  <entry>R<subscript>33low</subscript></entry>
+		  <entry>R<subscript>33high</subscript></entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 457337e..29e9d7c 100644
@@ -1594,6 +1594,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb10dpcm8;
     &sub-srggb12;
     &sub-srggb12p;
+    &sub-srggb14;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +0 -0
index 7ace868..2c4b076 100644

include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 590

Quoted 10 lines
include/uapi/linux/videodev2.h +4 -0
@@ -581,6 +581,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
 #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
 #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
+#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') /* 14  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14  GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') /* 14  GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14  RGRG.. GBGB.. */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */

Regards,

Hans

Acked-by on v1 6/6
#16 lore raw

Re: [PATCH 6/6] v4l: Add packed Bayer raw14 pixel formats

In reply to Sakari Ailus
Quoted 23 lines · Sakari Ailus

These formats are compressed 14-bit raw bayer formats with four different pixel orders. They are similar to 10-bit variants. The formats added by this patch are

	V4L2_PIX_FMT_SBGGR14P
	V4L2_PIX_FMT_SGBRG14P
	V4L2_PIX_FMT_SGRBG14P
	V4L2_PIX_FMT_SRGGB14P
---
 .../DocBook/media/v4l/pixfmt-srggb14p.xml          | 118 +++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |   1 +
 include/uapi/linux/videodev2.h                     |   5 +
 3 files changed, 124 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml
Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml new file +0 -0
new file mode 100644
index 0000000..ecb06ef

Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml line 6

Quoted 6 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml new file +6 -0
@@ -0,0 +1,118 @@
+    <refentry id="pixfmt-srggb14p">
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB14P ('pREE'),
+	 V4L2_PIX_FMT_SGRBG14P ('pgEE'),
+	 V4L2_PIX_FMT_SGBRG14P ('pGEE'),
+	 V4L2_PIX_FMT_SBGGR14P ('pBEE'),

Again comma too many.

Quoted 8 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml new file +8 -0
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB14P"><constant>V4L2_PIX_FMT_SRGGB14P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG14P"><constant>V4L2_PIX_FMT_SGRBG14P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG14P"><constant>V4L2_PIX_FMT_SGBRG14P</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR14P"><constant>V4L2_PIX_FMT_SBGGR14P</constant></refname>

Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml line 24

Quoted 10 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml new file +10 -0
+	<refpurpose>14-bit packed Bayer formats</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are packed raw sRGB / Bayer
+	formats with 14 bits per colour. Every four consecutive colour
+	components are packed into 7 bytes. Each of the first 4 bytes
+	contain the 8 high order bits of the pixels, and the fifth, sixth
+	and seventh bytes contains the six least significants bits of each

s/significants/significant/

After fixing this:

Regards,

Hans

Quoted 123 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14p.xml new file +94 -0
+	pixel, in the same order.</para>
+
+	<para>Each n-pixel row contains n/2 green samples and n/2 blue
+	or red samples, with alternating green-red and green-blue
+	rows. They are conventionally described as GRGR... BGBG...,
+	RGRG... GBGB..., etc. Below is an example of one of these
+	formats:</para>
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR14P</constant> 4 &times; 4
+      pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte. The bits in subscript denote bits
+	  of the sample. The bits of the cell byte can be found in
+	  parentheses.
+
+	  <informaltable frame="topbot" colsep="1" rowsep="1">
+	    <tgroup cols="7" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00 bits 13--8</subscript></entry>
+		  <entry>G<subscript>01 bits 13--8</subscript></entry>
+		  <entry>B<subscript>02 bits 13--8</subscript></entry>
+		  <entry>G<subscript>03 bits 13--8</subscript></entry>
+		  <entry>G<subscript>01 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>00 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>B<subscript>02 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>01 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>03 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>02 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;7:</entry>
+		  <entry>G<subscript>10 bits 13--8</subscript></entry>
+		  <entry>R<subscript>11 bits 13--8</subscript></entry>
+		  <entry>G<subscript>12 bits 13--8</subscript></entry>
+		  <entry>R<subscript>13 bits 13--8</subscript></entry>
+		  <entry>R<subscript>11 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>10 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>R<subscript>12 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>11 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>R<subscript>13 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>12 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;14:</entry>
+		  <entry>B<subscript>20 bits 13--8</subscript></entry>
+		  <entry>G<subscript>21 bits 13--8</subscript></entry>
+		  <entry>B<subscript>22 bits 13--8</subscript></entry>
+		  <entry>G<subscript>23 bits 13--8</subscript></entry>
+		  <entry>G<subscript>21 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>20 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>B<subscript>22 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>21 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>G<subscript>23 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>22 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;21:</entry>
+		  <entry>G<subscript>30 bits 13--8</subscript></entry>
+		  <entry>R<subscript>31 bits 13--8</subscript></entry>
+		  <entry>G<subscript>32 bits 13--8</subscript></entry>
+		  <entry>R<subscript>33 bits 13--8</subscript></entry>
+		  <entry>R<subscript>31 bits 1--0</subscript>(bits 7--6)
+			 B<subscript>30 bits 5--0</subscript>(bits 5--0)
+		  </entry>
+		  <entry>R<subscript>32 bits 3--0</subscript>(bits 7--4)
+			 G<subscript>31 bits 5--2</subscript>(bits 3--0)
+		  </entry>
+		  <entry>R<subscript>33 bits 5--0</subscript>(bits 7--2)
+			 B<subscript>32 bits 5--4</subscript>(bits 1--0)
+		  </entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 29e9d7c..296a50a 100644
@@ -1595,6 +1595,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb12;
     &sub-srggb12p;
     &sub-srggb14;
+    &sub-srggb14p;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +5 -0
index 2c4b076..63d141e 100644
@@ -585,6 +585,11 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14  GBGB.. RGRG.. */
 #define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') /* 14  GRGR.. BGBG.. */
 #define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14  RGRG.. GBGB.. */
+	/* 14bit raw bayer packed, 7 bytes for every 4 pixels */
+#define V4L2_PIX_FMT_SBGGR14P v4l2_fourcc('p', 'B', 'E', 'E')
+#define V4L2_PIX_FMT_SGBRG14P v4l2_fourcc('p', 'G', 'E', 'E')
+#define V4L2_PIX_FMT_SGRBG14P v4l2_fourcc('p', 'g', 'E', 'E')
+#define V4L2_PIX_FMT_SRGGB14P v4l2_fourcc('p', 'R', 'E', 'E')
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */
#3 lore raw

Re: [PATCH 1/6] v4l: Correct the ordering of LSBs of the 10-bit raw packed formats

In reply to Hans Verkuil

Hi Hans,

Quoted 9 lines · Hans Verkuil
Quoted 5 lines · Sakari Ailus

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.

This is used by the uvc driver. Has this been verified against a UVC webcam that supports this format? Laurent, do you have such a device?

I bet Laurent hasn't got one. Guennadi, could you comment on this?

Signature · 4 lines
Regards,

Sakari Ailus
[email protected]
#8 lore raw

Re: [PATCH 3/6] v4l: Add packed Bayer raw12 pixel formats

In reply to Hans Verkuil

Hi Hans,

Thanks for the review!

Quoted 33 lines · Hans Verkuil
Quoted 23 lines · Sakari Ailus

These formats are compressed 12-bit raw bayer formats with four different pixel orders. They are similar to 10-bit variants. The formats added by this patch are

	V4L2_PIX_FMT_SBGGR12P
	V4L2_PIX_FMT_SGBRG12P
	V4L2_PIX_FMT_SGRBG12P
	V4L2_PIX_FMT_SRGGB12P
---
 .../DocBook/media/v4l/pixfmt-srggb12p.xml          | 103 +++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |   1 +
 include/uapi/linux/videodev2.h                     |   5 +
 3 files changed, 109 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml
Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml new file +0 -0
new file mode 100644
index 0000000..affa366

Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml line 6

Quoted 6 lines
Documentation/DocBook/media/v4l/pixfmt-srggb12p.xml new file +6 -0
@@ -0,0 +1,103 @@
+    <refentry id="pixfmt-srggb12p">
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB12P ('pRCC'),
+	 V4L2_PIX_FMT_SGRBG12P ('pgCC'),
+	 V4L2_PIX_FMT_SGBRG12P ('pGCC'),
+	 V4L2_PIX_FMT_SBGGR12P ('pBCC'),

Nitpick: the last comma should be removed otherwise the title would end with it.

Quoted 5 lines

Looks good otherwise.

With the comma removed:

Indeed. Looks like this comes from the 10-bit definitions. I'll fix that one as well.

Signature · 2 lines
Sakari Ailus
[email protected]
#13 lore raw

Re: [PATCH 5/6] v4l: Add 14-bit raw bayer pixel format definitions

In reply to Hans Verkuil

Hi Hans,

Quoted 17 lines · Hans Verkuil
Quoted 16 lines · Sakari Ailus

The formats added by this patch are:

	V4L2_PIX_FMT_SBGGR14
	V4L2_PIX_FMT_SGBRG14
	V4L2_PIX_FMT_SGRBG14
	V4L2_PIX_FMT_SRGGB14
---
 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml | 90 ++++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |  1 +
 include/uapi/linux/videodev2.h                     |  4 +
 3 files changed, 95 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml
Quoted 14 lines

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 6

Quoted 12 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +6 -0
new file mode 100644
index 0000000..7e82d7e
@@ -0,0 +1,90 @@
+    <refentry>
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB14 ('RG14'),
+	 V4L2_PIX_FMT_SGRBG14 ('BA14'),
+	 V4L2_PIX_FMT_SGBRG14 ('GB14'),
+	 V4L2_PIX_FMT_SBGGR14 ('BG14'),

Same comma problem.

Fixed.

Quoted 15 lines
Quoted 15 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +14 -0
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB14"><constant>V4L2_PIX_FMT_SRGGB14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG14"><constant>V4L2_PIX_FMT_SGRBG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG14"><constant>V4L2_PIX_FMT_SGBRG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR14"><constant>V4L2_PIX_FMT_SBGGR14</constant></refname>
+	<refpurpose>14-bit Bayer formats expanded to 16 bits</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are raw sRGB / Bayer formats with
Quoted 8 lines

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 26

Quoted 6 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +6 -0
+14 bits per colour. Each colour component is stored in a 16-bit word, with 2
+unused high bits filled with zeros. Each n-pixel row contains n/2 green samples
+and n/2 blue or red samples, with alternating red and blue rows. Bytes are
+stored in memory in little endian order. They are conventionally described
+as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these
+formats</para>

s/formats/formats:/

Fixed.

Quoted 10 lines

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 34

Quoted 8 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +8 -0
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR14</constant> 4 &times; 4
+pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte, high 2 bits in high bytes are 0.

s/high 2/the high 2/

After re-reading the patch, I changed this to "Each cell is one byte, the 2 most significant bits in the high bytes are 0".

Quoted 90 lines
Quoted 75 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +56 -0
+	  <informaltable frame="none">
+	    <tgroup cols="5" align="center">
+	      <colspec align="left" colwidth="2*" />
+	      <tbody valign="top">
+		<row>
+		  <entry>start&nbsp;+&nbsp;0:</entry>
+		  <entry>B<subscript>00low</subscript></entry>
+		  <entry>B<subscript>00high</subscript></entry>
+		  <entry>G<subscript>01low</subscript></entry>
+		  <entry>G<subscript>01high</subscript></entry>
+		  <entry>B<subscript>02low</subscript></entry>
+		  <entry>B<subscript>02high</subscript></entry>
+		  <entry>G<subscript>03low</subscript></entry>
+		  <entry>G<subscript>03high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;8:</entry>
+		  <entry>G<subscript>10low</subscript></entry>
+		  <entry>G<subscript>10high</subscript></entry>
+		  <entry>R<subscript>11low</subscript></entry>
+		  <entry>R<subscript>11high</subscript></entry>
+		  <entry>G<subscript>12low</subscript></entry>
+		  <entry>G<subscript>12high</subscript></entry>
+		  <entry>R<subscript>13low</subscript></entry>
+		  <entry>R<subscript>13high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;16:</entry>
+		  <entry>B<subscript>20low</subscript></entry>
+		  <entry>B<subscript>20high</subscript></entry>
+		  <entry>G<subscript>21low</subscript></entry>
+		  <entry>G<subscript>21high</subscript></entry>
+		  <entry>B<subscript>22low</subscript></entry>
+		  <entry>B<subscript>22high</subscript></entry>
+		  <entry>G<subscript>23low</subscript></entry>
+		  <entry>G<subscript>23high</subscript></entry>
+		</row>
+		<row>
+		  <entry>start&nbsp;+&nbsp;24:</entry>
+		  <entry>G<subscript>30low</subscript></entry>
+		  <entry>G<subscript>30high</subscript></entry>
+		  <entry>R<subscript>31low</subscript></entry>
+		  <entry>R<subscript>31high</subscript></entry>
+		  <entry>G<subscript>32low</subscript></entry>
+		  <entry>G<subscript>32high</subscript></entry>
+		  <entry>R<subscript>33low</subscript></entry>
+		  <entry>R<subscript>33high</subscript></entry>
+		</row>
+	      </tbody>
+	    </tgroup>
+	  </informaltable>
+	</para>
+      </formalpara>
+    </example>
+  </refsect1>
+</refentry>
Documentation/DocBook/media/v4l/pixfmt.xml +1 -0
index 457337e..29e9d7c 100644
@@ -1594,6 +1594,7 @@ access the palette, this must be done with ioctls of the Linux framebuffer API.<
     &sub-srggb10dpcm8;
     &sub-srggb12;
     &sub-srggb12p;
+    &sub-srggb14;
   </section>
 
   <section id="yuv-formats">
include/uapi/linux/videodev2.h +0 -0
index 7ace868..2c4b076 100644

include/uapi/linux/videodev2.h struct v4l2_pix_format { · line 590

Quoted 10 lines
include/uapi/linux/videodev2.h +4 -0
@@ -581,6 +581,10 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_SGBRG12P v4l2_fourcc('p', 'G', 'C', 'C')
 #define V4L2_PIX_FMT_SGRBG12P v4l2_fourcc('p', 'g', 'C', 'C')
 #define V4L2_PIX_FMT_SRGGB12P v4l2_fourcc('p', 'R', 'C', 'C')
+#define V4L2_PIX_FMT_SBGGR14 v4l2_fourcc('B', 'G', '1', '4') /* 14  BGBG.. GRGR.. */
+#define V4L2_PIX_FMT_SGBRG14 v4l2_fourcc('G', 'B', '1', '4') /* 14  GBGB.. RGRG.. */
+#define V4L2_PIX_FMT_SGRBG14 v4l2_fourcc('B', 'A', '1', '4') /* 14  GRGR.. BGBG.. */
+#define V4L2_PIX_FMT_SRGGB14 v4l2_fourcc('R', 'G', '1', '4') /* 14  RGRG.. GBGB.. */
 #define V4L2_PIX_FMT_SBGGR16 v4l2_fourcc('B', 'Y', 'R', '2') /* 16  BGBG.. GRGR.. */
 
 /* compressed formats */

Regards,

Hans

Signature · 4 lines
Kind regards,

Sakari Ailus
[email protected]
#14 lore raw

Re: [PATCH 5/6] v4l: Add 14-bit raw bayer pixel format definitions

Quoted 74 lines · Sakari Ailus

Hi Hans,

Quoted 17 lines · Hans Verkuil
Quoted 16 lines · Sakari Ailus

The formats added by this patch are:

	V4L2_PIX_FMT_SBGGR14
	V4L2_PIX_FMT_SGBRG14
	V4L2_PIX_FMT_SGRBG14
	V4L2_PIX_FMT_SRGGB14
---
 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml | 90 ++++++++++++++++++++++
 Documentation/DocBook/media/v4l/pixfmt.xml         |  1 +
 include/uapi/linux/videodev2.h                     |  4 +
 3 files changed, 95 insertions(+)
 create mode 100644 Documentation/DocBook/media/v4l/pixfmt-srggb14.xml
Quoted 14 lines

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 6

Quoted 12 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +6 -0
new file mode 100644
index 0000000..7e82d7e
@@ -0,0 +1,90 @@
+    <refentry>
+      <refmeta>
+	<refentrytitle>V4L2_PIX_FMT_SRGGB14 ('RG14'),
+	 V4L2_PIX_FMT_SGRBG14 ('BA14'),
+	 V4L2_PIX_FMT_SGBRG14 ('GB14'),
+	 V4L2_PIX_FMT_SBGGR14 ('BG14'),

Same comma problem.

Fixed.

Quoted 15 lines
Quoted 15 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +14 -0
+	 </refentrytitle>
+	&manvol;
+      </refmeta>
+      <refnamediv>
+	<refname id="V4L2-PIX-FMT-SRGGB14"><constant>V4L2_PIX_FMT_SRGGB14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGRBG14"><constant>V4L2_PIX_FMT_SGRBG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SGBRG14"><constant>V4L2_PIX_FMT_SGBRG14</constant></refname>
+	<refname id="V4L2-PIX-FMT-SBGGR14"><constant>V4L2_PIX_FMT_SBGGR14</constant></refname>
+	<refpurpose>14-bit Bayer formats expanded to 16 bits</refpurpose>
+      </refnamediv>
+      <refsect1>
+	<title>Description</title>
+
+	<para>These four pixel formats are raw sRGB / Bayer formats with
Quoted 8 lines

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 26

Quoted 6 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +6 -0
+14 bits per colour. Each colour component is stored in a 16-bit word, with 2
+unused high bits filled with zeros. Each n-pixel row contains n/2 green samples
+and n/2 blue or red samples, with alternating red and blue rows. Bytes are
+stored in memory in little endian order. They are conventionally described
+as GRGR... BGBG..., RGRG... GBGB..., etc. Below is an example of one of these
+formats</para>

s/formats/formats:/

Fixed.

Quoted 10 lines

Documentation/DocBook/media/v4l/pixfmt-srggb14.xml line 34

Quoted 8 lines
Documentation/DocBook/media/v4l/pixfmt-srggb14.xml new file +8 -0
+
+    <example>
+      <title><constant>V4L2_PIX_FMT_SBGGR14</constant> 4 &times; 4
+pixel image</title>
+
+      <formalpara>
+	<title>Byte Order.</title>
+	<para>Each cell is one byte, high 2 bits in high bytes are 0.

s/high 2/the high 2/

Quoted 2 lines

After re-reading the patch, I changed this to "Each cell is one byte, the 2 most significant bits in the high bytes are 0".

That is indeed better, although I would also say "two most" instead of "2 most". It's slightly weird to have "one byte" followed by "2 most". Could be me, though.

Regards,

Hans