1XXX - Not complete. 2 3Name 4 5 SGIX_mpeg2 6 7Name Strings 8 9 GL_SGIX_mpeg2 10 11Version 12 13 $Date: 1997/06/07 01:24:17 $ $Revision: 1.6 $ 14 15Number 16 17 ??? 18 19Dependencies 20 21 SGIX_mpeg1 and SGIX_image_compression are required. 22 23Overview 24 25 This extension provides support for compression and decompression 26 of MPEG2-compressed images. 27 28 Most of the additions specified by this extension exist to permit 29 the handling of fields of images, which is required by MPEG2 but 30 not by MPEG1. This extension adds the capability to update or 31 read from only the top or bottom fields of a predictor frame. The 32 extension also allows the compression and decompression of fields 33 of an image. 34 35 Support of this extension does not imply conformance to the MPEG2 36 standard (ISO 13818), although the following guarantees are made: 37 38 - During decode, the picture_structure field of the picture 39 coding extension is extracted and interpreted correctly. 40 The treatment of the resulting value is discussed below. 41 42 - During encode, the picture_structure field of the picture 43 coding extension and the picture_type field of the picture 44 header are set correctly as determined by 45 PACK_MPEG_PICTURE_TYPE_SGIX. 46 47Issues 48 49 * We guarantee that the picture_structure and picture_type 50 fields are interpreted and set correctly. We do this so that 51 we can make guarantees about which predictors will be used 52 and updated. Should we make this less restrictive? 53 54New Procedures and Functions 55 56 None. 57 58New Tokens 59 60 Accepted by the <param> parameter of PixelStoref, PixelStorei, 61 GetBooleanv, GetIntegerv, GetFloatv, and GetDoublev: 62 63 MPEG2_SGIX ???? 64 65 MPEG_IFIELD_TOP_SGIX ???? 66 MPEG_IFIELD_BOTTOM_SGIX ???? 67 MPEG_PFIELD_TOP_SGIX ???? 68 MPEG_PFIELD_BOTTOM_SGIX ???? 69 MPEG_BFIELD_TOP_SGIX ???? 70 MPEG_BFIELD_BOTTOM_SGIX ???? 71 72 Accepted by the <target> parameter of MPEGQuantTableubv and 73 GetMPEGQuantTableubv: 74 75 PACK_MPEG_INTRA_QUANT_CHROMA ???? 76 PACK_MPEG_NON_INTRA_QUANT_CHROMA ???? 77 UNPACK_MPEG_INTRA_QUANT_CHROMA ???? 78 UNPACK_MPEG_NON_INTRA_QUANT_CHROMA ???? 79 80Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation) 81 82 None. 83 84Additions to Chapter 3 of the 1.1 Specification (Rasterization) 85 86 The pixel storage modes are augmented to support MPEG2 compressed 87 images in memory. In Table 3.1, MPEG2_SGIX is added to the valid 88 range of UNPACK_COMPRESSION_TYPE_SGIX. 89 90 The values PACK_MPEG_INTRA_QUANT_CHROMA, 91 PACK_MPEG_NON_INTRA_QUANT_CHROMA, UNPACK_MPEG_INTRA_QUANT_CHROMA, 92 and UNPACK_MPEG_NON_INTRA_QUANT_CHROMA are added to the list of 93 legal values for the <target> parameter of MPEGQuantTableubv. 94 95 The following should be added to "Unpacking of Compressed Images" 96 subsection of section 3.6.3 (Rasterization of Pixel 97 Rectangles) following the information added by the MPEG1 98 extension: MPEG2-compressed images (UNPACK_COMPRESSION_TYPE_SGIX 99 equal to MPEG2_SGIX) are classified as one of six types: I-frame, 100 P-frame, B-frame, I-field, P-field, and B-field. Fields are 101 further classified into top and bottom. The classification is 102 accomplished through extraction and interpretation of the 103 picture_type field of the picture header and the picture_structure 104 field of the picture coding extension. This extraction and 105 interpretation is performed as specified in the MPEG2 spec (ISO 106 13818). 107 108 Decompression of MPEG2 images is very similar to the decompression 109 of MPEG1 images described in SGIX_mpeg1, but MPEG2 decompression 110 may make use of two chrominance quantization tables: 111 UNPACK_MPEG_INTRA_QUANT_CHROMA and 112 UNPACK_MPEG_NON_INTRA_QUANT_CHROMA. These tables are set and read 113 back in the same manner and using the same commands as the 114 quantization tables introduced in SGIX_mpeg1. The chrominance 115 quantization tables may be used and changed during the 116 decompression step if UNPACK_SAMPLE_SGIX is SAMPLE_422_SGIX. 117 UNPACK_MPEG_INTRA_QUANT_CHROMA is used and updated only during the 118 decompression of I-frames and I-fields; 119 UNPACK_MPEG_NON_INTRA_QUANT_CHROMA, is used and updated only 120 during the decompression of P- and B-frames and P- and B-fields. 121 122 Except for the use and update of UNPACK_MPEG_INTRA_QUANT_CHROMA 123 and UNPACK_MPEG_NON_INTRA_QUANT_CHROMA, MPEG2 frame pictures (I, 124 P, and B) are treated as specified in SGIX_mpeg1. MPEG2 field 125 pictures are treated as images whose height is half the height of 126 the corresponding frame. The height value, as computed in 127 image_compression_SGIX, gives the number of scan lines in the 128 field instead of the height of the frame. Fields are treated 129 identically to MPEG1 frames with two exceptions: MPEG2 fields may 130 use and update the chroma quant tables and the MPEG2 field picture 131 predictor update step is performed differently than the MPEG1 132 predictor update step. In the predictor update step during MPEG2 133 field decompression, only the top or bottom field of the predictor 134 is replaced. The field to be replaced is determined by the field 135 type of the current image (top fields replace the top fields of 136 the predictor). The other field of the predictor is left 137 unchanged. The predictor height must be twice the height of the 138 current image or the error INVALID_OPERATION is generated and 139 processing terminates without any change to the predictor frame 140 taking place. 141 142Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations 143and the Frame Buffer) 144 145 In Table 4.5, the values MPEG_IFIELD_TOP_SGIX, 146 MPEG_IFIELD_BOTTOM_SGIX, MPEG_PFIELD_TOP_SGIX, 147 MPEG_PFIELD_BOTTOM_SGIX, MPEG_BFIELD_TOP_SGIX, and 148 MPEG_BFIELD_BOTTOM_SGIX are added to the valid range of 149 PACK_MPEG_PICTURE_TYPE_SGIX. 150 151 The following should be added to the "Packing of Compressed 152 Images" subsection of section 4.3.2 following the information 153 added by the MPEG1 extension: If PACK_COMPRESSION_TYPE_SGIX is 154 equal to MPEG2_SGIX, MPEG2 compression is performed. Compression 155 of MPEG2 images is similar to compression of MPEG1 images. During 156 MPEG2 compression, the value of PACK_MPEG_PICTURE_TYPE_SGIX must 157 be equal to MPEG_IFRAME_SGIX, MPEG_PFRAME_SGIX, MPEG_BFRAME_SGIX, 158 MPEG_IFIELD_TOP_SGIX, MPEG_IFIELD_BOTTOM_SGIX, 159 MPEG_PFIELD_TOP_SGIX, MPEG_PFIELD_BOTTOM_SGIX, 160 MPEG_BFIELD_TOP_SGIX, or MPEG_BFIELD_BOTTOM_SGIX. If the value is 161 not legal, the error INVALID_ENUM is generated and no processing 162 takes place. If the image is a field, the height (as computed in 163 image_compression_SGIX) is interpreted as the number of scan lines 164 in the field, which is half the height of the corresponding frame. 165 166 The first step of MPEG2 compression is the conversion to YCrCb. 167 If PACK_TO_RGB_SGIX is TRUE, the RGBA input image is converted to 168 a YCrCb image using an unspecified algorithm. If PACK_TO_RGB_SGIX 169 is FALSE, the input image is converted to YCrCb by setting the Y 170 equal to R, Cr equal to G, and Cb equal to B. 171 172 The update of predictors during MPEG2 compression is identical to 173 the update of predictors during MPEG2 decompression described 174 above (including generation and possible termination of 175 processing), except that the PACK state is used in place of the 176 UNPACK state. 177 178 During compression, the replacement of the current image by a 179 predictor is determined by the values of 180 PACK_MPEG_PREDICTOR_READ_SGIX and PACK_MPEG_PICTURE_TYPE_SGIX. If 181 PACK_MPEG_PREDICTOR_READ_SGIX is equal to NONE, the current image 182 is passed on unchanged. If PACK_MPEG_PREDICTOR_READ_SGIX is 183 PACK_MPEG_PREDICTOR_FWD_SGIX, the predictor bound to 184 PACK_MPEG_PREDICTOR_FWD_SGIX is used as the source. If 185 PACK_MPEG_PREDICTOR_READ_SGIX is PACK_MPEG_PREDICTOR_BACK_SGIX, 186 the predictor bound to PACK_MPEG_PREDICTOR_BACK_SGIX is used as 187 the source. If PACK_MPEG_PICTURE_TYPE_SGIX is MPEG_IFRAME_SGIX, 188 MPEG_PFIELD_SGIX, or MPEG_BFIELD_SGIX, the entire frame of the 189 source replaces the current image. If PACK_MPEG_PICTURE_TYPE_SGIX 190 is MPEG_IFIELD_TOP_SGIX, MPEG_PFIELD_TOP_SGIX, or 191 MPEG_BFIELD_TOP_SGIX, the top field of the predictor replaces the 192 current image. Every other scan line of the predictor is 193 extracted, beginning with the top scan line of the image. If 194 PACK_MPEG_PICTURE_TYPE_SGIX is MPEG_IFIELD_BOTTOM_SGIX, 195 MPEG_PFIELD_BOTTOM_SGIX, or MPEG_BFIELD_BOTTOM_SGIX, the bottom 196 field of the predictor replaces the current image. Every other 197 scan line of the predictor is extracted, beginning with the second 198 scan line from the top. The image extracted during the replacement 199 step replaces the current image in all subsequent processing. 200 201 After the replacement step, downsampling of the image occurs in 202 the same manner as during the compression of MPEG1 images. 203 204 The output of the downsampling step is converted based upon the 205 picture type specified by PACK_MPEG_PICTURE_TYPE_SGIX. In this 206 extension, we specify which quantization tables and predictors are 207 used in the conversion, but do not describe the algorithms used. 208 209 If the picture type is MPEG_IFRAME_SGIX, MPEG_IFIELD_TOP_SGIX, or 210 MPEG_IFIELD_BOTTOM_SGIX, the quantization table 211 PACK_MPEG_INTRA_QUANT_SGIX is used. The quantization table 212 PACK_MPEG_INTRA_QUANT_CHROMA_SGIX is also used if PACK_SAMPLE_SGIX 213 is SAMPLE_422_SGIX. No predictors are used. 214 215 If the picture type is MPEG_PFRAME_SGIX, MPEG_PFIELD_TOP_SGIX, or 216 MPEG_PFIELD_BOTTOM_SGIX, the quantization table 217 PACK_MPEG_NON_INTRA_QUANT_SGIX is used. 218 PACK_MPEG_NON_INTRA_QUANT_CHROMA_SGIX is also used if 219 PACK_SAMPLE_SGIX is SAMPLE_422_SGIX. The data is converted using 220 the predictor bound to PACK_MPEG_PREDICTOR_BACK_SGIX. If the 221 image is a frame and its size is not equal to the size of the 222 predictor bound to PACK_MPEG_PREDICTOR_BACK_SGIX, the error 223 INVALID_OPERATION is generated. If the image is a field, its 224 width must be equal to the width of the predictor and its height 225 must be equal to half the height of the predictor or the error 226 INVALID_OPERATION is generated. 227 228 If the picture type is MPEG_BFRAME_SGIX, MPEG_PFIELD_TOP_SGIX, or 229 MPEG_PFIELD_BOTTOM_SGIX, the quantization table 230 PACK_MPEG_NON_INTRA_QUANT_SGIX is used. 231 PACK_MPEG_NON_INTRA_QUANT_CHROMA_SGIX is also used if 232 PACK_SAMPLE_SGIX is SAMPLE_422_SGIX. The image is converted using 233 the predictors bound to PACK_MPEG_PREDICTOR_BACK_SGIX and 234 PACK_MPEG_PREDICTOR_FORWARD_SGIX. If the image is a frame and its 235 size is not equal to the size of the predictors bound to 236 PACK_MPEG_PREDICTOR_BACK_SGIX and 237 PACK_MPEG_PREDICTOR_FORWARD_SGIX, the error INVALID_OPERATION is 238 generated. If the image is a field, its width must be equal to 239 the width of the predictors and its height must be equal to the 240 half the height of the predictors or the error INVALID_OPERATION 241 is generated. Error checking for this step takes place prior to 242 the predictor replacement step, so if an error is detected the 243 contents of the predictors are left unchanged. 244 245 Further compression is applied to the image using an unspecified 246 algorithm. The output of MPEG2 decompression is a byte stream 247 containing an MPEG2 picture header followed by picture data. The 248 picture header specifies the field and frame type determined by 249 the setting of PACK_MPEG_PICTURE_TYPE_SGIX. 250 251Additions to Chapter 5 of the 1.1 Specification (Special Functions) 252 253 None. 254 255Additions to Chapter 6 of the 1.1 Specification (State and State Requests) 256 257 The values PACK_MPEG_INTRA_QUANT_CHROMA, 258 PACK_MPEG_NON_INTRA_QUANT_CHROMA_SGIX, 259 UNPACK_MPEG_INTRA_QUANT_CHROMA_SGIX, and 260 UNPACK_MPEG_NON_INTRA_QUANT_CHROMA_SGIX are added to the list of 261 valid values for the parameter <target> to the routine 262 GetMPEGQuantTableubv. 263 264Additions to the GLX Specification 265 266 None. 267 268GLX Protocol 269 270 XXX 271 272Errors 273 274 INVALID_OPERATION is generated if UNPACK_MPEG_PREDICTOR_STORE_SGIX 275 is set to UNPACK_MPEG_PREDICTOR_BACK_SGIX during the download of 276 an MPEG2 field and the height of the predictor bound to 277 UNPACK_MPEG_PREDICTOR_BACK_SGIX is not equal to twice the height 278 of the field. 279 280 INVALID_OPERATION is generated if UNPACK_MPEG_PREDICTOR_STORE_SGIX 281 is set to UNPACK_MPEG_PREDICTOR_FWD_SGIX during the download of an 282 MPEG2 field and the height of the predictor bound to 283 UNPACK_MPEG_PREDICTOR_FWD_SGIX is not equal to twice the height of 284 the field. 285 286 INVALID_OPERATION is generated if a pixel readback operation is 287 applied, PACK_COMPRESSION_TYPE_SGIX is equal to MPEG2_SGIX, and 288 the value of PACK_MPEG_PICTURE_TYPE is not one of the legal 289 values. 290 291 INVALID_OPERATION is generated if during MPEG2 compression of a 292 frame PACK_MPEG_PREDICTOR_STORE_SGIX is equal to a value other 293 than NONE and the width and height of the current image are not 294 equal to the width and height of the predictor bound to the 295 specified bind point. 296 297 INVALID_OPERATION is generated if during MPEG2 compression of a 298 field PACK_MPEG_PREDICTOR_STORE_SGIX is equal to a value other 299 than NONE and the width and height of the current image are not 300 equal to the width and height of the predictor bound to the 301 specified bind point. 302 303New State 304 305 Initial 306 Get Value Get Command Type Value Attrib 307 --------- ----------- ---- ------- ------ 308 PACK_MPEG_INTRA_QUANT_CHROMA GetMPEGQuantTableubv 64*Z+ XXX client 309 PACK_MPEG_NON_INTRA_QUANT_CHROMA GetMPEGQuantTableubv 64*Z+ XXX client 310 UNPACK_MPEG_INTRA_QUANT_CHROMA GetMPEGQuantTableubv 64*Z+ XXX client 311 UNPACK_MPEG_NON_INTRA_QUANT_CHROMA GetMPEGQuantTableubv 64*Z+ XXX client 312 313New Implementation Dependent State 314 315 None. 316