![]() |
four_multi
Multi-Antenna,Multi-Node,Multi-Band,Multi-Cell
|
00001 // Copyright 2011-2013, Per Zetterberg, KTH Royal Institute of Technology 00002 // 00003 // This program is free software: you can redistribute it and/or modify 00004 // it under the terms of the GNU General Public License as published by 00005 // the Free Software Foundation, either version 3 of the License, or 00006 // (at your option) any later version. 00007 // 00008 // This program is distributed in the hope that it will be useful, 00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 // GNU General Public License for more details. 00012 // 00013 // You should have received a copy of the GNU General Public License 00014 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00015 // 00016 00017 00018 00019 #ifndef AMC_HPP 00020 #define AMC_HPP 00021 00022 #include "LDPC1.hpp" 00023 #include <vector> 00024 00033 class AMC { 00034 public: 00035 00037 AMC(void); 00038 00050 void init(uint32_t code_word_size,bool load_from_file); 00051 00065 void modulate(uint32_t modulation_order, uint32_t codec_ix, bvec message, bvec &transmitted, cvec &symbols,int skip_symbols) ; 00066 00068 void encode(uint32_t codec_ix, bvec message, bvec &transmitted); 00069 00071 int codec_message_size(uint32_t codec_ix) ; 00072 00074 int no_of_codecs(void) {return 4;}; 00075 00080 double evm(uint32_t modulation_order, bvec &transmitted, 00081 cvec &symbols, int skip_symbols); 00082 00083 00103 void demodulate(const cvec &input_symbols, double noise_variance, 00104 uint32_t modulation_order, 00105 uint32_t codec_ix, bvec &message_hat, bvec &transmitted_hat) ; 00106 00107 00113 double noise_variance(const cvec &symbols, uint32_t modulation_order); 00114 00116 bool only_raw_bits; 00117 00127 void randb_thread_safe(int size, bvec &out, uint64_t *seed) ; 00128 00136 void randb_thread_safe(int start_ix, int length, bvec &out, uint64_t *seed) ; 00137 00143 void run_through_all_mcs(void) ; 00144 00145 00146 private: 00147 00148 /* \brief Not part of the API */ 00149 uint32_t rand_new(uint64_t *next) ; 00150 00151 LDPC1 *codec(int number) { 00152 if (number==0) { 00153 return &b0; 00154 }; 00155 if (number==1) { 00156 return &b1; 00157 }; 00158 if (number==2) { 00159 return &b2; 00160 }; 00161 if (number==3) { 00162 return &b3; 00163 }; 00164 return &b0; 00165 }; 00166 00167 LDPC1 b0, b1, b2, b3; 00168 QAM qam; 00169 vec soft_bit; 00170 int m_code_word_size; 00171 }; 00172 00173 #endif