clang format, similar to GNU Radio
This commit is contained in:
+23
-27
@@ -21,34 +21,30 @@
|
||||
|
||||
using namespace gr::ieee802_11::equalizer;
|
||||
|
||||
const gr_complex base::LONG[] = {
|
||||
0, 0, 0, 0, 0, 0, 1, 1, -1, -1,
|
||||
1, 1, -1, 1, -1, 1, 1, 1, 1, 1,
|
||||
1, -1, -1, 1, 1, -1, 1, -1, 1, 1,
|
||||
1, 1, 0, 1, -1, -1, 1, 1, -1, 1,
|
||||
-1, 1, -1, -1, -1, -1, -1, 1, 1, -1,
|
||||
-1, 1, -1, 1, -1, 1, 1, 1, 1, 0,
|
||||
0, 0, 0, 0
|
||||
};
|
||||
const gr_complex base::LONG[] = { 0, 0, 0, 0, 0, 0, 1, 1, -1, -1, 1, 1, -1,
|
||||
1, -1, 1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1,
|
||||
1, -1, 1, 1, 1, 1, 0, 1, -1, -1, 1, 1, -1,
|
||||
1, -1, 1, -1, -1, -1, -1, -1, 1, 1, -1, -1, 1,
|
||||
-1, 1, -1, 1, 1, 1, 1, 0, 0, 0, 0, 0 };
|
||||
|
||||
const gr_complex base::POLARITY[127] = {
|
||||
1, 1, 1, 1,-1,-1,-1, 1,-1,-1,-1,-1, 1, 1,-1, 1,
|
||||
-1,-1, 1, 1,-1, 1, 1,-1, 1, 1, 1, 1, 1, 1,-1, 1,
|
||||
1, 1,-1, 1, 1,-1,-1, 1, 1, 1,-1, 1,-1,-1,-1, 1,
|
||||
-1, 1,-1,-1, 1,-1,-1, 1, 1, 1, 1, 1,-1,-1, 1, 1,
|
||||
-1,-1, 1,-1, 1,-1, 1, 1,-1,-1,-1, 1, 1,-1,-1,-1,
|
||||
-1, 1,-1,-1, 1,-1, 1, 1, 1, 1,-1, 1,-1, 1,-1, 1,
|
||||
-1,-1,-1,-1,-1, 1,-1, 1, 1,-1, 1,-1, 1, 1, 1,-1,
|
||||
-1, 1,-1,-1,-1, 1, 1, 1,-1,-1,-1,-1,-1,-1,-1 };
|
||||
1, 1, 1, 1, -1, -1, -1, 1, -1, -1, -1, -1, 1, 1, -1, 1, -1, -1, 1, 1, -1, 1,
|
||||
1, -1, 1, 1, 1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, -1, -1, 1, 1, 1, -1, 1,
|
||||
-1, -1, -1, 1, -1, 1, -1, -1, 1, -1, -1, 1, 1, 1, 1, 1, -1, -1, 1, 1, -1, -1,
|
||||
1, -1, 1, -1, 1, 1, -1, -1, -1, 1, 1, -1, -1, -1, -1, 1, -1, -1, 1, -1, 1, 1,
|
||||
1, 1, -1, 1, -1, 1, -1, 1, -1, -1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, 1, 1,
|
||||
1, -1, -1, 1, -1, -1, -1, 1, 1, 1, -1, -1, -1, -1, -1, -1, -1
|
||||
};
|
||||
|
||||
std::vector<gr_complex> base::get_csi() {
|
||||
std::vector<gr_complex> csi;
|
||||
csi.reserve(52);
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i == 32) || (i < 6) || (i > 58)) {
|
||||
continue;
|
||||
}
|
||||
csi.push_back(d_H[i]);
|
||||
}
|
||||
return csi;
|
||||
std::vector<gr_complex> base::get_csi()
|
||||
{
|
||||
std::vector<gr_complex> csi;
|
||||
csi.reserve(52);
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i == 32) || (i < 6) || (i > 58)) {
|
||||
continue;
|
||||
}
|
||||
csi.push_back(d_H[i]);
|
||||
}
|
||||
return csi;
|
||||
}
|
||||
|
||||
+15
-10
@@ -18,30 +18,35 @@
|
||||
#ifndef INCLUDED_IEEE802_11_EQUALIZER_BASE_H
|
||||
#define INCLUDED_IEEE802_11_EQUALIZER_BASE_H
|
||||
|
||||
#include <gnuradio/gr_complex.h>
|
||||
#include <gnuradio/digital/constellation.h>
|
||||
#include <gnuradio/gr_complex.h>
|
||||
|
||||
namespace gr {
|
||||
namespace ieee802_11 {
|
||||
namespace equalizer {
|
||||
|
||||
class base {
|
||||
class base
|
||||
{
|
||||
public:
|
||||
virtual ~base() {};
|
||||
virtual void equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod) = 0;
|
||||
virtual double get_snr() = 0;
|
||||
virtual ~base(){};
|
||||
virtual void equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod) = 0;
|
||||
virtual double get_snr() = 0;
|
||||
|
||||
static const gr_complex POLARITY[127];
|
||||
static const gr_complex POLARITY[127];
|
||||
|
||||
std::vector<gr_complex> get_csi();
|
||||
std::vector<gr_complex> get_csi();
|
||||
|
||||
protected:
|
||||
static const gr_complex LONG[64];
|
||||
static const gr_complex LONG[64];
|
||||
|
||||
gr_complex d_H[64];
|
||||
gr_complex d_H[64];
|
||||
};
|
||||
|
||||
} /* namespace channel_estimation */
|
||||
} // namespace equalizer
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
|
||||
+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; }
|
||||
|
||||
+10
-6
@@ -24,18 +24,22 @@ namespace gr {
|
||||
namespace ieee802_11 {
|
||||
namespace equalizer {
|
||||
|
||||
class comb: public base {
|
||||
class comb : public base
|
||||
{
|
||||
public:
|
||||
virtual void equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod);
|
||||
double get_snr();
|
||||
virtual void equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod);
|
||||
double get_snr();
|
||||
|
||||
private:
|
||||
const double alpha = 0.2;
|
||||
const double alpha = 0.2;
|
||||
};
|
||||
|
||||
} /* namespace channel_estimation */
|
||||
} // namespace equalizer
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_EQUALIZER_COMB_H */
|
||||
|
||||
|
||||
+39
-35
@@ -21,44 +21,48 @@
|
||||
|
||||
using namespace gr::ieee802_11::equalizer;
|
||||
|
||||
void lms::equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod) {
|
||||
void lms::equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod)
|
||||
{
|
||||
|
||||
if(n == 0) {
|
||||
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
|
||||
if (n == 0) {
|
||||
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
|
||||
|
||||
} else if(n == 1) {
|
||||
double signal = 0;
|
||||
double noise = 0;
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if((i == 32) || (i < 6) || ( i > 58)) {
|
||||
continue;
|
||||
}
|
||||
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
|
||||
signal += std::pow(std::abs(d_H[i] + in[i]), 2);
|
||||
d_H[i] += in[i];
|
||||
d_H[i] /= LONG[i] * gr_complex(2, 0);
|
||||
}
|
||||
} else if (n == 1) {
|
||||
double signal = 0;
|
||||
double noise = 0;
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i == 32) || (i < 6) || (i > 58)) {
|
||||
continue;
|
||||
}
|
||||
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
|
||||
signal += std::pow(std::abs(d_H[i] + in[i]), 2);
|
||||
d_H[i] += in[i];
|
||||
d_H[i] /= LONG[i] * gr_complex(2, 0);
|
||||
}
|
||||
|
||||
d_snr = 10 * std::log10(signal / noise / 2);
|
||||
d_snr = 10 * std::log10(signal / noise / 2);
|
||||
|
||||
} else {
|
||||
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]);
|
||||
gr_complex point;
|
||||
mod->map_to_points(bits[c], &point);
|
||||
d_H[i] = gr_complex(1-alpha,0) * d_H[i] + gr_complex(alpha,0) * in[i] / point;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
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]);
|
||||
gr_complex point;
|
||||
mod->map_to_points(bits[c], &point);
|
||||
d_H[i] = gr_complex(1 - alpha, 0) * d_H[i] +
|
||||
gr_complex(alpha, 0) * in[i] / point;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
lms::get_snr() {
|
||||
return d_snr;
|
||||
}
|
||||
double lms::get_snr() { return d_snr; }
|
||||
|
||||
+13
-7
@@ -25,17 +25,23 @@ namespace gr {
|
||||
namespace ieee802_11 {
|
||||
namespace equalizer {
|
||||
|
||||
class lms: public base {
|
||||
class lms : public base
|
||||
{
|
||||
public:
|
||||
virtual void equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod);
|
||||
private:
|
||||
double get_snr();
|
||||
virtual void equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod);
|
||||
|
||||
double d_snr;
|
||||
const double alpha = 0.5;
|
||||
private:
|
||||
double get_snr();
|
||||
|
||||
double d_snr;
|
||||
const double alpha = 0.5;
|
||||
};
|
||||
|
||||
} /* namespace channel_estimation */
|
||||
} // namespace equalizer
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
|
||||
+35
-31
@@ -21,41 +21,45 @@
|
||||
|
||||
using namespace gr::ieee802_11::equalizer;
|
||||
|
||||
void ls::equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod) {
|
||||
void ls::equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod)
|
||||
{
|
||||
|
||||
if(n == 0) {
|
||||
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
|
||||
if (n == 0) {
|
||||
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
|
||||
|
||||
} else if(n == 1) {
|
||||
double signal = 0;
|
||||
double noise = 0;
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if((i == 32) || (i < 6) || ( i > 58)) {
|
||||
continue;
|
||||
}
|
||||
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
|
||||
signal += std::pow(std::abs(d_H[i] + in[i]), 2);
|
||||
d_H[i] += in[i];
|
||||
d_H[i] /= LONG[i] * gr_complex(2, 0);
|
||||
}
|
||||
} else if (n == 1) {
|
||||
double signal = 0;
|
||||
double noise = 0;
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i == 32) || (i < 6) || (i > 58)) {
|
||||
continue;
|
||||
}
|
||||
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
|
||||
signal += std::pow(std::abs(d_H[i] + in[i]), 2);
|
||||
d_H[i] += in[i];
|
||||
d_H[i] /= LONG[i] * gr_complex(2, 0);
|
||||
}
|
||||
|
||||
d_snr = 10 * std::log10(signal / noise / 2);
|
||||
d_snr = 10 * std::log10(signal / noise / 2);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
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 ls::get_snr() {
|
||||
return d_snr;
|
||||
}
|
||||
double ls::get_snr() { return d_snr; }
|
||||
|
||||
+11
-6
@@ -25,17 +25,22 @@ namespace gr {
|
||||
namespace ieee802_11 {
|
||||
namespace equalizer {
|
||||
|
||||
class ls: public base {
|
||||
class ls : public base
|
||||
{
|
||||
public:
|
||||
virtual void equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod);
|
||||
virtual double get_snr();
|
||||
virtual void equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod);
|
||||
virtual double get_snr();
|
||||
|
||||
private:
|
||||
double d_snr;
|
||||
double d_snr;
|
||||
};
|
||||
|
||||
} /* namespace channel_estimation */
|
||||
} // namespace equalizer
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
#endif /* INCLUDED_IEEE802_11_EQUALIZER_LS_H */
|
||||
|
||||
|
||||
+64
-60
@@ -21,75 +21,79 @@
|
||||
|
||||
using namespace gr::ieee802_11::equalizer;
|
||||
|
||||
void sta::equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod) {
|
||||
void sta::equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod)
|
||||
{
|
||||
|
||||
if(n == 0) {
|
||||
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
|
||||
if (n == 0) {
|
||||
std::memcpy(d_H, in, 64 * sizeof(gr_complex));
|
||||
|
||||
} else if(n == 1) {
|
||||
double signal = 0;
|
||||
double noise = 0;
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if((i == 32) || (i < 6) || ( i > 58)) {
|
||||
continue;
|
||||
}
|
||||
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
|
||||
signal += std::pow(std::abs(d_H[i] + in[i]), 2);
|
||||
d_H[i] += in[i];
|
||||
d_H[i] /= LONG[i] * gr_complex(2, 0);
|
||||
}
|
||||
} else if (n == 1) {
|
||||
double signal = 0;
|
||||
double noise = 0;
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i == 32) || (i < 6) || (i > 58)) {
|
||||
continue;
|
||||
}
|
||||
noise += std::pow(std::abs(d_H[i] - in[i]), 2);
|
||||
signal += std::pow(std::abs(d_H[i] + in[i]), 2);
|
||||
d_H[i] += in[i];
|
||||
d_H[i] /= LONG[i] * gr_complex(2, 0);
|
||||
}
|
||||
|
||||
d_snr = 10 * std::log10(signal / noise / 2);
|
||||
d_snr = 10 * std::log10(signal / noise / 2);
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
gr_complex H_update[64];
|
||||
gr_complex H[64];
|
||||
gr_complex H_update[64];
|
||||
gr_complex H[64];
|
||||
|
||||
gr_complex p = POLARITY[(n - 2) % 127];
|
||||
gr_complex p = POLARITY[(n - 2) % 127];
|
||||
|
||||
H[11] = in[11] * p;
|
||||
H[25] = in[25] * p;
|
||||
H[39] = in[39] * p;
|
||||
H[53] = in[53] * -p;
|
||||
H[11] = in[11] * p;
|
||||
H[25] = in[25] * p;
|
||||
H[39] = in[39] * p;
|
||||
H[53] = in[53] * -p;
|
||||
|
||||
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]);
|
||||
gr_complex point;
|
||||
mod->map_to_points(bits[c], &point);
|
||||
H[i] = in[i] / point;
|
||||
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]);
|
||||
gr_complex point;
|
||||
mod->map_to_points(bits[c], &point);
|
||||
H[i] = in[i] / point;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 64; i++) {
|
||||
int n = 0;
|
||||
gr_complex s = 0;
|
||||
for(int k = i-beta; k <= i+beta; k++) {
|
||||
if((k == 32) || (k < 6) || ( k > 58)) {
|
||||
continue;
|
||||
}
|
||||
n++;
|
||||
s += H[k];
|
||||
}
|
||||
H_update[i] = s / gr_complex(n, 0);
|
||||
}
|
||||
for (int i = 0; i < 64; i++) {
|
||||
int n = 0;
|
||||
gr_complex s = 0;
|
||||
for (int k = i - beta; k <= i + beta; k++) {
|
||||
if ((k == 32) || (k < 6) || (k > 58)) {
|
||||
continue;
|
||||
}
|
||||
n++;
|
||||
s += H[k];
|
||||
}
|
||||
H_update[i] = s / gr_complex(n, 0);
|
||||
}
|
||||
|
||||
for(int i = 0; i < 64; i++) {
|
||||
if((i < 6) || ( i > 58)) {
|
||||
continue;
|
||||
}
|
||||
d_H[i] = gr_complex(1-alpha,0) * d_H[i] + gr_complex(alpha,0) * H_update[i];
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 64; i++) {
|
||||
if ((i < 6) || (i > 58)) {
|
||||
continue;
|
||||
}
|
||||
d_H[i] =
|
||||
gr_complex(1 - alpha, 0) * d_H[i] + gr_complex(alpha, 0) * H_update[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
double
|
||||
sta::get_snr() {
|
||||
return d_snr;
|
||||
}
|
||||
double sta::get_snr() { return d_snr; }
|
||||
|
||||
+12
-7
@@ -25,19 +25,24 @@ namespace gr {
|
||||
namespace ieee802_11 {
|
||||
namespace equalizer {
|
||||
|
||||
class sta: public base {
|
||||
class sta : public base
|
||||
{
|
||||
public:
|
||||
virtual void equalize(gr_complex *in, int n, gr_complex *symbols, uint8_t *bits, boost::shared_ptr<gr::digital::constellation> mod);
|
||||
double get_snr();
|
||||
virtual void equalize(gr_complex* in,
|
||||
int n,
|
||||
gr_complex* symbols,
|
||||
uint8_t* bits,
|
||||
boost::shared_ptr<gr::digital::constellation> mod);
|
||||
double get_snr();
|
||||
|
||||
private:
|
||||
double d_snr;
|
||||
double d_snr;
|
||||
|
||||
const double alpha = 0.5;
|
||||
const int beta = 2;
|
||||
const double alpha = 0.5;
|
||||
const int beta = 2;
|
||||
};
|
||||
|
||||
} /* namespace channel_estimation */
|
||||
} // namespace equalizer
|
||||
} /* namespace ieee802_11 */
|
||||
} /* namespace gr */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user