[WIP] Updates the LTR-Standard and LTR-Net decoders to use a new LTR

decoder with a zero-crossing symbol timing error detector.  The new
decoder is optimized for 8 kHz FM demodulated audio produced by the
AudioModule.
This commit is contained in:
Denny
2018-06-02 08:47:48 -04:00
parent c13315f731
commit a898be265f
64 changed files with 2660 additions and 1285 deletions

View File

@@ -20,7 +20,7 @@ package io.github.dsheirer.module.decode;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.alias.AliasModel;
import io.github.dsheirer.audio.AudioModule2;
import io.github.dsheirer.audio.AudioModule;
import io.github.dsheirer.channel.metadata.Metadata;
import io.github.dsheirer.channel.state.AlwaysUnsquelchedDecoderState;
import io.github.dsheirer.channel.traffic.TrafficChannelManager;
@@ -30,8 +30,6 @@ import io.github.dsheirer.controller.channel.ChannelModel;
import io.github.dsheirer.controller.channel.ChannelProcessingManager;
import io.github.dsheirer.controller.channel.map.ChannelMap;
import io.github.dsheirer.controller.channel.map.ChannelMapModel;
import io.github.dsheirer.dsp.filter.FilterFactory;
import io.github.dsheirer.dsp.filter.fir.FIRFilterSpecification;
import io.github.dsheirer.filter.AllPassFilter;
import io.github.dsheirer.filter.FilterSet;
import io.github.dsheirer.filter.IFilter;
@@ -101,39 +99,8 @@ public class DecoderFactory
{
private final static Logger mLog = LoggerFactory.getLogger(DecoderFactory.class);
private static final int NBFM_PASS_FREQUENCY = 6000;
private static final int NBFM_STOP_FREQUENCY = 6500;
//Low-pass filter with ~60 dB attenuation and 89 taps
private static final FIRFilterSpecification MPT1327_FILTER_SPECIFICATION = FIRFilterSpecification.lowPassBuilder()
.sampleRate( 48000 ).gridDensity( 16 ).passBandCutoff( 3200 ).passBandAmplitude( 1.0 ).passBandRipple( 0.02 )
.stopBandStart( 4000 ).stopBandAmplitude( 0.0 ).stopBandRipple( 0.03 ).build();
private static final FIRFilterSpecification P25_C4FM_IQ_SPECIFICATION = FIRFilterSpecification.lowPassBuilder()
.sampleRate(48000).gridDensity(16).passBandCutoff(6750).passBandAmplitude(1.0).passBandRipple(0.01)
.stopBandStart(7000).stopBandAmplitude(0.0).stopBandRipple(0.008).build();
private static final FIRFilterSpecification P25_C4FM_DEMOD_SPECIFICATION = FIRFilterSpecification.lowPassBuilder()
.sampleRate(48000).gridDensity(16).passBandCutoff(2500).passBandAmplitude(1.0).passBandRipple(0.01)
.stopBandStart(4000).stopBandAmplitude(0.0).stopBandRipple(0.008).build();
private static float[] MPT1327_LOWPASS_FILTER;
private static float[] P25_C4FM_IQ_FILTER;
private static float[] P25_C4FM_DEMOD_FILTER;
static
{
try
{
MPT1327_LOWPASS_FILTER = FilterFactory.getTaps(MPT1327_FILTER_SPECIFICATION);
P25_C4FM_IQ_FILTER = FilterFactory.getTaps(P25_C4FM_IQ_SPECIFICATION);
P25_C4FM_DEMOD_FILTER = FilterFactory.getTaps(P25_C4FM_DEMOD_SPECIFICATION);
}
catch(Exception e)
{
mLog.error("Couldn't design startup filter(s)");
}
}
private static final double CHANNEL_BANDWIDTH = 12500.0;
private static final double DEMODULATED_AUDIO_SAMPLE_RATE = 8000.0;
/**
* Returns a list of one primary decoder and any auxiliary decoders, as
@@ -183,30 +150,28 @@ public class DecoderFactory
modules.add(new AMDecoder(decodeConfig));
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.AM, channel.getName()));
modules.add(new AMDemodulatorModule());
//TODO: update AM demodulator to produce demodulated 8 kHz audio and delete the following filter module
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule2(metadata));
modules.add(new AudioModule(metadata));
break;
case NBFM:
modules.add(new NBFMDecoder(decodeConfig));
modules.add(new AlwaysUnsquelchedDecoderState(DecoderType.NBFM, channel.getName()));
modules.add(new FMDemodulatorModule(NBFM_PASS_FREQUENCY, NBFM_STOP_FREQUENCY));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule2(metadata));
modules.add(new FMDemodulatorModule(CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
modules.add(new AudioModule(metadata));
break;
case LTR_STANDARD:
MessageDirection direction = ((DecodeConfigLTRStandard) decodeConfig).getMessageDirection();
modules.add(new LTRStandardDecoder(aliasList, direction));
modules.add(new LTRStandardDecoderState(aliasList));
modules.add(new FMDemodulatorModule(NBFM_PASS_FREQUENCY, NBFM_STOP_FREQUENCY));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule2(metadata));
modules.add(new FMDemodulatorModule(CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
modules.add(new AudioModule(metadata));
break;
case LTR_NET:
modules.add(new LTRNetDecoder((DecodeConfigLTRNet) decodeConfig, aliasList));
modules.add(new LTRNetDecoderState(aliasList));
modules.add(new FMDemodulatorModule(NBFM_PASS_FREQUENCY, NBFM_STOP_FREQUENCY));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule2(metadata));
modules.add(new FMDemodulatorModule(CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
modules.add(new AudioModule(metadata));
break;
case MPT1327:
DecodeConfigMPT1327 mptConfig = (DecodeConfigMPT1327) decodeConfig;
@@ -227,16 +192,14 @@ public class DecoderFactory
(aliasList != null ? aliasList.getName() : null), mptConfig.getTrafficChannelPoolSize()));
}
modules.add(new FMDemodulatorModule(NBFM_PASS_FREQUENCY, NBFM_STOP_FREQUENCY));
modules.add(new DemodulatedAudioFilterModule(P25_C4FM_DEMOD_FILTER, 1.0f));
modules.add(new AudioModule2(metadata));
modules.add(new FMDemodulatorModule(CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
modules.add(new AudioModule(metadata));
break;
case PASSPORT:
modules.add(new PassportDecoder(decodeConfig, aliasList));
modules.add(new PassportDecoderState(aliasList));
modules.add(new FMDemodulatorModule(NBFM_PASS_FREQUENCY, NBFM_STOP_FREQUENCY));
modules.add(new DemodulatedAudioFilterModule(4000, 6000));
modules.add(new AudioModule2(metadata));
modules.add(new FMDemodulatorModule(CHANNEL_BANDWIDTH, DEMODULATED_AUDIO_SAMPLE_RATE));
modules.add(new AudioModule(metadata));
break;
case P25_PHASE1:
DecodeConfigP25Phase1 p25Config = (DecodeConfigP25Phase1) decodeConfig;

View File

@@ -1,121 +1,92 @@
/*******************************************************************************
* 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/>
* sdr-trunk
* Copyright (C) 2014-2018 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/>
*
******************************************************************************/
package io.github.dsheirer.module.decode.ltrnet;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern;
import io.github.dsheirer.dsp.fsk.LTRFSKDecoder;
import io.github.dsheirer.instrument.Instrumentable;
import io.github.dsheirer.instrument.tap.Tap;
import io.github.dsheirer.instrument.tap.TapGroup;
import io.github.dsheirer.dsp.fsk.LTRDecoder;
import io.github.dsheirer.message.MessageDirection;
import io.github.dsheirer.module.decode.Decoder;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.real.IUnFilteredRealBufferListener;
import io.github.dsheirer.sample.real.RealBuffer;
import io.github.dsheirer.sample.buffer.IReusableBufferListener;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
import java.util.ArrayList;
import java.util.List;
public class LTRNetDecoder extends Decoder
implements IUnFilteredRealBufferListener, Instrumentable
public class LTRNetDecoder extends Decoder implements IReusableBufferListener, Listener<ReusableBuffer>
{
public static final int LTR_STANDARD_MESSAGE_LENGTH = 40;
private LTRFSKDecoder mLTRFSKDecoder;
private MessageFramer mLTRMessageFramer;
private LTRNetMessageProcessor mLTRMessageProcessor;
public static final int LTR_NET_MESSAGE_LENGTH = 40;
protected LTRDecoder mLTRDecoder;
private MessageFramer mLTRMessageFramer;
private LTRNetMessageProcessor mLTRMessageProcessor;
private List<TapGroup> mAvailableTaps;
/**
* LTR-Net Decoder. Decodes unfiltered (e.g. demodulated but with no DC or
* audio filtering) samples and produces LTR-Net messages.
*/
public LTRNetDecoder( DecodeConfigLTRNet config, AliasList aliasList )
{
mLTRFSKDecoder = new LTRFSKDecoder();
if( config.getMessageDirection() == MessageDirection.OSW )
{
mLTRMessageFramer =
new MessageFramer( SyncPattern.LTR_STANDARD_OSW.getPattern(),
LTR_STANDARD_MESSAGE_LENGTH );
}
else
{
mLTRMessageFramer =
new MessageFramer( SyncPattern.LTR_STANDARD_ISW.getPattern(),
LTR_STANDARD_MESSAGE_LENGTH );
}
mLTRFSKDecoder.addListener( mLTRMessageFramer );
mLTRMessageProcessor = new LTRNetMessageProcessor(
config.getMessageDirection(), aliasList );
mLTRMessageFramer.addMessageListener( mLTRMessageProcessor );
mLTRMessageProcessor.setMessageListener( getMessageListener() );
}
@Override
public DecoderType getDecoderType()
{
return DecoderType.LTR_NET;
}
@Override
public Listener<RealBuffer> getUnFilteredRealBufferListener()
{
return mLTRFSKDecoder;
}
@Override
public List<TapGroup> getTapGroups()
public LTRNetDecoder(DecodeConfigLTRNet config, AliasList aliasList, LTRDecoder ltrDecoder)
{
if( mAvailableTaps == null )
mLTRDecoder = ltrDecoder;
if(config.getMessageDirection() == MessageDirection.OSW)
{
mAvailableTaps = new ArrayList<TapGroup>();
mAvailableTaps.addAll( mLTRFSKDecoder.getTapGroups() );
mLTRMessageFramer = new MessageFramer(SyncPattern.LTR_STANDARD_OSW.getPattern(), LTR_NET_MESSAGE_LENGTH);
}
else
{
mLTRMessageFramer = new MessageFramer(SyncPattern.LTR_STANDARD_ISW.getPattern(), LTR_NET_MESSAGE_LENGTH);
}
return mAvailableTaps;
mLTRDecoder.setListener(mLTRMessageFramer);
mLTRMessageFramer.setSyncDetectListener(mLTRDecoder);
mLTRMessageProcessor = new LTRNetMessageProcessor(config.getMessageDirection(), aliasList);
mLTRMessageFramer.addMessageListener(mLTRMessageProcessor);
mLTRMessageProcessor.setMessageListener(getMessageListener());
}
/**
* LTR-Net Decoder. Decodes unfiltered (e.g. demodulated but with no DC or
* audio filtering) samples and produces LTR-Net messages.
*/
public LTRNetDecoder(DecodeConfigLTRNet config, AliasList aliasList)
{
this(config, aliasList, new LTRDecoder(LTR_NET_MESSAGE_LENGTH));
}
@Override
public void registerTap( Tap tap )
public DecoderType getDecoderType()
{
mLTRFSKDecoder.registerTap( tap );
return DecoderType.LTR_NET;
}
@Override
public void unregisterTap( Tap tap )
public Listener<ReusableBuffer> getReusableBufferListener()
{
mLTRFSKDecoder.unregisterTap( tap );
return mLTRDecoder;
}
@Override
public void reset()
{
mLTRMessageFramer.reset();
}
@Override
public void receive(ReusableBuffer reusableBuffer)
{
mLTRDecoder.receive(reusableBuffer);
}
@Override
public void reset()
{
mLTRMessageFramer.reset();
}
}

View File

@@ -0,0 +1,44 @@
/*******************************************************************************
* sdr-trunk
* Copyright (C) 2014-2018 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/>
*
******************************************************************************/
package io.github.dsheirer.module.decode.ltrnet;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.dsp.fsk.LTRDecoderInstrumented;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
import javafx.beans.property.SimpleIntegerProperty;
public class LTRNetDecoderInstrumented extends LTRNetDecoder
{
public SimpleIntegerProperty bufferCount = new SimpleIntegerProperty();
public LTRNetDecoderInstrumented(DecodeConfigLTRNet config, AliasList aliasList)
{
super(config, aliasList, new LTRDecoderInstrumented(LTR_NET_MESSAGE_LENGTH));
}
public LTRDecoderInstrumented getLTRDecoder()
{
return (LTRDecoderInstrumented)mLTRDecoder;
}
@Override
public void receive(ReusableBuffer reusableBuffer)
{
super.receive(reusableBuffer);
bufferCount.setValue(bufferCount.intValue() + 1);
}
}

View File

@@ -1,85 +1,84 @@
/*******************************************************************************
* SDR Trunk
* Copyright (C) 2014,2015 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/>
* sdr-trunk
* Copyright (C) 2014-2018 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/>
*
******************************************************************************/
package io.github.dsheirer.module.decode.ltrstandard;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern;
import io.github.dsheirer.dsp.fsk.LTRFSKDecoder;
import io.github.dsheirer.dsp.fsk.LTRDecoder;
import io.github.dsheirer.message.MessageDirection;
import io.github.dsheirer.module.decode.Decoder;
import io.github.dsheirer.module.decode.DecoderType;
import io.github.dsheirer.sample.Listener;
import io.github.dsheirer.sample.real.IUnFilteredRealBufferListener;
import io.github.dsheirer.sample.real.RealBuffer;
import io.github.dsheirer.sample.buffer.IReusableBufferListener;
import io.github.dsheirer.sample.buffer.ReusableBuffer;
public class LTRStandardDecoder extends Decoder implements IUnFilteredRealBufferListener
public class LTRStandardDecoder extends Decoder implements IReusableBufferListener, Listener<ReusableBuffer>
{
public static final int LTR_STANDARD_MESSAGE_LENGTH = 40;
public static final int LTR_STANDARD_MESSAGE_LENGTH = 40;
private LTRDecoder mLTRDecoder;
private MessageFramer mLTRMessageFramer;
private LTRStandardMessageProcessor mLTRMessageProcessor;
private LTRFSKDecoder mLTRFSKDecoder;
private MessageFramer mLTRMessageFramer;
private LTRStandardMessageProcessor mLTRMessageProcessor;
/**
* LTR Decoder. Decodes unfiltered (e.g. demodulated but with no DC or
* audio filtering) samples and produces LTR Standard messages.
*/
public LTRStandardDecoder( AliasList aliasList,
MessageDirection direction )
{
mLTRFSKDecoder = new LTRFSKDecoder();
public LTRStandardDecoder(AliasList aliasList, MessageDirection direction)
{
mLTRDecoder = new LTRDecoder(LTR_STANDARD_MESSAGE_LENGTH);
if( direction == MessageDirection.OSW )
{
mLTRMessageFramer =
new MessageFramer( SyncPattern.LTR_STANDARD_OSW.getPattern(),
LTR_STANDARD_MESSAGE_LENGTH );
}
else
{
mLTRMessageFramer =
new MessageFramer( SyncPattern.LTR_STANDARD_ISW.getPattern(),
LTR_STANDARD_MESSAGE_LENGTH );
}
mLTRFSKDecoder.addListener( mLTRMessageFramer );
if(direction == MessageDirection.OSW)
{
mLTRMessageFramer = new MessageFramer(SyncPattern.LTR_STANDARD_OSW.getPattern(), LTR_STANDARD_MESSAGE_LENGTH);
}
else
{
mLTRMessageFramer = new MessageFramer(SyncPattern.LTR_STANDARD_ISW.getPattern(), LTR_STANDARD_MESSAGE_LENGTH);
}
mLTRMessageProcessor = new LTRStandardMessageProcessor( direction, aliasList );
mLTRMessageFramer.addMessageListener( mLTRMessageProcessor );
mLTRMessageProcessor.setMessageListener( getMessageListener() );
}
mLTRDecoder.setListener(mLTRMessageFramer);
mLTRMessageFramer.setSyncDetectListener(mLTRDecoder);
mLTRMessageProcessor = new LTRStandardMessageProcessor(direction, aliasList);
mLTRMessageFramer.addMessageListener(mLTRMessageProcessor);
mLTRMessageProcessor.setMessageListener(getMessageListener());
}
@Override
public DecoderType getDecoderType()
{
return DecoderType.LTR_STANDARD;
}
@Override
public DecoderType getDecoderType()
{
return DecoderType.LTR_STANDARD;
}
@Override
public Listener<RealBuffer> getUnFilteredRealBufferListener()
{
return mLTRFSKDecoder;
}
@Override
public Listener<ReusableBuffer> getReusableBufferListener()
{
return mLTRDecoder;
}
@Override
public void reset()
{
mLTRMessageFramer.reset();
}
@Override
public void receive(ReusableBuffer reusableBuffer)
{
mLTRDecoder.receive(reusableBuffer);
}
@Override
public void reset()
{
mLTRMessageFramer.reset();
}
}

View File

@@ -3,13 +3,13 @@ package io.github.dsheirer.module.decode.p25;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.BinaryMessage;
import io.github.dsheirer.bits.BitSetFullException;
import io.github.dsheirer.bits.ISyncDetectListener;
import io.github.dsheirer.bits.MultiSyncPatternMatcher;
import io.github.dsheirer.bits.SoftSyncDetector;
import io.github.dsheirer.bits.SyncDetector;
import io.github.dsheirer.dsp.psk.pll.IPhaseLockedLoop;
import io.github.dsheirer.dsp.symbol.Dibit;
import io.github.dsheirer.dsp.symbol.FrameSync;
import io.github.dsheirer.dsp.symbol.ISyncDetectListener;
import io.github.dsheirer.edac.BCH_63_16_11;
import io.github.dsheirer.edac.CRC;
import io.github.dsheirer.edac.CRCP25;

View File

@@ -20,7 +20,7 @@ package io.github.dsheirer.module.decode.passport;
import io.github.dsheirer.alias.AliasList;
import io.github.dsheirer.bits.MessageFramer;
import io.github.dsheirer.bits.SyncPattern;
import io.github.dsheirer.dsp.fsk.LTRFSKDecoder;
import io.github.dsheirer.dsp.fsk.LTRFSKDecoderLegacy;
import io.github.dsheirer.instrument.Instrumentable;
import io.github.dsheirer.instrument.tap.Tap;
import io.github.dsheirer.instrument.tap.TapGroup;
@@ -40,7 +40,7 @@ public class PassportDecoder extends Decoder
public static final int PASSPORT_MESSAGE_LENGTH = 68;
public static final int PASSPORT_SYNC_LENGTH = 9;
private LTRFSKDecoder mPassportFSKDecoder;
private LTRFSKDecoderLegacy mPassportFSKDecoder;
private MessageFramer mPassportMessageFramer;
private PassportMessageProcessor mPassportMessageProcessor;
@@ -52,7 +52,7 @@ public class PassportDecoder extends Decoder
*/
public PassportDecoder(DecodeConfiguration config, AliasList aliasList )
{
mPassportFSKDecoder = new LTRFSKDecoder();
mPassportFSKDecoder = new LTRFSKDecoderLegacy();
mPassportMessageFramer =
new MessageFramer( SyncPattern.PASSPORT.getPattern(),