[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] patch to gcell fft
From: |
Charles Swiger |
Subject: |
[Discuss-gnuradio] patch to gcell fft |
Date: |
Wed, 09 Jul 2008 16:38:20 -0400 |
Here is a patch to add windowing to
gcell/src/lib/wrapper/spu/gcs_fft_1d_r2.c , seems quick and snappy:
24a25
> #include <spu_intrinsics.h>
50a52
>
52,53c54,69
< // FIXME pointwise multiply in *= window
< assert(0);
---
> /* pointwise multiply: in *= window
> *
> * shuffle pattern to make float 'window' suitable for vector multiply
> * by complex 'in'
> */
> vector unsigned char pattern[2];
> pattern[0] = (vector unsigned
> char){0x0,0x1,0x2,0x3,0x0,0x1,0x2,0x3,0x4,0x5,0x6,0x7,0x4,0x5,0x6,0x7};
> pattern[1] = (vector unsigned
> char){0x8,0x9,0xa,0xb,0x8,0x9,0xa,0xb,0xc,0xd,0xe,0xf,0xc,0xd,0xe,0xf};
> register vector float zeros = (vector float){0,0,0,0};
> register vector float tempwin;
>
> int i;
> for (i=0; i<(1 << log2_fft_length)/2; i++) {
> tempwin = spu_shuffle(window[i/2],zeros,pattern[(i & 0x1)]);
> in[i] *= tempwin;
> }
Seems to work, take a lot of 'spikeyness' out:
http://www.swigerco.com/fft_windowing.html
It will also break gr-gcell/src/qa_fft.py
--Chuck
- [Discuss-gnuradio] patch to gcell fft,
Charles Swiger <=