diff options
author | Tom Rondeau <tom@trondeau.com> | 2015-09-22 15:12:32 -0400 |
---|---|---|
committer | Tom Rondeau <tom@trondeau.com> | 2015-09-22 15:12:32 -0400 |
commit | 9df0fda8d2c29874d581dbaf6670558a84d9328b (patch) | |
tree | 4d1d990886a735193134366d6e8f487efbdbfabc /gr-fec/include | |
parent | aa47616d7569f3ad00b38e39d71e3364efd123b3 (diff) |
fec: polar: whitespace fixes/tabs to go along with namespace change from last commit.
Diffstat (limited to 'gr-fec/include')
-rw-r--r-- | gr-fec/include/gnuradio/fec/polar_common.h | 102 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/polar_decoder_common.h | 100 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/polar_decoder_sc.h | 76 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h | 96 | ||||
-rw-r--r-- | gr-fec/include/gnuradio/fec/polar_encoder.h | 140 |
5 files changed, 257 insertions, 257 deletions
diff --git a/gr-fec/include/gnuradio/fec/polar_common.h b/gr-fec/include/gnuradio/fec/polar_common.h index 3ee7815008..7ef3e59b77 100644 --- a/gr-fec/include/gnuradio/fec/polar_common.h +++ b/gr-fec/include/gnuradio/fec/polar_common.h @@ -39,65 +39,65 @@ namespace gr { namespace fec { namespace code { - /*! - * \brief POLAR code common operations and attributes - * \ingroup error_coding_blk - * - * \details - * Polar codes are based on this paper by Erdal Arikan "Channel - * Polarization: A Method for Contructing Capacity-Achieving Codes - * for Symmetric Binary-Input Memoryless Channels", 2009 block - * holds common information for encoders and decoders. All polar - * encoder/decoders inherit from polar_common. - * - * class holds common info. It is common to all encoders and decoders. - */ - class FEC_API polar_common - { - public: /*! - * \param block_size codeword size. MUST be a power of 2. - * \param num_info_bits represents the number of information - * bits in a block. Also called frame_size. <= block_size - * \param frozen_bit_positions is an integer vector which - * defines the position of all frozen bits in a block. - * Its size MUST be equal to block_size - num_info_bits. - * Also it must be sorted and every position must only - * occur once. - * \param frozen_bit_values holds an unpacked byte for every - * frozen bit position. It defines if a frozen bit is - * fixed to '0' or '1'. Defaults to all ZERO. + * \brief POLAR code common operations and attributes + * \ingroup error_coding_blk + * + * \details + * Polar codes are based on this paper by Erdal Arikan "Channel + * Polarization: A Method for Contructing Capacity-Achieving Codes + * for Symmetric Binary-Input Memoryless Channels", 2009 block + * holds common information for encoders and decoders. All polar + * encoder/decoders inherit from polar_common. + * + * class holds common info. It is common to all encoders and decoders. */ - polar_common(int block_size, int num_info_bits, - std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values); - ~polar_common(); + class FEC_API polar_common + { + public: + /*! + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + polar_common(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_common(); - protected: - const int block_size()const {return d_block_size;}; - const int block_power()const {return d_block_power;}; - const int num_info_bits() const {return d_num_info_bits;}; + protected: + const int block_size()const {return d_block_size;}; + const int block_power()const {return d_block_power;}; + const int num_info_bits() const {return d_num_info_bits;}; - // helper functions - long bit_reverse(long value, int active_bits) const; - void print_packed_bit_array(const unsigned char* printed_array, - const int num_bytes) const; - void print_unpacked_bit_array(const unsigned char* bits, - const unsigned int num_bytes) const; + // helper functions + long bit_reverse(long value, int active_bits) const; + void print_packed_bit_array(const unsigned char* printed_array, + const int num_bytes) const; + void print_unpacked_bit_array(const unsigned char* bits, + const unsigned int num_bytes) const; - std::vector<int> d_frozen_bit_positions; - std::vector<char> d_frozen_bit_values; - std::vector<int> d_info_bit_positions; + std::vector<int> d_frozen_bit_positions; + std::vector<char> d_frozen_bit_values; + std::vector<int> d_info_bit_positions; - private: - int d_block_size; // depending on paper called 'N' or 'm' - int d_block_power; - int d_num_info_bits; // mostly abbreviated by 'K' + private: + int d_block_size; // depending on paper called 'N' or 'm' + int d_block_power; + int d_num_info_bits; // mostly abbreviated by 'K' - void initialize_info_bit_position_vector(); + void initialize_info_bit_position_vector(); - gr::blocks::kernel::unpack_k_bits *d_unpacker; // convenience for 'print_packed_bit_array' function. - }; + gr::blocks::kernel::unpack_k_bits *d_unpacker; // convenience for 'print_packed_bit_array' function. + }; } //namespace code } // namespace fec diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_common.h b/gr-fec/include/gnuradio/fec/polar_decoder_common.h index 7a18ba873c..b0ecb85149 100644 --- a/gr-fec/include/gnuradio/fec/polar_decoder_common.h +++ b/gr-fec/include/gnuradio/fec/polar_decoder_common.h @@ -32,66 +32,66 @@ namespace gr { namespace fec { namespace code { - /*! - * \brief Class holds common methods and attributes for different - * decoder implementations - */ - class FEC_API polar_decoder_common : public generic_decoder, public polar_common - { - public: /*! - * - * \param block_size codeword size. MUST be a power of 2. - * \param num_info_bits represents the number of information bits - * in a block. Also called frame_size. <= block_size - * \param frozen_bit_positions is an integer vector which defines - * the position of all frozen bits in a block. Its size - * MUST be equal to block_size - num_info_bits. Also it - * must be sorted and every position must only occur once. - * \param frozen_bit_values holds an unpacked byte for every - * frozen bit position. It defines if a frozen bit is - * fixed to '0' or '1'. Defaults to all ZERO. + * \brief Class holds common methods and attributes for different + * decoder implementations */ - polar_decoder_common(int block_size, int num_info_bits, - std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values); - ~polar_decoder_common(); + class FEC_API polar_decoder_common : public generic_decoder, public polar_common + { + public: + /*! + * + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information bits + * in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which defines + * the position of all frozen bits in a block. Its size + * MUST be equal to block_size - num_info_bits. Also it + * must be sorted and every position must only occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + polar_decoder_common(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_decoder_common(); - // FECAPI - double rate(){return (1.0 * get_output_size() / get_input_size());}; - int get_input_size(){return block_size();}; - int get_output_size(){return num_info_bits();}; - bool set_frame_size(unsigned int frame_size){return false;}; + // FECAPI + double rate(){return (1.0 * get_output_size() / get_input_size());}; + int get_input_size(){return block_size();}; + int get_output_size(){return num_info_bits();}; + bool set_frame_size(unsigned int frame_size){return false;}; - private: - static const float D_LLR_FACTOR = -2.19722458f; - unsigned int d_frozen_bit_counter; + private: + static const float D_LLR_FACTOR = -2.19722458f; + unsigned int d_frozen_bit_counter; - protected: - // calculate LLRs for stage - float llr_odd(const float la, const float lb) const; - float llr_even(const float la, const float lb, const unsigned char f) const; - unsigned char llr_bit_decision(const float llr) const {return (llr < 0.0f) ? 1 : 0;}; + protected: + // calculate LLRs for stage + float llr_odd(const float la, const float lb) const; + float llr_even(const float la, const float lb, const unsigned char f) const; + unsigned char llr_bit_decision(const float llr) const {return (llr < 0.0f) ? 1 : 0;}; - // control retrieval of frozen bits. - const bool is_frozen_bit(const int u_num) const; - const unsigned char next_frozen_bit(); + // control retrieval of frozen bits. + const bool is_frozen_bit(const int u_num) const; + const unsigned char next_frozen_bit(); - // preparation for decoding - void initialize_decoder(unsigned char* u, float* llrs, const float* input); + // preparation for decoding + void initialize_decoder(unsigned char* u, float* llrs, const float* input); - // basic algorithm methods - void butterfly(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); - void butterfly_volk(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); - void butterfly_generic(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); - void even_u_values(unsigned char* u_even, const unsigned char* u, const int u_num); - void odd_xor_even_values(unsigned char* u_xor, const unsigned char* u, const int u_num); - void extract_info_bits(unsigned char* output, const unsigned char* input) const; + // basic algorithm methods + void butterfly(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); + void butterfly_volk(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); + void butterfly_generic(float* llrs, unsigned char* u, const int stage, const int u_num, const int row); + void even_u_values(unsigned char* u_even, const unsigned char* u, const int u_num); + void odd_xor_even_values(unsigned char* u_xor, const unsigned char* u, const int u_num); + void extract_info_bits(unsigned char* output, const unsigned char* input) const; - // helper functions. - void print_pretty_llr_vector(const float* llr_vec) const; + // helper functions. + void print_pretty_llr_vector(const float* llr_vec) const; - }; + }; } // namespace code } // namespace fec diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_sc.h b/gr-fec/include/gnuradio/fec/polar_decoder_sc.h index 295e930e5a..3563a06574 100644 --- a/gr-fec/include/gnuradio/fec/polar_decoder_sc.h +++ b/gr-fec/include/gnuradio/fec/polar_decoder_sc.h @@ -32,50 +32,50 @@ namespace gr { namespace fec { namespace code { - /*! - * \brief Standard successive cancellation (SC) decoder for POLAR codes - * - * \details - * It expects float input with bits mapped 1 --> 1, 0 --> -1 - * Or: f = 2.0 * bit - 1.0 - * - */ - class FEC_API polar_decoder_sc : public polar_decoder_common - { - public: - /*! - * \param block_size codeword size. MUST be a power of 2. - * \param num_info_bits represents the number of information - * bits in a block. Also called frame_size. <= block_size - * \param frozen_bit_positions is an integer vector which - * defines the position of all frozen bits in a block. - * Its size MUST be equal to block_size - num_info_bits. - * Also it must be sorted and every position must only - * occur once. - * \param frozen_bit_values holds an unpacked byte for every - * frozen bit position. It defines if a frozen bit is - * fixed to '0' or '1'. Defaults to all ZERO. + * \brief Standard successive cancellation (SC) decoder for POLAR codes + * + * \details + * It expects float input with bits mapped 1 --> 1, 0 --> -1 + * Or: f = 2.0 * bit - 1.0 + * */ - static generic_decoder::sptr make(int block_size, int num_info_bits, - std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values); - ~polar_decoder_sc(); + class FEC_API polar_decoder_sc : public polar_decoder_common + { + public: + + /*! + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + static generic_decoder::sptr make(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_decoder_sc(); - // FECAPI - void generic_work(void *in_buffer, void *out_buffer); + // FECAPI + void generic_work(void *in_buffer, void *out_buffer); - private: - polar_decoder_sc(int block_size, int num_info_bits, - std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values); + private: + polar_decoder_sc(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); - float* d_llr_vec; - unsigned char* d_u_hat_vec; + float* d_llr_vec; + unsigned char* d_u_hat_vec; - unsigned char retrieve_bit_from_llr(float llr, const int pos); - void sc_decode(float* llrs, unsigned char* u); - }; + unsigned char retrieve_bit_from_llr(float llr, const int pos); + void sc_decode(float* llrs, unsigned char* u); + }; } // namespace code } // namespace fec diff --git a/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h b/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h index 6f7033b9f6..12b896e824 100644 --- a/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h +++ b/gr-fec/include/gnuradio/fec/polar_decoder_sc_list.h @@ -31,61 +31,61 @@ namespace gr { namespace fec { namespace code { - namespace polar { - class scl_list; - class path; - } + namespace polar { + class scl_list; + class path; + } - /*! - * \brief Successive cancellation list (SCL) decoder for polar - * codes. - * - * \details - * Decoder is based on Tal, Vardy "List Decoding of Polar Codes", - * 2012 LLR version: Balatsoukas-Stimming, Parizi, Burg "LLR-based - * Successive Cancellation List Decoding of Polar Codes", 2015. - * - * Block expects float input with bits mapped 1 --> 1, 0 --> -1 - * Or: f = 2.0 * bit - 1.0 - */ - class FEC_API polar_decoder_sc_list : public polar_decoder_common - { - public: /*! - * \param max_list_size caps number of followed decoding paths. - * \param block_size codeword size. MUST be a power of 2. - * \param num_info_bits represents the number of information - * bits in a block. Also called frame_size. <= block_size - * \param frozen_bit_positions is an integer vector which - * defines the position of all frozen bits in a block. - * Its size MUST be equal to block_size - num_info_bits. - * Also it must be sorted and every position must only - * occur once. - * \param frozen_bit_values holds an unpacked byte for every - * frozen bit position. It defines if a frozen bit is - * fixed to '0' or '1'. Defaults to all ZERO. + * \brief Successive cancellation list (SCL) decoder for polar + * codes. + * + * \details + * Decoder is based on Tal, Vardy "List Decoding of Polar Codes", + * 2012 LLR version: Balatsoukas-Stimming, Parizi, Burg "LLR-based + * Successive Cancellation List Decoding of Polar Codes", 2015. + * + * Block expects float input with bits mapped 1 --> 1, 0 --> -1 + * Or: f = 2.0 * bit - 1.0 */ - static generic_decoder::sptr make(int max_list_size, int block_size, - int num_info_bits, std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values); - ~polar_decoder_sc_list(); + class FEC_API polar_decoder_sc_list : public polar_decoder_common + { + public: + /*! + * \param max_list_size caps number of followed decoding paths. + * \param block_size codeword size. MUST be a power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. <= block_size + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + */ + static generic_decoder::sptr make(int max_list_size, int block_size, + int num_info_bits, std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); + ~polar_decoder_sc_list(); - // FECAPI - void generic_work(void *in_buffer, void *out_buffer); + // FECAPI + void generic_work(void *in_buffer, void *out_buffer); - private: - polar_decoder_sc_list(int max_list_size, int block_size, - int num_info_bits, std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values); + private: + polar_decoder_sc_list(int max_list_size, int block_size, + int num_info_bits, std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values); - polar::scl_list* d_scl; + polar::scl_list* d_scl; - void initialize_list(const float* in_buf); - const unsigned char* decode_list(); - void decode_bit(const int u_num); - void calculate_llrs_for_list(const int u_num); - void set_bit_in_list(const int u_num); - }; + void initialize_list(const float* in_buf); + const unsigned char* decode_list(); + void decode_bit(const int u_num); + void calculate_llrs_for_list(const int u_num); + void set_bit_in_list(const int u_num); + }; } // namespace code } // namespace fec diff --git a/gr-fec/include/gnuradio/fec/polar_encoder.h b/gr-fec/include/gnuradio/fec/polar_encoder.h index e3b4557c9b..f9541a203d 100644 --- a/gr-fec/include/gnuradio/fec/polar_encoder.h +++ b/gr-fec/include/gnuradio/fec/polar_encoder.h @@ -32,86 +32,86 @@ namespace gr { namespace fec { namespace code { - /*! - * \brief POLAR encoder - * for basic details see 'polar_common' class. - * \ingroup error_coding_blk - * - * \details - * expects values with MSB first. It needs a full information word and encodes it in one pass. - * Output is a codeword of block_size. - */ - class FEC_API polar_encoder : public generic_encoder, public polar_common - { - public: /*! - * Factory for a polar code encoder object. + * \brief POLAR encoder + * for basic details see 'polar_common' class. + * \ingroup error_coding_blk * - * \param block_size defines the codeword size. It MUST be a - * power of 2. - * \param num_info_bits represents the number of information - * bits in a block. Also called frame_size. - * \param frozen_bit_positions is an integer vector which - * defines the position of all frozen bits in a block. - * Its size MUST be equal to block_size - num_info_bits. - * Also it must be sorted and every position must only - * occur once. - * \param frozen_bit_values holds an unpacked byte for every - * frozen bit position. It defines if a frozen bit is - * fixed to '0' or '1'. Defaults to all ZERO. - * \param is_packed choose 1 active bit/byte or 8 active - * bit/byte. if false, VOLK polar encoder is used. + * \details + * expects values with MSB first. It needs a full information word and encodes it in one pass. + * Output is a codeword of block_size. */ - static generic_encoder::sptr make(int block_size, int num_info_bits, - std::vector<int> frozen_bit_positions, - std::vector<char> frozen_bit_values, - bool is_packed = false); - ~polar_encoder(); + class FEC_API polar_encoder : public generic_encoder, public polar_common + { + public: + /*! + * Factory for a polar code encoder object. + * + * \param block_size defines the codeword size. It MUST be a + * power of 2. + * \param num_info_bits represents the number of information + * bits in a block. Also called frame_size. + * \param frozen_bit_positions is an integer vector which + * defines the position of all frozen bits in a block. + * Its size MUST be equal to block_size - num_info_bits. + * Also it must be sorted and every position must only + * occur once. + * \param frozen_bit_values holds an unpacked byte for every + * frozen bit position. It defines if a frozen bit is + * fixed to '0' or '1'. Defaults to all ZERO. + * \param is_packed choose 1 active bit/byte or 8 active + * bit/byte. if false, VOLK polar encoder is used. + */ + static generic_encoder::sptr make(int block_size, int num_info_bits, + std::vector<int> frozen_bit_positions, + std::vector<char> frozen_bit_values, + bool is_packed = false); + ~polar_encoder(); - // FECAPI - void generic_work(void *in_buffer, void *out_buffer); - double rate(){return (1.0 * get_input_size() / get_output_size());}; - int get_input_size(){return num_info_bits() / (d_is_packed ? 8 : 1);}; - int get_output_size(){return block_size() / (d_is_packed ? 8 : 1);}; - bool set_frame_size(unsigned int frame_size){return false;}; - const char* get_input_conversion(){return d_is_packed ? "pack" : "none";}; - const char* get_output_conversion(){return d_is_packed ? "packed_bits" : "none";}; + // FECAPI + void generic_work(void *in_buffer, void *out_buffer); + double rate(){return (1.0 * get_input_size() / get_output_size());}; + int get_input_size(){return num_info_bits() / (d_is_packed ? 8 : 1);}; + int get_output_size(){return block_size() / (d_is_packed ? 8 : 1);}; + bool set_frame_size(unsigned int frame_size){return false;}; + const char* get_input_conversion(){return d_is_packed ? "pack" : "none";}; + const char* get_output_conversion(){return d_is_packed ? "packed_bits" : "none";}; - private: - polar_encoder(int block_size, int num_info_bits, - std::vector<int>& frozen_bit_positions, - std::vector<char>& frozen_bit_values, bool is_packed); - std::vector<int> d_info_bit_reversed_positions; - bool d_is_packed; + private: + polar_encoder(int block_size, int num_info_bits, + std::vector<int>& frozen_bit_positions, + std::vector<char>& frozen_bit_values, bool is_packed); + std::vector<int> d_info_bit_reversed_positions; + bool d_is_packed; - // c'tor method for packed algorithm setup. - void setup_frozen_bit_inserter(); + // c'tor method for packed algorithm setup. + void setup_frozen_bit_inserter(); - // methods insert input bits and frozen bits into packed array for encoding - unsigned char* d_frozen_bit_prototype; // packed frozen bits are written onto it and later copies are used. - void insert_packed_frozen_bits_and_reverse(unsigned char* target, - const unsigned char* input) const; - void insert_unpacked_bit_into_packed_array_at_position(unsigned char* target, + // methods insert input bits and frozen bits into packed array for encoding + unsigned char* d_frozen_bit_prototype; // packed frozen bits are written onto it and later copies are used. + void insert_packed_frozen_bits_and_reverse(unsigned char* target, + const unsigned char* input) const; + void insert_unpacked_bit_into_packed_array_at_position(unsigned char* target, + const unsigned char bit, + const int pos) const; + void insert_packet_bit_into_packed_array_at_position(unsigned char* target, const unsigned char bit, - const int pos) const; - void insert_packet_bit_into_packed_array_at_position(unsigned char* target, - const unsigned char bit, - const int target_pos, - const int bit_pos) const; + const int target_pos, + const int bit_pos) const; - // packed encoding methods - void encode_vector_packed(unsigned char* target) const; - void encode_vector_packed_subbyte(unsigned char* target) const; - void encode_packed_byte(unsigned char* target) const; - void encode_vector_packed_interbyte(unsigned char* target) const; + // packed encoding methods + void encode_vector_packed(unsigned char* target) const; + void encode_vector_packed_subbyte(unsigned char* target) const; + void encode_packed_byte(unsigned char* target) const; + void encode_vector_packed_interbyte(unsigned char* target) const; - // VOLK methods - void setup_volk_vectors(); - void volk_encode(unsigned char* out_buf, const unsigned char* in_buf); - unsigned char* d_temp; - unsigned char* d_frozen_bit_mask; - unsigned char* d_frozen_bits; - }; + // VOLK methods + void setup_volk_vectors(); + void volk_encode(unsigned char* out_buf, const unsigned char* in_buf); + unsigned char* d_temp; + unsigned char* d_frozen_bit_mask; + unsigned char* d_frozen_bits; + }; } // namespace code } // namespace fec |