|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jj2000.j2k.codestream.reader.BitstreamReaderAgent
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 | |
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 |
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 java.lang.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 int |
res
Image resolution level to generate |
protected SubbandSyn[] |
subbTrees
The subband trees for each component in the current tile. |
protected int |
tnbytes
Number of bytes targeted to be read |
protected float |
trate
Target decoding rate in bpp |
Constructor Summary | |
protected |
BitstreamReaderAgent(HeaderDecoder hd,
DecoderSpecs decSpec)
Initializes members of this class. |
Method Summary | |
static BitstreamReaderAgent |
createInstance(RandomAccessIO in,
HeaderDecoder hd,
ParameterList pl,
DecoderSpecs decSpec)
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 |
getCompHeight(int c,
int rl)
Returns the height in pixels of the specified component in the current tile, for the given (tile-component) resolution level. |
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 |
getCompWidth(int c,
int rl)
Returns the width in pixels of the specified component in the current tile, for the given (tile-component) resolution level. |
int |
getHeight(int rl)
Returns the overall height of the current tile in pixels, for the given resolution level. |
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. |
Coord |
getNumCodeBlocks(SubbandSyn sb,
int c,
Coord co)
Returns the number of code-blocks in a subband, along the horizontal and vertical dimensions. |
int |
getNumComps()
Returns the number of components in the image. |
int |
getNumTiles()
Returns the total number of tiles in the image. |
Coord |
getNumTiles(Coord co)
Returns the number of tiles in the horizontal and vertical directions. |
static java.lang.String[][] |
getParameterInfo()
Returns the parameters that are used in this class and implementing classes. |
int |
getPartitionULX()
Returns the horizontal coordinate of the origin of the cell and code-block partition, with respect to the canvas origin, on the reference grid. |
int |
getPartitionULY()
Returns the vertical coordinate of the origin of the cell and code-block partition, with respect to the canvas origin, on the reference grid. |
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. |
SubbandSyn |
getSubbandTree(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. |
Coord |
getTile(Coord co)
Returns the indexes of the current tile. |
int |
getTileIdx()
Returns the index of the current tile, relative to a standard scan-line order. |
Coord |
getTileOff(Coord co,
int c,
int rl)
Returns the horizontal and vertical offset of the upper-left corner of the current tile, in the specified component, relative to the canvas origin, for the specified resolution level. |
int |
getULX(int c,
int rl)
Returns the horizontal coordinate of the upper-left corner of the active tile, with respect to the canvas origin, in the component coordinates, for the specified component and resolution level. |
int |
getULY(int c,
int rl)
Returns the vertical coordinate of the upper-left corner of the active tile, with respect to the canvas origin, in the component coordinates, for the specified component and resolution level. |
int |
getWidth(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. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected DecoderSpecs decSpec
protected boolean[] derived
initSubbandsFields(int, jj2000.j2k.wavelet.synthesis.SubbandSyn)
protected int[] gb
initSubbandsFields(int, jj2000.j2k.wavelet.synthesis.SubbandSyn)
protected StdDequantizerParams[] params
initSubbandsFields(int, jj2000.j2k.wavelet.synthesis.SubbandSyn)
public static final char OPT_PREFIX
private static final java.lang.String[][] pinfo
protected int[] mdl
protected final int nc
protected int res
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 int ctX
protected int ctY
protected final HeaderDecoder hd
protected int tnbytes
protected int anbytes
protected float trate
protected float arate
Constructor Detail |
protected BitstreamReaderAgent(HeaderDecoder hd, DecoderSpecs decSpec)
hd
- The decoded header of the bit stream from where to initialize
the values.decSpec
- The decoder specificationsMethod Detail |
public final int getPartitionULX()
public int getPartitionULY()
public final int getNumComps()
public final int getCompSubsX(int c)
c
- The index of the component (between 0 and N-1)ImgData
public int getCompSubsY(int c)
c
- The index of the component (between 0 and C-1)ImgData
public int getWidth(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.
rl
- The (tile) resolution level.public int getHeight(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.
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.
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.
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.
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.
rl
- The resolution level, from 0 to L.public final int getCompWidth(int c, int rl)
c
- The index of the component, from 0 to N-1.rl
- The resolution level, from 0 to L.public final int getCompHeight(int c, int rl)
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.
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.
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)
x
- The horizontal indexes the tile.y
- The vertical indexes of the new tile.public abstract void nextTile()
public final Coord getTile(Coord co)
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()
public final Coord getTileOff(Coord co, int c, int rl)
co
- If not null the object is used to return the values, if null
a new one is created and returned.c
- The index of the component (between 0 and N-1)rl
- The resolution level, from 0 to L.public final int getULX(int c, int rl)
c
- The index of the component (between 0 and N-1)rl
- The resolution level, from 0 to L.public final int getULY(int c, int rl)
c
- The index of the component (between 0 and N-1)rl
- The resolution level, from 0 to L.public final Coord getNumTiles(Coord co)
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()
public final SubbandSyn getSubbandTree(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.
t
- The tile indexc
- The index of the component, from 0 to C-1.public final Coord getNumCodeBlocks(SubbandSyn sb, int c, Coord co)
sb
- The subband for which to return the number of blocks.c
- The component where the subband is.co
- If not null the values are returned in this object. If null a
new object is allocated and returned.public static BitstreamReaderAgent createInstance(RandomAccessIO in, HeaderDecoder hd, ParameterList pl, DecoderSpecs decSpec) throws java.io.IOException
in
- The RandomAccessIO source from which to read the bit stream.hd
- Header of the codestream.pl
- The parameter list containing parameters applicable to the
bit stream read (other parameters may also be present).decSpec
- The decoder specificationspublic static java.lang.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()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |