有一个接受样本的代码。它们原本是单声道的,我将它们交错为立体声。现在使用以下函数对它们进行过滤,但我不知道现在正在通过左右声道进行正确迭代,因为它是为单声道样本设计的。
int32 *in
是现在是立体声的缓冲区。 int32 *out
是最终输出的过滤缓冲区。
#define SQ2NCOEFFS 1024
mrindex = (SQ2NCOEFFS + 1) << 16;
mrratio = (PAL ? (int64)(PAL_CPU * 65536) : (int64)(NTSC_CPU * 65536)) / rate;
int32 count = 0;
for (x = mrindex; x < max; x += mrratio) {
int32 acc = 0, acc2 = 0;
unsigned int c;
int32 *S, *D;
for (c = SQ2NCOEFFS, S = &in[(x >> 16) - SQ2NCOEFFS], D = sq2coeffs; c; c--, D++) {
acc += (S[c] * *D) >> 6;
acc2 += (S[1+c] * *D) >> 6;
}
acc = ((int64)acc * (65536 - (x & 65535)) + (int64)acc2 * (x & 65535)) >> (16 + 11);
*out = acc;
out++;
count++;
}