mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
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:
54
src/edac/Golay18.java
Normal file
54
src/edac/Golay18.java
Normal 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 );
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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 );
|
||||
Reference in New Issue
Block a user