00001
00030 #ifndef ERROR_COUNTERS_H
00031 #define ERROR_COUNTERS_H
00032
00033 #include <itpp/base/vec.h>
00034
00035
00036 namespace itpp
00037 {
00038
00066 class BERC
00067 {
00068 public:
00079 BERC(int indelay = 0, int inignorefirst = 0, int inignorelast = 0);
00081 void count(const bvec &in1, const bvec &in2);
00084 void estimate_delay(const bvec &in1, const bvec &in2, int mindelay = -100,
00085 int maxdelay = 100);
00087 void clear() { errors = 0; corrects = 0; }
00089 void report() const;
00091 int get_delay() const { return delay; }
00093 double get_errors() const { return errors; }
00095 double get_corrects() const { return corrects; }
00097 double get_total_bits() const { return (errors + corrects); }
00099 double get_errorrate() const { return (errors / (corrects + errors)); }
00110 static double count_errors(const bvec &in1, const bvec &in2,
00111 int indelay = 0, int inignorefirst = 0,
00112 int inignorelast = 0);
00113
00114 private:
00115 int delay;
00116 int ignorefirst;
00117 int ignorelast;
00118 double errors;
00119 double corrects;
00120 };
00121
00127 class BLERC
00128 {
00129 public:
00131 BLERC(void);
00133 BLERC(int blocksize);
00135 void set_blocksize(int inblocksize, bool clear = true);
00137 void count(const bvec &in1, const bvec &in2);
00139 void clear() { errors = 0; corrects = 0; }
00141 double get_errors() const { return errors; }
00143 double get_corrects() const { return corrects; }
00145 double get_total_blocks() const { return (errors + corrects); }
00147 double get_errorrate() const { return (errors / (corrects + errors)); }
00148
00149
00150 private:
00151 bool setup_done;
00152 int blocksize;
00153 double errors;
00154 double corrects;
00155 bool CORR;
00156 };
00157
00158 }
00159
00160 #endif // #ifndef ERROR_COUNTERS_H