**Name**

**sconvolve** Convolves a signal with a filter

**Command Synopsis**

**sconvolve** [-d *Decimation*] [-i *Interpolation*] [-r] [-e *Edgemode*] [-b] [-p *EdgeProl*] *Signal* *FicConvol* *ImpulseResponse* [*EdgeIR* ]

-dDecimation: Downsampling rate (default 1)

-iInterpolation: Upsampling rate (default 1)

-r : Convolution with symetric filter

-eEdgemode: Edge processing mode (0/1/2/3, default 0)

-b : Convolution with high pass filter

-pEdgeProl: Extension of output on edges (0/1/2, default 0)

Signal: Input signal (fsignal)

FicConvol: Result of convolution (fsignal)

ImpulseResponse: Impulse response of inner filter (fsignal)

EdgeIR: Impulse reponses of edge and preconditionning filters (fimage)

**Function Summary**

void sconvolve (Signal , Output , DownRate , UpRate , ReflIR , Band , Edge , Prolong , Ri , Edge_Ri )

Fsignal Signal ;

Fsignal Output ;

int *DownRate ;

int *UpRate ;

int *ReflIR ;

int *Edge ;

int *Band ;

int *Prolong ;

Fsignal Ri ;

Fimage Edge_Ri ;

**Description**

*sconvolve* computes the convolution of a fsignal with a discrete filter which is also of fsignal type.
The signal can eventually be interpolated or over-sampled (adding *M* - 1 zero-valued samples betwen each successive samples) before the convolution, and the result can eventually be decimated or sub-sampled (discarding *N* - 1 samples over *N*).

Let {*x*_{k}} and {*y*_{k}} be the sample values of the input and output signal, and {*h*_{k}} the impulse response of the filter, then :

Because the signal is of finite size, one has to use special tricks to compute the edge (i.e. the first and last) coefficients. These are the following :

- One can extend the signal with 0-valued samples.
- One can periodize the signal.
- One can also reflect the signal around each edge.
- Finally one can use special filters to compute the coefficients near edges. For example one can use filters that correspond to wavelet basis adapted to the interval (see
*owave1*module's documentation).

Notice that if *n* is the size of the input signal, then the size of the output signal is *nM*/*N*, unless the -p option is selected.

The coefficients *h*_{k} of the filter's impulse response are stored in the fsignal type file *ImpulseResponse*. The coefficients of the filter's impulse response for computing the edge coefficients are stored in the fimage type file *EdgeIR*.

The sample values of the input signal are read in the fsignal type file *Signal*, the sample values of the output signal are stored in the file *FicConvol*.

- The -d option specifies the rate
*N*of sub-sampling after the convolution. - The -i option specifies the rate
*M*of over-sampling before convolution. - The -e option specifies the edge processing mode.
- 0 : 0 extension.
- 1 : periodization.
- 2 : reflexion.
- 3 : adapted filtering (default).

- The -p option specifies the extension or shrinkage of the output signal near edges. It works only if the edge processing mode is 0 or 1, and enables then to get exact reconstruciton in wavelet decompositions (see
*owave1*).- 0 : no extension nor shrinkage (default).
- 1 : prolongation. All the coefficients
*y*_{k}which are not always nul when the 0 extension is selected are kept. - 2 : shrinkage, the size of output is
(
*input*.*lastp*-*input*.*firstp*+ 1)*uprate*/*domwrate*.

- The -b option specifies the high-pass filtering, i.e. the convolution is performed with
{
*g*_{k}= (- 1)^{k+1}*h*_{1-k}} rather than {*h*_{k}}. - The -r option specifies that the convolution is performed with reflected filter
{
*h*_{-k}} (resp. {*g*_{-k}}) rather than {*h*_{k}} (resp. {*g*_{k}}).

**See Also**

`biowave1`, `biowave2`, `dybiowave2`, `ibiowave1`, `ibiowave2`, `iowave1`, `iowave2`, `owave1`, `owave2`.

**Version 1.3**

Last Modification date : Thu Jan 31 15:09:23 2002

**Author**

Jean-Pierre D'Ales