Mercurial > hg > svcore
diff base/Window.h @ 1527:710e6250a401 zoom
Merge from default branch
author | Chris Cannam |
---|---|
date | Mon, 17 Sep 2018 13:51:14 +0100 |
parents | 48e9f538e6e9 |
children | ad5f892c0c4d |
line wrap: on
line diff
--- a/base/Window.h Mon Dec 12 15:18:52 2016 +0000 +++ b/base/Window.h Mon Sep 17 13:51:14 2018 +0100 @@ -57,11 +57,11 @@ encache(); } Window &operator=(const Window &w) { - if (&w == this) return *this; - m_type = w.m_type; - m_size = w.m_size; - encache(); - return *this; + if (&w == this) return *this; + m_type = w.m_type; + m_size = w.m_size; + encache(); + return *this; } virtual ~Window() { breakfastquay::deallocate(m_cache); @@ -107,38 +107,38 @@ int i; switch (m_type) { - + case RectangularWindow: - for (i = 0; i < n; ++i) { - m_cache[i] *= T(0.5); - } - break; - + for (i = 0; i < n; ++i) { + m_cache[i] *= T(0.5); + } + break; + case BartlettWindow: - for (i = 0; i < n/2; ++i) { - m_cache[i] *= T(i) / T(n/2); - m_cache[i + n/2] *= T(1.0) - T(i) / T(n/2); - } - break; - + for (i = 0; i < n/2; ++i) { + m_cache[i] *= T(i) / T(n/2); + m_cache[i + n/2] *= T(1.0) - T(i) / T(n/2); + } + break; + case HammingWindow: cosinewin(m_cache, 0.54, 0.46, 0.0, 0.0); - break; - + break; + case HanningWindow: cosinewin(m_cache, 0.50, 0.50, 0.0, 0.0); - break; - + break; + case BlackmanWindow: cosinewin(m_cache, 0.42, 0.50, 0.08, 0.0); - break; - + break; + case GaussianWindow: - for (i = 0; i < n; ++i) { + for (i = 0; i < n; ++i) { m_cache[i] *= T(pow(2, - pow((i - (n-1)/2.0) / ((n-1)/2.0 / 3), 2))); - } - break; - + } + break; + case ParzenWindow: { int N = n-1; @@ -158,13 +158,13 @@ case NuttallWindow: cosinewin(m_cache, 0.3635819, 0.4891775, 0.1365995, 0.0106411); - break; + break; case BlackmanHarrisWindow: cosinewin(m_cache, 0.35875, 0.48829, 0.14128, 0.01168); break; } - + m_area = 0; for (int i = 0; i < n; ++i) { m_area += m_cache[i];