| 9 | |
| 10 | template<typename B> |
| 11 | Encoder_RSC_DB<B>::Encoder_RSC_DB(const int& K, const int& N, const std::string standard, const bool buffered_encoding) |
| 12 | : Encoder<B>(K, N) |
| 13 | , n_ff(standard == "DVB-RCS1" ? 3 : 4) |
| 14 | , n_states(1 << n_ff) |
| 15 | , buffered_encoding(buffered_encoding) |
| 16 | , next_state(4, std::vector<int>(n_states, 0)) |
| 17 | , out_parity(4, std::vector<int>(n_states, 0)) |
| 18 | { |
| 19 | const std::string name = "Encoder_RSC_DB"; |
| 20 | this->set_name(name); |
| 21 | for (auto& t : this->tasks) |
| 22 | t->set_replicability(true); |
| 23 | |
| 24 | if (N != 2 * K) |
| 25 | { |
| 26 | std::stringstream message; |
| 27 | message << "'N' has to be equal to 2 * 'K' ('N' = " << N << ", 'K' = " << K << ")."; |
| 28 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 29 | } |
| 30 | |
| 31 | // poly: A,B,Y,W,Feed : all in binary |
| 32 | if (standard == "DVB-RCS1") |
| 33 | { |
| 34 | poly = { { 1, 0, 0 }, // A |
| 35 | { 1, 1, 1 }, // B |
| 36 | { 1, 0, 1, 1 }, // Y |
| 37 | { 1, 0, 0, 1 }, // W |
| 38 | { 1, 0, 1 } }; // Feedback |
| 39 | circ_states = { { 0, 6, 4, 2, 7, 1, 3, 5 }, { 0, 3, 7, 4, 5, 6, 2, 1 }, { 0, 5, 3, 6, 2, 7, 1, 4 }, |
| 40 | { 0, 4, 1, 5, 6, 2, 7, 3 }, { 0, 2, 5, 7, 1, 3, 4, 6 }, { 0, 7, 6, 1, 3, 4, 5, 2 } }; |
| 41 | } |
| 42 | else if (standard == "DVB-RCS2") |
| 43 | { |
| 44 | poly = { { 1, 0, 0, 0 }, { 1, 1, 0, 1 }, { 1, 1, 1, 0, 1 }, { 1, 0, 1, 1, 1 }, { 0, 0, 1, 1 } }; |
| 45 | |
| 46 | circ_states = { { 0, 14, 3, 13, 7, 9, 4, 10, 15, 1, 12, 2, 8, 6, 11, 5 }, |
| 47 | { 0, 11, 13, 6, 10, 1, 7, 12, 5, 14, 8, 3, 15, 4, 2, 9 }, |
| 48 | { 0, 8, 9, 1, 2, 10, 11, 3, 4, 12, 13, 5, 6, 14, 15, 7 }, |
| 49 | { 0, 3, 4, 7, 8, 11, 12, 15, 1, 2, 5, 6, 9, 10, 13, 14 }, |
| 50 | { 0, 12, 5, 9, 11, 7, 14, 2, 6, 10, 3, 15, 13, 1, 8, 4 }, |
| 51 | { 0, 4, 12, 8, 9, 13, 5, 1, 2, 6, 14, 10, 11, 15, 7, 3 }, |
| 52 | { 0, 6, 10, 12, 5, 3, 15, 9, 11, 13, 1, 7, 14, 8, 4, 2 }, |
| 53 | { 0, 7, 8, 15, 1, 6, 9, 14, 3, 4, 11, 12, 2, 5, 10, 13 }, |
| 54 | { 0, 5, 14, 11, 13, 8, 3, 6, 10, 15, 4, 1, 7, 2, 9, 12 }, |
| 55 | { 0, 13, 7, 10, 15, 2, 8, 5, 14, 3, 9, 4, 1, 12, 6, 11 }, |
| 56 | { 0, 2, 6, 4, 12, 14, 10, 8, 9, 11, 15, 13, 5, 7, 3, 1 }, |
| 57 | { 0, 9, 11, 2, 6, 15, 13, 4, 12, 5, 7, 14, 10, 3, 1, 8 }, |
| 58 | { 0, 10, 15, 5, 14, 4, 1, 11, 13, 7, 2, 8, 3, 9, 12, 6 }, |
| 59 | { 0, 15, 1, 14, 3, 12, 2, 13, 7, 8, 6, 9, 4, 11, 5, 10 } }; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | std::stringstream message; |
| 64 | message << "'standard' has to be equal to DVB-RCS1 or DVB-RCS2 ('standard' = " << standard << ")."; |
| 65 | throw spu::tools::invalid_argument(__FILE__, __LINE__, __func__, message.str()); |
| 66 | } |
| 67 | |
| 68 | if ((int)poly.size() != 5) |
nothing calls this directly
no outgoing calls
no test coverage detected