Skip to content

Commit

Permalink
Merge pull request #25 from stuerp/vNext
Browse files Browse the repository at this point in the history
Fixed regression with non-radix-2 FFT's.
  • Loading branch information
stuerp committed Feb 27, 2024
2 parents 3b713d8 + 80dc480 commit d3af3a0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 3 additions & 6 deletions 3rdParty/ProjectNayuki/FftComplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,6 @@ void Fft::transformRadix2(vector<complex<double>> & vec, vector<complex<double>>
}
}

// Trigonometric table
static vector<complex<double>> expTableBluestein;

void Fft::transformBluestein(vector<complex<double>> & vec, vector<complex<double>> & exp, bool inverse)
{
// Find a power-of-2 convolution length m such that m >= n * 2 + 1
Expand Down Expand Up @@ -142,17 +139,17 @@ void Fft::transformBluestein(vector<complex<double>> & vec, vector<complex<doubl

vector<complex<double>> bvec(m);

bvec[0] = expTableBluestein[0];
bvec[0] = exp[0];

for (size_t i = 1; i < n; i++)
bvec[i] = bvec[m - i] = std::conj(expTableBluestein[i]);
bvec[i] = bvec[m - i] = std::conj(exp[i]);

// Convolution
vector<complex<double>> cvec = convolve(std::move(avec), std::move(bvec), exp);

// Postprocessing
for (size_t i = 0; i < n; i++)
vec[i] = cvec[i] * expTableBluestein[i];
vec[i] = cvec[i] * exp[i];
}

vector<complex<double>> Fft::convolve(vector<complex<double>> xvec, vector<complex<double>> yvec, vector<complex<double>> & exp)
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ To create the component first build the x86 configuration and next the x64 confi

## Change Log

v0.7.1.0-rc-2, 2024-02-27

* Fixed (Regression): Non-radix-2 FFT's caused a crash.

v0.7.1.0-rc-1, 2024-02-26

* New: The style of the graph description background can be specified.
Expand Down
6 changes: 3 additions & 3 deletions Resources.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

/** $VER: Resources.h (2024.02.26) P. Stuer **/
/** $VER: Resources.h (2024.02.27) P. Stuer **/

#pragma once

Expand All @@ -19,7 +19,7 @@
/** Component specific **/

#define STR_COMPONENT_NAME "Spectrum Analyzer"
#define STR_COMPONENT_VERSION TOSTRING(NUM_FILE_MAJOR) "." TOSTRING(NUM_FILE_MINOR) "." TOSTRING(NUM_FILE_PATCH) "." TOSTRING(NUM_FILE_PRERELEASE) "-rc-1"
#define STR_COMPONENT_VERSION TOSTRING(NUM_FILE_MAJOR) "." TOSTRING(NUM_FILE_MINOR) "." TOSTRING(NUM_FILE_PATCH) "." TOSTRING(NUM_FILE_PRERELEASE) "-rc-2"
#define STR_COMPONENT_BASENAME "foo_vis_spectrum_analyzer"
#define STR_COMPONENT_FILENAME STR_COMPONENT_BASENAME ".dll"
#define STR_COMPONENT_COMPANY_NAME ""
Expand All @@ -36,7 +36,7 @@
#define STR_COPYRIGHT TEXT(STR_COMPONENT_COPYRIGHT)

#define STR_FILE_NAME TEXT(STR_COMPONENT_FILENAME)
#define STR_FILE_VERSION TOSTRING(NUM_FILE_MAJOR) TEXT(".") TOSTRING(NUM_FILE_MINOR) TEXT(".") TOSTRING(NUM_FILE_PATCH) TEXT(".") TOSTRING(NUM_FILE_PRERELEASE) "-rc-1"
#define STR_FILE_VERSION TOSTRING(NUM_FILE_MAJOR) TEXT(".") TOSTRING(NUM_FILE_MINOR) TEXT(".") TOSTRING(NUM_FILE_PATCH) TEXT(".") TOSTRING(NUM_FILE_PRERELEASE) "-rc-2"
#define STR_FILE_DESCRIPTION TEXT(STR_COMPONENT_DESCRIPTION)

#define STR_PRODUCT_NAME STR_INTERNAL_NAME
Expand Down

0 comments on commit d3af3a0

Please sign in to comment.