Back to home page

OSCL-LXR

 
 

    


0001 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
0002 
0003 .. _yuv-formats:
0004 
0005 ***********
0006 YUV Formats
0007 ***********
0008 
0009 YUV is the format native to TV broadcast and composite video signals. It
0010 separates the brightness information (Y) from the color information (U
0011 and V or Cb and Cr). The color information consists of red and blue
0012 *color difference* signals, this way the green component can be
0013 reconstructed by subtracting from the brightness component. See
0014 :ref:`colorspaces` for conversion examples. YUV was chosen because
0015 early television would only transmit brightness information. To add
0016 color in a way compatible with existing receivers a new signal carrier
0017 was added to transmit the color difference signals.
0018 
0019 
0020 Subsampling
0021 ===========
0022 
0023 YUV formats commonly encode images with a lower resolution for the chroma
0024 components than for the luma component. This compression technique, taking
0025 advantage of the human eye being more sensitive to luminance than color
0026 differences, is called chroma subsampling.
0027 
0028 While many combinations of subsampling factors in the horizontal and vertical
0029 direction are possible, common factors are 1 (no subsampling), 2 and 4, with
0030 horizontal subsampling always larger than or equal to vertical subsampling.
0031 Common combinations are named as follows.
0032 
0033 - `4:4:4`: No subsampling
0034 - `4:2:2`: Horizontal subsampling by 2, no vertical subsampling
0035 - `4:2:0`: Horizontal subsampling by 2, vertical subsampling by 2
0036 - `4:1:1`: Horizontal subsampling by 4, no vertical subsampling
0037 - `4:1:0`: Horizontal subsampling by 4, vertical subsampling by 4
0038 
0039 Subsampling the chroma component effectively creates chroma values that can be
0040 located in different spatial locations:
0041 
0042 - .. _yuv-chroma-centered:
0043 
0044   The subsampled chroma value may be calculated by simply averaging the chroma
0045   value of two consecutive pixels. It effectively models the chroma of a pixel
0046   sited between the two original pixels. This is referred to as centered or
0047   interstitially sited chroma.
0048 
0049 - .. _yuv-chroma-cosited:
0050 
0051   The other option is to subsample chroma values in a way that place them in
0052   the same spatial sites as the pixels. This may be performed by skipping every
0053   other chroma sample (creating aliasing artifacts), or with filters using an
0054   odd number of taps. This is referred to as co-sited chroma.
0055 
0056 The following examples show different combination of chroma siting in a 4x4
0057 image.
0058 
0059 .. flat-table:: 4:2:2 subsampling, interstitially sited
0060     :header-rows: 1
0061     :stub-columns: 1
0062 
0063     * -
0064       - 0
0065       -
0066       - 1
0067       -
0068       - 2
0069       -
0070       - 3
0071     * - 0
0072       - Y
0073       - C
0074       - Y
0075       -
0076       - Y
0077       - C
0078       - Y
0079     * - 1
0080       - Y
0081       - C
0082       - Y
0083       -
0084       - Y
0085       - C
0086       - Y
0087     * - 2
0088       - Y
0089       - C
0090       - Y
0091       -
0092       - Y
0093       - C
0094       - Y
0095     * - 3
0096       - Y
0097       - C
0098       - Y
0099       -
0100       - Y
0101       - C
0102       - Y
0103 
0104 .. flat-table:: 4:2:2 subsampling, co-sited
0105     :header-rows: 1
0106     :stub-columns: 1
0107 
0108     * -
0109       - 0
0110       -
0111       - 1
0112       -
0113       - 2
0114       -
0115       - 3
0116     * - 0
0117       - Y/C
0118       -
0119       - Y
0120       -
0121       - Y/C
0122       -
0123       - Y
0124     * - 1
0125       - Y/C
0126       -
0127       - Y
0128       -
0129       - Y/C
0130       -
0131       - Y
0132     * - 2
0133       - Y/C
0134       -
0135       - Y
0136       -
0137       - Y/C
0138       -
0139       - Y
0140     * - 3
0141       - Y/C
0142       -
0143       - Y
0144       -
0145       - Y/C
0146       -
0147       - Y
0148 
0149 .. flat-table:: 4:2:0 subsampling, horizontally interstitially sited, vertically co-sited
0150     :header-rows: 1
0151     :stub-columns: 1
0152 
0153     * -
0154       - 0
0155       -
0156       - 1
0157       -
0158       - 2
0159       -
0160       - 3
0161     * - 0
0162       - Y
0163       - C
0164       - Y
0165       -
0166       - Y
0167       - C
0168       - Y
0169     * - 1
0170       - Y
0171       -
0172       - Y
0173       -
0174       - Y
0175       -
0176       - Y
0177     * - 2
0178       - Y
0179       - C
0180       - Y
0181       -
0182       - Y
0183       - C
0184       - Y
0185     * - 3
0186       - Y
0187       -
0188       - Y
0189       -
0190       - Y
0191       -
0192       - Y
0193 
0194 .. flat-table:: 4:1:0 subsampling, horizontally and vertically interstitially sited
0195     :header-rows: 1
0196     :stub-columns: 1
0197 
0198     * -
0199       - 0
0200       -
0201       - 1
0202       -
0203       - 2
0204       -
0205       - 3
0206     * - 0
0207       - Y
0208       -
0209       - Y
0210       -
0211       - Y
0212       -
0213       - Y
0214     * -
0215       -
0216       -
0217       -
0218       -
0219       -
0220       -
0221       -
0222     * - 1
0223       - Y
0224       -
0225       - Y
0226       -
0227       - Y
0228       -
0229       - Y
0230     * -
0231       -
0232       -
0233       -
0234       - C
0235       -
0236       -
0237       -
0238     * - 2
0239       - Y
0240       -
0241       - Y
0242       -
0243       - Y
0244       -
0245       - Y
0246     * -
0247       -
0248       -
0249       -
0250       -
0251       -
0252       -
0253       -
0254     * - 3
0255       - Y
0256       -
0257       - Y
0258       -
0259       - Y
0260       -
0261       - Y
0262 
0263 
0264 .. toctree::
0265     :maxdepth: 1
0266 
0267     pixfmt-packed-yuv
0268     pixfmt-yuv-planar
0269     pixfmt-yuv-luma
0270     pixfmt-y8i
0271     pixfmt-y12i
0272     pixfmt-uv8
0273     pixfmt-m420