Skip to content

Commit

Permalink
Fix SDFT windowing
Browse files Browse the repository at this point in the history
  • Loading branch information
KarateBrot committed Feb 17, 2022
1 parent 7b4415f commit 783e232
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/main/common/sdft.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,12 @@ void sdftInit(sdft_t *sdft, const int startBin, const int endBin, const int numB
}

sdft->idx = 0;
sdft->startBin = startBin;
sdft->endBin = endBin;
sdft->numBatches = numBatches;

// Add 1 bin on either side outside of range (if possible) to get proper windowing up to range limits
sdft->startBin = constrain(startBin - 1, 0, SDFT_BIN_COUNT - 1);
sdft->endBin = constrain(endBin + 1, sdft->startBin, SDFT_BIN_COUNT - 1);

sdft->numBatches = MAX(numBatches, 1);
sdft->batchSize = (sdft->endBin - sdft->startBin) / sdft->numBatches + 1; // batchSize = ceil(numBins / numBatches)

for (int i = 0; i < SDFT_SAMPLE_SIZE; i++) {
Expand Down

0 comments on commit 783e232

Please sign in to comment.