⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stddequantizer.java

📁 jpeg2000算法实现
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* * CVS identifier: * * $Id: StdDequantizer.java,v 1.10 2001/02/14 10:45:02 grosbois Exp $ * * Class:                   StdDequantizer * * Description:             Scalar deadzone dequantizer that returns integers *                          or floats. *                          This is a merger of the ScalarDZDeqInt and *                          ScalarDZDeqFloat classes by Joel Askelof and Diego *                          Santa Cruz. * * * * 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.quantization.dequantizer;import jj2000.j2k.wavelet.synthesis.*;import jj2000.j2k.entropy.decoder.*;import jj2000.j2k.quantization.*;import jj2000.j2k.codestream.*;import jj2000.j2k.entropy.*;import jj2000.j2k.decoder.*;import jj2000.j2k.image.*;import jj2000.j2k.io.*;import java.io.*;/** * This class implements a scalar dequantizer with deadzone. The output can be * either integer ('int') or floating-point ('float') data. The dequantization * step sizes and other parameters are taken from a StdDequantizerParams * class, which inherits from DequantizerParams. * * <P>Sign magnitude representation is used (instead of two's complement) for * the input data. The most significant bit is used for the sign (0 if * positive, 1 if negative). Then the magnitude of the quantized coefficient * is stored in the next most significat bits. The most significant magnitude * bit corresponds to the most significant bit-plane and so on. * * <P>When reversible quantization is used, this class only converts between * the sign-magnitude representation and the integer (or eventually * fixed-point) output, since there is no true quantization. * * <P>The output data is fixed-point two's complement for 'int' output and * floating-point for 'float' output. The type of output and the number number * of fractional bits for 'int' output are defined at the constructor. Each * component may have a different number of fractional bits. * * <P>The reconstruction levels used by the dequantizer are exactly what is * received from the entropy decoder. It is assumed that the entropy decoder * always returns codewords that are midways in the decoded intervals. In this * way the dequantized values will always lie midways in the quantization * intervals. * */public class StdDequantizer extends Dequantizer {    /** The quantizer type spec */    private QuantTypeSpec qts;    /** The quantizer step sizes  spec */    private QuantStepSizeSpec qsss;    /** The number of guard bits spec */    private GuardBitsSpec gbs;        /** The decoding parameters of the dequantizer */    private StdDequantizerParams params;    /** The 'DataBlkInt' object used to request data, used when output data is     * not int */    private DataBlkInt inblk;    /** Type of the current output data */    private int outdtype;    /**     * Initializes the source of compressed data. And sets the number of range     * bits and fraction bits and receives the parameters for the dequantizer.     *     * @param src From where to obtain the quantized data.     *     * @param rb The number of "range bits" (bitdepth) for each component     * (must be the "range bits" of the un-transformed components). For a     * definition of "range bits" see the getNomRangeBits() method.     *     * @param qts The quantizer type spec     *     * @param qsss The dequantizer step sizes spec     *     * @see Dequantizer#getNomRangeBits     *     * @exception IllegalArgumentException Thrown if 'outdt' is neither     * TYPE_FLOAT nor TYPE_INT, or if 'param' specify reversible quantization     * and 'outdt' is not TYPE_INT or 'fp' has non-zero values, or if 'outdt'     * is TYPE_FLOAT and 'fp' has non-zero values.     * */    public StdDequantizer(CBlkQuantDataSrcDec src,int[] utrb,                               DecoderSpecs decSpec){        super(src,utrb,decSpec);        if(utrb.length != src.getNumComps()){            throw new IllegalArgumentException("Invalid rb argument");        }        this.qsss = decSpec.qsss;	this.qts = decSpec.qts;        this.gbs = decSpec.gbs;    }    /**     * Returns the position of the fixed point in the output data for the     * specified component. This is the position of the least significant     * integral (i.e. non-fractional) bit, which is equivalent to the number     * of fractional bits. For instance, for fixed-point values with 2     * fractional bits, 2 is returned. For floating-point data this value does     * not apply and 0 should be returned. Position 0 is the position of the     * least significant bit in the data. If the output data is 'float' then 0     * is always returned.     *     * <P><u>Note:</u> Fractional bits are no more supported by JJ2000.      *     * @param c The index of the component.     *     * @return The position of the fixed-point, which is the same as     * the number of fractional bits. For floating-point data 0 is     * returned.     * */    public int getFixedPoint(int c){        return 0;    }    /**     * Returns the specified code-block in the current tile for the specified     * component, as a copy (see below).     *     * <P>The returned code-block may be progressive, which is indicated by     * the 'progressive' variable of the returned 'DataBlk' object. If a     * code-block is progressive it means that in a later request to this     * method for the same code-block it is possible to retrieve data which is     * a better approximation, since meanwhile more data to decode for the     * code-block could have been received. If the code-block is not     * progressive then later calls to this method for the same code-block     * will return the exact same data values.     *     * <P>The data returned by this method is always a copy of the internal     * data of this object, if any, and it can be modified "in place" without     * any problems after being returned. The 'offset' of the returned data is      * 0, and the 'scanw' is the same as the code-block width. See the     * 'DataBlk' class.     *     * @param c The component for which to return the next code-block.     *     * @param m The vertical index of the code-block to return, in the     * specified subband.     *     * @param n The horizontal index of the code-block to return, in the     * specified subband.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -