15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci APPLE_rgb_422 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName Strings 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_APPLE_rgb_422 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciContact 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci Ken Dyke, Apple (kdyke 'at' apple.com) 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciStatus 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci Shipping as of August 28, 2009 (Mac OS X v10.6) 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciVersion 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci Last Modified Date: June 26, 2013 205bd8deadSopenharmony_ci Version: 1.5 215bd8deadSopenharmony_ci 225bd8deadSopenharmony_ciNumber 235bd8deadSopenharmony_ci 245bd8deadSopenharmony_ci OpenGL Extension #373 255bd8deadSopenharmony_ci OpenGL ES Extension #76 265bd8deadSopenharmony_ci 275bd8deadSopenharmony_ciDependencies 285bd8deadSopenharmony_ci 295bd8deadSopenharmony_ci OpenGL 2.0 or ARB_fragment_program is required when the GL is OpenGL. 305bd8deadSopenharmony_ci OpenGL ES 2.0 is required when the GL is OpenGL ES. 315bd8deadSopenharmony_ci Written against OpenGL 2.0. 325bd8deadSopenharmony_ci There are interactions with OpenGL ES 2.0 and 3.0. 335bd8deadSopenharmony_ci 345bd8deadSopenharmony_ciOverview 355bd8deadSopenharmony_ci 365bd8deadSopenharmony_ci A common storage format for video data is 8-bit 422, with every four 375bd8deadSopenharmony_ci bytes encoding two pixels. Within the four bytes there are two 385bd8deadSopenharmony_ci luminance samples, and two chrominance samples that are shared between 395bd8deadSopenharmony_ci both pixels. 405bd8deadSopenharmony_ci 415bd8deadSopenharmony_ci There is a previous extension, namely GL_APPLE_ycbcr_422 that provided 425bd8deadSopenharmony_ci transparent support for this kind of data. However, that extension 435bd8deadSopenharmony_ci left the exact conversion from Y'CbCr to RGB undefined. In reality, 445bd8deadSopenharmony_ci it really had always been based on the ITU-R BT.601 standard, which 455bd8deadSopenharmony_ci meant it was not particularly useful for dealing with high definition 465bd8deadSopenharmony_ci video data, which is encoded using the Rec. 709 standard. 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci In some cases the original extension was implemented via fixed function 495bd8deadSopenharmony_ci hardware, but on more modern graphics processors this is done via 505bd8deadSopenharmony_ci a combination of 422 sampling formats and fragment shader instructions. 515bd8deadSopenharmony_ci 525bd8deadSopenharmony_ci This extension essentially exposes a "raw" 422 texture format that 535bd8deadSopenharmony_ci allows developers to access the raw pre-converted Y'CbCr components 545bd8deadSopenharmony_ci so that they have full control over the colorspace conversion. 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci In order to avoid defining entirely new color channels within GL, 575bd8deadSopenharmony_ci the Y, Cb and Cr color channels within the 422 data are mapped into 585bd8deadSopenharmony_ci the existing green, blue and red color channels, respectively. Developers 595bd8deadSopenharmony_ci must write their own fragment shader/program to perform the desired 605bd8deadSopenharmony_ci color space transformation. 615bd8deadSopenharmony_ci 625bd8deadSopenharmony_ci Note: Because of the use of the packed UNSIGNED_SHORT_8_8[_REV] types, the 635bd8deadSopenharmony_ci correct type to use based on the layout of the data in memory (Cb Y Cr Y 645bd8deadSopenharmony_ci versus Y Cb Y Cr) will necessarily be sensitive to host endianness. 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci This extension differs from the EXT_422_pixels extension in a couple of 675bd8deadSopenharmony_ci ways. First, this extension defines only a single new format, while 685bd8deadSopenharmony_ci relying on two new type arguments to differentiate between the two 695bd8deadSopenharmony_ci component orderings. Second, this extension provides no defined method 705bd8deadSopenharmony_ci of filtering the chroma values between adjacent pixels. And lastly, 715bd8deadSopenharmony_ci the color channel assignments are slightly different, essentially to 725bd8deadSopenharmony_ci match more closely the rough meanings of the Y, Cb and Cr values in 735bd8deadSopenharmony_ci 422 video data. 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ciNew Procedures and Functions 765bd8deadSopenharmony_ci 775bd8deadSopenharmony_ci None 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ciNew Tokens 805bd8deadSopenharmony_ci 815bd8deadSopenharmony_ci Accepted by the <format> parameter of DrawPixels, ReadPixels, TexImage1D, 825bd8deadSopenharmony_ci TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, 835bd8deadSopenharmony_ci TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, 845bd8deadSopenharmony_ci ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, 855bd8deadSopenharmony_ci GetSeparableFilter, ColorTable, and GetColorTable: 865bd8deadSopenharmony_ci 875bd8deadSopenharmony_ci RGB_422_APPLE 0x8A1F 885bd8deadSopenharmony_ci 895bd8deadSopenharmony_ci Accepted by the <internalformat> parameter of TexImage2D, TexImage3D, 905bd8deadSopenharmony_ci CopyTexImage2D, TexStorage2D, and TexStorage3D: 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci RGB_RAW_422_APPLE 0x8A51 935bd8deadSopenharmony_ci 945bd8deadSopenharmony_ci Accepted by the <type> parameter of DrawPixels, ReadPixels, TexImage1D, 955bd8deadSopenharmony_ci TexImage2D, GetTexImage, TexImage3D, TexSubImage1D, TexSubImage2D, 965bd8deadSopenharmony_ci TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, 975bd8deadSopenharmony_ci ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, 985bd8deadSopenharmony_ci GetSeparableFilter, ColorTable, and GetColorTable: 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_APPLE 0x85BA 1015bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB 1025bd8deadSopenharmony_ci 1035bd8deadSopenharmony_ciAdditions to Chapter 3 of the OpenGL 2.0 Specification (Rasterization) 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci Two entries are added to Table 3.5 (DrawPixels and ReadPixels type 1065bd8deadSopenharmony_ci parameter values and the corresponding OpenGL data types): 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci type Parameter Corresponding Special 1095bd8deadSopenharmony_ci Token Name GL Data Type Interpretation 1105bd8deadSopenharmony_ci -------------- ------------- -------------- 1115bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_APPLE ushort Yes 1125bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_REV_APPLE ushort Yes 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci One entry is added to Table 3.6 (DrawPixels and ReadPixels formats): 1165bd8deadSopenharmony_ci 1175bd8deadSopenharmony_ci Format Name Element Meaning and Order Target Buffer 1185bd8deadSopenharmony_ci ----------- ------------------------- ------------ 1195bd8deadSopenharmony_ci RGB_422_APPLE G,B even column pixels Color 1205bd8deadSopenharmony_ci G,R odd column pixels 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ci 1235bd8deadSopenharmony_ci Two entries are added to Table 3.8 (Packed pixel formats): 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci type Parameter GL Data Number of Matching 1265bd8deadSopenharmony_ci Token Name Type Components Pixel Formats 1275bd8deadSopenharmony_ci -------------- ------- ---------- ------------- 1285bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_APPLE ushort 2 RGB_422_APPLE 1295bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_REV_APPLE ushort 2 RGB_422_APPLE 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ci 1325bd8deadSopenharmony_ci Two entries are added to Table 3.10 (UNSIGNED SHORT formats): 1335bd8deadSopenharmony_ci 1345bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_APPLE: 1355bd8deadSopenharmony_ci 1365bd8deadSopenharmony_ci 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1375bd8deadSopenharmony_ci +-------------------------------+-------------------------------+ 1385bd8deadSopenharmony_ci | 1st | 2nd | 1395bd8deadSopenharmony_ci +-------------------------------+-------------------------------+ 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci 1425bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_REV_APPLE: 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 1455bd8deadSopenharmony_ci +-------------------------------+-------------------------------+ 1465bd8deadSopenharmony_ci | 2nd | 1st | 1475bd8deadSopenharmony_ci +-------------------------------+-------------------------------+ 1485bd8deadSopenharmony_ci 1495bd8deadSopenharmony_ci 1505bd8deadSopenharmony_ci One entry is added to Table 3.12 (Packed pixel field assignments): 1515bd8deadSopenharmony_ci 1525bd8deadSopenharmony_ci First Second Third Fourth 1535bd8deadSopenharmony_ci Format Element Element Element Element 1545bd8deadSopenharmony_ci ------ ------- ------- ------- ------- 1555bd8deadSopenharmony_ci RGB_422_APPLE green blue/red 1565bd8deadSopenharmony_ci 1575bd8deadSopenharmony_ci Add the following second paragraph to the end of the section entitled 1585bd8deadSopenharmony_ci "Conversion to RGB": 1595bd8deadSopenharmony_ci 1605bd8deadSopenharmony_ci If the format is RGB_422_APPLE, pixels are unpacked in pairs. For 1615bd8deadSopenharmony_ci even column pixels, the green and blue components are unpacked from the 1625bd8deadSopenharmony_ci even column pixel, and the red component is taken from the following odd 1635bd8deadSopenharmony_ci column pixel. For odd column pixels, the green and red components are 1645bd8deadSopenharmony_ci unpacked from the odd column pixel, and the blue component is unpacked 1655bd8deadSopenharmony_ci from the previous even column pixel. The row length must be even or 1665bd8deadSopenharmony_ci INVALID_OPERATION is generated. 1675bd8deadSopenharmony_ci 1685bd8deadSopenharmony_ciAdditions to the GLX Specification 1695bd8deadSopenharmony_ci 1705bd8deadSopenharmony_ci None 1715bd8deadSopenharmony_ci 1725bd8deadSopenharmony_ciGLX Protocol 1735bd8deadSopenharmony_ci 1745bd8deadSopenharmony_ci None 1755bd8deadSopenharmony_ci 1765bd8deadSopenharmony_ciDependencies on OpenGL ES 2.0 1775bd8deadSopenharmony_ci 1785bd8deadSopenharmony_ci If the GL is OpenGL ES, RGB_422_APPLE format textures may not be used 1795bd8deadSopenharmony_ci in conjunction with mipmapping or repeat wrap modes. Add to the list 1805bd8deadSopenharmony_ci of conditions in section 3.8.2 under which (0,0,0,1) will be returned 1815bd8deadSopenharmony_ci from a sampler: 1825bd8deadSopenharmony_ci 1835bd8deadSopenharmony_ci - A two-dimensional sampler is called, the corresponding texture image 1845bd8deadSopenharmony_ci has format RGB_422_APPLE, and either the texture wrap mode is not 1855bd8deadSopenharmony_ci CLAMP_TO_EDGE, or the minification filter is neither NEAREST nor 1865bd8deadSopenharmony_ci LINEAR. 1875bd8deadSopenharmony_ci 1885bd8deadSopenharmony_ci Also, RGB_422_APPLE format textures may not be used as cube maps. The 1895bd8deadSopenharmony_ci following error condition is introduced: 1905bd8deadSopenharmony_ci 1915bd8deadSopenharmony_ci - INVALID_OPERATION is generated by TexImage2D, TexSubImage2D, and 1925bd8deadSopenharmony_ci CopyTexImage2D if <format> is RGB_422_APPLE and <target> is 1935bd8deadSopenharmony_ci TEXTURE_CUBE_MAP_*. 1945bd8deadSopenharmony_ci 1955bd8deadSopenharmony_ci Changes to OpenGL 2.0's Table 3.5 above are made to OpenGL ES 2.0's Table 1965bd8deadSopenharmony_ci 3.2 (TexImage2D and ReadPixels <type> parameter values and the 1975bd8deadSopenharmony_ci corresponding GL data types.) Changes to OpenGL 2.0's Table 3.6 above are 1985bd8deadSopenharmony_ci made to OpenGL ES 2.0's Table 3.3 (TexImage2D and ReadPixels formats). 1995bd8deadSopenharmony_ci Changes to OpenGL 2.0's Table 3.8 above are made to OpenGL ES 2.0's Table 2005bd8deadSopenharmony_ci 3.5 (Packed pixel formats). Changes to OpenGL 2.0's Table 3.10 above are 2015bd8deadSopenharmony_ci made to OpenGL ES 2.0's Table 3.6 (UNSIGNED_SHORT formats). Changes to 2025bd8deadSopenharmony_ci OpenGL 2.0's Table 3.13 are made to OpenGL ES 2.0's Table 3.7 (Packed 2035bd8deadSopenharmony_ci pixel field assignments). 2045bd8deadSopenharmony_ci 2055bd8deadSopenharmony_ci Mentions of DrawPixels, ReadPixels, TexImage1D, TexImage3D, GetTexImage, 2065bd8deadSopenharmony_ci TexSubImage1D, TexSubImage3D, GetHistogram, GetMinmax, ConvolutionFilter1D, 2075bd8deadSopenharmony_ci ConvolutionFilter2D, GetConvolutionFilter, SeparableFilter2D, 2085bd8deadSopenharmony_ci GetSeparableFilter, ColorTable, and GetColorTable in this extension 2095bd8deadSopenharmony_ci specification can be ignored for OpenGL ES. 2105bd8deadSopenharmony_ci 2115bd8deadSopenharmony_ci Mentions of TexStorage* and RGB_RAW_422_APPLE can be ignored unless EXT_texture_storage is present. 2125bd8deadSopenharmony_ci 2135bd8deadSopenharmony_ciDependencies on OpenGL ES 3.0 2145bd8deadSopenharmony_ci 2155bd8deadSopenharmony_ci All of the same dependencies for OpenGL ES 2.0 also exist for OpenGL ES 3.0 2165bd8deadSopenharmony_ci except that TexImage3D and TexSubImage3D do apply here. 2175bd8deadSopenharmony_ci 2185bd8deadSopenharmony_ci Changes to OpenGL 2.0's Table 3.5 above are made to OpenGL ES 3.0's Table 2195bd8deadSopenharmony_ci 3.4 (Pixel data <type> parameter values and the corresponding GL data 2205bd8deadSopenharmony_ci types.) Changes to OpenGL 2.0's Table 3.6 above are made to OpenGL ES 2215bd8deadSopenharmony_ci 3.0's Table 3.5 (Pixel data formats). Changes to OpenGL 2.0's Table 3.8 2225bd8deadSopenharmony_ci above are made to OpenGL ES 3.0's Table 3.6 (Packed pixel formats). 2235bd8deadSopenharmony_ci Changes to OpenGL 2.0's Table 3.10 above are made to OpenGL ES 3.0's Table 2245bd8deadSopenharmony_ci 3.7 (UNSIGNED_SHORT formats). Changes to OpenGL 2.0's Table 3.13 are made 2255bd8deadSopenharmony_ci to OpenGL ES 3.0's Table 3.10 (Packed pixel field assignments). 2265bd8deadSopenharmony_ci 2275bd8deadSopenharmony_ci When the GL is OpenGL ES 3.0, the following table entries are added to Table 2285bd8deadSopenharmony_ci 3.2: 2295bd8deadSopenharmony_ci 2305bd8deadSopenharmony_ci Format Type External Bytes per Pixel Internal Format 2315bd8deadSopenharmony_ci ------------- ---------------------------- ------------------------ ----------------- 2325bd8deadSopenharmony_ci RGB_422_APPLE UNSIGNED_SHORT_8_8_APPLE 2 RGB_RAW_422_APPLE 2335bd8deadSopenharmony_ci RGB_422_APPLE UNSIGNED_SHORT_8_8_REV_APPLE 2 RGB_RAW_422_APPLE 2345bd8deadSopenharmony_ci 2355bd8deadSopenharmony_ci When the GL is OpenGL ES 3.0, RGB_422_APPLE is also added to the Texture-only 2365bd8deadSopenharmony_ci color formats list in the Required Texture Formats subsection of section 2375bd8deadSopenharmony_ci 3.8.3. 2385bd8deadSopenharmony_ci 2395bd8deadSopenharmony_ci If the GL is not OpenGL ES 3.0 and the EXT_texture_storage extension is not 2405bd8deadSopenharmony_ci present, omit references to RGB_RAW_422_APPLE and TexStorage*. 2415bd8deadSopenharmony_ci 2425bd8deadSopenharmony_ci Details of how this extension interacts with EXT_texture_storage when the 2435bd8deadSopenharmony_ci GL is a version of OpenGL earlier than 3.0 can be found in the 2445bd8deadSopenharmony_ci EXT_texture_storage spec. 2455bd8deadSopenharmony_ci 2465bd8deadSopenharmony_ciErrors 2475bd8deadSopenharmony_ci 2485bd8deadSopenharmony_ci INVALID_OPERATION is generated if <format> is RGB_422_APPLE and <type> is 2495bd8deadSopenharmony_ci not one of UNSIGNED_SHORT_8_8_APPLE or UNSIGNED_SHORT_8_8_REV_APPLE. 2505bd8deadSopenharmony_ci 2515bd8deadSopenharmony_ci INVALID_OPERATION is generated if <type> is UNSIGNED_SHORT_8_8_APPLE or 2525bd8deadSopenharmony_ci UNSIGNED_SHORT_8_8_REV_APPLE and <format> is not RGB_422_APPLE. 2535bd8deadSopenharmony_ci 2545bd8deadSopenharmony_ci INVALID_OPERATION is generated if <format> is RGB_422_APPLE and <width> 2555bd8deadSopenharmony_ci is not even. 2565bd8deadSopenharmony_ci 2575bd8deadSopenharmony_ciNew State 2585bd8deadSopenharmony_ci 2595bd8deadSopenharmony_ci None 2605bd8deadSopenharmony_ci 2615bd8deadSopenharmony_ciNew Implementation Dependent State 2625bd8deadSopenharmony_ci 2635bd8deadSopenharmony_ci None 2645bd8deadSopenharmony_ci 2655bd8deadSopenharmony_ciRevision History 2665bd8deadSopenharmony_ci 2675bd8deadSopenharmony_ci 1.5 2013/06/26 lipchak Add ES3 interactions 2685bd8deadSopenharmony_ci 1.4 2010/04/06 lipchak Add ES interactions 2695bd8deadSopenharmony_ci 1.3 2009/09/03 kdyke First shipping version 2705bd8deadSopenharmony_ci 271