habibviewer.jpeg2000
Class Encoder

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

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

This class is the main class of JJ2000's encoder. It instantiates all objects of the chain and launchs the encoding process. It then writes the header and the compressed bit stream to the output file. Finally, packed packet headers (through codestream post-manipulation) and file-format may be created if needed.

First the encoder should be initialized with a ParameterList object provided through the constructor. Then, the run() method is invoked and the encoder 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 occurred.

The modules are inserted in the encoding chain with the following order:

The encoder uses a pull model. This means that the last module (PostCompRateAllocator) requests data from its source (EntropyCoder), ...

Writing of the codestream writing (header+bit stream) is realized by HeaderEncoder and CodestreamWriter modules.

Packed packet headers and file-format creation are carried out by CodestreamManipulator and FileFormatWriter modules respectively.

Many modules of the encoder may behave differently depending on the tile-component. The specifications of their behaviour are kept in specialized modules extending ModuleSpec class. All these modules are accessible through an instance of EncoderSpecs class.

See Also:
ImgReader, ImgDataJoiner, ForwCompTransf, Tiler, ImgDataConverter, ForwardWT, Quantizer, ROIScaler, EntropyCoder, PostCompRateAllocator, HeaderEncoder, CodestreamWriter, CodestreamManipulator, FileFormatWriter, ModuleSpec, EncoderSpecs

Field Summary
 java.lang.String errorMessage
           
 int exitCode
          The exit code of the run method
static char[] vprfxs
          The valid list of options prefixes
 
Constructor Summary
Encoder(jj2000.j2k.image.BlkImgDataSrc imgSrc, java.lang.String outputFile, float bitrate, int layers)
          Instantiates an encoder object, width the ParameterList object given as argument.
 
Method Summary
 int getExitCode()
          Returns the exit code of the class.
 void run()
          Runs the encoder.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

exitCode

public int exitCode
The exit code of the run method


errorMessage

public java.lang.String errorMessage

vprfxs

public static final char[] vprfxs
The valid list of options prefixes

Constructor Detail

Encoder

public Encoder(jj2000.j2k.image.BlkImgDataSrc imgSrc,
               java.lang.String outputFile,
               float bitrate,
               int layers)
Instantiates an encoder object, width the ParameterList object given as argument. It also retrieves the default ParameterList.

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 encoder. 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()