CADI.Common.LogicalTarget.JPEG2000.Codestream
Class JPCMainHeaderDecoder

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

public class JPCMainHeaderDecoder
extends java.lang.Object

This class reads the JPEG2000 code-stream main header and decodes it. An input stream object is passed to, and it reads the global information neccesary to decompress the image.

Version:
1.1.3 2008/11/16
Author:
Group on Interactive Coding of Images (GICI)

Field Summary
(package private)  int[] definedPrecincts
          Tells if precincts are defined within the headers or not (1 or 0).
private  BufferedDataInputStream in
          Is an object with the input stream where the main header is read from.
private  JPCParameters jpcParameters
          Is an object where the main header are saved.
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.
(package private)  boolean markerFound
          To know if a marker has been found.
 
Constructor Summary
JPCMainHeaderDecoder(BufferedDataInputStream in)
           
 
Method Summary
 JPCParameters getJPCParameters()
          This function returns the JPC codestream parameters.
 long getMainHeaderInitialPos()
          Returns the first position of the main header first byte in the image codestream.
 int getMainHeaderLength()
          Returns the length of the main header.
private  void readCBD()
           
private  void readCOC()
          Reads a COD/COC marker segment and retrieves the parameters contained.
private  void readCOD()
          Reads a COD marker segment and retrieves the parameters contained.
 void readCOM()
           
private  void readMCC()
          Reads the MCC marker.
private  void readMCO()
          Reads the MCO marker.
private  void readMCT()
           
private  void readQCC()
          Reads a QCD/QCC marker segment and retrieves the parameters contained.
private  void readQCD()
          Reads a QCD/QCC marker segment and retrieves the parameters contained.
private  void readSIZ()
          Reads the SIZ marker segment and retrieves the parameters contained.
private  void readSOC()
          Reads the SOC marker.
 void run()
          Reads the J2C file headers and retrieves the parameters contained.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

in

private BufferedDataInputStream in
Is an object with the input stream where the main header is read from.


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.


definedPrecincts

int[] definedPrecincts
Tells if precincts are defined within the headers or not (1 or 0).

Index in the array is component index


markerFound

boolean markerFound
To know if a marker has been found.

Constructor Detail

JPCMainHeaderDecoder

public JPCMainHeaderDecoder(BufferedDataInputStream in)
Parameters:
in -
Method Detail

run

public void run()
         throws ErrorException
Reads the J2C file headers and retrieves the parameters contained.

Throws:
ErrorException - when the header information is ambiguous or incorrect

getMainHeaderInitialPos

public long getMainHeaderInitialPos()
Returns the first position of the main header first byte in the image codestream.

Returns:
The position of the main header first byte.

getMainHeaderLength

public int getMainHeaderLength()
Returns the length of the main header.

Returns:
The length of the main header.

getJPCParameters

public JPCParameters getJPCParameters()
This function returns the JPC codestream parameters.

Returns:
jpcParameters definition in JPCParameters

readSOC

private void readSOC()
              throws ErrorException,
                     java.io.IOException
Reads the SOC marker.

Throws:
ErrorException - when the SOC marker is not unique in the codestream
java.io.IOException

readSIZ

private void readSIZ()
              throws ErrorException,
                     java.io.IOException
Reads the SIZ marker segment and retrieves the parameters contained.

Throws:
ErrorException - when the SIZ marker or its marker segment is ambiguous or incorrect
java.io.IOException

readCOD

private void readCOD()
              throws ErrorException,
                     java.io.IOException
Reads a COD marker segment and retrieves the parameters contained.

Throws:
ErrorException - when the COD marker segment is ambiguous or incorrect
java.io.IOException

readCOC

private void readCOC()
              throws ErrorException,
                     java.io.IOException
Reads a COD/COC marker segment and retrieves the parameters contained.

Throws:
ErrorException - when the COD/COC marker segment is ambiguous or incorrect
java.io.IOException

readQCD

private void readQCD()
              throws ErrorException,
                     java.io.IOException
Reads a QCD/QCC marker segment and retrieves the parameters contained.

Throws:
ErrorException - when the QCD/QCC marker segment is ambiguous or incorrect
java.io.IOException

readQCC

private void readQCC()
              throws ErrorException,
                     java.io.IOException
Reads a QCD/QCC marker segment and retrieves the parameters contained.

Throws:
ErrorException - when the QCD/QCC marker segment is ambiguous or incorrect
java.io.IOException

readCOM

public void readCOM()
             throws ErrorException,
                    java.io.IOException
Throws:
ErrorException
java.io.IOException

readCBD

private void readCBD()
              throws ErrorException,
                     java.io.IOException
Throws:
ErrorException
java.io.IOException

readMCT

private void readMCT()
              throws ErrorException,
                     java.io.IOException
Throws:
ErrorException
java.io.IOException

readMCC

private void readMCC()
              throws ErrorException,
                     java.io.IOException
Reads the MCC marker.

Throws:
ErrorException
java.io.IOException

readMCO

private void readMCO()
              throws ErrorException,
                     java.io.IOException
Reads the MCO marker.

Throws:
ErrorException
java.io.IOException


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)