File Index
Files and directories
Sign in
FILE

yuv-formats.rst

File preview with syntax highlighting.

linux-6.19.14/Documentation/userspace-api/media/v4l/yuv-formats.rst RESTRUCTUREDTEXT
  1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
  2.. c:namespace:: V4L
  3
  4.. _yuv-formats:
  5
  6***********
  7YUV Formats
  8***********
  9
 10YUV is the format native to TV broadcast and composite video signals. It
 11separates the brightness information (Y) from the color information (U
 12and V or Cb and Cr). The color information consists of red and blue
 13*color difference* signals, this way the green component can be
 14reconstructed by subtracting from the brightness component. See
 15:ref:`colorspaces` for conversion examples. YUV was chosen because
 16early television would only transmit brightness information. To add
 17color in a way compatible with existing receivers a new signal carrier
 18was added to transmit the color difference signals.
 19
 20
 21Subsampling
 22===========
 23
 24YUV formats commonly encode images with a lower resolution for the chroma
 25components than for the luma component. This compression technique, taking
 26advantage of the human eye being more sensitive to luminance than color
 27differences, is called chroma subsampling.
 28
 29While many combinations of subsampling factors in the horizontal and vertical
 30direction are possible, common factors are 1 (no subsampling), 2 and 4, with
 31horizontal subsampling always larger than or equal to vertical subsampling.
 32Common combinations are named as follows.
 33
 34- `4:4:4`: No subsampling
 35- `4:2:2`: Horizontal subsampling by 2, no vertical subsampling
 36- `4:2:0`: Horizontal subsampling by 2, vertical subsampling by 2
 37- `4:1:1`: Horizontal subsampling by 4, no vertical subsampling
 38- `4:1:0`: Horizontal subsampling by 4, vertical subsampling by 4
 39
 40Subsampling the chroma component effectively creates chroma values that can be
 41located in different spatial locations:
 42
 43- .. _yuv-chroma-centered:
 44
 45  The subsampled chroma value may be calculated by simply averaging the chroma
 46  value of two consecutive pixels. It effectively models the chroma of a pixel
 47  sited between the two original pixels. This is referred to as centered or
 48  interstitially sited chroma.
 49
 50- .. _yuv-chroma-cosited:
 51
 52  The other option is to subsample chroma values in a way that place them in
 53  the same spatial sites as the pixels. This may be performed by skipping every
 54  other chroma sample (creating aliasing artifacts), or with filters using an
 55  odd number of taps. This is referred to as co-sited chroma.
 56
 57The following examples show different combination of chroma siting in a 4x4
 58image.
 59
 60.. flat-table:: 4:2:2 subsampling, interstitially sited
 61    :header-rows: 1
 62    :stub-columns: 1
 63
 64    * -
 65      - 0
 66      -
 67      - 1
 68      -
 69      - 2
 70      -
 71      - 3
 72    * - 0
 73      - Y
 74      - C
 75      - Y
 76      -
 77      - Y
 78      - C
 79      - Y
 80    * - 1
 81      - Y
 82      - C
 83      - Y
 84      -
 85      - Y
 86      - C
 87      - Y
 88    * - 2
 89      - Y
 90      - C
 91      - Y
 92      -
 93      - Y
 94      - C
 95      - Y
 96    * - 3
 97      - Y
 98      - C
 99      - Y
100      -
101      - Y
102      - C
103      - Y
104
105.. flat-table:: 4:2:2 subsampling, co-sited
106    :header-rows: 1
107    :stub-columns: 1
108
109    * -
110      - 0
111      -
112      - 1
113      -
114      - 2
115      -
116      - 3
117    * - 0
118      - Y/C
119      -
120      - Y
121      -
122      - Y/C
123      -
124      - Y
125    * - 1
126      - Y/C
127      -
128      - Y
129      -
130      - Y/C
131      -
132      - Y
133    * - 2
134      - Y/C
135      -
136      - Y
137      -
138      - Y/C
139      -
140      - Y
141    * - 3
142      - Y/C
143      -
144      - Y
145      -
146      - Y/C
147      -
148      - Y
149
150.. flat-table:: 4:2:0 subsampling, horizontally interstitially sited, vertically co-sited
151    :header-rows: 1
152    :stub-columns: 1
153
154    * -
155      - 0
156      -
157      - 1
158      -
159      - 2
160      -
161      - 3
162    * - 0
163      - Y
164      - C
165      - Y
166      -
167      - Y
168      - C
169      - Y
170    * - 1
171      - Y
172      -
173      - Y
174      -
175      - Y
176      -
177      - Y
178    * - 2
179      - Y
180      - C
181      - Y
182      -
183      - Y
184      - C
185      - Y
186    * - 3
187      - Y
188      -
189      - Y
190      -
191      - Y
192      -
193      - Y
194
195.. flat-table:: 4:1:0 subsampling, horizontally and vertically interstitially sited
196    :header-rows: 1
197    :stub-columns: 1
198
199    * -
200      - 0
201      -
202      - 1
203      -
204      - 2
205      -
206      - 3
207    * - 0
208      - Y
209      -
210      - Y
211      -
212      - Y
213      -
214      - Y
215    * -
216      -
217      -
218      -
219      -
220      -
221      -
222      -
223    * - 1
224      - Y
225      -
226      - Y
227      -
228      - Y
229      -
230      - Y
231    * -
232      -
233      -
234      -
235      - C
236      -
237      -
238      -
239    * - 2
240      - Y
241      -
242      - Y
243      -
244      - Y
245      -
246      - Y
247    * -
248      -
249      -
250      -
251      -
252      -
253      -
254      -
255    * - 3
256      - Y
257      -
258      - Y
259      -
260      - Y
261      -
262      - Y
263
264
265.. toctree::
266    :maxdepth: 1
267
268    pixfmt-packed-yuv
269    pixfmt-yuv-planar
270    pixfmt-yuv-luma
271    pixfmt-y8i
272    pixfmt-y12i
273    pixfmt-y16i
274    pixfmt-uv8
275    pixfmt-m420
~/ Read-only file preview.