The tcSigProcTIDspSupport class provides utility methods that are necessary to leverage the TI Digital Signal Processing libraries for the C6000 series processors. These functions are in many cases copied directly from the TI DSP library user's guide.
This is a simple example of tcSigProcTIDspSupport usage. The example shown here computes the FFT spectra from 2 real time domain input signals using the TI provided FFT calls and associate runtime libraries. Additionally, the input data is weighted using a hanning taper. Several static structures are built at initialization, including the windowing taper, a working buffer, twiddle factors for the FFT, and a bit reversal index for sorting the outputs of the FFT (which are in bit-reversed order).
{
#define FFT_SIZE 2048
float* mpHanningData = new float[FFT_SIZE];
float* mpTwiddles = new float[FFT_SIZE*2+8];
float* mpWorkBuff = new float[FFT_SIZE*2+8];
short* mpInputBuffA = new float[FFT_SIZE];
short* mpInputBuffB = new float[FFT_SIZE];
float* mpFFTA = new float[FFT_SIZE*2];
float* mpFFTB = new float[FFT_SIZE*2];
short* mpBitReverseIndex = new short[tcSigProcTIDspSupport::bitrev_index_length(FFT_SIZE)];
tcSigProcWinFunc::Hanning(mpHanningData, FFT_SIZE);
if ((unsigned int)mpTwiddles & 7)
{
mpTwiddles = (float*)(((unsigned int)mpTwiddles+8)&~7);
}
if ((unsigned int)mpWorkBuff & 7)
{
mpWorkBuff = (float*)(((unsigned int)mpWorkBuff+8)&~7);
}
tcSigProcTIDspSupport::compute_bitrev_index(mpBitReverseIndex, LOW_RES_FFT_SIZE);
tcSigProcTIDspSupport::gen_w_r2(mpTwiddles,FFT_SIZE);
tcSigProcTIDspSupport::bit_rev(mpTwiddles,FFT_SIZE>>1);
tcSigProcVector::ToFloat(mpInputBuffA,mpWorkBuff, FFT_SIZE, 1, 2);
tcSigProcVector::ToFloat(mpInputBuffB,mpWorkBuff+1, FFT_SIZE, 1, 2);
tcSigProcVector::VecAddMul(mpWorkBuff, mpHanningData, 0.0,
mpWorkBuff, FFT_SIZE, 2, 1, 2);
tcSigProcVector::VecAddMul(mpWorkBuff+1, mpHanningData, 0.0,
mpWorkBuff+1, FFT_SIZE, 2, 1, 2);
DSPF_sp_cfftr2_dit(mpWorkBuff,mpTwiddles,FFT_SIZE);
DSPF_sp_bitrev_cplx((double*)mpWorkBuff, mpBitReverseIndex, FFT_SIZE);
tcSigProcTIDspSupport::ExtractDualRealFFT(mpWorkBuff, mpFFTA, mpFFTB,
FFT_SIZE, FFT_SIZE);
}