|
|
|
@@ -71,7 +71,7 @@ void FLAC__window_bartlett_hann(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f));
|
|
|
|
window[n] = (FLAC__real)(0.62f - 0.48f * fabs((float)n/(float)N+0.5f) + 0.38f * cos(2.0f * M_PI * ((float)n/(float)N+0.5f)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
@@ -80,7 +80,7 @@ void FLAC__window_blackman(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N);
|
|
|
|
window[n] = (FLAC__real)(0.42f - 0.5f * cos(2.0f * M_PI * n / N) + 0.08f * cos(4.0f * M_PI * n / N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* 4-term -92dB side-lobe */
|
|
|
|
/* 4-term -92dB side-lobe */
|
|
|
|
@@ -90,7 +90,7 @@ void FLAC__window_blackman_harris_4term_92db_sidelobe(FLAC__real *window, const
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n <= N; n++)
|
|
|
|
for (n = 0; n <= N; n++)
|
|
|
|
window[n] = 0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N);
|
|
|
|
window[n] = (FLAC__real)(0.35875f - 0.48829f * cos(2.0f * M_PI * n / N) + 0.14128f * cos(4.0f * M_PI * n / N) - 0.01168f * cos(6.0f * M_PI * n / N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
@@ -102,7 +102,7 @@ void FLAC__window_connes(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
for (n = 0; n <= N; n++) {
|
|
|
|
for (n = 0; n <= N; n++) {
|
|
|
|
double k = ((double)n - N2) / N2;
|
|
|
|
double k = ((double)n - N2) / N2;
|
|
|
|
k = 1.0f - k * k;
|
|
|
|
k = 1.0f - k * k;
|
|
|
|
window[n] = k * k;
|
|
|
|
window[n] = (FLAC__real)(k * k);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -112,7 +112,7 @@ void FLAC__window_flattop(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N);
|
|
|
|
window[n] = (FLAC__real)(1.0f - 1.93f * cos(2.0f * M_PI * n / N) + 1.29f * cos(4.0f * M_PI * n / N) - 0.388f * cos(6.0f * M_PI * n / N) + 0.0322f * cos(8.0f * M_PI * n / N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev)
|
|
|
|
void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__real stddev)
|
|
|
|
@@ -123,7 +123,7 @@ void FLAC__window_gauss(FLAC__real *window, const FLAC__int32 L, const FLAC__rea
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n <= N; n++) {
|
|
|
|
for (n = 0; n <= N; n++) {
|
|
|
|
const double k = ((double)n - N2) / (stddev * N2);
|
|
|
|
const double k = ((double)n - N2) / (stddev * N2);
|
|
|
|
window[n] = exp(-0.5f * k * k);
|
|
|
|
window[n] = (FLAC__real)exp(-0.5f * k * k);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -133,7 +133,7 @@ void FLAC__window_hamming(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 0.54f - 0.46f * cos(2.0f * M_PI * n / N);
|
|
|
|
window[n] = (FLAC__real)(0.54f - 0.46f * cos(2.0f * M_PI * n / N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
@@ -142,7 +142,7 @@ void FLAC__window_hann(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 0.5f - 0.5f * cos(2.0f * M_PI * n / N);
|
|
|
|
window[n] = (FLAC__real)(0.5f - 0.5f * cos(2.0f * M_PI * n / N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
@@ -151,7 +151,7 @@ void FLAC__window_kaiser_bessel(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N);
|
|
|
|
window[n] = (FLAC__real)(0.402f - 0.498f * cos(2.0f * M_PI * n / N) + 0.098f * cos(4.0f * M_PI * n / N) - 0.001f * cos(6.0f * M_PI * n / N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
@@ -160,7 +160,7 @@ void FLAC__window_nuttall(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
FLAC__int32 n;
|
|
|
|
FLAC__int32 n;
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
for (n = 0; n < L; n++)
|
|
|
|
window[n] = 0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N);
|
|
|
|
window[n] = (FLAC__real)(0.3635819f - 0.4891775f*cos(2.0f*M_PI*n/N) + 0.1365995f*cos(4.0f*M_PI*n/N) - 0.0106411f*cos(6.0f*M_PI*n/N));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
void FLAC__window_rectangle(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
@@ -203,8 +203,8 @@ void FLAC__window_tukey(FLAC__real *window, const FLAC__int32 L, const FLAC__rea
|
|
|
|
/* ...replace ends with hann */
|
|
|
|
/* ...replace ends with hann */
|
|
|
|
if (Np > 0) {
|
|
|
|
if (Np > 0) {
|
|
|
|
for (n = 0; n <= Np; n++) {
|
|
|
|
for (n = 0; n <= Np; n++) {
|
|
|
|
window[n] = 0.5f - 0.5f * cos(M_PI * n / Np);
|
|
|
|
window[n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * n / Np));
|
|
|
|
window[L-Np-1+n] = 0.5f - 0.5f * cos(M_PI * (n+Np) / Np);
|
|
|
|
window[L-Np-1+n] = (FLAC__real)(0.5f - 0.5f * cos(M_PI * (n+Np) / Np));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@@ -218,7 +218,7 @@ void FLAC__window_welch(FLAC__real *window, const FLAC__int32 L)
|
|
|
|
|
|
|
|
|
|
|
|
for (n = 0; n <= N; n++) {
|
|
|
|
for (n = 0; n <= N; n++) {
|
|
|
|
const double k = ((double)n - N2) / N2;
|
|
|
|
const double k = ((double)n - N2) / N2;
|
|
|
|
window[n] = 1.0f - k * k;
|
|
|
|
window[n] = (FLAC__real)(1.0f - k * k);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|