1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Fix SDFT batch process (#12218)

Fix SDFT batch processing
This commit is contained in:
Jan Post 2023-01-19 05:58:01 +01:00 committed by GitHub
parent e782ab9b28
commit fb29036ba7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -86,7 +86,7 @@ FAST_CODE void sdftPush(sdft_t *sdft, const float sample)
// Add new sample to frequency spectrum in parts
FAST_CODE void sdftPushBatch(sdft_t *sdft, const float sample, const int batchIdx)
{
const int batchStart = sdft->batchSize * batchIdx;
const int batchStart = sdft->batchSize * batchIdx + sdft->startBin;
int batchEnd = batchStart;
const float delta = sample - rPowerN * sdft->samples[sdft->idx];
@ -191,7 +191,7 @@ static FAST_CODE void updateEdges(sdft_t *sdft, const float value, const int bat
const unsigned idx = sdft->startBin - 1;
sdft->data[idx] = twiddle[idx] * (sdft->data[idx] + value);
}
// First bin outside of upper range
if (sdft->endBin < SDFT_BIN_COUNT - 1 && batchIdx == sdft->numBatches - 1) {
const unsigned idx = sdft->endBin + 1;