Removes debug logging for polyphase channelizer and reusable buffer queues.

This commit is contained in:
Denny
2018-07-01 06:43:40 -04:00
parent f7a873dd0c
commit 0051a1d381
10 changed files with 14 additions and 59 deletions

View File

@@ -118,7 +118,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
mTapsPerChannel = tapsPerChannel; mTapsPerChannel = tapsPerChannel;
float[] filterTaps = FilterFactory.getSincM2Channelizer(getChannelSampleRate(), getChannelCount(), float[] filterTaps = FilterFactory.getSincM2Channelizer(getChannelSampleRate(), getChannelCount(),
mTapsPerChannel, true); mTapsPerChannel, false);
init(filterTaps); init(filterTaps);
} }
@@ -171,7 +171,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
super.setSampleRate(sampleRate); super.setSampleRate(sampleRate);
float[] filterTaps = FilterFactory.getSincM2Channelizer(getChannelSampleRate(), getChannelCount(), float[] filterTaps = FilterFactory.getSincM2Channelizer(getChannelSampleRate(), getChannelCount(),
mTapsPerChannel, true); mTapsPerChannel, false);
init(filterTaps); init(filterTaps);
} }
@@ -188,9 +188,6 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
@Override @Override
public void receive(ReusableComplexBuffer reusableComplexBuffer) public void receive(ReusableComplexBuffer reusableComplexBuffer)
{ {
long start = System.nanoTime();
long processing = 0;
ReusableChannelResultsBuffer channelResultsBuffer = getChannelResultsBuffer(); ReusableChannelResultsBuffer channelResultsBuffer = getChannelResultsBuffer();
channelResultsBuffer.setTimestamp(reusableComplexBuffer.getTimestamp()); channelResultsBuffer.setTimestamp(reusableComplexBuffer.getTimestamp());
@@ -219,7 +216,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
if(mSampleBufferPointer >= mSamplesPerBlock) if(mSampleBufferPointer >= mSamplesPerBlock)
{ {
//Filter buffered samples and produce a single sample across each of the polyphase channels //Filter buffered samples and produce a single sample across each of the polyphase channels
processing += process(channelResultsBuffer); process(channelResultsBuffer);
//Right-shift the samples in the buffer over to make room for a new block of samples //Right-shift the samples in the buffer over to make room for a new block of samples
//Note: since JDK 8, hotspot JIT compiler uses native processor intrinsics for efficiency //Note: since JDK 8, hotspot JIT compiler uses native processor intrinsics for efficiency
@@ -337,7 +334,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
* Processes the sample buffer for each new block of sample data that is loaded and distributes the results to any * Processes the sample buffer for each new block of sample data that is loaded and distributes the results to any
* registered channel listeners. * registered channel listeners.
*/ */
private long process(ReusableChannelResultsBuffer channelResultsBuffer) private void process(ReusableChannelResultsBuffer channelResultsBuffer)
{ {
//Multiply each of the samples by the corresponding filter tap //Multiply each of the samples by the corresponding filter tap
for(int x = 0; x < mInlineSamples.length; x++) for(int x = 0; x < mInlineSamples.length; x++)
@@ -345,8 +342,6 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
mInlineInterimOutput[x] = mInlineSamples[x] * mInlineFilter[x]; mInlineInterimOutput[x] = mInlineSamples[x] * mInlineFilter[x];
} }
long start = System.nanoTime();
Arrays.fill(mFilterAccumulator, 0.0f); Arrays.fill(mFilterAccumulator, 0.0f);
int tapOffset = 0; int tapOffset = 0;
@@ -382,10 +377,6 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
channelResultsBuffer.addChannelResults(processed); channelResultsBuffer.addChannelResults(processed);
mTopBlockIndicator = !mTopBlockIndicator; mTopBlockIndicator = !mTopBlockIndicator;
long elapsed = System.nanoTime() - start;
return elapsed;
} }
/** /**
@@ -466,20 +457,4 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
return buffersToDispose; return buffersToDispose;
} }
} }
public static void main(String[] args)
{
int channelCount = 4;
int tapsPerChannel = 8;
float[] taps = new float[channelCount * tapsPerChannel];
for(int x = 0; x < taps.length; x++)
{
taps[x] = x;
}
float[] filter = getAlignedFilter(taps, channelCount, tapsPerChannel);
mLog.debug(Arrays.toString(filter));
}
} }

View File

@@ -146,26 +146,14 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
*/ */
public TunerChannelSource getChannel(TunerChannel tunerChannel) public TunerChannelSource getChannel(TunerChannel tunerChannel)
{ {
mLog.debug("Getting channel: " + tunerChannel.toString());
PolyphaseChannelSource channelSource = null; PolyphaseChannelSource channelSource = null;
try try
{ {
List<Integer> polyphaseIndexes = mChannelCalculator.getChannelIndexes(tunerChannel); List<Integer> polyphaseIndexes = mChannelCalculator.getChannelIndexes(tunerChannel);
StringBuilder sb = new StringBuilder();
sb.append("Channel Indexes - ");
for(int index: polyphaseIndexes)
{
sb.append(index).append(":").append((long)mChannelCalculator.getIndexCenterFrequency(index,
ChannelCalculator.IndexBoundaryPolicy.ADJUST_POSITIVE)).append(" ");
}
mLog.debug(sb.toString());
IPolyphaseChannelOutputProcessor outputProcessor = getOutputProcessor(polyphaseIndexes); IPolyphaseChannelOutputProcessor outputProcessor = getOutputProcessor(polyphaseIndexes);
mLog.debug("Channel Ouput Processor: " + outputProcessor.getClass());
if(outputProcessor != null) if(outputProcessor != null)
{ {
long centerFrequency = mChannelCalculator.getCenterFrequencyForIndexes(polyphaseIndexes); long centerFrequency = mChannelCalculator.getCenterFrequencyForIndexes(polyphaseIndexes);
@@ -210,7 +198,7 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
} }
catch(IllegalArgumentException iae) catch(IllegalArgumentException iae)
{ {
mLog.error("Error", iae); mLog.error("Couldn't get test channel with index:" + index, iae);
} }
return channelSource; return channelSource;
@@ -319,7 +307,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
//Update channel calculator immediately so that channels can be allocated //Update channel calculator immediately so that channels can be allocated
mChannelCalculator.setCenterFrequency(sourceEvent.getValue().longValue()); mChannelCalculator.setCenterFrequency(sourceEvent.getValue().longValue());
mLog.debug("Tuner frequency change: " + sourceEvent.getValue().longValue());
//Defer channelizer configuration changes to be handled on the buffer processor thread //Defer channelizer configuration changes to be handled on the buffer processor thread
mBufferSourceEventMonitor.receive(sourceEvent); mBufferSourceEventMonitor.receive(sourceEvent);
break; break;
@@ -354,8 +341,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
{ {
if(mPolyphaseChannelizer == null || Math.abs(mPolyphaseChannelizer.getSampleRate() - sampleRate) > 0.5) if(mPolyphaseChannelizer == null || Math.abs(mPolyphaseChannelizer.getSampleRate() - sampleRate) > 0.5)
{ {
mLog.debug("Creating or Updating Channelizer for sample rate " + sampleRate);
try try
{ {
if(mPolyphaseChannelizer == null) if(mPolyphaseChannelizer == null)
@@ -384,10 +369,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
double updatedChannelSampleRate = mChannelCalculator.getChannelSampleRate(); double updatedChannelSampleRate = mChannelCalculator.getChannelSampleRate();
updateOutputProcessors(SourceEvent.sampleRateChange(updatedChannelSampleRate, "Channelizer Sample Rate Update")); updateOutputProcessors(SourceEvent.sampleRateChange(updatedChannelSampleRate, "Channelizer Sample Rate Update"));
} }
else
{
mLog.debug("Request to update current sample rate ignored: " + sampleRate);
}
} }
/** /**
@@ -408,7 +389,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
{ {
try try
{ {
mLog.debug("**Sending source event to channel: " + sourceEvent.toString());
channelSource.process(sourceEvent); channelSource.process(sourceEvent);
} }
catch(SourceException se) catch(SourceException se)
@@ -439,7 +419,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
//If the indexes size is the same then update the current processor, otherwise create a new one //If the indexes size is the same then update the current processor, otherwise create a new one
if(channelSource.getPolyphaseChannelOutputProcessor().getInputChannelCount() == indexes.size()) if(channelSource.getPolyphaseChannelOutputProcessor().getInputChannelCount() == indexes.size())
{ {
mLog.debug("Updating existing output processor - indexes:" + indexes + " freq:" + centerFrequency);
channelSource.getPolyphaseChannelOutputProcessor().setPolyphaseChannelIndices(indexes); channelSource.getPolyphaseChannelOutputProcessor().setPolyphaseChannelIndices(indexes);
channelSource.setFrequency(centerFrequency); channelSource.setFrequency(centerFrequency);
@@ -458,7 +437,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
} }
else else
{ {
mLog.debug("Setting new output processor - indexes:" + indexes + " freq:" + centerFrequency);
channelSource.setPolyphaseChannelOutputProcessor(getOutputProcessor(indexes), centerFrequency); channelSource.setPolyphaseChannelOutputProcessor(getOutputProcessor(indexes), centerFrequency);
} }
} }
@@ -599,7 +577,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor
*/ */
public void receive(SourceEvent event) public void receive(SourceEvent event)
{ {
mLog.debug("Got a source event: " + event.toString());
mQueuedSourceEvents.offer(event); mQueuedSourceEvents.offer(event);
} }

View File

@@ -234,7 +234,6 @@ public class PolyphaseChannelSource extends TunerChannelSource
{ {
synchronized(mPolyphaseChannelOutputProcessor) synchronized(mPolyphaseChannelOutputProcessor)
{ {
mLog.debug("Setting output processor frequency offset to: " + getFrequencyOffset());
mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset()); mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset());
} }
} }

View File

@@ -78,7 +78,6 @@ public abstract class ChannelOutputProcessor implements IPolyphaseChannelOutputP
@Override @Override
public void setFrequencyOffset(long frequencyOffset) public void setFrequencyOffset(long frequencyOffset)
{ {
mLog.debug("Setting frequency offset to: " + frequencyOffset + " for class:" + this.getClass());
mFrequencyCorrectionMixer.setFrequency(frequencyOffset); mFrequencyCorrectionMixer.setFrequency(frequencyOffset);
mFrequencyCorrectionEnabled = (frequencyOffset != 0); mFrequencyCorrectionEnabled = (frequencyOffset != 0);
} }

View File

@@ -24,6 +24,7 @@ import io.github.dsheirer.dsp.gain.ComplexFeedForwardGainControl;
import io.github.dsheirer.dsp.psk.DQPSKDecisionDirectedDemodulator; import io.github.dsheirer.dsp.psk.DQPSKDecisionDirectedDemodulator;
import io.github.dsheirer.dsp.psk.InterpolatingSampleBuffer; import io.github.dsheirer.dsp.psk.InterpolatingSampleBuffer;
import io.github.dsheirer.dsp.psk.pll.CostasLoop; import io.github.dsheirer.dsp.psk.pll.CostasLoop;
import io.github.dsheirer.dsp.psk.pll.Tracking;
import io.github.dsheirer.sample.buffer.ReusableComplexBuffer; import io.github.dsheirer.sample.buffer.ReusableComplexBuffer;
import io.github.dsheirer.source.SourceEvent; import io.github.dsheirer.source.SourceEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -63,6 +64,7 @@ public class P25DecoderC4FM extends P25Decoder
mBasebandFilter = new ComplexFIRFilter2(getBasebandFilter()); mBasebandFilter = new ComplexFIRFilter2(getBasebandFilter());
mCostasLoop = new CostasLoop(getSampleRate(), getSymbolRate()); mCostasLoop = new CostasLoop(getSampleRate(), getSymbolRate());
mCostasLoop.setTracking(Tracking.FAST);
mInterpolatingSampleBuffer = new InterpolatingSampleBuffer(getSamplesPerSymbol(), SAMPLE_COUNTER_GAIN); mInterpolatingSampleBuffer = new InterpolatingSampleBuffer(getSamplesPerSymbol(), SAMPLE_COUNTER_GAIN);
mQPSKDemodulator = new DQPSKDecisionDirectedDemodulator(mCostasLoop, mInterpolatingSampleBuffer); mQPSKDemodulator = new DQPSKDecisionDirectedDemodulator(mCostasLoop, mInterpolatingSampleBuffer);
@@ -162,6 +164,7 @@ public class P25DecoderC4FM extends P25Decoder
case NOTIFICATION_FREQUENCY_CHANGE: case NOTIFICATION_FREQUENCY_CHANGE:
case NOTIFICATION_FREQUENCY_CORRECTION_CHANGE: case NOTIFICATION_FREQUENCY_CORRECTION_CHANGE:
case NOTIFICATION_CHANNEL_FREQUENCY_CORRECTION_CHANGE: case NOTIFICATION_CHANNEL_FREQUENCY_CORRECTION_CHANGE:
mLog.debug("Resetting COSTAS loop for: " + sourceEvent.getEvent().name());
mCostasLoop.reset(); mCostasLoop.reset();
break; break;
case NOTIFICATION_SAMPLE_RATE_CHANGE: case NOTIFICATION_SAMPLE_RATE_CHANGE:

View File

@@ -23,6 +23,7 @@ import io.github.dsheirer.dsp.gain.ComplexFeedForwardGainControl;
import io.github.dsheirer.dsp.psk.DQPSKGardnerDemodulator; import io.github.dsheirer.dsp.psk.DQPSKGardnerDemodulator;
import io.github.dsheirer.dsp.psk.InterpolatingSampleBuffer; import io.github.dsheirer.dsp.psk.InterpolatingSampleBuffer;
import io.github.dsheirer.dsp.psk.pll.CostasLoop; import io.github.dsheirer.dsp.psk.pll.CostasLoop;
import io.github.dsheirer.dsp.psk.pll.Tracking;
import io.github.dsheirer.sample.buffer.ReusableComplexBuffer; import io.github.dsheirer.sample.buffer.ReusableComplexBuffer;
import io.github.dsheirer.source.SourceEvent; import io.github.dsheirer.source.SourceEvent;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -67,6 +68,7 @@ public class P25DecoderLSM extends P25Decoder
mBasebandFilter = new ComplexFIRFilter2(getBasebandFilter()); mBasebandFilter = new ComplexFIRFilter2(getBasebandFilter());
mCostasLoop = new CostasLoop(getSampleRate(), getSymbolRate()); mCostasLoop = new CostasLoop(getSampleRate(), getSymbolRate());
mCostasLoop.setTracking(Tracking.NORMAL);
mInterpolatingSampleBuffer = new InterpolatingSampleBuffer(getSamplesPerSymbol(), SAMPLE_COUNTER_GAIN); mInterpolatingSampleBuffer = new InterpolatingSampleBuffer(getSamplesPerSymbol(), SAMPLE_COUNTER_GAIN);
mQPSKDemodulator = new DQPSKGardnerDemodulator(mCostasLoop, mInterpolatingSampleBuffer); mQPSKDemodulator = new DQPSKGardnerDemodulator(mCostasLoop, mInterpolatingSampleBuffer);

View File

@@ -47,7 +47,7 @@ public class ReusableAudioPacketQueue extends AbstractReusableBufferQueue<Reusab
incrementBufferCount(); incrementBufferCount();
buffer.setDebugName("Owner:" + getDebugName()); buffer.setDebugName("Owner:" + getDebugName());
mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : "")); // mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : ""));
} }
buffer.setType(ReusableAudioPacket.Type.AUDIO); buffer.setType(ReusableAudioPacket.Type.AUDIO);

View File

@@ -44,7 +44,7 @@ public class ReusableBufferQueue extends AbstractReusableBufferQueue<ReusableBuf
incrementBufferCount(); incrementBufferCount();
buffer.setDebugName("Owner:" + getDebugName()); buffer.setDebugName("Owner:" + getDebugName());
mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : "")); // mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : ""));
} }
buffer.resize(size); buffer.resize(size);

View File

@@ -47,7 +47,7 @@ public class ReusableChannelResultsBufferQueue extends AbstractReusableBufferQue
incrementBufferCount(); incrementBufferCount();
buffer.setDebugName("Owner:" + getDebugName()); buffer.setDebugName("Owner:" + getDebugName());
mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : "")); // mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : ""));
} }
return buffer; return buffer;

View File

@@ -55,7 +55,7 @@ public class ReusableComplexBufferQueue extends AbstractReusableBufferQueue<Reus
incrementBufferCount(); incrementBufferCount();
buffer.setDebugName("Owner:" + getDebugName()); buffer.setDebugName("Owner:" + getDebugName());
mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : "")); // mLog.debug("Buffer Created - Count:" + getBufferCount() + (getDebugName() != null ? " [" + getDebugName() + "]" : ""));
} }
buffer.resize(size); buffer.resize(size);