1XXX - Not complete. 2 3Name 4 5 SGIX_subsample 6 7Name Strings 8 9 GL_SGIX_subsample 10 11Version 12 13 Last Modified Date: 07/27/1999 14 Author Revision: $Header: //depot/main/doc/registry/extensions/SGI/subsample.spec#10 $ 15 16Number 17 18 202 19 20Dependencies 21 22 Full support of SGI_ycrcb can be accomplished by using 23 SGIX_subsample and GL_COLOR_MATRIX. In addition, some 24 applications may also choose to invoke GL_CONVOLUTION 25 and GL_COLOR_TABLE to better improve the quality of both 26 the resampling and color conversion. Note however, that 27 this extension, combined with the ycrcbformat.spec 28 (SGIX_ycrcba) extension obsoletes the current ycrcb.spec 29 (SGIX_ycrcb) extension. 30 31 EXT_texture3D affects the definition of this extension 32 EXT_subtexture affects the definition of this extension 33 EXT_histogram affects the definition of this extension 34 EXT_convolution affects the definition of this extension 35 SGI_color_table affects the definition of this extension 36 SGI_resample affects the definition of this extension 37 SGI_subsample_4224 affects the definition of this extension 38 39Overview 40 41 Many video image formats and compression techniques utilize 42 various component subsamplings, so it is necessary to provide a 43 mechanism to specify the up- and down-sampling of components as 44 pixel data is drawn from and read back to the client. Though 45 subsampled components are normally associated with the video 46 color space, YCrCb, use of subsampling in OpenGL does not imply 47 a specific color space. 48 49 This extension defines new pixel storage modes that are used in 50 the conversion of image data to and from component subsampled 51 formats on the client side. The extension defines a new pixel 52 storage mode to specify these sampling patterns, there are 53 three legal values (PIXEL_SUBSAMPLE_4444_SGIX, 54 PIXEL_SUBSAMPLE_4242_SGIX, and 55 PIXEL_SUBSAMPLE_2424_SGIX). 56 57 When pixel data is received from the client and an unpacking 58 upsampling mode other than PIXEL_SUBSAMPLE_4444_SGIX is 59 specified, the upsampling is performed via replication, 60 unless otherwise specified by RESAMPLE_SGIX. 61 62 Similarly, when pixel data is read back to the client and a 63 packing downsampling mode other than 64 PIXEL_SUBSAMPLE_4444_SGIX is specified, downsampling is 65 performed via simple component decimation (point sampling), 66 unless otherwise specified by RESAMPLE_SGIX. 67 68Issues 69 * If we revive the ycrcbformat.spec then support for the old 70 (SGIX_ycrcb) extension can be accomplished using the the 71 SGIX_subsample and SGIX_ycrcba. 72 73 * the enums with names like PIXEL_SUBSAMPLE_4242_SGIX and 74 PIXEL_SUBSAMPLE_2424_SGIX gives an impression that there 75 are 4 components in the subsampling. Can there be an 76 alternative name? 77 (Angela suggests: PIXEL_SUBSAMPLE_422_CbYCrY_SGIX and 78 PIXEL_SUBSAMPLE_422_YCbYCr_SGIX. This is clear, but involves 79 naming the components YCrCb. However, the term 4:2:2 basically 80 refers to the subcarrier frequency for the YCrCb transmission 81 in video signals, so 4:2:2 in a way already implies 4:2:2) 82 83New Procedures and Functions 84 85 None. 86 87New Tokens 88 89 Accepted by the <pname> parameter of PixelStoref, PixelStorei, 90 GetBooleanv, GetIntegerv, GetFloatv and GetDoublev: 91 92 PACK_SUBSAMPLE_RATE_SGIX 0x85A0 93 UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1 94 95 Accepted by the <param> parameter of PixelStoref and 96 PixelStorei when the <pname> parameter is PACK_SUBSAMPLE_RATE_SGIX or 97 UNPACK_SUBSAMPLE_RATE_SGIX: 98 99 PIXEL_SUBSAMPLE_4444_SGIX 0x85A2 100 PIXEL_SUBSAMPLE_2424_SGIX 0x85A3 101 PIXEL_SUBSAMPLE_4242_SGIX 0x85A4 102 103Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 104 105 None. 106 107Additions to Chapter 3 of the 1.1 Specification (Rasterization) 108 109 3.6.1 Pixel Storage Modes 110 111 The following is added to Table 3.1: 112 113 Parameter Name Type Initial Value Valid Range 114 -------------- ---- ------------- ----------- 115 UNPACK_SUBSAMPLE_RATE_SGIX integer PIXEL_SUBSAMPLE_4444_SGIX PIXEL_SUBSAMPLE_4444_SGIX 116 PIXEL_SUBSAMPLE_4242_SGIX 117 PIXEL_SUBSAMPLE_2424_SGIX 118 119 PACK_SUBSAMPLE_RATE_SGIX integer PIXEL_SUBSAMPLE_4444_SGIX PIXEL_SUBSAMPLE_4444_SGIX 120 PIXEL_SUBSAMPLE_4242_SGIX 121 PIXEL_SUBSAMPLE_2424_SGIX 122 123 124 3.6.3 Rasterization of Pixel Rectangles 125 126 <at the end of the paragraph before the Unpacking section> 127 128 If the PixelStore parameter UNPACK_SUBSAMPLE_RATE_SGIX is set to 129 PIXEL_SUBSAMPLE_4242_SGIX or PIXEL_SUBSAMPLE_2424_SGIX, then the 130 <format> needs to be set to a corresponding 3- or 4- component 131 pixel format or the error INVALID_OPERATION occurs. If a 132 4-component pixel format is used, the alpha is assumed to be 133 of constant value 1.0) 134 135 If the PixelStore parameter UNPACK_SUBSAMPLE_RATE_SGIX is set to 136 PIXEL_SUBSAMPLE_4242_SGIX or PIXEL_SUBSAMPLE_2424_SGIX, then the 137 <width> needs to be set to a multiple of 2 pixels or the error 138 INVALID_OPERATION occurs. 139 140 <following "to form groups." at the end of the first paragraph 141 in the Unpacking section> 142 143 If the PixelStore parameter UNPACK_SUBSAMPLE_RATE_SGIX is set to 144 something other than PIXEL_SUBSAMPLE_4444_SGIX then these elements 145 are grouped into sets of one, two, three or four values, 146 depending on the value of UNPACK_SUBSAMPLE_RATE_SGIX, to form 147 groups. 148 149 <at the and of the paragraph> 150 151 Table 3.5.1 summarizes the layout of groups obtained from 152 memory depending on the value of UNPACK_SUBSAMPLE_RATE_SGIX. 153 154 Table 3.5.1: 155 156 Value of Number of Number of Order of 157 UNPACK_SUBSAMPLE Components Values/Group components 158 _RATE_SGIX in a seq of 159 groups in memory 160 -------------------- ---------- ------- ---------- 161 PIXEL_SUBSAMPLE_4444_SGIX n n 162 PIXEL_SUBSAMPLE_4242_SGIX 3 CbYCr(rgb) 2 YCb,YCr,YCb,YCr 163 PIXEL_SUBSAMPLE_2424_SGIX 3 CbYCr(rgb) 2 CbY,CrY,CbY,CrY 164 165 note: Cb, Y, and Cr are used to illustrate the in-memory 166 packing of pixels in the YCrCb color space. Normally, 2,3, and 167 4 component groups are labeled LA, RGB, RGBA. 168 169 <A new section is inserted before "Conversion to RGB"> 170 171 Conversion to UNIFORM Sampling 172 ------------------------------ 173 174 This step is applied only if the PixelStore parameter 175 UNPACK_SUBSAMPLE_RATE_SGIX is set to something other than 176 PIXEL_SUBSAMPLE_4444_SGIX. If UNPACK_SUBSAMPLE_RATE_SGIX 177 is set to PIXEL_SUBSAMPLE_4242_SGIX or 178 PIXEL_SUBSAMPLE_2424_SGIX then the number 179 of components per pixel is increased from two to three. 180 After upsampling, the data is treated as though it were RGB. 181 182 2424: 183 184 < R0,G0> < B1,G1> < R2,G2> < B3, G3> 185 <Cb0,Y0> <Cr0,Y1> <Cb2,Y2> <Cr2, Y3> 186 | | | | | | | | 187 | | o-----o---+--o | | o-----o---+--o 188 | | | | | | | | | | 189 o--+--+-----o | | o---+--+-----o | | 190 | | | | | | | | | | | | 191 V V V V V V V V V V V V 192 <Cb0,Y0,Cr0> <Cb0,Y1,Cr0> <Cb2,Y2,Cr2> <Cb2,Y3,Cr2> 193 < R0,G0,B1 > < R0,G1,B1 > < R2,G2,B3 > < R2,G3,B3 > 194 195 196 4242: 197 < G0,R0> <G1,B1 > <G2,R2 > < G3,B3 > 198 <Y0,Cb0> <Y1,Cr0> <Y2,Cb2> <Y3,Cr2> 199 | | | | | | | | 200 \ / \_____ __\__/ \ \ / \_____ __\__/ \ 201 X ___X \ | X ___X \ | 202 / \ / \ \ | / \ / \ \ | 203 | | | | | | | | | | | | 204 V V V V V V V V V V V V 205 <Cb0,Y0,Cr0> <Cb0,Y1,Cr0> <Cb2,Y2,Cr2> <Cb2,Y3,Cr2> 206 < R0,G0,B1 > < R0,G1,B1 > < R2,G2,B3 > < R2,G3,B3 > 207 208Additions to Chapter 4 of the 1.1 Specification (Per-Fragment 209Operations and the Frame Buffer) 210 211 4.3.2 Reading Pixels 212 213 The following is added to Table 4.5: 214 215 Parameter Name Type Initial Value Valid Range 216 -------------- ---- ------------- ----------- 217 PACK_SUBSAMPLE_RATE_SGIX integer PIXEL_SUBSAMPLE_4444_SGIX PIXEL_SUBSAMPLE_4444_SGIX 218 PIXEL_SUBSAMPLE_4242_SGIX 219 PIXEL_SUBSAMPLE_2424_SGIX 220 221 <A new section is inserted before "Final Conversion"> 222 223 Conversion to Subsampled Form 224 ------------------------------ 225 226 This step is applied only if the PixelStore parameter 227 PACK_SUBSAMPLE_RATE_SGIX is set to something other than 228 PIXEL_SUBSAMPLE_4444_SGIX. If this step is carried out its 229 operation is controlled by the values of PACK_SUBSAMPE_RATE_SGIX. 230 231 If a filter operation is specified by RESAMPLE_SGIX, the 232 resampling filter is applied prior to the subsampling step. 233 234 The pack mode involves dropping chroma samples. For users who 235 like to perform arbitrary filtering other than those specifiable 236 using RESAMPLE_SGIX, it could also be done prior to packing with 237 user calls to convolution function. 238 239 If PACK_SUBSAMPLE_RATE_SGIX is set to PIXEL_SUBSAMPLE_4242_SGIX or 240 PIXEL_SUBSAMPLE_2424_SGIX then the resulting pixels has an average 241 of 2 component values per pixel. Each pixel pair are constructed 242 as follows: 243 The first destination pixel of a pair is made up of the 244 first and second component of the first source pixel. 245 The second destination pixel of a pair is made up of the 246 third component of the first source pixel, and the second 247 component of the second source pixel. 248 249 2424: 250 251 <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3> 252 | | | | | | | | | | | | | | | | 253 | | | * * | * * | | | * * | * * 254 | | | | | | | | 255 V V V V V V V V 256 <R0,G0><B0 G1> <R2,G2><B2, G3> 257 <--- pixel pair ----> <--- pixel pair ----> 258 259 4242: 260 261 <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3> 262 | | | * * | * * | | | * * | * * 263 \ / |____ ____| \ / |____ ____| 264 X ____X____ X ____X____ 265 / \ | | | | | | 266 V V V V V V V V 267 <G0,R0><G1 B0> <G2,R2><G3, B2> 268 <--- pixel pair ----> <--- pixel pair ----> 269 270 <toward the end of the paragraph "Placement in Client Memory"> 271 272 If the PixelStore parameter PACK_SUBSAMPLE_RATE_SGIX is set to 273 PIXEL_SUBSAMPLE_RATE_4242_SGIX or PIXEL_SUBSAMPLE_RATE_2424_SGIX 274 then only the corresponding two elements are written. That is, 275 only the first two components of each group are written to memory. 276 277Additions to Chapter 5 of the 1.1 Specification (Special Functions) 278 279 None. 280 281Additions to Chapter 6 of the 1.1 Specification (State and State Requests) 282 283 XXX 284 285Additions to the GLX Specification 286 287 288Errors 289 290 XXX 291 292 293New State 294 295 Get Value Get Command Type Initial Value Attribute 296 --------- ----------- ---- ------------- --------- 297 UNPACK_SUBSAMPLE_RATE_SGIX GetIntegerv Z4 PIXEL_SUBSAMPLE_4444_SGIX client 298 PACK_SUBSAMPLE_RATE_SGIX GetIntegerv Z4 PIXEL_SUBSAMPLE_4444_SGIX client 299 300New Implementation Dependent State 301 302 None. 303