public class CBlkRateDistStats extends CodedCBlk
The rate-distortion statistics (i.e. R-D slope) is stored for valid points only. The set of valid points is determined by the entropy coder engine itself. Normally they are selected so as to lye in a convex hull, which can be achived by using the 'selectConvexHull' method of this class, but some other strategies might be employed.
The rate (in bytes) for each truncation point (valid or not) is stored in the 'truncRates' array. The rate of a truncation point is the total number of bytes in 'data' (see super class) that have to be decoded to reach the truncation point.
The slope (reduction of distortion divided by the increase in rate) at each of the valid truncation points is stored in 'truncSlopes'.
The index of each valid truncation point is stored in 'truncIdxs'. The index should be interpreted in the following way: a valid truncation point at position 'n' has the index 'truncIdxs[n]', the rate 'truncRates[truncIdxs[n]]' and the slope 'truncSlopes[n]'. The arrays 'truncIdxs' and 'truncRates' have at least 'nVldTrunc' elements. The 'truncRates' array has at least 'nTotTrunc' elements.
In addition the 'isTermPass' array contains a flag for each truncation point (valid and non-valid ones) that tells if the pass is terminated or not. If this variable is null then it means that no pass is terminated, except the last one which always is.
The compressed data is stored in the 'data' member variable of the super class.
CodedCBlk
Modifier and Type | Field and Description |
---|---|
boolean[] |
isTermPass
Array of flags indicating terminated passes (valid or non-valid
truncation points).
|
int |
nROIcoeff
The number of ROI coefficients in the code-block
|
int |
nROIcp
Number of ROI coding passes
|
int |
nTotTrunc
The total number of truncation points
|
int |
nVldTrunc
The number of valid truncation points
|
SubbandAn |
sb
The subband to which the code-block belongs
|
double[] |
truncDists
The distortion for each truncation point (valid and non-valid ones)
|
int[] |
truncIdxs
The indices of the valid truncation points, in increasing
order.
|
int[] |
truncRates
The rate (in bytes) for each truncation point (valid and non-valid
ones)
|
float[] |
truncSlopes
The negative of the rate-distortion slope for each valid truncation
point
|
Constructor and Description |
---|
CBlkRateDistStats()
Creates a new CBlkRateDistStats object without allocating any space for
'truncRates', 'truncSlopes', 'truncDists' and 'truncIdxs' or 'data'.
|
CBlkRateDistStats(int m,
int n,
int skipMSBP,
byte[] data,
int[] rates,
double[] dists,
boolean[] termp,
int np,
boolean inclast)
Creates a new CBlkRateDistStats object and initializes the valid
truncation points, their rates and their slopes, from the 'rates' and
'dist' arrays.
|
Modifier and Type | Method and Description |
---|---|
void |
selectConvexHull(int[] rates,
double[] dists,
boolean[] termp,
int n,
boolean inclast)
Compute the rate-distorsion slopes and selects those that lie in a
convex hull.
|
String |
toString()
Returns the contents of the object in a string.
|
public SubbandAn sb
public int nTotTrunc
public int nVldTrunc
public int[] truncRates
public double[] truncDists
public float[] truncSlopes
public int[] truncIdxs
public boolean[] isTermPass
public int nROIcoeff
public int nROIcp
public CBlkRateDistStats()
public CBlkRateDistStats(int m, int n, int skipMSBP, byte[] data, int[] rates, double[] dists, boolean[] termp, int np, boolean inclast)
The valid truncation points are selected by taking them as lying on a convex hull. This is done by calling the method selectConvexHull().
Note that the arrays 'rates' and 'termp' are copied, not referenced, so they can be modified after a call to this constructor.
m
- The horizontal index of the code-block, within the subband.n
- The vertical index of the code-block, within the subband.skipMSBP
- The number of skipped most significant bit-planes for
this code-block.data
- The compressed data. This array is referenced by this
object so it should not be modified after.rates
- The rates (in bytes) for each truncation point in the
compressed data. This array is modified by the method but no reference
is kept to it.dists
- The reduction in distortion (with respect to no information
coded) for each truncation point. This array is modified by the method
but no reference is kept to it.termp
- An array of boolean flags indicating, for each pass, if a
pass is terminated or not (true if terminated). If null then it is
assumed that no pass is terminated except the last one which always is.np
- The number of truncation points contained in 'rates', 'dist'
and 'termp'.inclast
- If false the convex hull is constructed as for lossy
coding. If true it is constructed as for lossless coding, in which case
it is ensured that all bit-planes are sent (i.e. the last truncation
point is always included).public void selectConvexHull(int[] rates, double[] dists, boolean[] termp, int n, boolean inclast)
Note that the arrays 'rates' and 'termp' are copied, not referenced, so they can be modified after a call to this method.
rates
- The rates (in bytes) for each truncation point in the
compressed data. This array is modified by the method.dists
- The reduction in distortion (with respect to no
information coded) for each truncation point. This array is modified by
the method.termp
- An array of boolean flags indicating, for each pass, if a
pass is terminated or not (true if terminated). If null then it is
assumed that no pass is terminated except the last one which always is.n
- The number of truncation points contained in 'rates', 'dist'
and 'termp'.inclast
- If false the convex hull is constructed as for lossy
coding. If true it is constructed as for lossless coding, in which case
it is ensured that all bit-planes are sent (i.e. the last truncation
point is always included).Copyright © 2015–2022 SCIFIO. All rights reserved.