|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectCADI.Common.LogicalTarget.JPEG2000.Decode.BPEDecoder
public class BPEDecoder
This class receives an array of ByteStreams belonging to a code-block and decodes them obtaining the original image samples. Typically it is used in the following way:
constructor(receiveing the bytestreams)
runAll
getBlockSamples
You can also use this class to increasingly decode the coding passes: you only have to use the decodeNextCodingPass function as times as coding passes contains the code-block.
ATTENTION: In the framework of the JPEG2000 many different code-blocks have to be encoded. It is more efficient to create only one object of this class and change the code-block:
constructor(void)
swapCodeBlock
runAll
getBlockSamples
swapCodeBlock
runAll
getBlockSamples
...
(of course, the function runAll can be substituted for multiple call of the decodeNextCodingPass function) If this class is used in this last way it is easy to incorporate a multithreading support for the decoding of code-blocks.
Since version 1.3 this class uses an optimized way to calculate coefficient contexts. Although it achieves good results in terms of computational complexity, the source code is not very understandable (when computing the coefficient contexts). File BPEDecoder.java.1_2 contains the 1.2 version of this class, that has a more understandable source code. Apart of this, both classes are exactly equal.
| Field Summary | |
|---|---|
private Decoder |
blockDecoder
Decoder to read from the inputByteStream. |
private int[][] |
blockSamples
Original block samples (index meaning [y][x]). |
private ByteStream[][] |
CDByteStreams
ByteStreams generated by the fractional bit plane coding (index meaning [bitPlane][0(SPP),1(MRP),2(CP)] -bitPlane==0 is MSBP-). |
private byte[][] |
contextMap
Map where the contexts of the coefficients are stored. |
private int |
currentBitPlane
Current bit plane encoded. |
private int |
currentCodingPass
Current coding pass encoded. |
private int |
currentMaskBitPlane
Current mask of the bit plane. |
private int |
maskBitPlaneBefore
Mask of the currentBitPlane - 1. |
private int |
MSBPlane
Most Significance Bit Plane found in the block. |
private int |
numBitsRunModeBreak
Number of bits needed to flush the singificant coefficient in the stripe (used when the run mode is broken). |
private int |
stripeHeight
Stripe height. |
private int |
subband
Image WT subband. |
private int |
xSize
Definition in SIZParameters.xSize |
private int |
ySize
Definition in SIZParameters.ySize |
| Constructor Summary | |
|---|---|
BPEDecoder()
Constructor that does not receive anything. |
|
BPEDecoder(ByteStream[][] CDByteStreams,
int[][] blockSamples,
int MSBPlane,
int subband)
Constructor that receives block coded bit streams, block sizes, most significant bit plane and block subband. |
|
| Method Summary | |
|---|---|
private void |
cleanupPass()
Cleanup pass of JPEG2000 decoding scheme. |
void |
decodeNextCodingPass()
Decodes the next coding pass. |
int[][] |
getBlockSamples()
|
private void |
magnitudeRefinementPass()
Magnitude refinement pass of JPEG2000 decoding scheme. |
void |
runAll()
Decode the image samples (all bit planes). |
private void |
signDecode(int x,
int y)
Calculates the bit sign and context from a sample (called when the sample becomes significant). |
private void |
significancePropagationPass()
Significance propagation pass of JPEG2000 decoding scheme. |
void |
swapCodeBlock(ByteStream[][] CDByteStreams,
int[][] blockSamples,
int MSBPlane,
int subband)
Swaps the code-block decoded by this class. |
private void |
updateMap(int x,
int y,
boolean CP)
Turn neighbourhoods map samples of (x,y) from 0 to 1 if they can be visited in the current scan. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private ByteStream[][] CDByteStreams
The content must be understood as a ByteStream.
private int[][] blockSamples
All values allowed.
private int ySize
SIZParameters.ySize
private int xSize
SIZParameters.xSize
private int subband
Valid values: 0(LL), 1(HL), 2(LH), 3(HH).
LL HL
LH HH
private int MSBPlane
Negative values not allowed.
private byte[][] contextMap
The value means the context of the sample. Valid contexts are: 0 - 8 when the coefficient is still non-significant, 15 - 17 when the coefficient is significant and it is going to be refined. These values can be positive or negative to indicate if they have to be visited by the significancePropoagationPass or cleanupPass functions. SPP only visits coefficients with contexts > 0 and <= 8, CP only visits coefficients with contexts >= -8 <= 0.
private int currentBitPlane
0 is the Less Significant Bit Plane.
private int currentCodingPass
0 is the SPP, 1 is MRP, and 2 is CP.
private int currentMaskBitPlane
The content is 2^currentBitPlane
private int maskBitPlaneBefore
The content is 2^(currentBitPlane-1)
private Decoder blockDecoder
This Decoder must be compatible with the abstract class Decoder.
private final int stripeHeight
Negative values not allowed for this field.
private final int numBitsRunModeBreak
This should be log_2(stripeHeight)
| Constructor Detail |
|---|
public BPEDecoder()
throws ErrorException
ErrorException
public BPEDecoder(ByteStream[][] CDByteStreams,
int[][] blockSamples,
int MSBPlane,
int subband)
throws ErrorException
CDByteStreams - definition in CDByteStreamsblockSamples - definition in blockSamplesMSBPlane - definition in MSBPlanesubband - definition in subband
ErrorException - problems with the inputByteStream| Method Detail |
|---|
public void swapCodeBlock(ByteStream[][] CDByteStreams,
int[][] blockSamples,
int MSBPlane,
int subband)
throws ErrorException
CDByteStreams - definition in CDByteStreamsblockSamples - definition in blockSamplesMSBPlane - definition in MSBPlanesubband - definition in subband
ErrorException - problems with the inputByteStream
public void runAll()
throws WarningException,
ErrorException
WarningException - when reached the last coding pass
ErrorException - problems with the inputByteStream
public void decodeNextCodingPass()
throws WarningException,
ErrorException
WarningException - when reached the last coding pass
ErrorException - problems with the inputByteStream
private void signDecode(int x,
int y)
throws ErrorException
x - position of the sampley - position of the sample
ErrorException - when end of bitstream is reached
private void significancePropagationPass()
throws ErrorException
ErrorException - when end of bitstream reached
private void magnitudeRefinementPass()
throws ErrorException
ErrorException - when end of bitstream reached
private void cleanupPass()
throws ErrorException
ErrorException - when end of bitstream reached
private void updateMap(int x,
int y,
boolean CP)
x - x position of the sampley - y position of the sampleCP - indicates if the updating is performed by the Cleanup Pass (true, otherwise false)public int[][] getBlockSamples()
blockSamples
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||