public class JPEG2KCodestream
extends java.lang.Object
This class plays a main role because:
1) it is the root of a tree structure where tiles are the children,
components the grandchildren, and so on.
2) it records the default parameters for all the tile-components.
3) it can be inherited by other classes. Therefore, other classes can offer
another interface and add new features.
Usage example:
construct
getMethods
Modifier and Type | Field and Description |
---|---|
protected CBDParameters |
cbdParameters
Component bit depth (CBD).
|
protected java.util.HashMap<java.lang.Integer,COCParameters> |
cocParametersList
Coding style of component (COC).
|
protected CODParameters |
codParameters
Coding style default (COD).
|
protected COMParameters |
comParameters
Comments (COM).
|
protected int |
identifier
Records the codestream identifier.
|
protected JPKParameters |
jpkParameters
Wrapped used to store non-compliant parameters.
|
private int |
maxRLevels
Records the maximum number of resolution levels.
|
protected java.util.HashMap<java.lang.Integer,MCCParameters> |
mccParametersList
Multiple component transform collection (MCC).
|
protected MCOParameters |
mcoParameters
Multiple component transform ordering (MCO).
|
protected java.util.HashMap<java.lang.Integer,MCTParameters> |
mctParametersList
Multiple component transformation (MCT).
|
protected java.util.HashMap<java.lang.Integer,QCCParameters> |
qccParametersList
Quantization component (QCC).
|
protected QCDParameters |
qcdParameters
Quantization default (QCD).
|
protected SIZParameters |
sizParameters
Image and tile size parameters (SIZ).
|
protected java.util.HashMap<java.lang.Integer,JPEG2KTile> |
tiles
It is a hash table to store the tiles in which this codestream is divided.
|
Constructor and Description |
---|
JPEG2KCodestream(int identifier,
JPCParameters jpcParameters)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.util.ArrayList<java.lang.Integer> |
calculateRelevantTiles(ViewWindowField viewWindow,
int discardLevels)
Determines which tiles are relevant to the Window of Interest,
viewWindow . |
void |
calculateSupportRegion(int tile,
int component,
int rLevel,
CADIRectangle supportRegion,
int discardLevels)
This method calculates the offset and width of the support region taken
into account the DWT applied.
|
void |
createTile(int index)
Creates a new tile.
|
CADIDimension |
determineFrameSize(int discardLevels)
Determines the frame size when
discardLevels levels of the DWT
are discarded. |
void |
determineFrameSize(int discardLevels,
CADIDimension frameSize)
Determines the frame size when
discardLevels levels of the DWT
are discarded. |
int |
determineNumberOfDiscardLevels(int[] fsiz,
int roundDirection)
Determines the number of discard levels to be applied for achieving the
best fit of the
fsiz to an available frame size. |
long |
findInClassIdentifier(int tile,
int component,
int rLevel,
int precinct)
Returns a unique identifier for the tile-component-resolution level-
precinct.
|
java.util.ArrayList<java.lang.Long> |
findRelevantPrecincts(ViewWindowField actualViewWindow)
Determines which are the relevant precincts to the
viewWindow
when discardLevels DWT levels are discarded. |
java.util.ArrayList<java.lang.Long> |
findRelevantPrecincts(ViewWindowField viewWindow,
int discardLevels)
Determines which are the relevant precincts to the
viewWindow
when discardLevels DWT levels are discarded. |
java.util.ArrayList<java.lang.Long> |
findRelevantPrecinctsTRCP(ViewWindowField actualViewWindow,
int discardLevels)
Calculates which are the relevant precincts which belong to the WOI
(fsiz, roff, rsiz).
|
int[] |
findTCP(long inClassIdentifier)
Returns the tile-component-resolution level-precinct of the precinct
given by the unique identifier
inClassIdentifier . |
int[] |
findTCRP(long inClassIdentifier)
Returns the tile-component-resolution level-precinct of the precinct
given by the unique identifier
inClassIdentifier . |
int |
findTile(long inClassIdentifier)
Returns the index of the tile in which the precinct is located.
|
int |
getBlockHeight()
Returns the block height.
|
int |
getBlockHeight(int component)
Returns the block height for the component
component . |
int |
getBlockWidth()
Returns the block width.
|
int |
getBlockWidth(int component)
Returns the block width for the component
component . |
CBDParameters |
getCBDParameters() |
CODParameters |
getCODParameters() |
COMParameters |
getCOMParameters() |
int |
getExponent(int component,
int rLevel,
int subband)
Returns the exponent for the component
component , resolution
levelrLevel and subband subband . |
private static int |
getExtensionLength(int WTType,
int direction,
int sampleIndex) |
int |
getGuardBits(int component)
Returns the number of guard bits for the component
component . |
int |
getIdentifier()
Returns the
identifier attribute. |
CADIRectangle |
getImageArea()
Returns the bounds (offset and size) of the image area on the reference
grid.
|
JPCParameters |
getJPCParameters()
Returns the main header parameters.
|
JPKParameters |
getJPKParameters() |
int |
getMantisa(int component,
int rLevel,
int subband)
Returns the mantisa for the component
component , resolution
levelrLevel and subband subband . |
int |
getMaxResolutionLevels()
Returns the maximum number of resolutions levels for all tile-components.
|
java.util.HashMap<java.lang.Integer,MCCParameters> |
getMCCParameters() |
MCOParameters |
getMCOParameters() |
java.util.HashMap<java.lang.Integer,MCTParameters> |
getMCTParameters() |
int |
getMultiComponentTransform()
Returns the transform applied across the components, if it has been applied.
|
int |
getNumLayers()
Returns number of layers that the final codestream contains.
|
int |
getNumTiles()
Returns the maximum number of tiles.
|
int |
getNumTilesHigh()
Returns the number of tiles high (Y direction).
|
int |
getNumTilesWide()
Returns the number of tiles wide (X direction).
|
JPEG2KPrecinct |
getPrecinct(long inClassIdentifier)
Returns the precinct identified by the unique precinct identifer
inClassIdentifier . |
int |
getPrecinctHeights(int component,
int rLevel) |
int |
getPrecinctWidths(int component,
int rLevel) |
int |
getPrecision(int component)
Returns the number of bits per pixel for the component
component . |
java.util.HashMap<java.lang.Long,java.lang.Float> |
getPredictiveModel()
Returns the
COMParameters.predictiveModel attribute. |
int |
getProgressionOrder()
Returns the file progression order.
|
QCDParameters |
getQCDParameters() |
int |
getQuantizationStyle()
Returns the type of quantization applied.
|
int |
getRSize() |
SIZParameters |
getSIZParameters() |
JPEG2KTile |
getTile(int index)
Returns a the tile object
index . |
int |
getWTLevels()
Returns the number of levels of the Wavelet transform.
|
int |
getWTType()
Returns the type of Wavelet transform applied.
|
int |
getXOSize() |
int |
getXRsize(int component)
Returns the horizontal separation of sample of component
component
with respect to the reference grid. |
int |
getXSize() |
int |
getXTOSize() |
int |
getXTSize() |
int |
getYOSize() |
int |
getYRsize(int component)
Returns the vertical separation of sample of component
component
with respect to the reference grid. |
int |
getYSize() |
int |
getYTOSize() |
int |
getYTSize() |
int |
getZSize() |
boolean |
isBypass(int component)
Check if the bypass flag is active.
|
boolean |
isCausal(int component)
Check if the causal flag is active.
|
boolean |
isErterm(int component)
Check if the erterm flag is active.
|
boolean |
isReset(int component)
Check if the reset flag is active.
|
boolean |
isRestart(int component)
Check if the restart flag is active.
|
boolean |
isSegmark(int component)
Check if the segmark flag is active.
|
boolean |
isSigned(int component)
Check if the component
component is signed. |
void |
list(java.io.PrintStream out)
Prints this Server JPEG2K Codestream out to the specified output stream.
|
void |
listParameters(java.io.PrintStream out)
This method is similar to
list(PrintStream) but it only output
the parameters. |
void |
mapRegionToSuitableResolutionGrid(int[] fsiz,
int[] roff,
int[] rsiz,
int discardLevels)
Maps an image region (frame size, region offset and region size) to the
suitable codestream frame size (image resolution) and image region.
|
void |
removeAllTiles()
Removes all tiles.
|
void |
removeTile(int index)
Removes a tile from the list.
|
java.lang.String |
toString() |
boolean |
useEPH()
Check if End of Packets Headers (EPH) are used.
|
boolean |
useSOP()
Check if End of Packets Headers (SOP) are used.
|
protected int identifier
Only positive values are allowed.
protected java.util.HashMap<java.lang.Integer,JPEG2KTile> tiles
The key of the hash is the tile index.
protected SIZParameters sizParameters
protected CODParameters codParameters
protected java.util.HashMap<java.lang.Integer,COCParameters> cocParametersList
protected QCDParameters qcdParameters
protected java.util.HashMap<java.lang.Integer,QCCParameters> qccParametersList
protected CBDParameters cbdParameters
protected java.util.HashMap<java.lang.Integer,MCTParameters> mctParametersList
The integer of the hash key stand for the stage.
protected java.util.HashMap<java.lang.Integer,MCCParameters> mccParametersList
The integer of the hash key stand for the stage.
protected MCOParameters mcoParameters
protected COMParameters comParameters
protected JPKParameters jpkParameters
private int maxRLevels
This attribute is used by the getMaxResolutionLevels()
method. The
first time method is called this value is computed, otherwise is just read.
public JPEG2KCodestream(int identifier, JPCParameters jpcParameters)
identifier
- definition in identifier
.jpcParameters
- and object of the class
JPCParameters
.public int getIdentifier()
identifier
attribute.identifier
.public void createTile(int index)
index
- is the tile index.public JPEG2KTile getTile(int index)
index
.index
- definition inJPEG2KTile.index
.public void removeTile(int index)
index
- definition inJPEG2KTile.index
.public void removeAllTiles()
public int findTile(long inClassIdentifier)
inClassIdentifier
- definition in
JPIPMessageHeader.inClassIdentifier
.public int[] findTCRP(long inClassIdentifier)
inClassIdentifier
.inClassIdentifier
- definition in
JPIPMessageHeader.inClassIdentifier
.public int[] findTCP(long inClassIdentifier)
inClassIdentifier
.inClassIdentifier
- definition in
JPIPMessageHeader.inClassIdentifier
.public long findInClassIdentifier(int tile, int component, int rLevel, int precinct)
tile
- tile in which the precinct is.component
- the component which the resolution level belongs.rLevel
- the resolution level within the tile-component.precinct
- the number precinct within the tile-component-resolution
level following a raster modeJPIPMessageHeader.inClassIdentifier
.public JPEG2KPrecinct getPrecinct(long inClassIdentifier)
inClassIdentifier
.inClassIdentifier
- definition in
JPIPMessageHeader.inClassIdentifier
.public int getRSize()
public int getXSize()
public int getYSize()
public int getXOSize()
public int getYOSize()
public int getXTSize()
public int getYTSize()
public int getXTOSize()
public int getYTOSize()
public int getZSize()
public int getPrecision(int component)
component
.component
- public boolean isSigned(int component)
component
is signed.component
- definition in JPEG2KComponent.component
.true
if the component is signed. Otherwise, returns
false
.public int getXRsize(int component)
component
with respect to the reference grid.component
- definition in JPEG2KComponent.component
.public int getYRsize(int component)
component
with respect to the reference grid.component
- definition in JPEG2KComponent.component
.public int getProgressionOrder()
public int getNumLayers()
public int getMultiComponentTransform()
public int getWTLevels()
public int getWTType()
public boolean isBypass(int component)
component
- definition in JPEG2KComponent.component
.true
if bypass flag is active. Otherwise, returns false
.public boolean isReset(int component)
component
- definition in JPEG2KComponent.component
.true
if reset flag is active. Otherwise, returns false
.public boolean isRestart(int component)
component
- definition in JPEG2KComponent.component
.true
if restart flag is active. Otherwise, returns false
.public boolean isCausal(int component)
component
- definition in JPEG2KComponent.component
.true
if causal flag is active. Otherwise, returns false
.public boolean isErterm(int component)
component
- definition in JPEG2KComponent.component
.true
if erterm flag is active. Otherwise, returns false
.public boolean isSegmark(int component)
component
- definition in JPEG2KComponent.component
.true
if segmark flag is active. Otherwise, returns false
.public int getBlockHeight()
ATTENTION: This method will be deprecated in the next version. Use the
getBlockHeight(int)
method.
public int getBlockWidth()
ATTENTION: This method will be deprecated in the next version. Use the
getBlockWidth(int)
method.
public int getBlockHeight(int component)
component
.component
- definition in JPEG2KComponent.component
.public int getBlockWidth(int component)
component
.component
- definition in JPEG2KComponent.component
.public int getPrecinctHeights(int component, int rLevel)
public int getPrecinctWidths(int component, int rLevel)
public boolean useSOP()
false
if SOP are used. Otherwise, return false
.public boolean useEPH()
false
if EPH are used. Otherwise, return false
.public int getQuantizationStyle()
public int getExponent(int component, int rLevel, int subband)
component
, resolution
levelrLevel
and subband subband
.component
- rLevel
- subband
- public int getMantisa(int component, int rLevel, int subband)
component
, resolution
levelrLevel
and subband subband
.component
- rLevel
- subband
- public int getGuardBits(int component)
component
.component
- public java.util.HashMap<java.lang.Long,java.lang.Float> getPredictiveModel()
COMParameters.predictiveModel
attribute.COMParameters.predictiveModel
attribute.public CADIRectangle getImageArea()
CADIRectangle
with the bounds of the
image area.public int getNumTilesWide()
public int getNumTilesHigh()
public int getNumTiles()
public int getMaxResolutionLevels()
public void determineFrameSize(int discardLevels, CADIDimension frameSize)
discardLevels
levels of the DWT
are discarded.discardLevels
- the number of DWT levels to discard.frameSize
- an object where the result will be recorded.public CADIDimension determineFrameSize(int discardLevels)
discardLevels
levels of the DWT
are discarded.discardLevels
- the number of DWT levels to discard.public int determineNumberOfDiscardLevels(int[] fsiz, int roundDirection)
fsiz
to an available frame size.fsiz
- definition in
ViewWindowField.fsiz
.roundDirection
- definition in
ViewWindowField.roundDirection
.public java.util.ArrayList<java.lang.Integer> calculateRelevantTiles(ViewWindowField viewWindow, int discardLevels)
viewWindow
.viewWindow
- definition in
ViewWindowField
discardLevels
- the number of DWT levels to discard.public void calculateSupportRegion(int tile, int component, int rLevel, CADIRectangle supportRegion, int discardLevels)
supportRegion
parameter and the result is saved in the same
parameter. The discardLevels
indicates the number of discarded
DWT levels to achieve the resolution level over the supportRegion
has been defined.sadftile
- the tile index.component
- the component.rLevel
- the resolution level within the tile-component.supportRegion
- it is an input and output parameters. As input, the
method receives the region of which to calculate the support region.
As output, the result is saved in it.discardLevels
- number of DWT levels to discard.public void mapRegionToSuitableResolutionGrid(int[] fsiz, int[] roff, int[] rsiz, int discardLevels)
The fsiz
, roff
, and rsiz
are all
of them input and output parameters.
Further information, see see ISO/IEC 15444-9 section C.4.1
fsiz
- definition in
ViewWindowField.fsiz
.roff
- definition in
ViewWindowField.roff
.rsiz
- definition in
ViewWindowField.rsiz
.discardLevels
- is the number of discarded DWT levels.public java.util.ArrayList<java.lang.Long> findRelevantPrecinctsTRCP(ViewWindowField actualViewWindow, int discardLevels)
Further information, see ISO/IEC 15444-9 section K.4.1
actualViewWindow
- discardLevels
- public java.util.ArrayList<java.lang.Long> findRelevantPrecincts(ViewWindowField viewWindow, int discardLevels)
viewWindow
when discardLevels
DWT levels are discarded.
The returned list of precincts is sorted out in the fashion tile-resolution level-component-precinct.
Further information, see ISO/IEC 15444-9 section K.4.1
viewWindow
- definition in
CADI.Common.Network.JPIP.ViewWindowField.ViewWindowField
.discardLevels
- is the number of discarded DWT levels.public java.util.ArrayList<java.lang.Long> findRelevantPrecincts(ViewWindowField actualViewWindow)
viewWindow
when discardLevels
DWT levels are discarded.
The returned list of precincts is sorted out in the fashion tile-resolution level-component-precinct.
Further information, see ISO/IEC 15444-9 section K.4.1
viewWindow
- definition in
CADI.Common.Network.JPIP.ViewWindowField.ViewWindowField
.public JPCParameters getJPCParameters()
A copy of the parameters is performed in order to avoid that internal attribute to be modified.
public SIZParameters getSIZParameters()
public CODParameters getCODParameters()
public QCDParameters getQCDParameters()
public CBDParameters getCBDParameters()
public java.util.HashMap<java.lang.Integer,MCTParameters> getMCTParameters()
public java.util.HashMap<java.lang.Integer,MCCParameters> getMCCParameters()
public MCOParameters getMCOParameters()
public COMParameters getCOMParameters()
public JPKParameters getJPKParameters()
public java.lang.String toString()
toString
in class java.lang.Object
public void list(java.io.PrintStream out)
out
- an output stream.public void listParameters(java.io.PrintStream out)
list(PrintStream)
but it only output
the parameters.out
- an output stream.private static int getExtensionLength(int WTType, int direction, int sampleIndex)
WTType
- definition in
CADI.Common.LogicalTarget.JPEG2000.Parameters.CODParameters#WTTypes
.direction
- -1 means to the left, and 1 to the rightsampleIndex
-
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)