45 BERC::BERC(
int indelay,
int inignorefirst,
int inignorelast):
46 delay(indelay), ignorefirst(inignorefirst), ignorelast(inignorelast),
47 errors(0), corrects(0) {}
52 - ignorefirst - ignorelast;
55 for (
int i = 0; i < countlength; i++) {
56 if (in1(i + ignorefirst) == in2(i + ignorefirst + delay)) {
65 for (
int i = 0; i < countlength; i++) {
66 if (in1(i + ignorefirst - delay) == in2(i + ignorefirst)) {
88 int num, start1, start2;
89 int min_input_length =
std::min(in1.length(), in2.length());
90 int bestdelay = mindelay;
93 for (
int i = mindelay; i < maxdelay; i++) {
94 num = min_input_length -
std::abs(i) - ignorefirst - ignorelast;
95 start1 = (i < 0) ? -i : 0;
96 start2 = (i > 0) ? i : 0;
98 in2.mid(start2, num)))));
99 if (correlation > bestcorr) {
101 bestcorr = correlation;
109 std::cout.setf(std::ios::fixed);
110 std::cout << std::endl
111 <<
"==================================" << std::endl
112 <<
" Bit Error Counter Report " << std::endl
113 <<
"==================================" << std::endl
114 <<
" Ignore First = " << ignorefirst << std::endl
115 <<
" Ignore Last = " << ignorelast << std::endl
116 <<
" Delay = " << delay << std::endl
117 <<
" Number of counted bits = " << std::setprecision(0)
118 << (errors + corrects) << std::endl
119 <<
" Number of errors = " << std::setprecision(0)
120 << errors << std::endl
121 <<
"==================================" << std::endl
122 <<
" Error rate = " << std::setprecision(8)
123 << (errors / (errors + corrects)) << std::endl
124 <<
"==================================" << std::endl << std::endl;
128 int inignorefirst,
int inignorelast)
131 - inignorefirst - inignorelast;
132 int local_errors = 0;
135 for (
int i = 0; i < countlength; i++) {
136 if (in1(i + inignorefirst) != in2(i + inignorefirst + indelay)) {
142 for (
int i = 0; i < countlength; i++) {
143 if (in1(i + inignorefirst - indelay) != in2(i + inignorefirst)) {
161 BLERC::BLERC(
int inblocksize): setup_done(true), blocksize(inblocksize),
162 errors(0), corrects(0) {}
167 blocksize = inblocksize;
178 "BLERC::count(): Block size has to be setup before counting errors.");
179 int min_input_length =
std::min(in1.length(), in2.length());
181 "BLERC::count(): Block size must not be longer than input vectors.");
183 for (
int i = 0; i < (min_input_length / blocksize); i++) {
185 for (
int j = 0; j < blocksize; j++) {
186 if (in1(i * blocksize + j) != in2(i * blocksize + j)) {