Previous Next
172
CHAPTER 3 Syntax
domain [ 0 20 ] and the y argument to the domain [ 0 30 ]. Using bilinear
interpolation between sample points, the function computes a value for z, which
(because BitsPerSample is 4) will be in the range [ 0 15 ], and the decoding
transforms z to a number in the range [ −1.0 1.0 ] for the result. The sample array
is stored in a string of 326 bytes, calculated as follows (rounded up):
326 bytes = 31 rows × 21 samples / row × 4 bits / sample ÷ 8 bits / byte
The first byte contains the sample for the point (−1.0, −1.0) in the high-order 4
bits and the sample for the point (−0.9, −1.0) in the low-order 4 bits.
Example 3.19
14 0 obj
<< /FunctionType 0
/Domain [−1.0 1.0 −1.0 1.0 ]
/Size [ 21 31 ]
/Encode [ 0 20 0 30 ]
/BitsPerSample 4
/Range [ −1.0 1.0 ]
/Decode [ −1.0 1.0 ]
/Length …
/Filter …
>>
stream
… 651 sample values …
endstream
endobj
The Decode entry can be used creatively to increase the accuracy of encoded
samples corresponding to certain values in the range. For example, if the range of
the function is [ −1.0 1.0 ] and BitsPerSample is 4, the usual value of Decode
would be [ −1.0 1.0 ] and the sample values would be integers in the interval
[ 0 15 ] (as shown in Figure 3.8). But if these values are used, the midpoint of the
range, 0.0, is not represented exactly by any sample value, since it falls halfway
between 7 and 8. However, if the Decode array is [ −1.0 +1.1429 ] (1.1429 being
approximately equal to 16 ÷ 14) and the sample values supplied are in the interval
[ 0 14 ], the effective range of [ −1.0 1.0 ] is achieved, and the range value 0.0 is
represented by the sample value 7.
Previous Next