Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19063
Modified Files:
Tag: devel_0_38
d_delay.c
Log Message:
simd improved delread~
Index: d_delay.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_delay.c,v
retrieving revision 1.2.4.1
retrieving revision 1.2.4.2
diff -C2 -d -r1.2.4.1 -r1.2.4.2
*** d_delay.c 14 Dec 2004 09:28:34 -0000 1.2.4.1
--- d_delay.c 7 Jan 2005 12:22:58 -0000 1.2.4.2
***************
*** 6,9 ****
--- 6,12 ----
#include "m_pd.h"
+
+ #include "m_simd.h"
+
extern int ugen_getsortno(void);
***************
*** 66,71 ****
x->x_cspace.c_n = nsamps;
x->x_cspace.c_vec =
! (float *)getbytes((nsamps + XTRASAMPS) * sizeof(float));
! x->x_cspace.c_phase = XTRASAMPS;
x->x_sortno = 0;
x->x_vecsize = 0;
--- 69,74 ----
x->x_cspace.c_n = nsamps;
x->x_cspace.c_vec =
! (float *)getalignedbytes((nsamps + XTRASAMPS) * sizeof(float));
! x->x_cspace.c_phase = XTRASAMPS;
x->x_sortno = 0;
x->x_vecsize = 0;
***************
*** 102,108 ****
}
static void sigdelwrite_dsp(t_sigdelwrite *x, t_signal **sp)
{
! dsp_add(sigdelwrite_perform, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n);
x->x_sortno = ugen_getsortno();
sigdelwrite_checkvecsize(x, sp[0]->s_n);
--- 105,115 ----
}
+
+
static void sigdelwrite_dsp(t_sigdelwrite *x, t_signal **sp)
{
! dsp_add(sigdelwrite_perform, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n);
!
!
x->x_sortno = ugen_getsortno();
sigdelwrite_checkvecsize(x, sp[0]->s_n);
***************
*** 112,116 ****
{
pd_unbind(&x->x_obj.ob_pd, x->x_sym);
! freebytes(x->x_cspace.c_vec,
(x->x_cspace.c_n + XTRASAMPS) * sizeof(float));
}
--- 119,123 ----
{
pd_unbind(&x->x_obj.ob_pd, x->x_sym);
! freealignedbytes(x->x_cspace.c_vec,
(x->x_cspace.c_n + XTRASAMPS) * sizeof(float));
}
***************
*** 169,172 ****
--- 176,180 ----
x->x_delsamps = delwriter->x_cspace.c_n - DEFDELVS;
}
+ x->x_delsamps += (16 - x->x_delsamps) % 16;
}
***************
*** 190,193 ****
--- 198,251 ----
}
+ #include "assert.h"
+ static t_int *sigdelread_perf8(t_int *w)
+ {
+ t_float *out = (t_float *)(w[1]);
+ t_delwritectl *c = (t_delwritectl *)(w[2]);
+ int delsamps = *(int *)(w[3]);
+ int n = (int)(w[4]);
+ int phase = c->c_phase - delsamps, nsamps = c->c_n;
+ float *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS);
+
+ if (phase < 0) phase += nsamps;
+ bp = vp + phase;
+ if (phase + n > nsamps)
+ while (n--)
+ {
+ *out++ = *bp++;
+ if (bp == ep) bp -= nsamps;
+ }
+ else
+ {
+ copyvec_8(out, bp, n);
+ }
+ return (w+5);
+ }
+
+ static t_int *sigdelread_perfsimd(t_int *w)
+ {
+ t_float *out = (t_float *)(w[1]);
+ t_delwritectl *c = (t_delwritectl *)(w[2]);
+ int delsamps = *(int *)(w[3]);
+ int n = (int)(w[4]);
+ int phase = c->c_phase - delsamps, nsamps = c->c_n;
+ float *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS);
+
+ if (phase < 0) phase += nsamps;
+ bp = vp + phase;
+ if (phase + n > nsamps)
+ while (n--)
+ {
+ *out++ = *bp++;
+ if (bp == ep) bp -= nsamps;
+ }
+ else
+ {
+ assert( SIMD_CHKALIGN (bp) != 0 ); /* tb: are we sure to have aligned pointers??? */
+ copyvec_simd(out, bp, n);
+ }
+ return (w+5);
+ }
+
static void sigdelread_dsp(t_sigdelread *x, t_signal **sp)
{
***************
*** 202,207 ****
0 : delwriter->x_vecsize);
sigdelread_float(x, x->x_deltime);
! dsp_add(sigdelread_perform, 4,
! sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n);
}
else if (*x->x_sym->s_name)
--- 260,273 ----
0 : delwriter->x_vecsize);
sigdelread_float(x, x->x_deltime);
! if (sp[0]->s_n & 7)
! dsp_add(sigdelread_perform, 4,
! sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n);
! else
! if (SIMD_CHECK1(sp[0]->s_n, sp[0]->s_vec))
! dsp_add(sigdelread_perfsimd, 4,
! sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n);
! else
! dsp_add(sigdelread_perf8, 4,
! sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n);
}
else if (*x->x_sym->s_name)