001/*
002 * $RCSfile: CBlkWTDataSrc.java,v $
003 * $Revision: 1.1 $
004 * $Date: 2005/02/11 05:02:30 $
005 * $State: Exp $
006 *
007 * Class:                   CBlkWTDataSrc
008 *
009 * Description:             Interface that define methods for transfer of WT
010 *                          data in a code-block basis.
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 *
045 *
046 *
047 */
048
049
050package jj2000.j2k.wavelet.analysis;
051
052import jj2000.j2k.image.*;
053import jj2000.j2k.wavelet.*;
054
055/**
056 * This abstract class defines methods to transfer wavelet data in a
057 * code-block by code-block basis. In each call to 'getNextCodeBlock()' or
058 * 'getNextInternCodeBlock()' a new code-block is returned. The code-blocks
059 * are returned in no specific order.
060 *
061 * <P>This class is the source of data for the quantizer. See the 'Quantizer'
062 * class.
063 *
064 * <P>Note that no more of one object may request data, otherwise one object
065 * would get some of the data and another one another part, in no defined
066 * manner.
067 *
068 * @see ForwWTDataProps
069 *
070 * @see WaveletTransform
071 *
072 * @see jj2000.j2k.quantization.quantizer.CBlkQuantDataSrcEnc
073 *
074 * @see jj2000.j2k.quantization.quantizer.Quantizer
075 * */
076public interface CBlkWTDataSrc extends ForwWTDataProps {
077
078    /**
079     * Returns the position of the fixed point in the specified component, or
080     * equivalently the number of fractional bits. This is the position of the
081     * least significant integral (i.e. non-fractional) bit, which is
082     * equivalent to the number of fractional bits. For instance, for
083     * fixed-point values with 2 fractional bits, 2 is returned. For
084     * floating-point data this value does not apply and 0 should be
085     * returned. Position 0 is the position of the least significant bit in
086     * the data.
087     *
088     * @param n The index of the component.
089     *
090     * @return The position of the fixed-point, which is the same as
091     * the number of fractional bits. For floating-point data 0 is
092     * returned.
093     *
094     *
095     * */
096     public int getFixedPoint(int n);
097
098    /** Return the data type of this CBlkWTDataSrc for the given
099     *  component in the current tile. Its value should be either
100     *  DataBlk.TYPE_INT or DataBlk.TYPE_FLOAT but can change
101     *  according to the current tile-component.
102     *
103     * @param t Tile index
104     *
105     * @param c Component index
106     *
107     * @return Current data type
108     *
109     */
110    public int getDataType(int t,int c);
111
112    /**
113     * Returns the next code-block in the current tile for the specified
114     * component, as a copy (see below). The order in which code-blocks are
115     * returned is not specified. However each code-block is returned only
116     * once and all code-blocks will be returned if the method is called 'N'
117     * times, where 'N' is the number of code-blocks in the tile. After all
118     * the code-blocks have been returned for the current tile calls to this
119     * method will return 'null'.
120     *
121     * <P>When changing the current tile (through 'setTile()' or 'nextTile()')
122     * this method will always return the first code-block, as if this method
123     * was never called before for the new current tile.
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.  The 'magbits'
129     * of the returned data is not set by this method and should be
130     * ignored. See the 'CBlkWTData' class.
131     *
132     * <P>The 'ulx' and 'uly' members of the returned 'CBlkWTData' object
133     * contain the coordinates of the top-left corner of the block, with
134     * respect to the tile, not the subband.
135     *
136     * @param n The component for which to return the next code-block.
137     *
138     * @param cblk If non-null this object will be used to return the new
139     * code-block. If null a new one will be allocated and returned. If the
140     * "data" array of the object is non-null it will be reused, if possible,
141     * to return the data.
142     *
143     * @return The next code-block in the current tile for component 'n', or
144     * null if all code-blocks for the current tile have been returned.
145     *
146     * @see CBlkWTData
147     *
148     *
149     * */
150    public abstract CBlkWTData getNextCodeBlock(int n, CBlkWTData cblk);
151
152    /**
153     * Returns the next code-block in the current tile for the specified
154     * component. The order in which code-blocks are returned is not
155     * specified. However each code-block is returned only once and all
156     * code-blocks will be returned if the method is called 'N' times, where
157     * 'N' is the number of code-blocks in the tile. After all the code-blocks
158     * have been returned for the current tile calls to this method will
159     * return 'null'.
160     *
161     * <P>When changing the current tile (through 'setTile()' or 'nextTile()')
162     * this method will always return the first code-block, as if this method
163     * was never called before for the new current tile.
164     *
165     * <P>The data returned by this method can be the data in the internal
166     * buffer of this object, if any, and thus can not be modified by the
167     * caller. The 'offset' and 'scanw' of the returned data can be
168     * arbitrary. The 'magbits' of the returned data is not set by this method
169     * and should be ignored. See the 'CBlkWTData' class.
170     *
171     * <P>The 'ulx' and 'uly' members of the returned 'CBlkWTData' object
172     * contain the coordinates of the top-left corner of the block, with
173     * respect to the tile, not the subband.
174     *
175     * @param n The component for which to return the next code-block.
176     *
177     * @param cblk If non-null this object will be used to return the new
178     * code-block. If null a new one will be allocated and returned. If the
179     * "data" array of the object is non-null it will be reused, if possible,
180     * to return the data.
181     *
182     * @return The next code-block in the current tile for component 'n', or
183     * null if all code-blocks for the current tile have been returned.
184     *
185     * @see CBlkWTData
186     *
187     *
188     * */
189    public abstract CBlkWTData getNextInternCodeBlock(int n, CBlkWTData cblk);
190
191}