convert inline buffers to dynamic growth per instance

This commit is contained in:
Charles J. Cliffe
2014-12-24 03:03:34 -05:00
parent 576a77e095
commit b487cf9901
4 changed files with 72 additions and 32 deletions
+15 -8
View File
@@ -104,6 +104,9 @@ void DemodulatorPreThread::threadMain() {
std::deque<DemodulatorThreadPostIQData *> buffers;
std::deque<DemodulatorThreadPostIQData *>::iterator buffers_i;
std::vector<liquid_float_complex> in_buf_data;
std::vector<liquid_float_complex> out_buf_data;
while (!terminated) {
DemodulatorThreadIQData *inp;
inputQueue->pop(inp);
@@ -167,11 +170,17 @@ void DemodulatorPreThread::threadMain() {
if (data->size()) {
int bufSize = data->size() / 2;
liquid_float_complex in_buf_data[bufSize];
liquid_float_complex out_buf_data[bufSize];
if (in_buf_data.size() != bufSize) {
if (in_buf_data.capacity() < bufSize) {
in_buf_data.reserve(bufSize);
out_buf_data.reserve(bufSize);
}
in_buf_data.resize(bufSize);
out_buf_data.resize(bufSize);
}
liquid_float_complex *in_buf = in_buf_data;
liquid_float_complex *out_buf = out_buf_data;
liquid_float_complex *in_buf = &in_buf_data[0];
liquid_float_complex *out_buf = &out_buf_data[0];
liquid_float_complex *temp_buf = NULL;
for (int i = 0; i < bufSize; i++) {
@@ -215,12 +224,10 @@ void DemodulatorPreThread::threadMain() {
resamp->resampler = resampler;
postInputQueue->push(resamp);
inp->decRefCount();
} else {
inp->decRefCount();
}
inp->decRefCount();
if (!workerResults->empty()) {
while (!workerResults->empty()) {
DemodulatorWorkerThreadResult result;