it.geosolutions.imageioimpl.plugins.tiff
Class TIFFFaxCompressor

Object
  extended by TIFFCompressor
      extended by TIFFFaxCompressor
Direct Known Subclasses:
TIFFRLECompressor, TIFFT4Compressor, TIFFT6Compressor

public abstract class TIFFFaxCompressor
extends TIFFCompressor


Field Summary
 int bits
          Output bit buffer.
static int BLACK
          The CCITT numerical definition of black.
static byte[] byteTable
           
static int[][] horz
          Black and white horizontal mode table.
static int[] horzMode
          Horizontal mode table.
 boolean inverseFill
          Whether bits are inserted in reverse order (TIFF FillOrder 2).
static int[][] makeupCodes
          Black and white make-up code table.
static int[] makeupCodesBlack
          Make-up codes for black runs.
static int[] makeupCodesWhite
          Make-up codes for white runs.
 int ndex
          Number of bits in the output bit buffer.
static int[][] pass
          Black and white pass mode table.
static int[] passMode
          Pass mode table.
static int[][] termCodes
          Black and white terminating code table.
static int[] termCodesBlack
          Terminating codes for black runs.
static int[] termCodesWhite
          Terminating codes for white runs.
static int[][] vert
          Black and white vertical mode table.
static int[] vertMode
          Vertical mode table.
static int WHITE
          The CCITT numerical definition of white.
 
Fields inherited from class TIFFCompressor
compressionTagValue, compressionType, isCompressionLossless, metadata, stream, writer
 
Constructor Summary
protected TIFFFaxCompressor(String compressionType, int compressionTagValue, boolean isCompressionLossless)
          Constructor.
 
Method Summary
 int add1DBits(byte[] buf, int where, int count, int color)
          Get code for run and add to compressed bitstream.
 int add2DBits(byte[] buf, int where, int[][] mode, int entry)
          Place entry from mode table into compressed bitstream.
 int addEOFB(byte[] buf, int where)
          Add an End-of-Facsimile-Block (EOFB == 0x001001) to the compressed bitstream.
 int addEOL(boolean is1DMode, boolean addFill, boolean add1, byte[] buf, int where)
          Add an End-of-Line (EOL == 0x001) to the compressed bitstream with optional byte alignment.
 int encode1D(byte[] data, int rowOffset, int colOffset, int rowLength, byte[] compData, int compOffset)
          One-dimensionally encode a row of data using CCITT Huffman compression.
 void initBitBuf()
          Initialize bit buffer machinery.
 int nextState(byte[] data, int base, int bitOffset, int maxOffset)
          Return min of maxOffset or offset of first pixel different from pixel at bitOffset.
 void setMetadata(IIOMetadata metadata)
          Sets the value of the metadata field.
 
Methods inherited from class TIFFCompressor
encode, getCompressionTagValue, getCompressionType, getMetadata, getStream, getWriter, isCompressionLossless, setStream, setWriter
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

WHITE

public static final int WHITE
The CCITT numerical definition of white.

See Also:
Constant Field Values

BLACK

public static final int BLACK
The CCITT numerical definition of black.

See Also:
Constant Field Values

byteTable

public static byte[] byteTable

termCodesBlack

public static int[] termCodesBlack
Terminating codes for black runs.


termCodesWhite

public static int[] termCodesWhite
Terminating codes for white runs.


makeupCodesBlack

public static int[] makeupCodesBlack
Make-up codes for black runs.


makeupCodesWhite

public static int[] makeupCodesWhite
Make-up codes for white runs.


passMode

public static int[] passMode
Pass mode table.


vertMode

public static int[] vertMode
Vertical mode table.


horzMode

public static int[] horzMode
Horizontal mode table.


termCodes

public static int[][] termCodes
Black and white terminating code table.


makeupCodes

public static int[][] makeupCodes
Black and white make-up code table.


pass

public static int[][] pass
Black and white pass mode table.


vert

public static int[][] vert
Black and white vertical mode table.


horz

public static int[][] horz
Black and white horizontal mode table.


inverseFill

public boolean inverseFill
Whether bits are inserted in reverse order (TIFF FillOrder 2).


bits

public int bits
Output bit buffer.


ndex

public int ndex
Number of bits in the output bit buffer.

Constructor Detail

TIFFFaxCompressor

protected TIFFFaxCompressor(String compressionType,
                            int compressionTagValue,
                            boolean isCompressionLossless)
Constructor. The superclass constructor is merely invoked with the same parameters.

Method Detail

setMetadata

public void setMetadata(IIOMetadata metadata)
Sets the value of the metadata field.

The implementation in this class also sets local options from the FILL_ORDER field if it exists.

Overrides:
setMetadata in class TIFFCompressor
Parameters:
metadata - the IIOMetadata object for the image being written.
See Also:
TIFFCompressor.getMetadata()

nextState

public int nextState(byte[] data,
                     int base,
                     int bitOffset,
                     int maxOffset)
Return min of maxOffset or offset of first pixel different from pixel at bitOffset.


initBitBuf

public void initBitBuf()
Initialize bit buffer machinery.


add1DBits

public int add1DBits(byte[] buf,
                     int where,
                     int count,
                     int color)
Get code for run and add to compressed bitstream.


add2DBits

public int add2DBits(byte[] buf,
                     int where,
                     int[][] mode,
                     int entry)
Place entry from mode table into compressed bitstream.


addEOL

public int addEOL(boolean is1DMode,
                  boolean addFill,
                  boolean add1,
                  byte[] buf,
                  int where)
Add an End-of-Line (EOL == 0x001) to the compressed bitstream with optional byte alignment.


addEOFB

public int addEOFB(byte[] buf,
                   int where)
Add an End-of-Facsimile-Block (EOFB == 0x001001) to the compressed bitstream.


encode1D

public int encode1D(byte[] data,
                    int rowOffset,
                    int colOffset,
                    int rowLength,
                    byte[] compData,
                    int compOffset)
One-dimensionally encode a row of data using CCITT Huffman compression. The bit buffer should be initialized as required before invoking this method and should be flushed after the method returns. The fill order is always highest-order to lowest-order bit so the calling routine should handle bit inversion.



Copyright © 2006-2010 GeoSolutions. All Rights Reserved.