1Name 2 3 APPLE_ycbcr_422 4 5Name Strings 6 7 GL_APPLE_ycbcr_422 8 9Contact 10 11 Geoff Stahl, Apple (gstahl 'at' apple.com) 12 13Status 14 15 Shipping as of August 24, 2002 (Mac OS X v10.2) 16 17Version 18 19 $Date: 2002/09/19 00:01:25 $ $Revision: 1.6 $ 20 21Number 22 23 275 24 25Dependencies 26 27 OpenGL 1.1 is required 28 APPLE_packed_pixels or OpenGL 1.2 is required 29 Written against OpenGL 1.2.1 30 31Overview 32 33 This extension provides a method for GL to read, store and optionally 34 process textures that are defined in Y'CbCr 422 video formats. This 35 extension supports the two common Y'CbCr 422 video formats (known by 36 QuickTime FourCC as '2vuy' and 'yuvs'). These formats represent one of the 37 most common 16 bit Y'CbCr formats in both standard and reverse byte 38 ordering. From a client stand point these can be assumed to be decoded 39 immediately (even though the implementation is free to optimize the data 40 storage and keep it in the native format) and otherwise function as any 41 other texture format. The texture command <internalformat> parameter 42 normally be should be specified as RGB, since Y'CbCr is just a form of RGB 43 data. This extension can be supported with either hardware or software 44 decoding and it is up to the specific implementation to determine which is 45 used. 46 47 A new <format> is added, YCBCR_422_APPLE. Additionally, to handle the 48 difference in pixel size and byte ordering for 422 video, the pixel storage 49 operations treat YCBCR_422_APPLE as a 2 component format using 50 the UNSIGNED_SHORT_8_8_APPLE or UNSIGNED_SHORT_8_8_REV_APPLE <type>. 51 52 The '2vuy' or k2vuyPixelFormat pixel format is an 8-bit 4:2:2 Component 53 Y'CbCr format. Each 16 bit pixel is represented by an unsigned eight bit 54 luminance component and two unsigned eight bit chroma components. Each pair 55 of pixels shares a common set of chroma values. The components are ordered 56 in memory; Cb, Y0, Cr, Y1. The luminance components have a range of [16, 57 235], while the chroma value has a range of [16, 240]. This is consistent 58 with the CCIR601 spec. This format is fairly prevalent on both Mac and Win32 59 platforms. The equivalent Microsoft fourCC is �UYVY�. This format is 60 supported with the UNSIGNED_SHORT_8_8_REV_APPLE type for pixel storage 61 operations. 62 63 The 'yuvs' or kYUVSPixelFormat is an 8-bit 4:2:2 Component Y'CbCr format. 64 Identical to the k2vuyPixelFormat except each 16 bit word has been byte 65 swapped. This results in a component ordering of; Y0, Cb, Y1, Cr. This is 66 most prevalent yuv 4:2:2 format on both Mac and Win32 platforms. The 67 equivalent Microsoft fourCC is 'YUY2'. This format is supported with the 68 UNSIGNED_SHORT_8_8_APPLE type for pixel storage operations. 69 70Issues 71 72 Why is YCRCR_422 not provided as an <internalformat>? 73 74 The internalFormat parameter passes two distinct pieces of information: 75 which one of the six texEnv equations to use *and* what the desired 76 internal storage format is. All of the existing internal format enums 77 have one of {RGBA, RGB, L, LA, A, I} embedded in the name to specify 78 which of the six texEnv equations. Since the YUV data contains RGB 79 information, only the RGB texEnv setting is meaningful. Thus, if we did 80 provide a new internal format enum it would have to be something of the 81 form GL_RGB_YCRCR422 (weird, but has the right meaning). Using 82 YCRCR_422 as an internalFormat setting would be incorrect with respect 83 to the texEnv equations. 84 85New Procedures and Functions 86 87 None 88 89New Tokens 90 91 Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, 92 TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, 93 TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, 94 ConvolutionFilter2D, ConvolutionFilter3D, GetConvolutionFilter, 95 SeparableFilter2D, SeparableFilter3D, GetSeparableFilter, ColorTable, 96 GetColorTable: 97 98 YCBCR_422_APPLE 0x85B9 99 100 Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, 101 TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, 102 TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, 103 ConvolutionFilter2D, ConvolutionFilter3D, GetConvolutionFilter, 104 SeparableFilter2D, SeparableFilter3D, GetSeparableFilter, ColorTable, 105 GetColorTable: 106 107 UNSIGNED_SHORT_8_8_APPLE 0x85BA 108 UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB 109 110Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 111 112 Two entries are added to table 3.5 (DrawPixels and ReadPixels type parameter 113 values and the corresponding OpenGL data types): 114 115 type Parameter Corresponding Special 116 Token Name GL Data Type Interpretation 117 -------------- ------------- -------------- 118 UNSIGNED_SHORT_8_8_APPLE ushort Yes 119 UNSIGNED_SHORT_8_8_REV_APPLE ushort Yes 120 121 122 One entry is added to table 3.6 (DrawPixels and ReadPixels formats): 123 124 Format Name Element Meaning and Order Target Buffer 125 ----------- ------------------------- ------------- 126 YCBCR_422_APPLE Y luminance value, Color 127 [Cb,Cr] chroma value 128 129 130 Two entries are added to table 3.8 (Packed pixel formats): 131 132 type Parameter GL Data Number of Matching 133 Token Name Type Components Pixel Formats 134 -------------- ------- ---------- ------------- 135 UNSIGNED_SHORT_8_8_APPLE ushort 3 YCBCR_422_APPLE 136 UNSIGNED_SHORT_8_8_REV_APPLE ushort 3 YCBCR_422_APPLE 137 138 139 Two entries are added to table 3.10 (UNSIGNED SHORT formats): 140 141 UNSIGNED_SHORT_8_8_APPLE: 142 143 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 144 +-------------------------------+-------------------------------+ 145 | 1st | 2nd | 146 +-------------------------------+-------------------------------+ 147 148 149 UNSIGNED_SHORT_8_8_REV_APPLE: 150 151 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 152 +-------------------------------+-------------------------------+ 153 | 2nd | 1st | 154 +-------------------------------+-------------------------------+ 155 156 157 One entry is added to table 3.12 (Packed pixel field assignments): 158 159 First Second Third Fourth 160 Format Element Element Element Element 161 ------ ------- ------- ------- ------- 162 YCBCR_422_APPLE luminance chroma 163 164 165 The new format YCBCR_422_APPLE is added to the discussion of Conversion to 166 RGB: 167 168 If the format is YCBCR_422_APPLE, the chroma and luminance values in each 169 group are converted to R, G, and B values using an undefined algorithm. This 170 conversion does not necessarily occur immediately as implementations are 171 free to pass Y'CbCr 422 formated pixels directly to hardware that is capable 172 of processing it. From a client stand point it can be assumed any 173 optimization will be transparently applied and not affect rendering results. 174 Pixel transfer operations will likely force conversion to RGB and will 175 likely negate hardware Y'CbCr acceleration. Additionally, if the format is 176 YCBCR_422_APPLE, the conversion algorithm may produce undefined RGB values 177 for final pixel of any row where the row length is not a multiple of 2. 178 179Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment Operations 180and the Framebuffer) 181 182 Add after last paragraph of Final Conversion: 183 184 For an RGBA color and if the <type> is UNSIGNED_SHORT_8_8_APPLE or 185 UNSIGNED_SHORT_8_8_REV_APPLE, the conversion to Y'CbCr occurs via an 186 undefined reverse component conversion. The actual equation used may vary 187 per implementation. If the row length is odd the final pixel maybe defined 188 otherwise the conversion to the requested Y'CbCr output <type> is in all 189 ways the same and any other <type>. 190 191Additions to the GLX Specification 192 193 None 194 195GLX Protocol 196 197 None 198 199Errors 200 201 None 202 203New State 204 205 None 206 207New Implementation Dependent State 208 209 None 210 211Revision History 212 213 None 214 215