Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6391
Modified Files: Tag: devel_0_38 d_filter.c Log Message: unrolled biquad and relaxed denormal bashing
Index: d_filter.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_filter.c,v retrieving revision 1.3.4.3 retrieving revision 1.3.4.4 diff -C2 -d -r1.3.4.3 -r1.3.4.4 *** d_filter.c 21 May 2005 13:08:13 -0000 1.3.4.3 --- d_filter.c 22 Jun 2005 18:47:52 -0000 1.3.4.4 *************** *** 399,402 **** --- 399,472 ---- }
+ /* tb: some loop unrolling & do some relaxed denormal bashing */ + #if 1 + static t_int *sigbiquad_perf8(t_int *w) + { + float *in = (float *)(w[1]); + float *out = (float *)(w[2]); + t_biquadctl *c = (t_biquadctl *)(w[3]); + int n = (t_int)(w[4])>>3; + int i; + float last = c->c_x1; + float prev = c->c_x2; + float fb1 = c->c_fb1; + float fb2 = c->c_fb2; + float ff1 = c->c_ff1; + float ff2 = c->c_ff2; + float ff3 = c->c_ff3; + for (i = 0; i < n; i++) + { + float output = *in++ + fb1 * last + fb2 * prev; + #ifdef __i386__ + output += 1e-10; /* quantizing should be faster than PD_BIGORSMALL */ + output -= 1e-10; /* only doing this every 8th sample should be ok */ + #endif + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + output += 1e-10; + output -= 1e-10; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + + output = *in++ + fb1 * last + fb2 * prev; + *out++ = ff1 * output + ff2 * last + ff3 * prev; + prev = last; + last = output; + } + c->c_x1 = last; + c->c_x2 = prev; + return (w+5); + } + #endif + static void sigbiquad_list(t_sigbiquad *x, t_symbol *s, int argc, t_atom *argv) { *************** *** 442,449 **** static void sigbiquad_dsp(t_sigbiquad *x, t_signal **sp) { dsp_add(sigbiquad_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x->x_ctl, sp[0]->s_n); ! }
--- 512,530 ---- static void sigbiquad_dsp(t_sigbiquad *x, t_signal **sp) { + #if 1 + const int n = sp[0]->s_n; + if (n&7) + dsp_add(sigbiquad_perform, 4, + sp[0]->s_vec, sp[1]->s_vec, + x->x_ctl, sp[0]->s_n); + else + dsp_add(sigbiquad_perf8, 4, + sp[0]->s_vec, sp[1]->s_vec, + x->x_ctl, sp[0]->s_n); + #else dsp_add(sigbiquad_perform, 4, sp[0]->s_vec, sp[1]->s_vec, x->x_ctl, sp[0]->s_n); ! #endif }