001/*
002 * $RCSfile: SynWTFilter.java,v $
003 * $Revision: 1.1 $
004 * $Date: 2005/02/11 05:02:34 $
005 * $State: Exp $
006 *
007 * Class:                   SynWTFilter
008 *
009 * Description:             The abstract class for all synthesis wavelet
010 *                          filters.
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.synthesis;
051
052import jj2000.j2k.wavelet.*;
053import jj2000.j2k.codestream.*;
054import jj2000.j2k.io.*;
055import jj2000.j2k.*;
056import java.io.*;
057
058/**
059 * This abstract class defines the methods of all synthesis wavelet
060 * filters. Specialized abstract classes that work on particular data
061 * types (int, float) provide more specific method calls while
062 * retaining the generality of this one. See the SynWTFilterInt
063 * and SynWTFilterFloat classes. Implementations of snythesis
064 * filters should inherit from one of those classes.
065 *
066 * <P>The length of the output signal is always the sum of the length
067 * of the low-pass and high-pass input signals.
068 *
069 * <P>All synthesis wavelet filters should follow the following conventions:
070 *
071 * <P>- The first sample of the output corresponds to the low-pass
072 * one. As a consequence, if the output signal is of odd-length then
073 * the low-pass input signal is one sample longer than the high-pass
074 * input one. Therefore, if the length of output signal is N, the
075 * low-pass input signal is of length N/2 if N is even and N/2+1/2 if
076 * N is odd, while the high-pass input signal is of length N/2 if N
077 * is even and N/2-1/2 if N is odd.
078 *
079 * <P>- The normalization of the analysis filters is 1 for the DC gain
080 * and 2 for the Nyquist gain (Type I normalization), for both
081 * reversible and non-reversible filters. The normalization of the
082 * synthesis filters should ensure prefect reconstruction according to
083 * this normalization of the analysis wavelet filters.
084 *
085 * <P>The synthetize method may seem very complicated, but is designed to
086 * minimize the amount of data copying and redundant calculations when
087 * used for block-based or line-based wavelet transform
088 * implementations, while being applicable to full-frame transforms as
089 * well.
090 *
091 * @see SynWTFilterInt
092 *
093 * @see SynWTFilterFloat
094 * */
095public abstract class SynWTFilter implements WaveletFilter,
096    Markers {
097
098    /**
099     * Reconstructs the output signal by the synthesis filter,
100     * recomposing the low-pass and high-pass input signals in one
101     * output signal. This method performs the upsampling and
102     * fitering with the low pass first filtering convention.
103     *
104     * <P>The input low-pass (high-pass) signal resides in the lowSig
105     * array. The index of the first sample to filter (i.e. that will
106     * generate the first (second) output sample). is given by lowOff
107     * (highOff). This array must be of the same type as the one for
108     * which the particular implementation works with (which is
109     * returned by the getDataType() method).
110     *
111     * <P>The low-pass (high-pass) input signal can be interleaved
112     * with other signals in the same lowSig (highSig) array, and this
113     * is determined by the lowStep (highStep) argument. This means
114     * that the first sample of the low-pass (high-pass) input signal
115     * is lowSig[lowOff] (highSig[highOff]), the second is
116     * lowSig[lowOff+lowStep] (highSig[highOff+highStep]), the third
117     * is lowSig[lowOff+2*lowStep] (highSig[highOff+2*highStep]), and
118     * so on. Therefore if lowStep (highStep) is 1 there is no
119     * interleaving. This feature allows to filter columns of a 2-D
120     * signal, when it is stored in a line by line order in lowSig
121     * (highSig), without having to copy the data, in this case the
122     * lowStep (highStep) argument should be the line width of the
123     * low-pass (high-pass) signal.
124     *
125     * <P>The output signal is placed in the outSig array. The outOff
126     * and outStep arguments are analogous to the lowOff and lowStep
127     * ones, but they apply to the outSig array. The outSig array must
128     * be long enough to hold the low-pass output signal.
129     *
130     * @param lowSig This is the array that contains the low-pass
131     * input signal. It must be of the correct type (e.g., it must be
132     * int[] if getDataType() returns TYPE_INT).
133     *
134     * @param lowOff This is the index in lowSig of the first sample to
135     * filter.
136     *
137     * @param lowLen This is the number of samples in the low-pass
138     * input signal to filter.
139     *
140     * @param lowStep This is the step, or interleave factor, of the
141     * low-pass input signal samples in the lowSig array. See above.
142     *
143     * @param highSig This is the array that contains the high-pass
144     * input signal. It must be of the correct type (e.g., it must be
145     * int[] if getDataType() returns TYPE_INT).
146     *
147     * @param highOff This is the index in highSig of the first sample to
148     * filter.
149     *
150     * @param highLen This is the number of samples in the high-pass
151     * input signal to filter.
152     *
153     * @param highStep This is the step, or interleave factor, of the
154     * high-pass input signal samples in the highSig array. See above.
155     *
156     * @param outSig This is the array where the output signal is
157     * placed. It must be of the same type as lowSig and it should be
158     * long enough to contain the output signal.
159     *
160     * @param outOff This is the index in outSig of the element where
161     * to put the first output sample.
162     *
163     * @param outStep This is the step, or interleave factor, of the
164     * output samples in the outSig array. See above.
165     *
166     *
167     *
168     *
169     * */
170    public abstract
171        void synthetize_lpf(Object lowSig, int lowOff, int lowLen, int lowStep,
172                        Object highSig, int highOff, int highLen, int highStep,
173                        Object outSig, int outOff, int outStep);
174
175    /**
176     * Reconstructs the output signal by the synthesis filter,
177     * recomposing the low-pass and high-pass input signals in one
178     * output signal. This method performs the upsampling and
179     * fitering with the high pass first filtering convention.
180     *
181     * <P>The input low-pass (high-pass) signal resides in the lowSig
182     * array. The index of the first sample to filter (i.e. that will
183     * generate the first (second) output sample). is given by lowOff
184     * (highOff). This array must be of the same type as the one for
185     * which the particular implementation works with (which is
186     * returned by the getDataType() method).
187     *
188     * <P>The low-pass (high-pass) input signal can be interleaved
189     * with other signals in the same lowSig (highSig) array, and this
190     * is determined by the lowStep (highStep) argument. This means
191     * that the first sample of the low-pass (high-pass) input signal
192     * is lowSig[lowOff] (highSig[highOff]), the second is
193     * lowSig[lowOff+lowStep] (highSig[highOff+highStep]), the third
194     * is lowSig[lowOff+2*lowStep] (highSig[highOff+2*highStep]), and
195     * so on. Therefore if lowStep (highStep) is 1 there is no
196     * interleaving. This feature allows to filter columns of a 2-D
197     * signal, when it is stored in a line by line order in lowSig
198     * (highSig), without having to copy the data, in this case the
199     * lowStep (highStep) argument should be the line width of the
200     * low-pass (high-pass) signal.
201     *
202     * <P>The output signal is placed in the outSig array. The outOff
203     * and outStep arguments are analogous to the lowOff and lowStep
204     * ones, but they apply to the outSig array. The outSig array must
205     * be long enough to hold the low-pass output signal.
206     *
207     * @param lowSig This is the array that contains the low-pass
208     * input signal. It must be of the correct type (e.g., it must be
209     * int[] if getDataType() returns TYPE_INT).
210     *
211     * @param lowOff This is the index in lowSig of the first sample to
212     * filter.
213     *
214     * @param lowLen This is the number of samples in the low-pass
215     * input signal to filter.
216     *
217     * @param lowStep This is the step, or interleave factor, of the
218     * low-pass input signal samples in the lowSig array. See above.
219     *
220     * @param highSig This is the array that contains the high-pass
221     * input signal. It must be of the correct type (e.g., it must be
222     * int[] if getDataType() returns TYPE_INT).
223     *
224     * @param highOff This is the index in highSig of the first sample to
225     * filter.
226     *
227     * @param highLen This is the number of samples in the high-pass
228     * input signal to filter.
229     *
230     * @param highStep This is the step, or interleave factor, of the
231     * high-pass input signal samples in the highSig array. See above.
232     *
233     * @param outSig This is the array where the output signal is
234     * placed. It must be of the same type as lowSig and it should be
235     * long enough to contain the output signal.
236     *
237     * @param outOff This is the index in outSig of the element where
238     * to put the first output sample.
239     *
240     * @param outStep This is the step, or interleave factor, of the
241     * output samples in the outSig array. See above.
242     *
243     *
244     *
245     *
246     * */
247    public abstract
248        void synthetize_hpf(Object lowSig, int lowOff, int lowLen, int lowStep,
249                        Object highSig, int highOff, int highLen, int highStep,
250                        Object outSig, int outOff, int outStep);
251
252}
253
254