[MPlayer-dev-eng] more on af_resample.c
Michael Niedermayer
michaelni at gmx.at
Thu Oct 3 00:45:25 CEST 2002
Hi
On Thursday 03 October 2002 00:47, Arpi wrote:
> 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
btw2, these dont look identical (shouldnt it be >> 17) ?
btw3, fewer bits could be used for the coefficients so that no overflow
happens
[...]
Michael
More information about the MPlayer-dev-eng
mailing list