1Name 2 3 OML_subsample 4 5Name Strings 6 7 GL_OML_subsample 8 9Contact 10 11 Jon Leech, Silicon Graphics (ljp 'at' sgi.com) 12 13Status 14 15 Complete. Approved by the Khronos SIG on July 19, 2001. 16 17Version 18 19 Last Modified Date: 07/23/2001 20 Author Revision: $Header: //depot/main/doc/registry/extensions/OML/subsample.spec#10 $ 21 22Number 23 24 240 25 26Dependencies 27 28 This extension is written against the OpenGL 1.2.1 Specification, 29 30Overview 31 32 Many video image formats and compression techniques utilize various 33 component subsamplings, so it is necessary to provide a mechanism to 34 specify the up- and down-sampling of components as pixel data is 35 drawn from and read back to the client. Though subsampled components 36 are normally associated with the video color space, YCrCb, use of 37 subsampling in OpenGL does not imply a specific color space. Color 38 space conversion may be performed using other extensions or core 39 capabilities such as the color matrix. 40 41 This extension defines two new pixel storage formats representing 42 subsampled data on the client. It is loosely based on the 43 SGIX_subsample extension, but specifies subsampling with the data 44 format parameter rather than pixel packing parameters. It also 45 adds support for CYA subsampled data. 46 47 When pixel data is received from the client and an unpacking 48 upsampling mode other than PIXEL_SUBSAMPLE_NONE_OML is specified, 49 upsampling is performed via replication, unless otherwise specified 50 by UNPACK_RESAMPLE_OML. 51 52 Similarly, when pixel data is read back to the client and a packing 53 downsampling mode other than PIXEL_SUBSAMPLE_NONE_OML is specified, 54 downsampling is performed via simple component decimation (point 55 sampling), unless otherwise specified by PACK_RESAMPLE_OML. 56 57Issues 58 59 * Which subsampled component orderings should be supported? 60 61 Only CY and CYA component ordering, since this matches contemporary 62 video hardware. YC and YCA ordering will require a separate 63 extension defining new formats. 64 65 * The new enumerant naming scheme gives the component frequencies in 66 the same order as the components themselves; that is, 67 FORMAT_SUBSAMPLE_24_24_OML corresponds to CY 4:2:2, and 68 FORMAT_SUBSAMPLE_244_244_OML corresponds to CYA 4:2:2:4. This makes 69 naming YC and YCA orderings easier. 70 71 * Should subsampling be specified with new pixel storage parameters, 72 like the SGIX_subsample extension, or with new formats, like the 73 EXT_422 extension? 74 75 With new formats. There are many invalid format/type combinations 76 when specifying subsampling with a pixel storage parameter. Also, 77 there's an ambiguity when doing this because the <format> parameter 78 represents the after-upsampling data format, not the host format. 79 80 * Because subsampled data is inherently pixel / texture oriented, this 81 extension only supports the new formats for pixel and texture 82 operations; it does not support them for convolution filters, 83 histograms, minmax, or color tables. 84 85 * The only packed pixel type supported is 10_10_10_2, since this is 86 needed for video data interoperability. It would be possible to 87 support many other packed pixel formats, but most are unused in 88 practice. 89 90 Is support for other packed pixels types, particularly 91 2_10_10_10_REV, required? 92 93 * Should readbacks of non-even widths be allowed when downsampling? 94 95 No. This is not consistent with draw operations, where this 96 constraint already exists. It also makes OML_resample more complex 97 when using an AVERAGE filter, since the edge cases may also apply to 98 even pixel coordinates. The spec may need to be more explicit about 99 this restriction. 100 101IP Status 102 103 No known issues. 104 105New Procedures and Functions 106 107 None. 108 109New Tokens 110 111 Accepted by the <format> parameter of DrawPixels, ReadPixels, 112 TexImage1D, TexImage2D, TexImage3D, TexSubImage1D, TexSubImage2D, 113 TexSubImage3D, and GetTexImage 114 115 FORMAT_SUBSAMPLE_24_24_OML 0x8982 116 FORMAT_SUBSAMPLE_244_244_OML 0x8983 117 118Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation) 119 120 None. 121 122Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization) 123 124 - (3.6.4, p. 88 "Rasterization of Pixel Rectangles") 125 126 Add prior to the "Unpacking" subsection on page 90: 127 128 If <format> is FORMAT_SUBSAMPLE_24_24_OML or 129 FORMAT_SUBSAMPLE_244_244_OML, and <type> is one of the packed pixel 130 formats in table 3.8 other than UNSIGNED_INT_10_10_10_2, then the 131 error INVALID_OPERATION occurs; if <width> is not a multiple of 2 132 pixels, or if the value of the UNPACK_SKIP_PIXELS or 133 UNPACK_ROW_LENGTH parameters is not a multiple of 2 pixels, then the 134 error INVALID_OPERATION occurs. 135 136 - Add new entries to table 3.6: 137 138 Format Name Element Meaning and Order Target Buffer 139 ----------- ------------------------- ------------- 140 FORMAT_SUBSAMPLE_24_24_OML CbY / CrY Color 141 FORMAT_SUBSAMPLE_244_244_OML CbYA / CrYA Color 142 143 - Append to the caption of table 3.6: 144 145 Subsampled formats yield components that are further modified during 146 conversion to uniform sampling. The subsampled components are 147 denoted as Cb, Y, Cr, and A, although subsampled data is not defined 148 to be in any specific color space. 149 150 - Modify table 3.8: 151 152 <type> Parameter GL Data Number of Matching 153 Token Name Type Components Pixel Formats 154 ----------------------- ------- ---------- ------------- 155 UNSIGNED_INT_10_10_10_2 uint 2, 3, 4 RGBA, BGRA, 156 FORMAT_SUBSAMPLE_24_24_OML, 157 FORMAT_SUBSAMPLE_244_244_OML 158 159 - Append to the caption of table 3.8: 160 161 Subsampled formats may pack components from multiple groups into a 162 single uint. 163 164 - Modify table 3.11's UNSIGNED_INT_10_10_10_2 entry: 165 166 UNSIGNED_INT_10_10_10_2, <format>s RGBA and BGRA: 167 168 (use existing 4-component diagram) 169 170 UNSIGNED_INT_10_10_10_2, <format> SUBSAMPLE_24_24_OML: 171 172 31 22 21 12 11 2 1 0 173 | pixel 0/comp. 0 | pixel 0/comp. 1 | pixel 1/comp. 0 | xx | 174 | pixel 1/comp. 1 | pixel 2/comp. 0 | pixel 2/comp. 1 | xx | 175 176 UNSIGNED_INT_10_10_10_2, <format> SUBSAMPLE_244_244_OML: 177 178 31 22 21 12 11 2 1 0 179 | 1st comp. | 2nd comp. | 3rd comp. | xx | 180 181 - Change caption of table 3.11: 182 183 Table 3.11: UNSIGNED_INT formats. Subsampled formats are packed into 184 words, so components from a group may lie in different words. ``xx'' 185 fields are unused. 186 187 - Add new subsection before "Conversion to RGB" on page 99: 188 189 Conversion to Uniform Sampling 190 191 This step is applied only to subsampled data. If <format> is 192 FORMAT_SUBSAMPLE_24_24_OML, then the number of components per pixel 193 is increased from two to three. If <format> is 194 FORMAT_SUBSAMPLE_244_244_OML. then the number of components per 195 pixel is increased from three to four. 196 197 After conversion to uniform sampling (see figure 3.9). pixels are 198 thereafter treated as though they were RGB (three component) or RGBA 199 (four component) format. 200 201 In the remainder of this section, the j'th component of the i'th 202 pixel in a row is denoted by S_i,j (for source pixels in client 203 memory) and D_i,j (for destination pixels in the color buffer). 204 205 Destination component values are defined as: 206 207 For even pixels ((i mod 2) == 0): 208 209 D_i,0 = S_i,0 210 D_i,1 = S_i,1 211 D_i,2 = S_i+1,0 212 D_i,3 = S_i,2 213 214 For odd pixels ((i mod 2) == 1): 215 216 D_i,0 = S_i-1,0 217 D_i,1 = S_i,1 218 D_i,2 = S_i,0 219 D_i,3 = S_i,2 220 221 - Add new figure 3.9 (renumber following figures): 222 223 FORMAT_SUBSAMPLE_24_24_OML: 224 <Cb0,Y0> <Cr0,Y1> <Cb2,Y2> <Cr2, Y3> 225 | | | | | | | | 226 | | ____/ \__|__ | | ____/ \__|__ 227 | | / | \ | | / | \ 228 |\_|__|_____ | | |\__|__|_____ | | 229 | | | \ | | | | | \ | | 230 V V V V V V V V V V V V 231 <Cb0,Y0,Cr0> <Cb0,Y1,Cr0> <Cb2,Y2,Cr2> <Cb2,Y3,Cr2> 232 < R0,G0,B1 > < R0,G1,B1 > < R2,G2,B3 > < R2,G3,B3 > 233 234 FORMAT_SUBSAMPLE_244_244_OML: 235 <Cb0,Y0,A0> <Cr0,Y1,A1> <Cb2,Y2,A2> <Cr2,Y3,A3> 236 | | \ | | \ | | \ | | \ 237 | | _\_____/ \__|__ \ | | _\_____/ \__|__ \ 238 | | / \ | \ \ | | / \ | \ \ 239 |\_|__|___\____ | | \ |\__|__|___\____ | | \ 240 | | | | \ | | | | | | | \ | | | 241 V V V V V V V V V V V V V V V V 242 <Cb0,Y0,Cr0,A0> <Cb0,Y1,Cr0,A1> <Cb2,Y2,Cr2,A2> <Cb2,Y3,Cr2,A3> 243 < R0,G0,B1,A0 > < R0,G1,B1,A1 > < R2,G2,B3,A2 > < R2,G3,B3,A3 > 244 245 Figure 3.9: Upsampling with component replication of subsampled data 246 from client memory to form RGB or RGBA pixels. 247 248 249Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment 250Operations and the Frame Buffer) 251 252 4.3.2 Reading Pixels 253 254 - Add new subsection before "Final Conversion" on page 160: 255 256 Conversion to Subsampled Form 257 258 This step is applied only if <format> is FORMAT_SUBSAMPLE_24_24_OML 259 or FORMAT_SUBSAMPLE_244_244_OML. 260 261 In the remainder of this section, the j'th component of the i'th 262 pixel in a row is denoted by S_i,j (for source pixels in the color 263 buffer) and D_i,j (for destination pixels in client memory). 264 265 If <format> is FORMAT_SUBSAMPLE_24_24_OML, then the resulting pixels 266 have 2 components; if <format> is FORMAT_SUBSAMPLE_244_244_OML, then 267 the resulting pixels have 3 components (see figure 4.3). Destination 268 component values are defined as: 269 270 For even pixels ((i mod 2) == 0): 271 272 D_i,0 = S_i,0 273 D_i,1 = S_i,1 274 D_i,2 = S_i,3 (only for FORMAT_SUBSAMPLE_244_244_OML) 275 276 For odd pixels ((i mod 2) == 1): 277 278 D_i,0 = S_i-1,2 279 D_i,1 = S_i,1 280 D_i,2 = S_i,3 (only for FORMAT_SUBSAMPLE_244_244_OML) 281 282 - Add new figure 4.3 (renumber following figures): 283 284 FORMAT_SUBSAMPLE_24_24_OML: 285 <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3> 286 | | | | | | | | | | | | | | | | 287 | | \ * * | * * | | \ * * | * * 288 | | | | | | | | 289 V V V V V V V V 290 <Cb0,Y0><Cr0, Y1> <Cb2,Y2><Cr2, Y3> 291 <--- pixel pair ----> <--- pixel pair ----> 292 293 FORMAT_SUBSAMPLE_244_244_OML: 294 <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3> 295 | | | | | | | | | | | | | | | | 296 | | \__|__ * | * | | | \__|__ * | * | 297 | | | \ | | | | | \ | | 298 | | / | | / | | / | | / 299 V V V V V V V V V V V V 300 <Cb0,Y0,A0> <Cr0,Y1,A1> <Cb2,Y2,A2> <Cr2,Y3,A3> 301 <--- pixel pair ----> <--- pixel pair ----> 302 303 Figure 4.3: Downsampling of RGB or RGBA pixels to form subsampled 304 data in host memory. 305 306 307 - Add prior to the last sentence of subsection "Placement in Client 308 Memory" on page 162: 309 310 If <format> is FORMAT_SUBSAMPLE_24_24_OML, then only the 311 corresponding two elements (first two components of each group) are 312 written. If <format> is FORMAT_SUBSAMPLE_244_244_OML, then only the 313 corresponding three elements (first three components of each group) 314 are written. 315 316Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions) 317 318 None. 319 320Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State Requests) 321 322 None. 323 324Additions to the GLX 1.3 Specification 325 326 TBD. Discussion of image formats in the GLX Protocol Specification 327 may need to be expanded. 328 329Errors 330 331 See above. 332 333New State 334 335 None. 336 337New Implementation Dependent State 338 339 None. 340 341Revision History 342 343 * Revision 10, 07/24/2001 - Finalized Status for OpenML 1.0. 344 * Revision 9, 07/16/2001 - Fix label in 24_24 packed pixel diagram. 345 * Revisions 7-8, 07/11/2001 - Assign enum values and extension number 346 for the registry. 347 * Revision 6 - Correct errors in the equations describing subsampling. 348 * Revision 5 - formatting changes for OpenML Specification 349 * Revision 4 - Rewrite to use the <format> parameter, rather than a 350 pixel storage mode, to specify subsampled data. Specify which 351 format/type combinations are allowed for subsampled data, and define 352 the representation of 10-bit component subsampled packed pixel data. 353 * Revision 3 - Removed support for YC component orders. Renamed CY and 354 CYA enumerants more sensibly. Changed text descriptions of sampling 355 to equations. Made enum values undefined until we've determined if 356 this extension is backwards compatible with SGIX_subsample. 357 * Revision 2 - corrected 4224 upsampling and downsampling figures. 358 Moved discussion of errors for non-even image widths from the 359 OML_resample specification. 360 * Revision 1 - derived from SGIX_subsample. 361