mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-12 16:47:31 -05:00
#2516 DMR Decoder enhancements. Architecture now shares common C4FM framework like P25P1 and NXDN. Adds soft decoding and enhanced/corrected error detection and correction. (#2517)
Co-authored-by: denny <dennis.sheirer@gmail.com>
This commit is contained in:
@@ -7,6 +7,26 @@ import io.github.dsheirer.dsp.symbol.Dibit;
|
||||
*/
|
||||
public abstract class C4FMMessageFramer
|
||||
{
|
||||
private static final float SOFT_SYMBOL_SCALE = (float)(4.0 / Math.PI); //Radians to symbol units (+/-1, +/-3)
|
||||
|
||||
/**
|
||||
* Converts the soft symbol into a pair of soft bit values using max-log likelihood ratios for the Gray mapped
|
||||
* 4-level symbol (D01=+3, D00=+1, D10=-1, D11=-3), where a positive soft bit value favors a 1 bit.
|
||||
* @param softSymbol in radians
|
||||
* @param softBits array to receive the two soft bit values
|
||||
* @param index for the first bit (sign bit), followed by the second (magnitude) bit
|
||||
*/
|
||||
protected static void setSoftBits(float softSymbol, float[] softBits, int index)
|
||||
{
|
||||
float u = softSymbol * SOFT_SYMBOL_SCALE;
|
||||
float magnitude = Math.abs(u);
|
||||
//First bit is 1 for negative symbols
|
||||
float favorZero = magnitude <= 2.0f ? 4.0f * u : 8.0f * u - 8.0f * Math.signum(u);
|
||||
softBits[index] = -favorZero;
|
||||
//Second bit is 1 for the outer (+/-3) symbols
|
||||
softBits[index + 1] = 4.0f * (magnitude - 2.0f);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process the symbol
|
||||
* @param symbol in radians
|
||||
|
||||
Reference in New Issue
Block a user