APT demod: allocate image row on heap to save one copy

pull/875/head
f4exb 2021-04-23 10:16:46 +02:00
rodzic 8b5ebbd1b5
commit 054e6feaa5
3 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -81,14 +81,14 @@ public:
}
private:
float m_pixels[APT_PROW_WIDTH];
const float *m_pixels;
int m_zenith;
MsgPixels(const float *pixels, int zenith) :
Message(),
m_pixels(pixels),
m_zenith(zenith)
{
memcpy(m_pixels, pixels, sizeof(m_pixels));
}
};

Wyświetl plik

@ -105,6 +105,7 @@ bool APTDemodImageWorker::handleMessage(const Message& cmd)
const APTDemod::MsgPixels& pixelsMsg = (APTDemod::MsgPixels&) cmd;
const float *pixels = pixelsMsg.getPixels();
processPixels(pixels);
delete[] pixels;
return true;
}
else if (APTDemod::MsgResetDecoder::match(cmd))

Wyświetl plik

@ -122,7 +122,7 @@ void APTDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV
// 2 lines per second
if (m_sampleCount >= APTDEMOD_AUDIO_SAMPLE_RATE)
{
float pixels[APT_PROW_WIDTH];
float *pixels = new float[APT_PROW_WIDTH];
apt_getpixelrow(pixels, m_row, &m_zenith, m_row == 0, getsamples, this);
if (getImageWorkerMessageQueue()) {