Fix I2S input down-sampling crosstalk
Simplified and corrected array indexing used in DS3 calls.
This commit is contained in:
@@ -6,6 +6,7 @@ sc_usb_audio Change Log
|
||||
- ADDED: UserBufferManagementInit() to reset any state required in UserBufferManagement()
|
||||
- ADDED: I2S output up-sampling (I2S_UPSAMPLE_FACTOR_OUT)
|
||||
- CHANGE: Rename I2S input down-sampling (I2S_DOWNSAMPLE_FACTOR to I2S_DOWNSAMPLE_FACTOR_IN)
|
||||
- RESOLVED: Crosstalk between input channels when I2S input down-sampling is enabled
|
||||
|
||||
7.0.1
|
||||
-----
|
||||
|
||||
@@ -702,27 +702,29 @@ int i2sOutUpsamplingCounter = 0;
|
||||
#endif // I2S_MODE_TDM
|
||||
#endif // CODEC_MASTER
|
||||
|
||||
/* Note the use of readBuffNo changes based on frameCount */
|
||||
samplesIn[buffIndex][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 0, 2, 4.. on each line.
|
||||
sample = bitrev(sample);
|
||||
int chanIndex = ((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i; // channels 0, 2, 4.. on each line.
|
||||
#if (I2S_DOWNSAMPLE_FACTOR_IN > 1)
|
||||
if ((I2S_DOWNSAMPLE_FACTOR_IN - 1) == i2sInDownsamplingCounter)
|
||||
{
|
||||
samplesIn[readBuffNo][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))] =
|
||||
samplesIn[buffIndex][chanIndex] =
|
||||
src_ds3_voice_add_final_sample(
|
||||
i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i],
|
||||
i2sInDs3.delayLine[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i][i2sInDownsamplingCounter],
|
||||
i2sInDs3Sum[chanIndex],
|
||||
i2sInDs3.delayLine[chanIndex][i2sInDownsamplingCounter],
|
||||
src_ff3v_fir_coefs[i2sInDownsamplingCounter],
|
||||
samplesIn[readBuffNo][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))]);
|
||||
sample);
|
||||
}
|
||||
else
|
||||
{
|
||||
i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] =
|
||||
i2sInDs3Sum[chanIndex] =
|
||||
src_ds3_voice_add_sample(
|
||||
i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i],
|
||||
i2sInDs3.delayLine[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i][i2sInDownsamplingCounter],
|
||||
src_ff3v_fir_coefs[i2sInDownsamplingCounter],
|
||||
samplesIn[readBuffNo][((frameCount-2)&(I2S_CHANS_PER_FRAME-1))]);
|
||||
i2sInDs3Sum[chanIndex],
|
||||
i2sInDs3.delayLine[chanIndex][i2sInDownsamplingCounter],
|
||||
src_ff3v_fir_coefs[i2sInDownsamplingCounter],
|
||||
sample);
|
||||
}
|
||||
#else
|
||||
samplesIn[buffIndex][chanIndex] = sample;
|
||||
#endif // (I2S_DOWNSAMPLE_FACTOR_IN > 1)
|
||||
}
|
||||
#endif
|
||||
@@ -852,26 +854,29 @@ int i2sOutUpsamplingCounter = 0;
|
||||
#endif // I2S_MODE_TDM
|
||||
#endif // CODEC_MASTER
|
||||
|
||||
samplesIn[buffIndex][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] = bitrev(sample); // channels 1, 3, 5.. on each line.
|
||||
sample = bitrev(sample);
|
||||
int chanIndex = ((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i; // channels 1, 3, 5.. on each line.
|
||||
#if ((I2S_DOWNSAMPLE_FACTOR_IN > 1) && !I2S_DOWNSAMPLE_MONO_IN)
|
||||
if ((I2S_DOWNSAMPLE_FACTOR_IN - 1) == i2sInDownsamplingCounter)
|
||||
{
|
||||
samplesIn[buffIndex][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i] =
|
||||
samplesIn[buffIndex][chanIndex] =
|
||||
src_ds3_voice_add_final_sample(
|
||||
i2sInDs3Sum[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i],
|
||||
i2sInDs3.delayLine[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i][i2sInDownsamplingCounter],
|
||||
i2sInDs3Sum[chanIndex],
|
||||
i2sInDs3.delayLine[chanIndex][i2sInDownsamplingCounter],
|
||||
src_ff3v_fir_coefs[i2sInDownsamplingCounter],
|
||||
samplesIn[readBuffNo][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i]);
|
||||
sample);
|
||||
}
|
||||
else
|
||||
{
|
||||
i2sInDs3Sum[((frameCount-2)&(I2S_CHANS_PER_FRAME-1))+i] =
|
||||
i2sInDs3Sum[chanIndex] =
|
||||
src_ds3_voice_add_sample(
|
||||
i2sInDs3Sum[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i],
|
||||
i2sInDs3.delayLine[((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i][i2sInDownsamplingCounter],
|
||||
src_ff3v_fir_coefs[i2sInDownsamplingCounter],
|
||||
samplesIn[readBuffNo][((frameCount-1)&(I2S_CHANS_PER_FRAME-1))+i]);
|
||||
i2sInDs3Sum[chanIndex],
|
||||
i2sInDs3.delayLine[chanIndex][i2sInDownsamplingCounter],
|
||||
src_ff3v_fir_coefs[i2sInDownsamplingCounter],
|
||||
sample);
|
||||
}
|
||||
#else
|
||||
samplesIn[buffIndex][chanIndex] = sample;
|
||||
#endif // ((I2S_DOWNSAMPLE_FACTOR_IN > 1) && !I2S_DOWNSAMPLE_MONO_IN)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user