|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectit.tidalwave.imageio.decoder.HuffmannDecoder
public class HuffmannDecoder
This class is capable to decode bit strings encoded with a Huffman table.
PENDING: give a short description of what a Huffman table is.
This class is able to create itself from a description in an array of bytes or
shorts, following some common schemes used in many RAW formats.
| Field Summary | |
|---|---|
HuffmannDecoder[] |
branch
The two pointers (index 0 and 1) to the lower tree level. |
| Method Summary | |
|---|---|
static HuffmannDecoder |
createDecoder(byte[] source,
int start)
Creates a decode tree according the specification in source. |
static HuffmannDecoder |
createDecoder(short[] source)
Creates a decode tree according the specification in source. |
static HuffmannDecoder |
createDecoderWithJpegHack(byte[] source,
int start)
Creates a decode tree according the specification in source. |
int |
decode(javax.imageio.stream.ImageInputStream br)
Reads an encoded value from a BitReader and returns the decoded value. |
java.lang.String |
toString()
|
java.lang.String |
toString(java.lang.String prefix)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public HuffmannDecoder[] branch
| Method Detail |
|---|
public static HuffmannDecoder createDecoder(short[] source)
{ 0,1,4,2,3,1,2,0,0,0,0,0,0,0,0,0,
0x04,0x03,0x05,0x06,0x02,0x07,0x01,0x08,0x09,0x00,0x0a,0x0b,0xff },
then the code is
00 0x04
010 0x03
011 0x05
100 0x06
101 0x02
1100 0x07
1101 0x01
11100 0x08
11101 0x09
11110 0x00
111110 0x0a
1111110 0x0b
1111111 0xff
source - the coded version as an array of shorts
public static HuffmannDecoder createDecoder(byte[] source,
int start)
createDecoder(short[]) for more information.
source - the coded version as an array of bytesstart - the offset in the source to the first byte to use
public static HuffmannDecoder createDecoderWithJpegHack(byte[] source,
int start)
createDecoder(short[]) for more information. This version should be
used for Hufmman tables used in Lossless JPEG compression - they have some
specific issues.
source - the coded version as an array of bytesstart - the offset in the source to the first byte to use
public int decode(javax.imageio.stream.ImageInputStream br)
throws java.io.IOException
BitReader and returns the decoded value.
br - the bit reader
java.io.IOException - if an I/O exception occurspublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.String toString(java.lang.String prefix)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||