我有以下二维数组:
float accumulator[MAX_CHANNELS][2*MAX_FRAME_LENGTH];
我一直在为每个通道移动代码中的内存块,如下所示:
for (int channel = 0; channel < nChannels; channel++) {
memmove(accumulator[channel], accumulator[channel] + stepSize, fftFrameSize * 2 * sizeof(float));
}
但是,这给了我错误的结果,我不明白为什么。我正在使用的电话有什么问题memmove
?
或者,我尝试使用以下一维数组(每个通道 1 个)并得到正确的结果:
float accumulator1[2*MAX_FRAME_LENGTH];
float accumulator2[2*MAX_FRAME_LENGTH];
memmove(accumulator1, accumulator1 + stepSize, fftFrameSize * 2 * sizeof(float));
memmove(accumulator2, accumulator2 + stepSize, fftFrameSize * 2 * sizeof(float));