# What kind of filter is this?

Started by November 3, 2003
```Hi,

This is my first post to comp.dsp. I found the filter below but I haven't been
able to identify the type of filter it is (so I can understand and modify its
parameters, properties, look for the theory, etc). It is used to separate U and V
color components of chroma prior to demodulation by rotation according to the
phase of the carrier.

Using a sine as input, the output of y is 23 degrees behind the input (phase
I mean), and z is 67 degrees ahead, meaning y and z are 90 degs apart.

y  =  cy * (x[ 0] - x);
y +=  cy * (x[-1] - x);
y +=  cy * (x[-2] - x);
y +=  cy * (x[-3] - x);
y +=  cy * (x[-4] - x);
y +=  cy * (x[-5] - x);
y +=  cy * (x[-6] - x);
y +=  cy * (x[-7] - x);
y >>= 4;

z  =  cz * (x[ 0] + x);
z +=  cz * (x[-1] + x);
z +=  cz * (x[-2] + x);
z +=  cz * (x[-3] + x);
z +=  cz * (x[-4] + x);
z +=  cz * (x[-5] + x);
z +=  cz * (x[-6] + x);
z +=  cz * (x[-7] + x);
z >>= 4;

Thanks, and I didn't post the coeffs because I'm not sure if they're patented or
something)

Zero
```
```"Zerofall" <zerofall@hotmail.com> wrote in message
> Hi,
>
> This is my first post to comp.dsp. I found the filter below but I haven't
been
> able to identify the type of filter it is (so I can understand and modify
its
> parameters, properties, look for the theory, etc). It is used to separate
U and V
>  color components of chroma prior to demodulation by rotation according to
the
> phase of the carrier.
>
> Using a sine as input, the output of y is 23 degrees behind the input
(phase
>  I mean), and z is 67 degrees ahead, meaning y and z are 90 degs apart.
>
>
> y  =  cy * (x[ 0] - x);
> y +=  cy * (x[-1] - x);
> y +=  cy * (x[-2] - x);
> y +=  cy * (x[-3] - x);
> y +=  cy * (x[-4] - x);
> y +=  cy * (x[-5] - x);
> y +=  cy * (x[-6] - x);
> y +=  cy * (x[-7] - x);
> y >>= 4;
>
> z  =  cz * (x[ 0] + x);
> z +=  cz * (x[-1] + x);
> z +=  cz * (x[-2] + x);
> z +=  cz * (x[-3] + x);
> z +=  cz * (x[-4] + x);
> z +=  cz * (x[-5] + x);
> z +=  cz * (x[-6] + x);
> z +=  cz * (x[-7] + x);
> z >>= 4;
>
> Thanks, and I didn't post the coeffs because I'm not sure if they're
patented or
> something)

I'm just learning all this kind of stuff at Uni myself...
however, it looks like the algorithm is a pair of eight tap FIR filters
In that case, the only really inmportant aspect is the actual value of the
coefficients.  They determine the response of the filter.  If all it does is
shift the phase of the input signal, then I would say it's a phase shifting
filter (all-pass??)

I'm sure you'll get better info from the others in the group...

Bevan Weiss

```
```
Zerofall wrote:
>
> Hi,
>
> This is my first post to comp.dsp. I found the filter below but I haven't been
> able to identify the type of filter it is (so I can understand and modify its
> parameters, properties, look for the theory, etc). It is used to separate U and V
>  color components of chroma prior to demodulation by rotation according to the
> phase of the carrier.
>
> Using a sine as input, the output of y is 23 degrees behind the input (phase
>  I mean), and z is 67 degrees ahead, meaning y and z are 90 degs apart.
>
> y  =  cy * (x[ 0] - x);
> y +=  cy * (x[-1] - x);
> y +=  cy * (x[-2] - x);
> y +=  cy * (x[-3] - x);
> y +=  cy * (x[-4] - x);
> y +=  cy * (x[-5] - x);
> y +=  cy * (x[-6] - x);
> y +=  cy * (x[-7] - x);
> y >>= 4;
>
> z  =  cz * (x[ 0] + x);
> z +=  cz * (x[-1] + x);
> z +=  cz * (x[-2] + x);
> z +=  cz * (x[-3] + x);
> z +=  cz * (x[-4] + x);
> z +=  cz * (x[-5] + x);
> z +=  cz * (x[-6] + x);
> z +=  cz * (x[-7] + x);
> z >>= 4;
>
> Thanks, and I didn't post the coeffs because I'm not sure if they're patented or
> something)

They are FIR filters. The first is anti-symmetric the second symmetric. The
frequency response of the first is pure real, and the second is pure imaginary.
The lag and lead you noted is dependent on frequency of the sine wave you input.

If you want to make a gain vs frequency plot use these formulas:

Y = sum(i:0,7) cy[i]*sin(2*i*pi*f)

Z = sum(i:0,7) cz[i]*cos(2*i*pi*f)

-jim

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----
```
```It's a pair of 16-tap, linear phase FIR filters.  The code is optimized to
reduce the number of multiplications to 1 for each pair of equal magnitude
coefficients.  The y filter is even and the z filter odd.  Given that, what
you said about your test, and because there are two of them, the filters are
probably a Hilbert transform pair.

```
```
jim wrote:

> They are FIR filters. The first is anti-symmetric the second symmetric. The
> frequency response of the first is pure real, and the second is pure imaginary.

Sorry, that's backwards - A symmetric filter has a real frequency response. An
anti-symmetric has the imaginary frequency response.

-jim

-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----==  Over 100,000 Newsgroups - 19 Different Servers! =-----
```
```Bevan Weiss wrote:

> "Zerofall" <zerofall@hotmail.com> wrote in message
>
>>Hi,
>>
>>This is my first post to comp.dsp. I found the filter below but I haven't
>
> been
>
>>able to identify the type of filter it is (so I can understand and modify
>
> its
>
>>parameters, properties, look for the theory, etc). It is used to separate
>
> U and V
>
>> color components of chroma prior to demodulation by rotation according to
>
> the
>
>>phase of the carrier.
>>
>>Using a sine as input, the output of y is 23 degrees behind the input
>
> (phase
>
>> I mean), and z is 67 degrees ahead, meaning y and z are 90 degs apart.
>>
>>
>>y  =  cy * (x[ 0] - x);
>>y +=  cy * (x[-1] - x);
>>y +=  cy * (x[-2] - x);
>>y +=  cy * (x[-3] - x);
>>y +=  cy * (x[-4] - x);
>>y +=  cy * (x[-5] - x);
>>y +=  cy * (x[-6] - x);
>>y +=  cy * (x[-7] - x);
>>y >>= 4;
>>
>>z  =  cz * (x[ 0] + x);
>>z +=  cz * (x[-1] + x);
>>z +=  cz * (x[-2] + x);
>>z +=  cz * (x[-3] + x);
>>z +=  cz * (x[-4] + x);
>>z +=  cz * (x[-5] + x);
>>z +=  cz * (x[-6] + x);
>>z +=  cz * (x[-7] + x);
>>z >>= 4;
>>
>>Thanks, and I didn't post the coeffs because I'm not sure if they're
>
> patented or
>
>>something)
>
>
> I'm just learning all this kind of stuff at Uni myself...
> however, it looks like the algorithm is a pair of eight tap FIR filters
> (correction if I'm wrong please).
> In that case, the only really inmportant aspect is the actual value of the
> coefficients.  They determine the response of the filter.  If all it does is
> shift the phase of the input signal, then I would say it's a phase shifting
> filter (all-pass??)
>
> I'm sure you'll get better info from the others in the group...
>
> Bevan Weiss
>
>
It's not really possible to characterize a filter by probing it at a
single frequency. I don't think you can patent coefficients. You can

Jerry
--
Engineering is the art of making what you want from things you can get.
&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;

```
```Hi,

Wow, so many replies, thank you, I'm posting the coefficients and the rotation
by the carrier's phase (cordic style), maybe it will clarify things.

y  =   704  * (x[ 0] - x);
y +=  1559  * (x[-1] - x);
y +=  1078  * (x[-2] - x);
y +=  -457  * (x[-3] - x);
y += -1020  * (x[-4] - x);
y +=  -282  * (x[-5] - x);
y +=   199  * (x[-6] - x);
y +=   141  * (x[-7] - x);
y >>= 4;

z  =  1700 * (x[ 0] + x);
z +=   364 * (x[-1] + x);
z += -1525 * (x[-2] + x);
z += -2182 * (x[-3] + x);
z +=   821 * (x[-4] + x);
z +=   962 * (x[-5] + x);
z +=   199 * (x[-6] + x);
z +=  -340 * (x[-7] + x);
z >>= 4;

fs = cos1[(Phase - 90deg)];
fc = cos1[(Phase )];
u = (fs*y + fc*z) >> 8;
v = (fc*y - fs*z) >> 8;

What confuses me is that it uses  "(x-x" and (x[-1]-x) and so on,
cause the coefficients are multiplying at differentials between samples that get
farther and farther from each other (0 1,-1 2, -2 3, etc), or is it as Matt
said that the actual 16-tap filter would be:

y  = 0;
y -=   141  * x;
y -=   199  * x;
y -=  -282  * x;
y -= -1020  * x;
y -=  -457  * x;
y -=  1078  * x;
y -=  1559  * x;
y -=   704  * x;
y +=   704  * x;
y +=  1559  * x[-1];
y +=  1078  * x[-2];
y +=  -457  * x[-3];
y += -1020  * x[-4];
y +=  -282  * x[-5];
y +=   199  * x[-6];
y +=   141  * x[-7];

also meaning that (as Jim said) it is anti-symmetric (because the coeffs would
be: ......,-1559,-704,704,1559,...... ), representing the "real" freq resp, that
I think would represent the "cosine samples" for the UV extraction,
which would be according to the fact that in this case the "y" value would
be rotated (using cordic) to become V, and "z" would be U, components of
chroma (Chroma = U*sin(wt)+V*cos(wt)).

Ouch, I hope I got everything right, of course a newbee like me will most
likely get really messed up.

Can anyone point out a website (preferable, because in my country bookstores and
libraries don't have many DSP books) where I could find some theory/lectures
these to perform I-Q extraction (I'm not sure if it would be enough to just add
33degrees to the Cordic rotation, starting from the same filters).

Also, how do I change the email address so I don't get spam, Google wants to
check the new *fony* address I want to put in.

Thanks

Zero
```
```Just putting it up one more time,

Sorry

Zero
```