[PD-cvs] pd/src d_array.c,1.3.4.2,1.3.4.3 d_ctl.c,1.3.4.5,1.3.4.6 d_delay.c,1.2.4.3,1.2.4.4 d_global.c,1.2.4.1,1.2.4.2 d_soundfile.c,1.4.4.9,1.4.4.10 m_pd.h,1.4.4.6,1.4.4.7 m_sched.c,1.5.4.12,1.5.4.13 m_simd.c,1.1.4.3,1.1.4.4 m_simd_sse_gcc.c,1.1.4.9,1.1.4.10 m_simd_sse_gcc.h,1.1.4.5,1.1.4.6 m_simd_sse_vc.c,1.1.4.5,1.1.4.6 m_simd_sse_vc.h,1.1.4.5,1.1.4.6 m_simd_ve_gcc.c,1.1.4.1,1.1.4.2 m_simd_ve_gcc.h,1.1.4.3,1.1.4.4 s_audio.c,1.5.4.5,1.5.4.6 s_entry.c,1.2.4.1,1.2.4.2 x_net.c,1.2.4.1,1.2.4.2

Tim Blechmann timblech at users.sourceforge.net
Tue Jan 11 22:41:17 CET 2005


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7145

Modified Files:
      Tag: devel_0_38
	d_array.c d_ctl.c d_delay.c d_global.c d_soundfile.c m_pd.h 
	m_sched.c m_simd.c m_simd_sse_gcc.c m_simd_sse_gcc.h 
	m_simd_sse_vc.c m_simd_sse_vc.h m_simd_ve_gcc.c 
	m_simd_ve_gcc.h s_audio.c s_entry.c x_net.c 
Log Message:
mainly simd changes for gcc/i386

Index: m_simd.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd.c,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -C2 -d -r1.1.4.3 -r1.1.4.4
*** m_simd.c	8 Jan 2005 22:13:40 -0000	1.1.4.3
--- m_simd.c	11 Jan 2005 21:41:14 -0000	1.1.4.4
***************
*** 37,115 ****
  }
  
- void testcopyvec_8(t_float *dst,const t_float *src,int n)
- {
-     while(n--) {
-         *(dst++) = (PD_BIGORSMALL(*src) ? 0 : *src); src++;
- 	}
- }
  
! void testaddvec_8(t_float *dst,const t_float *src,int n)
  {
!     while(n--) {
!         *(dst++) += (PD_BIGORSMALL(*src) ? 0 : *src); src++;
! 	}
  }
  
! int simd_check1(t_int n, t_float* ptr1)
  {
! 	return SIMD_CHECK1(n,ptr1);
  }
  
- int simd_check2(t_int n, t_float* ptr1, t_float* ptr2)
- {
- 	return SIMD_CHECK2(n,ptr1,ptr2);
- }
  
! int simd_check3(t_int n, t_float* ptr1, t_float* ptr2, t_float* ptr3)
! {
! 	return SIMD_CHECK3(n,ptr1,ptr2,ptr3);
! }
! 
! #ifdef DONTUSESIMD
! int simd_runtime_check()
  {
! 	return 0;
  }
  
! /* tb: wrapper for simd functions */
! void zerovec_simd(t_float *dst,int n)
  {
! 	zerovec_8(dst,n);
  }
  
! void setvec_simd(t_float *dst,t_float v,int n)
  {
! 	setvec_8(dst,v,n);
  }
  
! void copyvec_simd(t_float *dst,const t_float *src,int n)
  {
! 	copyvec_8(dst,src,n);
  }
  
- void addvec_simd(t_float *dst,const t_float *src,int n)
- {
- 	addvec_8(dst,src,n);
- }
  
! void testcopyvec_simd(t_float *dst,const t_float *src,int n)
  {
! 	testcopyvec_8(dst,src,n);
  }
  
! void testaddvec_simd(t_float *dst,const t_float *src,int n)
  {
! 	testaddvec_8(dst,src,n);
  }
  
! float sumvec_simd(t_float* in, t_int n)
  {
! 	return sumvec_8(in,n);
  }
  
  
- #endif /* DONTUSESIMD */
- 
- 
  float sumvec_8(t_float* in, t_int n)
  {
--- 37,95 ----
  }
  
  
! void copyvec(t_float *dst,const t_float *src,int n)
  {
! 	while(n--)
! 		*dst++ = *src++;
  }
  
! void addvec(t_float *dst,const t_float *src,int n)
  {
! 	while(n--)
! 		*dst++ += *src++;
  }
  
  
! void testcopyvec_8(t_float *dst,const t_float *src,int n)
  {
!     while(n--) {
!         *(dst++) = (PD_BIGORSMALL(*src) ? 0 : *src); src++;
! 	}
  }
  
! void testcopyvec(t_float *dst,const t_float *src,int n)
  {
! 	testcopyvec_8(dst, src, n);
  }
  
! void testaddvec_8(t_float *dst,const t_float *src,int n)
  {
!     while(n--) {
!         *(dst++) += (PD_BIGORSMALL(*src) ? 0 : *src); src++;
! 	}
  }
  
! void testaddvec(t_float *dst,const t_float *src,int n)
  {
! 	testaddvec_8(dst, src, n);
  }
  
  
! int simd_check1(t_int n, t_float* ptr1)
  {
! 	return SIMD_CHECK1(n,ptr1);
  }
  
! int simd_check2(t_int n, t_float* ptr1, t_float* ptr2)
  {
! 	return SIMD_CHECK2(n,ptr1,ptr2);
  }
  
! int simd_check3(t_int n, t_float* ptr1, t_float* ptr2, t_float* ptr3)
  {
! 	return SIMD_CHECK3(n,ptr1,ptr2,ptr3);
  }
  
  
  float sumvec_8(t_float* in, t_int n)
  {
***************
*** 132,136 ****
  }
  
! float env_tilde_accum(t_float* in, t_float* hp, t_int n)
  {
  	float ret = 0;
--- 112,116 ----
  }
  
! float env_tilde_accum_8(t_float* in, t_float* hp, t_int n)
  {
  	float ret = 0;
***************
*** 157,161 ****
  		ret += *hp++ * (*in * *in);
  	}
- 	
  	return ret;
  }
--- 137,246 ----
  		ret += *hp++ * (*in * *in);
  	}
  	return ret;
  }
+ 
+ float peakvec(t_float* vec, t_int n, t_float cur_max)
+ {
+ 	int i;
+ 	for (i = 0; i != n; ++i)
+ 	{
+ 		float f = *vec++;
+ 		if (f > cur_max) cur_max = f;
+ 		else if (-f > cur_max) cur_max = -f;
+ 	}
+ 	return cur_max;
+ }
+ 
+ void line_tilde_slope(t_float* out, t_int n, t_float* value,
+ 					  t_float* slopes, t_float* slopestep)
+ {
+ 	n>>=3;
+ 	t_float slope = slopes[0];
+ 	t_float f = *value;
+ 	while (n--)
+ 	{
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 		*out++ = f;
+ 		f += slope;
+ 	}
+ }
+ 
+ 
+ #ifdef DONTUSESIMD
+ int simd_runtime_check()
+ {
+ 	return 0;
+ }
+ 
+ /* tb: wrapper for simd functions */
+ void zerovec_simd(t_float *dst,int n)
+ {
+ 	zerovec_8(dst,n);
+ }
+ 
+ void setvec_simd(t_float *dst,t_float v,int n)
+ {
+ 	setvec_8(dst,v,n);
+ }
+ 
+ void copyvec_simd(t_float *dst,const t_float *src,int n)
+ {
+ 	copyvec_8(dst,src,n);
+ }
+ 
+ void copyvec_simd_unalignedsrc(t_float *dst,const t_float *src,int n)
+ {
+ 	copyvec_8(dst,src,n);
+ }
+ 
+ void addvec_simd(t_float *dst,const t_float *src,int n)
+ {
+ 	addvec_8(dst,src,n);
+ }
+ 
+ void testcopyvec_simd(t_float *dst,const t_float *src,int n)
+ {
+ 	testcopyvec_8(dst,src,n);
+ }
+ 
+ void testaddvec_simd(t_float *dst,const t_float *src,int n)
+ {
+ 	testaddvec_8(dst,src,n);
+ }
+ 
+ float sumvec_simd(t_float* in, t_int n)
+ {
+ 	return sumvec_8(in,n);
+ }
+ 
+ float env_tilde_accum_simd(t_float* in, t_float* hp, t_int n)
+ {
+ 	return env_tilde_accum_8(in, hp, n);
+ }
+ 
+ float peakvec_simd(t_float* vec, t_int n, t_float cur_max)
+ {
+ 	return peakvec(vec, n, cur_max);
+ }
+ 
+ 
+ /* float testfloat_simd(t_float f) */
+ /* { */
+ /* 	testfloat(f); */
+ /* } */
+ 
+ #endif /* DONTUSESIMD */
+ 

Index: s_entry.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_entry.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
*** s_entry.c	10 Nov 2004 10:52:15 -0000	1.2.4.1
--- s_entry.c	11 Jan 2005 21:41:14 -0000	1.2.4.2
***************
*** 7,11 ****
  #include <windows.h>
  #include <stdio.h>
- #include <stdlib.h>
  
  int WINAPI WinMain(HINSTANCE hInstance, 
--- 7,10 ----
***************
*** 14,20 ****
                                 int nCmdShow)
  {
!     __try 
!     {
!         sys_main(__argc,__argv); /* use preparsed arguments */
      }
      __finally
--- 13,18 ----
                                 int nCmdShow)
  {
!     __try {
!         sys_main(__argc,__argv);
      }
      __finally

Index: d_ctl.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_ctl.c,v
retrieving revision 1.3.4.5
retrieving revision 1.3.4.6
diff -C2 -d -r1.3.4.5 -r1.3.4.6
*** d_ctl.c	8 Jan 2005 22:13:40 -0000	1.3.4.5
--- d_ctl.c	11 Jan 2005 21:41:14 -0000	1.3.4.6
***************
*** 107,110 ****
--- 107,112 ----
      int x_ticksleft;
      int x_retarget;
+ 	float* x_slopes; /* tb: for simd-optimized line */
+ 	float x_slopestep;  /* tb: 4*x->x_inc */
  } t_line;
  
***************
*** 130,134 ****
      {
          float f = x->x_value;
!         while (n--) *out++ = f, f += x->x_inc;
          x->x_value += x->x_biginc;
          x->x_ticksleft--;
--- 132,137 ----
      {
          float f = x->x_value;
! 		float slope = x->x_inc;         /* tb: make sure, x->inc is loaded to a register */
!         while (n--) *out++ = f, f += slope;
          x->x_value += x->x_biginc;
          x->x_ticksleft--;
***************
*** 167,188 ****
          float f = x->x_value;
  		n >>= 3;
          while (n--) 
  		{ 
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  			*out++ = f;
! 			f += x->x_inc;
  		}
  
--- 170,192 ----
          float f = x->x_value;
  		n >>= 3;
+ 		float slope = x->x_inc;
          while (n--) 
  		{ 
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  			*out++ = f;
! 			f += slope;
  		}
  
***************
*** 211,214 ****
--- 215,220 ----
      {
          int nticks = x->x_inletwas * x->x_dspticktomsec;
+ 		int i;
+ 
          if (!nticks) nticks = 1;
          x->x_ticksleft = nticks;
***************
*** 216,243 ****
          x->x_inc = x->x_1overn * x->x_biginc;
          x->x_retarget = 0;
      }
      if (x->x_ticksleft)
      {
          float f = x->x_value;
! 		n >>= 3;
!         while (n--) 
! 		{ 
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 			*out++ = f;
! 			f += x->x_inc;
! 		}
          x->x_value += x->x_biginc;
          x->x_ticksleft--;
--- 222,238 ----
          x->x_inc = x->x_1overn * x->x_biginc;
          x->x_retarget = 0;
+ 
+ 		for (i = 0; i != 4; ++i)
+ 		{
+ 			x->x_slopes[i] = i*x->x_inc;
+ 		}
+ 		x->x_slopestep = 4 * x->x_inc;
      }
      if (x->x_ticksleft)
      {
          float f = x->x_value;
! 
! 		line_tilde_slope_simd(out, n, &x->x_value, x->x_slopes, &x->x_slopestep);
! 
          x->x_value += x->x_biginc;
          x->x_ticksleft--;
***************
*** 246,250 ****
      {
          float f = x->x_value = x->x_target;
! 		setvec_8(out,f,n);
      }
      return (w+4);
--- 241,245 ----
      {
          float f = x->x_value = x->x_target;
! 		setvec_simd(out,f,n);
      }
      return (w+4);
***************
*** 289,292 ****
--- 284,288 ----
  }
  
+ /* tb: modified for simd-optimized line~ */
  static void *line_tilde_new(void)
  {
***************
*** 296,306 ****
      x->x_ticksleft = x->x_retarget = 0;
      x->x_value = x->x_target = x->x_inletvalue = x->x_inletwas = 0;
      return (x);
  }
  
  static void line_tilde_setup(void)
  {
!     line_tilde_class = class_new(gensym("line~"), line_tilde_new, 0,
!         sizeof(t_line), 0, 0);
      class_addfloat(line_tilde_class, (t_method)line_tilde_float);
      class_addmethod(line_tilde_class, (t_method)line_tilde_dsp,
--- 292,308 ----
      x->x_ticksleft = x->x_retarget = 0;
      x->x_value = x->x_target = x->x_inletvalue = x->x_inletwas = 0;
+ 	x->x_slopes = getalignedbytes(4*sizeof(t_float));
      return (x);
  }
  
+ static void *line_tilde_free(t_line * x)
+ {
+ 	freealignedbytes(x->x_slopes, 4*sizeof(t_float));
+ }
+ 
  static void line_tilde_setup(void)
  {
!     line_tilde_class = class_new(gensym("line~"), (t_newmethod)line_tilde_new, 
! 		(t_method)line_tilde_free, sizeof(t_line), 0, 0);
      class_addfloat(line_tilde_class, (t_method)line_tilde_float);
      class_addmethod(line_tilde_class, (t_method)line_tilde_dsp,
***************
*** 730,734 ****
  
  /* tb: loop unrolling and simd */
! float env_tilde_accum(t_float* in, t_float* hp, t_int n);
  
  static t_int *env_tilde_perf8(t_int *w)
--- 732,736 ----
  
  /* tb: loop unrolling and simd */
! float env_tilde_accum_8(t_float* in, t_float* hp, t_int n);
  
  static t_int *env_tilde_perf8(t_int *w)
***************
*** 745,749 ****
          float *hp = x->x_buf + count;
  		
! 		*sump += env_tilde_accum(in, hp, n);
      }
      sump[0] = 0;
--- 747,751 ----
          float *hp = x->x_buf + count;
  		
! 		*sump += env_tilde_accum_8(in, hp, n);
      }
      sump[0] = 0;

Index: m_simd_ve_gcc.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_ve_gcc.h,v
retrieving revision 1.1.4.3
retrieving revision 1.1.4.4
diff -C2 -d -r1.1.4.3 -r1.1.4.4
*** m_simd_ve_gcc.h	8 Jan 2005 22:13:40 -0000	1.1.4.3
--- m_simd_ve_gcc.h	11 Jan 2005 21:41:14 -0000	1.1.4.4
***************
*** 41,46 ****
  t_int *sigrsqrt_perf_simd(t_int *w);
  
! #define env_tilde_accum_simdc      env_tilde_accum
  #define sum_vecsimd                sumvec_8 /* SIMD not implemented */
  
  #endif /* __M_SIMD_VE_GCC_H */
--- 41,49 ----
  t_int *sigrsqrt_perf_simd(t_int *w);
  
! #define env_tilde_accum_simd       env_tilde_accum /* SIMD not implemented */
! #define copyvec_simd_unalignedsrc  copyvec_8
  #define sum_vecsimd                sumvec_8 /* SIMD not implemented */
+ #define line_tilde_slope_simd      line_tilde_slope_simd /* SIMD not implemented */
+ 
  
  #endif /* __M_SIMD_VE_GCC_H */

Index: m_simd_sse_gcc.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_gcc.h,v
retrieving revision 1.1.4.5
retrieving revision 1.1.4.6
diff -C2 -d -r1.1.4.5 -r1.1.4.6
*** m_simd_sse_gcc.h	8 Jan 2005 22:13:40 -0000	1.1.4.5
--- m_simd_sse_gcc.h	11 Jan 2005 21:41:14 -0000	1.1.4.6
***************
*** 20,23 ****
--- 20,25 ----
  t_int *sig_tilde_perf_simd(t_int *w);
  float env_tilde_accum_simd(t_float* in, t_float* hp, t_int n);
+ void line_tilde_slope_simd(t_float* out, t_int n, t_float* value,
+ 						   t_float* slopes, t_float* slopestep);
  
  /* functions in d_arithmetic.c */

Index: d_delay.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_delay.c,v
retrieving revision 1.2.4.3
retrieving revision 1.2.4.4
diff -C2 -d -r1.2.4.3 -r1.2.4.4
*** d_delay.c	7 Jan 2005 15:14:36 -0000	1.2.4.3
--- d_delay.c	11 Jan 2005 21:41:14 -0000	1.2.4.4
***************
*** 136,140 ****
  		}
  	else
! 		copyvec_8(bp, in, n);
      c->c_phase = phase; 
      return (w+4);
--- 136,140 ----
  		}
  	else
! 		testcopyvec_8(bp, in, n);
      c->c_phase = phase; 
      return (w+4);
***************
*** 167,171 ****
  		}
  	else
! 		copyvec_simd(bp, in, n);
      c->c_phase = phase; 
      return (w+4);
--- 167,171 ----
  		}
  	else
! 		testcopyvec_simd(bp, in, n);
      c->c_phase = phase; 
      return (w+4);
***************
*** 220,223 ****
--- 220,224 ----
      t_float x_n;        /* vector size */
      int x_zerodel;      /* 0 or vecsize depending on read/write order */
+ 	void (*x_copy_fp)(t_float*, const t_float*, int); /* tb: copy function */
  } t_sigdelread;
  
***************
*** 251,257 ****
              x->x_delsamps = delwriter->x_cspace.c_n - DEFDELVS;
      }
! #ifdef DEL_SIMD	
! 	x->x_delsamps += (SIMD_BYTEALIGN - x->x_delsamps) % SIMD_BYTEALIGN;
! #endif
  }
  
--- 252,259 ----
              x->x_delsamps = delwriter->x_cspace.c_n - DEFDELVS;
      }
! 	if ( SIMD_CHKCNT(x->x_delsamps))
! 		x->x_copy_fp = copyvec_simd;
! 	else
! 		x->x_copy_fp = copyvec_simd_unalignedsrc;
  }
  
***************
*** 305,308 ****
--- 307,311 ----
      int delsamps = *(int *)(w[3]);
      int n = (int)(w[4]);
+ 	t_sigdelread * x = (t_sigdelread *)(w[5]);
      int phase = c->c_phase - delsamps, nsamps = c->c_n;
      float *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS);
***************
*** 318,324 ****
  	else
  	{
! 		copyvec_simd(out, bp, n);
  	}
!     return (w+5);
  }
  
--- 321,327 ----
  	else
  	{
! 		x->x_copy_fp(out, bp, n);
  	}
!     return (w+6);
  }
  
***************
*** 335,339 ****
              0 : delwriter->x_vecsize);
          sigdelread_float(x, x->x_deltime);
- #ifdef DEL_SIMD
  		if (sp[0]->s_n & 7)
  			dsp_add(sigdelread_perform, 4,
--- 338,341 ----
***************
*** 341,353 ****
  		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
- 		dsp_add(sigdelread_perform, 4,
- 				sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n);
- #endif
      }
      else if (*x->x_sym->s_name)
--- 343,351 ----
  		else
  			if (SIMD_CHECK1(sp[0]->s_n, sp[0]->s_vec))
! 				dsp_add(sigdelread_perfsimd, 5,
! 						sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n, x);
  			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)

Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.4.4.9
retrieving revision 1.4.4.10
diff -C2 -d -r1.4.4.9 -r1.4.4.10
*** d_soundfile.c	14 Dec 2004 09:29:54 -0000	1.4.4.9
--- d_soundfile.c	11 Jan 2005 21:41:14 -0000	1.4.4.10
***************
*** 1074,1078 ****
  
      soundfiler_queue->begin=soundfiler_queue->end=NULL;
!     pthread_mutex_unlock(&(soundfiler_queue->mutex)); 
      
      // initialize thread
--- 1074,1078 ----
  
      soundfiler_queue->begin=soundfiler_queue->end=NULL;
! /*     pthread_mutex_unlock(&(soundfiler_queue->mutex));  */
      
      // initialize thread
***************
*** 1383,1387 ****
  		w[3] = (t_int)(&resume_after_callback);
  		
! 		set_callback(&soundfiler_read_update_garray, w, 4);
  
  		pthread_cond_wait(&resume_after_callback, &resume_after_callback_mutex);
--- 1383,1387 ----
  		w[3] = (t_int)(&resume_after_callback);
  		
! 		sys_callback(&soundfiler_read_update_garray, w, 4);
  
  		pthread_cond_wait(&resume_after_callback, &resume_after_callback_mutex);
***************
*** 1400,1404 ****
  		w[0] = (t_int)(garrays[i]);
  		w[1] = (t_int)finalsize;
! 		set_callback(&soundfiler_read_update_graphics, w, 2);
  	}
  
--- 1400,1404 ----
  		w[0] = (t_int)(garrays[i]);
  		w[1] = (t_int)finalsize;
! 		sys_callback(&soundfiler_read_update_graphics, w, 2);
  	}
  
***************
*** 1426,1430 ****
  	outargs[0] = (t_int)x->x_obj.ob_outlet;
  	outargs[1] = (t_int)itemsread;
! 	set_callback(&soundfiler_read_output, outargs, 2);
  }
  
--- 1426,1430 ----
  	outargs[0] = (t_int)x->x_obj.ob_outlet;
  	outargs[1] = (t_int)itemsread;
! 	sys_callback(&soundfiler_read_output, outargs, 2);
  }
  

Index: m_pd.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_pd.h,v
retrieving revision 1.4.4.6
retrieving revision 1.4.4.7
diff -C2 -d -r1.4.4.6 -r1.4.4.7
*** m_pd.h	8 Jan 2005 19:43:52 -0000	1.4.4.6
--- m_pd.h	11 Jan 2005 21:41:14 -0000	1.4.4.7
***************
*** 669,672 ****
--- 669,677 ----
  EXTERN void testaddvec_simd(t_float *dst,const t_float *src,int n);
  EXTERN float sumvec_simd(t_float* in, t_int n);
+ EXTERN void copyvec_simd_unalignedsrc(t_float *dst,const t_float *src,int n);
+ 
+ /* general, non-simd functions */
+ EXTERN void copyvec(t_float *dst,const t_float *src,int n);
+ EXTERN void addvec(t_float *dst,const t_float *src,int n);
  
  EXTERN int simd_runtime_check(void);
***************
*** 768,771 ****
--- 773,783 ----
  #endif
  
+ 
+ /* tb: wrapper for PD_BIGORSMALL macro */
+ EXTERN void testcopyvec(t_float *dst,const t_float *src,int n);
+ EXTERN void testaddvec(t_float *dst,const t_float *src,int n);
+ 
+ 
+ 
  #if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
  }

Index: m_simd_sse_vc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_vc.c,v
retrieving revision 1.1.4.5
retrieving revision 1.1.4.6
diff -C2 -d -r1.1.4.5 -r1.1.4.6
*** m_simd_sse_vc.c	29 Nov 2004 18:11:38 -0000	1.1.4.5
--- m_simd_sse_vc.c	11 Jan 2005 21:41:14 -0000	1.1.4.6
***************
*** 149,152 ****
--- 149,153 ----
  }
  
+ 
  t_int *zero_perf_simd(t_int *w)
  {

Index: x_net.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/x_net.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
*** x_net.c	8 Nov 2004 17:54:02 -0000	1.2.4.1
--- x_net.c	11 Jan 2005 21:41:15 -0000	1.2.4.2
***************
*** 82,86 ****
          intarg = 1;
          if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,
!             (char *)&intarg, sizeof(intarg)) < 0)
                  post("setsockopt (TCP_NODELAY) failed\n");
      }
--- 82,86 ----
          intarg = 1;
          if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,
!             &intarg, sizeof(intarg)) < 0)
                  post("setsockopt (TCP_NODELAY) failed\n");
      }
***************
*** 274,278 ****
      intarg = 1;
      if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
!         (char *)&intarg, sizeof(intarg)) < 0)
              post("setsockopt (SO_REUSEADDR) failed\n");
  #endif
--- 274,278 ----
      intarg = 1;
      if (setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
!         &intarg, sizeof(intarg)) < 0)
              post("setsockopt (SO_REUSEADDR) failed\n");
  #endif
***************
*** 288,292 ****
          intarg = 1;
          if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,
!             (char *)&intarg, sizeof(intarg)) < 0)
                  post("setsockopt (TCP_NODELAY) failed\n");
      }
--- 288,292 ----
          intarg = 1;
          if (setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY,
!             &intarg, sizeof(intarg)) < 0)
                  post("setsockopt (TCP_NODELAY) failed\n");
      }

Index: m_simd_ve_gcc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_ve_gcc.c,v
retrieving revision 1.1.4.1
retrieving revision 1.1.4.2
diff -C2 -d -r1.1.4.1 -r1.1.4.2
*** m_simd_ve_gcc.c	5 Nov 2004 13:33:19 -0000	1.1.4.1
--- m_simd_ve_gcc.c	11 Jan 2005 21:41:14 -0000	1.1.4.2
***************
*** 110,113 ****
--- 110,114 ----
  }
  
+ 
  t_int *zero_perf_simd(t_int *w)
  {

Index: m_simd_sse_vc.h
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_vc.h,v
retrieving revision 1.1.4.5
retrieving revision 1.1.4.6
diff -C2 -d -r1.1.4.5 -r1.1.4.6
*** m_simd_sse_vc.h	8 Jan 2005 22:13:40 -0000	1.1.4.5
--- m_simd_sse_vc.h	11 Jan 2005 21:41:14 -0000	1.1.4.6
***************
*** 41,47 ****
  t_int *sigrsqrt_perf_simd(t_int *w);
  
! #define sum_vecsimd             sumvec_8
! #define env_tilde_accum_simd    env_tilde_accum
  #define sigwrap_perf_simd       sigwrap_perform  /* SIMD not implemented */
  
  
--- 41,49 ----
  t_int *sigrsqrt_perf_simd(t_int *w);
  
! #define sum_vecsimd             sumvec_8         /* SIMD not implemented */
! #define env_tilde_accum_simd    env_tilde_accum  /* SIMD not implemented */
! #define copyvec_simd_unalignedsrc copyvec_8      /* SIMD not implemented */
  #define sigwrap_perf_simd       sigwrap_perform  /* SIMD not implemented */
+ #define line_tilde_slope_simd   line_tilde_slope_simd /* SIMD not implemented */
  
  

Index: m_simd_sse_gcc.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/m_simd_sse_gcc.c,v
retrieving revision 1.1.4.9
retrieving revision 1.1.4.10
diff -C2 -d -r1.1.4.9 -r1.1.4.10
*** m_simd_sse_gcc.c	8 Jan 2005 22:13:40 -0000	1.1.4.9
--- m_simd_sse_gcc.c	11 Jan 2005 21:41:14 -0000	1.1.4.10
***************
*** 86,89 ****
--- 86,116 ----
  }
  
+ /* dst is assumed to be aligned */
+ void copyvec_simd_unalignedsrc(t_float *dst,const t_float *src,int n)
+ {
+     asm(
+ 		".set T_FLOAT,4                            \n" /* sizeof(t_float) */
+ 		"shr       $4, %0                          \n"
+ 		
+ 		/* loop: *dst = *src */
+ 		"1:                                        \n"
+ 		"movups    (%1), %%xmm0                    \n"
+ 		"movups    4*T_FLOAT(%1), %%xmm1           \n"
+ 		"movups    8*T_FLOAT(%1), %%xmm2           \n"
+ 		"movups    12*T_FLOAT(%1), %%xmm3          \n"
+ 		"movaps    %%xmm0, (%2)                    \n"
+ 		"movaps    %%xmm1, 4*T_FLOAT(%2)           \n"
+ 		"movaps    %%xmm2, 8*T_FLOAT(%2)           \n"
+ 		"movaps    %%xmm3, 12*T_FLOAT(%2)          \n"
+ 		
+ 		
+ 		"addl      $16*T_FLOAT,%1                  \n"
+ 		"addl      $16*T_FLOAT,%2                  \n"
+ 		"loop      1b                              \n"
+ 		:
+ 		:"c"(n),"r"(src),"r"(dst)
+ 		:"%xmm0","%xmm1","%xmm2","%xmm3");
+ }
+ 
  
  /* dst and src are assumed to be aligned */
***************
*** 123,170 ****
  }
  
! /* dst is assumed to be aligned */
! void testvec_simd(t_float *dst,t_float v,int n)
  {
!     asm(
! 		".set T_FLOAT,4                            \n" /* sizeof(t_float) */
! 		"shufps    $0,%2,%2                        \n" /* load value */
! 		"shr       $4,%0                           \n"
  		
- 		/* should we do more loop unrolling? */
- 		/* *dst = v */
  		"1:                                        \n"
! 		"movaps    %2, (%1)                        \n"
! 		"movaps    %2, 4*T_FLOAT(%1)               \n"
! 		"movaps    %2, 8*T_FLOAT(%1)               \n"
! 		"movaps    %2, 12*T_FLOAT(%1)              \n"
  		
  		"addl      $16*T_FLOAT,%1                  \n"
! 		"loop      1b                              \n"
  		:
! 		:"c"(n),"r"(dst),"x"((t_float)v)
! 		);
  }
  
  
- /*
-  * if we switch on DAZ, we shouldn't have problems with denormals 
-  * any more ... tb
-  */
- void testcopyvec_simd(t_float *dst,const t_float *src,int n)
- {
- #if 0 //def DAZ
- 	copyvec_simd(dst,src,n);
- #else
- 	testcopyvec_8(dst,src,n); /* SIMD not implemented */
- #endif
- }
- 
  void testaddvec_simd(t_float *dst,const t_float *src,int n)
  {
! #if 0 //DAZ
! 	addvec_simd(dst,src,n);
! #else
! 	testaddvec_8(dst,src,n); /* SIMD not implemented */
! #endif
  }
  
--- 150,302 ----
  }
  
! 
! void testcopyvec_simd(t_float *dst,const t_float *src,int n)
  {
! 	
! 	asm(
! 		".section	.rodata                        \n"
! 		".align 16                                 \n"
! 		"2:                                        \n"
! 		".long	1610612736                         \n" /* bitmask */
! 		".long	1610612736                         \n" /* 0x60000000 */
! 		".long	1610612736                         \n"
! 		".long	1610612736                         \n"
! 
! 		".set T_FLOAT,4                            \n"
! 		".text                                     \n"
! 		
! 		"shr       $4, %0                          \n"
! 		"movaps    (2b), %%xmm0                    \n" /* xmm0 = bitmask */
! 		"xorps     %%xmm1, %%xmm1                  \n" /* xmm1 = 0x0     */
! 
  		
  		"1:                                        \n"
! 		"movaps    (%1), %%xmm2                    \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"movaps    %%xmm2, (%2)                    \n"
! 
! 		"movaps    4*T_FLOAT(%1), %%xmm2           \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"movaps    %%xmm2, 4*T_FLOAT(%2)           \n"
! 
! 		"movaps    8*T_FLOAT(%1), %%xmm2           \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"movaps    %%xmm2, 8*T_FLOAT(%2)           \n"
! 
! 		"movaps    12*T_FLOAT(%1), %%xmm2          \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"movaps    %%xmm2, 12*T_FLOAT(%2)          \n"
! 		
  		
  		"addl      $16*T_FLOAT,%1                  \n"
! 		"addl      $16*T_FLOAT,%2                  \n"
! 		"decl      %0                              \n"
! 		"jne       1b                              \n"
  		:
! 		:"c"(n),"r"(src),"r"(dst)
! 		:"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4");
  }
  
  
  void testaddvec_simd(t_float *dst,const t_float *src,int n)
  {
! 	asm(
! 		".section	.rodata                        \n"
! 		".align 16                                 \n"
! 		"2:                                        \n"
! 		".long	1610612736                         \n" /* bitmask */
! 		".long	1610612736                         \n" /* 0x60000000 */
! 		".long	1610612736                         \n"
! 		".long	1610612736                         \n"
! 
! 		".set T_FLOAT,4                            \n"
! 		".text                                     \n"
! 		
! 		"shr       $4, %0                          \n"
! 		"movaps    (2b), %%xmm0                    \n" /* xmm0 = bitmask */
! 		"xorps     %%xmm1, %%xmm1                  \n" /* xmm1 = 0x0     */
! 
! 		
! 		"1:                                        \n"
! 		"movaps    (%1), %%xmm2                    \n"
! 		"movaps    (%2), %%xmm5                    \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"addps     %%xmm2, %%xmm5                  \n"
! 		"movaps    %%xmm5, (%2)                    \n"
! 
! 		"movaps    4*T_FLOAT(%1), %%xmm2           \n"
! 		"movaps    4*T_FLOAT(%2), %%xmm5           \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"addps     %%xmm2, %%xmm5                  \n"
! 		"movaps    %%xmm5, 4*T_FLOAT(%2)           \n"
! 
! 		"movaps    8*T_FLOAT(%1), %%xmm2           \n"
! 		"movaps    8*T_FLOAT(%2), %%xmm5           \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"addps     %%xmm2, %%xmm5                  \n"
! 		"movaps    %%xmm5, 8*T_FLOAT(%2)           \n"
! 
! 		"movaps    12*T_FLOAT(%1), %%xmm2          \n"
! 		"movaps    12*T_FLOAT(%2), %%xmm5          \n"
! 		"movaps    %%xmm2, %%xmm3                  \n"
! 		"andps     %%xmm0, %%xmm3                  \n"
! 		"movaps    %%xmm3, %%xmm4                  \n"
! 		"cmpneqps  %%xmm0, %%xmm3                  \n"
! 		"cmpneqps  %%xmm1, %%xmm4                  \n"
! 		"andps     %%xmm4, %%xmm3                  \n"
! 		"andps     %%xmm3, %%xmm2                  \n"
! 		"addps     %%xmm2, %%xmm5                  \n"
! 		"movaps    %%xmm5, 12*T_FLOAT(%2)          \n"
! 		
! 		
! 		"addl      $16*T_FLOAT,%1                  \n"
! 		"addl      $16*T_FLOAT,%2                  \n"
! 		"decl      %0                              \n"
! 		"jne       1b                              \n"
! 		:
! 		:"c"(n),"r"(src),"r"(dst)
! 		:"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5");
  }
  
***************
*** 234,238 ****
  	".set T_FLOAT,4                            \n"
  	
!         "shufps    $0, %1, %1                      \n"
  	"shrl      $4, %3                          \n" /* divide by 16 */
  
--- 366,370 ----
  	".set T_FLOAT,4                            \n"
  	
! 	"shufps    $0, %1, %1                      \n"
  	"shrl      $4, %3                          \n" /* divide by 16 */
  
***************
*** 908,912 ****
  		"loop      1b                              \n"
  
! 		"movhlps   %%xmm2, %%xmm3                  \n"
  		"movups    %%xmm2, %%xmm4                  \n"
  		"movups    %%xmm3, %0                      \n"
--- 1040,1044 ----
  		"loop      1b                              \n"
  
! 		"movhlps   %%xmm2, %%xmm3                  \n" /* unpack xmm0 */
  		"movups    %%xmm2, %%xmm4                  \n"
  		"movups    %%xmm3, %0                      \n"
***************
*** 926,929 ****
--- 1058,1157 ----
  
  
+ float peakvec_simd(t_float* vec, t_int n, t_float cur_max)
+ {
+     asm(
+ 		".section	.rodata                        \n"
+ 		".align 16                                 \n"
+ 		"2:                                        \n"
+ 		".long	2147483647                         \n" /* bitmask for abs */
+ 		".long	2147483647                         \n" /* 0x7fffffff */
+ 		".long	2147483647                         \n"
+ 		".long	2147483647                         \n"
+ 
+ 		".set T_FLOAT,4                            \n"
+ 		".text                                     \n"
+ 
+ 		"shrl      $4, %2                          \n" /* divide by 16 */
+ 		"movaps    (2b), %%xmm0                    \n"
+ 		"shufps    $0, %0, %0                      \n"
+ 
+ 		"1:                                        \n"
+ 		"movaps    (%1), %%xmm1                    \n"
+ 		"andps     %%xmm0, %%xmm1                  \n"
+ 		"maxps     %%xmm1, %0                      \n"
+ 
+ 		"movaps    4*T_FLOAT(%1), %%xmm1           \n"
+ 		"andps     %%xmm0, %%xmm1                  \n"
+ 		"maxps     %%xmm1, %0                      \n"
+ 
+ 		"movaps    8*T_FLOAT(%1), %%xmm1           \n"
+ 		"andps     %%xmm0, %%xmm1                  \n"
+ 		"maxps     %%xmm1, %0                      \n"
+ 
+ 		"movaps    12*T_FLOAT(%1), %%xmm1          \n"
+ 		"andps     %%xmm0, %%xmm1                  \n"
+ 		"maxps     %%xmm1, %0                      \n"
+ 
+ 		"addl      $16*T_FLOAT, %1                 \n"
+ 		"loop      1b                              \n"
+ 		
+ 		"movhlps   %0, %%xmm2                      \n"
+ 		"movaps    %0, %%xmm3                      \n"
+ 		"movaps    %%xmm2, %%xmm4                  \n"
+ 		"shufps    $81, %%xmm3, %%xmm3             \n"
+ 		"shufps    $81, %%xmm4,  %%xmm4            \n"
+ 
+ 		"maxss     %%xmm2, %%xmm3                  \n"
+ 		"maxss     %%xmm3, %%xmm4                  \n"
+ 		"maxss     %%xmm4, %0                      \n"
+ 
+ 		:"=x"(cur_max)
+ 		:"r"(vec),"c"(n), "0"(cur_max)
+ 		:"%xmm0","%xmm1","%xmm2","%xmm3", "%xmm4", "%xmm5");
+ 
+ 	return cur_max;
+ }
+ 
+ void line_tilde_slope_simd(t_float* out, t_int n, t_float* value,
+ 						   t_float* slopes, t_float* slopestep)
+ {
+ 	asm(
+ 		".set T_FLOAT,4                          \n"
+ 		"movss     (%2),%%xmm0                   \n" /* value */
+ 		"shufps    $0, %%xmm0, %%xmm0            \n"
+ 		"movaps    (%3), %%xmm1                  \n" /* slopes */
+ 
+ 		"addps     %%xmm1, %%xmm0                \n" /* compute first output */
+ 		
+ 		"movss     (%4), %%xmm2                  \n" /* slopestep */
+ 		"shufps    $0, %%xmm2, %%xmm2            \n" 
+ 
+ 		"shrl      $4, %1                        \n" /* n>>4 */
+ 
+ 		"1:                                      \n"
+ 		"movaps    %%xmm0, (%0)                  \n"
+ 		"addps     %%xmm2, %%xmm0                \n"
+ 
+ 		"movaps    %%xmm0, 4*T_FLOAT(%0)         \n"
+ 		"addps     %%xmm2, %%xmm0                \n"
+ 
+ 		"movaps    %%xmm0, 8*T_FLOAT(%0)         \n"
+ 		"addps     %%xmm2, %%xmm0                \n"
+ 
+ 		"movaps    %%xmm0, 12*T_FLOAT(%0)        \n"
+ 		"addps     %%xmm2, %%xmm0                \n"
+ 
+ 
+ 		"addl      $16*T_FLOAT, %0               \n"
+ 		"loop      1b                            \n"
+ 
+ 
+ 		:
+ 		:"r"(out),"c"(n), "r"(value), "r"(slopes),
+ 		"r"(slopestep)
+ 		:"%xmm0", "%xmm1", "%xmm2");
+ 
+ }
+ 
  #endif
  

Index: s_audio.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/s_audio.c,v
retrieving revision 1.5.4.5
retrieving revision 1.5.4.6
diff -C2 -d -r1.5.4.5 -r1.5.4.6
*** s_audio.c	27 Dec 2004 16:02:33 -0000	1.5.4.5
--- s_audio.c	11 Jan 2005 21:41:14 -0000	1.5.4.6
***************
*** 9,12 ****
--- 9,13 ----
  #include "m_pd.h"
  #include "s_stuff.h"
+ #include "m_simd.h"
  #include <stdio.h>
  #ifdef UNISTD
***************
*** 67,70 ****
--- 68,77 ----
  extern int sys_callbackscheduler;
  
+ float peakvec_simd(t_float* vec, t_int n, t_float cur_max);
+ float peakvec(t_float* vec, t_int n, t_float cur_max);
+ 
+ static float (*peak_fp)(t_float*, t_int, t_float) = peakvec;
+ 
+ 
  static int audio_isopen(void)
  {
***************
*** 165,168 ****
--- 172,182 ----
      memset(sys_soundout, 0, outbytes);
  
+ 	/* tb: modification for simd-optimized peak finding */
+ 	if (SIMD_CHKCNT(sys_inchannels * sys_dacblocksize) &&
+ 		SIMD_CHKCNT(sys_outchannels * sys_dacblocksize))
+ 		peak_fp = peakvec_simd;
+ 	else
+ 		peak_fp = peakvec;
+ 
      if (sys_verbose)
          post("input channels = %d, output channels = %d",
***************
*** 448,469 ****
      if (sys_meters)
      {
!         int i, n;
!         float maxsamp;
!         for (i = 0, n = sys_inchannels * sys_dacblocksize, maxsamp = sys_inmax;
!             i < n; i++)
!         {
!             float f = sys_soundin[i];
!             if (f > maxsamp) maxsamp = f;
!             else if (-f > maxsamp) maxsamp = -f;
!         }
!         sys_inmax = maxsamp;
!         for (i = 0, n = sys_outchannels * sys_dacblocksize, maxsamp = sys_outmax;
!             i < n; i++)
!         {
!             float f = sys_soundout[i];
!             if (f > maxsamp) maxsamp = f;
!             else if (-f > maxsamp) maxsamp = -f;
!         }
!         sys_outmax = maxsamp;
      }
  
--- 462,469 ----
      if (sys_meters)
      {
!         sys_inmax = peak_fp(sys_soundin,sys_inchannels * sys_dacblocksize, 
! 							sys_inmax);
!         sys_outmax = peak_fp(sys_soundout,sys_outchannels * sys_dacblocksize, 
! 							 sys_outmax);
      }
  

Index: d_global.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_global.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_global.c	5 Nov 2004 13:55:58 -0000	1.2.4.1
--- d_global.c	11 Jan 2005 21:41:14 -0000	1.2.4.2
***************
*** 37,49 ****
  static t_int *sigsend_perform(t_int *w)
  {
!     t_float *in = (t_float *)(w[1]);
!     t_float *out = (t_float *)(w[2]);
!     int n = (int)(w[3]);
!     while (n--)
!     {
!         *out = (PD_BIGORSMALL(*in) ? 0 : *in);
!         out++;
!         in++;
!     }
      return (w+4);
  }
--- 37,42 ----
  static t_int *sigsend_perform(t_int *w)
  {
!     testcopyvec((t_float *)w[2],(t_float *)w[1],w[3]);
! 
      return (w+4);
  }
***************
*** 306,321 ****
  {
      t_sigthrow *x = (t_sigthrow *)(w[1]);
-     t_float *in = (t_float *)(w[2]);
-     int n = (int)(w[3]);
      t_float *out = x->x_whereto;
!     if (out)
!     {
!         while (n--)
!         {
!             *out += (PD_BIGORSMALL(*in) ? 0 : *in);
!             out++;
!             in++;
!         }
!     }
      return (w+4);
  }
--- 299,305 ----
  {
      t_sigthrow *x = (t_sigthrow *)(w[1]);
      t_float *out = x->x_whereto;
!     if(out) testaddvec(out,(t_float *)w[2],w[3]);
! 
      return (w+4);
  }

Index: d_array.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_array.c,v
retrieving revision 1.3.4.2
retrieving revision 1.3.4.3
diff -C2 -d -r1.3.4.2 -r1.3.4.3
*** d_array.c	11 Nov 2004 22:30:41 -0000	1.3.4.2
--- d_array.c	11 Jan 2005 21:41:14 -0000	1.3.4.3
***************
*** 56,66 ****
          if (nxfer > n) nxfer = n;
          phase += nxfer;
!         while (nxfer--)
          {
!             float f = *in++;
!             if (PD_BIGORSMALL(f))
!                 f = 0;
!             *fp++ = f;
          }
          if (phase >= endphase)
          {
--- 56,92 ----
          if (nxfer > n) nxfer = n;
          phase += nxfer;
! 
! 		testcopyvec(fp, in, nxfer);
!         if (phase >= endphase)
          {
!             tabwrite_tilde_redraw(x);
!             phase = 0x7fffffff;
          }
+         x->x_phase = phase;
+     }
+     else x->x_phase = 0x7fffffff;
+ bad:
+     return (w+4);
+ }
+ 
+ 
+ static t_int *tabwrite_tilde_perf_simd(t_int *w)
+ {
+     t_tabwrite_tilde *x = (t_tabwrite_tilde *)(w[1]);
+     t_float *in = (t_float *)(w[2]);
+     int n = (int)(w[3]), phase = x->x_phase, endphase = x->x_nsampsintab;
+     if (!x->x_vec) goto bad;
+     
+     if (endphase > phase)
+     {
+         int nxfer = endphase - phase;
+         float *fp = x->x_vec + phase;
+         if (nxfer > n) nxfer = n;
+         phase += nxfer;
+ 		
+ 		if (SIMD_CHKCNT(nxfer))
+ 			testcopyvec_simd(fp, in, nxfer);
+ 		else
+ 			testcopyvec(fp, in, nxfer);
          if (phase >= endphase)
          {
***************
*** 75,78 ****
--- 101,105 ----
  }
  
+ 
  void tabwrite_tilde_set(t_tabwrite_tilde *x, t_symbol *s)
  {
***************
*** 97,101 ****
  {
      tabwrite_tilde_set(x, x->x_arrayname);
!     dsp_add(tabwrite_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
  }
  
--- 124,131 ----
  {
      tabwrite_tilde_set(x, x->x_arrayname);
! 	if (SIMD_CHECK1(sp[0]->s_n, sp[0]->s_vec))
! 		dsp_add(tabwrite_tilde_perf_simd, 3, x, sp[0]->s_vec, sp[0]->s_n);
! 	else
! 		dsp_add(tabwrite_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
  }
  
***************
*** 732,747 ****
      if (!x->x_vec) goto bad;
  
!     if(n&7)
!     while (n--)
!     {   
!         float f = *in++;
!         if (PD_BIGORSMALL(f))
!             f = 0;
!          *dest++ = f;
      }
!     else if(SIMD_CHECK2(n,in,dest))
!         testcopyvec_simd(dest,in,n);
!     else
!         testcopyvec_8(dest,in,n);
  
      if (!i--)
--- 762,791 ----
      if (!x->x_vec) goto bad;
  
! 	testcopyvec(dest,in,n);
! 
!     if (!i--)
!     {
!         t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class);
!         if (!a)
!             bug("tabsend_dsp");
!         else garray_redraw(a);
!         i = x->x_graphperiod;
      }
!     x->x_graphcount = i;
! bad:
!     return (w+4);
! }
! 
! 
! static t_int *tabsend_perf_simd(t_int *w)
! {
!     t_tabsend *x = (t_tabsend *)(w[1]);
!     t_float *in = (t_float *)(w[2]);
!     int n = w[3];
!     t_float *dest = x->x_vec;
!     int i = x->x_graphcount;
!     if (!x->x_vec) goto bad;
! 
! 	testcopyvec_simd(dest,in,n);
  
      if (!i--)
***************
*** 758,761 ****
--- 802,806 ----
  }
  
+ 
  static void tabsend_dsp(t_tabsend *x, t_signal **sp)
  {
***************
*** 779,783 ****
          if (n < vecsize) vecsize = n;
          garray_usedindsp(a);
!         dsp_add(tabsend_perform, 3, x, sp[0]->s_vec, vecsize);
      }
  }
--- 824,831 ----
          if (n < vecsize) vecsize = n;
          garray_usedindsp(a);
! 		if(SIMD_CHECK1(vecsize,sp[0]->s_vec))
! 			dsp_add(tabsend_perf_simd, 3, x, sp[0]->s_vec, vecsize);
! 		else
! 			dsp_add(tabsend_perform, 3, x, sp[0]->s_vec, vecsize);
      }
  }

Index: m_sched.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/m_sched.c,v
retrieving revision 1.5.4.12
retrieving revision 1.5.4.13
diff -C2 -d -r1.5.4.12 -r1.5.4.13
*** m_sched.c	2 Dec 2004 16:40:24 -0000	1.5.4.12
--- m_sched.c	11 Jan 2005 21:41:14 -0000	1.5.4.13
***************
*** 633,637 ****
  static t_sched_callback * idle_callback = NULL;
  
! void set_callback(t_int (*callback) (t_int* argv), t_int* argv, t_int argc)
  {
  	t_sched_callback* new = (t_sched_callback*) getbytes
--- 633,637 ----
  static t_sched_callback * idle_callback = NULL;
  
! void sys_callback(t_int (*callback) (t_int* argv), t_int* argv, t_int argc)
  {
  	t_sched_callback* new = (t_sched_callback*) getbytes





More information about the Pd-cvs mailing list