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]; // hanning window float* mpTwiddles = new float[FFT_SIZE*2+8]; // TI FFT twiddle factors float* mpWorkBuff = new float[FFT_SIZE*2+8]; // working buffer short* mpInputBuffA = new float[FFT_SIZE]; // input A (real data, from 16 bit ADC) short* mpInputBuffB = new float[FFT_SIZE]; // input B (real data, from 16 bit ADC) float* mpFFTA = new float[FFT_SIZE*2]; // FFT output for A float* mpFFTB = new float[FFT_SIZE*2]; // FFT output for B short* mpBitReverseIndex = new short[tcSigProcTIDspSupport::bitrev_index_length(FFT_SIZE)]; // build a hanning window tcSigProcWinFunc::Hanning(mpHanningData, FFT_SIZE); // The TI libraries require 8 byte aligned data structures.... // this can be ignored if using static data structures that // are aligned using the #pragma DATA_ALIGN() TI call. if ((unsigned int)mpTwiddles & 7) { mpTwiddles = (float*)(((unsigned int)mpTwiddles+8)&~7); } // same deal with the working buffer if ((unsigned int)mpWorkBuff & 7) { mpWorkBuff = (float*)(((unsigned int)mpWorkBuff+8)&~7); } tcSigProcTIDspSupport::compute_bitrev_index(mpBitReverseIndex, LOW_RES_FFT_SIZE); // Generate the twiddle factors tcSigProcTIDspSupport::gen_w_r2(mpTwiddles,FFT_SIZE); tcSigProcTIDspSupport::bit_rev(mpTwiddles,FFT_SIZE>>1); // ... get the data to be FFT'd // move first set into real values of the working buffer tcSigProcVector::ToFloat(mpInputBuffA,mpWorkBuff, FFT_SIZE, 1, 2); // move second set into complex values of the working buffer tcSigProcVector::ToFloat(mpInputBuffB,mpWorkBuff+1, FFT_SIZE, 1, 2); // Apply the taper to the real part tcSigProcVector::VecAddMul(mpWorkBuff, mpHanningData, 0.0, mpWorkBuff, FFT_SIZE, 2, 1, 2); // Apply the taper to the imaginary part tcSigProcVector::VecAddMul(mpWorkBuff+1, mpHanningData, 0.0, mpWorkBuff+1, FFT_SIZE, 2, 1, 2); // do the TI FFT DSPF_sp_cfftr2_dit(mpWorkBuff,mpTwiddles,FFT_SIZE); // fix the output order to be sorted normally DSPF_sp_bitrev_cplx((double*)mpWorkBuff, mpBitReverseIndex, FFT_SIZE); // extract the two sets of data tcSigProcTIDspSupport::ExtractDualRealFFT(mpWorkBuff, mpFFTA, mpFFTB, FFT_SIZE, FFT_SIZE); // ... process the results }