cblkratediststats.java
来自「jpeg2000编解码」· Java 代码 · 共 371 行 · 第 1/2 页
JAVA
371 行
/** * CVS identifier: * * $Id: CBlkRateDistStats.java,v 1.1.1.1 2002/07/22 09:26:49 grosbois Exp $ * * Class: CBlkRateDistStats * * Description: The coded (compressed) code-block with * rate-distortion statistics. * * COPYRIGHT: * * This software module was originally developed by Rapha雔 Grosbois and * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel * Askel鰂 (Ericsson Radio Systems AB); and Bertrand Berthelot, David * Bouchard, F閘ix Henry, Gerard Mozelle and Patrice Onno (Canon Research * Centre France S.A) in the course of development of the JPEG2000 * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This * software module is an implementation of a part of the JPEG 2000 * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio * Systems AB and Canon Research Centre France S.A (collectively JJ2000 * Partners) agree not to assert against ISO/IEC and users of the JPEG * 2000 Standard (Users) any of their rights under the copyright, not * including other intellectual property rights, for this software module * with respect to the usage by ISO/IEC and Users of this software module * or modifications thereof for use in hardware or software products * claiming conformance to the JPEG 2000 Standard. Those intending to use * this software module in hardware or software products are advised that * their use may infringe existing patents. The original developers of * this software module, JJ2000 Partners and ISO/IEC assume no liability * for use of this software module or modifications thereof. No license * or right to this software module is granted for non JPEG 2000 Standard * conforming products. JJ2000 Partners have full right to use this * software module for his/her own purpose, assign or donate this * software module to any third party and to inhibit third parties from * using this software module for non JPEG 2000 Standard conforming * products. This copyright notice must be included in all copies or * derivative works of this software module. * * Copyright (c) 1999/2000 JJ2000 Partners. * */package jj2000.j2k.entropy.encoder;import jj2000.j2k.wavelet.analysis.*;import jj2000.j2k.entropy.*;import security.*;import java.io.*;/** * This class stores coded (compressed) code-blocks with their associated * rate-distortion statistics. This object should always contain all the * compressed data of the code-block. It is applicable to the encoder engine * only. Some data of the coded-block is stored in the super class, see * CodedCBlk. * * <p>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.</p> * * <p>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.</p> * * <p>The slope (reduction of distortion divided by the increase in rate) at * each of the valid truncation points is stored in 'truncSlopes'.</p> * * <p>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.</p> * * <p>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.</p> * * <p>The compressed data is stored in the 'data' member variable of the super * class.</p> * * @see CodedCBlk * */public class CBlkRateDistStats extends CodedCBlk { /** The subband to which the code-block belongs */ public SubbandAn sb; /** The total number of truncation points */ public int nTotTrunc; /** The number of valid truncation points */ public int nVldTrunc; /** The rate (in bytes) for each truncation point (valid and non-valid * ones) */ public int truncRates[]; /** The distortion for each truncation point (valid and non-valid ones) */ public double truncDists[]; /** The negative of the rate-distortion slope for each valid truncation point */ public float truncSlopes[]; /** The indices of the valid truncation points, in increasing order.*/ public int truncIdxs[]; /** Array of flags indicating terminated passes (valid or non-valid * truncation points). */ public boolean isTermPass[]; /** The number of ROI coefficients in the code-block */ public int nROIcoeff = 0; /** Number of ROI coding passes */ public int nROIcp = 0; /** Whether or not this code-block is or has to be scrambled */ public boolean scrambled = false; /** Scrambling type (only valid if <tt>scrambled</tt> is true) */ public int scramblingType = ScramblingTypes.NO_SCRAMBLING; /** Seed value to use for scrambling */ public long seed = 0; /** Reference to the last contributed coding pass (-1 means no * contribution yet). This field is updated during the * rate-allocation procedure when simulating the layer progressive * codestream. */ public int lastContribIdx = -1; /** Offset of the first scrambled codeword */ public int scrambOff = 0; /** * Creates a new CBlkRateDistStats object without allocating any space for * 'truncRates', 'truncSlopes', 'truncDists' and 'truncIdxs' or 'data'. * */ public CBlkRateDistStats() { } /** * 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. * * <p>The valid truncation points are selected by taking them as lying on * a convex hull. This is done by calling the method * selectConvexHull().</p> * * <p>Note that the arrays 'rates' and 'termp' are copied, not referenced, * so they can be modified after a call to this constructor.</p> * * @param m The horizontal index of the code-block, within the subband. * * @param n The vertical index of the code-block, within the subband. * * @param skipMSBP The number of skipped most significant bit-planes for * this code-block. * * @param data The compressed data. This array is referenced by this * object so it should not be modified after. * * @param 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. * * @param 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. * * @param 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. * * @param np The number of truncation points contained in 'rates', 'dist' * and 'termp'.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?