# Help polyphase implementation

Started by June 14, 2010
```Dear all,
I want to convert the signal from 44.1 to 48kHz.
I am using an pi/160 FIR filter of length around 8k.

When I up sample to 147 times and filter and down sample to 160, I am
getting good results.

So for efficient implementation I am implementing the same with poly phase
structure.

The input signal increments with a time_stride of 147/160 and I need to
find the exact phase of the filter in between 0-159 to start convolution to
get that phase output.The incrementation of h_index is 160 but starting
point depends on the signal time. I am multiplying the h_stride with the 15
bit fraction of the time index.

I am not able to get the h index exactly at some places as like in the
above up sampling - filtering -down sampling procedure. It is shifting by
+1 or -1 due to rounding effect, I am not getting exactly what to
round(signal index or h index) and where(when incrementing the signal time
or calculating h_index).

Due to this problem I am getting less SNR (obviously), Because of not
selecting the correct coefficient set for the phases at some places.

Can anybody give me some suggestion or help me where I am going wrong, if

Regards

```
```"bhaskar.nallani" <bhaskar.nallani@n_o_s_p_a_m.soctronics.com> writes:

> Dear all,
> I want to convert the signal from 44.1 to 48kHz.
> I am using an pi/160 FIR filter of length around 8k.
>
> When I up sample to 147 times and filter and down sample to 160, I am
> getting good results.
>
> So for efficient implementation I am implementing the same with poly phase
> structure.
>
> The input signal increments with a time_stride of 147/160 and I need to
> find the exact phase of the filter in between 0-159 to start convolution to
> get that phase output.The incrementation of h_index is 160 but starting
> point depends on the signal time. I am multiplying the h_stride with the 15
> bit fraction of the time index.
>
> I am not able to get the h index exactly at some places as like in the
> above up sampling - filtering -down sampling procedure. It is shifting by
> +1 or -1 due to rounding effect, I am not getting exactly what to
> round(signal index or h index) and where(when incrementing the signal time
> or calculating h_index).
>
> Due to this problem I am getting less SNR (obviously), Because of not
> selecting the correct coefficient set for the phases at some places.
>
> Can anybody give me some suggestion or help me where I am going wrong, if
>
> Regards

Sounds like you have the right idea. It's hard to debug with a "word
description" - can we have a look at your code?
--
Randy Yates                      % "With time with what you've learned,
Digital Signal Labs              %  they'll kiss the ground you walk
mailto://yates@ieee.org          %  upon."
http://www.digitalsignallabs.com % '21st Century Man', *Time*, ELO
```
```On 14 Juni, 13:33, "bhaskar.nallani"
> Dear all,
> I want to convert the signal from 44.1 to 48kHz.
> I am using an pi/160 FIR filter of length around 8k.
>
> When I up sample to 147 times and filter and down sample to 160, I am
> getting good results.
>
> So for efficient implementation I am implementing the same with poly phase
> structure.
>
> The input signal increments with a time_stride of 147/160 and I need to
> find the exact phase of the filter in between 0-159 to start convolution to
> get that phase output.The incrementation of h_index is 160 but starting
> point depends on the signal time. I am multiplying the h_stride with the 15
> bit fraction of the time index.
>
> I am not able to get the h index exactly at some places as like in the
> above up sampling - filtering -down sampling procedure. It is shifting by
> +1 or -1 due to rounding effect, I am not getting exactly what to
> round(signal index or h index) and where(when incrementing the signal time
> or calculating h_index).
>
> Due to this problem I am getting less SNR (obviously), Because of not
> selecting the correct coefficient set for the phases at some places.
>
> Can anybody give me some suggestion or help me where I am going wrong, if
>
> Regards

Hello,
You are not making sense: 44100*160/147 = 48000, ie you need to UP-
sample by
160 and DOWN-sample by 147.
Your input index is calculated as: fix(n*147/160)
And your start index for the coefficents: rem(n*147, 160), where
n=0...N-1
and N is the number of output samples you want to calclate. There is
no need
to do rounding for these calculations. In fact the calculations can
be
performed with simple addition/subration in integer arithmetic.
Here are the first 20 indices.
input ix: 0   0   1   2   3  4  5  6  7  8  9 10 11  11  12  13  14 15
16 17
coeff ix: 0 147 134 121 108 95 82 69 56 43 30 17  4 151 138 125 112 99
86 73

Also, the coeffecients are accessed with a stride of 160.
Best rgds
```