Part Number: TMS320C6713B
Hello,
I am currently working on the real-time pitch shifter algorithm using DSK6713 and CCS v5.3. My code is working fine, but only with the sampling frequency up to 8 kHz. I cannot use the higher sampling frequency because it takes me too much time (~0,024sec.) to process frame with 1024 samples. To use 44kHz the current frame should be processed in time <0,00582sec, so I would need to optimize my code 4 times.
The most significant time (~2,353,044 cycles) takes the calculation of magnitude and phase, e.g.:
for(i = 0; i < 1024; i++){
a = 2*i;
r[i] = sqrt(fft_in[a]*fft_in[a] + fft_in[a+1]*fft_in[a+1]);
phi[i] = atan2(fft_in[a+1], fft_in[a]);
}
float mod(float a, float N) {return a - N*floor(a/N);}
for (i=0; i<1024;i++){
phase_out[i] = mod(phi[i]-phi0[i]-omega[i]+M_PI, -2*M_PI) + M_PI;
delta_phi[i] = omega[i] + phase_out[i];
phi0[i] = phi[i];
psi[i] = mod(psi[i]+delta_phi[i]*tstretch_ratio+M_PI, -2*M_PI) + M_PI;
}
How could I optimize this code to increase the execution speed?
Thanks and regards,
Ka