📄 anwtfilter.java
字号:
/* * CVS identifier: * * $Id: AnWTFilter.java,v 1.14 2000/09/21 16:13:13 dsanta Exp $ * * Class: AnWTFilter * * Description: The abstract class for all analysis wavelet filters * * * * COPYRIGHT: * * This software module was originally developed by Rapha雔 Grosbois and * Diego Santa Cruz (Swiss Federal Institute of Technology-EPFL); Joel * Askel鰂 (Ericsson Radio Systems AB); and Bertrand Berthelot, David * Bouchard, F閘ix Henry, Gerard Mozelle and Patrice Onno (Canon Research * Centre France S.A) in the course of development of the JPEG2000 * standard as specified by ISO/IEC 15444 (JPEG 2000 Standard). This * software module is an implementation of a part of the JPEG 2000 * Standard. Swiss Federal Institute of Technology-EPFL, Ericsson Radio * Systems AB and Canon Research Centre France S.A (collectively JJ2000 * Partners) agree not to assert against ISO/IEC and users of the JPEG * 2000 Standard (Users) any of their rights under the copyright, not * including other intellectual property rights, for this software module * with respect to the usage by ISO/IEC and Users of this software module * or modifications thereof for use in hardware or software products * claiming conformance to the JPEG 2000 Standard. Those intending to use * this software module in hardware or software products are advised that * their use may infringe existing patents. The original developers of * this software module, JJ2000 Partners and ISO/IEC assume no liability * for use of this software module or modifications thereof. No license * or right to this software module is granted for non JPEG 2000 Standard * conforming products. JJ2000 Partners have full right to use this * software module for his/her own purpose, assign or donate this * software module to any third party and to inhibit third parties from * using this software module for non JPEG 2000 Standard conforming * products. This copyright notice must be included in all copies or * derivative works of this software module. * * Copyright (c) 1999/2000 JJ2000 Partners. * * * */package jj2000.j2k.wavelet.analysis;import jj2000.j2k.codestream.writer.*;import jj2000.j2k.wavelet.*;import jj2000.j2k.image.*;import jj2000.j2k.util.*;import java.util.*;import java.io.*;/** * This abstract class defines the methods of all analysis wavelet * filters. Specialized abstract classes that work on particular data * types (int, float) provide more specific method calls while * retaining the generality of this one. See the AnWTFilterInt * and AnWTFilterFloat classes. Implementations of analysis * filters should inherit from one of those classes. * * <P>All analysis wavelet filters should follow the following conventions: * * <P>- The first sample to filter is the low-pass one. As a * consequence, if the input signal is of odd-length then the low-pass * output signal is one sample longer than the high-pass output * one. Therefore, if the length of input signal is N, the low-pass * output signal is of length N/2 if N is even and N/2+1/2 if N is * odd, while the high-pass output signal is of length N/2 if N is * even and N/2-1/2 if N is odd. * * <P>- The normalization is 1 for the DC gain and 2 for the Nyquist * gain (Type I normalization), for both reversible and non-reversible * filters. * * <P>If the length of input signal is N, the low-pass output signal * is of length N/2 if N is even and N/2+1/2 if N is odd, while the * high-pass output sample is of length N/2 if N is even and N/2-1/2 * if N is odd. * * <P>The analyze method may seem very complicated, but is designed to * minimize the amount of data copying and redundant calculations when * used for block-based or line-based wavelet transform * implementations, while being applicable to full-frame transforms as * well. * * <P>All filters should implement the equals() method of the Object * class. The call x.equals(y) should test if the 'x' and 'y' filters are the * same or not, in what concerns the bit stream header syntax (two filters are * the same if the same filter code should be output to the bit stream). * * @see AnWTFilterInt * * @see AnWTFilterFloat * */public abstract class AnWTFilter implements WaveletFilter{ /** The prefix for wavelet filter options: 'F' */ public final static char OPT_PREFIX = 'F'; /** The list of parameters that is accepted for wavelet filters. Options * for wavelet filters start with a 'F'. */ private final static String [][] pinfo = { { "Ffilters", "[<tile-component idx>] <id> "+ "[ [<tile-component idx>] <id> ...]", "Specifies which filters to use for specified tile-component.\n"+ "<tile-component idx>: see general note\n"+ "<id>: ',' separates horizontal and vertical filters, ':' separates"+ " decomposition levels filters. JPEG 2000 part I only supports w5x3"+ " and w9x7 filters.",null}, }; /** * Filters the input signal by this analysis filter, decomposing * it in a low-pass and a high-pass signal. This method performs * the filtering and the subsampling with the low pass first * filtering convention. * * <P>The input signal resides in the inSig array. The index of * the first sample to filter (i.e. that will generate the first * low-pass output sample) is given by inOff. The number of * samples to filter is given by inLen. This array must be of the * same type as the one for which the particular implementation * works with (which is returned by the getDataType() method). * * <P>The input signal can be interleaved with other signals in * the same inSig array, and this is determined by the inStep * argument. This means that the first sample of the input signal * is inSig[inOff], the second is inSig[inOff+inStep], the third * is inSig[inOff+2*inStep], and so on. Therefore if inStep is 1 * there is no interleaving. This feature allows to filter columns * of a 2-D signal, when it is stored in a line by line order in * inSig, without having to copy the data, in this case the inStep * argument should be the line width. * * <P>This method also allows to apply the analysis wavelet filter * by parts in the input signal using an overlap and thus * producing the same coefficients at the output. The tailOvrlp * argument specifies how many samples in the input signal, before * the first one to be filtered, can be used for overlap. Then, * the filter instead of extending the input signal will use those * samples to calculate the first output samples. The argument * tailOvrlp can be 0 for no overlap, or some value that provides * partial or full overlap. There should be enough samples in the * input signal, before the first sample to be filtered, to * support the overlap. The headOvrlp provides the same * functionality but at the end of the input signal. The inStep * argument also applies to samples used for overlap. This overlap * feature can be used for line-based wavelet transforms (in which * case it will only be used when filtering the columns) or for * overlapping block-based wavelet transforms (in which case it * will be used when filtering lines and columns). * * <P>The low-pass output signal is placed in the lowSig * array. The lowOff and lowStep arguments are analogous to the * inOff and inStep ones, but they apply to the lowSig array. The * lowSig array must be long enough to hold the low-pass output * signal. * * <P>The high-pass output signal is placed in the highSig * array. The highOff and highStep arguments are analogous to the * inOff and inStep ones, but they apply to the highSig array. The * highSig array must be long enough to hold the high-pass output * signal. * * @param inSig This is the array that contains the input * signal. It must be of the correct type (e.g., it must be int[] * if getDataType() returns TYPE_INT). * * @param inOff This is the index in inSig of the first sample to * filter. * * @param inLen This is the number of samples in the input signal * to filter. * * @param inStep This is the step, or interleave factor, of the * input signal samples in the inSig array. See above. * * @param tailOvrlp This is the number of samples in the input * signal before the first sample to filter that can be used for * overlap. See above. * * @param headOvrlp This is the number of samples in the input * signal after the last sample to filter that can be used for * overlap. See above. * * @param lowSig This is the array where the low-pass output * signal is placed. It must be of the same type as inSig and it * should be long enough to contain the output signal. * * @param lowOff This is the index in lowSig of the element where * to put the first low-pass output sample. * * @param lowStep This is the step, or interleave factor, of the * low-pass output samples in the lowSig array. See above. * * @param highSig This is the array where the high-pass output * signal is placed. It must be of the same type as inSig and it * should be long enough to contain the output signal. * * @param highOff This is the index in highSig of the element where * to put the first high-pass output sample. * * @param highStep This is the step, or interleave factor, of the * high-pass output samples in the highSig array. See above. * * @see WaveletFilter#getDataType * * * * * */ public abstract void analyze_lpf(Object inSig, int inOff, int inLen, int inStep, Object lowSig, int lowOff, int lowStep, Object highSig, int highOff, int highStep); /** * Filters the input signal by this analysis filter, decomposing * it in a low-pass and a high-pass signal. This method performs * the filtering and the subsampling with the high pass first filtering * convention. * * <P>The input signal resides in the inSig array. The index of * the first sample to filter (i.e. that will generate the first * high-pass output sample) is given by inOff. The number of * samples to filter is given by inLen. This array must be of the * same type as the one for which the particular implementation * works with (which is returned by the getDataType() method). * * <P>The input signal can be interleaved with other signals in * the same inSig array, and this is determined by the inStep * argument. This means that the first sample of the input signal * is inSig[inOff], the second is inSig[inOff+inStep], the third * is inSig[inOff+2*inStep], and so on. Therefore if inStep is 1 * there is no interleaving. This feature allows to filter columns * of a 2-D signal, when it is stored in a line by line order in * inSig, without having to copy the data, in this case the inStep * argument should be the line width. * * <P>The low-pass output signal is placed in the lowSig * array. The lowOff and lowStep arguments are analogous to the * inOff and inStep ones, but they apply to the lowSig array. The * lowSig array must be long enough to hold the low-pass output * signal.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -