1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

Deep redesign: Valgrind optimizations

This commit is contained in:
f4exb 2015-08-29 03:09:00 +02:00
parent 5101a08632
commit 43a783aceb
2 changed files with 19 additions and 10 deletions

View File

@ -224,16 +224,19 @@ public:
}
void myDecimate(Sample* sample1, Sample* sample2)
{
{
static const qint16 mod33[38] = { 31,32,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,
20,21,22,23,24,25,26,27,28,29,30,31,32,0,1,2} ;
20,21,22,23,24,25,26,27,28,29,30,31,32,0,1,2};
m_samples[m_ptr][0] = sample1->real();
m_samples[m_ptr][1] = sample1->imag();
m_ptr = mod33[m_ptr + 2 - 1];
m_samples[m_ptr][0] = sample2->real();
m_samples[m_ptr][1] = sample2->imag();
doFIR(sample2);
m_ptr = mod33[m_ptr + 2 - 1];
}
@ -305,12 +308,14 @@ protected:
// go through samples in buffer
qint32 iAcc = 0;
qint32 qAcc = 0;
for(int i = 0; i < HB_FILTERORDER / 4; i++) {
for (int i = 0; i < HB_FILTERORDER / 4; i++)
{
// do multiply-accumulate
qint32 iTmp = m_samples[a][0] + m_samples[b][0];
qint32 qTmp = m_samples[a][1] + m_samples[b][1];
iAcc += iTmp * COEFF[i];
qAcc += qTmp * COEFF[i];
//qint32 iTmp = m_samples[a][0] + m_samples[b][0]; // Valgrind optim
//qint32 qTmp = m_samples[a][1] + m_samples[b][1]; // Valgrind optim
iAcc += (m_samples[a][0] + m_samples[b][0]) * COEFF[i];
qAcc += (m_samples[a][1] + m_samples[b][1]) * COEFF[i];
// update read-pointer
a = mod33[a + 2 + 2];
@ -318,6 +323,7 @@ protected:
}
a = mod33[a + 2 - 1];
iAcc += ((qint32)m_samples[a][0] + 1) << (HB_SHIFT - 1);
qAcc += ((qint32)m_samples[a][1] + 1) << (HB_SHIFT - 1);

View File

@ -195,14 +195,16 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
// convert to int16
std::vector<qint32>::const_iterator src = m_mixBuffer.begin();
//std::vector<qint32>::const_iterator src = m_mixBuffer.begin(); // Valgrind optim
qint16* dst = (qint16*) data;
qint32 s;
for (uint i = 0; i < framesPerBuffer; i++)
{
// left channel
qint32 s = *src++;
//s = *src++; // Valgrind optim
s = m_mixBuffer[2*i];
if(s < -32768)
{
@ -217,7 +219,8 @@ qint64 AudioOutput::readData(char* data, qint64 maxLen)
// right channel
s = *src++;
//s = *src++; // Valgrind optim
s = m_mixBuffer[2*i + 1];
if(s < -32768)
{