public abstract class BitstreamReaderAgent extends Object implements CodedCBlkDataSrcDec
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.
Modifier and Type | Field and Description |
---|---|
protected int |
anbytes
Actual number of read bytes
|
protected float |
arate
Actual decoding rate in bpp
|
protected int |
ax
The horizontal coordinate of the image origin in the canvas system, on
the reference grid.
|
protected int |
ay
The vertical coordinate of the image origin in the canvas system, on
the reference grid.
|
protected int |
ctX
The current tile horizontal index
|
protected int |
ctY
The current tile vertical index
|
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.
|
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
The decoder specifications
|
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.
|
protected HeaderDecoder |
hd
The decoded bit stream header
|
protected int |
imgH
The image width on the hi-res reference grid
|
protected int |
imgW
The image width on the hi-res reference grid
|
protected int[] |
mdl
The maximum number of decompostion levels for each component of the
current tile.
|
protected int |
nc
The number of components
|
protected int |
nt
The total number of tiles.
|
protected int |
ntH
The nominal tile height, in the hi-res reference grid
|
protected int |
ntW
The nominal tile width, in the hi-res reference grid
|
protected int |
ntX
The number of tile in the horizontal direction
|
protected int |
ntY
The number of tiles in the vertical direction
|
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.
|
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.
|
static char |
OPT_PREFIX
The prefix for bit stream reader options: 'B'
|
protected StdDequantizerParams[] |
params
Dequantization parameters of all subbands and all components in the
current tile.
|
private static String[][] |
pinfo
The list of parameters that is accepted by the bit stream
readers.
|
protected int |
px
The horizontal coordinate of the tiling origin in the canvas system, on
the reference grid.
|
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
Image resolution level to generate
|
protected int |
tnbytes
Number of bytes targeted to be read
|
protected float |
trate
Target decoding rate in bpp
|
Modifier | Constructor and Description |
---|---|
protected |
BitstreamReaderAgent(HeaderDecoder hd,
DecoderSpecs decSpec)
Initializes members of this class.
|
Modifier and Type | Method and Description |
---|---|
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.
|
int |
getActualNbytes()
Return the actual number of read bytes.
|
float |
getActualRate()
Return the actual decoding rate in bits per pixel.
|
int |
getCbULX()
Returns the vertical code-block partition origin.
|
int |
getCbULY()
Returns the vertical code-block partition origin.
|
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.
|
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.
|
int |
getCompSubsX(int c)
Returns the component subsampling factor in the horizontal direction,
for the specified component.
|
int |
getCompSubsY(int c)
Returns the component subsampling factor in the vertical direction, for
the specified component.
|
int |
getImgHeight(int rl)
Returns the overall height of the image in pixels, for the given
resolution level.
|
int |
getImgRes()
Returns the image resolution level to reconstruct from the
codestream.
|
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.
|
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.
|
int |
getImgWidth(int rl)
Returns the overall width of the image in pixels, for the given (image)
resolution level.
|
int |
getNomTileHeight()
Returns the nominal tile height
|
int |
getNomTileWidth()
Returns the nominal tile width
|
int |
getNumComps()
Returns the number of components in the image.
|
int |
getNumTiles()
Returns the total number of tiles in the image.
|
Point |
getNumTiles(Point co)
Returns the number of tiles in the horizontal and vertical directions.
|
static String[][] |
getParameterInfo()
Returns the parameters that are used in this class and implementing
classes.
|
int |
getPPX(int t,
int c,
int rl)
Returns the precinct partition width for the specified tile-component
and (tile-component) resolution level.
|
int |
getPPY(int t,
int c,
int rl)
Returns the precinct partition height for the specified tile-component
and (tile-component) resolution level.
|
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.
|
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.
|
SubbandSyn |
getSynSubbandTree(int t,
int c)
Returns the subband tree, for the specified tile-component.
|
int |
getTargetNbytes()
Return the target number of read bytes.
|
float |
getTargetRate()
Return the target decoding rate in bits per pixel.
|
Point |
getTile(Point co)
Returns the indexes of the current tile.
|
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.
|
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.
|
int |
getTileHeight(int rl)
Returns the overall height of the current tile in pixels, for the given
resolution level.
|
int |
getTileIdx()
Returns the index of the current tile, relative to a standard scan-line
order.
|
int |
getTilePartULX()
Returns the horizontal offset of tile partition
|
int |
getTilePartULY()
Returns the vertical offset of tile partition
|
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 void |
nextTile()
Advances to the next tile, in standard scan-line order (by rows then
columns).
|
abstract void |
setTile(int x,
int y)
Changes the current tile, given the new indexes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getCodeBlock
protected DecoderSpecs decSpec
protected boolean[] derived
protected int[] gb
protected StdDequantizerParams[] params
public static final char OPT_PREFIX
private static final String[][] pinfo
protected int[] mdl
protected final int nc
protected int targetRes
protected SubbandSyn[] subbTrees
protected final int imgW
protected final int imgH
protected final int ax
protected final int ay
protected final int px
protected final int py
protected final int[] offX
protected final int[] offY
protected final int[] culx
protected final int[] culy
protected final int ntW
protected final int ntH
protected final int ntX
protected final int ntY
protected final int nt
protected int ctX
protected int ctY
protected final HeaderDecoder hd
protected int tnbytes
protected int anbytes
protected float trate
protected float arate
protected BitstreamReaderAgent(HeaderDecoder hd, DecoderSpecs decSpec)
hd
- The decoded header of the bit stream from where to initialize
the values.decSpec
- The decoder specificationspublic final int getCbULX()
public int getCbULY()
public final int getNumComps()
getNumComps
in interface MultiResImgData
public final int getCompSubsX(int c)
getCompSubsX
in interface MultiResImgData
c
- The index of the component (between 0 and N-1)ImgData
public int getCompSubsY(int c)
getCompSubsY
in interface MultiResImgData
c
- The index of the component (between 0 and C-1)ImgData
public int getTileWidth(int rl)
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.
getTileWidth
in interface MultiResImgData
rl
- The (tile) resolution level.public int getTileHeight(int rl)
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.
getTileHeight
in interface MultiResImgData
rl
- The (tile) resolution level.public int getImgWidth(int rl)
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.
getImgWidth
in interface MultiResImgData
rl
- The image resolution level.public int getImgHeight(int rl)
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.
getImgHeight
in interface MultiResImgData
rl
- The image resolution level, from 0 to L.public int getImgULX(int rl)
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.
getImgULX
in interface MultiResImgData
rl
- The resolution level, from 0 to L.public int getImgULY(int rl)
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.
getImgULY
in interface MultiResImgData
rl
- The resolution level, from 0 to L.public final int getTileCompWidth(int t, int c, int rl)
getTileCompWidth
in interface MultiResImgData
t
- The tile indexc
- The index of the component, from 0 to N-1.rl
- The resolution level, from 0 to L.public final int getTileCompHeight(int t, int c, int rl)
getTileCompHeight
in interface MultiResImgData
t
- The tile index.c
- The index of the component, from 0 to N-1.rl
- The resolution level, from 0 to L.public final int getCompImgWidth(int c, int rl)
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.
getCompImgWidth
in interface MultiResImgData
c
- The index of the component, from 0 to N-1.rl
- The resolution level, from 0 to L.public final int getCompImgHeight(int c, int rl)
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.
getCompImgHeight
in interface MultiResImgData
c
- The index of the component, from 0 to N-1.rl
- The resolution level, from 0 to L.public abstract void setTile(int x, int y)
setTile
in interface MultiResImgData
x
- The horizontal indexes the tile.y
- The vertical indexes of the new tile.public abstract void nextTile()
nextTile
in interface MultiResImgData
public final Point getTile(Point co)
getTile
in interface MultiResImgData
co
- If not null this object is used to return the information. If
null a new one is created and returned.public final int getTileIdx()
getTileIdx
in interface MultiResImgData
public final int getResULX(int c, int rl)
getResULX
in interface MultiResImgData
c
- The component index.rl
- The resolution level index.public final int getResULY(int c, int rl)
getResULY
in interface MultiResImgData
c
- The component index.rl
- The resolution level index.public final Point getNumTiles(Point co)
getNumTiles
in interface MultiResImgData
co
- If not null this object is used to return the information. If
null a new one is created and returned.public final int getNumTiles()
getNumTiles
in interface MultiResImgData
public final SubbandSyn getSynSubbandTree(int t, int c)
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.
getSynSubbandTree
in interface InvWTData
getSynSubbandTree
in interface MultiResImgData
t
- The tile indexc
- The index of the component, from 0 to C-1.public static BitstreamReaderAgent createInstance(RandomAccessIO in, HeaderDecoder hd, J2KImageReadParamJava j2krparam, DecoderSpecs decSpec, boolean cdstrInfo, HeaderInfo hi) throws IOException
in
- The RandomAccessIO source from which to read the bit stream.hd
- Header of the codestream.j2krparam
- The parameters applicable to the
bit stream read (other parameters may also be present).decSpec
- The decoder specificationscdstrInfo
- Whether or not to print information found in
codestream.hi
- Reference to the HeaderInfo instance.IOException
- If an I/O error occurs while reading initial
data from the bit stream.IllegalArgumentException
- If an unrecognised bit stream
reader option is present.public static String[][] getParameterInfo()
public final int getPPX(int t, int c, int rl)
t
- the tile indexc
- The index of the component (between 0 and N-1)rl
- The resolution level, from 0 to L.public final int getPPY(int t, int c, int rl)
t
- The tile indexc
- The index of the component (between 0 and N-1)rl
- The resolution level, from 0 to L.protected void initSubbandsFields(int c, SubbandSyn sb)
c
- The component indexsb
- The subband tree to be initialised.public int getImgRes()
public float getTargetRate()
public float getActualRate()
public int getTargetNbytes()
public int getActualNbytes()
public int getTilePartULX()
getTilePartULX
in interface MultiResImgData
public int getTilePartULY()
getTilePartULY
in interface MultiResImgData
public int getNomTileWidth()
getNomTileWidth
in interface MultiResImgData
public int getNomTileHeight()
getNomTileHeight
in interface MultiResImgData
Copyright © 2016 Open Microscopy Environment