CADI.Client.ClientLogicalTarget.JPEG2000
Class JPEG2KDecoder

java.lang.Object
  extended by CADI.Client.ClientLogicalTarget.JPEG2000.JPEG2KDecoder

public class JPEG2KDecoder
extends java.lang.Object

This class implements the JPEG2000 decoder engine.

If this class has to be called to decode several WOIs of the same image, this class is ready to be called without destroing and creating a new object. It is more efficient to create the object and call necessary times to the decode(ViewWindowField, Hashtable, Hashtable) method. In this case, the three-dimensional array returned by the decode(ViewWindowField, Hashtable, Hashtable) method with the decompresed WOI cannot be destroied because it will be re-used in the next call.

Usage example:
  constructor
  decode

Version:
1.3.1 2008/12/13
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  int[][] blocksPerPrecinctHeights
          Definition in GenerateImageStructure.blocksPerPrecinctHeights
private  int[][] blocksPerPrecinctWidths
          Definition in GenerateImageStructure.blocksPerPrecinctWidths
private  int[] componentIndexes
          Is an one-dimensional array with the component indexes which belong to the WOI.
private  float[][][] imageSamplesFloat
          Temporal structure.
private  int[][][] imageSamplesInt
          Temporal structure.
private  long initStageTime
          Used for verbose information (time for stage).
private  long initTime
          Used for verbose information (total time).
private  JPCParameters jpcParameters
          Definition in JPEG2KLogicalTarget.jpcParameters.
private  java.util.Hashtable<java.lang.Long,ByteStream[][][][]> precinctsByteStreams
          Definition in JPEG2KLogicalTarget.precinctsByteStreams.
private static float Q_RECONSTRUCTION
          Reconstruction parameter used to adjust better the dequantitzation process (when QTypes == 1).
private  int[] QComponentsBits
          Definition in SIZParameters.precision
private static int RC_TYPE
          Range type to apply.
private  ViewWindowField viewWindow
          Definition in JPEG2KLogicalTarget.viewWindow.
private  int[] WTLevels
          Definition in CODParameters.WTLevels
private  int[] WTTypes
          Definition in CODParameters.WTTypes
private  java.util.Hashtable<java.lang.Long,int[][][]> zeroBitPlanes
          Definition in JPEG2KLogicalTarget.zeroBitPlanes.
private  int zSize
          Definition in SIZParameters.zSize
 
Constructor Summary
JPEG2KDecoder(JPCParameters jpcParameters, int[][] blocksPerPrecinctWidths, int[][] blocksPerPrecinctHeights)
          Constructor.
 
Method Summary
 float[][][] decode(ViewWindowField viewWindow, java.util.Hashtable<java.lang.Long,ByteStream[][][][]> precinctsByteStreams, java.util.Hashtable<java.lang.Long,int[][][]> zeroBitPlanes)
          Decodes the WOI.
private  int[] getRelevantComponents(int[][] comps)
          Calculates which are the necessary components to invert a multiple component transformation.
 void list(java.io.PrintStream out)
          Prints this JPEG2K Decoder fields out to the specified output stream.
private  float[][][] run()
          Performs the WOI decoding.
private  void setParameters(ViewWindowField viewWindow, java.util.Hashtable<java.lang.Long,ByteStream[][][][]> precinctsByteStreams, java.util.Hashtable<java.lang.Long,int[][][]> zeroBitPlanes)
          Sets the parameters to decode the WOI.
private  void showDecodedImage()
          For debugging purposes.
private  void showDequantizedImage()
           
private  void showDetransformedImage()
          For debugging purposes.
private  void showTimeMemory(java.lang.String stage)
          Show some time and memory usage statisticals.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

jpcParameters

private JPCParameters jpcParameters
Definition in JPEG2KLogicalTarget.jpcParameters.


blocksPerPrecinctWidths

private int[][] blocksPerPrecinctWidths
Definition in GenerateImageStructure.blocksPerPrecinctWidths


blocksPerPrecinctHeights

private int[][] blocksPerPrecinctHeights
Definition in GenerateImageStructure.blocksPerPrecinctHeights


viewWindow

private ViewWindowField viewWindow
Definition in JPEG2KLogicalTarget.viewWindow.


precinctsByteStreams

private java.util.Hashtable<java.lang.Long,ByteStream[][][][]> precinctsByteStreams
Definition in JPEG2KLogicalTarget.precinctsByteStreams.


zeroBitPlanes

private java.util.Hashtable<java.lang.Long,int[][][]> zeroBitPlanes
Definition in JPEG2KLogicalTarget.zeroBitPlanes.


Q_RECONSTRUCTION

private static final float Q_RECONSTRUCTION
Reconstruction parameter used to adjust better the dequantitzation process (when QTypes == 1).

Recommened values between 0 to 1.

See Also:
Constant Field Values

RC_TYPE

private static final int RC_TYPE
Range type to apply.

Valid values are:

See Also:
Constant Field Values

zSize

private int zSize
Definition in SIZParameters.zSize


componentIndexes

private int[] componentIndexes
Is an one-dimensional array with the component indexes which belong to the WOI.


WTTypes

private int[] WTTypes
Definition in CODParameters.WTTypes


WTLevels

private int[] WTLevels
Definition in CODParameters.WTLevels


QComponentsBits

private int[] QComponentsBits
Definition in SIZParameters.precision


imageSamplesFloat

private float[][][] imageSamplesFloat
Temporal structure.


imageSamplesInt

private int[][][] imageSamplesInt
Temporal structure.


initStageTime

private long initStageTime
Used for verbose information (time for stage).

0 is initial time.


initTime

private long initTime
Used for verbose information (total time).

0 is initial time.

Constructor Detail

JPEG2KDecoder

public JPEG2KDecoder(JPCParameters jpcParameters,
                     int[][] blocksPerPrecinctWidths,
                     int[][] blocksPerPrecinctHeights)
Constructor.

Parameters:
jpcParameters - definition in jpcParameters.
blocksPerPrecinctWidths - definition in blocksPerPrecinctWidths.
blocksPerPrecinctHeights - definition in blocksPerPrecinctHeights.
Method Detail

decode

public float[][][] decode(ViewWindowField viewWindow,
                          java.util.Hashtable<java.lang.Long,ByteStream[][][][]> precinctsByteStreams,
                          java.util.Hashtable<java.lang.Long,int[][][]> zeroBitPlanes)
                   throws ErrorException
Decodes the WOI.

Parameters:
viewWindow - definition in viewWindow.
precinctsByteStreams - definition in precinctsByteStreams.
zeroBitPlanes - definition in zeroBitPlanes.
Returns:
definition in imageSamplesFloat.
Throws:
ErrorException - when a error has been found in an stage of the JPEG2000 decoding process.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

list

public void list(java.io.PrintStream out)
Prints this JPEG2K Decoder fields out to the specified output stream. This method is useful for debugging.

Parameters:
out - an output stream.

setParameters

private void setParameters(ViewWindowField viewWindow,
                           java.util.Hashtable<java.lang.Long,ByteStream[][][][]> precinctsByteStreams,
                           java.util.Hashtable<java.lang.Long,int[][][]> zeroBitPlanes)
Sets the parameters to decode the WOI.

Parameters:
viewWindow - definition in viewWindow.
precinctsByteStreams - definition in precinctsByteStreams.
zeroBitPlanes - definition in zeroBitPlanes.

run

private float[][][] run()
                 throws ErrorException
Performs the WOI decoding.

Returns:
definition in imageSamplesFloat.
Throws:
ErrorException - when an error has been ocurred in an stage of the JPEG2000 decoding process.

getRelevantComponents

private int[] getRelevantComponents(int[][] comps)
                             throws ErrorException
Calculates which are the necessary components to invert a multiple component transformation. compsRanges the range of components to be decompressed. The first index is an array index of the ranges. An the second index indicates: 0 is the first component of the range, and 1 is the last component of the range.

Returns:
an one-dimensional array with required components to inver the multiple component transform.
Throws:
ErrorException

showTimeMemory

private void showTimeMemory(java.lang.String stage)
Show some time and memory usage statisticals.

Parameters:
stage - string that will be displayed

showDequantizedImage

private void showDequantizedImage()

showDetransformedImage

private void showDetransformedImage()
For debugging purposes.


showDecodedImage

private void showDecodedImage()
For debugging purposes.



CADI - Copyright (C) 2007
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

Group on Interactive Coding of Images (GICI) (contact)