Пример #1
0
MyConvolver::~MyConvolver()
{
    if (_ffts_fwd_plan)
        ffts_free(_ffts_fwd_plan);
    
    if (_ffts_inv_plan)
        ffts_free(_ffts_inv_plan);
    
}
Пример #2
0
Файл: test.c Проект: RTsGIT/ffts
int 
test_transform(int n, int sign) {

#ifdef HAVE_SSE 
	float __attribute__ ((aligned(32))) *input = _mm_malloc(2 * n * sizeof(float), 32);
  float __attribute__ ((aligned(32))) *output = _mm_malloc(2 * n * sizeof(float), 32);
#else
	float __attribute__ ((aligned(32))) *input = valloc(2 * n * sizeof(float));
  float __attribute__ ((aligned(32))) *output = valloc(2 * n * sizeof(float));
#endif
	int i;	
	for(i=0;i<n;i++) {
		input[2*i]   = 0.0f;
		input[2*i+1] = 0.0f;
	}

	input[2] = 1.0f;

	ffts_plan_t *p = ffts_init_1d(i, sign);
	if(p) {
		ffts_execute(p, input, output);
		printf(" %3d  | %9d | %10E\n", sign, n, impulse_error(n, sign, output));
  	ffts_free(p);
	}else{
		printf("Plan unsupported\n");
		return 0;
	}

	return 1;
}
Пример #3
0
Файл: test.c Проект: RTsGIT/ffts
int
main(int argc, char *argv[]) {
	
	if(argc == 3) {
		// test specific transform with test pattern and display output
		int n = atoi(argv[1]);
		int sign = atoi(argv[2]);

#ifdef HAVE_SSE
		float __attribute__ ((aligned(32))) *input = _mm_malloc(2 * n * sizeof(float), 32);
		float __attribute__ ((aligned(32))) *output = _mm_malloc(2 * n * sizeof(float), 32);
#else
		float __attribute__ ((aligned(32))) *input = valloc(2 * n * sizeof(float));
		float __attribute__ ((aligned(32))) *output = valloc(2 * n * sizeof(float));
#endif
		int i;	
		for(i=0;i<n;i++) {
			input[2*i]   = i;
			input[2*i+1] = 0.0f;
		}

	//	input[2] = 1.0f;

		ffts_plan_t *p = ffts_init_1d(i, sign);
		if(p) {
			ffts_execute(p, input, output);
			for(i=0;i<n;i++) printf("%d %d %f %f\n", i, sign, output[2*i], output[2*i+1]);
			ffts_free(p);
		}else{
			printf("Plan unsupported\n");
			return 0;
		}

#ifdef HAVE_NEON 
		_mm_free(input);
		_mm_free(output);
#else
		free(input);
		free(output);
#endif

	}else{
Пример #4
0
void ffts_free_nd_real(ffts_plan_t *p) {

	int i;
	for(i=0;i<p->rank;i++) {
		
		ffts_plan_t *x = p->plans[i];

		int k;
		for(k=i+1;k<p->rank;k++) {
			if(x == p->plans[k]) p->plans[k] = NULL;
		}
		
		if(x)	ffts_free(x);
	}

	free(p->Ns);
	free(p->Ms);
	free(p->plans);
	free(p->buf);
	free(p->transpose_buf);
	free(p);
}
Пример #5
0
FFTSEngine::~FFTSEngine()
{
	ffts_free(m_currentplan);
	free(m_imem);
	free(m_omem);
}
Пример #6
0
void FFTSEngine::configure(int n, bool inverse)
{
	ffts_free(m_currentplan);
	m_currentplan = ffts_init_1d(n, inverse ? 1 : -1);
}