net.sourceforge.jiu.codecs.tiff

Class TIFFDecoderModifiedHuffman


public class TIFFDecoderModifiedHuffman
extends TIFFDecoder

A TIFF decoder for files compresseed with the Modified Huffman method (also known as CCITT 1D Modified Huffman Run Length Encoding). This compression algorithm has the value 2 in the compression tag of an image file directory. Only bilevel images can be encoded with that method.
Author:
Marco Schmidt
Since:
0.9.0

Field Summary

private int
bitBuffer
private DataInput
in
private int
numBufferedBits

Fields inherited from class net.sourceforge.jiu.codecs.tiff.TIFFDecoder

bottomRow, bufferIndex, codec, currentRow, ifd, leftColumn, processedTileRows, rightColumn, rowBuffer, tileIndex, topRow, totalTileRows

Method Summary

void
decode()
Decode data from input and write the decompressed pixel data to the image associated with this decoder.
private int
decodeBlackRun()
private void
decodeRow(byte[] row)
private int
decodeRun(int[][][] codes, int minCodeSize)
private int
decodeWhiteRun()
Integer[]
getCompressionTypes()
Returns an array with Integer values of all compression types supported by this decoder (see the COMPRESSION_xyz constants in TIFFConstants.
void
initialize()
Check if all necessary parameters have been given to this decoder and initialize several internal fields from them.
private int
readBit()
private int
readBits(int number)
private void
reset()

Methods inherited from class net.sourceforge.jiu.codecs.tiff.TIFFDecoder

decode, getBytesPerRow, getCodec, getCompressionTypes, getImageFileDirectory, getInput, getTileIndex, getX1, getX2, getY1, getY2, initialize, putBytes, setCodec, setImageFileDirectory, setTileIndex, storeRow

Field Details

bitBuffer

private int bitBuffer

in

private DataInput in

numBufferedBits

private int numBufferedBits

Method Details

decode

public void decode()
            throws InvalidFileStructureException,
                   IOException
Decode data from input and write the decompressed pixel data to the image associated with this decoder. Child classes must override this method to implement the decoding for a particular compression type.
Overrides:
decode in interface TIFFDecoder

decodeBlackRun

private int decodeBlackRun()
            throws InvalidFileStructureException,
                   IOException

decodeRow

private void decodeRow(byte[] row)
            throws InvalidFileStructureException,
                   IOException

decodeRun

private int decodeRun(int[][][] codes,
                      int minCodeSize)
            throws InvalidFileStructureException,
                   IOException

decodeWhiteRun

private int decodeWhiteRun()
            throws InvalidFileStructureException,
                   IOException

getCompressionTypes

public Integer[] getCompressionTypes()
Returns an array with Integer values of all compression types supported by this decoder (see the COMPRESSION_xyz constants in TIFFConstants. Normally, this is only one value, but some compression types got assigned more than one constant (e.g. deflated). Also, a decoder could be capable of dealing with more than one type of compression if the compression types are similar enough to justify that. However, typically a decoder can only deal with one type of compression.
Overrides:
getCompressionTypes in interface TIFFDecoder
Returns:
array with Integer objects of all TIFF compression constants supported by this decoder

initialize

public void initialize()
            throws IOException,
                   MissingParameterException
Check if all necessary parameters have been given to this decoder and initialize several internal fields from them. Required parameters are a TIFFCodec object, a TIFFImageFileDirectory object and a tile index.
Overrides:
initialize in interface TIFFDecoder

readBit

private int readBit()
            throws IOException

readBits

private int readBits(int number)
            throws IOException

reset

private void reset()