mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-15 02:07:24 -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:
@@ -3,13 +3,19 @@
|
||||
#include "ReedSolomon.hpp"
|
||||
#include "Golay24.hpp"
|
||||
|
||||
//#define __CHECK_HDU_DEBUG__
|
||||
// Uncomment for very verbose trace messages
|
||||
//#define CHECK_HDU_DEBUG
|
||||
|
||||
int check_and_fix_golay24(char* hex, char* parity, int* fixed_errors)
|
||||
// The following methods are just a C bridge for the C++ implementations of the Golay and ReedSolomon
|
||||
// algorithms.
|
||||
|
||||
static DSDGolay24 golay24;
|
||||
|
||||
static DSDReedSolomon_36_20_17 reed_solomon_36_20_17;
|
||||
|
||||
int check_and_fix_golay_24_6(char* hex, char* parity, int* fixed_errors)
|
||||
{
|
||||
static DSDGolay24 golay24;
|
||||
|
||||
#ifdef __CHECK_HDU_DEBUG__
|
||||
#ifdef CHECK_HDU_DEBUG
|
||||
printf("[");
|
||||
for(unsigned int i=0; i<6; i++) {
|
||||
printf("%c", (hex[i] != 0)? 'X': ' ');
|
||||
@@ -21,9 +27,9 @@ int check_and_fix_golay24(char* hex, char* parity, int* fixed_errors)
|
||||
printf("]");
|
||||
#endif
|
||||
|
||||
int irrecoverable_errors = golay24.decode(hex, parity, fixed_errors);
|
||||
int irrecoverable_errors = golay24.decode_6(hex, parity, fixed_errors);
|
||||
|
||||
#ifdef __CHECK_HDU_DEBUG__
|
||||
#ifdef CHECK_HDU_DEBUG
|
||||
printf(" -> [");
|
||||
for(unsigned int i=0; i<6; i++) {
|
||||
printf("%c", (hex[i] != 0)? 'X': ' ');
|
||||
@@ -40,11 +46,53 @@ int check_and_fix_golay24(char* hex, char* parity, int* fixed_errors)
|
||||
return irrecoverable_errors;
|
||||
}
|
||||
|
||||
int check_and_fix_golay_24_12(char* dodeca, char* parity, int* fixed_errors)
|
||||
{
|
||||
#ifdef CHECK_HDU_DEBUG
|
||||
printf("[");
|
||||
for(unsigned int i=0; i<12; i++) {
|
||||
printf("%c", (dodeca[i] != 0)? 'X': ' ');
|
||||
}
|
||||
printf("] [");
|
||||
for(unsigned int i=12; i<24; i++) {
|
||||
printf("%c", (parity[i-12] != 0)? 'X': ' ');
|
||||
}
|
||||
printf("]");
|
||||
#endif
|
||||
|
||||
int irrecoverable_errors = golay24.decode_12(dodeca, parity, fixed_errors);
|
||||
|
||||
#ifdef CHECK_HDU_DEBUG
|
||||
printf(" -> [");
|
||||
for(unsigned int i=0; i<12; i++) {
|
||||
printf("%c", (dodeca[i] != 0)? 'X': ' ');
|
||||
}
|
||||
printf("]");
|
||||
if (irrecoverable_errors) {
|
||||
printf(" Errors: >4");
|
||||
} else {
|
||||
printf(" Errors: %i", *fixed_errors);
|
||||
}
|
||||
printf("\n");
|
||||
#endif
|
||||
|
||||
return irrecoverable_errors;
|
||||
}
|
||||
|
||||
void encode_golay_24_6(char* hex, char* out_parity)
|
||||
{
|
||||
golay24.encode_6(hex, out_parity);
|
||||
}
|
||||
|
||||
void encode_golay_24_12(char* dodeca, char* out_parity)
|
||||
{
|
||||
golay24.encode_12(dodeca, out_parity);
|
||||
}
|
||||
|
||||
|
||||
int check_and_fix_redsolomon_36_20_17(char* data, char* parity)
|
||||
{
|
||||
static DSDReedSolomon_36_20_17 reed_solomon_36_20_17;
|
||||
|
||||
#ifdef __CHECK_HDU_DEBUG__
|
||||
#ifdef CHECK_HDU_DEBUG
|
||||
char original[20][6];
|
||||
for (int i = 0; i < 20; i++) {
|
||||
for (int j = 0; j < 6; j++) {
|
||||
@@ -55,7 +103,7 @@ int check_and_fix_redsolomon_36_20_17(char* data, char* parity)
|
||||
|
||||
int irrecoverable_errors = reed_solomon_36_20_17.decode(data, parity);
|
||||
|
||||
#ifdef __CHECK_HDU_DEBUG__
|
||||
#ifdef CHECK_HDU_DEBUG
|
||||
printf("Results for Reed-Solomon code (36,20,17)\n\n");
|
||||
if (irrecoverable_errors == 0) {
|
||||
printf(" i original fixed\n");
|
||||
@@ -86,3 +134,9 @@ int check_and_fix_redsolomon_36_20_17(char* data, char* parity)
|
||||
|
||||
return irrecoverable_errors;
|
||||
}
|
||||
|
||||
void encode_reedsolomon_36_20_17(char* hex_data, char* fixed_parity)
|
||||
{
|
||||
reed_solomon_36_20_17.encode(hex_data, fixed_parity);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user