diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2019-08-07 21:45:12 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-08-09 23:04:28 +0200 |
commit | f7bbf2c1d8d780294f3e016aff239ca35eb6516e (patch) | |
tree | e09ab6112e02b2215b2d59ac24d3d6ea2edac745 /gr-trellis/include | |
parent | 78431dc6941e3acc67c858277dfe4a0ed583643c (diff) |
Tree: clang-format without the include sorting
Diffstat (limited to 'gr-trellis/include')
22 files changed, 806 insertions, 723 deletions
diff --git a/gr-trellis/include/gnuradio/trellis/api.h b/gr-trellis/include/gnuradio/trellis/api.h index bdf5842864..a38720d3a3 100644 --- a/gr-trellis/include/gnuradio/trellis/api.h +++ b/gr-trellis/include/gnuradio/trellis/api.h @@ -25,9 +25,9 @@ #include <gnuradio/attributes.h> #ifdef gnuradio_trellis_EXPORTS -# define TRELLIS_API __GR_ATTR_EXPORT +#define TRELLIS_API __GR_ATTR_EXPORT #else -# define TRELLIS_API __GR_ATTR_IMPORT +#define TRELLIS_API __GR_ATTR_IMPORT #endif #endif /* INCLUDED_TRELLIS_API_H */ diff --git a/gr-trellis/include/gnuradio/trellis/base.h b/gr-trellis/include/gnuradio/trellis/base.h index c69500d0df..cbe668b4e4 100644 --- a/gr-trellis/include/gnuradio/trellis/base.h +++ b/gr-trellis/include/gnuradio/trellis/base.h @@ -26,18 +26,18 @@ #include <vector> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief change base - */ +/*! + * \brief change base + */ - bool dec2base(unsigned int num, int base, std::vector<int> &s); - bool dec2bases(unsigned int num, const std::vector<int> &bases, std::vector<int> &s); - unsigned int base2dec(const std::vector<int> &s, int base); - unsigned int bases2dec(const std::vector<int> &s, const std::vector<int> &bases); +bool dec2base(unsigned int num, int base, std::vector<int>& s); +bool dec2bases(unsigned int num, const std::vector<int>& bases, std::vector<int>& s); +unsigned int base2dec(const std::vector<int>& s, int base); +unsigned int bases2dec(const std::vector<int>& s, const std::vector<int>& bases); - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_BASE_H */ diff --git a/gr-trellis/include/gnuradio/trellis/calc_metric.h b/gr-trellis/include/gnuradio/trellis/calc_metric.h index c85fcbff69..053a9db9ce 100644 --- a/gr-trellis/include/gnuradio/trellis/calc_metric.h +++ b/gr-trellis/include/gnuradio/trellis/calc_metric.h @@ -28,27 +28,35 @@ #include <gnuradio/digital/metric_type.h> namespace gr { - namespace trellis { +namespace trellis { - template <class T> - void calc_metric(int O, int D, const std::vector<T> &TABLE, const T *input, - float *metric, digital::trellis_metric_type_t type); +template <class T> +void calc_metric(int O, + int D, + const std::vector<T>& TABLE, + const T* input, + float* metric, + digital::trellis_metric_type_t type); - /* - void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *input, - float *metric, digital::trellis_metric_type_t type); +/* + void calc_metric(int O, int D, const std::vector<short> &TABLE, const short *input, + float *metric, digital::trellis_metric_type_t type); - void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *input, - float *metric, digital::trellis_metric_type_t type); + void calc_metric(int O, int D, const std::vector<int> &TABLE, const int *input, + float *metric, digital::trellis_metric_type_t type); - void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *input, - float *metric, digital::trellis_metric_type_t type); - */ + void calc_metric(int O, int D, const std::vector<float> &TABLE, const float *input, + float *metric, digital::trellis_metric_type_t type); +*/ - void calc_metric(int O, int D, const std::vector<gr_complex> &TABLE, const gr_complex *input, - float *metric, digital::trellis_metric_type_t type); +void calc_metric(int O, + int D, + const std::vector<gr_complex>& TABLE, + const gr_complex* input, + float* metric, + digital::trellis_metric_type_t type); - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_CALC_METRIC_H */ diff --git a/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h b/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h index 01bfab0140..9dcac004b9 100644 --- a/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h +++ b/gr-trellis/include/gnuradio/trellis/constellation_metrics_cf.h @@ -29,23 +29,23 @@ #include <gnuradio/digital/metric_type.h> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup trellis_coding_blk - */ - class TRELLIS_API constellation_metrics_cf : virtual public block - { - public: - // gr::trellis::constellation_metrics_cf::sptr - typedef boost::shared_ptr<constellation_metrics_cf> sptr; +/*! + * \brief Evaluate metrics for use by the Viterbi algorithm. + * \ingroup trellis_coding_blk + */ +class TRELLIS_API constellation_metrics_cf : virtual public block +{ +public: + // gr::trellis::constellation_metrics_cf::sptr + typedef boost::shared_ptr<constellation_metrics_cf> sptr; - static sptr make(digital::constellation_sptr constellation, - digital::trellis_metric_type_t TYPE); - }; + static sptr make(digital::constellation_sptr constellation, + digital::trellis_metric_type_t TYPE); +}; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_CONSTELLATION_METRICS_CF_H */ diff --git a/gr-trellis/include/gnuradio/trellis/core_algorithms.h b/gr-trellis/include/gnuradio/trellis/core_algorithms.h index aedff120d8..ffd78c0fdb 100644 --- a/gr-trellis/include/gnuradio/trellis/core_algorithms.h +++ b/gr-trellis/include/gnuradio/trellis/core_algorithms.h @@ -30,95 +30,145 @@ #include <gnuradio/trellis/interleaver.h> namespace gr { - namespace trellis { +namespace trellis { - float min(float a, float b); - float min_star(float a, float b); +float min(float a, float b); +float min_star(float a, float b); - template <class T> - void viterbi_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - const float *in, T *out); +template <class T> +void viterbi_algorithm(int I, + int S, + int O, + const std::vector<int>& NS, + const std::vector<int>& OS, + const std::vector<std::vector<int>>& PS, + const std::vector<std::vector<int>>& PI, + int K, + int S0, + int SK, + const float* in, + T* out); - template <class Ti, class To> - void viterbi_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - int D, - const std::vector<Ti> &TABLE, - digital::trellis_metric_type_t TYPE, - const Ti *in, To *out); +template <class Ti, class To> +void viterbi_algorithm_combined(int I, + int S, + int O, + const std::vector<int>& NS, + const std::vector<int>& OS, + const std::vector<std::vector<int>>& PS, + const std::vector<std::vector<int>>& PI, + int K, + int S0, + int SK, + int D, + const std::vector<Ti>& TABLE, + digital::trellis_metric_type_t TYPE, + const Ti* in, + To* out); - void siso_algorithm(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - const float *priori, const float *prioro, float *post); +void siso_algorithm(int I, + int S, + int O, + const std::vector<int>& NS, + const std::vector<int>& OS, + const std::vector<std::vector<int>>& PS, + const std::vector<std::vector<int>>& PI, + int K, + int S0, + int SK, + bool POSTI, + bool POSTO, + float (*p2mymin)(float, float), + const float* priori, + const float* prioro, + float* post); - template <class T> - void siso_algorithm_combined(int I, int S, int O, - const std::vector<int> &NS, - const std::vector<int> &OS, - const std::vector< std::vector<int> > &PS, - const std::vector< std::vector<int> > &PI, - int K, - int S0,int SK, - bool POSTI, bool POSTO, - float (*p2mymin)(float,float), - int D, - const std::vector<T> &TABLE, - digital::trellis_metric_type_t TYPE, - const float *priori, const T *observations, float *post); +template <class T> +void siso_algorithm_combined(int I, + int S, + int O, + const std::vector<int>& NS, + const std::vector<int>& OS, + const std::vector<std::vector<int>>& PS, + const std::vector<std::vector<int>>& PI, + int K, + int S0, + int SK, + bool POSTI, + bool POSTO, + float (*p2mymin)(float, float), + int D, + const std::vector<T>& TABLE, + digital::trellis_metric_type_t TYPE, + const float* priori, + const T* observations, + float* post); - template<class T> - void sccc_decoder(const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *iprioro, T *data); +template <class T> +void sccc_decoder(const fsm& FSMo, + int STo0, + int SToK, + const fsm& FSMi, + int STi0, + int STiK, + const interleaver& INTERLEAVER, + int blocklength, + int iterations, + float (*p2mymin)(float, float), + const float* iprioro, + T* data); - template<class Ti, class To> - void sccc_decoder_combined(const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<Ti> &TABLE, - digital::trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data); +template <class Ti, class To> +void sccc_decoder_combined(const fsm& FSMo, + int STo0, + int SToK, + const fsm& FSMi, + int STi0, + int STiK, + const interleaver& INTERLEAVER, + int blocklength, + int iterations, + float (*p2mymin)(float, float), + int D, + const std::vector<Ti>& TABLE, + digital::trellis_metric_type_t METRIC_TYPE, + float scaling, + const Ti* observations, + To* data); - template<class T> - void pccc_decoder(const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - const float *cprioro, T *data); +template <class T> +void pccc_decoder(const fsm& FSM1, + int ST10, + int ST1K, + const fsm& FSM2, + int ST20, + int ST2K, + const interleaver& INTERLEAVER, + int blocklength, + int iterations, + float (*p2mymin)(float, float), + const float* cprioro, + T* data); - template<class Ti, class To> - void pccc_decoder_combined(const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, int blocklength, int iterations, - float (*p2mymin)(float,float), - int D, const std::vector<Ti> &TABLE, - digital::trellis_metric_type_t METRIC_TYPE, - float scaling, - const Ti *observations, To *data); +template <class Ti, class To> +void pccc_decoder_combined(const fsm& FSM1, + int ST10, + int ST1K, + const fsm& FSM2, + int ST20, + int ST2K, + const interleaver& INTERLEAVER, + int blocklength, + int iterations, + float (*p2mymin)(float, float), + int D, + const std::vector<Ti>& TABLE, + digital::trellis_metric_type_t METRIC_TYPE, + float scaling, + const Ti* observations, + To* data); - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_CORE_ALGORITHMS_H */ diff --git a/gr-trellis/include/gnuradio/trellis/encoder.h b/gr-trellis/include/gnuradio/trellis/encoder.h index 5f022f2a01..15c64063b1 100644 --- a/gr-trellis/include/gnuradio/trellis/encoder.h +++ b/gr-trellis/include/gnuradio/trellis/encoder.h @@ -29,37 +29,37 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief Convolutional encoder. - * \ingroup trellis_coding_blk - */ - template <class IN_T, class OUT_T> - class TRELLIS_API encoder : virtual public sync_block - { - public: - typedef boost::shared_ptr< encoder<IN_T,OUT_T> > sptr; +/*! + * \brief Convolutional encoder. + * \ingroup trellis_coding_blk + */ +template <class IN_T, class OUT_T> +class TRELLIS_API encoder : virtual public sync_block +{ +public: + typedef boost::shared_ptr<encoder<IN_T, OUT_T>> sptr; - static sptr make(const fsm &FSM, int ST); + static sptr make(const fsm& FSM, int ST); - static sptr make(const fsm &FSM, int ST, int K); + static sptr make(const fsm& FSM, int ST, int K); - virtual fsm FSM() const = 0; - virtual int ST() const = 0; - virtual int K() const = 0; - virtual void set_FSM(const fsm &FSM) =0; - virtual void set_ST(int ST) =0; - virtual void set_K(int K) =0; - }; - typedef encoder<std::uint8_t, std::uint8_t> encoder_bb; - typedef encoder<std::uint8_t, std::int16_t> encoder_bs; - typedef encoder<std::uint8_t, std::int32_t> encoder_bi; - typedef encoder<std::int16_t, std::int16_t> encoder_ss; - typedef encoder<std::int16_t, std::int32_t> encoder_si; - typedef encoder<std::int32_t, std::int32_t> encoder_ii; + virtual fsm FSM() const = 0; + virtual int ST() const = 0; + virtual int K() const = 0; + virtual void set_FSM(const fsm& FSM) = 0; + virtual void set_ST(int ST) = 0; + virtual void set_K(int K) = 0; +}; +typedef encoder<std::uint8_t, std::uint8_t> encoder_bb; +typedef encoder<std::uint8_t, std::int16_t> encoder_bs; +typedef encoder<std::uint8_t, std::int32_t> encoder_bi; +typedef encoder<std::int16_t, std::int16_t> encoder_ss; +typedef encoder<std::int16_t, std::int32_t> encoder_si; +typedef encoder<std::int32_t, std::int32_t> encoder_ii; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* ENCODER_H */ diff --git a/gr-trellis/include/gnuradio/trellis/fsm.h b/gr-trellis/include/gnuradio/trellis/fsm.h index 672a33403a..6ce9cec0ea 100644 --- a/gr-trellis/include/gnuradio/trellis/fsm.h +++ b/gr-trellis/include/gnuradio/trellis/fsm.h @@ -28,176 +28,178 @@ #include <iosfwd> namespace gr { - namespace trellis { +namespace trellis { + +/*! + * \brief Finite State Machine Specification class. + * \ingroup trellis_coding_blk + * + * \details + * An instance of this class represents a finite state machine + * specification (FSMS) rather than the FSM itself. It particular + * the state of the FSM is not stored within an instance of this + * class. + */ +class TRELLIS_API fsm +{ +private: + // Input alphabet cardinality. + int d_I; + + // Number of states. + int d_S; + + // Output alphabet cardinality. + int d_O; + + // NS means Next State. + // next_state = d_NS[current_state * d_I + input_symbol] + std::vector<int> d_NS; + + // OS means Output Symbol. + // output_symbol = d_OS[current_state * d_I + input_symbol] + std::vector<int> d_OS; + + // PS means Previous State. + std::vector<std::vector<int>> d_PS; + + // PI means Previous Input Symbol. + // d_PS[current_state][k] and d_PI[current_state][k], is a pair of the form + // (previous_state, previous_input_symbol) that could have produced the + // current state. + std::vector<std::vector<int>> d_PI; + + // TM means Termination matrix. + // d_TMl[s*d_S+es] is the shortest number of steps to get from state s to + // state es. + std::vector<int> d_TMl; + + // d_TMi[s*d_S+es] is the input symbol required to set off on the shortest + // path from state s to es. + std::vector<int> d_TMi; + void generate_PS_PI(); + void generate_TM(); + bool find_es(int es); + +public: + /*! + * \brief Constructor to create an uninitialized FSMS. + */ + fsm(); + + /*! + * \brief Constructor to copy an FSMS. + */ + fsm(const fsm& FSM); + + /*! + * \brief Constructor to to create an FSMS. + * + * \param I The number of possible input symbols. + * \param S The number of possible FSM states. + * \param O The number of possible output symbols. + * \param NS A mapping from (current state, input symbol) to next state. + * next_state = NS[current_state * I + input_symbol] + * \param OS A mapping from (current state, input symbol) to output symbol. + * output_symbol = OS[current_state * I + input_symbol] + * + */ + fsm(int I, int S, int O, const std::vector<int>& NS, const std::vector<int>& OS); /*! - * \brief Finite State Machine Specification class. - * \ingroup trellis_coding_blk + * \brief Constructor to create an FSMS from file contents. + * + * \param name filename * - * \details - * An instance of this class represents a finite state machine - * specification (FSMS) rather than the FSM itself. It particular - * the state of the FSM is not stored within an instance of this - * class. */ - class TRELLIS_API fsm - { - private: - // Input alphabet cardinality. - int d_I; - - // Number of states. - int d_S; - - // Output alphabet cardinality. - int d_O; - - // NS means Next State. - // next_state = d_NS[current_state * d_I + input_symbol] - std::vector<int> d_NS; - - // OS means Output Symbol. - // output_symbol = d_OS[current_state * d_I + input_symbol] - std::vector<int> d_OS; - - // PS means Previous State. - std::vector< std::vector<int> > d_PS; - - // PI means Previous Input Symbol. - // d_PS[current_state][k] and d_PI[current_state][k], is a pair of the form - // (previous_state, previous_input_symbol) that could have produced the - // current state. - std::vector< std::vector<int> > d_PI; - - // TM means Termination matrix. - // d_TMl[s*d_S+es] is the shortest number of steps to get from state s to - // state es. - std::vector<int> d_TMl; - - // d_TMi[s*d_S+es] is the input symbol required to set off on the shortest - // path from state s to es. - std::vector<int> d_TMi; - void generate_PS_PI (); - void generate_TM (); - bool find_es(int es); - - public: - /*! - * \brief Constructor to create an uninitialized FSMS. - */ - fsm(); - - /*! - * \brief Constructor to copy an FSMS. - */ - fsm(const fsm &FSM); - - /*! - * \brief Constructor to to create an FSMS. - * - * \param I The number of possible input symbols. - * \param S The number of possible FSM states. - * \param O The number of possible output symbols. - * \param NS A mapping from (current state, input symbol) to next state. - * next_state = NS[current_state * I + input_symbol] - * \param OS A mapping from (current state, input symbol) to output symbol. - * output_symbol = OS[current_state * I + input_symbol] - * - */ - fsm(int I, int S, int O, const std::vector<int> &NS, const std::vector<int> &OS); - - /*! - * \brief Constructor to create an FSMS from file contents. - * - * \param name filename - * - */ - fsm(const char *name); - - /*! - * \brief Creates an FSMS from the generator matrix of a (n, k) binary convolutional code. - * - * \param k ??? - * \param n ??? - * \param G ??? - * - */ - fsm(int k, int n, const std::vector<int> &G); - - /*! - * \brief Creates an FSMS describing ISI. - * - * \param mod_size modulation size - * \param ch_length channel length - * - */ - fsm(int mod_size, int ch_length); - - /*! - * \brief Creates an FSMS describing the trellis for a CPM. - * - * \param P ???? h=K/P (relatively prime) - * \param M alphabet size - * \param L pulse duration - * - * This FSM is based on the paper by B. Rimoldi - * "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988 - * See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf - */ - fsm(int P, int M, int L); - - /*! - * \brief Creates an FSMS describing the joint trellis of two FSMs. - * - * \param FSM1 first FSMS - * \param FSM2 second FSMS - */ - fsm(const fsm &FSM1, const fsm &FSM2); - - - /*! - * \brief Creates an FSMS describing the trellis of two serially concatenated FSMs. - * - * \param FSMo outer FSMS - * \param FSMi inner FSMS - * \param serial set it to true to distinguish from the previous constructor - */ - fsm(const fsm &FSMo, const fsm &FSMi, bool serial); - - /*! - * \brief Creates an FSMS representing n stages through the original FSM (AKA radix-n FSM). - * - * \param FSM Original FSMs - * \param n Number of stages. - */ - fsm(const fsm &FSM, int n); - int I() const { return d_I; } - int S() const { return d_S; } - int O() const { return d_O; } - const std::vector<int> & NS() const { return d_NS; } - const std::vector<int> & OS() const { return d_OS; } - const std::vector< std::vector<int> > & PS() const { return d_PS; } - const std::vector< std::vector<int> > & PI() const { return d_PI; } - const std::vector<int> & TMi() const { return d_TMi; } - const std::vector<int> & TMl() const { return d_TMl; } - - /*! - * \brief Creates an svg image of the trellis representation. - * - * \param filename filename - * \param number_stages ???? - */ - void write_trellis_svg(std::string filename ,int number_stages); - - /*! - * \brief Write the FSMS to a file. - * - * \param filename filename - */ - void write_fsm_txt(std::string filename); - }; - - } /* namespace trellis */ + fsm(const char* name); + + /*! + * \brief Creates an FSMS from the generator matrix of a (n, k) binary convolutional + * code. + * + * \param k ??? + * \param n ??? + * \param G ??? + * + */ + fsm(int k, int n, const std::vector<int>& G); + + /*! + * \brief Creates an FSMS describing ISI. + * + * \param mod_size modulation size + * \param ch_length channel length + * + */ + fsm(int mod_size, int ch_length); + + /*! + * \brief Creates an FSMS describing the trellis for a CPM. + * + * \param P ???? h=K/P (relatively prime) + * \param M alphabet size + * \param L pulse duration + * + * This FSM is based on the paper by B. Rimoldi + * "A decomposition approach to CPM", IEEE Trans. Info Theory, March 1988 + * See also my own notes at http://www.eecs.umich.edu/~anastas/docs/cpm.pdf + */ + fsm(int P, int M, int L); + + /*! + * \brief Creates an FSMS describing the joint trellis of two FSMs. + * + * \param FSM1 first FSMS + * \param FSM2 second FSMS + */ + fsm(const fsm& FSM1, const fsm& FSM2); + + + /*! + * \brief Creates an FSMS describing the trellis of two serially concatenated FSMs. + * + * \param FSMo outer FSMS + * \param FSMi inner FSMS + * \param serial set it to true to distinguish from the previous constructor + */ + fsm(const fsm& FSMo, const fsm& FSMi, bool serial); + + /*! + * \brief Creates an FSMS representing n stages through the original FSM (AKA radix-n + * FSM). + * + * \param FSM Original FSMs + * \param n Number of stages. + */ + fsm(const fsm& FSM, int n); + int I() const { return d_I; } + int S() const { return d_S; } + int O() const { return d_O; } + const std::vector<int>& NS() const { return d_NS; } + const std::vector<int>& OS() const { return d_OS; } + const std::vector<std::vector<int>>& PS() const { return d_PS; } + const std::vector<std::vector<int>>& PI() const { return d_PI; } + const std::vector<int>& TMi() const { return d_TMi; } + const std::vector<int>& TMl() const { return d_TMl; } + + /*! + * \brief Creates an svg image of the trellis representation. + * + * \param filename filename + * \param number_stages ???? + */ + void write_trellis_svg(std::string filename, int number_stages); + + /*! + * \brief Write the FSMS to a file. + * + * \param filename filename + */ + void write_fsm_txt(std::string filename); +}; + +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_FSM_H */ diff --git a/gr-trellis/include/gnuradio/trellis/interleaver.h b/gr-trellis/include/gnuradio/trellis/interleaver.h index 9e30c75e95..caf0f80a09 100644 --- a/gr-trellis/include/gnuradio/trellis/interleaver.h +++ b/gr-trellis/include/gnuradio/trellis/interleaver.h @@ -28,32 +28,32 @@ #include <string> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief INTERLEAVER class - * \ingroup trellis_coding_blk - */ - class TRELLIS_API interleaver - { - private: - unsigned int d_K; - std::vector<int> d_INTER; - std::vector<int> d_DEINTER; +/*! + * \brief INTERLEAVER class + * \ingroup trellis_coding_blk + */ +class TRELLIS_API interleaver +{ +private: + unsigned int d_K; + std::vector<int> d_INTER; + std::vector<int> d_DEINTER; - public: - interleaver(); - interleaver(const interleaver & INTERLEAVER); - interleaver(unsigned int K, const std::vector<int> & INTER); - interleaver(const char *name); - interleaver(unsigned int K, int seed); - unsigned int K () const { return d_K; } - const std::vector<int> & INTER() const { return d_INTER; } - const std::vector<int> & DEINTER() const { return d_DEINTER; } - void write_interleaver_txt(std::string filename); - }; +public: + interleaver(); + interleaver(const interleaver& INTERLEAVER); + interleaver(unsigned int K, const std::vector<int>& INTER); + interleaver(const char* name); + interleaver(unsigned int K, int seed); + unsigned int K() const { return d_K; } + const std::vector<int>& INTER() const { return d_INTER; } + const std::vector<int>& DEINTER() const { return d_DEINTER; } + void write_interleaver_txt(std::string filename); +}; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_INTERLEAVER_H */ diff --git a/gr-trellis/include/gnuradio/trellis/metrics.h b/gr-trellis/include/gnuradio/trellis/metrics.h index e2ca32222a..b9af40a25c 100644 --- a/gr-trellis/include/gnuradio/trellis/metrics.h +++ b/gr-trellis/include/gnuradio/trellis/metrics.h @@ -30,39 +30,39 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief Evaluate metrics for use by the Viterbi algorithm. - * \ingroup trellis_coding_blk - */ -template<class T> - class TRELLIS_API metrics : virtual public block - { - public: - // gr::trellis::metrics::sptr - typedef boost::shared_ptr< metrics<T> > sptr; +/*! + * \brief Evaluate metrics for use by the Viterbi algorithm. + * \ingroup trellis_coding_blk + */ +template <class T> +class TRELLIS_API metrics : virtual public block +{ +public: + // gr::trellis::metrics::sptr + typedef boost::shared_ptr<metrics<T>> sptr; - static sptr make(int O, int D, const std::vector<T> &TABLE, - digital::trellis_metric_type_t TYPE); + static sptr + make(int O, int D, const std::vector<T>& TABLE, digital::trellis_metric_type_t TYPE); - virtual int O() const = 0; - virtual int D() const = 0; - virtual digital::trellis_metric_type_t TYPE() const = 0; - virtual std::vector<T> TABLE() const = 0; + virtual int O() const = 0; + virtual int D() const = 0; + virtual digital::trellis_metric_type_t TYPE() const = 0; + virtual std::vector<T> TABLE() const = 0; - virtual void set_O(int O) = 0; - virtual void set_D(int D) = 0; - virtual void set_TYPE(digital::trellis_metric_type_t type) = 0; - virtual void set_TABLE(const std::vector<T> &table) = 0; - }; + virtual void set_O(int O) = 0; + virtual void set_D(int D) = 0; + virtual void set_TYPE(digital::trellis_metric_type_t type) = 0; + virtual void set_TABLE(const std::vector<T>& table) = 0; +}; typedef metrics<std::int16_t> metrics_s; typedef metrics<std::int32_t> metrics_i; typedef metrics<float> metrics_f; typedef metrics<gr_complex> metrics_c; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* METRICS_H */ diff --git a/gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h b/gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h index 8684f33f03..b6ed61ec33 100644 --- a/gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h +++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_blk.h @@ -33,41 +33,45 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ -template<class T> - class TRELLIS_API pccc_decoder_blk : virtual public block - { - public: - // gr::trellis::pccc_decoder_blk::sptr - typedef boost::shared_ptr< pccc_decoder_blk<T> > sptr; +/*! + * \ingroup trellis_coding_blk + */ +template <class T> +class TRELLIS_API pccc_decoder_blk : virtual public block +{ +public: + // gr::trellis::pccc_decoder_blk::sptr + typedef boost::shared_ptr<pccc_decoder_blk<T>> sptr; - static sptr make(const fsm &FSM1, int ST10, int ST1K, - const fsm &FSM2, int ST20, int ST2K, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - siso_type_t SISO_TYPE); + static sptr make(const fsm& FSM1, + int ST10, + int ST1K, + const fsm& FSM2, + int ST20, + int ST2K, + const interleaver& INTERLEAVER, + int blocklength, + int repetitions, + siso_type_t SISO_TYPE); - virtual fsm FSM1() const = 0; - virtual fsm FSM2() const = 0; - virtual int ST10() const = 0; - virtual int ST1K() const = 0; - virtual int ST20() const = 0; - virtual int ST2K() const = 0; - virtual interleaver INTERLEAVER() const = 0; - virtual int blocklength() const = 0; - virtual int repetitions() const = 0; - virtual siso_type_t SISO_TYPE() const = 0; - }; + virtual fsm FSM1() const = 0; + virtual fsm FSM2() const = 0; + virtual int ST10() const = 0; + virtual int ST1K() const = 0; + virtual int ST20() const = 0; + virtual int ST2K() const = 0; + virtual interleaver INTERLEAVER() const = 0; + virtual int blocklength() const = 0; + virtual int repetitions() const = 0; + virtual siso_type_t SISO_TYPE() const = 0; +}; typedef pccc_decoder_blk<std::uint8_t> pccc_decoder_b; typedef pccc_decoder_blk<std::int16_t> pccc_decoder_s; typedef pccc_decoder_blk<std::int32_t> pccc_decoder_i; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* PCCC_DECODER_BLK_H */ diff --git a/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h index e09c08f3bc..0bb9188558 100644 --- a/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h +++ b/gr-trellis/include/gnuradio/trellis/pccc_decoder_combined_blk.h @@ -33,53 +33,57 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ - template <class IN_T,class OUT_T> - class TRELLIS_API pccc_decoder_combined_blk : virtual public block - { - public: - typedef boost::shared_ptr< pccc_decoder_combined_blk<IN_T,OUT_T> > sptr; +/*! + * \ingroup trellis_coding_blk + */ +template <class IN_T, class OUT_T> +class TRELLIS_API pccc_decoder_combined_blk : virtual public block +{ +public: + typedef boost::shared_ptr<pccc_decoder_combined_blk<IN_T, OUT_T>> sptr; - static sptr make(const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - siso_type_t SISO_TYPE, - int D, - const std::vector<IN_T> &TABLE, - digital::trellis_metric_type_t METRIC_TYPE, - float scaling); + static sptr make(const fsm& FSMo, + int STo0, + int SToK, + const fsm& FSMi, + int STi0, + int STiK, + const interleaver& INTERLEAVER, + int blocklength, + int repetitions, + siso_type_t SISO_TYPE, + int D, + const std::vector<IN_T>& TABLE, + digital::trellis_metric_type_t METRIC_TYPE, + float scaling); - virtual fsm FSM1() const = 0; - virtual fsm FSM2() const = 0; - virtual int ST10() const = 0; - virtual int ST1K() const = 0; - virtual int ST20() const = 0; - virtual int ST2K() const = 0; - virtual interleaver INTERLEAVER() const = 0; - virtual int blocklength() const = 0; - virtual int repetitions() const = 0; - virtual int D() const = 0; - virtual std::vector<IN_T> TABLE() const = 0; - virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0; - virtual siso_type_t SISO_TYPE() const = 0; - virtual float scaling() const = 0; - virtual void set_scaling(float scaling) = 0; - }; + virtual fsm FSM1() const = 0; + virtual fsm FSM2() const = 0; + virtual int ST10() const = 0; + virtual int ST1K() const = 0; + virtual int ST20() const = 0; + virtual int ST2K() const = 0; + virtual interleaver INTERLEAVER() const = 0; + virtual int blocklength() const = 0; + virtual int repetitions() const = 0; + virtual int D() const = 0; + virtual std::vector<IN_T> TABLE() const = 0; + virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0; + virtual siso_type_t SISO_TYPE() const = 0; + virtual float scaling() const = 0; + virtual void set_scaling(float scaling) = 0; +}; - typedef pccc_decoder_combined_blk<float, std::uint8_t> pccc_decoder_combined_fb; - typedef pccc_decoder_combined_blk<float, std::int16_t> pccc_decoder_combined_fs; - typedef pccc_decoder_combined_blk<float, std::int32_t> pccc_decoder_combined_fi; - typedef pccc_decoder_combined_blk<gr_complex, std::uint8_t> pccc_decoder_combined_cb; - typedef pccc_decoder_combined_blk<gr_complex, std::int16_t> pccc_decoder_combined_cs; - typedef pccc_decoder_combined_blk<gr_complex, std::int32_t> pccc_decoder_combined_ci; +typedef pccc_decoder_combined_blk<float, std::uint8_t> pccc_decoder_combined_fb; +typedef pccc_decoder_combined_blk<float, std::int16_t> pccc_decoder_combined_fs; +typedef pccc_decoder_combined_blk<float, std::int32_t> pccc_decoder_combined_fi; +typedef pccc_decoder_combined_blk<gr_complex, std::uint8_t> pccc_decoder_combined_cb; +typedef pccc_decoder_combined_blk<gr_complex, std::int16_t> pccc_decoder_combined_cs; +typedef pccc_decoder_combined_blk<gr_complex, std::int32_t> pccc_decoder_combined_ci; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* PCCC_DECODER_COMBINED_BLK_H */ diff --git a/gr-trellis/include/gnuradio/trellis/pccc_encoder.h b/gr-trellis/include/gnuradio/trellis/pccc_encoder.h index 6f3ee25170..b4bb269404 100644 --- a/gr-trellis/include/gnuradio/trellis/pccc_encoder.h +++ b/gr-trellis/include/gnuradio/trellis/pccc_encoder.h @@ -31,39 +31,41 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief PCCC encoder. - * \ingroup trellis_coding_blk - */ - template <class IN_T, class OUT_T> - class TRELLIS_API pccc_encoder : virtual public sync_block - { - public: - typedef boost::shared_ptr<pccc_encoder<IN_T,OUT_T>> sptr; +/*! + * \brief PCCC encoder. + * \ingroup trellis_coding_blk + */ +template <class IN_T, class OUT_T> +class TRELLIS_API pccc_encoder : virtual public sync_block +{ +public: + typedef boost::shared_ptr<pccc_encoder<IN_T, OUT_T>> sptr; - static sptr make(const fsm &FSM1, int ST1, - const fsm &FSM2, int ST2, - const interleaver &INTERLEAVER, - int blocklength); + static sptr make(const fsm& FSM1, + int ST1, + const fsm& FSM2, + int ST2, + const interleaver& INTERLEAVER, + int blocklength); - virtual fsm FSM1() const = 0; - virtual int ST1() const = 0; - virtual fsm FSM2() const = 0; - virtual int ST2() const = 0; - virtual interleaver INTERLEAVER() const = 0; - virtual int blocklength() const = 0; - }; - typedef pccc_encoder<std::uint8_t, std::uint8_t> pccc_encoder_bb; - typedef pccc_encoder<std::uint8_t, std::int16_t> pccc_encoder_bs; - typedef pccc_encoder<std::uint8_t, std::int32_t> pccc_encoder_bi; - typedef pccc_encoder<std::int16_t, std::int16_t> pccc_encoder_ss; - typedef pccc_encoder<std::int16_t, std::int32_t> pccc_encoder_si; - typedef pccc_encoder<std::int32_t, std::int32_t> pccc_encoder_ii; + virtual fsm FSM1() const = 0; + virtual int ST1() const = 0; + virtual fsm FSM2() const = 0; + virtual int ST2() const = 0; + virtual interleaver INTERLEAVER() const = 0; + virtual int blocklength() const = 0; +}; +typedef pccc_encoder<std::uint8_t, std::uint8_t> pccc_encoder_bb; +typedef pccc_encoder<std::uint8_t, std::int16_t> pccc_encoder_bs; +typedef pccc_encoder<std::uint8_t, std::int32_t> pccc_encoder_bi; +typedef pccc_encoder<std::int16_t, std::int16_t> pccc_encoder_ss; +typedef pccc_encoder<std::int16_t, std::int32_t> pccc_encoder_si; +typedef pccc_encoder<std::int32_t, std::int32_t> pccc_encoder_ii; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* PCCC_ENCODER_H */ diff --git a/gr-trellis/include/gnuradio/trellis/permutation.h b/gr-trellis/include/gnuradio/trellis/permutation.h index 5c86f3c9a7..22c586c504 100644 --- a/gr-trellis/include/gnuradio/trellis/permutation.h +++ b/gr-trellis/include/gnuradio/trellis/permutation.h @@ -28,33 +28,32 @@ #include <gnuradio/sync_block.h> namespace gr { - namespace trellis { - - /*! - * \brief Permutation. - * \ingroup trellis_coding_blk - */ - class TRELLIS_API permutation : virtual public sync_block - { - public: - // gr::trellis::permutation::sptr - typedef boost::shared_ptr<permutation> sptr; - - static sptr make(int K, const std::vector<int> &TABLE, - int SYMS_PER_BLOCK, size_t NBYTES); - - virtual int K() const = 0; - virtual std::vector<int> TABLE() const = 0; - virtual int SYMS_PER_BLOCK() const = 0; - virtual size_t BYTES_PER_SYMBOL() const = 0; - - virtual void set_K(int K) =0; - virtual void set_TABLE (const std::vector<int> &table) = 0; - virtual void set_SYMS_PER_BLOCK(int spb) =0; - - }; - - } /* namespace trellis */ +namespace trellis { + +/*! + * \brief Permutation. + * \ingroup trellis_coding_blk + */ +class TRELLIS_API permutation : virtual public sync_block +{ +public: + // gr::trellis::permutation::sptr + typedef boost::shared_ptr<permutation> sptr; + + static sptr + make(int K, const std::vector<int>& TABLE, int SYMS_PER_BLOCK, size_t NBYTES); + + virtual int K() const = 0; + virtual std::vector<int> TABLE() const = 0; + virtual int SYMS_PER_BLOCK() const = 0; + virtual size_t BYTES_PER_SYMBOL() const = 0; + + virtual void set_K(int K) = 0; + virtual void set_TABLE(const std::vector<int>& table) = 0; + virtual void set_SYMS_PER_BLOCK(int spb) = 0; +}; + +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_PERMUTATION_H */ diff --git a/gr-trellis/include/gnuradio/trellis/quicksort_index.h b/gr-trellis/include/gnuradio/trellis/quicksort_index.h index 402962172a..030daa911e 100644 --- a/gr-trellis/include/gnuradio/trellis/quicksort_index.h +++ b/gr-trellis/include/gnuradio/trellis/quicksort_index.h @@ -26,16 +26,15 @@ #include <vector> namespace gr { - namespace trellis { +namespace trellis { - template <class T> - void SWAP(T &a, T &b); +template <class T> +void SWAP(T& a, T& b); - template <class T> - void quicksort_index(std::vector<T> &p, std::vector<int> &index, - int left, int right); +template <class T> +void quicksort_index(std::vector<T>& p, std::vector<int>& index, int left, int right); - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_QUICKSORT_INDEX_H */ diff --git a/gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h b/gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h index 48b90dc927..1728199d88 100644 --- a/gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h +++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_blk.h @@ -33,41 +33,45 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ -template<class T> - class TRELLIS_API sccc_decoder_blk : virtual public block - { - public: - // gr::trellis::sccc_decoder_blk::sptr - typedef boost::shared_ptr< sccc_decoder_blk<T> > sptr; +/*! + * \ingroup trellis_coding_blk + */ +template <class T> +class TRELLIS_API sccc_decoder_blk : virtual public block +{ +public: + // gr::trellis::sccc_decoder_blk::sptr + typedef boost::shared_ptr<sccc_decoder_blk<T>> sptr; - static sptr make(const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - siso_type_t SISO_TYPE); + static sptr make(const fsm& FSMo, + int STo0, + int SToK, + const fsm& FSMi, + int STi0, + int STiK, + const interleaver& INTERLEAVER, + int blocklength, + int repetitions, + siso_type_t SISO_TYPE); - virtual fsm FSMo() const = 0; - virtual fsm FSMi() const = 0; - virtual int STo0() const = 0; - virtual int SToK() const = 0; - virtual int STi0() const = 0; - virtual int STiK() const = 0; - virtual interleaver INTERLEAVER() const = 0; - virtual int blocklength() const = 0; - virtual int repetitions() const = 0; - virtual siso_type_t SISO_TYPE() const = 0; - }; + virtual fsm FSMo() const = 0; + virtual fsm FSMi() const = 0; + virtual int STo0() const = 0; + virtual int SToK() const = 0; + virtual int STi0() const = 0; + virtual int STiK() const = 0; + virtual interleaver INTERLEAVER() const = 0; + virtual int blocklength() const = 0; + virtual int repetitions() const = 0; + virtual siso_type_t SISO_TYPE() const = 0; +}; typedef sccc_decoder_blk<std::uint8_t> sccc_decoder_b; typedef sccc_decoder_blk<std::int16_t> sccc_decoder_s; typedef sccc_decoder_blk<std::int32_t> sccc_decoder_i; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* SCCC_DECODER_BLK_H */ diff --git a/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h index cfec71e981..177f4e2077 100644 --- a/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h +++ b/gr-trellis/include/gnuradio/trellis/sccc_decoder_combined_blk.h @@ -33,54 +33,58 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ - template <class IN_T,class OUT_T> - class TRELLIS_API sccc_decoder_combined_blk : virtual public block - { - public: - typedef boost::shared_ptr< sccc_decoder_combined_blk<IN_T,OUT_T> > sptr; +/*! + * \ingroup trellis_coding_blk + */ +template <class IN_T, class OUT_T> +class TRELLIS_API sccc_decoder_combined_blk : virtual public block +{ +public: + typedef boost::shared_ptr<sccc_decoder_combined_blk<IN_T, OUT_T>> sptr; - static sptr make(const fsm &FSMo, int STo0, int SToK, - const fsm &FSMi, int STi0, int STiK, - const interleaver &INTERLEAVER, - int blocklength, - int repetitions, - siso_type_t SISO_TYPE, - int D, - const std::vector<IN_T> &TABLE, - digital::trellis_metric_type_t METRIC_TYPE, - float scaling); + static sptr make(const fsm& FSMo, + int STo0, + int SToK, + const fsm& FSMi, + int STi0, + int STiK, + const interleaver& INTERLEAVER, + int blocklength, + int repetitions, + siso_type_t SISO_TYPE, + int D, + const std::vector<IN_T>& TABLE, + digital::trellis_metric_type_t METRIC_TYPE, + float scaling); - virtual fsm FSMo() const = 0; - virtual fsm FSMi() const = 0; - virtual int STo0() const = 0; - virtual int SToK() const = 0; - virtual int STi0() const = 0; - virtual int STiK() const = 0; - virtual interleaver INTERLEAVER() const = 0; - virtual int blocklength() const = 0; - virtual int repetitions() const = 0; - virtual int D() const = 0; - virtual std::vector<IN_T> TABLE() const = 0; - virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0; - virtual siso_type_t SISO_TYPE() const = 0; - virtual float scaling() const = 0; + virtual fsm FSMo() const = 0; + virtual fsm FSMi() const = 0; + virtual int STo0() const = 0; + virtual int SToK() const = 0; + virtual int STi0() const = 0; + virtual int STiK() const = 0; + virtual interleaver INTERLEAVER() const = 0; + virtual int blocklength() const = 0; + virtual int repetitions() const = 0; + virtual int D() const = 0; + virtual std::vector<IN_T> TABLE() const = 0; + virtual digital::trellis_metric_type_t METRIC_TYPE() const = 0; + virtual siso_type_t SISO_TYPE() const = 0; + virtual float scaling() const = 0; - virtual void set_scaling(float scaling) = 0; - }; + virtual void set_scaling(float scaling) = 0; +}; - typedef sccc_decoder_combined_blk<float, std::uint8_t> sccc_decoder_combined_fb; - typedef sccc_decoder_combined_blk<float, std::int16_t> sccc_decoder_combined_fs; - typedef sccc_decoder_combined_blk<float, std::int32_t> sccc_decoder_combined_fi; - typedef sccc_decoder_combined_blk<gr_complex, std::uint8_t> sccc_decoder_combined_cb; - typedef sccc_decoder_combined_blk<gr_complex, std::int16_t> sccc_decoder_combined_cs; - typedef sccc_decoder_combined_blk<gr_complex, std::int32_t> sccc_decoder_combined_ci; +typedef sccc_decoder_combined_blk<float, std::uint8_t> sccc_decoder_combined_fb; +typedef sccc_decoder_combined_blk<float, std::int16_t> sccc_decoder_combined_fs; +typedef sccc_decoder_combined_blk<float, std::int32_t> sccc_decoder_combined_fi; +typedef sccc_decoder_combined_blk<gr_complex, std::uint8_t> sccc_decoder_combined_cb; +typedef sccc_decoder_combined_blk<gr_complex, std::int16_t> sccc_decoder_combined_cs; +typedef sccc_decoder_combined_blk<gr_complex, std::int32_t> sccc_decoder_combined_ci; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* SCCC_DECODER_COMBINED_H */ diff --git a/gr-trellis/include/gnuradio/trellis/sccc_encoder.h b/gr-trellis/include/gnuradio/trellis/sccc_encoder.h index 394cce50de..8506fd7c21 100644 --- a/gr-trellis/include/gnuradio/trellis/sccc_encoder.h +++ b/gr-trellis/include/gnuradio/trellis/sccc_encoder.h @@ -30,38 +30,40 @@ #include <vector> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \brief SCCC encoder. - * \ingroup trellis_coding_blk - */ - template <class IN_T, class OUT_T> - class TRELLIS_API sccc_encoder : virtual public sync_block - { - public: - typedef boost::shared_ptr< sccc_encoder<IN_T,OUT_T> > sptr; +/*! + * \brief SCCC encoder. + * \ingroup trellis_coding_blk + */ +template <class IN_T, class OUT_T> +class TRELLIS_API sccc_encoder : virtual public sync_block +{ +public: + typedef boost::shared_ptr<sccc_encoder<IN_T, OUT_T>> sptr; - static sptr make(const fsm &FSMo, int STo, - const fsm &FSMi, int STi, - const interleaver &INTERLEAVER, - int blocklength); + static sptr make(const fsm& FSMo, + int STo, + const fsm& FSMi, + int STi, + const interleaver& INTERLEAVER, + int blocklength); - virtual fsm FSMo() const = 0; - virtual int STo() const = 0; - virtual fsm FSMi() const = 0; - virtual int STi() const = 0; - virtual interleaver INTERLEAVER() const = 0; - virtual int blocklength() const = 0; - }; - typedef sccc_encoder<std::uint8_t, std::uint8_t> sccc_encoder_bb; - typedef sccc_encoder<std::uint8_t, std::int16_t> sccc_encoder_bs; - typedef sccc_encoder<std::uint8_t, std::int32_t> sccc_encoder_bi; - typedef sccc_encoder<std::int16_t, std::int16_t> sccc_encoder_ss; - typedef sccc_encoder<std::uint8_t, std::int32_t> sccc_encoder_si; - typedef sccc_encoder<std::int32_t, std::int32_t> sccc_encoder_ii; + virtual fsm FSMo() const = 0; + virtual int STo() const = 0; + virtual fsm FSMi() const = 0; + virtual int STi() const = 0; + virtual interleaver INTERLEAVER() const = 0; + virtual int blocklength() const = 0; +}; +typedef sccc_encoder<std::uint8_t, std::uint8_t> sccc_encoder_bb; +typedef sccc_encoder<std::uint8_t, std::int16_t> sccc_encoder_bs; +typedef sccc_encoder<std::uint8_t, std::int32_t> sccc_encoder_bi; +typedef sccc_encoder<std::int16_t, std::int16_t> sccc_encoder_ss; +typedef sccc_encoder<std::uint8_t, std::int32_t> sccc_encoder_si; +typedef sccc_encoder<std::int32_t, std::int32_t> sccc_encoder_ii; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* SCCC_ENCODER_H */ diff --git a/gr-trellis/include/gnuradio/trellis/siso_combined_f.h b/gr-trellis/include/gnuradio/trellis/siso_combined_f.h index 4c37b2c68d..d6249aca62 100644 --- a/gr-trellis/include/gnuradio/trellis/siso_combined_f.h +++ b/gr-trellis/include/gnuradio/trellis/siso_combined_f.h @@ -31,49 +31,52 @@ #include <gnuradio/block.h> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ - class TRELLIS_API siso_combined_f : virtual public block - { - public: - // gr::trellis::siso_combined_f::sptr - typedef boost::shared_ptr<siso_combined_f> sptr; +/*! + * \ingroup trellis_coding_blk + */ +class TRELLIS_API siso_combined_f : virtual public block +{ +public: + // gr::trellis::siso_combined_f::sptr + typedef boost::shared_ptr<siso_combined_f> sptr; - static sptr make(const fsm &FSM, int K, - int S0, int SK, - bool POSTI, bool POSTO, - siso_type_t d_SISO_TYPE, - int D, - const std::vector<float> &TABLE, - digital::trellis_metric_type_t TYPE); + static sptr make(const fsm& FSM, + int K, + int S0, + int SK, + bool POSTI, + bool POSTO, + siso_type_t d_SISO_TYPE, + int D, + const std::vector<float>& TABLE, + digital::trellis_metric_type_t TYPE); - virtual fsm FSM() const = 0; - virtual int K() const = 0; - virtual int S0() const = 0; - virtual int SK() const = 0; - virtual bool POSTI() const = 0; - virtual bool POSTO() const = 0; - virtual siso_type_t SISO_TYPE() const = 0; - virtual int D() const = 0; - virtual std::vector<float> TABLE() const = 0; - virtual digital::trellis_metric_type_t TYPE() const = 0; + virtual fsm FSM() const = 0; + virtual int K() const = 0; + virtual int S0() const = 0; + virtual int SK() const = 0; + virtual bool POSTI() const = 0; + virtual bool POSTO() const = 0; + virtual siso_type_t SISO_TYPE() const = 0; + virtual int D() const = 0; + virtual std::vector<float> TABLE() const = 0; + virtual digital::trellis_metric_type_t TYPE() const = 0; - virtual void set_FSM(const fsm &FSM) =0; - virtual void set_K(int K) =0; - virtual void set_S0(int S0) =0; - virtual void set_SK(int SK) =0; - virtual void set_POSTI(bool POSTI) =0; - virtual void set_POSTO(bool POSTO) =0; - virtual void set_SISO_TYPE(trellis::siso_type_t type) =0; - virtual void set_D(int D) =0; - virtual void set_TABLE(const std::vector<float> &table) =0; - virtual void set_TYPE(digital::trellis_metric_type_t type) =0; - }; + virtual void set_FSM(const fsm& FSM) = 0; + virtual void set_K(int K) = 0; + virtual void set_S0(int S0) = 0; + virtual void set_SK(int SK) = 0; + virtual void set_POSTI(bool POSTI) = 0; + virtual void set_POSTO(bool POSTO) = 0; + virtual void set_SISO_TYPE(trellis::siso_type_t type) = 0; + virtual void set_D(int D) = 0; + virtual void set_TABLE(const std::vector<float>& table) = 0; + virtual void set_TYPE(digital::trellis_metric_type_t type) = 0; +}; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_SISO_COMBINED_F_H */ diff --git a/gr-trellis/include/gnuradio/trellis/siso_f.h b/gr-trellis/include/gnuradio/trellis/siso_f.h index 89bcba0e82..90ae33309f 100644 --- a/gr-trellis/include/gnuradio/trellis/siso_f.h +++ b/gr-trellis/include/gnuradio/trellis/siso_f.h @@ -30,40 +30,43 @@ #include <gnuradio/block.h> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ - class TRELLIS_API siso_f : virtual public block - { - public: - // gr::trellis::siso_f::sptr - typedef boost::shared_ptr<siso_f> sptr; +/*! + * \ingroup trellis_coding_blk + */ +class TRELLIS_API siso_f : virtual public block +{ +public: + // gr::trellis::siso_f::sptr + typedef boost::shared_ptr<siso_f> sptr; - static sptr make(const fsm &FSM, int K, - int S0, int SK, - bool POSTI, bool POSTO, - siso_type_t d_SISO_TYPE); + static sptr make(const fsm& FSM, + int K, + int S0, + int SK, + bool POSTI, + bool POSTO, + siso_type_t d_SISO_TYPE); - virtual fsm FSM() const = 0; - virtual int K() const = 0; - virtual int S0() const = 0; - virtual int SK() const = 0; - virtual bool POSTI() const = 0; - virtual bool POSTO() const = 0; - virtual siso_type_t SISO_TYPE() const = 0; + virtual fsm FSM() const = 0; + virtual int K() const = 0; + virtual int S0() const = 0; + virtual int SK() const = 0; + virtual bool POSTI() const = 0; + virtual bool POSTO() const = 0; + virtual siso_type_t SISO_TYPE() const = 0; - virtual void set_FSM(const fsm &FSM) =0; - virtual void set_K(int K) =0; - virtual void set_S0(int S0) =0; - virtual void set_SK(int SK) =0; - virtual void set_POSTI(bool posti) =0; - virtual void set_POSTO(bool posto) =0; - virtual void set_SISO_TYPE(trellis::siso_type_t type) = 0; - }; + virtual void set_FSM(const fsm& FSM) = 0; + virtual void set_K(int K) = 0; + virtual void set_S0(int S0) = 0; + virtual void set_SK(int SK) = 0; + virtual void set_POSTI(bool posti) = 0; + virtual void set_POSTO(bool posto) = 0; + virtual void set_SISO_TYPE(trellis::siso_type_t type) = 0; +}; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_SISO_F_H */ diff --git a/gr-trellis/include/gnuradio/trellis/siso_type.h b/gr-trellis/include/gnuradio/trellis/siso_type.h index 9d147ce0f8..e942199c57 100644 --- a/gr-trellis/include/gnuradio/trellis/siso_type.h +++ b/gr-trellis/include/gnuradio/trellis/siso_type.h @@ -24,14 +24,11 @@ #define INCLUDED_TRELLIS_SISO_TYPE_H namespace gr { - namespace trellis { +namespace trellis { - typedef enum { - TRELLIS_MIN_SUM = 200, - TRELLIS_SUM_PRODUCT - } siso_type_t; +typedef enum { TRELLIS_MIN_SUM = 200, TRELLIS_SUM_PRODUCT } siso_type_t; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* INCLUDED_TRELLIS_SISO_TYPE_H */ diff --git a/gr-trellis/include/gnuradio/trellis/viterbi.h b/gr-trellis/include/gnuradio/trellis/viterbi.h index c37392fb99..c432793426 100644 --- a/gr-trellis/include/gnuradio/trellis/viterbi.h +++ b/gr-trellis/include/gnuradio/trellis/viterbi.h @@ -31,36 +31,35 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ -template<class T> - class TRELLIS_API viterbi : virtual public block - { - public: - // gr::trellis::viterbi::sptr - typedef boost::shared_ptr< viterbi<T> > sptr; +/*! + * \ingroup trellis_coding_blk + */ +template <class T> +class TRELLIS_API viterbi : virtual public block +{ +public: + // gr::trellis::viterbi::sptr + typedef boost::shared_ptr<viterbi<T>> sptr; - static sptr make(const fsm &FSM, int K, - int S0, int SK); + static sptr make(const fsm& FSM, int K, int S0, int SK); - virtual fsm FSM() const = 0; - virtual int K() const = 0; - virtual int S0() const = 0; - virtual int SK() const = 0; + virtual fsm FSM() const = 0; + virtual int K() const = 0; + virtual int S0() const = 0; + virtual int SK() const = 0; - virtual void set_FSM(const fsm &FSM) =0; - virtual void set_K(int K) =0; - virtual void set_S0(int S0) =0; - virtual void set_SK(int SK) =0; - }; + virtual void set_FSM(const fsm& FSM) = 0; + virtual void set_K(int K) = 0; + virtual void set_S0(int S0) = 0; + virtual void set_SK(int SK) = 0; +}; typedef viterbi<std::uint8_t> viterbi_b; typedef viterbi<std::int16_t> viterbi_s; typedef viterbi<std::int32_t> viterbi_i; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* VITERBI_H */ diff --git a/gr-trellis/include/gnuradio/trellis/viterbi_combined.h b/gr-trellis/include/gnuradio/trellis/viterbi_combined.h index b48106a8b4..de1e139e5f 100644 --- a/gr-trellis/include/gnuradio/trellis/viterbi_combined.h +++ b/gr-trellis/include/gnuradio/trellis/viterbi_combined.h @@ -31,53 +31,56 @@ #include <cstdint> namespace gr { - namespace trellis { +namespace trellis { - /*! - * \ingroup trellis_coding_blk - */ - template <class IN_T,class OUT_T> - class TRELLIS_API viterbi_combined : virtual public block - { - public: - typedef boost::shared_ptr< viterbi_combined<IN_T,OUT_T> > sptr; +/*! + * \ingroup trellis_coding_blk + */ +template <class IN_T, class OUT_T> +class TRELLIS_API viterbi_combined : virtual public block +{ +public: + typedef boost::shared_ptr<viterbi_combined<IN_T, OUT_T>> sptr; - static sptr make(const fsm &FSM, int K, - int S0, int SK, int D, - const std::vector<IN_T> &TABLE, - digital::trellis_metric_type_t TYPE); + static sptr make(const fsm& FSM, + int K, + int S0, + int SK, + int D, + const std::vector<IN_T>& TABLE, + digital::trellis_metric_type_t TYPE); - virtual fsm FSM() const = 0; - virtual int K() const = 0; - virtual int S0() const = 0; - virtual int SK() const = 0; - virtual int D() const = 0; - virtual std::vector<IN_T> TABLE() const = 0; - virtual digital::trellis_metric_type_t TYPE() const = 0; + virtual fsm FSM() const = 0; + virtual int K() const = 0; + virtual int S0() const = 0; + virtual int SK() const = 0; + virtual int D() const = 0; + virtual std::vector<IN_T> TABLE() const = 0; + virtual digital::trellis_metric_type_t TYPE() const = 0; - virtual void set_FSM(const fsm &FSM) =0; - virtual void set_K(int K) =0; - virtual void set_S0(int S0) =0; - virtual void set_SK(int SK) =0; - virtual void set_D(int D) =0; - virtual void set_TABLE (const std::vector<IN_T> &table) = 0; - virtual void set_TYPE(digital::trellis_metric_type_t type) = 0; - }; + virtual void set_FSM(const fsm& FSM) = 0; + virtual void set_K(int K) = 0; + virtual void set_S0(int S0) = 0; + virtual void set_SK(int SK) = 0; + virtual void set_D(int D) = 0; + virtual void set_TABLE(const std::vector<IN_T>& table) = 0; + virtual void set_TYPE(digital::trellis_metric_type_t type) = 0; +}; - typedef viterbi_combined<std::int16_t, std::uint8_t> viterbi_combined_sb; - typedef viterbi_combined<std::int16_t, std::int16_t> viterbi_combined_ss; - typedef viterbi_combined<std::int16_t, std::int32_t> viterbi_combined_si; - typedef viterbi_combined<std::int32_t, std::uint8_t> viterbi_combined_ib; - typedef viterbi_combined<std::int32_t, std::int16_t> viterbi_combined_is; - typedef viterbi_combined<std::int32_t, std::int32_t> viterbi_combined_ii; - typedef viterbi_combined<float, std::uint8_t> viterbi_combined_fb; - typedef viterbi_combined<float, std::int16_t> viterbi_combined_fs; - typedef viterbi_combined<float, std::int32_t> viterbi_combined_fi; - typedef viterbi_combined<gr_complex, std::uint8_t> viterbi_combined_cb; - typedef viterbi_combined<gr_complex, std::int16_t> viterbi_combined_cs; - typedef viterbi_combined<gr_complex, std::int32_t> viterbi_combined_ci; +typedef viterbi_combined<std::int16_t, std::uint8_t> viterbi_combined_sb; +typedef viterbi_combined<std::int16_t, std::int16_t> viterbi_combined_ss; +typedef viterbi_combined<std::int16_t, std::int32_t> viterbi_combined_si; +typedef viterbi_combined<std::int32_t, std::uint8_t> viterbi_combined_ib; +typedef viterbi_combined<std::int32_t, std::int16_t> viterbi_combined_is; +typedef viterbi_combined<std::int32_t, std::int32_t> viterbi_combined_ii; +typedef viterbi_combined<float, std::uint8_t> viterbi_combined_fb; +typedef viterbi_combined<float, std::int16_t> viterbi_combined_fs; +typedef viterbi_combined<float, std::int32_t> viterbi_combined_fi; +typedef viterbi_combined<gr_complex, std::uint8_t> viterbi_combined_cb; +typedef viterbi_combined<gr_complex, std::int16_t> viterbi_combined_cs; +typedef viterbi_combined<gr_complex, std::int32_t> viterbi_combined_ci; - } /* namespace trellis */ +} /* namespace trellis */ } /* namespace gr */ #endif /* VITERBI_COMBINED_H */ |