void FHT::logSpectrum(float *out, float *p) { int n = m_num / 2, i, j, k, *r; if (!m_log) { m_log = new int[n]; float f = n / log10((double)n); for (i = 0, r = m_log; i < n; i++, r++) { j = int(rint(log10(i + 1.0) * f)); *r = j >= n ? n - 1 : j; } } semiLogSpectrum(p); *out++ = *p = *p / 100; for (k = i = 1, r = m_log; i < n; i++) { j = *r++; if (i == j) *out++ = p[i]; else { float base = p[k - 1]; float step = (p[j] - base) / (j - (k - 1)); for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr; } } }
void FHT::logSpectrum(float* out, float* p) { int n = num_ / 2, i, j, k, *r; if (!log_) { log_ = new int[n]; float f = n / log10(static_cast<double>(n)); for (i = 0, r = log_; i < n; i++, r++) { j = static_cast<int>(rint(log10(i + 1.0) * f)); *r = j >= n ? n - 1 : j; } } semiLogSpectrum(p); *out++ = *p = *p / 100; for (k = i = 1, r = log_; i < n; i++) { j = *r++; if (i == j) { *out++ = p[i]; } else { float base = p[k - 1]; float step = (p[j] - base) / (j - (k - 1)); for (float corr = 0; k <= j; k++, corr += step) *out++ = base + corr; } } }