~ubuntu-branches/debian/sid/x42-plugins/sid

« back to all changes in this revision

Viewing changes to meters.lv2/gui/fft.c

  • Committer: Package Import Robot
  • Author(s): Jaromír Mikeš
  • Date: 2015-03-23 18:26:21 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20150323182621-bxlw3w09u72u4ned
Tags: 20141101-1
* Imported Upstream version 20141101
* Bump Standards.
* Patch refreshed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
#include <stdio.h>
20
20
#include <sys/types.h>
 
21
#include <pthread.h>
21
22
#include <fftw3.h>
22
23
 
23
24
#ifndef MIN
24
25
#define MIN(A,B) ( (A) < (B) ? (A) : (B) )
25
26
#endif
26
27
 
 
28
static pthread_mutex_t fftw_planner_lock = PTHREAD_MUTEX_INITIALIZER;
 
29
 
27
30
/******************************************************************************
28
31
 * internal FFT abstraction
29
32
 */
137
140
 
138
141
        fftx_reset(ft);
139
142
 
 
143
        pthread_mutex_lock(&fftw_planner_lock);
140
144
        ft->fftplan = fftwf_plan_r2r_1d(window_size, ft->fft_in, ft->fft_out, FFTW_R2HC, FFTW_MEASURE);
 
145
        pthread_mutex_unlock(&fftw_planner_lock);
141
146
}
142
147
 
143
148
FFTX_FN_PREFIX
144
149
void fftx_free(struct FFTAnalysis *ft) {
145
150
        if (!ft) return;
 
151
        pthread_mutex_lock(&fftw_planner_lock);
146
152
        fftwf_destroy_plan(ft->fftplan);
 
153
        pthread_mutex_unlock(&fftw_planner_lock);
147
154
        free(ft->hann_window);
148
155
        free(ft->ringbuf);
149
 
        free(ft->fft_in);
150
 
        free(ft->fft_out);
 
156
        fftwf_free(ft->fft_in);
 
157
        fftwf_free(ft->fft_out);
151
158
        free(ft->power);
152
159
        free(ft->phase);
153
160
        free(ft->phase_h);