274 lines · plain
1.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later2 3.. _yuv-formats:4 5***********6YUV Formats7***********8 9YUV is the format native to TV broadcast and composite video signals. It10separates the brightness information (Y) from the color information (U11and V or Cb and Cr). The color information consists of red and blue12*color difference* signals, this way the green component can be13reconstructed by subtracting from the brightness component. See14:ref:`colorspaces` for conversion examples. YUV was chosen because15early television would only transmit brightness information. To add16color in a way compatible with existing receivers a new signal carrier17was added to transmit the color difference signals.18 19 20Subsampling21===========22 23YUV formats commonly encode images with a lower resolution for the chroma24components than for the luma component. This compression technique, taking25advantage of the human eye being more sensitive to luminance than color26differences, is called chroma subsampling.27 28While many combinations of subsampling factors in the horizontal and vertical29direction are possible, common factors are 1 (no subsampling), 2 and 4, with30horizontal subsampling always larger than or equal to vertical subsampling.31Common combinations are named as follows.32 33- `4:4:4`: No subsampling34- `4:2:2`: Horizontal subsampling by 2, no vertical subsampling35- `4:2:0`: Horizontal subsampling by 2, vertical subsampling by 236- `4:1:1`: Horizontal subsampling by 4, no vertical subsampling37- `4:1:0`: Horizontal subsampling by 4, vertical subsampling by 438 39Subsampling the chroma component effectively creates chroma values that can be40located in different spatial locations:41 42- .. _yuv-chroma-centered:43 44 The subsampled chroma value may be calculated by simply averaging the chroma45 value of two consecutive pixels. It effectively models the chroma of a pixel46 sited between the two original pixels. This is referred to as centered or47 interstitially sited chroma.48 49- .. _yuv-chroma-cosited:50 51 The other option is to subsample chroma values in a way that place them in52 the same spatial sites as the pixels. This may be performed by skipping every53 other chroma sample (creating aliasing artifacts), or with filters using an54 odd number of taps. This is referred to as co-sited chroma.55 56The following examples show different combination of chroma siting in a 4x457image.58 59.. flat-table:: 4:2:2 subsampling, interstitially sited60 :header-rows: 161 :stub-columns: 162 63 * -64 - 065 -66 - 167 -68 - 269 -70 - 371 * - 072 - Y73 - C74 - Y75 -76 - Y77 - C78 - Y79 * - 180 - Y81 - C82 - Y83 -84 - Y85 - C86 - Y87 * - 288 - Y89 - C90 - Y91 -92 - Y93 - C94 - Y95 * - 396 - Y97 - C98 - Y99 -100 - Y101 - C102 - Y103 104.. flat-table:: 4:2:2 subsampling, co-sited105 :header-rows: 1106 :stub-columns: 1107 108 * -109 - 0110 -111 - 1112 -113 - 2114 -115 - 3116 * - 0117 - Y/C118 -119 - Y120 -121 - Y/C122 -123 - Y124 * - 1125 - Y/C126 -127 - Y128 -129 - Y/C130 -131 - Y132 * - 2133 - Y/C134 -135 - Y136 -137 - Y/C138 -139 - Y140 * - 3141 - Y/C142 -143 - Y144 -145 - Y/C146 -147 - Y148 149.. flat-table:: 4:2:0 subsampling, horizontally interstitially sited, vertically co-sited150 :header-rows: 1151 :stub-columns: 1152 153 * -154 - 0155 -156 - 1157 -158 - 2159 -160 - 3161 * - 0162 - Y163 - C164 - Y165 -166 - Y167 - C168 - Y169 * - 1170 - Y171 -172 - Y173 -174 - Y175 -176 - Y177 * - 2178 - Y179 - C180 - Y181 -182 - Y183 - C184 - Y185 * - 3186 - Y187 -188 - Y189 -190 - Y191 -192 - Y193 194.. flat-table:: 4:1:0 subsampling, horizontally and vertically interstitially sited195 :header-rows: 1196 :stub-columns: 1197 198 * -199 - 0200 -201 - 1202 -203 - 2204 -205 - 3206 * - 0207 - Y208 -209 - Y210 -211 - Y212 -213 - Y214 * -215 -216 -217 -218 -219 -220 -221 -222 * - 1223 - Y224 -225 - Y226 -227 - Y228 -229 - Y230 * -231 -232 -233 -234 - C235 -236 -237 -238 * - 2239 - Y240 -241 - Y242 -243 - Y244 -245 - Y246 * -247 -248 -249 -250 -251 -252 -253 -254 * - 3255 - Y256 -257 - Y258 -259 - Y260 -261 - Y262 263 264.. toctree::265 :maxdepth: 1266 267 pixfmt-packed-yuv268 pixfmt-yuv-planar269 pixfmt-yuv-luma270 pixfmt-y8i271 pixfmt-y12i272 pixfmt-uv8273 pixfmt-m420274