23#ifndef INCLUDED_DIGITAL_CONSTELLATION_H
24#define INCLUDED_DIGITAL_CONSTELLATION_H
30#include <boost/any.hpp>
31#include <boost/enable_shared_from_this.hpp>
44typedef boost::shared_ptr<constellation> constellation_sptr;
66 std::vector<int> pre_diff_code,
67 unsigned int rotational_symmetry,
68 unsigned int dimensionality,
69 bool normalize_points =
true);
95 std::vector<gr_complex>
points() {
return d_constellation; }
116 return floor(log(
double(d_constellation.size())) / d_dimensionality / log(2.0));
119 unsigned int arity() {
return d_arity; }
121 constellation_sptr
base() {
return shared_from_this(); }
239 typedef boost::shared_ptr<constellation_calcdist>
sptr;
254 std::vector<int> pre_diff_code,
255 unsigned int rotational_symmetry,
256 unsigned int dimensionality,
257 bool normalize_points =
true);
266 std::vector<int> pre_diff_code,
267 unsigned int rotational_symmetry,
268 unsigned int dimensionality,
269 bool nomalize_points =
true);
299 std::vector<int> pre_diff_code,
300 unsigned int rotational_symmetry,
301 unsigned int dimensionality,
302 unsigned int n_sectors);
316 std::vector<int> sector_values;
340 typedef boost::shared_ptr<constellation_rect>
sptr;
356 std::vector<int> pre_diff_code,
357 unsigned int rotational_symmetry,
358 unsigned int real_sectors,
359 unsigned int imag_sectors,
360 float width_real_sectors,
361 float width_imag_sectors);
366 std::vector<int> pre_diff_code,
367 unsigned int rotational_symmetry,
368 unsigned int real_sectors,
369 unsigned int imag_sectors,
370 float width_real_sectors,
371 float width_imag_sectors);
378 unsigned int n_real_sectors;
379 unsigned int n_imag_sectors;
380 float d_width_real_sectors;
381 float d_width_imag_sectors;
409 typedef boost::shared_ptr<constellation_expl_rect>
sptr;
412 std::vector<int> pre_diff_code,
413 unsigned int rotational_symmetry,
414 unsigned int real_sectors,
415 unsigned int imag_sectors,
416 float width_real_sectors,
417 float width_imag_sectors,
418 std::vector<unsigned int> sector_values);
423 std::vector<int> pre_diff_code,
424 unsigned int rotational_symmetry,
425 unsigned int real_sectors,
426 unsigned int imag_sectors,
427 float width_real_sectors,
428 float width_imag_sectors,
429 std::vector<unsigned int> sector_values);
433 return d_sector_values[sector];
437 std::vector<unsigned int> d_sector_values;
459 typedef boost::shared_ptr<constellation_psk>
sptr;
463 std::vector<int> pre_diff_code,
464 unsigned int n_sectors);
474 std::vector<int> pre_diff_code,
475 unsigned int n_sectors);
498 typedef boost::shared_ptr<constellation_bpsk>
sptr;
534 typedef boost::shared_ptr<constellation_qpsk>
sptr;
569 typedef boost::shared_ptr<constellation_dqpsk>
sptr;
606 typedef boost::shared_ptr<constellation_8psk>
sptr;
642 typedef boost::shared_ptr<constellation_8psk_natural>
sptr;
680 typedef boost::shared_ptr<constellation_16qam>
sptr;
Digital constellation for 16qam.
Definition: constellation.h:678
boost::shared_ptr< constellation_16qam > sptr
Definition: constellation.h:680
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
Digital constellation for natually mapped 8PSK.
Definition: constellation.h:640
~constellation_8psk_natural()
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
boost::shared_ptr< constellation_8psk_natural > sptr
Definition: constellation.h:642
constellation_8psk_natural()
Digital constellation for 8PSK.
Definition: constellation.h:604
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
boost::shared_ptr< constellation_8psk > sptr
Definition: constellation.h:606
Digital constellation for BPSK .
Definition: constellation.h:496
boost::shared_ptr< constellation_bpsk > sptr
Definition: constellation.h:498
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
Calculate Euclidian distance for any constellation.
Definition: constellation.h:237
constellation_calcdist(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, bool nomalize_points=true)
static sptr make(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, bool normalize_points=true)
boost::shared_ptr< constellation_calcdist > sptr
Definition: constellation.h:239
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
Digital constellation for DQPSK.
Definition: constellation.h:567
boost::shared_ptr< constellation_dqpsk > sptr
Definition: constellation.h:569
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
Rectangular digital constellation.
Definition: constellation.h:407
boost::shared_ptr< constellation_expl_rect > sptr
Definition: constellation.h:409
unsigned int calc_sector_value(unsigned int sector)
Definition: constellation.h:431
static sptr make(std::vector< gr_complex > constellation, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors, std::vector< unsigned int > sector_values)
constellation_expl_rect(std::vector< gr_complex > constellation, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors, std::vector< unsigned int > sector_values)
~constellation_expl_rect()
constellation_psk
Definition: constellation.h:457
unsigned int get_sector(const gr_complex *sample)
constellation_psk(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int n_sectors)
unsigned int calc_sector_value(unsigned int sector)
boost::shared_ptr< constellation_psk > sptr
Definition: constellation.h:459
static sptr make(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int n_sectors)
Digital constellation for QPSK.
Definition: constellation.h:532
boost::shared_ptr< constellation_qpsk > sptr
Definition: constellation.h:534
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
Rectangular digital constellation.
Definition: constellation.h:338
unsigned int calc_sector_value(unsigned int sector)
unsigned int get_sector(const gr_complex *sample)
constellation_rect(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors)
gr_complex calc_sector_center(unsigned int sector)
boost::shared_ptr< constellation_rect > sptr
Definition: constellation.h:340
static constellation_rect::sptr make(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors)
Sectorized digital constellation.
Definition: constellation.h:286
virtual unsigned int calc_sector_value(unsigned int sector)=0
unsigned int n_sectors
Definition: constellation.h:313
virtual unsigned int get_sector(const gr_complex *sample)=0
unsigned int decision_maker(const gr_complex *sample)
Returns the constellation point that matches best.
void find_sector_values()
constellation_sector(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, unsigned int n_sectors)
An abstracted constellation object.
Definition: constellation.h:63
constellation_sptr base()
Definition: constellation.h:121
bool d_apply_pre_diff_code
Definition: constellation.h:203
virtual void calc_hard_symbol_metric(const gr_complex *sample, float *metric)
std::vector< gr_complex > d_constellation
Definition: constellation.h:201
bool has_soft_dec_lut()
Returns True if the soft decision LUT has been defined, False otherwise.
std::vector< int > d_pre_diff_code
Definition: constellation.h:202
virtual void calc_metric(const gr_complex *sample, float *metric, gr::digital::trellis_metric_type_t type)
Calculates distance.
pmt::pmt_t as_pmt()
Definition: constellation.h:123
unsigned int arity()
Definition: constellation.h:119
int d_lut_precision
Definition: constellation.h:213
std::vector< gr_complex > points()
Returns the set of points in this constellation.
Definition: constellation.h:95
float get_distance(unsigned int index, const gr_complex *sample)
void gen_soft_dec_lut(int precision, float npwr=1.0)
Generates the soft decision LUT based on constellation and symbol map.
float d_im_max
Definition: constellation.h:210
virtual std::vector< float > calc_soft_dec(gr_complex sample, float npwr=1.0)
Calculate soft decisions for the given sample.
virtual void calc_euclidean_metric(const gr_complex *sample, float *metric)
unsigned int rotational_symmetry()
Returns the order of rotational symmetry.
Definition: constellation.h:110
unsigned int decision_maker_v(std::vector< gr_complex > sample)
Takes a vector rather than a pointer. Better for SWIG wrapping.
unsigned int d_rotational_symmetry
Definition: constellation.h:204
constellation(std::vector< gr_complex > constell, std::vector< int > pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, bool normalize_points=true)
std::vector< std::vector< gr_complex > > v_points()
Returns a vector of vectors of points.
void set_soft_dec_lut(const std::vector< std::vector< float > > &soft_dec_lut, int precision)
Define a soft decision look-up table.
void set_pre_diff_code(bool a)
Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
Definition: constellation.h:106
void map_to_points(unsigned int value, gr_complex *points)
Returns the constellation points for a symbol value.
std::vector< std::vector< float > > d_soft_dec_lut
Definition: constellation.h:212
unsigned int d_dimensionality
Definition: constellation.h:205
bool apply_pre_diff_code()
Whether to apply an encoding before doing differential encoding. (e.g. gray coding)
Definition: constellation.h:103
std::vector< gr_complex > s_points()
Returns the vector of points in this constellation. Raise error if dimensionality is not one.
unsigned int decision_maker_pe(const gr_complex *sample, float *phase_error)
Also calculates the phase error.
std::vector< float > soft_decision_maker(gr_complex sample)
Returns the soft decisions for the given sample.
unsigned int d_arity
Definition: constellation.h:206
unsigned int dimensionality()
Returns the number of complex numbers in a single symbol.
Definition: constellation.h:112
float d_lut_scale
Definition: constellation.h:214
float d_scalefactor
The factor by which the user given constellation points were scaled by to achieve an average amplitud...
Definition: constellation.h:209
unsigned int bits_per_symbol()
Definition: constellation.h:114
std::vector< std::vector< float > > soft_dec_lut()
virtual unsigned int decision_maker(const gr_complex *sample)=0
Returns the constellation point that matches best.
std::vector< int > pre_diff_code()
Returns the encoding to apply before differential encoding.
Definition: constellation.h:108
std::vector< gr_complex > map_to_points_v(unsigned int value)
unsigned int get_closest_point(const gr_complex *sample)
#define DIGITAL_API
Definition: gr-digital/include/gnuradio/digital/api.h:30
std::complex< float > gr_complex
Definition: gr_complex.h:27
trellis_metric_type_t
Definition: metric_type.h:29
Include this header to use the message passing features.
Definition: basic_block.h:45
boost::intrusive_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition: pmt.h:56
PMT_API pmt_t make_any(const boost::any &any)
make an any