Mercurial > hg > peckfft
comparison peck_fft.c @ 12:655dc5c14169
backup
author | Peter Meerwald <p.meerwald@bct-electronic.com> |
---|---|
date | Thu, 22 Sep 2011 16:58:25 +0200 |
parents | abdcde012978 |
children |
comparison
equal
deleted
inserted
replaced
11:abdcde012978 | 12:655dc5c14169 |
---|---|
294 kf_bfly2(Fout, fstride, st, m); | 294 kf_bfly2(Fout, fstride, st, m); |
295 break; | 295 break; |
296 case 3: kf_bfly3(Fout, fstride, st, m); break; | 296 case 3: kf_bfly3(Fout, fstride, st, m); break; |
297 case 4: | 297 case 4: |
298 { | 298 { |
299 static unsigned counter = 0; | 299 //static unsigned counter = 0; |
300 armv7_cycles_start(); | 300 // armv7_cycles_start(); |
301 unsigned int t1 = armv7_cycles_read(); | 301 // unsigned int t1 = armv7_cycles_read(); |
302 //printf("%08x %d %d\n", Fout, fstride, m); | |
302 kf_bfly4(Fout, fstride, st, m); | 303 kf_bfly4(Fout, fstride, st, m); |
303 unsigned int t2 = armv7_cycles_read(); | 304 // unsigned int t2 = armv7_cycles_read(); |
304 armv7_cycles_stop(); | 305 // armv7_cycles_stop(); |
305 counter++; | 306 // counter++; |
306 if (counter > 150 && counter < 160) printf("XX %d\n", t2-t1); | 307 // if (counter > 150 && counter < 160) printf("XX %d\n", t2-t1); |
307 } | 308 } |
308 break; | 309 break; |
309 case 5: kf_bfly5(Fout, fstride, st, m); break; | 310 case 5: kf_bfly5(Fout, fstride, st, m); break; |
310 default: kf_bfly_generic(Fout, fstride, st, m, p); break; | 311 default: kf_bfly_generic(Fout, fstride, st, m, p); break; |
311 } | 312 } |
342 /* | 343 /* |
343 * User-callable function to allocate all necessary storage space for the fft. | 344 * User-callable function to allocate all necessary storage space for the fft. |
344 * The return value is a contiguous block of memory, allocated with malloc. As such, | 345 * The return value is a contiguous block of memory, allocated with malloc. As such, |
345 * it can be freed with free(), rather than a peck_fft-specific function. | 346 * it can be freed with free(), rather than a peck_fft-specific function. |
346 */ | 347 */ |
347 peck_fft_cfg peck_fft_alloc(int nfft, int inverse_fft, void * mem, size_t * lenmem) { | 348 peck_fft_cfg peck_fft_alloc(int nfft, int inverse_fft, void *mem, size_t *lenmem) { |
348 peck_fft_cfg st = NULL; | 349 peck_fft_cfg st = NULL; |
349 size_t memneeded = sizeof(struct peck_fft_state) | 350 size_t memneeded = sizeof(struct peck_fft_state) |
350 + sizeof(peck_fft_cpx)*(nfft-1); /* twiddle factors */ | 351 + sizeof(peck_fft_cpx)*(nfft-1); /* twiddle factors */ |
351 | 352 |
352 if (lenmem == NULL) { | 353 if (lenmem == NULL) { |
353 st = ( peck_fft_cfg)PECK_FFT_MALLOC(memneeded); | 354 st = (peck_fft_cfg) PECK_FFT_MALLOC(memneeded); |
354 } else { | 355 } else { |
355 if (mem != NULL && *lenmem >= memneeded) | 356 if (mem != NULL && *lenmem >= memneeded) |
356 st = (peck_fft_cfg)mem; | 357 st = (peck_fft_cfg) mem; |
357 *lenmem = memneeded; | 358 *lenmem = memneeded; |
358 } | 359 } |
359 | 360 |
360 if (st) { | 361 if (st) { |
361 int i; | 362 int i; |