Previous Next


                                                171
SECTION 3.9                                                                            Functions



That value is encoded:
e i = Interpolate ( x i ′, Domain 2i , Domain 2i + 1 , Encode 2i , Encode 2i + 1 )

That value is clipped to the size of the sample table in that dimension:
e i ′ = min ( max ( e i , 0 ) , Size i – 1 )

The encoded input values are real numbers, not restricted to integers.
Interpolation is used to determine output values from the nearest surrounding
values in the sample table. Each output value rj , for 0 ≤ j < n, is then decoded:

r j ′ = Interpolate ( r j , 0 , 2 BitsPerSample – 1 , Decode 2j , Decode 2j + 1 )

Finally, each decoded value is clipped to the range:
y j = min ( max ( r j ′, Range 2j ) , Range 2j + 1 )

Sample data is represented as a stream of unsigned 8-bit bytes (integers in the
range 0 to 255). The bytes constitute a continuous bit stream, with the high-order
bit of each byte first. Each sample value is represented as a sequence of
BitsPerSample bits. Successive values are adjacent in the bit stream; there is no
padding at byte boundaries.

For a function with multidimensional input (more than one input variable), the
sample values in the first dimension vary fastest, and the values in the last
dimension vary slowest. For example, for a function f (a, b, c), where a, b, and c
vary from 0 to 9 in steps of 1, the sample values would appear in this order:
f (0, 0, 0), f (1, 0, 0), … , f (9, 0, 0), f (0, 1, 0), f (1, 1, 0), … , f (9, 1, 0), f (0, 2, 0),
f (1, 2, 0), … , f (9, 9, 0), f (0, 0, 1), f (1, 0, 1), and so on.

For a function with multidimensional output (more than one output value), the
values are stored in the same order as Range.

The stream data must be long enough to contain the entire sample array, as
indicated by Size, Range, and BitsPerSample; see “Stream Extent” on page 61.

Example 3.19 illustrates a sampled function with 4-bit samples in an array
containing 21 columns and 31 rows (651 values). The function takes two
arguments, x and y, in the domain [−1.0 1.0 ], and returns one value, z, in that
same range. The x argument is linearly transformed by the encoding to the

Previous Next