Revert "Update spectrum_collector.cpp"

This reverts commit 35cece1cb0.
This commit is contained in:
Brumi-2021 2021-10-24 01:58:58 +02:00
parent bfd614b51f
commit 28ee69baae

View File

@ -106,12 +106,12 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) {
}
/* 3 types of Windowing time domain shapes declaration , but only used Hamming , shapes for FFT
gcc10 compile sintax error c/m (1/2),
GCC10 compile sintax error c/m (1/2),
The primary diff. between const and constexpr variables is that
the initialization of a const var can be deferred until run time.
A constexpr var. must be initialized at compile time. ...
A var. can be declared with constexpr , when it has a literal type and is initialized.
gcc10 compile sintax error c/m (2/2)
GCC compile sintax error c/m (2/2)
Static assert --> Tests a software assertion at compile time for debugging.
we keep the same safety compile protection , just changing slightly the sintax checking that the size of the called array is power of 2.
if the bool "constant expression" is TRUE (normal case) , the declaration has no effect.
@ -119,24 +119,24 @@ void SpectrumCollector::post_message(const buffer_c16_t& data) {
*/
template<typename T> // Although currently we are not using that Windowing shape, we apply the same gcc10 compile error c/m
template<typename T> // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m
static typename T::value_type spectrum_window_none(const T& s, const size_t i) {
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions.
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
return s[i];
};
template<typename T> // Currently we are calling and using that Window shape.
static typename T::value_type spectrum_window_hamming_3(const T& s, const size_t i) {
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions.
const size_t mask = s.size() - 1; // c/m compile error gcc10 , constexpr->const
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const
// Three point Hamming window.
return s[i] * 0.54f + (s[(i-1) & mask] + s[(i+1) & mask]) * -0.23f;
};
template<typename T> // Although currently we are not using that Windowing shape, we apply the same gcc10 compile error c/m
template<typename T> // Although currently we are not using that Windowing shape, we apply the same GCC10 compile error c/m
static typename T::value_type spectrum_window_blackman_3(const T& s, const size_t i) {
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error gcc10 , OK for all gcc versions.
const size_t mask = s.size() - 1; // c/m compile error gcc10 , constexpr->const
static_assert(power_of_two(sizeof(s)), "Array size must be power of 2"); // c/m compile error GCC10 , OK for all GCC versions.
const size_t mask = s.size() - 1; // c/m compile error GCC10 , constexpr->const
// Three term Blackman window.
constexpr float alpha = 0.42f;
constexpr float beta = 0.5f * 0.5f;