mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-12 16:57:23 -05:00
Included error correction on P25 TDULC.
Added a new "heuristics" module for P25 that improves the estimation of the symbol (dibit) that corresponds to a given analog signal value. Added a BER (bit error reate) estimation for P25.
This commit is contained in:
23
Hamming.cpp
23
Hamming.cpp
@@ -1,5 +1,5 @@
|
||||
|
||||
#include <Hamming.hpp>
|
||||
#include "Hamming.hpp"
|
||||
|
||||
// definition outside class declaration
|
||||
Hamming_10_6_3_data Hamming_10_6_3::data;
|
||||
@@ -50,6 +50,18 @@ int Hamming_10_6_3::decode(std::bitset<10>& input)
|
||||
return error_count;
|
||||
}
|
||||
|
||||
int Hamming_10_6_3::encode(std::bitset<6>& input)
|
||||
{
|
||||
// Compute syndromes
|
||||
int s0 = ((data.gt0 & input).count() & 1) << 3;
|
||||
int s1 = ((data.gt1 & input).count() & 1) << 2;
|
||||
int s2 = ((data.gt2 & input).count() & 1) << 1;
|
||||
int s3 = ((data.gt3 & input).count() & 1);
|
||||
int parity = s0 | s1 | s2 | s3;
|
||||
|
||||
return parity;
|
||||
}
|
||||
|
||||
int Hamming_10_6_3_TableImpl::decode(int input, int* output)
|
||||
{
|
||||
assert (input < 1024 && input >= 0);
|
||||
@@ -60,3 +72,12 @@ int Hamming_10_6_3_TableImpl::decode(int input, int* output)
|
||||
|
||||
return data.error_counts[input];
|
||||
}
|
||||
|
||||
int Hamming_10_6_3_TableImpl::encode(int input)
|
||||
{
|
||||
assert (input < 64 && input >= 0);
|
||||
|
||||
// Making use of a table...
|
||||
|
||||
return data.encode_parities[input];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user