diff options
-rw-r--r-- | gnuradio-core/src/lib/general/Makefile.am | 12 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/general.i | 10 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_constellation_receiver_cb.cc | 1 | ||||
-rw-r--r-- | gnuradio-core/src/lib/general/gr_constellation_receiver_cb.h | 2 | ||||
-rw-r--r-- | gr-digital/lib/Makefile.am | 2 | ||||
-rw-r--r-- | gr-digital/lib/digital_constellation.cc | 104 | ||||
-rw-r--r-- | gr-digital/lib/digital_constellation.h | 114 | ||||
-rw-r--r-- | gr-digital/swig/Makefile.am | 1 | ||||
-rw-r--r-- | gr-digital/swig/digital_constellation.i | 142 | ||||
-rw-r--r-- | gr-digital/swig/digital_swig.i | 2 |
10 files changed, 189 insertions, 201 deletions
diff --git a/gnuradio-core/src/lib/general/Makefile.am b/gnuradio-core/src/lib/general/Makefile.am index 3b8997d8c..de1e50f0e 100644 --- a/gnuradio-core/src/lib/general/Makefile.am +++ b/gnuradio-core/src/lib/general/Makefile.am @@ -56,10 +56,7 @@ libgeneral_la_SOURCES = \ gr_complex_to_xxx.cc \ gr_conjugate_cc.cc \ gr_copy.cc \ - gr_constellation.cc \ gr_constellation_decoder_cb.cc \ - gr_constellation_decoder2_cb.cc \ - gr_constellation_receiver_cb.cc \ gr_correlate_access_code_bb.cc \ gr_costas_loop_cc.cc \ gr_count_bits.cc \ @@ -114,7 +111,6 @@ libgeneral_la_SOURCES = \ gr_ofdm_demapper_vcb.cc \ gr_ofdm_mapper_bcv.cc \ gr_ofdm_frame_sink.cc \ - gr_ofdm_frame_sink2.cc \ gr_ofdm_insert_preamble.cc \ gr_ofdm_sampler.cc \ gr_pa_2x2_phase_combiner.cc \ @@ -217,10 +213,7 @@ grinclude_HEADERS = \ gr_complex_to_interleaved_short.h \ gr_complex_to_xxx.h \ gr_conjugate_cc.h \ - gr_constellation.h \ gr_constellation_decoder_cb.h \ - gr_constellation_decoder2_cb.h \ - gr_constellation_receiver_cb.h \ gr_copy.h \ gr_correlate_access_code_bb.h \ gr_costas_loop_cc.h \ @@ -281,7 +274,6 @@ grinclude_HEADERS = \ gr_ofdm_demapper_vcb.h \ gr_ofdm_mapper_bcv.h \ gr_ofdm_frame_sink.h \ - gr_ofdm_frame_sink2.h \ gr_ofdm_insert_preamble.h \ gr_ofdm_sampler.h \ gr_pa_2x2_phase_combiner.h \ @@ -396,10 +388,7 @@ swiginclude_HEADERS = \ gr_complex_to_interleaved_short.i \ gr_complex_to_xxx.i \ gr_conjugate_cc.i \ - gr_constellation.i \ gr_constellation_decoder_cb.i \ - gr_constellation_decoder2_cb.i \ - gr_constellation_receiver_cb.i \ gr_copy.i \ gr_correlate_access_code_bb.i \ gr_costas_loop_cc.i \ @@ -450,7 +439,6 @@ swiginclude_HEADERS = \ gr_ofdm_demapper_vcb.i \ gr_ofdm_mapper_bcv.i \ gr_ofdm_frame_sink.i \ - gr_ofdm_frame_sink2.i \ gr_ofdm_insert_preamble.i \ gr_ofdm_sampler.i \ gr_pa_2x2_phase_combiner.i \ diff --git a/gnuradio-core/src/lib/general/general.i b/gnuradio-core/src/lib/general/general.i index d9648ef64..5a5534129 100644 --- a/gnuradio-core/src/lib/general/general.i +++ b/gnuradio-core/src/lib/general/general.i @@ -70,8 +70,6 @@ #include <gr_fake_channel_coder_pp.h> #include <gr_throttle.h> #include <gr_mpsk_receiver_cc.h> -#include <gr_constellation_receiver_cb.h> -#include <gr_constellation.h> #include <gr_stream_mux.h> #include <gr_stream_to_streams.h> #include <gr_streams_to_stream.h> @@ -100,7 +98,7 @@ #include <gr_ofdm_cyclic_prefixer.h> #include <gr_ofdm_mapper_bcv.h> #include <gr_ofdm_frame_sink.h> -#include <gr_ofdm_frame_sink2.h> + //#include <gr_ofdm_frame_sink2.h> #include <gr_ofdm_insert_preamble.h> #include <gr_ofdm_sampler.h> #include <gr_regenerate_bb.h> @@ -115,7 +113,6 @@ #include <gr_correlate_access_code_bb.h> #include <gr_diff_phasor_cc.h> #include <gr_constellation_decoder_cb.h> -#include <gr_constellation_decoder2_cb.h> #include <gr_binary_slicer_fb.h> #include <gr_diff_encoder_bb.h> #include <gr_diff_decoder_bb.h> @@ -200,8 +197,6 @@ %include "gr_fake_channel_coder_pp.i" %include "gr_throttle.i" %include "gr_mpsk_receiver_cc.i" -%include "gr_constellation_receiver_cb.i" -%include "gr_constellation.i" %include "gr_stream_mux.i" %include "gr_stream_to_streams.i" %include "gr_streams_to_stream.i" @@ -230,7 +225,7 @@ %include "gr_ofdm_cyclic_prefixer.i" %include "gr_ofdm_mapper_bcv.i" %include "gr_ofdm_frame_sink.i" -%include "gr_ofdm_frame_sink2.i" + //%include "gr_ofdm_frame_sink2.i" %include "gr_ofdm_insert_preamble.i" %include "gr_ofdm_sampler.i" %include "gr_regenerate_bb.i" @@ -245,7 +240,6 @@ %include "gr_correlate_access_code_bb.i" %include "gr_diff_phasor_cc.i" %include "gr_constellation_decoder_cb.i" -%include "gr_constellation_decoder2_cb.i" %include "gr_binary_slicer_fb.i" %include "gr_diff_encoder_bb.i" %include "gr_diff_decoder_bb.i" diff --git a/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.cc b/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.cc index c1b56f44f..be6d3bfe4 100644 --- a/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.cc +++ b/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.cc @@ -26,7 +26,6 @@ #include <gr_io_signature.h> #include <gr_prefs.h> -#include <gr_constellation.h> #include <gr_constellation_receiver_cb.h> #include <stdexcept> #include <gr_math.h> diff --git a/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.h b/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.h index 80ffcc873..c5670e839 100644 --- a/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.h +++ b/gnuradio-core/src/lib/general/gr_constellation_receiver_cb.h @@ -24,7 +24,7 @@ #define INCLUDED_GR_CONSTELLATION_RECEIVER_CB_H #include <gr_block.h> -#include <gr_constellation.h> +#include <digital_constellation.h> #include <gr_complex.h> #include <math.h> #include <fstream> diff --git a/gr-digital/lib/Makefile.am b/gr-digital/lib/Makefile.am index 7113f94d2..6f641b745 100644 --- a/gr-digital/lib/Makefile.am +++ b/gr-digital/lib/Makefile.am @@ -25,6 +25,7 @@ AM_CPPFLAGS = $(STD_DEFINES_AND_INCLUDES) $(PYTHON_CPPFLAGS) $(WITH_INCLUDES) # These headers get installed in ${prefix}/include/gnuradio grinclude_HEADERS = \ + digital_constellation.h \ digital_costas_loop_cc.h \ digital_cma_equalizer_cc.h \ digital_kurtotic_equalizer_cc.h @@ -32,6 +33,7 @@ grinclude_HEADERS = \ lib_LTLIBRARIES = libgnuradio-digital.la libgnuradio_digital_la_SOURCES = \ + digital_constellation.cc \ digital_costas_loop_cc.cc \ digital_cma_equalizer_cc.cc \ digital_kurtotic_equalizer_cc.cc diff --git a/gr-digital/lib/digital_constellation.cc b/gr-digital/lib/digital_constellation.cc index eede99ffd..804a65ac8 100644 --- a/gr-digital/lib/digital_constellation.cc +++ b/gr-digital/lib/digital_constellation.cc @@ -21,7 +21,7 @@ */ #include <gr_io_signature.h> -#include <gr_constellation.h> +#include <digital_constellation.h> #include <gr_metric_type.h> #include <gr_math.h> #include <gr_complex.h> @@ -36,8 +36,10 @@ // Base Constellation Class -gr_constellation::gr_constellation (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, unsigned int dimensionality) : +digital_constellation::digital_constellation (std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int rotational_symmetry, + unsigned int dimensionality) : d_constellation(constellation), d_pre_diff_code(pre_diff_code), d_rotational_symmetry(rotational_symmetry), @@ -52,7 +54,7 @@ gr_constellation::gr_constellation (std::vector<gr_complex> constellation, std:: calc_arity(); } -gr_constellation::gr_constellation () : +digital_constellation::digital_constellation () : d_apply_pre_diff_code(false), d_rotational_symmetry(0), d_dimensionality(1) @@ -61,19 +63,19 @@ gr_constellation::gr_constellation () : } //! Returns the constellation points for a symbol value -void gr_constellation::map_to_points(unsigned int value, gr_complex *points) { +void digital_constellation::map_to_points(unsigned int value, gr_complex *points) { for (unsigned int i=0; i<d_dimensionality; i++) points[i] = d_constellation[value*d_dimensionality + i]; } -std::vector<gr_complex> gr_constellation::map_to_points_v(unsigned int value) { +std::vector<gr_complex> digital_constellation::map_to_points_v(unsigned int value) { std::vector<gr_complex> points_v; points_v.resize(d_dimensionality); map_to_points(value, &(points_v[0])); return points_v; } -float gr_constellation::get_distance(unsigned int index, const gr_complex *sample) { +float digital_constellation::get_distance(unsigned int index, const gr_complex *sample) { float dist = 0; for (unsigned int i=0; i<d_dimensionality; i++) { dist += norm(sample[i] - d_constellation[index*d_dimensionality + i]); @@ -81,7 +83,7 @@ float gr_constellation::get_distance(unsigned int index, const gr_complex *sampl return dist; } -unsigned int gr_constellation::get_closest_point(const gr_complex *sample) { +unsigned int digital_constellation::get_closest_point(const gr_complex *sample) { unsigned int min_index = 0; float min_euclid_dist; @@ -99,7 +101,7 @@ unsigned int gr_constellation::get_closest_point(const gr_complex *sample) { return min_index; } -unsigned int gr_constellation::decision_maker_pe(const gr_complex *sample, float *phase_error) +unsigned int digital_constellation::decision_maker_pe(const gr_complex *sample, float *phase_error) { unsigned int index = decision_maker(sample); *phase_error = 0; @@ -109,7 +111,7 @@ unsigned int gr_constellation::decision_maker_pe(const gr_complex *sample, float } /* -unsigned int gr_constellation::decision_maker_e(const gr_complex *sample, float *error) +unsigned int digital_constellation::decision_maker_e(const gr_complex *sample, float *error) { unsigned int index = decision_maker(sample); *error = 0; @@ -119,14 +121,14 @@ unsigned int gr_constellation::decision_maker_e(const gr_complex *sample, float } */ -std::vector<gr_complex> gr_constellation::s_points () { +std::vector<gr_complex> digital_constellation::s_points () { if (d_dimensionality != 1) throw std::runtime_error ("s_points only works for dimensionality 1 constellations."); else return d_constellation; } -std::vector<std::vector<gr_complex> > gr_constellation::v_points () { +std::vector<std::vector<gr_complex> > digital_constellation::v_points () { std::vector<std::vector<gr_complex> > vv_const; vv_const.resize(d_arity); for (unsigned int p=0; p<d_arity; p++) { @@ -140,7 +142,7 @@ std::vector<std::vector<gr_complex> > gr_constellation::v_points () { return vv_const; } -void gr_constellation::calc_metric(const gr_complex *sample, float *metric, trellis_metric_type_t type) { +void digital_constellation::calc_metric(const gr_complex *sample, float *metric, trellis_metric_type_t type) { switch (type){ case TRELLIS_EUCLIDEAN: calc_euclidean_metric(sample, metric); @@ -156,13 +158,13 @@ void gr_constellation::calc_metric(const gr_complex *sample, float *metric, trel } } -void gr_constellation::calc_euclidean_metric(const gr_complex *sample, float *metric) { +void digital_constellation::calc_euclidean_metric(const gr_complex *sample, float *metric) { for (unsigned int o=0; o<d_arity; o++) { metric[o] = get_distance(o, sample); } } -void gr_constellation::calc_hard_symbol_metric(const gr_complex *sample, float *metric){ +void digital_constellation::calc_hard_symbol_metric(const gr_complex *sample, float *metric){ float minm = FLT_MAX; unsigned int minmi = 0; for (unsigned int o=0; o<d_arity; o++) { @@ -177,56 +179,56 @@ void gr_constellation::calc_hard_symbol_metric(const gr_complex *sample, float * } } -void gr_constellation::calc_arity () { +void digital_constellation::calc_arity () { if (d_constellation.size() % d_dimensionality != 0) throw std::runtime_error ("Constellation vector size must be a multiple of the dimensionality."); d_arity = d_constellation.size()/d_dimensionality; } -unsigned int gr_constellation::decision_maker_v (std::vector<gr_complex> sample) { +unsigned int digital_constellation::decision_maker_v (std::vector<gr_complex> sample) { assert(sample.size() == d_dimensionality); return decision_maker (&(sample[0])); } -gr_constellation_calcdist_sptr -gr_make_constellation_calcdist(std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, +digital_constellation_calcdist_sptr +digital_make_constellation_calcdist(std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality) { - return gr_constellation_calcdist_sptr(new gr_constellation_calcdist (constellation, pre_diff_code, rotational_symmetry, + return digital_constellation_calcdist_sptr(new digital_constellation_calcdist (constellation, pre_diff_code, rotational_symmetry, dimensionality)); } -gr_constellation_calcdist::gr_constellation_calcdist(std::vector<gr_complex> constellation, +digital_constellation_calcdist::digital_constellation_calcdist(std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality) : - gr_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality) + digital_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality) {} // Chooses points base on shortest distance. // Inefficient. -unsigned int gr_constellation_calcdist::decision_maker(const gr_complex *sample) +unsigned int digital_constellation_calcdist::decision_maker(const gr_complex *sample) { return get_closest_point(sample); } -gr_constellation_sector::gr_constellation_sector (std::vector<gr_complex> constellation, +digital_constellation_sector::digital_constellation_sector (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, unsigned int n_sectors) : - gr_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality), + digital_constellation(constellation, pre_diff_code, rotational_symmetry, dimensionality), n_sectors(n_sectors) { } -unsigned int gr_constellation_sector::decision_maker (const gr_complex *sample) { +unsigned int digital_constellation_sector::decision_maker (const gr_complex *sample) { unsigned int sector; sector = get_sector(sample); return sector_values[sector]; } -void gr_constellation_sector::find_sector_values () { +void digital_constellation_sector::find_sector_values () { unsigned int i; sector_values.clear(); for (i=0; i<n_sectors; i++) { @@ -234,31 +236,31 @@ void gr_constellation_sector::find_sector_values () { } } -gr_constellation_rect_sptr -gr_make_constellation_rect(std::vector<gr_complex> constellation, +digital_constellation_rect_sptr +digital_make_constellation_rect(std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors) { - return gr_constellation_rect_sptr(new gr_constellation_rect (constellation, pre_diff_code, rotational_symmetry, + return digital_constellation_rect_sptr(new digital_constellation_rect (constellation, pre_diff_code, rotational_symmetry, real_sectors, imag_sectors, width_real_sectors, width_imag_sectors)); } -gr_constellation_rect::gr_constellation_rect (std::vector<gr_complex> constellation, +digital_constellation_rect::digital_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned 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_constellation_sector(constellation, pre_diff_code, rotational_symmetry, 1, real_sectors * imag_sectors), + digital_constellation_sector(constellation, pre_diff_code, rotational_symmetry, 1, real_sectors * imag_sectors), n_real_sectors(real_sectors), n_imag_sectors(imag_sectors), d_width_real_sectors(width_real_sectors), d_width_imag_sectors(width_imag_sectors) { find_sector_values(); } -unsigned int gr_constellation_rect::get_sector (const gr_complex *sample) { +unsigned int digital_constellation_rect::get_sector (const gr_complex *sample) { int real_sector, imag_sector; unsigned int sector; real_sector = int(real(*sample)/d_width_real_sectors + n_real_sectors/2.0); @@ -271,7 +273,7 @@ unsigned int gr_constellation_rect::get_sector (const gr_complex *sample) { return sector; } -unsigned int gr_constellation_rect::calc_sector_value (unsigned int sector) { +unsigned int digital_constellation_rect::calc_sector_value (unsigned int sector) { unsigned int real_sector, imag_sector; gr_complex sector_center; unsigned int closest_point; @@ -284,24 +286,24 @@ unsigned int gr_constellation_rect::calc_sector_value (unsigned int sector) { } -gr_constellation_psk_sptr -gr_make_constellation_psk(std::vector<gr_complex> constellation, +digital_constellation_psk_sptr +digital_make_constellation_psk(std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors) { - return gr_constellation_psk_sptr(new gr_constellation_psk (constellation, pre_diff_code, + return digital_constellation_psk_sptr(new digital_constellation_psk (constellation, pre_diff_code, n_sectors)); } -gr_constellation_psk::gr_constellation_psk (std::vector<gr_complex> constellation, +digital_constellation_psk::digital_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors) : - gr_constellation_sector(constellation, pre_diff_code, constellation.size(), 1, n_sectors) + digital_constellation_sector(constellation, pre_diff_code, constellation.size(), 1, n_sectors) { find_sector_values(); } -unsigned int gr_constellation_psk::get_sector (const gr_complex *sample) { +unsigned int digital_constellation_psk::get_sector (const gr_complex *sample) { float phase = arg(*sample); float width = M_TWOPI / n_sectors; int sector = floor(phase/width + 0.5); @@ -311,7 +313,7 @@ unsigned int gr_constellation_psk::get_sector (const gr_complex *sample) { return sector; } -unsigned int gr_constellation_psk::calc_sector_value (unsigned int sector) { +unsigned int digital_constellation_psk::calc_sector_value (unsigned int sector) { float phase = sector * M_TWOPI / n_sectors; gr_complex sector_center = gr_complex(cos(phase), sin(phase)); unsigned int closest_point = get_closest_point(§or_center); @@ -319,13 +321,13 @@ unsigned int gr_constellation_psk::calc_sector_value (unsigned int sector) { } -gr_constellation_bpsk_sptr -gr_make_constellation_bpsk() +digital_constellation_bpsk_sptr +digital_make_constellation_bpsk() { - return gr_constellation_bpsk_sptr(new gr_constellation_bpsk ()); + return digital_constellation_bpsk_sptr(new digital_constellation_bpsk ()); } -gr_constellation_bpsk::gr_constellation_bpsk () +digital_constellation_bpsk::digital_constellation_bpsk () { d_constellation.resize(2); d_constellation[0] = gr_complex(-1, 0); @@ -335,19 +337,19 @@ gr_constellation_bpsk::gr_constellation_bpsk () calc_arity(); } -unsigned int gr_constellation_bpsk::decision_maker(const gr_complex *sample) +unsigned int digital_constellation_bpsk::decision_maker(const gr_complex *sample) { return (real(*sample) > 0); } -gr_constellation_qpsk_sptr -gr_make_constellation_qpsk() +digital_constellation_qpsk_sptr +digital_make_constellation_qpsk() { - return gr_constellation_qpsk_sptr(new gr_constellation_qpsk ()); + return digital_constellation_qpsk_sptr(new digital_constellation_qpsk ()); } -gr_constellation_qpsk::gr_constellation_qpsk () +digital_constellation_qpsk::digital_constellation_qpsk () { d_constellation.resize(4); // Gray-coded @@ -360,7 +362,7 @@ gr_constellation_qpsk::gr_constellation_qpsk () calc_arity(); } -unsigned int gr_constellation_qpsk::decision_maker(const gr_complex *sample) +unsigned int digital_constellation_qpsk::decision_maker(const gr_complex *sample) { // Real component determines small bit. // Imag component determines big bit. diff --git a/gr-digital/lib/digital_constellation.h b/gr-digital/lib/digital_constellation.h index f6726a9b5..73cc888f9 100644 --- a/gr-digital/lib/digital_constellation.h +++ b/gr-digital/lib/digital_constellation.h @@ -20,8 +20,8 @@ * Boston, MA 02110-1301, USA. */ -#ifndef INCLUDED_GR_CONSTELLATION_H -#define INCLUDED_GR_CONSTELLATION_H +#ifndef INCLUDED_DIGITAL_CONSTELLATION_H +#define INCLUDED_DIGITAL_CONSTELLATION_H #include <vector> #include <math.h> @@ -30,20 +30,20 @@ #include <gr_metric_type.h> /************************************************************/ -/* gr_constellation */ +/* digital_constellation */ /* */ /* Base class defining interface. */ /************************************************************/ -class gr_constellation; -typedef boost::shared_ptr<gr_constellation> gr_constellation_sptr; +class digital_constellation; +typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr; -class gr_constellation : public boost::enable_shared_from_this<gr_constellation> +class digital_constellation : public boost::enable_shared_from_this<digital_constellation> { public: - gr_constellation (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, + digital_constellation (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality); - gr_constellation (); + digital_constellation (); //! Returns the constellation points for a symbol value void map_to_points(unsigned int value, gr_complex *points); @@ -88,7 +88,7 @@ public: return d_arity; } - gr_constellation_sptr base() { + digital_constellation_sptr base() { return shared_from_this(); } @@ -107,26 +107,26 @@ public: }; /************************************************************/ -/* gr_constellation_calcdist */ +/* digital_constellation_calcdist */ /* */ /* Constellation which calculates the distance to each */ /* point in the constellation for decision making. */ /* Inefficient for large constellations. */ /************************************************************/ -class gr_constellation_calcdist; -typedef boost::shared_ptr<gr_constellation_calcdist> gr_constellation_calcdist_sptr; +class digital_constellation_calcdist; +typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr; // public constructor -gr_constellation_calcdist_sptr -gr_make_constellation_calcdist (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, +digital_constellation_calcdist_sptr +digital_make_constellation_calcdist (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality); -class gr_constellation_calcdist : public gr_constellation +class digital_constellation_calcdist : public digital_constellation { public: - gr_constellation_calcdist (std::vector<gr_complex> constellation, + digital_constellation_calcdist (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality); @@ -136,12 +136,12 @@ class gr_constellation_calcdist : public gr_constellation // void calc_hard_symbol_metric(gr_complex *sample, float *metric); private: - friend gr_constellation_calcdist_sptr - gr_make_constellation_calcdist (std::vector<gr_complex> constellation); + friend digital_constellation_calcdist_sptr + digital_make_constellation_calcdist (std::vector<gr_complex> constellation); }; /************************************************************/ -/* gr_constellation_sector */ +/* digital_constellation_sector */ /* */ /* An abstract class. */ /* Constellation space is divided into sectors. */ @@ -149,11 +149,11 @@ class gr_constellation_calcdist : public gr_constellation /* point. */ /************************************************************/ -class gr_constellation_sector : public gr_constellation +class digital_constellation_sector : public digital_constellation { public: - gr_constellation_sector (std::vector<gr_complex> constellation, + digital_constellation_sector (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int dimensionality, @@ -176,7 +176,7 @@ class gr_constellation_sector : public gr_constellation }; /************************************************************/ -/* gr_constellation_rect */ +/* digital_constellation_rect */ /* */ /* Only implemented for 1-(complex)dimensional */ /* constellation. */ @@ -188,21 +188,21 @@ class gr_constellation_sector : public gr_constellation /* not too large. */ /************************************************************/ -class gr_constellation_rect; -typedef boost::shared_ptr<gr_constellation_rect> gr_constellation_rect_sptr; +class digital_constellation_rect; +typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr; // public constructor -gr_constellation_rect_sptr -gr_make_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, +digital_constellation_rect_sptr +digital_make_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors); -class gr_constellation_rect : public gr_constellation_sector +class digital_constellation_rect : public digital_constellation_sector { public: - gr_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, + digital_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors); @@ -220,8 +220,8 @@ class gr_constellation_rect : public gr_constellation_sector float d_width_real_sectors; float d_width_imag_sectors; - friend gr_constellation_rect_sptr - gr_make_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, + friend digital_constellation_rect_sptr + digital_make_constellation_rect (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int rotational_symmetry, unsigned int real_sectors, unsigned int imag_sectors, float width_real_sectors, float width_imag_sectors); @@ -229,7 +229,7 @@ class gr_constellation_rect : public gr_constellation_sector }; /************************************************************/ -/* gr_constellation_psk */ +/* digital_constellation_psk */ /* */ /* Constellation space is divided into pie slices sectors. */ /* Each slice is associated with the nearest constellation */ @@ -238,19 +238,19 @@ class gr_constellation_rect : public gr_constellation_sector /* Assumes that there is a constellation point at 1. */ /************************************************************/ -class gr_constellation_psk; -typedef boost::shared_ptr<gr_constellation_psk> gr_constellation_psk_sptr; +class digital_constellation_psk; +typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr; // public constructor -gr_constellation_psk_sptr -gr_make_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, +digital_constellation_psk_sptr +digital_make_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors); -class gr_constellation_psk : public gr_constellation_sector +class digital_constellation_psk : public digital_constellation_sector { public: - gr_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, + digital_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors); protected: @@ -261,61 +261,61 @@ class gr_constellation_psk : public gr_constellation_sector private: - friend gr_constellation_psk_sptr - gr_make_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, + friend digital_constellation_psk_sptr + digital_make_constellation_psk (std::vector<gr_complex> constellation, std::vector<unsigned int> pre_diff_code, unsigned int n_sectors); }; /************************************************************/ -/* gr_constellation_bpsk */ +/* digital_constellation_bpsk */ /* */ /* Only works for BPSK. */ /* */ /************************************************************/ -class gr_constellation_bpsk; -typedef boost::shared_ptr<gr_constellation_bpsk> gr_constellation_bpsk_sptr; +class digital_constellation_bpsk; +typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr; // public constructor -gr_constellation_bpsk_sptr -gr_make_constellation_bpsk (); +digital_constellation_bpsk_sptr +digital_make_constellation_bpsk (); -class gr_constellation_bpsk : public gr_constellation +class digital_constellation_bpsk : public digital_constellation { public: - gr_constellation_bpsk (); + digital_constellation_bpsk (); unsigned int decision_maker (const gr_complex *sample); - friend gr_constellation_bpsk_sptr - gr_make_constellation_bpsk (); + friend digital_constellation_bpsk_sptr + digital_make_constellation_bpsk (); }; /************************************************************/ -/* gr_constellation_qpsk */ +/* digital_constellation_qpsk */ /* */ /* Only works for QPSK. */ /* */ /************************************************************/ -class gr_constellation_qpsk; -typedef boost::shared_ptr<gr_constellation_qpsk> gr_constellation_qpsk_sptr; +class digital_constellation_qpsk; +typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr; // public constructor -gr_constellation_qpsk_sptr -gr_make_constellation_qpsk (); +digital_constellation_qpsk_sptr +digital_make_constellation_qpsk (); -class gr_constellation_qpsk : public gr_constellation +class digital_constellation_qpsk : public digital_constellation { public: - gr_constellation_qpsk (); + digital_constellation_qpsk (); unsigned int decision_maker (const gr_complex *sample); - friend gr_constellation_qpsk_sptr - gr_make_constellation_qpsk (); + friend digital_constellation_qpsk_sptr + digital_make_constellation_qpsk (); }; diff --git a/gr-digital/swig/Makefile.am b/gr-digital/swig/Makefile.am index d06da3a26..edbda6bda 100644 --- a/gr-digital/swig/Makefile.am +++ b/gr-digital/swig/Makefile.am @@ -57,6 +57,7 @@ digital_swig_la_swig_libadd = \ # additional SWIG files to be installed digital_swig_swiginclude_headers = \ + digital_constellation.i \ digital_costas_loop_cc.i \ digital_cma_equalizer_cc.i \ digital_kurtotic_equalizer_cc.i diff --git a/gr-digital/swig/digital_constellation.i b/gr-digital/swig/digital_constellation.i index 179e68136..0eb0c59e2 100644 --- a/gr-digital/swig/digital_constellation.i +++ b/gr-digital/swig/digital_constellation.i @@ -26,17 +26,17 @@ // Make sure metric types get SWIGed. %include gr_metric_type.h -class gr_constellation; -typedef boost::shared_ptr<gr_constellation> gr_constellation_sptr; -%template(gr_constellation_sptr) boost::shared_ptr<gr_constellation>; +class digital_constellation; +typedef boost::shared_ptr<digital_constellation> digital_constellation_sptr; +%template(digital_constellation_sptr) boost::shared_ptr<digital_constellation>; -class gr_constellation +class digital_constellation { public: - gr_constellation (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); + digital_constellation (std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int rotational_symmetry, + unsigned int dimensionality); std::vector<gr_complex> points(); std::vector<gr_complex> s_points(); std::vector<std::vector<gr_complex> > v_points(); @@ -48,99 +48,99 @@ public: std::vector<gr_complex> map_to_points_v(unsigned int value); unsigned int bits_per_symbol (); unsigned int arity (); - gr_constellation_sptr base (); + digital_constellation_sptr base (); bool apply_pre_diff_code(); std::vector<unsigned int> pre_diff_code(); unsigned int rotational_symmetry(); unsigned int dimensionality(); }; -class gr_constellation_calcdist; -typedef boost::shared_ptr<gr_constellation_calcdist> gr_constellation_calcdist_sptr; -%template(gr_constellation_calcdist_sptr) boost::shared_ptr<gr_constellation_calcdist>; -%rename(constellation_calcdist) gr_make_constellation_calcdist; -gr_constellation_calcdist_sptr -gr_make_constellation_calcdist(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); -%ignore gr_constellation_calcdist; - -class gr_constellation_calcdist: public gr_constellation +class digital_constellation_calcdist; +typedef boost::shared_ptr<digital_constellation_calcdist> digital_constellation_calcdist_sptr; +%template(digital_constellation_calcdist_sptr) boost::shared_ptr<digital_constellation_calcdist>; +%rename(constellation_calcdist) digital_make_constellation_calcdist; +digital_constellation_calcdist_sptr +digital_make_constellation_calcdist(std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int rotational_symmetry, + unsigned int dimensionality); +%ignore digital_constellation_calcdist; + +class digital_constellation_calcdist: public digital_constellation { public: - gr_constellation_calcdist (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int dimensionality); + digital_constellation_calcdist (std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int rotational_symmetry, + unsigned int dimensionality); unsigned int decision_maker (const gr_complex *sample); }; -class gr_constellation_sector: public gr_constellation +class digital_constellation_sector: public digital_constellation { }; -class gr_constellation_rect; -typedef boost::shared_ptr<gr_constellation_rect> gr_constellation_rect_sptr; -%template(gr_constellation_rect_sptr) boost::shared_ptr<gr_constellation_rect>; -%rename(constellation_rect) gr_make_constellation_rect; -gr_constellation_rect_sptr gr_make_constellation_rect(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, unsigned int imag_sectors, - float width_real_sectors, float width_imag_sectors); -%ignore gr_constellation_rect; - -class gr_constellation_rect : public gr_constellation_sector +class digital_constellation_rect; +typedef boost::shared_ptr<digital_constellation_rect> digital_constellation_rect_sptr; +%template(digital_constellation_rect_sptr) boost::shared_ptr<digital_constellation_rect>; +%rename(constellation_rect) digital_make_constellation_rect; +digital_constellation_rect_sptr digital_make_constellation_rect(std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int rotational_symmetry, + unsigned int real_sectors, unsigned int imag_sectors, + float width_real_sectors, float width_imag_sectors); +%ignore digital_constellation_rect; + +class digital_constellation_rect : public digital_constellation_sector { public: - gr_constellation_rect (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int rotational_symmetry, - unsigned int real_sectors, unsigned int imag_sectors, - float width_real_sectors, float width_imag_sectors); + digital_constellation_rect (std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int rotational_symmetry, + unsigned int real_sectors, unsigned int imag_sectors, + float width_real_sectors, float width_imag_sectors); }; -class gr_constellation_psk; -typedef boost::shared_ptr<gr_constellation_psk> gr_constellation_psk_sptr; -%template(gr_constellation_psk_sptr) boost::shared_ptr<gr_constellation_psk>; -%rename(constellation_psk) gr_make_constellation_psk; -gr_constellation_psk_sptr gr_make_constellation_psk(std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); -%ignore gr_constellation_psk; +class digital_constellation_psk; +typedef boost::shared_ptr<digital_constellation_psk> digital_constellation_psk_sptr; +%template(digital_constellation_psk_sptr) boost::shared_ptr<digital_constellation_psk>; +%rename(constellation_psk) digital_make_constellation_psk; +digital_constellation_psk_sptr digital_make_constellation_psk(std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int n_sectors); +%ignore digital_constellation_psk; -class gr_constellation_psk : public gr_constellation_sector +class digital_constellation_psk : public digital_constellation_sector { public: - gr_constellation_psk (std::vector<gr_complex> constellation, - std::vector<unsigned int> pre_diff_code, - unsigned int n_sectors); + digital_constellation_psk (std::vector<gr_complex> constellation, + std::vector<unsigned int> pre_diff_code, + unsigned int n_sectors); }; -class gr_constellation_bpsk; -typedef boost::shared_ptr<gr_constellation_bpsk> gr_constellation_bpsk_sptr; -%template(gr_constellation_bpsk_sptr) boost::shared_ptr<gr_constellation_bpsk>; -%rename(constellation_bpsk) gr_make_constellation_bpsk; -gr_constellation_bpsk_sptr gr_make_constellation_bpsk(); -%ignore gr_constellation_bpsk; +class digital_constellation_bpsk; +typedef boost::shared_ptr<digital_constellation_bpsk> digital_constellation_bpsk_sptr; +%template(digital_constellation_bpsk_sptr) boost::shared_ptr<digital_constellation_bpsk>; +%rename(constellation_bpsk) digital_make_constellation_bpsk; +digital_constellation_bpsk_sptr digital_make_constellation_bpsk(); +%ignore digital_constellation_bpsk; -class gr_constellation_bpsk : public gr_constellation +class digital_constellation_bpsk : public digital_constellation { public: - gr_constellation_bpsk (); + digital_constellation_bpsk (); }; -class gr_constellation_qpsk; -typedef boost::shared_ptr<gr_constellation_qpsk> gr_constellation_qpsk_sptr; -%template(gr_constellation_qpsk_sptr) boost::shared_ptr<gr_constellation_qpsk>; -%rename(constellation_qpsk) gr_make_constellation_qpsk; -gr_constellation_qpsk_sptr gr_make_constellation_qpsk(); -%ignore gr_constellation_qpsk; +class digital_constellation_qpsk; +typedef boost::shared_ptr<digital_constellation_qpsk> digital_constellation_qpsk_sptr; +%template(digital_constellation_qpsk_sptr) boost::shared_ptr<digital_constellation_qpsk>; +%rename(constellation_qpsk) digital_make_constellation_qpsk; +digital_constellation_qpsk_sptr digital_make_constellation_qpsk(); +%ignore digital_constellation_qpsk; -class gr_constellation_qpsk : public gr_constellation +class digital_constellation_qpsk : public digital_constellation { public: - gr_constellation_qpsk (); + digital_constellation_qpsk (); }; diff --git a/gr-digital/swig/digital_swig.i b/gr-digital/swig/digital_swig.i index c2416c6c2..73d8edd8d 100644 --- a/gr-digital/swig/digital_swig.i +++ b/gr-digital/swig/digital_swig.i @@ -22,11 +22,13 @@ %include "gnuradio.i" %{ +#include "digital_constellation.h" #include "digital_costas_loop_cc.h" #include "digital_cma_equalizer_cc.h" #include "digital_kurtotic_equalizer_cc.h" %} +%include "digital_constellation.i" %include "digital_costas_loop_cc.i" %include "digital_cma_equalizer_cc.i" %include "digital_kurtotic_equalizer_cc.i" |