habibviewer.jpeg2000
Class Decoder

java.lang.Object
  extended by habibviewer.jpeg2000.Decoder
All Implemented Interfaces:
java.lang.Runnable

public class Decoder
extends java.lang.Object
implements java.lang.Runnable

This class is alteration of the main class of JJ2000's decoder. It instantiates all objects and performs the decoding operations. It then writes the image to the output file or displays it.

First the decoder should be initialized with a input file name and loading parameters given through the constructor. When the run() method is invoked the decoder executes. The exit code of the class can be obtained with the getExitCode() method, after the constructor and after the run method. A non-zero value indicates that an error has ocurred.

The decoding chain corresponds to the following sequence of modules:

The behaviour of each module may be modified according to the current tile-component. All the specifications are kept in modules extending ModuleSpec and accessible through an instance of DecoderSpecs class.

See Also:
BitstreamReaderAgent, EntropyDecoder, ROIDeScaler, Dequantizer, InverseWT, ImgDataConverter, InvCompTransf, BlkImgDataSrcImageProducer, ModuleSpec, DecoderSpecs

Field Summary
 jj2000.j2k.image.BlkImgDataSrc decodedImage
          Decoded image
 java.lang.String errorMessage
          Error output stream
 int nCompCod
          Number of Components in codestream
 int nLayers
          Number of layers
 int nTiles
          Number of tiles
 int reconstructedImageHeight
          Reconstructed image height
 int reconstructedImageWidth
          Reconstructed image width
 int reconstructedResolutionLevel
          Reconstructed resolution level
 float targetBitrate
          Target bitrate
 int targetImageHeight
          Target image height
 int targetImageWidth
          Target image width
 int targetResolutionLevel
          Target resolution level
 int tileHeight
          Tile height
 int tileWidth
          Tile width
 
Constructor Summary
Decoder(jj2000.disp.ImgScrollPane isp, java.lang.String inputFile, float rate, int nbytes, int layers, int bitplanes, int codeblocks)
          Instantiates a decoder object, with the input file name string given as argument, a component where to display the image and decoding parameters, like target bitrate, number of layers, number of bit planes and number of code blocks.
 
Method Summary
 java.lang.String[] getCOMInfo()
          Return the information found in the COM marker segments encountered in the decoded codestream.
 int getExitCode()
          Returns the exit code of the class.
 void run()
          Runs the decoder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

errorMessage

public java.lang.String errorMessage
Error output stream


decodedImage

public jj2000.j2k.image.BlkImgDataSrc decodedImage
Decoded image


nLayers

public int nLayers
Number of layers


nCompCod

public int nCompCod
Number of Components in codestream


nTiles

public int nTiles
Number of tiles


targetImageWidth

public int targetImageWidth
Target image width


targetImageHeight

public int targetImageHeight
Target image height


tileWidth

public int tileWidth
Tile width


tileHeight

public int tileHeight
Tile height


reconstructedResolutionLevel

public int reconstructedResolutionLevel
Reconstructed resolution level


targetResolutionLevel

public int targetResolutionLevel
Target resolution level


reconstructedImageWidth

public int reconstructedImageWidth
Reconstructed image width


reconstructedImageHeight

public int reconstructedImageHeight
Reconstructed image height


targetBitrate

public float targetBitrate
Target bitrate

Constructor Detail

Decoder

public Decoder(jj2000.disp.ImgScrollPane isp,
               java.lang.String inputFile,
               float rate,
               int nbytes,
               int layers,
               int bitplanes,
               int codeblocks)
Instantiates a decoder object, with the input file name string given as argument, a component where to display the image and decoding parameters, like target bitrate, number of layers, number of bit planes and number of code blocks.

Parameters:
isp - The component where the image is to be displayed
inputFile - Name of the input file
rate - Decoding rate in bits per pixel
nbytes - Decoding rate in bytes
layers - Maximum number of layers to decode for any code-block
bitplanes - Maximum number of bit planes to decode for any code-block
codeblocks - Maximum number of code-blocks
Method Detail

getExitCode

public int getExitCode()
Returns the exit code of the class. This is only initialized after the constructor and when the run method returns.

Returns:
The exit code of the constructor and the run() method.

run

public void run()
Runs the decoder. After completion the exit code is set, a non-zero value indicates that an error ocurred.

Specified by:
run in interface java.lang.Runnable
See Also:
getExitCode()

getCOMInfo

public java.lang.String[] getCOMInfo()
Return the information found in the COM marker segments encountered in the decoded codestream.