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

📄 synwtfilterintlift5x3.java

📁 java 实现的小波压缩库代码,内部包含了分析器
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * CVS identifier:
 *
 * $Id: SynWTFilterIntLift5x3.java,v 1.10 2000/12/12 16:56:35 grosbois Exp $
 *
 * Class:                   SynWTFilterIntLift5x3
 *
 * Description:             A synthetizing wavelet filter implementing the
 *                          lifting 5x3 transform.
 *
 *
 *
 * 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.synthesis;

import jj2000.j2k.wavelet.*;
import jj2000.j2k.image.*;
import jj2000.j2k.*;

/**
 * This class inherits from the synthesis wavelet filter definition for int
 * data. It implements the inverse wavelet transform specifically for the 5x3
 * filter. The implementation is based on the lifting scheme.
 *
 * <P>See the SynWTFilter class for details such as normalization, how to
 * split odd-length signals, etc. In particular, this method assumes that the
 * low-pass coefficient is computed first.
 *
 * @see SynWTFilter
 * @see SynWTFilterInt
 * */
public class SynWTFilterIntLift5x3 extends SynWTFilterInt {
    
    /**
     * An implementation of the synthetize_lpf() method that works on int
     * data, for the inverse 5x3 wavelet transform using the lifting
     * scheme. See the general description of the synthetize_lpf() method in
     * the SynWTFilter class for more details.
     *
     * <P>The coefficients of the first lifting step are [-1/4 1 -1/4]. 
     *
     * <P>The coefficients of the second lifting step are [1/2 1 1/2].
     *
     * @param lowSig This is the array that contains the low-pass
     * input signal.
     *
     * @param lowOff This is the index in lowSig of the first sample to
     * filter.
     *
     * @param lowLen This is the number of samples in the low-pass
     * input signal to filter.
     *
     * @param lowStep This is the step, or interleave factor, of the
     * low-pass input signal samples in the lowSig array.
     *
     * @param highSig This is the array that contains the high-pass
     * input signal.
     *
     * @param highOff This is the index in highSig of the first sample to
     * filter.
     *
     * @param highLen This is the number of samples in the high-pass
     * input signal to filter.
     *
     * @param highStep This is the step, or interleave factor, of the
     * high-pass input signal samples in the highSig array.
     *
     * @param outSig This is the array where the output signal is
     * placed. It should be long enough to contain the output signal.
     *
     * @param outOff This is the index in outSig of the element where
     * to put the first output sample.
     *
     * @param outStep This is the step, or interleave factor, of the
     * output samples in the outSig array.
     *
     * @see SynWTFilter#synthetize_lpf
     * */
    public
        void synthetize_lpf(int[] lowSig, int lowOff, int lowLen, int lowStep,
                        int[] highSig, int highOff, int highLen, int highStep, 
                        int[] outSig, int outOff, int outStep) {
                        
        int i;
        int outLen = lowLen + highLen; //Length of the output signal
        int iStep = 2*outStep; //Upsampling in outSig
        int ik; //Indexing outSig
        int lk; //Indexing lowSig
        int hk; //Indexing highSig  
        
        /*
         *Generate even samples (inverse low-pass filter)
         */
            
        //Initialize counters
        lk = lowOff;
        hk = highOff;
        ik = outOff;
                
        //Handle tail boundary effect. Use symmetric extension.
        if(outLen>1) {
            outSig[ik] = lowSig[lk] - ((highSig[hk]+1)>>1);
        }
        else {
            outSig[ik] = lowSig[lk];
        }
        
        lk += lowStep;  
        hk += highStep;
        ik += iStep;
 
        //Apply lifting step to each "inner" sample.
        for(i = 2; i < outLen-1; i += 2) {
            outSig[ik] = lowSig[lk] - 
                ((highSig[hk-highStep] + highSig[hk] + 2)>>2);
            
            lk += lowStep;  
            hk += highStep;
            ik += iStep;
        }
        
        //Handle head boundary effect if input signal has odd length.
        if((outLen % 2 == 1)&&(outLen>2)) {
            outSig[ik] = lowSig[lk] - ((2*highSig[hk-highStep]+2)>>2);
        }

        /*
         *Generate odd samples (inverse high pass-filter)
         */
         
        //Initialize counters
        hk = highOff;
        ik = outOff + outStep;
              
        //Apply first lifting step to each "inner" sample.
        for(i = 1; i < outLen-1; i += 2) {           
            // Since signs are inversed (add instead of substract)
            // the +1 rounding dissapears.
            outSig[ik] = highSig[hk] + 
                ((outSig[ik-outStep] + outSig[ik+outStep]) >> 1);
            
            hk += highStep;
            ik += iStep;   
        }

        //Handle head boundary effect if input signal has even length.
        if( outLen%2==0 && outLen>1) {
            outSig[ik] = highSig[hk] + outSig[ik-outStep];
        } 
    }
    
    /**
     * An implementation of the synthetize_hpf() method that works on int
     * data, for the inverse 5x3 wavelet transform using thelifting
     * scheme. See the general description of the synthetize_hpf() method in
     * the SynWTFilter class for more details.
     *
     * <P>The coefficients of the first lifting step are [-1/4 1 -1/4]. 
     *
     * <P>The coefficients of the second lifting step are [1/2 1 1/2].
     *
     * @param lowSig This is the array that contains the low-pass
     * input signal.
     *
     * @param lowOff This is the index in lowSig of the first sample to
     * filter.
     *
     * @param lowLen This is the number of samples in the low-pass
     * input signal to filter.
     *
     * @param lowStep This is the step, or interleave factor, of the
     * low-pass input signal samples in the lowSig array.
     *
     * @param highSig This is the array that contains the high-pass
     * input signal.
     *
     * @param highOff This is the index in highSig of the first sample to
     * filter.
     *
     * @param highLen This is the number of samples in the high-pass
     * input signal to filter.
     *
     * @param highStep This is the step, or interleave factor, of the
     * high-pass input signal samples in the highSig array.
     *
     * @param outSig This is the array where the output signal is
     * placed. It should be long enough to contain the output signal.
     *
     * @param outOff This is the index in outSig of the element where
     * to put the first output sample.
     *
     * @param outStep This is the step, or interleave factor, of the
     * output samples in the outSig array.
     *
     * @see SynWTFilter#synthetize_hpf
     * */
    public 
        void synthetize_hpf(int[] lowSig, int lowOff, int lowLen, int lowStep, 
                        int[] highSig, int highOff, int highLen, int highStep, 
                        int[] outSig, int outOff, int outStep) {
                        
        int i;

⌨️ 快捷键说明

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