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.

dm6467 dsp核上的算法速度慢



用于C语言编写的算法跑在DSP核上,已经将算法循环体内的变量尽量都放在栈内,改变代码顺序,尽量减小相邻几条语句的上下依赖性。 已有一定效果,想进一步改善,如下设想是否可行:

(1) 像素的亮度是放在一个全局大数组中,每个像素占用一个byte,每循环一次,从unsigned char* p 指向的地址读一个字节。想改为:每循环一次,将p强制转换为int*, 每次读4个byte,读内存省时间,但是强制转换是否增加耗时? 我不懂线性汇编(by the way 我觉得“线性汇编”这个名字起的和SYS/BIOS一样不堪)

(2) 有网友说将 for(i=0;i<length;i++) 改成 for(i=length;i>0;i--)速度更快。如果这个length是被优化在寄存器中,那么网友的说法还成立吗?