public class HuffmanEncoder extends java.lang.Object implements ImageEncoder
Constructor and Description |
---|
HuffmanEncoder(java.io.OutputStream os,
int buf_length) |
Modifier and Type | Method and Description |
---|---|
void |
encode(byte[] pixels,
int start,
int len)
The actual encoding implementation
|
void |
encode(int[] ZZ,
int component_id) |
void |
finish() |
int |
getCompressedDataLen() |
void |
initialize() |
void |
setEncodingTables(int[][] DC_EHUFCO,
int[][] DC_EHUFSI,
int[][] AC_EHUFCO,
int[][] AC_EHUFSI) |
public void encode(byte[] pixels, int start, int len) throws java.lang.Exception
ImageEncoder
encode
in interface ImageEncoder
pixels
- array of pixels (This has nothing to do with the actual bits per pixel since it could be pixel packed)start
- offset in the pixel array where the encoding starts (the actual position could be anywhere inside the
offset byte which maybe kept track of by the implementation class through a parameter such as
currPos if the encoder is pixel oriented).len
- the number of pixels to be encoded if the encoder is pixel oriented like CCITT or the number of bytes to
be encoded if the encoder is byte oriented like LZW etc.java.lang.Exception
public void encode(int[] ZZ, int component_id) throws java.lang.Exception
java.lang.Exception
public void finish() throws java.lang.Exception
finish
in interface ImageEncoder
java.lang.Exception
public int getCompressedDataLen()
getCompressedDataLen
in interface ImageEncoder
public void initialize()
initialize
in interface ImageEncoder
public void setEncodingTables(int[][] DC_EHUFCO, int[][] DC_EHUFSI, int[][] AC_EHUFCO, int[][] AC_EHUFSI)