CADI.Common.LogicalTarget.JPEG2000.Codestream
Class JPKMainHeaderDecoder

java.lang.Object
  extended by CADI.Common.LogicalTarget.JPEG2000.Codestream.JPKMainHeaderDecoder

public class JPKMainHeaderDecoder
extends java.lang.Object

This class reads a JPK heading from a file. Then, get functions can be used to retrieve read values. This class receives an input stream and advance read up to heading end. Usage example:
  construct
  run
  get functions

Version:
1.0.2 2008/11/08
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
private  int[] BDBlockHeights
          Definition in CODParameters.blockHeights
private  int BDBlockHeights_BITS
           
private  int[] BDBlockWidths
          Definition in CODParameters.blockWidths
private  int BDBlockWidths_BITS
           
private  int[][] BDResolutionPrecinctHeights
          Definition in CODParameters.precinctHeights
private  int BDResolutionPrecinctHeights_BITS
           
private  int[][] BDResolutionPrecinctWidths
          Definition in CODParameters.precinctWidths
private  int BDResolutionPrecinctWidths_BITS
           
private  int BitStreamType
          Bitstream type.
private  int BitStreamType_BITS
           
private  int[] CTComponents
          Definition in CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#CTComponents
private  int CTComponents_BITS
           
private  int CTType
          Definition in CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#CTType
private  int CTType_BITS
           
private  int[] DBitPlaneEncodingSA
          Definition in JPKParameters.bitPlaneEncodingSA
private  int DBitPlaneEncodingSA_BITS
           
private  int DPCMRestartIndex
          Definition in JPKParameters.DPCMRestartIndex
private  int DPCMRestartIndex_BITS
           
private  int[] DWaveletSA
          Definition in JPKParameters.waveletSA
private  int DWaveletSA_BITS
           
private  boolean[] FWPacketHeaders
          Definition in CODParameters.useSOP and CODParameters.useEPH.
private  int FWProgressionOrder
          Definition in CODParameters.progressionOrder
private  int FWProgressionOrder_BITS
           
private  BufferedDataInputStream in
          Definition in JPEG2KLogicalTarget.in
private  JPCParameters jpcParameters
          Is an object where the main header are saved.
private  BitStream JPKHeading
          Temporal bitstream where the values are saved from the file.
private  int LCAchievedNumLayers
          Definition in CODParameters.numLayers
private  int LCAchievedNumLayers_BITS
           
private  boolean[] LSComponents
          Definition in JPKParameters.LSComponents
private  boolean[] LSSignedComponents
          Definition in SIZParameters.signed
private  int[] LSSubsValues
          Definition in JPKParameters.LSSubsValues
private  int LSSubsValues_BITS
           
private  int LSType
          Definition in JPKParameters.LSType
private  int LSType_BITS
           
private  long mainHeaderInitialPos
          Is the file pointer to the first byte of the main header.
private  int mainHeaderLength
          Is the length of the main header.
private  int[] QComponentsBits
          Definition in SIZParameters.precision
private  int QComponentsBits_BITS
           
private  int QDynamicRange
          Definition in JPKParameters.QDynamicRange
private  int QDynamicRange_BITS
           
private  int[][][] QExponents
          Definition in QCDParameters.QExponents
private  int QExponents_BITS
           
private  int QGuardBits
          Definition in QCDParameters.QGuardBits
private  int QGuardBits_BITS
           
private  int[][][] QMantisas
          Definition in QCDParameters.QMantisas
private  int QMantisas_BITS
           
private  int[] QTypes
          Definition in QCDParameters.QTypes
private  int QTypes_BITS
           
private  int[] RBitplanesScaling
          Definition in JPKParameters.RBitplanesScaling
private  int RBitplanesScaling_BITS
           
private  float[] RMMultValues
          Definition in JPKParameters.RMMultValues
private  int[] RroisParameters
          Definition in JPKParameters.RroisParameters
private  int RroisParameters_BITS
           
private  int RroiType
          Definition in JPKParameters.RroiType
private  int RroiType_BITS
           
private  int WSL
          Definition in JPKParameters.WSL
private  int WSL_BITS
           
private  int WST
          Definition in JPKParameters.WST
private  int WST_BITS
           
private  int WT3D
          Definition in JPKParameters.WT3D
private  int WT3D_BITS
           
private  int[] WTLevels
          Definition in CODParameters.WTLevels
private  int WTLevels_BITS
           
private  int[] WTTypes
          Definition in CODParameters.WTTypes
private  int WTTypes_BITS
           
private  int xSize
          Definition in SIZParameters.xSize
private  int xSize_BITS
           
private  int ySize
          Definition in SIZParameters.ySize
private  int ySize_BITS
           
private  int zSize
          Definition in SIZParameters.zSize
private  int zSize_BITS
           
 
Constructor Summary
JPKMainHeaderDecoder(BufferedDataInputStream in)
          Constructor of JPKDeheading.
 
Method Summary
 JPCParameters getJPCParameters()
          Returns the jpcParameters attribute.
 long getMainHeaderInitialPos()
          Returns the mainHeaderInitialPos attribute.
 int getMainHeaderLength()
          Returns the mainHeaderLength attribute.
private  boolean readBoolean()
          Reads a boolean from the file and returns its value.
private  int readByte()
          Reads a byte from the file and returns its value.
private  float readFloat()
          Reads a float from the file and returns its value.
private  int readInteger(int numBits)
          Reads an integer from the file and returns its value.
 void run()
          Reads the JPK heading.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jpcParameters

private JPCParameters jpcParameters
Is an object where the main header are saved.


mainHeaderInitialPos

private long mainHeaderInitialPos
Is the file pointer to the first byte of the main header.


mainHeaderLength

private int mainHeaderLength
Is the length of the main header.


zSize

private int zSize
Definition in SIZParameters.zSize


zSize_BITS

private final int zSize_BITS
See Also:
Constant Field Values

ySize

private int ySize
Definition in SIZParameters.ySize


ySize_BITS

private final int ySize_BITS
See Also:
Constant Field Values

xSize

private int xSize
Definition in SIZParameters.xSize


xSize_BITS

private final int xSize_BITS
See Also:
Constant Field Values

LSType

private int LSType
Definition in JPKParameters.LSType


LSType_BITS

private final int LSType_BITS
See Also:
Constant Field Values

LSComponents

private boolean[] LSComponents
Definition in JPKParameters.LSComponents


LSSubsValues

private int[] LSSubsValues
Definition in JPKParameters.LSSubsValues


LSSubsValues_BITS

private final int LSSubsValues_BITS
See Also:
Constant Field Values

LSSignedComponents

private boolean[] LSSignedComponents
Definition in SIZParameters.signed


RMMultValues

private float[] RMMultValues
Definition in JPKParameters.RMMultValues


CTType

private int CTType
Definition in CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#CTType


CTType_BITS

private final int CTType_BITS
See Also:
Constant Field Values

CTComponents

private int[] CTComponents
Definition in CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#CTComponents


CTComponents_BITS

private final int CTComponents_BITS
See Also:
Constant Field Values

WTTypes

private int[] WTTypes
Definition in CODParameters.WTTypes


WTTypes_BITS

private final int WTTypes_BITS
See Also:
Constant Field Values

WTLevels

private int[] WTLevels
Definition in CODParameters.WTLevels


WTLevels_BITS

private final int WTLevels_BITS
See Also:
Constant Field Values

WT3D

private int WT3D
Definition in JPKParameters.WT3D


WT3D_BITS

private final int WT3D_BITS
See Also:
Constant Field Values

WSL

private int WSL
Definition in JPKParameters.WSL


WSL_BITS

private final int WSL_BITS
See Also:
Constant Field Values

WST

private int WST
Definition in JPKParameters.WST


WST_BITS

private final int WST_BITS
See Also:
Constant Field Values

QTypes

private int[] QTypes
Definition in QCDParameters.QTypes


QTypes_BITS

private final int QTypes_BITS
See Also:
Constant Field Values

QDynamicRange

private int QDynamicRange
Definition in JPKParameters.QDynamicRange


QDynamicRange_BITS

private final int QDynamicRange_BITS
See Also:
Constant Field Values

QComponentsBits

private int[] QComponentsBits
Definition in SIZParameters.precision


QComponentsBits_BITS

private final int QComponentsBits_BITS
See Also:
Constant Field Values

QExponents

private int[][][] QExponents
Definition in QCDParameters.QExponents


QExponents_BITS

private final int QExponents_BITS
See Also:
Constant Field Values

QMantisas

private int[][][] QMantisas
Definition in QCDParameters.QMantisas


QMantisas_BITS

private final int QMantisas_BITS
See Also:
Constant Field Values

QGuardBits

private int QGuardBits
Definition in QCDParameters.QGuardBits


QGuardBits_BITS

private final int QGuardBits_BITS
See Also:
Constant Field Values

BDBlockWidths

private int[] BDBlockWidths
Definition in CODParameters.blockWidths


BDBlockWidths_BITS

private final int BDBlockWidths_BITS
See Also:
Constant Field Values

BDBlockHeights

private int[] BDBlockHeights
Definition in CODParameters.blockHeights


BDBlockHeights_BITS

private final int BDBlockHeights_BITS
See Also:
Constant Field Values

BDResolutionPrecinctWidths

private int[][] BDResolutionPrecinctWidths
Definition in CODParameters.precinctWidths


BDResolutionPrecinctWidths_BITS

private final int BDResolutionPrecinctWidths_BITS
See Also:
Constant Field Values

BDResolutionPrecinctHeights

private int[][] BDResolutionPrecinctHeights
Definition in CODParameters.precinctHeights


BDResolutionPrecinctHeights_BITS

private final int BDResolutionPrecinctHeights_BITS
See Also:
Constant Field Values

LCAchievedNumLayers

private int LCAchievedNumLayers
Definition in CODParameters.numLayers


LCAchievedNumLayers_BITS

private final int LCAchievedNumLayers_BITS
See Also:
Constant Field Values

BitStreamType

private int BitStreamType
Bitstream type.

Bitstreams can be:


BitStreamType_BITS

private final int BitStreamType_BITS
See Also:
Constant Field Values

FWProgressionOrder

private int FWProgressionOrder
Definition in CODParameters.progressionOrder


FWProgressionOrder_BITS

private final int FWProgressionOrder_BITS
See Also:
Constant Field Values

FWPacketHeaders

private boolean[] FWPacketHeaders
Definition in CODParameters.useSOP and CODParameters.useEPH.


DWaveletSA

private int[] DWaveletSA
Definition in JPKParameters.waveletSA


DWaveletSA_BITS

private final int DWaveletSA_BITS
See Also:
Constant Field Values

DBitPlaneEncodingSA

private int[] DBitPlaneEncodingSA
Definition in JPKParameters.bitPlaneEncodingSA


DBitPlaneEncodingSA_BITS

private final int DBitPlaneEncodingSA_BITS
See Also:
Constant Field Values

RroiType

private int RroiType
Definition in JPKParameters.RroiType


RroiType_BITS

private final int RroiType_BITS
See Also:
Constant Field Values

RroisParameters

private int[] RroisParameters
Definition in JPKParameters.RroisParameters


RroisParameters_BITS

private final int RroisParameters_BITS
See Also:
Constant Field Values

RBitplanesScaling

private int[] RBitplanesScaling
Definition in JPKParameters.RBitplanesScaling


RBitplanesScaling_BITS

private final int RBitplanesScaling_BITS
See Also:
Constant Field Values

DPCMRestartIndex

private int DPCMRestartIndex
Definition in JPKParameters.DPCMRestartIndex


DPCMRestartIndex_BITS

private final int DPCMRestartIndex_BITS
See Also:
Constant Field Values

in

private BufferedDataInputStream in
Definition in JPEG2KLogicalTarget.in


JPKHeading

private BitStream JPKHeading
Temporal bitstream where the values are saved from the file.

Content is a buffer of bits.

Constructor Detail

JPKMainHeaderDecoder

public JPKMainHeaderDecoder(BufferedDataInputStream in)
Constructor of JPKDeheading. It receives the information about the compressed image needed to be put in JPKHeading.

Parameters:
in - definition in in
Method Detail

run

public void run()
         throws ErrorException
Reads the JPK heading.

Throws:
ErrorException - when some I/O error occurs

getJPCParameters

public JPCParameters getJPCParameters()
Returns the jpcParameters attribute.

Returns:
the jpcParameters attribute

getMainHeaderInitialPos

public long getMainHeaderInitialPos()
Returns the mainHeaderInitialPos attribute.

Returns:
the mainHeaderInitialPos attribute.

getMainHeaderLength

public int getMainHeaderLength()
Returns the mainHeaderLength attribute.

Returns:
the mainHeaderLength attribute.

readBoolean

private boolean readBoolean()
                     throws ErrorException
Reads a boolean from the file and returns its value.

Returns:
the boolean read
Throws:
ErrorException - when some wrong bitstream or I/O operation occurs

readInteger

private int readInteger(int numBits)
                 throws ErrorException
Reads an integer from the file and returns its value.

Parameters:
numBits - the number of bits of the integer
Returns:
the integer read
Throws:
ErrorException - when some wrong bitstream or I/O operation occurs

readFloat

private float readFloat()
                 throws ErrorException
Reads a float from the file and returns its value.

Returns:
the float read
Throws:
ErrorException - when some wrong bitstream or I/O operation occurs

readByte

private int readByte()
              throws ErrorException
Reads a byte from the file and returns its value.

Returns:
the byte readed
Throws:
ErrorException - when some wrong bitstream or I/O operation occurs


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)