This commit is contained in:
Denny
2017-09-02 06:55:58 -04:00
parent f461ed9cdb
commit 9e275b7d62
6 changed files with 38 additions and 16 deletions

View File

@@ -92,11 +92,9 @@ public abstract class AbstractComplexPolyphaseChannelizer implements Listener<Co
*/ */
protected void dispatch(float[] channels) protected void dispatch(float[] channels)
{ {
ComplexBuffer complexChannelsBuffer = new ComplexBuffer(channels);
for(PolyphaseChannelSource channel : mChannels) for(PolyphaseChannelSource channel : mChannels)
{ {
channel.processChannels(complexChannelsBuffer); channel.processChannels(channels);
} }
} }

View File

@@ -58,7 +58,7 @@ public class ComplexPolyphaseChannelizerM2 extends AbstractComplexPolyphaseChann
if(channels % 2 != 0) if(channels % 2 != 0)
{ {
throw new IllegalArgumentException("Channel count must be a multiple of 2"); throw new IllegalArgumentException("Channel count must be an even multiple of the oversample rate (2)");
} }
initFilters(taps); initFilters(taps);

View File

@@ -88,7 +88,7 @@ public class PolyphaseChannelSource extends ComplexChannelSource
* Process the array samples for each of the output channels from the polyphase channelizer. * Process the array samples for each of the output channels from the polyphase channelizer.
* @param channelsBuffer * @param channelsBuffer
*/ */
public void processChannels(ComplexBuffer channelsBuffer) public void processChannels(float[] channelsBuffer)
{ {
mProcessor.process(channelsBuffer); mProcessor.process(channelsBuffer);
} }
@@ -199,7 +199,7 @@ public class PolyphaseChannelSource extends ComplexChannelSource
public class ChannelBufferProcessor implements Runnable public class ChannelBufferProcessor implements Runnable
{ {
private OverflowableTransferQueue<ComplexBuffer> mComplexChannelBuffers; private OverflowableTransferQueue<float[]> mComplexChannelBuffers;
public ChannelBufferProcessor() public ChannelBufferProcessor()
{ {
@@ -220,7 +220,7 @@ public class PolyphaseChannelSource extends ComplexChannelSource
* *
* @param channelsBuffer to enqueue for processing * @param channelsBuffer to enqueue for processing
*/ */
public void process(ComplexBuffer channelsBuffer) public void process(float[] channelsBuffer)
{ {
mComplexChannelBuffers.offer(channelsBuffer); mComplexChannelBuffers.offer(channelsBuffer);
} }
@@ -230,7 +230,7 @@ public class PolyphaseChannelSource extends ComplexChannelSource
{ {
try try
{ {
//TODO: implement distribution to each channel
} }
catch(Throwable throwable) catch(Throwable throwable)
{ {

View File

@@ -25,10 +25,10 @@ public interface IPolyphaseChannelOutputProcessor
/** /**
* Process the channel output channel results from the polyphase channelizer filter * Process the channel output channel results from the polyphase channelizer filter
* *
* @param channelResults to process * @param channels to process
* @param listener to receive the processed channel results * @param listener to receive the processed channel results
*/ */
void process(float[] channelResults, IComplexSampleListener listener); void process(float[] channels, IComplexSampleListener listener);
/** /**
* Specifies the positive or negative frequency correction that should be applied to samples extracted from * Specifies the positive or negative frequency correction that should be applied to samples extracted from

View File

@@ -64,30 +64,30 @@ public class SingleChannelOutputProcessor implements IPolyphaseChannelOutputProc
* Extracts the channel from the channel results array, applies frequency translation, and delivers the * Extracts the channel from the channel results array, applies frequency translation, and delivers the
* extracted frequency-translated channel sample to the complex sample listener. * extracted frequency-translated channel sample to the complex sample listener.
* *
* @param channelResults to process containing an array of channel I/Q sample pairs (I0,Q0,I1,Q1...In,Qn) * @param channels to process containing an array of channel I/Q sample pairs (I0,Q0,I1,Q1...In,Qn)
* @param listener to receive the extracted, frequency-translated channel results * @param listener to receive the extracted, frequency-translated channel results
*/ */
@Override @Override
public void process(float[] channelResults, IComplexSampleListener listener) public void process(float[] channels, IComplexSampleListener listener)
{ {
if(channelResults.length >= (mChannelOffset + 1)) if(channels.length >= (mChannelOffset + 1))
{ {
//Only perform frequency translation if the frequency correction mixer has a non-zero frequency value //Only perform frequency translation if the frequency correction mixer has a non-zero frequency value
if(mFrequencyCorrectionMixer.isEnabled()) if(mFrequencyCorrectionMixer.isEnabled())
{ {
mFrequencyCorrectionMixer.rotate(); mFrequencyCorrectionMixer.rotate();
float i = Complex.multiplyInphase(channelResults[mChannelOffset], channelResults[mChannelOffset + 1], float i = Complex.multiplyInphase(channels[mChannelOffset], channels[mChannelOffset + 1],
mFrequencyCorrectionMixer.inphase(), mFrequencyCorrectionMixer.quadrature()); mFrequencyCorrectionMixer.inphase(), mFrequencyCorrectionMixer.quadrature());
float q = Complex.multiplyQuadrature(channelResults[mChannelOffset], channelResults[mChannelOffset + 1], float q = Complex.multiplyQuadrature(channels[mChannelOffset], channels[mChannelOffset + 1],
mFrequencyCorrectionMixer.inphase(), mFrequencyCorrectionMixer.quadrature()); mFrequencyCorrectionMixer.inphase(), mFrequencyCorrectionMixer.quadrature());
listener.receive(i, q); listener.receive(i, q);
} }
else else
{ {
listener.receive(channelResults[mChannelOffset], channelResults[mChannelOffset + 1]); listener.receive(channels[mChannelOffset], channels[mChannelOffset + 1]);
} }
} }
} }

View File

@@ -0,0 +1,24 @@
/*******************************************************************************
* sdrtrunk
* Copyright (C) 2014-2017 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 sample.complex;
public interface IComplexSampleListener
{
public void receive(float i, float q);
}