[]
        
(Showing Draft Content)

CSJ2K.j2k.codestream.reader.BitstreamReaderAgent

BitstreamReaderAgent Class

This is the generic interface for bit stream reader agents. A bit stream reader agent is an entity that allows reading from a bit stream and requesting compressed code-blocks. It can be a simple file reader, or a network connection, or anything else.

       <p>The bit stream reader agent allows to make request for compressed block
       data in any order. The amount of data returned would normally depend on the
       data available at the time of the request, be it from a file or from a
       network connection.</p><p>The bit stream reader agent has the notion of a current tile, and
       coordinates are relative to the current tile, where applicable.</p><p>Resolution level 0 is the lowest resolution level, i.e. the LL subband
       alone.</p>
Inheritance
BitstreamReaderAgent
Namespace: CSJ2K.j2k.codestream.reader
Assembly: C1.WPF.PdfViewer.4.6.2.dll
Syntax
public abstract class BitstreamReaderAgent : CodedCBlkDataSrcDec, InvWTData, MultiResImgData

Constructors

Name Description
BitstreamReaderAgent(HeaderDecoder, DecoderSpecs)

Initializes members of this class. This constructor takes a HeaderDecoder object. This object must be initialized by the constructor of the implementing class from the header of the bit stream.

Fields

Name Description
OPT_PREFIX

The prefix for bit stream reader options: 'B'

anbytes

Actual number of read bytes

arate

Actual decoding rate in bpp

ax

The horizontal coordinate of the image origin in the canvas system, on the reference grid.

ay

The vertical coordinate of the image origin in the canvas system, on the reference grid.

ctX

The current tile horizontal index

ctY

The current tile vertical index

culx

The horizontal coordinates of the upper-left corner of the active tile, with respect to the canvas origin, in the component hi-res grid, for each component.

culy

The vertical coordinates of the upper-left corner of the active tile, with respect to the canvas origin, in the component hi-res grid, for each component.

decSpec

The decoder specifications

derived

Whether or not the components in the current tile uses a derived quantization step size (only relevant in non reversible quantization mode). This field is actualized by the setTile method in FileBitstreamReaderAgent.

gb

Number of guard bits off all component in the current tile. This field is actualized by the setTile method in FileBitstreamReaderAgent.

hd

The decoded bit stream header

imgH

The image width on the hi-res reference grid

imgW

The image width on the hi-res reference grid

mdl

The maximum number of decompostion levels for each component of the current tile. It means that component c has mdl[c]+1 resolution levels (indexed from 0 to mdl[c])

nc

The number of components

nt

The total number of tiles

ntH

The nominal tile height, in the hi-res reference grid

ntW

The nominal tile width, in the hi-res reference grid

ntX

The number of tile in the horizontal direction

ntY

The number of tiles in the vertical direction

offX

The horizontal offsets of the upper-left corner of the current tile (not active tile) with respect to the canvas origin, in the component hi-res grid, for each component.

offY

The vertical offsets of the upper-left corner of the current tile (not active tile) with respect to the canvas origin, in the component hi-res grid, for each component.

params_Renamed

Dequantization parameters of all subbands and all components in the current tile. The value is actualized by the setTile method in FileBitstreamReaderAgent.

px

The horizontal coordinate of the tiling origin in the canvas system, on the reference grid.

py

The vertical coordinate of the tiling origin in the canvas system, on the reference grid.

subbTrees

The subband trees for each component in the current tile. Each element in the array is the root element of the subband tree for a component. The number of magnitude bits in each subband (magBits member variable) is not initialized.

targetRes

Image resolution level to generate

tnbytes

Number of bytes targeted to be read

trate

Target decoding rate in bpp

Properties

Name Description
ActualNbytes

Return the actual number of read bytes.

ActualRate

Return the actual decoding rate in bits per pixel.

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.

ImgRes

Returns the image resolution level to reconstruct from the codestream. This value cannot be computed before every main and tile headers are read.

NomTileHeight

Returns the nominal tile height

NomTileWidth

Returns the nominal tile width

NumComps

Returns the number of components in the image.

ParameterInfo

Returns the parameters that are used in this class and implementing classes. 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. Null may be returned if no options are supported.

TargetNbytes

Return the target number of read bytes.

TargetRate

Return the target decoding rate in bits per pixel.

TileIdx

Returns the index of the current tile, relative to a standard scan-line order.

TilePartULX

Returns the horizontal offset of tile partition

TilePartULY

Returns the vertical offset of tile partition

Methods

Name Description
createInstance(RandomAccessIO, HeaderDecoder, ParameterList, DecoderSpecs, bool, HeaderInfo)

Creates a bit stream reader of the correct type that works on the provided RandomAccessIO, with the special parameters from the parameter list.

getCodeBlock(int, int, int, SubbandSyn, int, int, DecLyrdCBlk)

Returns the specified coded code-block, for the specified component, in the current tile. The first layer to return is indicated by 'fl'. The number of layers that is returned depends on 'nl' and the amount of data available.

       <p>The argument 'fl' is to be used by subsequent calls to this method
       for the same code-block. In this way supplamental data can be retrieved
       at a later time. The fact that data from more than one layer can be
       returned means that several packets from the same code-block, of the
       same component, and the same tile, have been concatenated.</p><p>The returned compressed code-block can have its progressive
       attribute set. If this attribute is set it means that more data can be
       obtained by subsequent calls to this method (subject to transmission
       delays, etc). If the progressive attribute is not set it means that the
       returned data is all the data that can be obtained for the specified
       subblock.</p><p>The compressed code-block is uniquely specified by the current tile,
       the component (identified by 'c'), the subband (indentified by 'sb')
       and the code-bock vertical and horizontal indexes 'm' and 'n'.</p><p>The 'ulx' and 'uly' members of the returned 'DecLyrdCBlk' object
       contain the coordinates of the top-left corner of the block, with
       respect to the tile, not the subband.</p>
getCompImgHeight(int, int)

Returns the height in pixels of the specified component in the overall image, for the given (component) resolution level.

       <p>Note: Component resolution level indexes may differ from
       tile-component resolution index. They are indeed indexed starting from
       the lowest number of decomposition levels of same component of each
       tile.</p><p>Example: For an image (2 tiles) with 1 component (tile 0 having 2
       decomposition levels and tile 1 having 3 decomposition levels), the
       first tile(-component) has 3 resolution levels and the second one has 4
       resolution levels, whereas the component has only 3 resolution levels
       available.</p>
getCompImgWidth(int, int)

Returns the width in pixels of the specified component in the overall image, for the given (component) resolution level.

       <p>Note: Component resolution level indexes may differ from
       tile-component resolution index. They are indeed indexed starting from
       the lowest number of decomposition levels of same component of each
       tile.</p><p>Example: For an image (2 tiles) with 1 component (tile 0 having 2
       decomposition levels and tile 1 having 3 decomposition levels), the
       first tile(-component) has 3 resolution levels and the second one has 4
       resolution levels, whereas the component has only 3 resolution levels
       available.</p>
getCompSubsX(int)

Returns the component subsampling factor in the horizontal direction, for the specified component. This is, approximately, the ratio of dimensions between the reference grid and the component itself, see the 'ImgData' interface desription for details.

getCompSubsY(int)

Returns the component subsampling factor in the vertical direction, for the specified component. This is, approximately, the ratio of dimensions between the reference grid and the component itself, see the 'ImgData' interface desription for details.

getImgHeight(int)

Returns the overall height of the image in pixels, for the given resolution level. This is the image's height without accounting for any component subsampling or tiling.

       <p>Note: Image resolution level indexes may differ from tile-component
       resolution index. They are indeed indexed starting from the lowest
       number of decomposition levels of each component of each tile.</p><p>Example: For an image (1 tile) with 2 components (component 0 having
       2 decomposition levels and component 1 having 3 decomposition levels),
       the first (tile-) component has 3 resolution levels and the second one
       has 4 resolution levels, whereas the image has only 3 resolution levels
       available.</p>
getImgULX(int)

Returns the horizontal coordinate of the image origin, the top-left corner, in the canvas system, on the reference grid at the specified resolution level.

       <p>Note: Image resolution level indexes may differ from tile-component
       resolution index. They are indeed indexed starting from the lowest
       number of decomposition levels of each component of each tile.</p><p>Example: For an image (1 tile) with 2 components (component 0 having
       2 decomposition levels and component 1 having 3 decomposition levels),
       the first (tile-) component has 3 resolution levels and the second one
       has 4 resolution levels, whereas the image has only 3 resolution levels
       available.</p>
getImgULY(int)

Returns the vertical coordinate of the image origin, the top-left corner, in the canvas system, on the reference grid at the specified resolution level.

       <p>Note: Image resolution level indexes may differ from tile-component
       resolution index. They are indeed indexed starting from the lowest
       number of decomposition levels of each component of each tile.</p><p>Example: For an image (1 tile) with 2 components (component 0 having
       2 decomposition levels and component 1 having 3 decomposition levels),
       the first (tile-) component has 3 resolution levels and the second one
       has 4 resolution levels, whereas the image has only 3 resolution levels
       available.</p>
getImgWidth(int)

Returns the overall width of the image in pixels, for the given (image) resolution level. This is the image's width without accounting for any component subsampling or tiling.

       <p>Note: Image resolution level indexes may differ from tile-component
       resolution index. They are indeed indexed starting from the lowest
       number of decomposition levels of each component of each tile.</p><p>Example: For an image (1 tile) with 2 components (component 0 having
       2 decomposition levels and component 1 having 3 decomposition levels),
       the first (tile-) component has 3 resolution levels and the second one
       has 4 resolution levels, whereas the image has only 3 resolution levels
       available.</p>
getNumTiles()

Returns the total number of tiles in the image.

getNumTiles(Coord)

Returns the number of tiles in the horizontal and vertical directions.

getPPX(int, int, int)

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

getPPY(int, int, int)

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

getResULX(int, int)

Returns the horizontal coordinate of the upper-left corner of the specified resolution in the given component of the current tile.

getResULY(int, int)

Returns the vertical coordinate of the upper-left corner of the specified component in the given component of the current tile.

getSynSubbandTree(int, int)

Returns the subband tree, for the specified tile-component. This method returns the root element of the subband tree structure, see Subband and SubbandSyn. The tree comprises all the available resolution levels.

       <p>Note: this method is not able to return subband tree for a tile
       different than the current one.</p><p>The number of magnitude bits ('magBits' member variable) for each
       subband is not initialized.</p>
getTile(Coord)

Returns the indexes of the current tile. These are the horizontal and vertical indexes of the current tile.

getTileCompHeight(int, int, int)

Returns the height in pixels of the specified tile-component for the given (tile-component) resolution level.

getTileCompWidth(int, int, int)

Returns the width in pixels of the specified tile-component for the given (tile-component) resolution level.

getTileHeight(int)

Returns the overall height of the current tile in pixels, for the given resolution level. This is the tile's height without accounting for any component subsampling.

       <p>Note: Tile resolution level indexes may be different from
       tile-component resolution index. They are indeed indexed starting from
       the lowest number of decomposition levels of each component of the
       tile.</p><p>For an image (1 tile) with 2 components (component 0 having 2
       decomposition levels and component 1 having 3 decomposition levels),
       the first (tile-)component has 3 resolution levels and the second one
       has 4 resolution levels, whereas the tile has only 3 resolution levels
       available.</p>
getTileWidth(int)

Returns the overall width of the current tile in pixels for the given (tile) resolution level. This is the tile's width without accounting for any component subsampling.

       <p>Note: Tile resolution level indexes may be different from
       tile-component resolution index. They are indeed indexed starting from
       the lowest number of decomposition levels of each component of the
       tile.</p><p>For an image (1 tile) with 2 components (component 0 having 2
       decomposition levels and component 1 having 3 decomposition levels),
       the first (tile-)component has 3 resolution levels and the second one
       has 4 resolution levels, whereas the tile has only 3 resolution levels
       available.</p>
initSubbandsFields(int, SubbandSyn)

Initialises subbands fields, such as number of code-blocks, code-blocks dimension and number of magnitude bits, in the subband tree. The nominal code-block width/height depends on the precincts dimensions if used. The way the number of magnitude bits is computed depends on the quantization type (reversible, derived, expounded).

nextTile()

Advances to the next tile, in standard scan-line order (by rows then columns). An NoNextElementException is thrown if the current tile is the last one (i.e. there is no next tile).

setTile(int, int)

Changes the current tile, given the new indexes. An IllegalArgumentException is thrown if the indexes do not correspond to a valid tile.