# Downsampling in DWT algorithm

I was working on wavelet signal decomposition and got confused with the downsampling part of Discrete Wavelet Transform algorithm.

If we consider a signal $\{a_0, ... ,a_0[N-1]\}$ of length N and use formula $$a_1[k] = \sum_m h[m-2k]a_0[m]$$ then for two low pass filters $$\{h=h_0,~h=h_1, ~h=h_2, ~h=h_3\}$$ and $$\{g[-2]=h_0,~g[-1]=h_1, ~g=h_2, ~g=h_3\}$$ (which are the same thing except the second filter is time-shifted version of the first one) we will get different results.

Let me clarify. After convolution of $a_0$ and $h$ we will get $N+3$ samples $\tilde a_1[k]$, $k=-1,...,N+1$ with the first non zero sample being $\tilde a_1[-1]$. So, after downsampling we will result in the following sequence $$\tilde a_1, \tilde a_1, \tilde a_1, ..., \tilde a_1[N_1]$$ where $N_1$ is the integer part of $(N+1)/2$, with total number of samples equal to $N_1 + 1$.

Now if we convolve $g$ and $a_0$ again we will get $N+3$ samples, but this time $\hat a_1[k]$, $k=0,...,N+2$. And after downsampling we will get $$\hat a_1, \hat a_1, \hat a_1, ..., \hat a_1[N_2]$$ where $N_2$ is the integer part of $(N+2)/2$, with total number of samples equal to $N_2 + 1$.

So as a result, if number of samples $N$ of input signal $a_0$ is even, then number of approximation coefficients for $h$ and $g$ is different (integer part of $(N+1)/2$ is less than integer part of $(N+2)/2$). More than that, second sequence consists of exactly those samples which are excluded from the first one and vice versa.

So my questions are:

1) Is this correct or do I have a mistake somewhere?

2) If this is correct, then why implementations of dwt algorithm ignore this fact? (I've tested dwt from PyWavelets package)

## 1 Answer

Wavelet analysis results in information about both frequency and time localization. Since the two filters are slightly offset in time, if your signal varies over time, one might expect the two wavelet results to be different.

• OK, but when you do dwt for db2 wavelet which has exactly 4 filter coefficients you do not supply information about time offsets. You just use sequence of 4 numbers. My point is it seems like it does matter which indices wavelet filter coefficients have. But implementations of dwt do not take that into account. – niyazets Mar 4 '16 at 7:56