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.*;
048import jj2000.j2k.wavelet.*;
049
050/**
051 * This abstract class defines methods to transfer wavelet data in a
052 * code-block by code-block basis, for the decoder side. In each call to
053 * 'getCodeBlock()' or 'getInternCodeBlock()' a new code-block is
054 * returned. The code-blocks are returned in no specific order.
055 *
056 * <P>This class is the source of data, in general, for the inverse wavelet
057 * transforms. See the 'InverseWT' class.
058 *
059 * @see InvWTData
060 *
061 * @see WaveletTransform
062 *
063 * @see jj2000.j2k.quantization.dequantizer.CBlkQuantDataSrcDec
064 *
065 * @see InverseWT
066 * */
067public interface CBlkWTDataSrcDec extends InvWTData {
068
069    /**
070     * Returns the number of bits, referred to as the "range bits",
071     * corresponding to the nominal range of the data in the specified
072     * component.
073     *
074     * <P>The returned value corresponds to the nominal dynamic range of the
075     * reconstructed image data, not of the wavelet coefficients
076     * themselves. This is because different subbands have different gains and
077     * thus different nominal ranges. To have an idea of the nominal range in
078     * each subband the subband analysis gain value from the subband tree
079     * structure, returned by the 'getSubbandTree()' method, can be used. See
080     * the 'Subband' class for more details.
081     *
082     * <P>If this number is <i>b</b> then for unsigned data the nominal range
083     * is between 0 and 2^b-1, and for signed data it is between -2^(b-1) and
084     * 2^(b-1)-1.
085     *
086     * @param c The index of the component
087     *
088     * @return The number of bits corresponding to the nominal range of the
089     * data.
090     *
091     * @see Subband
092     * */
093    public int getNomRangeBits(int c);
094
095    /**
096     * Returns the position of the fixed point in the specified component, or
097     * equivalently the number of fractional bits. This is the position of the
098     * least significant integral (i.e. non-fractional) bit, which is
099     * equivalent to the number of fractional bits. For instance, for
100     * fixed-point values with 2 fractional bits, 2 is returned. For
101     * floating-point data this value does not apply and 0 should be
102     * returned. Position 0 is the position of the least significant bit in
103     * the data.
104     *
105     * @param c The index of the component.
106     *
107     * @return The position of the fixed-point, which is the same as the
108     * number of fractional bits. For floating-point data 0 is returned.
109     * */
110     public int getFixedPoint(int c);
111
112    /**
113     * Returns the specified code-block in the current tile for the specified
114     * component, as a copy (see below).
115     *
116     * <P>The returned code-block may be progressive, which is indicated by
117     * the 'progressive' variable of the returned 'DataBlk' object. If a
118     * code-block is progressive it means that in a later request to this
119     * method for the same code-block it is possible to retrieve data which is
120     * a better approximation, since meanwhile more data to decode for the
121     * code-block could have been received. If the code-block is not
122     * progressive then later calls to this method for the same code-block
123     * will return the exact same data values.
124     *
125     * <P>The data returned by this method is always a copy of the internal
126     * data of this object, if any, and it can be modified "in place" without
127     * any problems after being returned. The 'offset' of the returned data is
128     * 0, and the 'scanw' is the same as the code-block width. See the
129     * 'DataBlk' class.
130     *
131     * @param c The component for which to return the next code-block.
132     *
133     * @param m The vertical index of the code-block to return,
134     * in the specified subband.
135     *
136     * @param n The horizontal index of the code-block to return,
137     * in the specified subband.
138     *
139     * @param sb The subband in which the code-block to return is.
140     *
141     * @param cblk If non-null this object will be used to return the new
142     * code-block. If null a new one will be allocated and returned. If the
143     * "data" array of the object is non-null it will be reused, if possible,
144     * to return the data.
145     *
146     * @return The next code-block in the current tile for component 'n', or
147     * null if all code-blocks for the current tile have been returned.
148     *
149     * @see DataBlk
150     * */
151    public DataBlk getCodeBlock(int c, int m, int n, SubbandSyn sb,
152                                DataBlk cblk);
153
154    /**
155     * Returns the specified code-block in the current tile for the specified
156     * component (as a reference or copy).
157     *
158     * <P>The returned code-block may be progressive, which is indicated by
159     * the 'progressive' variable of the returned 'DataBlk'
160     * object. If a code-block is progressive it means that in a later request
161     * to this method for the same code-block it is possible to retrieve data
162     * which is a better approximation, since meanwhile more data to decode
163     * for the code-block could have been received. If the code-block is not
164     * progressive then later calls to this method for the same code-block
165     * will return the exact same data values.
166     *
167     * <P>The data returned by this method can be the data in the internal
168     * buffer of this object, if any, and thus can not be modified by the
169     * caller. The 'offset' and 'scanw' of the returned data can be
170     * arbitrary. See the 'DataBlk' class.
171     *
172     * @param c The component for which to return the next code-block.
173     *
174     * @param m The vertical index of the code-block to return, in the
175     * specified subband.
176     *
177     * @param n The horizontal index of the code-block to return, in the
178     * specified subband.
179     *
180     * @param sb The subband in which the code-block to return is.
181     *
182     * @param cblk If non-null this object will be used to return the new
183     * code-block. If null a new one will be allocated and returned. If the
184     * "data" array of the object is non-null it will be reused, if possible,
185     * to return the data.
186     *
187     * @return The next code-block in the current tile for component 'n', or
188     * null if all code-blocks for the current tile have been returned.
189     *
190     * @see DataBlk
191     * */
192    public DataBlk getInternCodeBlock(int c, int m, int n, SubbandSyn sb,
193                                        DataBlk cblk);
194}