Package net.sourceforge.jiu.codecs.tiff
Class TIFFDecoderModifiedHuffman
- java.lang.Object
-
- net.sourceforge.jiu.codecs.tiff.TIFFDecoder
-
- net.sourceforge.jiu.codecs.tiff.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 value2in the compression tag of an image file directory. Only bilevel images can be encoded with that method.- Since:
- 0.9.0
- Author:
- Marco Schmidt
-
-
Field Summary
Fields Modifier and Type Field Description private intbitBufferprivate DataInputinprivate intnumBufferedBits
-
Constructor Summary
Constructors Constructor Description TIFFDecoderModifiedHuffman()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddecode()Decode data from input and write the decompressed pixel data to the image associated with this decoder.private intdecodeBlackRun()private voiddecodeRow(byte[] row)private intdecodeRun(int[][][] codes, int minCodeSize)private intdecodeWhiteRun()Integer[]getCompressionTypes()Returns an array with Integer values of all compression types supported by this decoder (see the COMPRESSION_xyz constants inTIFFConstants.voidinitialize()Check if all necessary parameters have been given to this decoder and initialize several internal fields from them.private intreadBit()private intreadBits(int number)private voidreset()-
Methods inherited from class net.sourceforge.jiu.codecs.tiff.TIFFDecoder
getBytesPerRow, getCodec, getImageFileDirectory, getInput, getTileIndex, getX1, getX2, getY1, getY2, putBytes, setCodec, setImageFileDirectory, setTileIndex
-
-
-
-
Field Detail
-
in
private DataInput in
-
bitBuffer
private int bitBuffer
-
numBufferedBits
private int numBufferedBits
-
-
Method Detail
-
decode
public void decode() throws InvalidFileStructureException, IOExceptionDescription copied from class:TIFFDecoderDecode 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.- Specified by:
decodein classTIFFDecoder- Throws:
InvalidFileStructureExceptionIOException
-
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()
Description copied from class:TIFFDecoderReturns an array with Integer values of all compression types supported by this decoder (see the COMPRESSION_xyz constants inTIFFConstants. 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.- Specified by:
getCompressionTypesin classTIFFDecoder- Returns:
- array with Integer objects of all TIFF compression constants supported by this decoder
-
initialize
public void initialize() throws IOException, MissingParameterExceptionDescription copied from class:TIFFDecoderCheck 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:
initializein classTIFFDecoder- Throws:
IOExceptionMissingParameterException
-
readBit
private int readBit() throws IOException- Throws:
IOException
-
readBits
private int readBits(int number) throws IOException- Throws:
IOException
-
reset
private void reset()
-
-