001/*
002 * $RCSfile: CBlkWTDataSrcDec.java,v $
003 * $Revision: 1.1 $
004 * $Date: 2005/02/11 05:02:31 $
005 * $State: Exp $
006 *
007 * Class:                   CBlkWTDataSrcDec
008 *
009 * Description:             Interface that define methods for trasnfer of WT
010 *                          data in a code-block basis (decoder side).
011 *
012 *
013 *
014 * COPYRIGHT:
015 *
016 * This software module was originally developed by Raphaël Grosbois and
017 * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel
018 * Askelöf (Ericsson Radio Systems AB); and Bertrand Berthelot, David
019 * Bouchard, Félix Henry, Gerard Mozelle and Patrice Onno (Canon Research
020 * Centre France S.A) in the course of development of the JPEG2000
021 * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This
022 * software module is an implementation of a part of the JPEG 2000
023 * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio
024 * Systems AB and Canon Research Centre France S.A (collectively JJ2000
025 * Partners) agree not to assert against ISO/IEC and users of the JPEG
026 * 2000 Standard (Users) any of their rights under the copyright, not
027 * including other intellectual property rights, for this software module
028 * with respect to the usage by ISO/IEC and Users of this software module
029 * or modifications thereof for use in hardware or software products
030 * claiming conformance to the JPEG 2000 Standard. Those intending to use
031 * this software module in hardware or software products are advised that
032 * their use may infringe existing patents. The original developers of
033 * this software module, JJ2000 Partners and ISO/IEC assume no liability
034 * for use of this software module or modifications thereof. No license
035 * or right to this software module is granted for non JPEG 2000 Standard
036 * conforming products. JJ2000 Partners have full right to use this
037 * software module for his/her own purpose, assign or donate this
038 * software module to any third party and to inhibit third parties from
039 * using this software module for non JPEG 2000 Standard conforming
040 * products. This copyright notice must be included in all copies or
041 * derivative works of this software module.
042 *
043 * Copyright (c) 1999/2000 JJ2000 Partners.
044 * */
045package jj2000.j2k.wavelet.synthesis;
046
047import jj2000.j2k.image.DataBlk;
048import jj2000.j2k.wavelet.Subband;
049import jj2000.j2k.wavelet.WaveletTransform;
050
051/**
052 * This abstract class defines methods to transfer wavelet data in a
053 * code-block by code-block basis, for the decoder side. In each call to
054 * 'getCodeBlock()' or 'getInternCodeBlock()' a new code-block is
055 * returned. The code-blocks are returned in no specific order.
056 *
057 * <P>This class is the source of data, in general, for the inverse wavelet
058 * transforms. See the 'InverseWT' class.
059 *
060 * @see InvWTData
061 *
062 * @see WaveletTransform
063 *
064 * @see jj2000.j2k.quantization.dequantizer.CBlkQuantDataSrcDec
065 *
066 * @see InverseWT
067 * */
068public interface CBlkWTDataSrcDec extends InvWTData {
069
070    /**
071     * Returns the number of bits, referred to as the "range bits",
072     * corresponding to the nominal range of the data in the specified
073     * component.
074     *
075     * <P>The returned value corresponds to the nominal dynamic range of the
076     * reconstructed image data, not of the wavelet coefficients
077     * themselves. This is because different subbands have different gains and
078     * thus different nominal ranges. To have an idea of the nominal range in
079     * each subband the subband analysis gain value from the subband tree
080     * structure, returned by the 'getSubbandTree()' method, can be used. See
081     * the 'Subband' class for more details.
082     *
083     * <P>If this number is <i>b</b> then for unsigned data the nominal range
084     * is between 0 and 2^b-1, and for signed data it is between -2^(b-1) and
085     * 2^(b-1)-1.
086     *
087     * @param c The index of the component
088     *
089     * @return The number of bits corresponding to the nominal range of the
090     * data.
091     *
092     * @see Subband
093     * */
094    public int getNomRangeBits(int c);
095
096    /**
097     * Returns the position of the fixed point in the specified component, or
098     * equivalently the number of fractional bits. This is the position of the
099     * least significant integral (i.e. non-fractional) bit, which is
100     * equivalent to the number of fractional bits. For instance, for
101     * fixed-point values with 2 fractional bits, 2 is returned. For
102     * floating-point data this value does not apply and 0 should be
103     * returned. Position 0 is the position of the least significant bit in
104     * the data.
105     *
106     * @param c The index of the component.
107     *
108     * @return The position of the fixed-point, which is the same as the
109     * number of fractional bits. For floating-point data 0 is returned.
110     * */
111     public int getFixedPoint(int c);
112
113    /**
114     * Returns the specified code-block in the current tile for the specified
115     * component, as a copy (see below).
116     *
117     * <P>The returned code-block may be progressive, which is indicated by
118     * the 'progressive' variable of the returned 'DataBlk' object. If a
119     * code-block is progressive it means that in a later request to this
120     * method for the same code-block it is possible to retrieve data which is
121     * a better approximation, since meanwhile more data to decode for the
122     * code-block could have been received. If the code-block is not
123     * progressive then later calls to this method for the same code-block
124     * will return the exact same data values.
125     *
126     * <P>The data returned by this method is always a copy of the internal
127     * data of this object, if any, and it can be modified "in place" without
128     * any problems after being returned. The 'offset' of the returned data is
129     * 0, and the 'scanw' is the same as the code-block width. See the
130     * 'DataBlk' class.
131     *
132     * @param c The component for which to return the next code-block.
133     *
134     * @param m The vertical index of the code-block to return,
135     * in the specified subband.
136     *
137     * @param n The horizontal index of the code-block to return,
138     * in the specified subband.
139     *
140     * @param sb The subband in which the code-block to return is.
141     *
142     * @param cblk If non-null this object will be used to return the new
143     * code-block. If null a new one will be allocated and returned. If the
144     * "data" array of the object is non-null it will be reused, if possible,
145     * to return the data.
146     *
147     * @return The next code-block in the current tile for component 'n', or
148     * null if all code-blocks for the current tile have been returned.
149     *
150     * @see DataBlk
151     * */
152    public DataBlk getCodeBlock(int c, int m, int n, SubbandSyn sb,
153                                DataBlk cblk);
154
155    /**
156     * Returns the specified code-block in the current tile for the specified
157     * component (as a reference or copy).
158     *
159     * <P>The returned code-block may be progressive, which is indicated by
160     * the 'progressive' variable of the returned 'DataBlk'
161     * object. If a code-block is progressive it means that in a later request
162     * to this method for the same code-block it is possible to retrieve data
163     * which is a better approximation, since meanwhile more data to decode
164     * for the code-block could have been received. If the code-block is not
165     * progressive then later calls to this method for the same code-block
166     * will return the exact same data values.
167     *
168     * <P>The data returned by this method can be the data in the internal
169     * buffer of this object, if any, and thus can not be modified by the
170     * caller. The 'offset' and 'scanw' of the returned data can be
171     * arbitrary. See the 'DataBlk' class.
172     *
173     * @param c The component for which to return the next code-block.
174     *
175     * @param m The vertical index of the code-block to return, in the
176     * specified subband.
177     *
178     * @param n The horizontal index of the code-block to return, in the
179     * specified subband.
180     *
181     * @param sb The subband in which the code-block to return is.
182     *
183     * @param cblk If non-null this object will be used to return the new
184     * code-block. If null a new one will be allocated and returned. If the
185     * "data" array of the object is non-null it will be reused, if possible,
186     * to return the data.
187     *
188     * @return The next code-block in the current tile for component 'n', or
189     * null if all code-blocks for the current tile have been returned.
190     *
191     * @see DataBlk
192     * */
193    public DataBlk getInternCodeBlock(int c, int m, int n, SubbandSyn sb,
194                                        DataBlk cblk);
195}