1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-09-04 22:27:53 -04:00

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

This commit is contained in:
f4exb 2021-04-23 10:16:46 +02:00
parent 8b5ebbd1b5
commit 054e6feaa5
3 changed files with 4 additions and 3 deletions

View File

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

View File

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

View File

@ -122,7 +122,7 @@ void APTDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV
// 2 lines per second // 2 lines per second
if (m_sampleCount >= APTDEMOD_AUDIO_SAMPLE_RATE) 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); apt_getpixelrow(pixels, m_row, &m_zenith, m_row == 0, getsamples, this);
if (getImageWorkerMessageQueue()) { if (getImageWorkerMessageQueue()) {