This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: TI-RTOS
Hi,
Can you check if there is DSP API lib for reducing the processing duration to the attached code?
specially the short time Fourier transform part.
Thank you,
Aviram
#include <math.h>
#include "KaiserWindow_256.h"
#include <string.h>
#include "S1_def.h"
int reductionI[FFT_SIZE] __attribute__((section("algo_l2")));
int reductionQ[FFT_SIZE] __attribute__((section("algo_l2")));
// Amnon :
// Change to be in-place
// loop of FFT_NUM_OF_SEGMENTS-1, the first acc item is already in-place
int IQ_Reduction(short* input_I, short* input_Q, float* output_IQ, int fft_size)
{
// IQ Reduction - work in parallel on I and Q samples in order to reduce the computational complexity
int i, j;
int sampleIndex;
//int acc_I, acc_Q;
//int reductionI[FFT_MAX_SIZE];
//int reductionQ[FFT_MAX_SIZE];
int sumI;
int sumQ;
int meanI;
int meanQ;
int delta;
// Init
sumI = 0;
sumQ = 0;
memset(reductionI, 0, sizeof(reductionI));
memset(reductionQ, 0, sizeof(reductionQ));
for (i = 0; i < fft_size; i++)
{
// Init Accumulators
//acc_I = 0;
//acc_Q = 0;
// Init Input index
sampleIndex = i;
for (j = 0; j < FFT_NUM_OF_SEGMENTS; j++)
{
reductionI[i] += input_I[sampleIndex];
reductionQ[i] += input_Q[sampleIndex];
sampleIndex += fft_size;
}
sumI += reductionI[i];
sumQ += reductionQ[i];
// Update Reduction Result
//reductionI[i] = acc_I;
//reductionQ[i] = acc_Q;
}
// Calculate DC
meanI = (int)(sumI * DC_AVG_FACTOR);
meanQ = (int)(sumQ * DC_AVG_FACTOR);
// Window Function
for (i = 0 , j = 0; i < fft_size; i++ , j += 2)
{
// Kaiser Window - already multiplied by (REDUCTION_AVG_FACTOR) value
// Remove DC
delta = (int)reductionI[i] - meanI;
output_IQ[j] = (float)(delta) * KaiserWindow_256[i];
// Remove DC
delta = (int)reductionQ[i] - meanQ;
output_IQ[j+1] = (float)(delta) * KaiserWindow_256[i];
}
return 0;
}