| 67 | |
| 68 | template<typename B> |
| 69 | int |
| 70 | Encoder_RSC_generic_json_sys<B>::inner_encode(const int bit_sys, int& state) |
| 71 | { |
| 72 | const auto bit_par = Encoder_RSC_generic_sys<B>::inner_encode(bit_sys, state); |
| 73 | |
| 74 | if (bit_counter == 0) |
| 75 | { |
| 76 | if (natural_domain) |
| 77 | { |
| 78 | const auto trellis = this->get_trellis(); |
| 79 | |
| 80 | stream << "\t" |
| 81 | << "[{" << std::endl; |
| 82 | |
| 83 | stream << "\t\t" |
| 84 | << "\"stage\": \"encoder\"," << std::endl |
| 85 | << "\t\t" |
| 86 | << "\"K\": " << this->K << "," << std::endl |
| 87 | << "\t\t" |
| 88 | << "\"poly\": \"{0" << std::oct << poly[0] << ",0" << std::oct << poly[1] << "}\"," << std::endl |
| 89 | << "\t\t" |
| 90 | << "\"R\": \"1/3\", " << std::endl |
| 91 | << "\t\t" |
| 92 | << "\"ff\": " << std::dec << this->n_ff << "," << std::endl |
| 93 | << "\t\t" |
| 94 | << "\"states\": " << this->n_states << "," << std::endl; |
| 95 | |
| 96 | stream << "\t\t" |
| 97 | << "\"trellis\": [" << std::endl; |
| 98 | for (auto i = 0; i < (int)trellis.size(); i++) |
| 99 | { |
| 100 | stream << "\t\t\t" |
| 101 | << "["; |
| 102 | for (auto j = 0; j < (int)trellis[i].size() - 1; j++) |
| 103 | stream << std::setw(3) << trellis[i][j] << ","; |
| 104 | stream << std::setw(3) << trellis[i][(int)trellis[i].size() - 1] << "]"; |
| 105 | if (i != (int)trellis.size() - 1) stream << "," << std::endl; |
| 106 | } |
| 107 | stream << "]," << std::endl; |
| 108 | |
| 109 | stream << "\t\t" |
| 110 | << "\"transitions\": {" << std::endl |
| 111 | << "\t\t\t" |
| 112 | << "\"natural\": [" << std::endl; |
| 113 | } |
| 114 | else |
| 115 | stream << "\t\t\t" |
| 116 | << "\"interleaved\": [" << std::endl; |
| 117 | } |
| 118 | |
| 119 | stream << "\t\t\t\t" << std::setw(2) << state; |
| 120 | |
| 121 | if (bit_counter != (this->K + this->n_ff - 1)) |
| 122 | { |
| 123 | stream << "," << std::endl; |
| 124 | bit_counter++; |
| 125 | } |
| 126 | else |
nothing calls this directly
no test coverage detected