GNU Radio Manual and C++ API Reference 3.8.5.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
constellation.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2010-2012 Free Software Foundation, Inc.
4 *
5 * This file is part of GNU Radio
6 *
7 * GNU Radio is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
11 *
12 * GNU Radio is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Radio; see the file COPYING. If not, write to
19 * the Free Software Foundation, Inc., 51 Franklin Street,
20 * Boston, MA 02110-1301, USA.
21 */
22
23#ifndef INCLUDED_DIGITAL_CONSTELLATION_H
24#define INCLUDED_DIGITAL_CONSTELLATION_H
25
28#include <gnuradio/gr_complex.h>
29#include <pmt/pmt.h>
30#include <boost/any.hpp>
31#include <boost/enable_shared_from_this.hpp>
32#include <vector>
33
34namespace gr {
35namespace digital {
36
37/************************************************************/
38/* constellation */
39/* */
40/* Base class defining interface. */
41/************************************************************/
42
43class constellation;
44typedef boost::shared_ptr<constellation> constellation_sptr;
45
46/*!
47 * \brief An abstracted constellation object
48 * \ingroup symbol_coding_blk
49 *
50 * \details
51 * The constellation objects hold the necessary information to pass
52 * around constellation information for modulators and
53 * demodulators. These objects contain the mapping between the bits
54 * and the constellation points used to represent them as well as
55 * methods for slicing the symbol space. Various implementations are
56 * possible for efficiency and ease of use.
57 *
58 * Standard constellations (BPSK, QPSK, QAM, etc) can be inherited
59 * from this class and overloaded to perform optimized slicing and
60 * constellation mappings.
61 */
62class DIGITAL_API constellation : public boost::enable_shared_from_this<constellation>
63{
64public:
65 constellation(std::vector<gr_complex> constell,
66 std::vector<int> pre_diff_code,
67 unsigned int rotational_symmetry,
68 unsigned int dimensionality,
69 bool normalize_points = true);
71 virtual ~constellation();
72
73 //! Returns the constellation points for a symbol value
74 void map_to_points(unsigned int value, gr_complex* points);
75 std::vector<gr_complex> map_to_points_v(unsigned int value);
76
77 //! Returns the constellation point that matches best.
78 virtual unsigned int decision_maker(const gr_complex* sample) = 0;
79 //! Takes a vector rather than a pointer. Better for SWIG wrapping.
80 unsigned int decision_maker_v(std::vector<gr_complex> sample);
81 //! Also calculates the phase error.
82 unsigned int decision_maker_pe(const gr_complex* sample, float* phase_error);
83 //! Calculates distance.
84 // unsigned int decision_maker_e(const gr_complex *sample, float *error);
85
86 //! Calculates metrics for all points in the constellation.
87 //! For use with the viterbi algorithm.
88 virtual void calc_metric(const gr_complex* sample,
89 float* metric,
91 virtual void calc_euclidean_metric(const gr_complex* sample, float* metric);
92 virtual void calc_hard_symbol_metric(const gr_complex* sample, float* metric);
93
94 //! Returns the set of points in this constellation.
95 std::vector<gr_complex> points() { return d_constellation; }
96 //! Returns the vector of points in this constellation.
97 //! Raise error if dimensionality is not one.
98 std::vector<gr_complex> s_points();
99 //! Returns a vector of vectors of points.
100 std::vector<std::vector<gr_complex>> v_points();
101 //! Whether to apply an encoding before doing differential encoding. (e.g. gray
102 //! coding)
103 bool apply_pre_diff_code() { return d_apply_pre_diff_code; }
104 //! Whether to apply an encoding before doing differential encoding. (e.g. gray
105 //! coding)
106 void set_pre_diff_code(bool a) { d_apply_pre_diff_code = a; }
107 //! Returns the encoding to apply before differential encoding.
108 std::vector<int> pre_diff_code() { return d_pre_diff_code; }
109 //! Returns the order of rotational symmetry.
110 unsigned int rotational_symmetry() { return d_rotational_symmetry; }
111 //! Returns the number of complex numbers in a single symbol.
112 unsigned int dimensionality() { return d_dimensionality; }
113
114 unsigned int bits_per_symbol()
115 {
116 return floor(log(double(d_constellation.size())) / d_dimensionality / log(2.0));
117 }
118
119 unsigned int arity() { return d_arity; }
120
121 constellation_sptr base() { return shared_from_this(); }
122
123 pmt::pmt_t as_pmt() { return pmt::make_any(boost::any(base())); }
124
125 /*! \brief Generates the soft decision LUT based on
126 * constellation and symbol map.
127 *
128 * \details Generates the soft decision LUT based on
129 * constellation and symbol map. It can be given a estimate of
130 * the noise power in the channel as \p npwr.
131 *
132 * \param precision Number of bits of precision on each axis.
133 * \param npwr Estimate of the noise power (if known).
134 *
135 * This is expensive to compute.
136 */
137 void gen_soft_dec_lut(int precision, float npwr = 1.0);
138
139 /*! \brief Calculate soft decisions for the given \p sample.
140 *
141 * \details Calculate the soft decisions from the given \p sample
142 * at the given noise power \p npwr.
143 *
144 * This is a very costly algorithm (especially for higher order
145 * modulations) and should be used sparingly. It uses the
146 * #gen_soft_dec_lut function to generate the LUT, which
147 * should be done once or if a large change in the noise floor
148 * is detected.
149 *
150 * Instead of using this function, generate the LUT using the
151 * #gen_soft_dec_lut after creating the constellation object
152 * and then use the #soft_decision_maker function to return the
153 * answer from the LUT.
154 *
155 * \param sample The complex sample to get the soft decisions.
156 * \param npwr Estimate of the noise power (if known).
157 */
158 virtual std::vector<float> calc_soft_dec(gr_complex sample, float npwr = 1.0);
159
160 /*! \brief Define a soft decision look-up table.
161 *
162 * \details Define a soft decision look-up table (LUT). Because
163 * soft decisions can be calculated in various ways with various
164 * levels of accuracy and complexity, this function allows
165 * users to create a LUT in their own way.
166 *
167 * Setting the LUT here means that #has_soft_dec_lut will return
168 * true. Decision vectors returned by #soft_decision_maker will
169 * be calculated using this LUT.
170 *
171 * \param soft_dec_lut The soft decision LUT as a vector of
172 * tuples (vectors in C++) of soft decisions. Each
173 * element of the LUT is a vector of k-bit floats (where
174 * there are k bits/sample in the constellation).
175 * \param precision The number of bits of precision used when
176 * generating the LUT.
177 */
178 void set_soft_dec_lut(const std::vector<std::vector<float>>& soft_dec_lut,
179 int precision);
180
181 //! Returns True if the soft decision LUT has been defined, False otherwise.
183
184
185 std::vector<std::vector<float>> soft_dec_lut();
186
187
188 /*! \brief Returns the soft decisions for the given \p sample.
189 *
190 * \details Returns the soft decisions for the given \p
191 * sample. If a LUT is defined for the object, the decisions
192 * will be calculated from there. Otherwise, this function will
193 * call calc_soft_dec directly to calculate the soft decisions.
194 *
195 * \param sample The complex sample to get the soft decisions.
196 */
197 std::vector<float> soft_decision_maker(gr_complex sample);
198
199
200protected:
201 std::vector<gr_complex> d_constellation;
202 std::vector<int> d_pre_diff_code;
205 unsigned int d_dimensionality;
206 unsigned int d_arity;
207 //! The factor by which the user given constellation points were
208 //! scaled by to achieve an average amplitude of 1.
210 float d_re_min, d_re_max, d_im_min, d_im_max;
211
212 std::vector<std::vector<float>> d_soft_dec_lut;
215
216 float get_distance(unsigned int index, const gr_complex* sample);
217 unsigned int get_closest_point(const gr_complex* sample);
219
221};
222
223/************************************************************/
224/* constellation_calcdist */
225/* */
226/************************************************************/
227
228/*! \brief Calculate Euclidean distance for any constellation
229 * \ingroup digital
230 *
231 * \details
232 * Constellation which calculates the distance to each point in the
233 * constellation for decision making. Inefficient for large
234 * constellations.
235 */
237{
238public:
239 typedef boost::shared_ptr<constellation_calcdist> sptr;
240
241 /*!
242 * Make a general constellation object that calculates the Euclidean distance for hard
243 * decisions.
244 *
245 * \param constell List of constellation points (order of list matches pre_diff_code)
246 * \param pre_diff_code List of alphabet symbols (before applying any differential
247 * coding) (order of list matches constell)
248 * \param rotational_symmetry Number of rotations around unit circle that have the
249 * same representation. \param dimensionality Number of dimensions to the
250 * constellation. \param normalize_points Normalize constellation points to
251 * mean(abs(points))=1 (default is true)
252 */
253 static sptr make(std::vector<gr_complex> constell,
254 std::vector<int> pre_diff_code,
255 unsigned int rotational_symmetry,
256 unsigned int dimensionality,
257 bool normalize_points = true);
258
259 unsigned int decision_maker(const gr_complex* sample);
260 // void calc_metric(gr_complex *sample, float *metric, trellis_metric_type_t type);
261 // void calc_euclidean_metric(gr_complex *sample, float *metric);
262 // void calc_hard_symbol_metric(gr_complex *sample, float *metric);
263
264protected:
265 constellation_calcdist(std::vector<gr_complex> constell,
266 std::vector<int> pre_diff_code,
267 unsigned int rotational_symmetry,
268 unsigned int dimensionality,
269 bool nomalize_points = true);
270};
271
272
273/************************************************************/
274/*! constellation_sector */
275/************************************************************/
276
277/*!
278 * \brief Sectorized digital constellation
279 * \ingroup digital
280 *
281 * \details
282 * Constellation space is divided into sectors. Each sector is
283 * associated with the nearest constellation point.
284 */
286{
287public:
288 /*!
289 * Make a sectorized constellation object.
290 *
291 * \param constell List of constellation points (order of list matches pre_diff_code)
292 * \param pre_diff_code List of alphabet symbols (before applying any differential
293 * coding) (order of list matches constell)
294 * \param rotational_symmetry Number of rotations around unit circle that have the
295 * same representation. \param dimensionality Number of z-axis dimensions to the
296 * constellation \param n_sectors Number of sectors in the constellation.
297 */
298 constellation_sector(std::vector<gr_complex> constell,
299 std::vector<int> pre_diff_code,
300 unsigned int rotational_symmetry,
301 unsigned int dimensionality,
302 unsigned int n_sectors);
303
305
306 unsigned int decision_maker(const gr_complex* sample);
307
308protected:
309 virtual unsigned int get_sector(const gr_complex* sample) = 0;
310 virtual unsigned int calc_sector_value(unsigned int sector) = 0;
312
313 unsigned int n_sectors;
314
315private:
316 std::vector<int> sector_values;
317};
318
319/************************************************************/
320/* constellation_rect */
321/************************************************************/
322
323/*!
324 * \brief Rectangular digital constellation
325 * \ingroup digital
326 *
327 * Only implemented for 1-(complex)dimensional constellation.
328 *
329 * Constellation space is divided into rectangular sectors. Each
330 * sector is associated with the nearest constellation point.
331 *
332 * Works well for square QAM.
333 *
334 * Works for any generic constellation provided sectors are not
335 * too large.
336 */
338{
339public:
340 typedef boost::shared_ptr<constellation_rect> sptr;
341
342 /*!
343 * Make a rectangular constellation object.
344 *
345 * \param constell List of constellation points (order of list matches pre_diff_code)
346 * \param pre_diff_code List of alphabet symbols (before applying any differential
347 * coding) (order of list matches constell)
348 * \param rotational_symmetry Number of rotations around unit circle that have the
349 * same representation. \param real_sectors Number of sectors the real axis is split
350 * in to. \param imag_sectors Number of sectors the imag axis is split in to. \param
351 * width_real_sectors width of each real sector to calculate decision boundaries.
352 * \param width_imag_sectors width of each imag sector to calculate decision
353 * boundaries.
354 */
355 static constellation_rect::sptr make(std::vector<gr_complex> constell,
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);
363
364protected:
365 constellation_rect(std::vector<gr_complex> constell,
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);
372
373 unsigned int get_sector(const gr_complex* sample);
374 gr_complex calc_sector_center(unsigned int sector);
375 unsigned int calc_sector_value(unsigned int sector);
376
377private:
378 unsigned int n_real_sectors;
379 unsigned int n_imag_sectors;
380 float d_width_real_sectors;
381 float d_width_imag_sectors;
382};
383
384
385/************************************************************/
386/* constellation_expl_rect */
387/************************************************************/
388
389/*!
390 * \brief Rectangular digital constellation.
391 * \ingroup digital
392 *
393 * \details
394 * Only implemented for 1-(complex)dimensional constellation.
395 *
396 * Constellation space is divided into rectangular sectors. Each
397 * sector is associated with the nearest constellation point.
398 *
399 * This class is different from constellation_rect in that the
400 * mapping from sector to constellation point is explicitly passed
401 * into the constructor as sector_values. Usually we do not need
402 * this, since we want each sector to be automatically mapped to
403 * the closest constellation point, however sometimes it's nice to
404 * have the flexibility.
405 */
407{
408public:
409 typedef boost::shared_ptr<constellation_expl_rect> sptr;
410
411 static sptr make(std::vector<gr_complex> constellation,
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);
420
421protected:
422 constellation_expl_rect(std::vector<gr_complex> constellation,
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);
430
431 unsigned int calc_sector_value(unsigned int sector)
432 {
433 return d_sector_values[sector];
434 }
435
436private:
437 std::vector<unsigned int> d_sector_values;
438};
439
440/************************************************************/
441/* constellation_psk */
442/************************************************************/
443
444/*!
445 * \brief constellation_psk
446 * \ingroup digital
447 *
448 * Constellation space is divided into pie slices sectors.
449 *
450 * Each slice is associated with the nearest constellation point.
451 *
452 * Works well for PSK but nothing else.
453 *
454 * Assumes that there is a constellation point at 1.x
455 */
457{
458public:
459 typedef boost::shared_ptr<constellation_psk> sptr;
460
461 // public constructor
462 static sptr make(std::vector<gr_complex> constell,
463 std::vector<int> pre_diff_code,
464 unsigned int n_sectors);
465
467
468protected:
469 unsigned int get_sector(const gr_complex* sample);
470
471 unsigned int calc_sector_value(unsigned int sector);
472
473 constellation_psk(std::vector<gr_complex> constell,
474 std::vector<int> pre_diff_code,
475 unsigned int n_sectors);
476};
477
478
479/************************************************************/
480/* constellation_bpsk */
481/* */
482/* Only works for BPSK. */
483/* */
484/************************************************************/
485
486/*!
487 * \brief Digital constellation for BPSK .
488 * \ingroup digital
489 *
490 * \details
491 * \verbatim
492 0 | 1
493 \endverbatim
494 */
496{
497public:
498 typedef boost::shared_ptr<constellation_bpsk> sptr;
499
500 // public constructor
501 static sptr make();
502
504
505 unsigned int decision_maker(const gr_complex* sample);
506
507protected:
509};
510
511
512/************************************************************/
513/* constellation_qpsk */
514/* */
515/* Only works for QPSK. */
516/* */
517/************************************************************/
518
519/*!
520 * \brief Digital constellation for QPSK
521 * \ingroup digital
522 *
523 * \details Constellation diagram assumes little endian format e.g. top, left means 2
524 not 1.
525 * \verbatim
526 01 | 11
527 -------
528 00 | 10
529 \endverbatim
530 */
532{
533public:
534 typedef boost::shared_ptr<constellation_qpsk> sptr;
535
536 // public constructor
537 static sptr make();
538
540
541 unsigned int decision_maker(const gr_complex* sample);
542
543protected:
545};
546
547
548/************************************************************/
549/* constellation_dqpsk */
550/* */
551/* Works with differential encoding; slower decisions. */
552/* */
553/************************************************************/
554
555/*!
556 * \brief Digital constellation for DQPSK.
557 * \ingroup digital
558 *
559 * \details
560 * \verbatim
561 01 | 00
562 -------
563 11 | 10
564 \endverbatim
565 */
567{
568public:
569 typedef boost::shared_ptr<constellation_dqpsk> sptr;
570
571 // public constructor
572 static sptr make();
573
575
576 unsigned int decision_maker(const gr_complex* sample);
577
578protected:
580};
581
582
583/************************************************************/
584/* constellation_8psk */
585/* */
586/* Only works for 8PSK. */
587/* */
588/************************************************************/
589
590/*!
591 * \brief Digital constellation for 8PSK.
592 * \ingroup digital
593 *
594 * \details
595 * \verbatim
596 101 | 100
597 001 | 000
598 -----------------
599 011 | 010
600 111 | 110
601 \endverbatim
602 */
604{
605public:
606 typedef boost::shared_ptr<constellation_8psk> sptr;
607
608 // public constructor
609 static sptr make();
610
612
613 unsigned int decision_maker(const gr_complex* sample);
614
615protected:
617};
618
619/************************************************************/
620/* constellation_8psk_natural */
621/* */
622/* Only works for natural 8psk */
623/* */
624/************************************************************/
625
626/*!
627 * \brief Digital constellation for natually mapped 8PSK.
628 * \ingroup digital
629 *
630 * \details
631 * \verbatim
632 011 | 010
633 100 | 001
634 -----------------
635 101 | 000
636 110 | 111
637 \endverbatim
638 */
640{
641public:
642 typedef boost::shared_ptr<constellation_8psk_natural> sptr;
643
644 // public constructor
645 static sptr make();
646
648
649 unsigned int decision_maker(const gr_complex* sample);
650
651protected:
653};
654
655/************************************************************/
656/* constellation_16qam */
657/* */
658/* the 16qam mapping used in set partition of tcm */
659/* */
660/************************************************************/
661
662/*!
663 * \brief Digital constellation for 16qam.
664 * \ingroup digital
665 *
666 * \details
667 * \verbatim
6681000 1101 | 1100 1001
669 |
6701111 1010 | 1011 1110
671 -----------------
6720100 0001 | 0000 0101
673 |
6740011 0110 | 0111 0010
675 \endverbatim
676 */
678{
679public:
680 typedef boost::shared_ptr<constellation_16qam> sptr;
681
682 // public constructor
683 static sptr make();
684
686
687 unsigned int decision_maker(const gr_complex* sample);
688
689protected:
691};
692
693} /* namespace digital */
694} /* namespace gr */
695
696#endif /* INCLUDED_DIGITAL_CONSTELLATION_H */
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
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
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 Euclidean 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_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.
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
GNU Radio logging wrapper for log4cpp library (C++ port of log4j)
Definition basic_block.h:46
PMT_API pmt_t make_any(const boost::any &any)
make an any
boost::shared_ptr< pmt_base > pmt_t
typedef for shared pointer (transparent reference counting). See http://www.boost....
Definition pmt.h:96