1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Fix SDFT batchSize rounding (#12329)

This commit is contained in:
Jan Post 2023-02-09 06:25:25 +01:00 committed by GitHub
parent 0ac9962bd4
commit 1ec9ec6bdc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,7 @@ void sdftInit(sdft_t *sdft, const int startBin, const int endBin, const int numB
sdft->endBin = constrain(endBin, sdft->startBin, SDFT_BIN_COUNT - 1);
sdft->numBatches = MAX(numBatches, 1);
sdft->batchSize = (sdft->endBin - sdft->startBin) / sdft->numBatches + 1; // batchSize = ceil(numBins / numBatches)
sdft->batchSize = (sdft->endBin - sdft->startBin + 1) / sdft->numBatches;
for (int i = 0; i < SDFT_SAMPLE_SIZE; i++) {
sdft->samples[i] = 0.0f;
@ -183,7 +183,7 @@ static FAST_CODE void applySqrt(const sdft_t *sdft, float *data)
}
// Needed for proper windowing at the edges of startBin and endBin
// Needed for proper windowing at the edges of active range
static FAST_CODE void updateEdges(sdft_t *sdft, const float value, const int batchIdx)
{
// First bin outside of lower range