P25 - added Header Data Unit (HDU) error detection and correction with Golay(18,6,8) and ReedSolomon(36,20,17).

This commit is contained in:
dennis.sheirer
2015-04-03 19:35:08 +00:00
parent 71a15707db
commit b8f4e682eb
5 changed files with 210 additions and 13 deletions

54
src/edac/Golay18.java Normal file
View File

@@ -0,0 +1,54 @@
package edac;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import bits.BinaryMessage;
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014 Dennis Sheirer
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
* -----------------------------------------------------------------------
* Galois24 decoder based on Hank Wallace's tutorial/algorithm located at:
* http://www.aqdi.com/golay.htm
******************************************************************************/
/**
* Golay 18/6/8 decoder. Uses the Golay24 edac class to perform edac on Golay
* 18 messages by treating the Golay 18 message as a Golay 24 message with the
* left-most 6 bits set to zero.
*/
public class Golay18
{
private final static Logger mLog = LoggerFactory.getLogger( Golay18.class );
/**
* Performs error detection and correction.
*/
public static void checkAndCorrect( BinaryMessage message, int startIndex )
{
int value = message.getInt( startIndex, startIndex + 17 );
BinaryMessage temp = new BinaryMessage( 24 );
temp.load( 6, 18, value );
BinaryMessage corrected = Golay24.checkAndCorrect( temp, 0 );
int correctedValue = corrected.getInt( 6, 23 );
message.load( startIndex, 18, correctedValue );
}
}

View File

@@ -14,7 +14,7 @@ public class Golay23
};
/**
* Implements Golay(23,11,7) error detection and correction. Returns the
* Implements Golay(23,12,7) error detection and correction. Returns the
* number of detected errors. If the error count is less than or equal to
* the max correctable errors (3), then the error bits are corrected.
* Otherwise the message is left intact and an error count greater than 3

View File

@@ -18,12 +18,12 @@ package edac;
* along with this program. If not, see <http://www.gnu.org/licenses/>
******************************************************************************/
public class ReedSolomon_24_12_13 extends BerlekempMassey_63
public class ReedSolomon_63_47_17 extends BerlekempMassey_63
{
/**
* Reed-Solomon RS(24,12,13) decoder
*/
public ReedSolomon_24_12_13()
public ReedSolomon_63_47_17()
{
/* TT = 6 = maximum correctable bit errors */
super( 6 );