1XXX - Not complete. 2 3Name 4 5 SGIX_mpeg1 6 7Name Strings 8 9 GL_SGIX_mpeg1 10 11Version 12 13 $Date: 1997/06/07 01:23:57 $ $Revision: 1.10 $ 14 15Number 16 17 ??? 18 19Dependencies 20 21 SGIX_image_compression is required. 22 23Overview 24 25 This extension provides support for MPEG1-compressed images. 26 MPEG1 compression is considered a pixel storage mode. Predictor 27 frames are supported and are managed as objects in a manner 28 similar to texture objects. 29 30 MPEG images may be uncompressed when transferred from client 31 memory during the unpacking phase of pixel operations. Images may 32 be compressed when transferred to client memory during the packing 33 phase of pixel operations. 34 35 MPEG predictor frames are stored as two-dimensional RGB images of 36 unspecified type. The predictors are referred to by numerical 37 names. The allocation and deallocation of memory to store the 38 predictor images takes place through the GL routines 39 AllocMPEGPredictorsSGIX and DeleteMPEGPredictorsSGIX which are 40 defined by this extension. 41 42 Support of this extension does not imply conformance to the MPEG1 43 standard (ISO 11172), although the following guarantees are made: 44 45 - During decode, the picture_coding_type piece of the picture 46 coding header is extracted and interpreted correctly. The 47 treatment of the resulting value is discussed below. 48 49Issues 50 51 * Some systems may not support predictors. Should we split the 52 extension into two: one for intraframe only and a second 53 which allows predictors? 54 55 A: Predictors are pretty fundamental to MPEG, so we will 56 leave them in the spec. Implementations that do not 57 support them can do a partial implementation and not 58 advertise the extension. 59 60 * Should we introduce the concept of "residency" for predictors 61 as we did for texture objects? 62 63 A: No. Caching of predictors would be far less useful than 64 caching textures. If we find an application which could 65 use this capability, we'll add another extension. 66 67 * When drawing from a predictor object, we always take the 68 entire image. Should we allow a way to take a subregion of 69 the predictor? A similar question arises for drawing to a 70 predictor object. 71 72 A: Supporting this functionality could be difficult to 73 impossible for systems using specialized compression and 74 decompression hardware. Therefore, we will leave it for 75 another extension. 76 77 * Currently, we require that the user allocate a predictor 78 before using any predictors. That is, there is no default 79 predictor created at context init. Is this the correct 80 behavior? In the texture object extension, there is a 81 default texture which is used. 82 83 A: Since predictors are used as sources, destinations, and 84 forward and backward predictors, choosing the correct 85 number of default predictors and bindings for them which 86 would be at all useful would be difficult if not 87 impossible. Textures are a simpler case since they are 88 basically only used for one thing. Additionally, having 89 default predictors would require implementations to 90 reserve space for the predictors at context init (which 91 would waste space since the vast majority of applications 92 will not use MPEG compression) or to allocate the space 93 during a pixel command (which could cause the pixel 94 command to generate an out-of-memory error). Therefore, 95 we will stick with the current approach. 96 97 * Should we add "error recovery" bind points? These predictors 98 could be used by the implementation to replace regions of a 99 decoded image which were determined to be bogus because of 100 image data errors. Frank Bernard says this is a fairly 101 common technique. 102 103 A: We'll leave this for another extension. 104 105 * Do we need a proxy mechanism to determine the amount of 106 predictor space available? 107 108 * Do we need a more straightforward way to copy predictors from 109 the frame buffer? Something like CopyMPEGPredictorSGIX? 110 111 * We guarantee that the picture_structure and picture_type 112 fields are interpreted and set correctly. We do this so that 113 we can make guarantees about which predictors will be used 114 and updated. Should we make this less restrictive? 115 116 * Drawing from predictors is still a little awkward. We 117 require the user to draw a zero-size MPEG-compressed image. 118 The user needs to have a legal picture header. Should we add 119 some more direct way to accomplish this step? 120 121Reasoning 122 123 * We have used a scheme for predictor management which is 124 slightly different from the scheme for texture objects. 125 Specifically, we have an allocation routine 126 (AllocMPEGPredictorsSGIX), but textures are allocated on 127 download. The reason for this is that it removes the need to 128 allocate memory during commands like DrawPixels and 129 ReadPixels. Failure of either of these commands due to an 130 out-of-memory error would be highly counterintuitive. 131 132 * To simplify state management and queries, we perform 133 upsampling prior to motion compensation and predictor 134 storage. 135 136 * We manage quantization tables using a syntax similar to that 137 of pixel maps instead of managing them as pixel data since 138 they update the pack and unpack state. Using and 139 simultaneously updating the state would be awkward. Also, 140 the values are always one unscaled component, meaning that 141 the added flexibility of a user-specified type and format 142 would be virtually useless. 143 144New Procedures and Functions 145 146 void GenMPEGPredictorsSGIX(sizei n, 147 uint *predictors); 148 149 void AllocMPEGPredictorsSGIX(sizei width, 150 sizei height, 151 sizei n, 152 uint *predictors); 153 154 void DeleteMPEGPredictorsSGIX(sizei n, 155 uint *predictors); 156 157 boolean IsMPEGPredictorSGIX(uint predictor); 158 159 void MPEGPredictorSGIX(enum target, 160 enum format, 161 enum type, 162 void *pixels); 163 164 void GetMPEGPredictorSGIX(enum target, 165 enum format, 166 enum type, 167 void *pixels); 168 169 void SwapMPEGPredictorsSGIX(enum target0, 170 enum target1); 171 172 void GetMPEGParameterfvSGIX(enum target, 173 enum pname, 174 float *params); 175 176 void GetMPEGParameterivSGIX(enum target, 177 enum pname, 178 int *params); 179 180 void MPEGQuantTableubv(enum target, 181 ubyte *values); 182 183 void GetMPEGQuantTableubv(enum target, 184 ubyte *values); 185 186New Tokens 187 188 Accepted by the <target> parameter of GetMPEGParameterfvSGIX and 189 GetMPEGParameterivSGIX; by the <target0> and <target1> parameters 190 of SwapMPEGPredictorsSGIX; by the <param> parameter of PixelStoref 191 and PixelStorei; and by the <pname> parameter of GetBooleanv, 192 GetIntegerv, GetFloatv, and GetDoublev: 193 194 PACK_MPEG_PREDICTOR_FWD_SGIX ???? 195 PACK_MPEG_PREDICTOR_BACK_SGIX ???? 196 197 UNPACK_MPEG_PREDICTOR_FWD_SGIX ???? 198 UNPACK_MPEG_PREDICTOR_BACK_SGIX ???? 199 200 Accepted by the <pname> parameter of PixelStoref, PixelStorei, 201 GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: 202 203 PACK_MPEG_PREDICTOR_STORE_SGIX ???? 204 PACK_MPEG_PREDICTOR_STORE_SINK_SGIX ???? 205 PACK_MPEG_PREDICTOR_READ_SGIX ???? 206 UNPACK_MPEG_PREDICTOR_STORE_SGIX ???? 207 UNPACK_MPEG_PREDICTOR_STORE_SINK_SGIX ???? 208 UNPACK_MPEG_PREDICTOR_READ_SGIX ???? 209 210 PACK_MPEG_PICTURE_TYPE_SGIX ???? 211 PACK_MPEG_ADAPT_QUANT_SCALE ???? 212 213 Accepted by the <param> parameter of PixelStoref and PixelStorei: 214 215 MPEG1_SGIX ???? 216 MPEG_IFRAME_SGIX ???? 217 MPEG_PFRAME_SGIX ???? 218 MPEG_BFRAME_SGIX ???? 219 220 Accepted by the <pname> parameter of GetMPEGParameterfvSGIX and 221 GetMPEGParameterivSGIX: 222 223 MPEG_PREDICTOR_WIDTH_SGIX ???? 224 MPEG_PREDICTOR_HEIGHT_SGIX ???? 225 226 Accepted by the <target> parameter of MPEGQuantTableubv and 227 GetMPEGQuantTableubv: 228 229 PACK_MPEG_INTRA_QUANT ???? 230 PACK_MPEG_NON_INTRA_QUANT ???? 231 UNPACK_MPEG_INTRA_QUANT ???? 232 UNPACK_MPEG_NON_INTRA_QUANT ???? 233 234Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 235 236 None. 237 238Additions to Chapter 3 of the 1.1 Specification (Rasterization) 239 240 The pixel storage modes are augmented to support MPEG compressed 241 images in memory. The following entries are added to Table 3.1: 242 243 Parameter Name Type Initial Value Valid Range 244 -------------- ---- ------------- ----------- 245 UNPACK_MPEG_PREDICTOR_FWD_SGIX integer 0 [0, infinity] 246 UNPACK_MPEG_PREDICTOR_BACK_SGIX integer 0 [0, infinity] 247 UNPACK_MPEG_PREDICTOR_STORE_SGIX Z3 NONE NONE, UNPACK_MPEG_PREDICTOR_FWD_SGIX, UNPACK_MPEG_PREDICTOR_BACK_SGIX 248 UNPACK_MPEG_PREDICTOR_STORE_SINK_SGIX boolean FALSE 249 UNPACK_MPEG_PREDICTOR_READ_SGIX Z3 NONE NONE, UNPACK_MPEG_PREDICTOR_FWD_SGIX, UNPACK_MPEG_PREDICTOR_BACK_SGIX 250 251 Additionally, the value MPEG1_SGIX is added to the valid range of 252 PACK_COMPRESSION_TYPE_SGIX and UNPACK_COMPRESSION_TYPE_SGIX. 253 254 The following should be added to the end of section 3.6.1 (Pixel 255 Storage Modes): 256 257 In addition to PixelStoref and PixelStorei, several commands 258 control the unpacking of MPEG-compressed images. The command: 259 260 MPEGQuantTableubv(enum target, ubyte *values); 261 262 allows the specification of custom quantization tables for MPEG 263 decode. The following are legal values for the <target> 264 parameter: PACK_MPEG_INTRA_QUANT, PACK_MPEG_NON_INTRA_QUANT, 265 UNPACK_MPEG_INTRA_QUANT, and UNPACK_MPEG_NON_INTRA_QUANT. If the 266 value of <target> is not legal, the error INVALID_ENUM is 267 generated. <values> points to a 64-element array of values 268 representing the quantizer grid which will update the state 269 specified by <target>. The organization of the elements in the 270 grid is not specified by this extension. 271 272 Several other commands are used to manage predictor objects for 273 MPEG compressed images. Predictor objects represent 274 two-dimensional images allocated by GL. The images are stored in 275 a YUV format. Each component is stored as a number of unspecified 276 precision. Predictor objects are referred to by unsigned integer 277 names. A predictor name is considered "in use" when an image 278 (including a zero-size image) is associated with it. The name 279 zero is reserved for the GL and is permanently associated with a 280 zero-size image. 281 282 Predictor frame names are allocated using the command: 283 284 void GenMPEGPredictorsSGIX( sizei n, uint *predictors ); 285 286 The parameter <predictors> points to an array of <n> unsigned 287 integers. GenMPEGPredictorsSGIX places <n> predictor names in 288 <predictors>. Names are chosen in an unspecified manner, the only 289 conditions being that only names that were not in use immediately 290 prior to the call to GenMPEGPredictorsSGIX will be returned, zero 291 will not be returned, and each name returned will be unique. An 292 image with width and height equal to zero is associated with each 293 name returned. 294 295 Images associated with MPEG predictor names are allocated using 296 the command: 297 298 AllocMPEGPredictorsSGIX( sizei width, sizei height, 299 sizei n, uint *predictors ); 300 301 This function associates an image of size <width> by <height> with 302 each of the <n> predictors whose names are in <predictors>. The 303 parameters <width> and <height> specify the size of images to be 304 associated with the predictor objects. If a name was previously 305 in use, the image previously associated with it is deleted, just 306 as though DeleteMPEGPredictorsSGIX (see below) had been called. 307 The name zero may not be included in the list of predictor objects 308 or the error INVALID_OPERATION results. After allocation, the 309 contents of the allocated images are undefined. 310 311 Predictor frames are deleted by calling: 312 313 DeleteMPEGPredictorsSGIX( sizei n, uint *predictors ); 314 315 with <predictors> pointing to a list of <n> predictor names of 316 objects to be deleted. When an object is deleted, the memory 317 associated with its image is freed. After the object is deleted, 318 it has no image size or contents and its name is considered no 319 longer in use. If a predictor object which is currently bound is 320 deleted, the binding reverts to zero. DeleteMPEGPredictorsSGIX 321 ignores names which do not correspond to predictor objects. The 322 name zero is also silently ignored. 323 324 Predictors are associated with bind points which define their 325 usage during pixel download and readback operations. The valid 326 bind points are: PACK_MPEG_PREDICTOR_FWD_SGIX, 327 PACK_MPEG_PREDICTOR_BACK_SGIX, PACK_MPEG_PREDICTOR_BACK_SGIX, and 328 UNPACK_MPEG_PREDICTOR_BACK_SGIX. The use of each bind point is 329 described in detail in either section 3.6.3 (Rasterization of 330 Pixel Rectangles) or in the section of Chapter 4 entitled "Packing 331 of Compressed Images." To bind a predictor to a bind point, the 332 commands PixelStorei and PixelStoref are used. The parameter 333 <pname> gives the name of a bind point and the parameter <param> 334 gives the numerical name of a predictor object. If <param> is not 335 a predictor object, the error INVALID_VALUE is generated. 336 337 The command 338 339 MPEGPredictorSGIX(enum target, enum format, enum type, 340 void *pixels); 341 342 is used to download images from client memory to the predictor 343 bound to the bind point <target>. If <target> is not the name of 344 a predictor bind point, the error INVALID_ENUM is generated. 345 <format> must be one of RED, GREEN, BLUE, ALPHA, RGB, RGBA, 346 ABGR_EXT, LUMINANCE, or LUMINANCE_ALPHA. <type> must be 347 UNSIGNED_BYTE, BYTE, UNSIGNED_SHORT, SHORT, UNSIGNED_INT, INT, or 348 FLOAT. <pixels> points to a two-dimensional image stored as 349 specified by <format> and <type>. The width and height of the 350 image are assumed to be the same as the width and height of the 351 predictor bound to <target>. The image is extracted from memory 352 and processed just as if DrawPixels were called, stopping after 353 the Final Expansion to RGBA step. 354 355 The command 356 357 SwapMPEGPredictorsSGIX(enum target0, enum target1); 358 359 is used to swap the predictor objects associated with two 360 predictor bind points. The predictor bound to <target0> is bound 361 to <target1> and the predictor bound to <target1> is bound to 362 <target0>. The error INVALID_ENUM is generated if <target0> or 363 <target1> is not the name of a predictor bind point. 364 365 3.6.3 Rasterization of Pixel Rectangles 366 367 The following should be added to the "Unpacking of Compressed 368 Images" subsection of section 3.6.3 (Rasterization of Pixel 369 Rectangles) following the paragraph which begins "Once the byte 370 stream has been taken from host memory...": If 371 UNPACK_COMPRESSION_TYPE_SGIX is equal to MPEG1_SGIX, the byte 372 stream is assumed to represent an MPEG1 picture header followed by 373 picture data. MPEG1 images are classified as one of three frame 374 types: I-frame, P-frame, or B-frame. The frame type is determined 375 by the value of the picture_type field in the picture header. 376 This extraction and interpretation takes place as described in the 377 MPEG specification (ISO 11172). The initial steps of MPEG 378 decompression are the same for all frames, but later steps are 379 dependent upon the frame type. 380 381 The size of the image represented by the byte stream is determined 382 by the width and height values as computed in the 383 SGIX_image_compression extension. Only image sizes for which the 384 width and height are multiples of 16 are valid. Specification of 385 an invalid size for the decompressed image will result in the 386 error INVALID_OPERATION. 387 388 Entropy decoding, inverse quantization, and inverse discrete 389 cosine transform operations are applied to the image. This 390 extension does not specify the algorithm used, nor does it imply 391 conformance to the MPEG2 specification. 392 393 The IDCT step produces three output images: Y, Cr, and Cb. The 394 images are upsampled as determined by the setting of 395 UNPACK_UPSAMPLE_SGIX. The upsampling is performed as described in 396 SGIX_image_compression. The output of the upsampling step is a 397 single width by height YCrCB image. The contents of the image and 398 how it is handled after the upsampling step is determined by the 399 type of MPEG frame. 400 401 The frame conversion step is described below for each of the 402 types. For all frame types, the output of the conversion step is 403 a single YCrCb image of the same width and height as the output of 404 the upsampling step. 405 406 If the image is an I-frame, no predictors are used to compute the 407 output image, but the quantizer table UNPACK_MPEG_INTRA_QUANT may 408 be used. The quantizer table contents may also be changed during 409 the decompression if the byte stream contains an embedded 410 quantization table. Any changes made are reflected in the GL state 411 and persist until the quantizer table is respecified through a 412 call to MPEGQuantTableubv or during decompression of another 413 I-frame. The exact algorithm used to compute the output image is 414 not specified in this extension. 415 416 If the image is a P-frame, the image represents a predicted picture. 417 The output of the frame conversion step is determined by the 418 contents of the image and by the contents of the predictor object 419 bound to the UNPACK_MPEG_PREDICTOR_BACK_SGIX bind point. This 420 predictor must be the same size as the current image or the error 421 INVALID_OPERATION is generated and processing of the image 422 terminates. The quantizer table UNPACK_MPEG_NON_INTRA_QUANT may 423 be used and possibly changed during the decompression. 424 425 If the image is a B-frame, the image represents a bidirectionally 426 predicted picture. The output of the frame conversion step is 427 determined by the contents of the image and by the contents of the 428 predictor objects bound to the UNPACK_MPEG_PREDICTOR_BACK_SGIX and 429 UNPACK_MPEG_PREDICTOR_FWD_SGIX bind points. The predictor objects 430 must be the same size as the current image or the error 431 INVALID_OPERATION is generated and processing of the image 432 terminates. The quantizer table UNPACK_MPEG_NON_INTRA_QUANT may 433 be used and possibly changed during the decompression. The 434 algorithm used to compute the output image is not specified in 435 this extension. 436 437 After the frame conversion step, the YCrCb image may be used to 438 update the predictor bound to UNPACK_MPEG_PREDICTOR_FORWARD_SGIX 439 or UNPACK_MPEG_PREDICTOR_BACK_SGIX in the predictor update step 440 described here. The predictor to be updated is specified using 441 the parameter UNPACK_MPEG_PREDICTOR_STORE_SGIX. If this value is 442 NONE, the predictor update step is skipped. Otherwise, the YCrCb 443 image from the frame conversion step overwrites the current 444 contents of the predictor bound to the target which was 445 specified with UNPACK_MPEG_PREDICTOR_STORE_SGIX. The affected 446 predictor's size must be the same as that of the current image or 447 the error INVALID_OPERATION is generated. Also, a predictor may 448 not be updated if it is being used in a previous step of the 449 decompression process or the error INVALID_OPERATION is generated. 450 This means that the UNPACK_MPEG_PREDICTOR_STORE_SGIX may not be 451 set to UNPACK_MPEG_PREDICTOR_BACK_SGIX during the download of a P- 452 or B-frame and that UNPACK_MPEG_PREDICTOR_STORE_SGIX may not be 453 set to UNPACK_MPEG_PREDICTOR_FORWARD_SGIX during the download of a 454 B-frame. If an error is generated during the predictor update 455 step, processing terminates and the contents of the predictor are 456 left unchanged. 457 458 If UNPACK_MPEG_PREDICTOR_STORE_SINK_SGIX is TRUE, the operation 459 terminates after the update step (even if no update was 460 performed). 461 462 After the predictor update step, the YCrCb image from the frame 463 conversion step may be replaced by the predictor bound to 464 UNPACK_MPEG_PREDICTOR_BACK_SGIX or UNPACK_MPEG_PREDICTOR_FWD_SGIX 465 as specified by UNPACK_MPEG_PREDICTOR_READ_SGIX. If We refer to 466 this step as the source replacement step. If 467 UNPACK_MPEG_PREDICTOR_READ_SGIX is equal to NONE, the image from 468 the conversion step is unchanged. If 469 UNPACK_MPEG_PREDICTOR_READ_SGIX is 470 UNPACK_MPEG_PREDICTOR_BACK_SGIX, the image is replaced by the 471 predictor image bound to UNPACK_MPEG_PREDICTOR_BACK_SGIX. If 472 UNPACK_MPEG_PREDICTOR_READ_SGIX is 473 UNPACK_MPEG_PREDICTOR_FORWARD_SGIX, the image is replaced by the 474 predictor image bound to UNPACK_MPEG_PREDICTOR_FORWARD_SGIX. When 475 replacement occurs, the image passed to the next stage in the 476 unpacking process has the same size and contents as the specified 477 predictor. Therefore, a predictor may be downloaded from a bind 478 point by setting UNPACK_MPEG_PREDICTOR_READ_SGIX appropriately and 479 drawing a zero-size MPEG image. 480 481 Predictors may not be used for replacement if they were written 482 during a previous step of the same operation. That is to say, 483 UNPACK_MPEG_PREDICTOR_READ_SGIX may not be set to the same value 484 as UNPACK_MPEG_PREDICTOR_STORE_SGIX unless that value is NONE. 485 Also, UNPACK_MPEG_PREDICTOR_READ_SGIX and 486 UNPACK_MPEG_PREDICTOR_STORE_SGIX may not specify bind points to 487 which the same predictor is bound, even if the bind points are 488 different. If either error condition occurs, the error 489 INVALID_OPERATION is generated and the operation terminates. The 490 termination of the operation occurs prior to the predictor update 491 step, so if the error occurs the contents of the predictors are 492 left unchanged. 493 494 After the replacement step, the YCrCb image is converted to RGB. 495 If UNPACK_TO_RGB_SGIX is enabled, an RGB image is produced using 496 an unspecified algorithm. If UNPACK_TO_RGB_SGIX is disabled, the 497 RGB image is producted by setting R to Y, G to Cr, and B to Cb. 498 The output image is treated as an RGB floating-point image. 499 500Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations 501and the Frame Buffer) 502 503 The following entries are added to Table 4.5: 504 505 Parameter Name Type Initial Value Valid Range 506 -------------- ---- ------------- ----------- 507 PACK_MPEG_PREDICTOR_FWD_SGIX integer 0 [0, infinity] 508 PACK_MPEG_PREDICTOR_BACK_SGIX integer 0 [0, infinity] 509 PACK_MPEG_PREDICTOR_STORE_SGIX Z3 NONE NONE, PACK_MPEG_PREDICTOR_FWD_SGIX, PACK_MPEG_PREDICTOR_BACK_SGIX 510 PACK_MPEG_PREDICTOR_STORE_SINK_SGIX boolean FALSE TRUE/FALSE 511 PACK_MPEG_PREDICTOR_READ_SGIX Z3 NONE NONE, PACK_MPEG_PREDICTOR_FWD_SGIX, PACK_MPEG_PREDICTOR_BACK_SGIX 512 PACK_MPEG_PICTURE_TYPE_SGIX Z3 NONE MPEG_IFRAME_SGIX, MPEG_PFRAME_SGIX, MPEG_BFRAME_SGIX 513 PACK_MPEG_ADAPT_QUANT_SCALE b FALSE TRUE/FALSE 514 515 The following is added to the "Packing of Compressed Images" 516 subsection following the paragraph beginning "If image compression 517 is on...": For MPEG1-compressed images (PACK_COMPRESSION_TYPE_SGIX 518 equal to MPEG1_SGIX), only image sizes for which width and height 519 are multiples of 16 are permitted. Other image sizes result in 520 the generation of the error INVALID_OPERATION. The type of frame 521 to be created is determined by the setting of 522 PACK_MPEG_PICTURE_TYPE_SGIX. During MPEG1 compression, if this 523 value is not equal to MPEG_IFRAME_SGIX, MPEG_PFRAME_SGIX, or 524 MPEG_BFRAME_SGIX, the error INVALID_ENUM is generated and no 525 processing takes place. 526 527 If PACK_TO_RGB_SGIX is TRUE, the RGBA input image is converted 528 to a YCrCb image using an unspecified algorithm. If 529 PACK_TO_RGB_SGIX is FALSE, the input image is converted to YCrCb 530 by setting the Y equal to R, Cr equal to G, and Cb equal to B. 531 532 The MPEG predictor bound to the bind point specified by 533 PACK_MPEG_PREDICTOR_STORE_SGIX is overwritten by the current image 534 if the value of PACK_MPEG_PREDICTOR_STORE_SGIX is not equal to 535 NONE. The update of PACK_MPEG_PREDICTOR_SGIX takes place in the 536 same manner as the update of UNPACK_MPEG_PREDICTOR_SGIX described 537 in section 3.6.3 (including the generation of errors and possible 538 termination of processing), except that the appropriate PACK 539 values are used in place of the UNPACK values. 540 541 As with decompression, the value PACK_MPEG_PREDICTOR_READ_SGIX may 542 be used to specify a bind point whose contents will replace the 543 current image in all subsequent processing. This update is 544 identical to that described in section 3.6.3 (including the 545 generation of errors and possible termination of processing), 546 except that the appropriate PACK values are used in place of the 547 UNPACK values. 548 549 The YCrCb image as downsampled is specified by PACK_SAMPLE_SGIX. 550 The operation is described in SGIX_image_compression. 551 552 The output of the downsampling step is converted based upon the 553 frame type specified by PACK_MPEG_PICTURE_TYPE_SGIX. In this 554 extension, we do not specify the algorithms used. We list the GL 555 state used to control the algorithm, but the interpretation of 556 this state is implementation-dependent. All algorithms may be 557 effected by the setting of PACK_MPEG_ADAPT_QUANT_SCALE. Other 558 parameters affect different frame types in different ways and will 559 be discussed in the paragraphs below. 560 561 If the frame type is MPEG_IFRAME_SGIX, the conversion does not use 562 any predictors. The conversion may use the contents of the 563 quantizer table PACK_MPEG_INTRA_QUANT_SGIX. Unlike during 564 decompression, the contents of the quant tables may not be changed 565 by the compression operation. 566 567 If the frame type is MPEG_PFRAME_SGIX, the data is converted using 568 the predictor bound to PACK_MPEG_PREDICTOR_BACK_SGIX. If the 569 image size is not equal to the size of the predictor, the error 570 INVALID_OPERATION is generated and the operation is terminated. 571 The conversion may also use the contents of the quantizer table 572 PACK_MPEG_NON_INTRA_QUANT_SGIX, but the contents of the quantizer 573 may not be changed by the compression operation. 574 575 If the frame type is MPEG_BFRAME_SGIX, the data is converted using 576 the predictors bound to PACK_MPEG_PREDICTOR_BACK_SGIX and 577 PACK_MPEG_PREDICTOR_FWD_SGIX. If the sizes of the predictors are 578 not equal to the image size, the error INVALID_OPERATION is 579 generated and the operation is terminated. The algorithms used in 580 the compression are not defined by this extension. The conversion 581 may also use the contents of the quantizer table 582 PACK_MPEG_NON_INTRA_QUANT_SGIX. The contents of table not may be 583 changed by the compression operation. 584 585 The output of MPEG1 compression is a byte stream containing an 586 MPEG1 picture header followed by picture data. 587 588Additions to Chapter 5 of the 1.1 Specification (Special Functions) 589 590 All of the procedures and functions added by this extension are 591 not included in display lists, but instead are executed 592 immediately. 593 594Additions to Chapter 6 of the 1.1 Specification (State and State Requests) 595 596 The routine 597 598 void GetMPEGQuantTableubv(enum target, ubyte *values); 599 600 is used to read back the contents of an MPEG quantizer table. The 601 valid values for the parameter <target> are: 602 PACK_MPEG_INTRA_QUANT_SGIX, PACK_MPEG_NON_INTRA_QUANT_SGIX, 603 UNPACK_MPEG_INTRA_QUANT_SGIX, and 604 UNPACK_MPEG_NON_INTRA_QUANT_SGIX. If the value of <target> is not 605 legal, the error INVALID_ENUM is generated. <values> points to a 606 64-element array. The organization of data in the array is not 607 specified by this extension. 608 609 The routine 610 611 void GetMPEGPredictorSGIX(enum target, enum format, enum type, 612 void *pixels); 613 614 is used to read back the contents of the predictor bound to a bind 615 point specified by <target>. The error INVALID_ENUM is generated 616 if <target> is not one of UNPACK_MPEG_PREDICTOR_FWD_SGIX, 617 UNPACK_MPEG_PREDICTOR_BACK_SGIX, PACK_MPEG_PREDICTOR_FWD_SGIX, or 618 PACK_MPEG_PREDICTOR_BACK_SGIX. <format> must be one of RED, 619 GREEN, BLUE, ALPHA, RGB, RGBA, ABGR_EXT, LUMINANCE, or 620 LUMINANCE_ALPHA. <type> must be UNSIGNED_BYTE, BYTE, 621 UNSIGNED_SHORT, SHORT, UNSIGNED_INT, INT, or FLOAT. If <format> 622 or <type> does not give a legal value, the error INVALID_ENUM is 623 generated. The two-dimensional image is returned to <pixels>. No 624 pixel transfer operations are performed on this image, but pixel 625 storage modes (including possibly MPEG compression) that are 626 applicable to ReadPixels are performed. Since the predictor does 627 not contain an alpha channel, any alpha values which are returned 628 are set to zero. If the pixel store operations applied would 629 change the contents of the predictor bound to <target>, the error 630 INVALID_OPERATION is generated. 631 632 The routines 633 634 void GetMPEGParameterfvSGIX(enum target, enum pname, 635 float *params); 636 637 and 638 639 void GetMPEGParameterivSGIX(enum target, enum pname, 640 int *params); 641 642 are used to return attributes of a predictor object bound to 643 <target> as floating-point or integer values (respectively). 644 <target> must specify one of UNPACK_MPEG_PREDICTOR_FWD_SGIX, 645 UNPACK_MPEG_PREDICTOR_BACK_SGIX, PACK_MPEG_PREDICTOR_FWD_SGIX, or 646 PACK_MPEG_PREDICTOR_BACK_SGIX or the error INVALID_ENUM is 647 generated. <pname> specifies the attribute to be returned and 648 must be MPEG_PREDICTOR_WIDTH_SGIX or MPEG_PREDICTOR_HEIGHT_SGIX. 649 These values cause the width or height of the predictor to be 650 returned to the location in client memory specified by <params>. 651 If <pname> does not specify a legal value, the error INVALID_ENUM 652 is generated. 653 654Additions to the GLX Specification 655 656 None. 657 658GLX Protocol 659 660 XXX 661 662Errors 663 664 INVALID_ENUM is generated if the parameter <target> to 665 MPEGQuantTableubv is not one of the legal values listed above. 666 667 INVALID_OPERATION is generated if the name zero is passed as one 668 of the predictors to AllocMPEGPredictorsSGIX. 669 670 INVALID_VALUE is generated if the parameter <pname> to PixelStorei 671 or PixelStoref indicates a predictor bind point but <param> is not 672 the name of a predictor object. 673 674 INVALID_OPERATION is generated if parameter <format> to 675 MPEGPredictorSGIX is not one of RED, GREEN, BLUE, ALPHA, RGB, 676 RGBA, ABGR_EXT, LUMINANCE, or LUMINANCE_ALPHA. 677 678 INVALID_OPERATION is generated if parameter <type> to 679 MPEGPredictorSGIX is not one of UNSIGNED_BYTE, BYTE, 680 UNSIGNED_SHORT, SHORT, UNSIGNED_INT, INT, or FLOAT. 681 682 INVALID_ENUM is generated if either or both of the parameters 683 <target0> and <target1> to the command SwapMPEGPredictorsSGIX is 684 not the name of a valid predictor bind point. 685 686 INVALID_OPERATION is generated if UNPACK_COMPRESSION_TYPE_SGIX is 687 MPEG1_SGIX and during a pixel download the values width and height 688 (as computed in SGIX_image_compression) are not legal for MPEG1 689 decompression. 690 691 INVALID_OPERATION is generated if UNPACK_MPEG_PREDICTOR_STORE_SGIX 692 is set to UNPACK_MPEG_PREDICTOR_BACK_SGIX during the download of a 693 P- or B-frame or if UNPACK_MPEG_PREDICTOR_STORE_SGIX is set to 694 UNPACK_MPEG_PREDICTOR_FORWARD_SGIX during the download of a 695 B-frame. 696 697 INVALID_OPERATION is generated if UNPACK_MPEG_PREDICTOR_READ_SGIX 698 and UNPACK_MPEG_PREDICTOR_STORE_SGIX are set to the same value 699 during a MPEG decompression and that value is not NONE. 700 701 INVALID_OPERATION is generated if during MPEG decompression 702 UNPACK_MPEG_PREDICTOR_READ_SGIX and 703 UNPACK_MPEG_PREDICTOR_STORE_SGIX specify bind points to which the 704 same predictor is bound. 705 706 INVALID_OPERATION is generated if PACK_COMPRESSION_TYPE_SGIX is 707 MPEG1_SGIX and during a pixel readback the values width and height 708 (as computed in SGIX_image_compression) are not legal for MPEG1 709 compression. 710 711 INVALID_OPERATION is generated if PACK_MPEG_PREDICTOR_STORE_SGIX 712 is set to PACK_MPEG_PREDICTOR_BACK_SGIX during the readback of a 713 P- or B-frame or if PACK_MPEG_PREDICTOR_STORE_SGIX is set to 714 PACK_MPEG_PREDICTOR_FORWARD_SGIX during the readback of a B-frame. 715 716 INVALID_OPERATION is generated if PACK_MPEG_PREDICTOR_READ_SGIX 717 and PACK_MPEG_PREDICTOR_STORE_SGIX are set to the same value 718 during a MPEG compression and that value is not NONE. 719 720 INVALID_OPERATION is generated if during MPEG decompression 721 PACK_MPEG_PREDICTOR_READ_SGIX and PACK_MPEG_PREDICTOR_STORE_SGIX 722 specify bind points to which the same predictor is bound. 723 724 INVALID_ENUM is generated if the <target> parameter to 725 GetMPEGPredictorSGIX is not a legal value. 726 727 INVALID_ENUM is generated if the <format> parameter to 728 GetMPEGPredictorSGIX is not one of the accepted values. 729 730 INVALID_ENUM is generated if the <type> parameter to 731 GetMPEGPredictorSGIX is not one of the accepted values. 732 733 INVALID_OPERATION is generated if the pixel storage modes in 734 operation when GetMPEGPredictorSGIX is called would change the 735 contents of the predictor bound to <target>. 736 737 INVALID_ENUM is generated if the <target> parameter to 738 GetMPEGParameterfvSGIX or GetMPEGParameterivSGIX is not one of the 739 accepted values. 740 741 INVALID_ENUM is generated if the <pname> parameter to 742 GetMPEGParameterfvSGIX or GetMPEGParameterivSGIX is not one of the 743 accepted values. 744 745 INVALID_OPERATION is generated if any of the commands defined in this 746 extension is executed between the execution of Begin and the 747 corresponding execution of End. 748 749New State 750 Initial 751 Get Value Get Command Type Value Attrib 752 --------- ----------- ---- ------- ------ 753 PACK_MPEG_PREDICTOR_DST_SGIX GetIntegerv Z+ 0 client 754 PACK_MPEG_PREDICTOR_SRC_SGIX GetIntegerv Z+ 0 client 755 PACK_MPEG_PREDICTOR_FWD_SGIX GetIntegerv Z+ 0 client 756 PACK_MPEG_PREDICTOR_BACK_SGIX GetIntegerv Z+ 0 client 757 UNPACK_MPEG_PREDICTOR_DST_SGIX GetIntegerv Z+ 0 client 758 UNPACK_MPEG_PREDICTOR_SRC_SGIX GetIntegerv Z+ 0 client 759 UNPACK_MPEG_PREDICTOR_FWD_SGIX GetIntegerv Z+ 0 client 760 UNPACK_MPEG_PREDICTOR_BACK_SGIX GetIntegerv Z+ 0 client 761 762 PACK_MPEG_PREDICTOR_TO_DST_SGI GetIntegerv B 0 client 763 PACK_MPEG_PREDICTOR_FROM_SRC_SGIX GetIntegerv B 0 client 764 PACK_MPEG_PREDICTOR_TO_DST_SINK_SGIX GetIntegerv B 0 client 765 UNPACK_MPEG_PREDICTOR_TO_DST_SGIX GetIntegerv B 0 client 766 UNPACK_MPEG_PREDICTOR_FROM_SRC_SGIX GetIntegerv B 0 client 767 UNPACK_MPEG_PREDICTOR_TO_DST_SINK_SGIX GetIntegerv B 0 client 768 769 PACK_MPEG_INTRA_QUANT GetMPEGQuantTableubv 64*Z+ ( 8,16,19,22,26,27,29,34, client 770 16,16,22,24,47,49,34,37, 771 19,22,26,27,29,34,34,38, 772 22,22,26,27,29,34,37,40, 773 22,26,27,29,32,35,40,48, 774 26,27,29,32,35,40,48,58, 775 26,27,29,34,38,46,56,69, 776 27,29,35,38,46,56,69,83) 777 PACK_MPEG_NON_INTRA_QUANT GetMPEGQuantTableubv 64*Z+ (16,16,16,16,16,16,16,16, client 778 16,16,16,16,16,16,16,16, 779 16,16,16,16,16,16,16,16, 780 16,16,16,16,16,16,16,16, 781 16,16,16,16,16,16,16,16, 782 16,16,16,16,16,16,16,16, 783 16,16,16,16,16,16,16,16, 784 16,16,16,16,16,16,16,16) 785 UNPACK_MPEG_INTRA_QUANT GetMPEGQuantTableubv 64*Z+ ( 8,16,19,22,26,27,29,34, client 786 16,16,22,24,47,49,34,37, 787 19,22,26,27,29,34,34,38, 788 22,22,26,27,29,34,37,40, 789 22,26,27,29,32,35,40,48, 790 26,27,29,32,35,40,48,58, 791 26,27,29,34,38,46,56,69, 792 27,29,35,38,46,56,69,83) 793 UNPACK_MPEG_NON_INTRA_QUANT GetMPEGQuantTableubv 64*Z+ (16,16,16,16,16,16,16,16, client 794 16,16,16,16,16,16,16,16, 795 16,16,16,16,16,16,16,16, 796 16,16,16,16,16,16,16,16, 797 16,16,16,16,16,16,16,16, 798 16,16,16,16,16,16,16,16, 799 16,16,16,16,16,16,16,16, 800 16,16,16,16,16,16,16,16) 801 MPEG_PREDICTOR_WIDTH_SGIX GetMPEGParameterivSGIX 3 x Z+ 0 client 802 MPEG_PREDICTOR_HEIGHT_SGIX GetMPEGParameterivSGIX 3 x Z+ 0 client 803 804New Implementation Dependent State 805 806 None. 807