|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCADI.Common.LogicalTarget.JPEG2000.Decode.MQDecoder
public class MQDecoder
This class decodes bits for the fractional bit plane decoder of JPEG2000, decoding them with the MQ decoder. This class allows the use of the following MQ options: restart, reset, bypass. Usage example:
construct
decodeBit
decodeBit
decodeBit
swapInputByteStream
reset
restart
decodeBit
decodeBit
...
| Field Summary | |
|---|---|
private int |
A
Interval range. |
private int |
C
Lower down interval. |
private ByteStream |
inputByteStream
Bytestream from which the MQ decoder reads data. |
private int |
L
Number of bytes transferred to the outputByteStream. |
private int |
numContexts
Number of contexts (defined by JPEG2000). |
private int[][] |
statesMPS
State and Most Probable Symbol of each context. |
private int[][] |
stateSymbolInit
MQ context state initialization (defined by JPEG2000 standard). |
private int[][] |
stateTrans
MQ probability state transition (defined by JPEG2000 standard). |
private int |
t
Number of bits to transfer (down counter). |
private int |
Tr
Byte to transfer. |
| Constructor Summary | |
|---|---|
MQDecoder()
Constructor that initializes internal registers of the MQ decoder but does not initialize the inputByteStream. |
|
MQDecoder(ByteStream inputByteStream)
Constructor that initializes internal registers of the MQ decoder. |
|
| Method Summary | |
|---|---|
boolean |
decodeBit()
Decode a bit using the context 18 (equivalent probabilities). |
boolean |
decodeBit(int context)
Decode a bit. |
private void |
fillLSB()
Fill the C register with a new byte of inputByteStream. |
void |
reset()
Reset the context probabilities of the decoder, if any. |
void |
restart()
Start the value of the internal variables A, C, ... of the MQ decoder filling them with the values of the inputByteStream. |
void |
swapInputByteStream(ByteStream inputByteStream)
Swaps the current inputByteStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private ByteStream inputByteStream
The content must be understood as a ByteStream.
private final int numContexts
Positive number.
private final int[][] stateSymbolInit
First array index represents the context and second is: (p.e. [2][0] is the initial state of context 2)
private final int[][] stateTrans
First array index represents the current state and second is: (i.e. [1][0] is the transition to do when code a MPS symbol and the state of the context is 1)
private int A
From right to left: 8 register bits, 3 spacer bits, 8 partial code byte, 1 carry bit.
private int C
From right to left: 8 register bits, 3 spacer bits, 8 partial code byte, 1 carry bit.
private int t
Usually it is initialized to 8, unless carry situations that it initilized to 7. Then count down until 0.
private int Tr
Byte flushed to the outputByteStream.
private int L
Byte flushed to the output ByteStream.
private int[][] statesMPS
Array index is the context and the State [context][0] or MPS [context][1]. It must correspond to some stateTrans.
| Constructor Detail |
|---|
public MQDecoder()
public MQDecoder(ByteStream inputByteStream)
throws ErrorException
inputByteStream - the input stream of bytes
ErrorException - when end of ByteStream is reached| Method Detail |
|---|
public boolean decodeBit()
throws ErrorException
decodeBit in interface DecoderErrorException - when trying to read after the end of the inputByteStream
public boolean decodeBit(int context)
throws ErrorException
decodeBit in interface Decodercontext - a byte that indicates the context of the decoded bit
ErrorException - when trying to read after the end of the inputByteStream
private void fillLSB()
throws ErrorException
ErrorException - when trying to read after the end of the inputByteStreampublic void swapInputByteStream(ByteStream inputByteStream)
swapInputByteStream in interface DecoderinputByteStream - the input stream of bytespublic void reset()
Decoder
reset in interface Decoder
public void restart()
throws ErrorException
restart in interface DecoderErrorException - when end of ByteStream is reached
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||