mirror of
https://github.com/DSheirer/sdrtrunk.git
synced 2026-11-16 18:47:33 -05:00
#1360 Resolves issue with Polyphase channelizer and decoded message timestamps for P25 and other protocols. (#1361)
Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
@@ -23,11 +23,10 @@ import io.github.dsheirer.sample.Listener;
|
|||||||
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;
|
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;
|
||||||
import io.github.dsheirer.source.ISourceEventListener;
|
import io.github.dsheirer.source.ISourceEventListener;
|
||||||
import io.github.dsheirer.source.SourceEvent;
|
import io.github.dsheirer.source.SourceEvent;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public abstract class AbstractComplexPolyphaseChannelizer implements Listener<InterleavedComplexSamples>, ISourceEventListener
|
public abstract class AbstractComplexPolyphaseChannelizer implements Listener<InterleavedComplexSamples>, ISourceEventListener
|
||||||
{
|
{
|
||||||
@@ -38,6 +37,7 @@ public abstract class AbstractComplexPolyphaseChannelizer implements Listener<In
|
|||||||
private int mChannelCount;
|
private int mChannelCount;
|
||||||
private int mSubChannelCount;
|
private int mSubChannelCount;
|
||||||
private double mChannelSampleRate;
|
private double mChannelSampleRate;
|
||||||
|
protected long mCurrentSamplesTimestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Complex sample polyphase channelizer
|
* Complex sample polyphase channelizer
|
||||||
@@ -106,7 +106,7 @@ public abstract class AbstractComplexPolyphaseChannelizer implements Listener<In
|
|||||||
{
|
{
|
||||||
for(PolyphaseChannelSource channel : mChannels)
|
for(PolyphaseChannelSource channel : mChannels)
|
||||||
{
|
{
|
||||||
channel.receiveChannelResults(channelResultsList);
|
channel.receiveChannelResults(channelResultsList, mCurrentSamplesTimestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,15 +22,14 @@ import io.github.dsheirer.dsp.filter.FilterFactory;
|
|||||||
import io.github.dsheirer.dsp.filter.design.FilterDesignException;
|
import io.github.dsheirer.dsp.filter.design.FilterDesignException;
|
||||||
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;
|
import io.github.dsheirer.sample.complex.InterleavedComplexSamples;
|
||||||
import io.github.dsheirer.util.Dispatcher;
|
import io.github.dsheirer.util.Dispatcher;
|
||||||
import org.apache.commons.math3.util.FastMath;
|
|
||||||
import org.jtransforms.fft.FloatFFT_1D;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import org.apache.commons.math3.util.FastMath;
|
||||||
|
import org.jtransforms.fft.FloatFFT_1D;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Non-Maximally Decimated Polyphase Filter Bank (NMDPFB) channelizer that divides the input baseband complex sample
|
* Non-Maximally Decimated Polyphase Filter Bank (NMDPFB) channelizer that divides the input baseband complex sample
|
||||||
@@ -193,7 +192,8 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
|
|||||||
@Override
|
@Override
|
||||||
public void receive(InterleavedComplexSamples complexSamples)
|
public void receive(InterleavedComplexSamples complexSamples)
|
||||||
{
|
{
|
||||||
//TODO: how do we pass the timestamp onto the sample assemblers?
|
mCurrentSamplesTimestamp = complexSamples.timestamp();
|
||||||
|
|
||||||
float[] samples = complexSamples.samples();
|
float[] samples = complexSamples.samples();
|
||||||
|
|
||||||
int samplesPointer = 0;
|
int samplesPointer = 0;
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
|
|||||||
private double mChannelSampleRate;
|
private double mChannelSampleRate;
|
||||||
private long mIndexCenterFrequency;
|
private long mIndexCenterFrequency;
|
||||||
private long mChannelFrequencyCorrection;
|
private long mChannelFrequencyCorrection;
|
||||||
private long mCurrentSamplesTimestamp;
|
|
||||||
private ReentrantLock mOutputProcessorLock = new ReentrantLock();
|
private ReentrantLock mOutputProcessorLock = new ReentrantLock();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -107,7 +106,6 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
|
|||||||
public void receive(ComplexSamples complexSamples)
|
public void receive(ComplexSamples complexSamples)
|
||||||
{
|
{
|
||||||
mStreamHeartbeatProcessor.receive(complexSamples);
|
mStreamHeartbeatProcessor.receive(complexSamples);
|
||||||
mCurrentSamplesTimestamp = complexSamples.timestamp();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -215,8 +213,9 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
|
|||||||
* channel aggregation, and dispatch the results to the downstream sample listener/consumer.
|
* channel aggregation, and dispatch the results to the downstream sample listener/consumer.
|
||||||
*
|
*
|
||||||
* @param channelResultsList containing a list of polyphase channelizer output arrays.
|
* @param channelResultsList containing a list of polyphase channelizer output arrays.
|
||||||
|
* @param currentSamplesTimestamp for the samples
|
||||||
*/
|
*/
|
||||||
public void receiveChannelResults(List<float[]> channelResultsList)
|
public void receiveChannelResults(List<float[]> channelResultsList, long currentSamplesTimestamp)
|
||||||
{
|
{
|
||||||
mOutputProcessorLock.lock();
|
mOutputProcessorLock.lock();
|
||||||
|
|
||||||
@@ -224,7 +223,7 @@ public class PolyphaseChannelSource extends TunerChannelSource implements Listen
|
|||||||
{
|
{
|
||||||
if(mPolyphaseChannelOutputProcessor != null)
|
if(mPolyphaseChannelOutputProcessor != null)
|
||||||
{
|
{
|
||||||
mPolyphaseChannelOutputProcessor.receiveChannelResults(channelResultsList, mCurrentSamplesTimestamp);
|
mPolyphaseChannelOutputProcessor.receiveChannelResults(channelResultsList, currentSamplesTimestamp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
Reference in New Issue
Block a user