decode an array of bytes in DCT format.
DCT is the format used by JPEG images, so this class simply
loads the DCT-format bytes as an image, then reads the bytes out
of the image to create the array. If this were to be used
against image objects we'd end up wasting a lot of work, because
we'd be generating a buffered image here, writing out the bytes,
and then generating a buffered image again from those bytes in the
PDFImage class.
Luckily, the image processing has been optimised to detect
DCT decodes at the end of filters, in which case it avoids
running the stream through this filter, and just directly
generates a BufferedImage from the DCT encoded byte stream.
As such, this decode will be invoked only if there's been
some very unusual employment of filters in the PDF - e.g.,
DCTDecode applied to non-image data, or if DCTDecode is not at
the end of a Filter dictionary entry. This is permissible but
unlikely to occur in practice.
The DCT-encoded stream may have 1, 3 or 4 samples per pixel, depending
on the colorspace of the image. In decoding, we look for the colorspace
in the stream object's dictionary to decide how to decode this image.
If no colorspace is present, we guess 3 samples per pixel.
- Parameters:
dict
- the stream dictionarybuf
- the DCT-encoded bufferparams
- the parameters to the decoder (ignored)
- Returns:
- the decoded buffer
- Throws:
PDFParseException