39 [WIP] - restructured the polyphase filter process. Previous version

was not computationally feasible with my 3rd Gen i7 processor running
and airspy at 10 MHz.  Restructured the polyphase channelizer to use
vector iteration structures that the JDK 9 JIT compiler can translate
into SIMD instructions.  Separated the IFFT processing from the filter
process so that they can be executed on separate threads and this allows
the processing to occur real time.

P25 C4FM decoding at 25 kHz channel sample rate using an airspy
10MHz sample stream seems to be working nicely with ~25% CPU usage and
~300 to 500 MB memory usage.  Incremental (parallel) channel decoding
should have a minimal increase in CPU loading since all of the 12.5 kHz
channels are available in the polyphase channelizer and the only
additional workload is the decoding of the 25 kHz sample stream.

There is still an issue with stopping channels and the channelizer keeps
 processing, and occasionally when starting traffic channels something
 deadlocks and causes out of memory.
This commit is contained in:
Denny
2018-04-15 09:05:06 -04:00
parent ff9395e4b9
commit e971ad4582
18 changed files with 637 additions and 702 deletions

View File

@@ -21,14 +21,14 @@ import org.slf4j.LoggerFactory;
import java.util.Queue;
import java.util.concurrent.LinkedTransferQueue;
public abstract class AbstractReusableBufferQueue<T extends ReusableBuffer> implements IReusableBufferDisposedListener<T>
public abstract class AbstractReusableBufferQueue<T extends AbstractReusableBuffer>
implements IReusableBufferDisposedListener<T>
{
private final static Logger mLog = LoggerFactory.getLogger(AbstractReusableBufferQueue.class);
private Queue<T> mReusableBufferQueue = new LinkedTransferQueue<>();
private int mBufferCount = 0;
private String mDebugName;
private int mBufferUserCounter;
public AbstractReusableBufferQueue(String debugName)
{
@@ -54,48 +54,31 @@ public abstract class AbstractReusableBufferQueue<T extends ReusableBuffer> impl
public void disposed(T reusableBuffer)
{
mReusableBufferQueue.offer(reusableBuffer);
// if(mDebugName != null && mDebugName.contentEquals("NativeBufferConverter"))
// {
// mLog.debug("Reclaimed: " + reusableBuffer.name());
// }
}
/**
* Returns a reusable buffer from an internal recycling queue, or creates a new buffer if there are currently no
* buffers available for reuse.
*
* @param size of the samples that will be loaded into the buffer
* @return a reusable buffer
* Get a recycled buffer from the queue
*/
public T getBuffer(int size)
protected T getRecycledBuffer()
{
T buffer = mReusableBufferQueue.poll();
if(buffer == null)
{
buffer = createBuffer(size);
mBufferCount++;
buffer.setDebugName("Owner:" + mDebugName + " Number:" + mBufferUserCounter++ + " NEW BUFFER");
mLog.debug("Buffer Created - Count:" + mBufferCount + (mDebugName != null ? " [" + mDebugName + "]" : ""));
}
else
{
String previous = buffer.name();
buffer.setDebugName("Owner:" + mDebugName + " Number:" + mBufferUserCounter++);
// if(mDebugName != null && mDebugName.contentEquals("NativeBufferConverter"))
// {
// mLog.debug("Buffer Reused: " + previous + " New Name:" + buffer.name());
// }
}
return buffer;
return mReusableBufferQueue.poll();
}
/**
* Create a new buffer of the specified size
* Increments the count of buffers managed by this queue. Note: this method is NOT thread safe
*/
protected abstract T createBuffer(int size);
protected void incrementBufferCount()
{
mBufferCount++;
}
protected int getBufferCount()
{
return mBufferCount;
}
protected String getDebugName()
{
return mDebugName;
}
}