Class CBlkRateDistStats
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.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionboolean[]Array of flags indicating terminated passes (valid or non-valid truncation points).intThe number of ROI coefficients in the code-blockintNumber of ROI coding passesintThe total number of truncation pointsintThe number of valid truncation pointsThe subband to which the code-block belongsdouble[]The distortion for each truncation point (valid and non-valid ones)int[]The indices of the valid truncation points, in increasing order.int[]The rate (in bytes) for each truncation point (valid and non-valid ones)float[]The negative of the rate-distortion slope for each valid truncation point -
Constructor Summary
ConstructorsConstructorDescriptionCreates 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. -
Method Summary
Modifier and TypeMethodDescriptionvoidselectConvexHull(int[] rates, double[] dists, boolean[] termp, int n, boolean inclast) Compute the rate-distorsion slopes and selects those that lie in a convex hull.toString()Returns the contents of the object in a string.
-
Field Details
-
sb
The subband to which the code-block belongs -
nTotTrunc
public int nTotTruncThe total number of truncation points -
nVldTrunc
public int nVldTruncThe number of valid truncation points -
truncRates
public int[] truncRatesThe rate (in bytes) for each truncation point (valid and non-valid ones) -
truncDists
public double[] truncDistsThe distortion for each truncation point (valid and non-valid ones) -
truncSlopes
public float[] truncSlopesThe negative of the rate-distortion slope for each valid truncation point -
truncIdxs
public int[] truncIdxsThe indices of the valid truncation points, in increasing order. -
isTermPass
public boolean[] isTermPassArray of flags indicating terminated passes (valid or non-valid truncation points). -
nROIcoeff
public int nROIcoeffThe number of ROI coefficients in the code-block -
nROIcp
public int nROIcpNumber of ROI coding passes
-
-
Constructor Details
-
CBlkRateDistStats
public CBlkRateDistStats()Creates a new CBlkRateDistStats object without allocating any space for 'truncRates', 'truncSlopes', 'truncDists' and 'truncIdxs' or 'data'. -
CBlkRateDistStats
public 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. The 'rates', 'dist' and 'termp' arrays must contain the rate (in bytes), the reduction in distortion (from nothing coded) and the flag indicating if termination is used, respectively, for each truncation point.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.
- Parameters:
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).
-
-
Method Details
-
selectConvexHull
public 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. It will compute the slopes, select the ones that form the convex hull and initialize the 'truncIdxs' and 'truncSlopes' arrays, as well as 'nVldTrunc', with the selected truncation points. It will also initialize 'truncRates' and 'isTermPass' arrays, as well as 'nTotTrunc', with all the truncation points (selected or not).Note that the arrays 'rates' and 'termp' are copied, not referenced, so they can be modified after a call to this method.
- Parameters:
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).
-
toString
Returns the contents of the object in a string. This is used for debugging.
-