Forums - Use of fft (fft32x16.S)

2 posts / 0 new
Last post
Use of fft (fft32x16.S)
Beno
Join Date: 30 Jan 15
Posts: 2
Posted: Wed, 2015-04-08 13:56

Hi,

I'm new to Hexagon development and have made a small program that computes the fft of a real signal but the output is not correct. The input is sinusoidal but the fft output has three spikes and I can't figure out the cause of this? Any advice appreciated!

Please find test code below

Thanks

//  --------------- Simplified Cpp code  ---------------
#define FFTSZ 256
CWord2x32 Input[FFTSZ] __attribute__((aligned(8*FFTSZ)));
CWord2x32 Output[FFTSZ] __attribute__((aligned(8)));
Word32 buffer[FFTSZ];
 
pFile_r = fopen("audio/input.bin", "rb");
pFile_w = fopen("audio/output.bin", "wb");
int Nfft = FFTSZ;
Word32 Z = 0;
 
result = fread(buffer, sizeof(typeof(buffer[0])), Nfft, pFile_r);
 
for(int i=0;i<Nfft;i++)
    Input[i] = Q6_P_combine_RI(buffer[i], Z);  // complex transform with real-input only
 
fft32x16(Input, Nfft, Wtwiddles, Output); // do transform
 
fwrite(Output, sizeof(typeof(Output[0])), Nfft, pFile_w);
 

// --------------- Matlab code ---------------

x= sin(2*pi*16*[0:255]/256); % no discontinuities
fid = fopen('../audio/input.bin', 'wb');
fwrite(fid, round(x*2^31), 'int32');
fclose(fid);
 
fid = fopen('../audio/output.bin', 'rb');
y = fread(fid, 'int32');
fclose(fid);
Y = (y(1:2:end)+1i*y(2:2:end))*2^-31;
subplot(313),plot(abs(Y));grid;
 
 
 

RESOLVED!!!!

  • Up0
  • Down0
Beno
Join Date: 30 Jan 15
Posts: 2
Posted: Sun, 2015-04-12 00:23

Hi,

Is there some documentation on how to use the fft32x16? I have run the test (using make clean->make sim) which compares two fft realizations but that doesn't help me much with my problem. When I read the input (C:\Qualcomm\HEXAGON_Tools\5.0.14\examples\libcore\SigProc\cxFFT32x16\test\data) from Matlab and computes the fft the output does not resemble the output file.

This forum in general seems quite dead and I wonder if there is a better forum for this kind of question?

 

 

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.