[MPlayer-dev-eng] more on af_resample.c

Arpi arpi at thot.banki.hu
Thu Oct 3 01:22:50 CEST 2002


Hi,

> > what about this optimization:  works well for me but i'm not sure it's
> > correct and won't overflow for certain samples:
> >
> > -#define FIR(x,w,y){ \
> > -  int16_t a = (w[0] *x[0] +w[1] *x[1] +w[2] *x[2] +w[3] *x[3] ) >> 16; \
> > -  int16_t b = (w[4] *x[4] +w[5] *x[5] +w[6] *x[6] +w[7] *x[7] ) >> 16; \
> > -  int16_t c = (w[8] *x[8] +w[9] *x[9] +w[10]*x[10]+w[11]*x[11]) >> 16; \
> > -  int16_t d = (w[12]*x[12]+w[13]*x[13]+w[14]*x[14]+w[15]*x[15]) >> 16; \
> > -  y[0]      = (a+b+c+d) >> 1; \
> > -}
> > +#define FIR(x,w,y) \
> > +  y[0] = ( w[0] *x[0] +w[1] *x[1] +w[2] *x[2] +w[3] *x[3] \
> > +         + w[4] *x[4] +w[5] *x[5] +w[6] *x[6] +w[7] *x[7] \
> > +         + w[8] *x[8] +w[9] *x[9] +w[10]*x[10]+w[11]*x[11] \
> > +         + w[12]*x[12]+w[13]*x[13]+w[14]*x[14]+w[15]*x[15] ) >> 16

> btw, what about correct rounding (+(1<<15)) or do i missunderstand something
good idea

> btw2, these dont look identical (shouldnt it be >> 17) ?
yes you're right, but as 32bits>>17 = 15bits, and the output can hold 16
bits, >>16 seems to be better choice for me :)

> btw3, fewer bits could be used for the coefficients so that no overflow 
> happens
imho it's already done, at least the output is more quiet/silent even
with >>16 than the original...


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu



More information about the MPlayer-dev-eng mailing list