| java.lang.Object jj2000.j2k.codestream.reader.HeaderDecoder
HeaderDecoder | public class HeaderDecoder implements ProgressionType,Markers,StdEntropyCoderOptions(Code) | | This class reads Main and Tile-part headers from the codestream. It is
created by the run() method of the Decoder instance.
A marker segment includes a marker and eventually marker segment
parameters. It is designed by the three letters code of the marker
associated with the marker segment. JPEG 2000 part 1 defines 6 types of
markers:
- Delimiting : SOC,SOT (read in FileBitstreamReaderAgent),SOD,EOC
(read in FileBitstreamReaderAgent).
- Fixed information: SIZ.
- Functional: COD,COC,RGN,QCD,QCC,POC.
- In bit-stream:
SOP,EPH.
- Pointer: TLM,PLM,PLT,PPM,PPT.
- Informational: CRG,COM.
The main header is read when the constructor is called whereas tile-part
headers are read when the FileBitstreamReaderAgent instance is created. The
reading is done in 2 passes:
- All marker segments are buffered and their corresponding flag is
activated (extractMainMarkSeg and extractTilePartMarkSeg methods).
- Buffered marker segment are analyzed in a logical way and
specifications are stored in appropriate member of DecoderSpecs instance
(readFoundMainMarkSeg and readFoundTilePartMarkSeg methods).
Whenever a marker segment is not recognized a warning message is
displayed and its length parameter is used to skip it.
See Also: DecoderSpecs See Also: Decoder See Also: FileBitstreamReaderAgent |
Method Summary | |
public void | checkMarkerLength(DataInputStream ehs, String str) Checks that the marker segment length is correct. | final public Dequantizer | createDequantizer(CBlkQuantDataSrcDec src, int rb, DecoderSpecs decSpec2) Returns the dequantizer parameters. | public EntropyDecoder | createEntropyDecoder(CodedCBlkDataSrcDec src, J2KImageReadParamJava j2krparam) Creates and returns the entropy decoder corresponding to the
information read from the codestream header and with the special
additional parameters from the parameter list.
Parameters: src - The bit stream reader agent where to get code-block datafrom. Parameters: j2krparam - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present). | public ROIDeScaler | createROIDeScaler(CBlkQuantDataSrcDec src, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec2) Creates and returns the ROIDeScaler corresponding to the information
read from the codestream header and with the special additional
parameters from the parameter list.
Parameters: src - The bit stream reader agent where to get code-block datafrom. Parameters: pl - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present). | public void | extractTilePartMarkSeg(short marker, RandomAccessIO ehs, int tileIdx, int tilePartIdx) This method extracts a marker segment in a tile-part header and stores
it into a byte buffer for the second pass. | final public int | getCbULX() Returns the horizontal code-block partition origin.Allowable values are
0 and 1, nothing else. | final public int | getCbULY() Returns the vertical code-block partition origin. | final public int | getCompSubsX(int c) Returns the component sub-sampling factor, with respect to the
reference grid, along the horizontal direction for the specified
component. | final public int | getCompSubsY(int c) Returns the component sub-sampling factor, with respect to the
reference grid, along the vertical direction for the specified
component. | public DecoderSpecs | getDecoderSpecs() | final public int | getImgHeight() Returns the image height in the reference grid. | final public int | getImgULX() Return the horizontal upper-left coordinate of the image in the
reference grid. | final public int | getImgULY() Return the vertical upper-left coordinate of the image in the reference
grid. | final public int | getImgWidth() Returns the image width in the reference grid. | public int | getMaxCompImgHeight() | public int | getMaxCompImgWidth() | final public int | getNomTileHeight() Returns the nominal width of the tiles in the reference grid. | final public int | getNomTileWidth() Returns the nominal width of the tiles in the reference grid. | final public int | getNumComps() Returns the number of components in the image. | public int | getNumFoundMarkSeg() Returns the number of found marker segments in the current header. | public int | getNumTiles() | final public int | getOriginalBitDepth(int c) Returns the original bitdepth of the specified component. | final public int | getPPX(int t, int c, int rl) Returns the precinct partition width for the specified tile-component
and resolution level. | final public int | getPPY(int t, int c, int rl) Returns the precinct partition height for the specified component, tile
and resolution level. | public ByteArrayInputStream | getPackedPktHead(int tile) Return the packed packet headers for a given tile. | public static String[][] | getParameterInfo() Returns the parameters that are used in this class. | final public Point | getTilingOrigin(Point co) Returns the tiling origin, referred to as '(Px,Py)' in the 'ImgData'
interface.
Parameters: co - If not null this object is used to return the information. | final public boolean | isOriginalSigned(int c) Returns true if the original data of the specified component was
signed. | final public boolean | precinctPartitionUsed() | public void | readFoundTilePartMarkSeg(int tileIdx, int tpIdx) | public void | resetHeaderMarkers() | public void | setTileOfTileParts(int tile) Sets the tile of each tile part in order. | public String | toString() Print information about the current header. |
CRG_FOUND | final public static int CRG_FOUND(Code) | | Flag bit for CRG marker segment found
|
OPT_PREFIX | final public static char OPT_PREFIX(Code) | | The prefix for header decoder options: 'H'
|
PPM_FOUND | final public static int PPM_FOUND(Code) | | Flag bit for SOD marker segment found
|
PPT_FOUND | final public static int PPT_FOUND(Code) | | Flag bit for SOD marker segment found
|
SOD_FOUND | final public static int SOD_FOUND(Code) | | Flag bit for SOD marker segment found
|
mainHeadOff | public int mainHeadOff(Code) | | The offset of the main header in the input stream
|
nTileParts | public int[] nTileParts(Code) | | The number of tile parts per tile
|
precinctPartitionIsUsed | boolean precinctPartitionIsUsed(Code) | | Is the precinct partition used
|
tileOfTileParts | public Vector tileOfTileParts(Code) | | Vector containing info as to which tile each tilepart belong
|
HeaderDecoder | public HeaderDecoder(RandomAccessIO ehs, J2KImageReadParamJava j2krparam, HeaderInfo hi) throws IOException(Code) | | Creates a HeaderDecoder instance and read in two passes the main header
of the codestream. The first and last marker segments shall be
respectively SOC and SOT.
Parameters: ehs - The encoded header stream where marker segment areextracted. Parameters: j2krparam - The parameter list of the decoder Parameters: hi - The HeaderInfo holding information found in marker segments exception: IOException - If an I/O error occurs while reading from theencoded header stream. exception: EOFException - If the end of the encoded header stream isreached before getting all the data. exception: CorruptedCodestreamException - If invalid data is found in thecodestream main header. |
checkMarkerLength | public void checkMarkerLength(DataInputStream ehs, String str) throws IOException(Code) | | Checks that the marker segment length is correct.
Parameters: ehs - The encoded header stream Parameters: str - The string identifying the marker, such as "SIZ marker" exception: IOException - If an I/O error occurs |
createDequantizer | final public Dequantizer createDequantizer(CBlkQuantDataSrcDec src, int rb, DecoderSpecs decSpec2)(Code) | | Returns the dequantizer parameters. Dequantizer parameters normally are
the quantization step sizes, see DequantizerParams.
Parameters: src - The source of data for the dequantizer. Parameters: rb - The number of range bits for each component. Must bethe number of range bits of the mixed components. Parameters: decSpec2 - The DecoderSpecs instance after any image manipulation. The dequantizer |
createEntropyDecoder | public EntropyDecoder createEntropyDecoder(CodedCBlkDataSrcDec src, J2KImageReadParamJava j2krparam)(Code) | | Creates and returns the entropy decoder corresponding to the
information read from the codestream header and with the special
additional parameters from the parameter list.
Parameters: src - The bit stream reader agent where to get code-block datafrom. Parameters: j2krparam - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present). The entropy decoder |
createROIDeScaler | public ROIDeScaler createROIDeScaler(CBlkQuantDataSrcDec src, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec2)(Code) | | Creates and returns the ROIDeScaler corresponding to the information
read from the codestream header and with the special additional
parameters from the parameter list.
Parameters: src - The bit stream reader agent where to get code-block datafrom. Parameters: pl - The parameter list containing parameters applicable to theentropy decoder (other parameters can also be present). The ROI descaler |
extractTilePartMarkSeg | public void extractTilePartMarkSeg(short marker, RandomAccessIO ehs, int tileIdx, int tilePartIdx) throws IOException(Code) | | This method extracts a marker segment in a tile-part header and stores
it into a byte buffer for the second pass. The marker is first
recognized, then its flag is activated and, finally, its content is
buffered in an element of byte arrays accessible thanks to a hashTable.
If a marker segment is not recognized, it prints a warning and skip it
according to its length.
Parameters: marker - The marker to process Parameters: ehs - The encoded header stream Parameters: tileIdx - The index of the current tile Parameters: tilePartIdx - The index of the current tile part |
getCbULX | final public int getCbULX()(Code) | | Returns the horizontal code-block partition origin.Allowable values are
0 and 1, nothing else.
|
getCbULY | final public int getCbULY()(Code) | | Returns the vertical code-block partition origin. Allowable values are
0 and 1, nothing else.
|
getCompSubsX | final public int getCompSubsX(int c)(Code) | | Returns the component sub-sampling factor, with respect to the
reference grid, along the horizontal direction for the specified
component.
Parameters: c - The index of the component The component sub-sampling factor X-wise. |
getCompSubsY | final public int getCompSubsY(int c)(Code) | | Returns the component sub-sampling factor, with respect to the
reference grid, along the vertical direction for the specified
component.
Parameters: c - The index of the component The component sub-sampling factor Y-wise. |
getDecoderSpecs | public DecoderSpecs getDecoderSpecs()(Code) | | Return the DecoderSpecs instance filled when reading the headers
The DecoderSpecs of the decoder |
getImgHeight | final public int getImgHeight()(Code) | | Returns the image height in the reference grid.
The image height in the reference grid |
getImgULX | final public int getImgULX()(Code) | | Return the horizontal upper-left coordinate of the image in the
reference grid.
The horizontal coordinate of the image origin. |
getImgULY | final public int getImgULY()(Code) | | Return the vertical upper-left coordinate of the image in the reference
grid.
The vertical coordinate of the image origin. |
getImgWidth | final public int getImgWidth()(Code) | | Returns the image width in the reference grid.
The image width in the reference grid |
getMaxCompImgHeight | public int getMaxCompImgHeight()(Code) | | Return the maximum height among all components
Maximum component height |
getMaxCompImgWidth | public int getMaxCompImgWidth()(Code) | | Return the maximum width among all components
Maximum component width |
getNomTileHeight | final public int getNomTileHeight()(Code) | | Returns the nominal width of the tiles in the reference grid.
The nominal tile width, in the reference grid. |
getNomTileWidth | final public int getNomTileWidth()(Code) | | Returns the nominal width of the tiles in the reference grid.
The nominal tile width, in the reference grid. |
getNumComps | final public int getNumComps()(Code) | | Returns the number of components in the image.
The number of components in the image. |
getNumFoundMarkSeg | public int getNumFoundMarkSeg()(Code) | | Returns the number of found marker segments in the current header.
The number of marker segments found in the current header. |
getNumTiles | public int getNumTiles()(Code) | | Return the number of tiles in the image
The number of tiles |
getOriginalBitDepth | final public int getOriginalBitDepth(int c)(Code) | | Returns the original bitdepth of the specified component.
Parameters: c - The index of the component The bitdepth of the component |
getPPX | final public int getPPX(int t, int c, int rl)(Code) | | Returns the precinct partition width for the specified tile-component
and resolution level.
Parameters: c - the component index Parameters: t - the tile index Parameters: rl - the resolution level The precinct partition width for the specified tile-componentand resolution level |
getPPY | final public int getPPY(int t, int c, int rl)(Code) | | Returns the precinct partition height for the specified component, tile
and resolution level.
Parameters: c - the component Parameters: t - the tile index Parameters: rl - the resolution level The precinct partition height for the specified component,tile and resolution level |
getPackedPktHead | public ByteArrayInputStream getPackedPktHead(int tile) throws IOException(Code) | | Return the packed packet headers for a given tile.
An input stream containing the packed packet headers for aparticular tile exception: IOException - If an I/O error occurs while reading from theencoder header stream |
getParameterInfo | public static String[][] getParameterInfo()(Code) | | Returns the parameters that are used in this class. It returns a 2D
String array. Each of the 1D arrays is for a different option, and they
have 3 elements. The first element is the option name, the second one
is the synopsis and the third one is a long description of what the
parameter is. The synopsis or description may be 'null', in which case
it is assumed that there is no synopsis or description of the option,
respectively.
the options name, their synopsis and their explanation. |
getTilingOrigin | final public Point getTilingOrigin(Point co)(Code) | | Returns the tiling origin, referred to as '(Px,Py)' in the 'ImgData'
interface.
Parameters: co - If not null this object is used to return the information. Ifnull a new one is created and returned. The coordinate of the tiling origin, in the canvas system, onthe reference grid. See Also: jj2000.j2k.image.ImgData |
isOriginalSigned | final public boolean isOriginalSigned(int c)(Code) | | Returns true if the original data of the specified component was
signed. If the data was not signed a level shift has to be applied at
the end of the decompression chain.
Parameters: c - The index of the component True if the original image component was signed. |
precinctPartitionUsed | final public boolean precinctPartitionUsed()(Code) | | Returns the boolean used to know if the precinct partition is used
|
readFoundTilePartMarkSeg | public void readFoundTilePartMarkSeg(int tileIdx, int tpIdx) throws IOException(Code) | | Return the DecoderSpecs instance filled when reading the headers
Parameters: tileIdx - The index of the current tile Parameters: tpIdx - Index of the current tile-part |
resetHeaderMarkers | public void resetHeaderMarkers()(Code) | | Method that resets members indicating which markers have already been
found
|
setTileOfTileParts | public void setTileOfTileParts(int tile)(Code) | | Sets the tile of each tile part in order. This information is needed
for identifying which packet header belongs to which tile when using
the PPM marker.
Parameters: tile - The tile number that the present tile part belongs to. |
toString | public String toString()(Code) | | Print information about the current header.
Information in a String |
|
|