GNU Radio C++ API Reference: constellation.h Source File

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