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