P25 - adds 3/4 rate convolutional decoder for confirmed packet data units.

This commit is contained in:
dennis.sheirer
2015-01-17 18:24:39 +00:00
parent a9ac26b4f8
commit 35855b08bb
4 changed files with 771 additions and 37 deletions

View File

@@ -19,6 +19,60 @@ public enum Dibit
mLowValue = lowValue;
mHighValue = highValue;
}
/**
* Allowable transition state 1 for trellis coded modulation. Indicates
* the dibit that differs from this dibit in the LSB bit position.
*/
public Dibit getAllowableTransition1()
{
switch( this )
{
case D00_PLUS_1:
return D01_PLUS_3;
case D01_PLUS_3:
return D00_PLUS_1;
case D10_MINUS_1:
return D11_MINUS_3;
case D11_MINUS_3:
return D10_MINUS_1;
default:
/* We'll never get here */
return D00_PLUS_1;
}
}
/**
* Allowable transition state 2 for trellis coded modulation. Indicates
* the dibit that differs from this dibit in the MSB bit position.
*/
public Dibit getAllowableTransition2()
{
switch( this )
{
case D00_PLUS_1:
return D10_MINUS_1;
case D01_PLUS_3:
return D11_MINUS_3;
case D10_MINUS_1:
return D00_PLUS_1;
case D11_MINUS_3:
return D01_PLUS_3;
default:
/* We'll never get here */
return D00_PLUS_1;
}
}
/**
* Indicates if the trellis coded modulation dibit is allowed to transition
* to the dibit argument.
*/
public boolean isAllowableTransition( Dibit dibit )
{
return dibit == getAllowableTransition1() ||
dibit == getAllowableTransition2();
}
public boolean getBit1()
{

View File

@@ -14,6 +14,7 @@ import bits.BitSetFullException;
import bits.SyncPatternMatcher;
import decode.p25.P25Interleave;
import decode.p25.Trellis_1_2_Rate;
import decode.p25.Trellis_3_4_Rate;
import decode.p25.message.P25Message;
import decode.p25.message.hdu.HDUMessage;
import decode.p25.message.ldu.LDU1Message;
@@ -61,6 +62,7 @@ public class P25MessageFramer implements Listener<Dibit>
private SyncPatternMatcher mMatcher;
private boolean mInverted = false;
private Trellis_1_2_Rate mHalfRate = new Trellis_1_2_Rate();
private Trellis_3_4_Rate mThreeQuarterRate = new Trellis_3_4_Rate();
private BCH_63_16_11 mNIDDecoder = new BCH_63_16_11();
/**
@@ -290,7 +292,6 @@ public class P25MessageFramer implements Listener<Dibit>
if( confirmed )
{
setDUID( DataUnitID.PDUC );
}
else
{
@@ -390,14 +391,34 @@ public class P25MessageFramer implements Listener<Dibit>
mComplete = true;
break;
case PDUC:
int blocks = mMessage.getInt( PDUMessage.BLOCKS_TO_FOLLOW );
int current = ( mMessage.size() - 260 ) / 196;
if( current < blocks )
/* De-interleave the latest block*/
P25Interleave.deinterleaveData( mMessage,
mMessage.size() - 196, mMessage.size() );
/* Decode 3/4 rate convolutional encoding from latest block */
if( mThreeQuarterRate.decode( mMessage,
mMessage.size() - 196, mMessage.size() ) )
{
mMessageLength += 196;
mMessage.setSize( mMessage.size() + 196 );
/* Resize the message to account for removing 48 + 4 parity bits */
mMessage.setSize( mMessage.size() - 52 );
int blocks = mMessage.getInt( PDUMessage.BLOCKS_TO_FOLLOW );
int current = ( mMessage.size() - 160 ) / 144;
if( current < blocks )
{
mMessageLength += 196;
mMessage.setSize( mMessage.size() + 196 );
}
else
{
dispatch( new PDUConfirmedMessage( mMessage.copy(),
mDUID, mAliasList ) );
mComplete = true;
}
break;
}
else
{