| java.lang.Object jj2000.j2k.codestream.reader.BitstreamReaderAgent
All known Subclasses: jj2000.j2k.codestream.reader.FileBitstreamReaderAgent,
BitstreamReaderAgent | abstract public class BitstreamReaderAgent implements CodedCBlkDataSrcDec(Code) | | 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.
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.
The bit stream reader agent has the notion of a current tile, and
coordinates are relative to the current tile, where applicable.
Resolution level 0 is the lowest resolution level, i.e. the LL subband
alone.
|
Field Summary | |
final public static char | OPT_PREFIX | protected int | anbytes | protected float | arate | final protected int | ax The horizontal coordinate of the image origin in the canvas system, on
the reference grid. | final protected int | ay The vertical coordinate of the image origin in the canvas system, on
the reference grid. | protected int | ctX | protected int | ctY | final protected int | 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. | final protected int | 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. | protected DecoderSpecs | decSpec | protected boolean | derived Whether or not the components in the current tile uses a derived
quantization step size (only relevant in non reversible quantization
mode). | protected int[] | gb Number of guard bits off all component in the current tile. | final protected HeaderDecoder | hd | final protected int | imgH | final protected int | imgW | protected int | mdl The maximum number of decompostion levels for each component of the
current tile. | final protected int | nc | final protected int | nt The total number of tiles. | final protected int | ntH | final protected int | ntW | final protected int | ntX | final protected int | ntY | final protected int | 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. | final protected int | 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. | protected StdDequantizerParams | params Dequantization parameters of all subbands and all components in the
current tile. | final protected int | px The horizontal coordinate of the tiling origin in the canvas system, on
the reference grid. | final protected int | py The vertical coordinate of the tiling origin in the canvas system, on
the reference grid. | protected SubbandSyn | subbTrees The subband trees for each component in the current tile. | protected int | targetRes | protected int | tnbytes | protected float | trate |
Method Summary | |
public static BitstreamReaderAgent | createInstance(RandomAccessIO in, HeaderDecoder hd, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec, boolean cdstrInfo, HeaderInfo hi) Creates a bit stream reader of the correct type that works on the
provided RandomAccessIO, with the special parameters from the parameter
list.
Parameters: in - The RandomAccessIO source from which to read the bit stream. Parameters: hd - Header of the codestream. Parameters: j2krparam - The parameters applicable to thebit stream read (other parameters may also be present). Parameters: decSpec - The decoder specifications Parameters: cdstrInfo - Whether or not to print information found incodestream. | public int | getActualNbytes() Return the actual number of read bytes. | public float | getActualRate() Return the actual decoding rate in bits per pixel. | final public int | getCbULX() Returns the vertical code-block partition origin. | public int | getCbULY() Returns the vertical code-block partition origin. | final public int | getCompImgHeight(int c, int rl) Returns the height in pixels of the specified component in the overall
image, for the given (component) resolution level.
Note: Component resolution level indexes may differ from
tile-component resolution index. | final public int | getCompImgWidth(int c, int rl) Returns the width in pixels of the specified component in the overall
image, for the given (component) resolution level.
Note: Component resolution level indexes may differ from
tile-component resolution index. | final public int | getCompSubsX(int c) Returns the component subsampling factor in the horizontal direction,
for the specified component. | public int | getCompSubsY(int c) Returns the component subsampling factor in the vertical direction, for
the specified component. | public int | getImgHeight(int rl) Returns the overall height of the image in pixels, for the given
resolution level. | public int | getImgRes() Returns the image resolution level to reconstruct from the
codestream. | public int | getImgULX(int rl) 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.
Note: Image resolution level indexes may differ from tile-component
resolution index. | public int | getImgULY(int rl) 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.
Note: Image resolution level indexes may differ from tile-component
resolution index. | public int | getImgWidth(int rl) Returns the overall width of the image in pixels, for the given (image)
resolution level. | public int | getNomTileHeight() | public int | getNomTileWidth() | final public int | getNumComps() Returns the number of components in the image. | final public Point | getNumTiles(Point co) Returns the number of tiles in the horizontal and vertical directions.
Parameters: co - If not null this object is used to return the information. | final public int | getNumTiles() Returns the total number of tiles in the image. | final public int | getPPX(int t, int c, int rl) Returns the precinct partition width for the specified tile-component
and (tile-component) resolution level.
Parameters: t - the tile index Parameters: c - The index of the component (between 0 and N-1) Parameters: rl - The resolution level, from 0 to L. | final public int | getPPY(int t, int c, int rl) Returns the precinct partition height for the specified tile-component
and (tile-component) resolution level.
Parameters: t - The tile index Parameters: c - The index of the component (between 0 and N-1) Parameters: rl - The resolution level, from 0 to L. | public static String[][] | getParameterInfo() Returns the parameters that are used in this class and implementing
classes. | final public int | getResULX(int c, int rl) Returns the horizontal coordinate of the upper-left corner of the
specified resolution in the given component of the current tile. | final public int | getResULY(int c, int rl) Returns the vertical coordinate of the upper-left corner of the
specified component in the given component of the current tile. | final public SubbandSyn | getSynSubbandTree(int t, int c) Returns the subband tree, for the specified tile-component. | public int | getTargetNbytes() Return the target number of read bytes. | public float | getTargetRate() Return the target decoding rate in bits per pixel. | final public Point | getTile(Point co) Returns the indexes of the current tile. | final public int | getTileCompHeight(int t, int c, int rl) Returns the height in pixels of the specified tile-component for the
given (tile-component) resolution level.
Parameters: t - The tile index. Parameters: c - The index of the component, from 0 to N-1. Parameters: rl - The resolution level, from 0 to L. | final public int | getTileCompWidth(int t, int c, int rl) Returns the width in pixels of the specified tile-component for the
given (tile-component) resolution level.
Parameters: t - The tile index Parameters: c - The index of the component, from 0 to N-1. Parameters: rl - The resolution level, from 0 to L. | public int | getTileHeight(int rl) Returns the overall height of the current tile in pixels, for the given
resolution level. | final public int | getTileIdx() Returns the index of the current tile, relative to a standard scan-line
order. | public int | getTilePartULX() | public int | getTilePartULY() | public int | getTileWidth(int rl) Returns the overall width of the current tile in pixels for the given
(tile) resolution level. | protected void | initSubbandsFields(int c, SubbandSyn sb) Initialises subbands fields, such as code-blocks dimension and number
of magnitude bits, in the subband tree. | abstract public void | nextTile() Advances to the next tile, in standard scan-line order (by rows then
columns). | abstract public void | setTile(int x, int y) Changes the current tile, given the new indexes. |
OPT_PREFIX | final public static char OPT_PREFIX(Code) | | The prefix for bit stream reader options: 'B'
|
anbytes | protected int anbytes(Code) | | Actual number of read bytes
|
arate | protected float arate(Code) | | Actual decoding rate in bpp
|
ax | final protected int ax(Code) | | The horizontal coordinate of the image origin in the canvas system, on
the reference grid.
|
ay | final protected int ay(Code) | | The vertical coordinate of the image origin in the canvas system, on
the reference grid.
|
ctX | protected int ctX(Code) | | The current tile horizontal index
|
ctY | protected int ctY(Code) | | The current tile vertical index
|
culx | final protected int culx(Code) | | 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 | final protected int culy(Code) | | 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.
|
derived | protected boolean derived(Code) | | 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.
See Also: FileBitstreamReaderAgent.initSubbandsFields |
imgH | final protected int imgH(Code) | | The image width on the hi-res reference grid
|
imgW | final protected int imgW(Code) | | The image width on the hi-res reference grid
|
mdl | protected int mdl(Code) | | 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 | final protected int nc(Code) | | The number of components
|
nt | final protected int nt(Code) | | The total number of tiles.
|
ntH | final protected int ntH(Code) | | The nominal tile height, in the hi-res reference grid
|
ntW | final protected int ntW(Code) | | The nominal tile width, in the hi-res reference grid
|
ntX | final protected int ntX(Code) | | The number of tile in the horizontal direction
|
ntY | final protected int ntY(Code) | | The number of tiles in the vertical direction
|
offX | final protected int offX(Code) | | 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 | final protected int offY(Code) | | 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.
|
px | final protected int px(Code) | | The horizontal coordinate of the tiling origin in the canvas system, on
the reference grid.
|
py | final protected int py(Code) | | The vertical coordinate of the tiling origin in the canvas system, on
the reference grid.
|
subbTrees | protected SubbandSyn subbTrees(Code) | | 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 | protected int targetRes(Code) | | Image resolution level to generate
|
tnbytes | protected int tnbytes(Code) | | Number of bytes targeted to be read
|
trate | protected float trate(Code) | | Target decoding rate in bpp
|
BitstreamReaderAgent | protected BitstreamReaderAgent(HeaderDecoder hd, DecoderSpecs decSpec)(Code) | | 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.
Parameters: hd - The decoded header of the bit stream from where to initializethe values. Parameters: decSpec - The decoder specifications |
createInstance | public static BitstreamReaderAgent createInstance(RandomAccessIO in, HeaderDecoder hd, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec, boolean cdstrInfo, HeaderInfo hi) throws IOException(Code) | | Creates a bit stream reader of the correct type that works on the
provided RandomAccessIO, with the special parameters from the parameter
list.
Parameters: in - The RandomAccessIO source from which to read the bit stream. Parameters: hd - Header of the codestream. Parameters: j2krparam - The parameters applicable to thebit stream read (other parameters may also be present). Parameters: decSpec - The decoder specifications Parameters: cdstrInfo - Whether or not to print information found incodestream. Parameters: hi - Reference to the HeaderInfo instance. exception: IOException - If an I/O error occurs while reading initialdata from the bit stream. exception: IllegalArgumentException - If an unrecognised bit streamreader option is present. |
getActualNbytes | public int getActualNbytes()(Code) | | Return the actual number of read bytes.
Actual decoding rate in bytes. |
getActualRate | public float getActualRate()(Code) | | Return the actual decoding rate in bits per pixel.
Actual decoding rate in bpp. |
getCbULX | final public int getCbULX()(Code) | | Returns the vertical code-block partition origin. Allowable values are
0 and 1, nothing else.
|
getCbULY | public int getCbULY()(Code) | | Returns the vertical code-block partition origin. Allowable values are
0 and 1, nothing else.
|
getCompImgHeight | final public int getCompImgHeight(int c, int rl)(Code) | | Returns the height in pixels of the specified component in the overall
image, for the given (component) resolution level.
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.
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.
Parameters: c - The index of the component, from 0 to N-1. Parameters: rl - The resolution level, from 0 to L. The height in pixels of component c in the overallimage. |
getCompImgWidth | final public int getCompImgWidth(int c, int rl)(Code) | | Returns the width in pixels of the specified component in the overall
image, for the given (component) resolution level.
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.
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.
Parameters: c - The index of the component, from 0 to N-1. Parameters: rl - The resolution level, from 0 to L. The width in pixels of component c in the overallimage. |
getCompSubsX | final public int getCompSubsX(int c)(Code) | | 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.
Parameters: c - The index of the component (between 0 and N-1) The horizontal subsampling factor of component 'c' See Also: jj2000.j2k.image.ImgData |
getCompSubsY | public int getCompSubsY(int c)(Code) | | 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.
Parameters: c - The index of the component (between 0 and C-1) The vertical subsampling factor of component 'c' See Also: jj2000.j2k.image.ImgData |
getImgHeight | public int getImgHeight(int rl)(Code) | | 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.
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.
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.
Parameters: rl - The image resolution level, from 0 to L. The total image's height in pixels. |
getImgRes | public int getImgRes()(Code) | | Returns the image resolution level to reconstruct from the
codestream. This value cannot be computed before every main and tile
headers are read.
The image resolution level |
getImgULX | public int getImgULX(int rl)(Code) | | 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.
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.
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.
Parameters: rl - The resolution level, from 0 to L. The horizontal coordinate of the image origin in the canvassystem, on the reference grid. |
getImgULY | public int getImgULY(int rl)(Code) | | 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.
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.
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.
Parameters: rl - The resolution level, from 0 to L. The vertical coordinate of the image origin in the canvassystem, on the reference grid. |
getImgWidth | public int getImgWidth(int rl)(Code) | | 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.
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.
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.
Parameters: rl - The image resolution level. The total image's width in pixels. |
getNomTileHeight | public int getNomTileHeight()(Code) | | Returns the nominal tile height
|
getNomTileWidth | public int getNomTileWidth()(Code) | | Returns the nominal tile width
|
getNumComps | final public int getNumComps()(Code) | | Returns the number of components in the image.
The number of components in the image. |
getNumTiles | final public Point getNumTiles(Point co)(Code) | | Returns the number of tiles in the horizontal and vertical directions.
Parameters: co - If not null this object is used to return the information. Ifnull a new one is created and returned. The number of tiles in the horizontal (Point.x) and vertical(Point.y) directions. |
getNumTiles | final public int getNumTiles()(Code) | | Returns the total number of tiles in the image.
The total number of tiles in the image. |
getPPX | final public int getPPX(int t, int c, int rl)(Code) | | Returns the precinct partition width for the specified tile-component
and (tile-component) resolution level.
Parameters: t - the tile index Parameters: c - The index of the component (between 0 and N-1) Parameters: rl - The resolution level, from 0 to L. the precinct partition width for the specified component,resolution level and tile. |
getPPY | final public int getPPY(int t, int c, int rl)(Code) | | Returns the precinct partition height for the specified tile-component
and (tile-component) resolution level.
Parameters: t - The tile index Parameters: c - The index of the component (between 0 and N-1) Parameters: rl - The resolution level, from 0 to L. The precinct partition height in the specified component, forthe specified resolution level, for the current tile. |
getParameterInfo | public static String[][] getParameterInfo()(Code) | | 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.
the options name, their synopsis and their explanation, or nullif no options are supported. |
getResULX | final public int getResULX(int c, int rl)(Code) | | Returns the horizontal coordinate of the upper-left corner of the
specified resolution in the given component of the current tile.
Parameters: c - The component index. Parameters: rl - The resolution level index. |
getResULY | final public int getResULY(int c, int rl)(Code) | | Returns the vertical coordinate of the upper-left corner of the
specified component in the given component of the current tile.
Parameters: c - The component index. Parameters: rl - The resolution level index. |
getSynSubbandTree | final public SubbandSyn getSynSubbandTree(int t, int c)(Code) | | 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.
Note: this method is not able to return subband tree for a tile
different than the current one.
The number of magnitude bits ('magBits' member variable) for each
subband is not initialized.
Parameters: t - The tile index Parameters: c - The index of the component, from 0 to C-1. The root of the tree structure. |
getTargetNbytes | public int getTargetNbytes()(Code) | | Return the target number of read bytes.
Target decoding rate in bytes. |
getTargetRate | public float getTargetRate()(Code) | | Return the target decoding rate in bits per pixel.
Target decoding rate in bpp. |
getTile | final public Point getTile(Point co)(Code) | | Returns the indexes of the current tile. These are the horizontal and
vertical indexes of the current tile.
Parameters: co - If not null this object is used to return the information. Ifnull a new one is created and returned. The current tile's indexes (vertical and horizontal indexes). |
getTileCompHeight | final public int getTileCompHeight(int t, int c, int rl)(Code) | | Returns the height in pixels of the specified tile-component for the
given (tile-component) resolution level.
Parameters: t - The tile index. Parameters: c - The index of the component, from 0 to N-1. Parameters: rl - The resolution level, from 0 to L. The height in pixels of component c in the currenttile. |
getTileCompWidth | final public int getTileCompWidth(int t, int c, int rl)(Code) | | Returns the width in pixels of the specified tile-component for the
given (tile-component) resolution level.
Parameters: t - The tile index Parameters: c - The index of the component, from 0 to N-1. Parameters: rl - The resolution level, from 0 to L. The width in pixels of component c in tile tfor resolution level rl. |
getTileHeight | public int getTileHeight(int rl)(Code) | | 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.
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.
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.
Parameters: rl - The (tile) resolution level. The total current tile's height in pixels. |
getTileIdx | final public int getTileIdx()(Code) | | Returns the index of the current tile, relative to a standard scan-line
order.
The current tile's index (starts at 0). |
getTilePartULX | public int getTilePartULX()(Code) | | Returns the horizontal offset of tile partition
|
getTilePartULY | public int getTilePartULY()(Code) | | Returns the vertical offset of tile partition
|
getTileWidth | public int getTileWidth(int rl)(Code) | | 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.
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.
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.
Parameters: rl - The (tile) resolution level. The current tile's width in pixels. |
initSubbandsFields | protected void initSubbandsFields(int c, SubbandSyn sb)(Code) | | Initialises subbands fields, such as 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).
Parameters: c - The component index Parameters: sb - The subband tree to be initialised. |
nextTile | abstract public void nextTile()(Code) | | 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 | abstract public void setTile(int x, int y)(Code) | | Changes the current tile, given the new indexes. An
IllegalArgumentException is thrown if the indexes do not correspond to
a valid tile.
Parameters: x - The horizontal indexes the tile. Parameters: y - The vertical indexes of the new tile. |
|
|