[]
        
(Showing Draft Content)

CSJ2K.j2k.codestream.reader.HeaderDecoder

HeaderDecoder Class

This class reads main and tile-part headers from the codestream given a RandomAccessIO instance located at the beginning of the codestream (i.e just before the SOC marker) or at the beginning of a tile-part (i.e. just before a SOT marker segment) respectively.

       <p>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 segments:

       <ul><li> Delimiting : SOC, SOT, SOD, EOC</li><li> Fixed information: SIZ.</li><li> Functional: COD, COC, RGN, QCD, QCC,POC.</li><li> In bit-stream: SOP, EPH.</li><li> Pointer: TLM, PLM, PLT, PPM, PPT.</li><li> Informational: CRG, COM.</li></ul></p><p>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:

       <ol><li>All marker segments are buffered and their corresponding flag is
       activated (extractMainMarkSeg and extractTilePartMarkSeg methods).</li><li>Buffered marker segment are analyzed in a logical way and
       specifications are stored in appropriate member of DecoderSpecs instance
       (readFoundMainMarkSeg and readFoundTilePartMarkSeg methods).</li></ol></p><p>Whenever a marker segment is not recognized a warning message is
       displayed and its length parameter is used to skip it.</p><p>The information found in this header is stored in HeaderInfo and
       DecoderSpecs instances.</p>
Inheritance
HeaderDecoder
Namespace: CSJ2K.j2k.codestream.reader
Assembly: C1.WPF.PdfViewer.4.6.2.dll
Syntax
public class HeaderDecoder

Constructors

Name Description
HeaderDecoder(RandomAccessIO, ParameterList, HeaderInfo)

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.

Fields

Name Description
CRG_FOUND

Flag bit for CRG marker segment found

OPT_PREFIX

The prefix for header decoder options: 'H'

PPM_FOUND

Flag bit for SOD marker segment found

PPT_FOUND

Flag bit for SOD marker segment found

SOD_FOUND

Flag bit for SOD marker segment found

mainHeadOff

The offset of the main header in the input stream

nTileParts

The number of tile parts in each tile

Properties

Name Description
CbULX

Returns the horizontal code-block partition origin.Allowable values are 0 and 1, nothing else.

CbULY

Returns the vertical code-block partition origin. Allowable values are 0 and 1, nothing else.

DecoderSpecs

Return the DecoderSpecs instance filled when reading the headers

ImgHeight

Returns the image height in the reference grid.

ImgULX

Return the horizontal upper-left coordinate of the image in the reference grid.

ImgULY

Return the vertical upper-left coordinate of the image in the reference grid.

ImgWidth

Returns the image width in the reference grid.

MaxCompImgHeight

Return the maximum height among all components

MaxCompImgWidth

Return the maximum width among all components

NomTileHeight

Returns the nominal width of the tiles in the reference grid.

NomTileWidth

Returns the nominal width of the tiles in the reference grid.

NumComps

Returns the number of components in the image.

NumFoundMarkSeg

Returns the number of found marker segments in the current header.

NumTiles

Return the number of tiles in the image

ParameterInfo

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.

TileOfTileParts

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.

Methods

Name Description
ToString()

Print information about the current header.

checkMarkerLength(BinaryReader, string)

Checks that the marker segment length is correct.

createChannelDefinitionMapper(BlkImgDataSrc, ColorSpace)

Creates and returns the ChannelDefinitonMapper which maps the input channels to the channel definition for the appropriate colorspace.

createColorSpaceMapper(BlkImgDataSrc, ColorSpace)

Creates and returns the EnumeratedColorSpaceMapper corresponding to the information read from the JP2 image file via the ColorSpace parameter.

createDequantizer(CBlkQuantDataSrcDec, int[], DecoderSpecs)

Returns the dequantizer parameters. Dequantizer parameters normally are the quantization step sizes, see DequantizerParams.

createEntropyDecoder(CodedCBlkDataSrcDec, ParameterList)

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.

createPalettizedColorSpaceMapper(BlkImgDataSrc, ColorSpace)

Creates and returns the PalettizedColorSpaceMapper which uses the input samples as indicies into a sample palette to construct the output.

createROIDeScaler(CBlkQuantDataSrcDec, ParameterList, DecoderSpecs)

Creates and returns the ROIDeScaler corresponding to the information read from the codestream header and with the special additional parameters from the parameter list.

createResampler(BlkImgDataSrc, ColorSpace)

Creates and returns the Resampler which converts the input source to one in which all channels have the same number of samples. This is required for colorspace conversions.

extractTilePartMarkSeg(short, RandomAccessIO, int, int)

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.

getCompSubsX(int)

Returns the component sub-sampling factor, with respect to the reference grid, along the horizontal direction for the specified component.

getCompSubsY(int)

Returns the component sub-sampling factor, with respect to the reference grid, along the vertical direction for the specified component.

getOriginalBitDepth(int)

Returns the original bitdepth of the specified component.

getPPX(int, int, int)

Returns the precinct partition width for the specified tile-component and resolution level.

getPPY(int, int, int)

Returns the precinct partition height for the specified tile-component and resolution level.

getPackedPktHead(int)

Return the packed packet headers for a given tile.

getTilingOrigin(Coord)

Returns the tiling origin, referred to as '(Px,Py)' in the 'ImgData' interface.

isOriginalSigned(int)

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.

precinctPartitionUsed()

Returns the boolean used to know if the precinct partition is used

readFoundTilePartMarkSeg(int, int)

Retrieves and reads all marker segments previously found in the tile-part header.

resetHeaderMarkers()

Method that resets members indicating which markers have already been found

See Also