xref: /linux/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst (revision fd7d598270724cc787982ea48bbe17ad383a8b7f)
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3.. _yuv-luma-only:
4
5*****************
6Luma-Only Formats
7*****************
8
9This family of formats only store the luma component of a Y'CbCr image. They
10are often referred to as greyscale formats.
11
12.. note::
13
14   - In all the tables that follow, bit 7 is the most significant bit in a byte.
15   - Formats are described with the minimum number of pixels needed to create a
16     byte-aligned repeating pattern. `...` indicates repetition of the pattern.
17   - Y'\ :sub:`x`\ [9:2] denotes bits 9 to 2 of the Y' value for pixel at column
18     `x`.
19   - `0` denotes padding bits set to 0.
20
21
22.. raw:: latex
23
24    \scriptsize
25
26.. tabularcolumns:: |p{3.6cm}|p{3.0cm}|p{1.3cm}|p{2.6cm}|p{1.3cm}|p{1.3cm}|p{1.3cm}|
27
28.. flat-table:: Luma-Only Image Formats
29    :header-rows: 1
30    :stub-columns: 0
31
32    * - Identifier
33      - Code
34      - Byte 0
35      - Byte 1
36      - Byte 2
37      - Byte 3
38      - Byte 4
39
40    * .. _V4L2-PIX-FMT-GREY:
41
42      - ``V4L2_PIX_FMT_GREY``
43      - 'GREY'
44
45      - Y'\ :sub:`0`\ [7:0]
46      - ...
47      - ...
48      - ...
49      - ...
50
51    * .. _V4L2-PIX-FMT-IPU3-Y10:
52
53      - ``V4L2_PIX_FMT_IPU3_Y10``
54      - 'ip3y'
55
56      - Y'\ :sub:`0`\ [7:0]
57      - Y'\ :sub:`1`\ [5:0] Y'\ :sub:`0`\ [9:8]
58      - Y'\ :sub:`2`\ [3:0] Y'\ :sub:`1`\ [9:6]
59      - Y'\ :sub:`3`\ [1:0] Y'\ :sub:`2`\ [9:4]
60      - Y'\ :sub:`3`\ [9:2]
61
62    * .. _V4L2-PIX-FMT-Y10:
63
64      - ``V4L2_PIX_FMT_Y10``
65      - 'Y10 '
66
67      - Y'\ :sub:`0`\ [7:0]
68      - `000000` Y'\ :sub:`0`\ [9:8]
69      - ...
70      - ...
71      - ...
72
73    * .. _V4L2-PIX-FMT-Y10BPACK:
74
75      - ``V4L2_PIX_FMT_Y10BPACK``
76      - 'Y10B'
77
78      - Y'\ :sub:`0`\ [9:2]
79      - Y'\ :sub:`0`\ [1:0] Y'\ :sub:`1`\ [9:4]
80      - Y'\ :sub:`1`\ [3:0] Y'\ :sub:`2`\ [9:6]
81      - Y'\ :sub:`2`\ [5:0] Y'\ :sub:`3`\ [9:8]
82      - Y'\ :sub:`3`\ [7:0]
83
84    * .. _V4L2-PIX-FMT-Y10P:
85
86      - ``V4L2_PIX_FMT_Y10P``
87      - 'Y10P'
88
89      - Y'\ :sub:`0`\ [9:2]
90      - Y'\ :sub:`1`\ [9:2]
91      - Y'\ :sub:`2`\ [9:2]
92      - Y'\ :sub:`3`\ [9:2]
93      - Y'\ :sub:`3`\ [1:0] Y'\ :sub:`2`\ [1:0] Y'\ :sub:`1`\ [1:0] Y'\ :sub:`0`\ [1:0]
94
95    * .. _V4L2-PIX-FMT-Y12:
96
97      - ``V4L2_PIX_FMT_Y12``
98      - 'Y12 '
99
100      - Y'\ :sub:`0`\ [7:0]
101      - `0000` Y'\ :sub:`0`\ [11:8]
102      - ...
103      - ...
104      - ...
105
106    * .. _V4L2-PIX-FMT-Y012:
107
108      - ``V4L2_PIX_FMT_Y012``
109      - 'Y012'
110
111      - Y'\ :sub:`0`\ [3:0] `0000`
112      - Y'\ :sub:`0`\ [11:4]
113      - ...
114      - ...
115      - ...
116
117    * .. _V4L2-PIX-FMT-Y14:
118
119      - ``V4L2_PIX_FMT_Y14``
120      - 'Y14 '
121
122      - Y'\ :sub:`0`\ [7:0]
123      - `00` Y'\ :sub:`0`\ [13:8]
124      - ...
125      - ...
126      - ...
127
128    * .. _V4L2-PIX-FMT-Y16:
129
130      - ``V4L2_PIX_FMT_Y16``
131      - 'Y16 '
132
133      - Y'\ :sub:`0`\ [7:0]
134      - Y'\ :sub:`0`\ [15:8]
135      - ...
136      - ...
137      - ...
138
139    * .. _V4L2-PIX-FMT-Y16-BE:
140
141      - ``V4L2_PIX_FMT_Y16_BE``
142      - 'Y16 ' | (1U << 31)
143
144      - Y'\ :sub:`0`\ [15:8]
145      - Y'\ :sub:`0`\ [7:0]
146      - ...
147      - ...
148      - ...
149
150.. raw:: latex
151
152    \normalsize
153
154.. note::
155
156    For the Y16 and Y16_BE formats, the actual sampling precision may be lower
157    than 16 bits. For example, 10 bits per pixel uses values in the range 0 to
158    1023. For the IPU3_Y10 format 25 pixels are packed into 32 bytes, which
159    leaves the 6 most significant bits of the last byte padded with 0.
160
161    For Y012 and Y12 formats, Y012 places its data in the 12 high bits, with
162    padding zeros in the 4 low bits, in contrast to the Y12 format, which has
163    its padding located in the most significant bits of the 16 bit word.
164