• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    OML_resample
4
5Name Strings
6
7    GL_OML_resample
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/resample.spec#10 $
21
22Number
23
24    241
25
26Dependencies
27
28    OML_subsample is required.
29    This extension is written against the OpenGL 1.2.1 Specification,
30
31Overview
32
33    This extension enhances the resampling capabilities of the
34    OML_subsample extension. It is loosely based on the SGIX_resample
35    extension.
36
37    When converting data from subsampled to uniform sampling, upsampling
38    may be performed by one of three methods: component replication,
39    zero fill, or adjacent neighbor averaging.
40
41    When converting data from uniform sampling to subsampled form,
42    downsampling may be performed only by component decimation (point
43    sampling) or averaging.
44
45    Upsampling and downsampling filters other than those defined by this
46    extension may be performed by appropriate use of convolution and
47    other pixel transfer operations. The zero fill unpacking mode is
48    included to assist applications wanting to define their own filters.
49
50Issues
51
52  * Should RESAMPLE_xxx enums be renamed to PIXEL_RESAMPLE_xxx?
53
54IP Status
55
56    No known issues.
57
58New Procedures and Functions
59
60    None.
61
62New Tokens
63
64    Accepted by the <pname> parameter of PixelStoref, PixelStorei,
65    GetBooleanv, GetIntegerv, GetFloatv and GetDoublev:
66
67	PACK_RESAMPLE_OML		    0x8984
68	UNPACK_RESAMPLE_OML		    0x8985
69
70    Accepted by the <param> parameter of PixelStoref and PixelStorei
71    when the <pname> parameter is UNPACK_RESAMPLE_OML:
72
73	RESAMPLE_REPLICATE_OML		    0x8986
74	RESAMPLE_ZERO_FILL_OML		    0x8987
75	RESAMPLE_AVERAGE_OML		    0x8988
76
77    Accepted by the <param> parameter of PixelStoref and PixelStorei
78    when the <pname> parameter is PACK_RESAMPLE_OML:
79
80	RESAMPLE_DECIMATE_OML		    0x8989
81	RESAMPLE_AVERAGE_OML		    0x8988
82
83
84Additions to Chapter 2 of the OpenGL 1.2.1 Specification (OpenGL Operation)
85
86    None.
87
88Additions to Chapter 3 of the OpenGL 1.2.1 Specification (Rasterization)
89
90  - (3.6.1, p. 75 "Pixel Storage Modes")
91
92    Add to table 3.1 (p. 76):
93
94    Parameter Name	Type	Initial Value		Valid Range
95    --------------	----	-------------		-----------
96    UNPACK_RESAMPLE_OML integer RESAMPLE_REPLICATE_OML	RESAMPLE_REPLICATE_OML
97							RESAMPLE_ZERO_FILL_OML
98							RESAMPLE_AVERAGE_OML
99
100    PACK_RESAMPLE_OML	integer RESAMPLE_DECIMATE_OML	RESAMPLE_DECIMATE_OML
101							RESAMPLE_AVERAGE_OML
102
103
104  - (3.6.4, p. 88 "Rasterization of Pixel Rectangles")
105
106  - Modify the new subsection "Conversion to Uniform Sampling"
107    (introduced by OML_subsample) to read:
108
109    Conversion to Uniform Sampling
110
111    This step is applied only to subsampled data. If <format> is
112    FORMAT_SUBSAMPLE_24_24_OML, then the number of components per pixel
113    is increased from two to three. If <format> is
114    FORMAT_SUBSAMPLE_244_244_OML. then the number of components per
115    pixel is increased from three to four. The upsampling method used is
116    determined by the value of the PixelStore parameter
117    UNPACK_RESAMPLE_OML.
118
119    After conversion to uniform sampling (see figure 3.9). pixels are
120    thereafter treated as though they were RGB (three component) or RGBA
121    (four component) format.
122
123    In the remainder of this section, the j'th component of the i'th
124    pixel in a row is denoted by S_i,j (for source pixels in client
125    memory) and D_i,j (for destination pixels in the color buffer).
126
127    Replication
128
129    If the value of UNPACK_RESAMPLE_OML is RESAMPLE_REPLICATE_OML (see
130    figure 3.9), destination component values are defined as:
131
132    For even pixels ((i mod 2) == 0):
133
134	D_i,0 = S_i,0
135	D_i,1 = S_i,1
136	D_i,2 = S_i+1,0
137	D_i,3 = S_i,2
138
139    For odd pixels ((i mod 2) == 1):
140
141	D_i,0 = S_i-1,0
142	D_i,1 = S_i,1
143	D_i,2 = S_i,0
144	D_i,3 = S_i,2
145
146
147  - (figure 3.9, introduced by OML_subsample, is unchanged)
148
149    Zero Fill
150
151    If the value of UNPACK_RESAMPLE_OML is RESAMPLE_ZERO_FILL_OML (see
152    figure 3.10), destination component values are defined as:
153
154    For even pixels ((i mod 2) == 0):
155
156	D_i,0 = S_i,0
157	D_i,1 = S_i,1
158	D_i,2 = S_i+1,0
159	D_i,3 = S_i,2
160
161    For odd pixels ((i mod 2) == 1):
162
163	D_i,0 = 0
164	D_i,1 = S_i,1
165	D_i,2 = 0
166	D_i,3 = S_i,2
167
168  - Add new figure 3.10, following the new figure 3.9 defined in the
169    OML_subsample extension:
170
171    FORMAT_SUBSAMPLE_24_24_OML:
172    <Cb0,Y0>	 <Cr0,Y1>     <Cb2,Y2>	  <Cr2, Y3>
173      |  |	  |   |        |   |	    |	|
174      |  |   ____/    |        |   |   ____/	|
175      |  |  /	      |        |   |  /		|
176      |  |  |	 0.0  | 0.0    |   |  |    0.0	| 0.0
177      |  |  |	  |   |  |     |   |  |     |	|  |
178      V  V  V	  V   V  V     V   V  V     V	V  V
179    <Cb0,Y0,Cr0> <Cb0,Y1,Cr0> <Cb2,Y2,Cr2> <Cb2,Y3,Cr2>
180    < R0,G0,B1 > < R0,G1,B1 > < R2,G2,B3 > < R2,G3,B3 >
181
182    FORMAT_SUBSAMPLE_244_244_OML:
183    <Cb0,Y0,A0>     <Cr0,Y1,A1>     <Cb2,Y2,A2>     <Cr2,Y3,A3>
184      |  |   \	     |	 |   \	     |	 |   \	     |	 |   \
185      |  |   _\_____/	 |    \      |	 |   _\_____/	 |    \
186      |  |  /  \	 |     \     |	 |  /  \	 |     \
187      |  |  |	\   0.0  | 0.0	\    |	 |  |	\   0.0  | 0.0	\
188      |  |  |	|    |	 |  |	|    |	 |  |	|    |	 |  |	|
189      V  V  V	V    V	 V  V	V    V	 V  V	V    V	 V  V	V
190    <Cb0,Y0,Cr0,A0> <Cb0,Y1,Cr0,A1> <Cb2,Y2,Cr2,A2> <Cb2,Y3,Cr2,A3>
191    < R0,G0,B1,A0 > < R0,G1,B1,A1 > < R2,G2,B3,A2 > < R2,G3,B3,A3 >
192
193
194    Figure 3.10: Upsampling with zero fill of subsampled data from host
195    memory to form RGB or RGBA pixels.
196
197
198    Averaging
199
200    If the value of UNPACK_RESAMPLE_OML is RESAMPLE_AVERAGE_OML (see
201    figure 3.11), destination component values are defined as:
202
203    For even pixels:
204
205	D_i,0 = S_i,0
206	D_i,1 = S_i,1
207	D_i,2 = S_i+1,0
208	D_i,3 = S_i,2
209
210	(No special case for D_i,2 can arise when i is the last pixel,
211	because of the restriction to even image widths).
212
213    For odd pixels:
214
215	D_i,0 = S_i,0			    i == <width>-1 (last pixel)
216	      = 1/2 S_i-1,0 + 1/2 S_i+1,0   otherwise
217	D_i,1 = S_i,1
218	D_i,2 = S_i,0			    i == <width>-1 (last pixel)
219	      = 1/2 S_i,0 + 1/2 S_i+2,0     otherwise
220	D_i,3 = S_i,2
221
222  - Add new figure 3.11, following the new figure 3.10:
223
224    FORMAT_SUBSAMPLE_24_24_OML:
225    <Cb0,Y0>	 <Cr0,Y1>     <Cb2,Y2>	  <Cr2, Y3>
226      |  |	  |   |        |   |	    |	|
227      |  |   ____/ \__|__  ____|___|_______/ \__|__  _
228      |  |  /	      |  \/    |   |  /		|  \/
229      |\_|__|_____  __|__|___ /|\__|__|_____  __|__|__
230      |  |  |	  \/  |  |     |   |  |     \/	|  |
231      V  V  V	  V   V  V     V   V  V     V	V  V
232    <Cb0,Y0,Cr0> <Cb0,Y1,Cr0> <Cb2,Y2,Cr2> <Cb2,Y3,Cr2>
233    < R0,G0,B1 > < R0,G1,B1 > < R2,G2,B3 > < R2,G3,B3 >
234
235
236    FORMAT_SUBSAMPLE_244_244_OML:
237    <Cb0,Y0,A0>     <Cr0,Y1,A1>     <Cb2,Y2,A2>     <Cr2,Y3,A3>
238      |  |   \	     |	 |   \	     |	 |   \	      |   |   \
239      |  |   _\_____/ \__|__  \______|___|____\______/ \__|__  \___
240      |  |  /  \	 |  \/ \     |	 |  /  \	  |  \/ \
241      |\_|__|___\____  __|__|___\___/|\__|__|___\_____	__|__|___\_
242      |  |  |	|    \/  |  |	|    |	 |  |	|     \/  |  |	 |
243      V  V  V	V    V	 V  V	V    V	 V  V	V     V   V  V	 V
244    <Cb0,Y0,Cr0,A0> <Cb0,Y1,Cr0,A1> <Cb2,Y2,Cr2,A2> <Cb2,Y3,Cr2,A3>
245    < R0,G0,B1,A0 > < R0,G1,B1,A1 > < R2,G2,B3,A2 > < R2,G3,B3,A3 >
246
247    Figure 3.11: Upsampling with averaging of subsampled data from host
248    memory to form RGB or RGBA pixels.
249
250Additions to Chapter 4 of the OpenGL 1.2.1 Specification (Per-Fragment
251Operations and the Frame Buffer)
252
253  - Modify the new section "Conversion to Subsampled Form" (introduced
254    by OML_subsample) to read:
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. A filter operation specified by the
260    value of PACK_RESAMPLE_OML is applied prior to the subsampling step.
261
262    In the remainder of this section, the j'th component of the i'th
263    pixel in a row is denoted by S_i,j (for source pixels in the color
264    buffer) and D_i,j (for destination pixels in client memory).
265
266    If <format> is FORMAT_SUBSAMPLE_24_24_OML, then the resulting pixels
267    have 2 components (see figure 4.3); if <format> is
268    FORMAT_SUBSAMPLE_244_244_OML, then the resulting pixels have 3
269    components (see figure 4.4).
270
271    Decimation
272
273    If the value of PACK_RESAMPLE_OML is RESAMPLE_DECIMATE_OML, then
274    destination component values are defined as:
275
276    For even pixels ((i mod 2) == 0):
277
278	D_i,0 = S_i,0
279	D_i,1 = S_i,1
280	D_i,2 = S_i,3	(only for FORMAT_SUBSAMPLE_244_244_OML)
281
282    For odd pixels ((i mod 2) == 1):
283
284	D_i,0 = S_i-1,2
285	D_i,1 = S_i,1
286	D_i,2 = S_i,3	(only for FORMAT_SUBSAMPLE_244_244_OML)
287
288  - Add new figure 4.3 (renumber following figures):
289
290    FORMAT_SUBSAMPLE_24_24_OML:
291    <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3>
292      |  | |   |   |  |  |  |	 |  |  |  |    |  |  |	|
293      |  |  \  *   *  |  *  *	 |  |	\ *    *  |  *	*
294      |  |   |	      |		 |  |	 |	  |
295      V  V   V	      V		 V  V	 V	  V
296    <Cb0,Y0><Cr0,     Y1>	<Cb2,Y2><Cr2,	  Y3>
297    <--- pixel pair ---->	<--- pixel pair ---->
298
299    FORMAT_SUBSAMPLE_244_244_OML:
300    <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3>
301      |  |  |  |   |   |  |  |	  |  |	|  |   |   |  |  |
302      |  |  \__|__ *   |  *  |	  |  |	\__|__ *   |  *  |
303      |  |     |  \    |     |	  |  |	   |  \    |	 |
304      |  |    /    |   |    /	  |  |	  /    |   |	/
305      V  V   V	   V   V   V	  V  V	 V     V   V   V
306    <Cb0,Y0,A0>   <Cr0,Y1,A1>	<Cb2,Y2,A2>   <Cr2,Y3,A3>
307    <--- pixel pair ---->	<--- pixel pair ---->
308
309    Figure 4.3: Downsampling with decimation of RGB or RGBA pixels to
310    form subsampled data in host memory.
311
312
313    Averaging
314
315    If the value of PACK_RESAMPLE_OML is RESAMPLE_AVERAGE_OML, then
316    destination component values are defined as:
317
318    For even pixels:
319
320	D_i,0 = 3/4 S_i,0 + 1/4 S_i+1,0     i == 0 (first pixel)
321	      = 1/4 S_i-1,0 + 3/4 S_i,0     i == <width>-1 (last pixel)
322	      = 1/4 S_i-1,0 +		    otherwise
323		1/2 S_i,0 +
324		1/4 S_i+1,0
325	D_i,1 = S_i,1
326	D_i,2 = S_i,3
327
328    For odd pixels:
329
330	D_i,0 = 3/4 S_i-1,2 + 1/4 S_i,2     i == <width>-1 (last pixel)
331	      = 1/4 S_i-1,2 +		    otherwise
332		1/2 S_i,2 +
333		1/4 S_i+1,2
334	D_i,1 = S_i,1
335	D_i,2 = S_i,3
336
337XXX Note that the "last pixel" case is only needed for readbacks where
338XXX <width> is not even, so may be removable.
339
340  - Add new figure 4.4 (renumber following figures):
341
342    FORMAT_SUBSAMPLE_24_24_OML:
343    <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3>
344      | _|_|_______/\_|__|______ | _|__|_______/\_|__|_______
345      |/ | |	      |  |	\|/ |  \_______   |  |
346      |  |  \______  _|_/ \______|__|_________ \ _|_/ \______
347      |  |	   \/ |		 |  |	      \|/ |
348      V  V	   V  V		 V  V	       V  V
349    <Cb0,Y0>	 <Cr0,Y1>      <Cb2,Y2>      <Cr2,Y3>
350
351    FORMAT_SUBSAMPLE_244_244_OML:
352    <R0,G0,B0,A0> <R1,G1,B1,A1> <R2,G2,B2,A2> <R3,G3,B3,A3>
353      | _|_|___|___/\_|__|___|__ | _|__|___|___/\_|__|___|___
354      |/ | |   |      |  |   |	\|/ |  \___|___   |  |	 |
355      |  |  \__|___  _|_/ \__|___|__|______|__ \ _|_/ \__|___
356      |  |     |   \/ |      |	 |  |	   |  \|/ |	 |
357      V  V     V   V  V      V	 V  V	   V   V  V	 V
358    <Cb0,Y0,  A0><Cr0,Y1,   A1><Cb2,Y2,   A2><Cr2,Y3,	A3>
359
360    Figure 4.4: Downsampling with averaging of RGB or RGBA pixels to
361    form subsampled data in host memory.
362
363Additions to Chapter 5 of the OpenGL 1.2.1 Specification (Special Functions)
364
365    None.
366
367Additions to Chapter 6 of the OpenGL 1.2.1 Specification (State and State Requests)
368
369    None.
370
371Additions to the GLX 1.3 Specification
372
373    None.
374
375Errors
376
377    See above.
378
379New State
380
381(table 6.17, p. 207)
382    Get Value		Type	Get Command Initial Value
383    ---------		----	----------- -------------
384    UNPACK_RESAMPLE_OML Z3	GetIntegerv RESAMPLE_REPLICATE_OML
385    PACK_RESAMPLE_OML	Z2	GetIntegerv RESAMPLE_DECIMATE_OML
386
387(continued columns)
388    Get Value		Description		Sec Attribute
389    ---------		-----------		--- ---------
390    UNPACK_RESAMPLE_OML Pixel upsampling mode	3.6 pixel-store
391    PACK_RESAMPLE_OML	Pixel downsampling mode 4.3 pixel-store
392
393New Implementation Dependent State
394
395    None.
396
397Revision History
398
399  * Revision 10, 07/24/2001 - Finalized Status for OpenML 1.0.
400  * Revision 9, 07/16/2001 - Remove erroneous redefinition of
401    RESAMPLE_AVERAGE enumerant value.
402  * Revisions 7-8, 07/11/2001 - Assign enum values and extension number
403    for the registry.
404  * Revision 6 - Correct errors in the equations describing subsampling.
405  * Revision 5 - formatting changes for OpenML Specification
406  * Revision 4, 03/27/2001 - Rewrite to use the <format> parameter,
407    rather than a pixel storage mode, to specify subsampled data.
408  * Revision 3 - Removed support for YC component orders. Renamed CY and
409    CYA enumerants more sensibly. Added Discreet's RESAMPLE_AVERAGE
410    resampling mode. Changed text descriptions of sampling to equations.
411    Made enum values undefined until we've determined if this extension
412    is backwards compatible with SGIX_resample.
413  * Revision 2 - corrected 4224 upsampling and downsampling figures.
414    Moved discussion of errors for non-even image widths to the
415    OML_subsample specification.
416  * Revision 1 - derived from SGIX_resample.
417