⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 anwtfilterintlift5x3.java

📁 java 实现的小波压缩库代码,内部包含了分析器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
                hk += highStep;
            }
        }
    
        //If input signal has odd length then we perform the lifting step
        // i.e. apply a symmetric extension.
        if( inLen%2==1 && inLen>1 ) {
            highSig[hk] = inSig[ik] - inSig[ik-inStep];
        }
        
        /*
         *Generate low frequency subband
         */
        
        //Initialize counters
        ik = inOff + inStep;
        lk = lowOff;
        hk = highOff;
        
        for (i=1 ; i<inLen-1 ; i+=2) {

            lowSig[lk] = inSig[ik] + 
                ((highSig[hk] + highSig[hk+highStep] + 2)>> 2);

            ik += iStep;
            lk += lowStep;  
            hk += highStep;
        }
        
        if ( inLen>1 && inLen%2==0) {
            // apply a symmetric extension.
            lowSig[lk] = inSig[ik]+((2*highSig[hk]+2)>>2);
        }
    }
    /**
     * Returns the negative support of the low-pass analysis
     * filter. That is the number of taps of the filter in the
     * negative direction.
     *
     * @return 2
     * */
    public int getAnLowNegSupport() {
        return 2;
    }

    /**
     * Returns the positive support of the low-pass analysis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * @return The number of taps of the low-pass analysis filter in the
     * positive direction
     * */
    public int getAnLowPosSupport() {
        return 2;
    }

    /**
     * Returns the negative support of the high-pass analysis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * @return The number of taps of the high-pass analysis filter in
     * the negative direction
     * */
    public int getAnHighNegSupport() {
        return 1;
    }

    /**
     * Returns the positive support of the high-pass analysis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * @return The number of taps of the high-pass analysis filter in the
     * positive direction
     * */
    public int getAnHighPosSupport() {
        return 1;
    }

    /**
     * Returns the negative support of the low-pass synthesis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * <P>A MORE PRECISE DEFINITION IS NEEDED
     *
     * @return The number of taps of the low-pass synthesis filter in the
     * negative direction
     * */
    public int getSynLowNegSupport() {
        return 1;
    }

    /**
     * Returns the positive support of the low-pass synthesis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * <P>A MORE PRECISE DEFINITION IS NEEDED
     *
     * @return The number of taps of the low-pass synthesis filter in
     * the positive direction
     * */
    public int getSynLowPosSupport() {
        return 1;
    }

    /**
     * Returns the negative support of the high-pass synthesis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * <P>A MORE PRECISE DEFINITION IS NEEDED
     *
     * @return The number of taps of the high-pass synthesis filter in the
     * negative direction
     * */
    public int getSynHighNegSupport() {
        return 2;
    }

    /**
     * Returns the positive support of the high-pass synthesis filter. That is
     * the number of taps of the filter in the negative direction.
     *
     * <P>A MORE PRECISE DEFINITION IS NEEDED
     *
     * @return The number of taps of the high-pass synthesis filter in the
     * positive direction
     * */
    public int getSynHighPosSupport() {
        return 2;
    }
    
    /**
     * Returns the time-reversed low-pass synthesis waveform of the filter,
     * which is the low-pass filter. This is the time-reversed impulse
     * response of the low-pass synthesis filter. It is used to calculate the
     * L2-norm of the synthesis basis functions for a particular subband (also
     * called energy weight).
     *
     * <P>The returned array may not be modified (i.e. a reference to the
     * internal array may be returned by the implementation of this method).
     *
     * @return The time-reversed low-pass synthesis waveform of the filter.
     * */
    public float[] getLPSynthesisFilter() {
        return LPSynthesisFilter;
    }

    /**
     * Returns the time-reversed high-pass synthesis waveform of the filter,
     * which is the high-pass filter. This is the time-reversed impulse
     * response of the high-pass synthesis filter. It is used to calculate the
     * L2-norm of the synthesis basis functions for a particular subband (also
     * called energy weight).
     *
     * <P>The returned array may not be modified (i.e. a reference to the
     * internal array may be returned by the implementation of this method).
     *
     * @return The time-reversed high-pass synthesis waveform of the filter.
     * */
    public float[] getHPSynthesisFilter() {
        return HPSynthesisFilter;
    }


    /**
     * Returns the implementation type of this filter, as defined in this
     * class, such as WT_FILTER_INT_LIFT, WT_FILTER_FLOAT_LIFT,
     * WT_FILTER_FLOAT_CONVOL.
     *
     * @return WT_FILTER_INT_LIFT.
     * */
    public int getImplType() {
        return WT_FILTER_INT_LIFT;
    }

    /**
     * Returns the reversibility of the filter. A filter is considered
     * reversible if it is suitable for lossless coding.
     *
     * @return true since the 5x3 is reversible, provided the appropriate
     * rounding is performed.
     * */
    public boolean isReversible() {
        return true; 
    }
    
    /**
     * Returns true if the wavelet filter computes or uses the same "inner"
     * subband coefficient as the full frame wavelet transform, and false
     * otherwise. In particular, for block based transforms with reduced
     * overlap, this method should return false. The term "inner" indicates
     * that this applies only with respect to the coefficient that are not
     * affected by image boundaries processings such as symmetric extension,
     * since there is not reference method for this.
     *
     * <P>The result depends on the length of the allowed overlap when
     * compared to the overlap required by the wavelet filter. It also depends
     * on how overlap processing is implemented in the wavelet filter.
     *
     * @param tailOvrlp This is the number of samples in the input signal
     * before the first sample to filter that can be used for overlap.
     *
     * @param headOvrlp This is the number of samples in the input signal
     * after the last sample to filter that can be used for overlap.
     *
     * @param inLen This is the lenght of the input signal to filter.The
     * required number of samples in the input signal after the last sample
     * depends on the length of the input signal.
     *
     * @return true if both overlaps are greater than 2, and correct
     * processing is applied in the analyze() method.
     * */
    public boolean isSameAsFullWT(int tailOvrlp, int headOvrlp, int inLen) {
        
        //If the input signal has even length.
        if( inLen % 2 == 0) {
            if( tailOvrlp >= 2 && headOvrlp >= 1 ) return true;
            else return false;
        }
        //Else if the input signal has odd length.
        else {
            if( tailOvrlp >= 2 && headOvrlp >= 2 ) return true;
            else return false;
        }
    }

    /**
     * Tests if the 'obj' object is the same filter as this one. Two filters
     * are the same if the same filter code should be output for both filters
     * by the encodeFilterCode() method.
     *
     * <P>Currently the implementation of this method only tests if 'obj' is
     * also of the class AnWTFilterIntLift5x3.
     *
     * @param The object against which to test inequality.
     * */
    public boolean equals(Object obj) {
        // To speed up test, first test for reference equality
        return obj == this ||
            obj instanceof AnWTFilterIntLift5x3;
    }

    /** 
     * Returns the type of filter used according to the FilterTypes interface
     * (W5x3).
     *
     * @see FilterTypes
     *
     * @return The filter type.
     * */
    public int getFilterType(){
        return FilterTypes.W5X3;
    }    

    /** Debugging method */
    public String toString(){
	return "w5x3";
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -