DSPRelated.com
Forums

What kind of filter is this?

Started by Zerofall 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[0] * (x[ 0] - x[1]);
y +=  cy[1] * (x[-1] - x[2]);
y +=  cy[2] * (x[-2] - x[3]);
y +=  cy[3] * (x[-3] - x[4]);
y +=  cy[4] * (x[-4] - x[5]);
y +=  cy[5] * (x[-5] - x[6]);
y +=  cy[6] * (x[-6] - x[7]);
y +=  cy[7] * (x[-7] - x[8]);
y >>= 4;

z  =  cz[0] * (x[ 0] + x[1]);
z +=  cz[1] * (x[-1] + x[2]);
z +=  cz[2] * (x[-2] + x[3]);
z +=  cz[3] * (x[-3] + x[4]);
z +=  cz[4] * (x[-4] + x[5]);
z +=  cz[5] * (x[-5] + x[6]);
z +=  cz[6] * (x[-6] + x[7]);
z +=  cz[7] * (x[-7] + x[8]);
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
news:628e317a.0311031518.18002a3d@posting.google.com...
> 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[0] * (x[ 0] - x[1]); > y += cy[1] * (x[-1] - x[2]); > y += cy[2] * (x[-2] - x[3]); > y += cy[3] * (x[-3] - x[4]); > y += cy[4] * (x[-4] - x[5]); > y += cy[5] * (x[-5] - x[6]); > y += cy[6] * (x[-6] - x[7]); > y += cy[7] * (x[-7] - x[8]); > y >>= 4; > > z = cz[0] * (x[ 0] + x[1]); > z += cz[1] * (x[-1] + x[2]); > z += cz[2] * (x[-2] + x[3]); > z += cz[3] * (x[-3] + x[4]); > z += cz[4] * (x[-4] + x[5]); > z += cz[5] * (x[-5] + x[6]); > z += cz[6] * (x[-6] + x[7]); > z += cz[7] * (x[-7] + x[8]); > 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

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[0] * (x[ 0] - x[1]); > y += cy[1] * (x[-1] - x[2]); > y += cy[2] * (x[-2] - x[3]); > y += cy[3] * (x[-3] - x[4]); > y += cy[4] * (x[-4] - x[5]); > y += cy[5] * (x[-5] - x[6]); > y += cy[6] * (x[-6] - x[7]); > y += cy[7] * (x[-7] - x[8]); > y >>= 4; > > z = cz[0] * (x[ 0] + x[1]); > z += cz[1] * (x[-1] + x[2]); > z += cz[2] * (x[-2] + x[3]); > z += cz[3] * (x[-3] + x[4]); > z += cz[4] * (x[-4] + x[5]); > z += cz[5] * (x[-5] + x[6]); > z += cz[6] * (x[-6] + x[7]); > z += cz[7] * (x[-7] + x[8]); > 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 > news:628e317a.0311031518.18002a3d@posting.google.com... > >>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[0] * (x[ 0] - x[1]); >>y += cy[1] * (x[-1] - x[2]); >>y += cy[2] * (x[-2] - x[3]); >>y += cy[3] * (x[-3] - x[4]); >>y += cy[4] * (x[-4] - x[5]); >>y += cy[5] * (x[-5] - x[6]); >>y += cy[6] * (x[-6] - x[7]); >>y += cy[7] * (x[-7] - x[8]); >>y >>= 4; >> >>z = cz[0] * (x[ 0] + x[1]); >>z += cz[1] * (x[-1] + x[2]); >>z += cz[2] * (x[-2] + x[3]); >>z += cz[3] * (x[-3] + x[4]); >>z += cz[4] * (x[-4] + x[5]); >>z += cz[5] * (x[-5] + x[6]); >>z += cz[6] * (x[-6] + x[7]); >>z += cz[7] * (x[-7] + x[8]); >>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 copyright a road map, but you can't patent a route. Jerry -- Engineering is the art of making what you want from things you can get. &#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;&#4294967295;
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[1]);
 y +=  1559  * (x[-1] - x[2]);
 y +=  1078  * (x[-2] - x[3]);
 y +=  -457  * (x[-3] - x[4]);
 y += -1020  * (x[-4] - x[5]);
 y +=  -282  * (x[-5] - x[6]);
 y +=   199  * (x[-6] - x[7]);
 y +=   141  * (x[-7] - x[8]);
 y >>= 4;
 
 z  =  1700 * (x[ 0] + x[1]);
 z +=   364 * (x[-1] + x[2]);
 z += -1525 * (x[-2] + x[3]);
 z += -2182 * (x[-3] + x[4]);
 z +=   821 * (x[-4] + x[5]);
 z +=   962 * (x[-5] + x[6]);
 z +=   199 * (x[-6] + x[7]);
 z +=  -340 * (x[-7] + x[8]);
 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[0]-x[1]" and (x[-1]-x[2]) 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[8];
 y -=   199  * x[7];
 y -=  -282  * x[6];
 y -= -1020  * x[5];
 y -=  -457  * x[4];
 y -=  1078  * x[3];
 y -=  1559  * x[2];
 y -=   704  * x[1];
 y +=   704  * x[0];
 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 
about this type of filters, because I'm looking forward to design filters like
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