clang format, similar to GNU Radio
This commit is contained in:
+55
-48
@@ -19,59 +19,66 @@
|
||||
|
||||
using namespace gr::ieee802_11::equalizer;
|
||||
|
||||
void comb::equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod) {
|
||||
void comb::equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod)
|
||||
{
|
||||
|
||||
gr_complex pilot[4];
|
||||
gr_complex pilot[4];
|
||||
|
||||
if(n < 2) {
|
||||
pilot[0] = in[11];
|
||||
pilot[1] = -in[25];
|
||||
pilot[2] = in[39];
|
||||
pilot[3] = in[53];
|
||||
} else {
|
||||
gr_complex p = POLARITY[(n - 2) % 127];
|
||||
pilot[0] = in[11] * p;
|
||||
pilot[1] = in[25] * p;
|
||||
pilot[2] = in[39] * p;
|
||||
pilot[3] = in[53] * -p;
|
||||
}
|
||||
if (n < 2) {
|
||||
pilot[0] = in[11];
|
||||
pilot[1] = -in[25];
|
||||
pilot[2] = in[39];
|
||||
pilot[3] = in[53];
|
||||
} else {
|
||||
gr_complex p = POLARITY[(n - 2) % 127];
|
||||
pilot[0] = in[11] * p;
|
||||
pilot[1] = in[25] * p;
|
||||
pilot[2] = in[39] * p;
|
||||
pilot[3] = in[53] * -p;
|
||||
}
|
||||
|
||||
gr_complex avg = (pilot[0] + pilot[1] + pilot[2] + pilot[3]) / gr_complex(4, 0);
|
||||
gr_complex avg = (pilot[0] + pilot[1] + pilot[2] + pilot[3]) / gr_complex(4, 0);
|
||||
|
||||
for(int i = 0; i < 64; i++) {
|
||||
gr_complex H;
|
||||
if(i <= 11) {
|
||||
H = gr_complex((11-i) / 11.0, 0) * avg + gr_complex( i / 11.0, 0) * pilot[0];
|
||||
} else if(i <= 25) {
|
||||
H = gr_complex((25-i) / 14.0, 0) * pilot[0] + gr_complex((i-11) / 14.0, 0) * pilot[1];
|
||||
} else if(i <= 39) {
|
||||
H = gr_complex((39-i) / 14.0, 0) * pilot[1] + gr_complex((i-25) / 14.0, 0) * pilot[2];
|
||||
} else if(i <= 53) {
|
||||
H = gr_complex((53-i) / 14.0, 0) * pilot[2] + gr_complex((i-39) / 14.0, 0) * pilot[3];
|
||||
} else {
|
||||
H = gr_complex((64-i) / 11.0, 0) * pilot[3] + gr_complex((i-53) / 11.0, 0) * avg;
|
||||
}
|
||||
for (int i = 0; i < 64; i++) {
|
||||
gr_complex H;
|
||||
if (i <= 11) {
|
||||
H = gr_complex((11 - i) / 11.0, 0) * avg + gr_complex(i / 11.0, 0) * pilot[0];
|
||||
} else if (i <= 25) {
|
||||
H = gr_complex((25 - i) / 14.0, 0) * pilot[0] +
|
||||
gr_complex((i - 11) / 14.0, 0) * pilot[1];
|
||||
} else if (i <= 39) {
|
||||
H = gr_complex((39 - i) / 14.0, 0) * pilot[1] +
|
||||
gr_complex((i - 25) / 14.0, 0) * pilot[2];
|
||||
} else if (i <= 53) {
|
||||
H = gr_complex((53 - i) / 14.0, 0) * pilot[2] +
|
||||
gr_complex((i - 39) / 14.0, 0) * pilot[3];
|
||||
} else {
|
||||
H = gr_complex((64 - i) / 11.0, 0) * pilot[3] +
|
||||
gr_complex((i - 53) / 11.0, 0) * avg;
|
||||
}
|
||||
|
||||
if(n == 0) {
|
||||
d_H[i] = H;
|
||||
} else {
|
||||
d_H[i] = gr_complex(1-alpha, 0) * d_H[i] + gr_complex(alpha, 0) * H;
|
||||
}
|
||||
}
|
||||
if (n == 0) {
|
||||
d_H[i] = H;
|
||||
} else {
|
||||
d_H[i] = gr_complex(1 - alpha, 0) * d_H[i] + gr_complex(alpha, 0) * H;
|
||||
}
|
||||
}
|
||||
|
||||
int c = 0;
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if( (i == 11) || (i == 25) || (i == 32) || (i == 39) || (i == 53) || (i < 6) || ( i > 58)) {
|
||||
continue;
|
||||
} else {
|
||||
symbols[c] = in[i] / d_H[i];
|
||||
bits[c] = mod->decision_maker(&symbols[c]);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
int c = 0;
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i == 11) || (i == 25) || (i == 32) || (i == 39) || (i == 53) || (i < 6) ||
|
||||
(i > 58)) {
|
||||
continue;
|
||||
} else {
|
||||
symbols[c] = in[i] / d_H[i];
|
||||
bits[c] = mod->decision_maker(&symbols[c]);
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
comb::get_snr() {
|
||||
return 42;
|
||||
}
|
||||
double comb::get_snr() { return 42; }
|
||||
|
||||
Reference in New Issue
Block a user