summaryrefslogtreecommitdiff
path: root/audio/libconvolve/files/patch-convolution__init.c
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2016-07-26 16:51:15 +0000
committerMathieu Arnold <mat@FreeBSD.org>2016-07-26 16:51:15 +0000
commit9fa9eb9ac7bf1d3de825ee25a8f0ae81b7b77896 (patch)
tree9b071a8105704e992946dcd6b801e9fcb7635142 /audio/libconvolve/files/patch-convolution__init.c
parentMooseFS is a Fault tolerant, High Available, Highly Performing, Scale-Out, (diff)
Cleanup patches, a* categories.
Rename them to follow the make makepatch naming, and regenerate them. With hat: portmgr Sponsored by: Absolight
Notes
Notes: svn path=/head/; revision=419133
Diffstat (limited to 'audio/libconvolve/files/patch-convolution__init.c')
-rw-r--r--audio/libconvolve/files/patch-convolution__init.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/audio/libconvolve/files/patch-convolution__init.c b/audio/libconvolve/files/patch-convolution__init.c
new file mode 100644
index 000000000000..7fca9b6f5c4d
--- /dev/null
+++ b/audio/libconvolve/files/patch-convolution__init.c
@@ -0,0 +1,74 @@
+--- convolution_init.c.orig 2005-11-27 23:24:57 UTC
++++ convolution_init.c
+@@ -17,8 +17,19 @@
+ */
+
+ #include "convolve.h"
+-#include <malloc.h>
++#include <stdlib.h>
+ #include <math.h>
++#include <errno.h>
++
++int my_posix_memalign(void **memptr, size_t alignment, size_t size)
++{
++ *memptr = malloc(size);
++
++ if (*memptr != NULL)
++ return 0;
++ else
++ return errno;
++}
+
+ int convolution_init (convolution_t *conv,
+ int number_of_responses,
+@@ -47,12 +58,12 @@ int convolution_init (convolution_t *con
+ // allocate FFT buffers
+ // as r2c stores only N/2+1 results, we don't need the padded size for this
+ // conv->fft_complex = (fftwf_complex*)malloc (sizeof(fftwf_complex) * (conv->chunk_length + 1));
+- posix_memalign(&conv->fft_complex, 16, sizeof(fftwf_complex) * (conv->chunk_length + 1));
++ my_posix_memalign(&conv->fft_complex, 16, sizeof(fftwf_complex) * (conv->chunk_length + 1));
+
+
+ // this one still needs to be 2 * chunk_length as we zero pad it
+ // conv->fft_real = (float*)malloc (sizeof(float) * 2 * conv->chunk_length);
+- posix_memalign(&conv->fft_real, 16, sizeof(float) * 2 * conv->chunk_length);
++ my_posix_memalign(&conv->fft_real, 16, sizeof(float) * 2 * conv->chunk_length);
+
+ // create fftw plans
+ conv->fft_plan_forward = fftwf_plan_dft_r2c_1d (2 * conv->chunk_length,
+@@ -100,7 +111,7 @@ int convolution_init (convolution_t *con
+ * (conv->chunk_length + 1)
+ * conv->fft_responses[index]->number_of_chunks);
+ */
+- posix_memalign(&conv->fft_responses[index]->channel_data[index2],
++ my_posix_memalign(&conv->fft_responses[index]->channel_data[index2],
+ 16,
+ sizeof(fftwf_complex)
+ * (conv->chunk_length + 1)
+@@ -169,7 +180,7 @@ int convolution_init (convolution_t *con
+
+ // need to divide (integer divide) the index by number_of_responses to get
+ // a valid index into the list of responses.
+- posix_memalign(&conv->input_chunk_ringbuffers[index], 16,
++ my_posix_memalign(&conv->input_chunk_ringbuffers[index], 16,
+ sizeof(fftwf_complex) * conv->fft_responses[index/conv->number_of_response_channels]->number_of_chunks
+ * (conv->chunk_length + 1));
+
+@@ -189,7 +200,7 @@ int convolution_init (convolution_t *con
+ = (fftwf_complex*)malloc (sizeof(fftwf_complex) * conv->fft_responses[index]->number_of_chunks
+ * (conv->chunk_length + 1));
+ */
+- posix_memalign(&conv->input_chunk_ringbuffers[index], 16,
++ my_posix_memalign(&conv->input_chunk_ringbuffers[index], 16,
+ sizeof(fftwf_complex) * conv->fft_responses[index]->number_of_chunks
+ * (conv->chunk_length + 1));
+
+@@ -222,7 +233,7 @@ int convolution_init (convolution_t *con
+ for (index = 0; index < conv->number_of_response_channels; ++index) {
+
+ // conv->overlap_buffers[index] = (float*)malloc (sizeof(float) * conv->chunk_length);
+- posix_memalign(&conv->overlap_buffers[index], 16, sizeof(float) * conv->chunk_length);
++ my_posix_memalign(&conv->overlap_buffers[index], 16, sizeof(float) * conv->chunk_length);
+
+ // zero out
+ for (index2 = 0; index2 < conv->chunk_length; ++index2) {