y *= bessel(16*sqrt(FFMAX(1-w*w, 0))) / bessel(16);
y *= bessel(16*sqrt(FFMAX(1-w*w, 0)));
void av_build_filter(int16_t *filter, double factor, int tap_count, int phase_count, int scale, int type){    int ph, i, v;    double x, y, w, tab[tap_count];    const int center= (tap_count-1)/2;    /* if upsampling, only need to interpolate, no filter */    if (factor > 1.0)        factor = 1.0;    for(ph=0;ph<phase_count;ph++) {        double norm = 0;        double e= 0;        for(i=0;i<tap_count;i++) {            x = M_PI * ((double)(i - center) - (double)ph / phase_count) * factor;            if (x == 0) y = 1.0;            else        y = sin(x) / x;            switch(type){            case 0:{                const float d= -0.5; //first order derivative = -0.5                x = fabs(((double)(i - center) - (double)ph / phase_count) * factor);                if(x<1.0) y= 1 - 3*x*x + 2*x*x*x + d*(            -x*x + x*x*x);                else      y=                       d*(-4 + 8*x - 5*x*x + x*x*x);                break;}            case 1:                w = 2.0*x / (factor*tap_count) + M_PI;                y *= 0.3635819 - 0.4891775 * cos(w) + 0.1365995 * cos(2*w) - 0.0106411 * cos(3*w);                break;            case 2:                w = 2.0*x / (factor*tap_count*M_PI);                y *= bessel(16*sqrt(FFMAX(1-w*w, 0))) / bessel(16);                break;            }            tab[i] = y;            norm += y;        }        /* normalize so that an uniform color remains the same */        for(i=0;i<tap_count;i++) {            v = clip(lrintf(tab[i] * scale / norm) + e, -32768, 32767);            filter[ph * tap_count + i] = v;            e += tab[i] * scale / norm - v;        }    }}