From 0051a1d38113653b1c7067dcca75389acbaef879 Mon Sep 17 00:00:00 2001 From: Denny Date: Sun, 1 Jul 2018 06:43:40 -0400 Subject: [PATCH] Removes debug logging for polyphase channelizer and reusable buffer queues. --- .../ComplexPolyphaseChannelizerM2.java | 33 +++---------------- .../channelizer/PolyphaseChannelManager.java | 25 +------------- .../channelizer/PolyphaseChannelSource.java | 1 - .../output/ChannelOutputProcessor.java | 1 - .../module/decode/p25/P25DecoderC4FM.java | 3 ++ .../module/decode/p25/P25DecoderLSM.java | 2 ++ .../buffer/ReusableAudioPacketQueue.java | 2 +- .../sample/buffer/ReusableBufferQueue.java | 2 +- .../ReusableChannelResultsBufferQueue.java | 2 +- .../buffer/ReusableComplexBufferQueue.java | 2 +- 10 files changed, 14 insertions(+), 59 deletions(-) diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ComplexPolyphaseChannelizerM2.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ComplexPolyphaseChannelizerM2.java index 91ebda5c..f1742359 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ComplexPolyphaseChannelizerM2.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/ComplexPolyphaseChannelizerM2.java @@ -118,7 +118,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann mTapsPerChannel = tapsPerChannel; float[] filterTaps = FilterFactory.getSincM2Channelizer(getChannelSampleRate(), getChannelCount(), - mTapsPerChannel, true); + mTapsPerChannel, false); init(filterTaps); } @@ -171,7 +171,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann super.setSampleRate(sampleRate); float[] filterTaps = FilterFactory.getSincM2Channelizer(getChannelSampleRate(), getChannelCount(), - mTapsPerChannel, true); + mTapsPerChannel, false); init(filterTaps); } @@ -188,9 +188,6 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann @Override public void receive(ReusableComplexBuffer reusableComplexBuffer) { - long start = System.nanoTime(); - long processing = 0; - ReusableChannelResultsBuffer channelResultsBuffer = getChannelResultsBuffer(); channelResultsBuffer.setTimestamp(reusableComplexBuffer.getTimestamp()); @@ -219,7 +216,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann if(mSampleBufferPointer >= mSamplesPerBlock) { //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 //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 * registered channel listeners. */ - private long process(ReusableChannelResultsBuffer channelResultsBuffer) + private void process(ReusableChannelResultsBuffer channelResultsBuffer) { //Multiply each of the samples by the corresponding filter tap for(int x = 0; x < mInlineSamples.length; x++) @@ -345,8 +342,6 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann mInlineInterimOutput[x] = mInlineSamples[x] * mInlineFilter[x]; } - long start = System.nanoTime(); - Arrays.fill(mFilterAccumulator, 0.0f); int tapOffset = 0; @@ -382,10 +377,6 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann channelResultsBuffer.addChannelResults(processed); mTopBlockIndicator = !mTopBlockIndicator; - - long elapsed = System.nanoTime() - start; - - return elapsed; } /** @@ -466,20 +457,4 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann 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)); - } } diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java index c9cb1cac..b4ea6441 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelManager.java @@ -146,26 +146,14 @@ public class PolyphaseChannelManager implements ISourceEventProcessor */ public TunerChannelSource getChannel(TunerChannel tunerChannel) { - mLog.debug("Getting channel: " + tunerChannel.toString()); PolyphaseChannelSource channelSource = null; try { List 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); - mLog.debug("Channel Ouput Processor: " + outputProcessor.getClass()); - if(outputProcessor != null) { long centerFrequency = mChannelCalculator.getCenterFrequencyForIndexes(polyphaseIndexes); @@ -210,7 +198,7 @@ public class PolyphaseChannelManager implements ISourceEventProcessor } catch(IllegalArgumentException iae) { - mLog.error("Error", iae); + mLog.error("Couldn't get test channel with index:" + index, iae); } return channelSource; @@ -319,7 +307,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor //Update channel calculator immediately so that channels can be allocated 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 mBufferSourceEventMonitor.receive(sourceEvent); break; @@ -354,8 +341,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor { if(mPolyphaseChannelizer == null || Math.abs(mPolyphaseChannelizer.getSampleRate() - sampleRate) > 0.5) { - mLog.debug("Creating or Updating Channelizer for sample rate " + sampleRate); - try { if(mPolyphaseChannelizer == null) @@ -384,10 +369,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor double updatedChannelSampleRate = mChannelCalculator.getChannelSampleRate(); 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 { - mLog.debug("**Sending source event to channel: " + sourceEvent.toString()); channelSource.process(sourceEvent); } 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(channelSource.getPolyphaseChannelOutputProcessor().getInputChannelCount() == indexes.size()) { - mLog.debug("Updating existing output processor - indexes:" + indexes + " freq:" + centerFrequency); channelSource.getPolyphaseChannelOutputProcessor().setPolyphaseChannelIndices(indexes); channelSource.setFrequency(centerFrequency); @@ -458,7 +437,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor } else { - mLog.debug("Setting new output processor - indexes:" + indexes + " freq:" + centerFrequency); channelSource.setPolyphaseChannelOutputProcessor(getOutputProcessor(indexes), centerFrequency); } } @@ -599,7 +577,6 @@ public class PolyphaseChannelManager implements ISourceEventProcessor */ public void receive(SourceEvent event) { - mLog.debug("Got a source event: " + event.toString()); mQueuedSourceEvents.offer(event); } diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelSource.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelSource.java index 07e065f1..222e0690 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelSource.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/PolyphaseChannelSource.java @@ -234,7 +234,6 @@ public class PolyphaseChannelSource extends TunerChannelSource { synchronized(mPolyphaseChannelOutputProcessor) { - mLog.debug("Setting output processor frequency offset to: " + getFrequencyOffset()); mPolyphaseChannelOutputProcessor.setFrequencyOffset(getFrequencyOffset()); } } diff --git a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java index 43c1e858..599832fb 100644 --- a/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java +++ b/src/main/java/io/github/dsheirer/dsp/filter/channelizer/output/ChannelOutputProcessor.java @@ -78,7 +78,6 @@ public abstract class ChannelOutputProcessor implements IPolyphaseChannelOutputP @Override public void setFrequencyOffset(long frequencyOffset) { - mLog.debug("Setting frequency offset to: " + frequencyOffset + " for class:" + this.getClass()); mFrequencyCorrectionMixer.setFrequency(frequencyOffset); mFrequencyCorrectionEnabled = (frequencyOffset != 0); } diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderC4FM.java b/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderC4FM.java index 14bc4d33..d2af6a7a 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderC4FM.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderC4FM.java @@ -24,6 +24,7 @@ import io.github.dsheirer.dsp.gain.ComplexFeedForwardGainControl; import io.github.dsheirer.dsp.psk.DQPSKDecisionDirectedDemodulator; import io.github.dsheirer.dsp.psk.InterpolatingSampleBuffer; 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.source.SourceEvent; import org.slf4j.Logger; @@ -63,6 +64,7 @@ public class P25DecoderC4FM extends P25Decoder mBasebandFilter = new ComplexFIRFilter2(getBasebandFilter()); mCostasLoop = new CostasLoop(getSampleRate(), getSymbolRate()); + mCostasLoop.setTracking(Tracking.FAST); mInterpolatingSampleBuffer = new InterpolatingSampleBuffer(getSamplesPerSymbol(), SAMPLE_COUNTER_GAIN); mQPSKDemodulator = new DQPSKDecisionDirectedDemodulator(mCostasLoop, mInterpolatingSampleBuffer); @@ -162,6 +164,7 @@ public class P25DecoderC4FM extends P25Decoder case NOTIFICATION_FREQUENCY_CHANGE: case NOTIFICATION_FREQUENCY_CORRECTION_CHANGE: case NOTIFICATION_CHANNEL_FREQUENCY_CORRECTION_CHANGE: + mLog.debug("Resetting COSTAS loop for: " + sourceEvent.getEvent().name()); mCostasLoop.reset(); break; case NOTIFICATION_SAMPLE_RATE_CHANGE: diff --git a/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderLSM.java b/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderLSM.java index 064652cf..5e3648de 100644 --- a/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderLSM.java +++ b/src/main/java/io/github/dsheirer/module/decode/p25/P25DecoderLSM.java @@ -23,6 +23,7 @@ import io.github.dsheirer.dsp.gain.ComplexFeedForwardGainControl; import io.github.dsheirer.dsp.psk.DQPSKGardnerDemodulator; import io.github.dsheirer.dsp.psk.InterpolatingSampleBuffer; 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.source.SourceEvent; import org.slf4j.Logger; @@ -67,6 +68,7 @@ public class P25DecoderLSM extends P25Decoder mBasebandFilter = new ComplexFIRFilter2(getBasebandFilter()); mCostasLoop = new CostasLoop(getSampleRate(), getSymbolRate()); + mCostasLoop.setTracking(Tracking.NORMAL); mInterpolatingSampleBuffer = new InterpolatingSampleBuffer(getSamplesPerSymbol(), SAMPLE_COUNTER_GAIN); mQPSKDemodulator = new DQPSKGardnerDemodulator(mCostasLoop, mInterpolatingSampleBuffer); diff --git a/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacketQueue.java b/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacketQueue.java index 1d66e4e9..fd7a83a0 100644 --- a/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacketQueue.java +++ b/src/main/java/io/github/dsheirer/sample/buffer/ReusableAudioPacketQueue.java @@ -47,7 +47,7 @@ public class ReusableAudioPacketQueue extends AbstractReusableBufferQueue