other algorithm
This commit is contained in:
parent
b02468867a
commit
a5511076aa
1 changed files with 3 additions and 2 deletions
5
main.cpp
5
main.cpp
|
@ -16,9 +16,10 @@ static constexpr int OFS = 20;
|
||||||
|
|
||||||
static CFFT fft (ORDER);
|
static CFFT fft (ORDER);
|
||||||
static vector<double> mono;
|
static vector<double> mono;
|
||||||
static bool sign = false;
|
static bool odd = false;
|
||||||
|
|
||||||
void cputs (const char * s) {
|
void cputs (const char * s) {
|
||||||
|
odd = ! odd;
|
||||||
const complex plus (0.0, 256.0), minus (0.0, -256.0);
|
const complex plus (0.0, 256.0), minus (0.0, -256.0);
|
||||||
complex data [TAPS];
|
complex data [TAPS];
|
||||||
memset (&data,0, TAPS * sizeof(complex));
|
memset (&data,0, TAPS * sizeof(complex));
|
||||||
|
@ -27,12 +28,12 @@ void cputs (const char * s) {
|
||||||
const char c = s [n];
|
const char c = s [n];
|
||||||
if (c == '\0') break;
|
if (c == '\0') break;
|
||||||
if (c == '#' ) {
|
if (c == '#' ) {
|
||||||
|
const bool sign = (n & 1) xor odd;
|
||||||
// Střídání fáze 0/180 dost potlačí rozmazání spektra.
|
// Střídání fáze 0/180 dost potlačí rozmazání spektra.
|
||||||
const complex fill = sign ? plus : minus;
|
const complex fill = sign ? plus : minus;
|
||||||
const int k = n + OFS;
|
const int k = n + OFS;
|
||||||
data[k] = fill;
|
data[k] = fill;
|
||||||
data[TAPS - k] = fill;
|
data[TAPS - k] = fill;
|
||||||
sign = ! sign;
|
|
||||||
}
|
}
|
||||||
putchar(c);
|
putchar(c);
|
||||||
n += 1;
|
n += 1;
|
||||||
|
|
Loading…
Add table
Reference in a new issue