[PD-cvs] SF.net SVN: pure-data:[10320] trunk/externals/bsaylor/partconv~.c

zmoelnig at users.sourceforge.net zmoelnig at users.sourceforge.net
Wed Oct 1 09:09:08 CEST 2008


Revision: 10320
          http://pure-data.svn.sourceforge.net/pure-data/?rev=10320&view=rev
Author:   zmoelnig
Date:     2008-10-01 07:09:07 +0000 (Wed, 01 Oct 2008)

Log Message:
-----------
reverted my change with the ifdefs

Modified Paths:
--------------
    trunk/externals/bsaylor/partconv~.c

Modified: trunk/externals/bsaylor/partconv~.c
===================================================================
--- trunk/externals/bsaylor/partconv~.c	2008-09-30 21:44:35 UTC (rev 10319)
+++ trunk/externals/bsaylor/partconv~.c	2008-10-01 07:09:07 UTC (rev 10320)
@@ -31,13 +31,11 @@
 
 #include <math.h>
 #include <string.h>
-#ifdef HAVE_FFTW3_H
-# include <fftw3.h>
-#endif /* FFTW3 */
+#include <fftw3.h>
 #include "m_pd.h"
 
 #ifdef __VEC__
-# include <altivec.h>
+#include <altivec.h>
 #endif
 
 #define MAXPARTS 256	// max number of partitions
@@ -50,11 +48,9 @@
 
 struct sumbuffer {
 	int index;
-#ifdef HAVE_FFTW3_H
 	fftwf_complex *fd;
 	float *td;
 	fftwf_plan plan;
-#endif /* FFTW3 */
 	int readpos;
 	struct sumbuffer *next, *prev;
 };
@@ -71,7 +67,6 @@
 	int ir_prepared;
 	int pd_blocksize;
 
-#ifdef HAVE_FFTW3_H
 	// partitions of impulse response
 	fftwf_plan irpart_plan;
 	float *irpart_td[MAXPARTS];
@@ -83,9 +78,7 @@
 	int inbufpos;
 	float *input_td;
 	fftwf_complex *input_fd;
-#endif /* FFTW3 */
 
-
 	// circular array/list of buffers for accumulating results of convolution
 	struct sumbuffer sumbufs[MAXPARTS+2];
 	int nsumbufs;  // number of sumbufs
@@ -134,7 +127,6 @@
 	t_float *in = (t_float *)(w[2]);
 	t_float *out = (t_float *)(w[3]);
 	int n = (int)(w[4]);
-#ifdef HAVE_FFTW3_H
 	int i;
 	int j;
 	int k;	// bin
@@ -148,7 +140,7 @@
 	v4sf *cursumbuf_fd;
 	v4sf *input_fd;
 	v4sf *irpart_fd;
-#elif defined HAVE_FFTW3_H
+#else
 	fftwf_complex *cursumbuf_fd;
 	fftwf_complex *input_fd;
 	fftwf_complex *irpart_fd;
@@ -173,7 +165,9 @@
 		x->curpart = 0;
 		memcpy(x->input_td, x->inbuf, x->partsize * sizeof(float));  // copy 'gathering' input buffer into 'transform' buffer
 		memset(&(x->input_td[x->partsize]), 0, (x->paddedsize - x->partsize) * sizeof(float));  // pad
+
 		fftwf_execute(x->input_plan);  // transform the input
+
 		// everything has been read out of prev sumbuf, so clear it
 		memset(x->sumbuf->prev->td, 0,  x->paddedsize * sizeof(float));
 
@@ -190,7 +184,7 @@
 	for (p = x->curpart; p < endpart; p++) {
 		// multiply the input block by the partition, accumulating the result in the appropriate sumbuf
 #ifdef USE_SSE
-# include "sse-conv.inc.c"
+#include "sse-conv.inc.c"
 #else
 		cursumbuf_fd = x->sumbufs[(x->sumbuf->index + p) % x->nsumbufs].fd;
 		input_fd = x->input_fd;
@@ -232,10 +226,6 @@
 	x->sumbuf->prev->readpos += n;
 
 	x->curcall++;
-#else /* !FFTW3 */
-  while(n-->0)
-    *out++=*in++;
-#endif
 
 	return (w+5);
 }
@@ -244,8 +234,8 @@
 
 static void partconv_free(t_partconv *x)
 {
-#ifdef HAVE_FFTW3_H
 	int i;
+
 	fftwf_free(x->inbuf);
 	for (i = 0; i < x->nparts; i++)
 		fftwf_free(x->irpart_td[i]);
@@ -255,7 +245,6 @@
 		fftwf_free(x->sumbufs[i].fd);
 		fftwf_destroy_plan(x->sumbufs[i].plan);
 	}
-#endif /* FFTW3 */
 }
 
 static void partconv_set(t_partconv *x, t_symbol *s)
@@ -278,7 +267,7 @@
 		pd_error(x, "%s: bad template", x->arrayname->s_name);
 		return;
 	}
-#ifdef HAVE_FFTW3_H
+
 	// if the IR has already been prepared, free everything first
 	if (x->ir_prepared == 1) {
 		partconv_free(x);
@@ -339,7 +328,6 @@
 
 	post("partconv~: using %s in %d partitions with FFT-size %d", x->arrayname->s_name, x->nparts, x->fftsize);
 	x->ir_prepared = 1;
-#endif /* FFTW3 */
 }
 
 static void partconv_dsp(t_partconv *x, t_signal **sp)
@@ -359,7 +347,7 @@
 	outlet_new(&x->x_obj, gensym("signal"));
 
 	if (argc != 2) {
-    //		post("argc = %d", argc);
+		post("argc = %d", argc);
 		error("partconv~: usage: [partconv~ <arrayname> <partsize>]\n\t- partition size must be a power of 2 >= blocksize");
 		return NULL;
 	}
@@ -385,11 +373,6 @@
 	x->ir_prepared = 0;
 	x->pd_blocksize = sys_getblksize();
 
-#ifndef HAVE_FFTW3_H
-  pd_error(x, "partconv~: compiled without FFTW3 support! this is a dummy!");
-#endif
-
-
 	return (x);
 }
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Pd-cvs mailing list