mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-21 23:55:13 -05:00
Remote: more fixes in conversion routines
This commit is contained in:
parent
ab9f316737
commit
7c8cb7a85a
Binary file not shown.
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Binary file not shown.
@ -56,17 +56,6 @@ When the return key is hit within the address (1) or port (2) the changes are ef
|
|||||||
|
|
||||||
This sets the number of FEC blocks per frame. A frame consists of 128 data blocks (1 meta data block followed by 127 I/Q data blocks) and a variable number of FEC blocks used to protect the UDP transmission with a Cauchy MDS block erasure correction. The two numbers next are the total number of blocks and the number of FEC blocks separated by a slash (/).
|
This sets the number of FEC blocks per frame. A frame consists of 128 data blocks (1 meta data block followed by 127 I/Q data blocks) and a variable number of FEC blocks used to protect the UDP transmission with a Cauchy MDS block erasure correction. The two numbers next are the total number of blocks and the number of FEC blocks separated by a slash (/).
|
||||||
|
|
||||||
<h3>10: Delay between UDP blocks transmission</h3>
|
<h3>10: Transmission sample size</h3>
|
||||||
|
|
||||||
This sets the minimum delay between transmission of an UDP block (send datagram) and the next. This allows throttling of the UDP transmission that is otherwise uncontrolled and causes network congestion.
|
Number of bytes per I or Q sample in transmission.
|
||||||
|
|
||||||
The value is a percentage of the nominal time it takes to process a block of samples corresponding to one UDP block (512 bytes). This is calculated as follows:
|
|
||||||
|
|
||||||
- Sample rate on the network: _SR_
|
|
||||||
- Delay percentage: _d_
|
|
||||||
- Number of FEC blocks: _F_
|
|
||||||
- There are 127 blocks of I/Q data per frame (1 meta block for 128 blocks) and each I/Q data block of 512 bytes (128 samples) has a 8 bytes header (2 samples) thus there are 126 samples remaining effectively. This gives the constant 127*126 = 16002 samples per frame in the formula
|
|
||||||
|
|
||||||
Formula: ((127 ✕ 126 ✕ _d_) / _SR_) / (128 + _F_)
|
|
||||||
|
|
||||||
The percentage appears first at the right of the dial button and then the actual delay value in microseconds.
|
|
||||||
|
@ -144,7 +144,7 @@ void RemoteSinkSink::feed(const SampleVector::const_iterator& begin, const Sampl
|
|||||||
} // block zero
|
} // block zero
|
||||||
|
|
||||||
// handle different sample sizes...
|
// handle different sample sizes...
|
||||||
int samplesPerBlock = RemoteNbBytesPerBlock / (SDR_RX_SAMP_SZ <= 16 ? 4 : 8); // two I or Q samples
|
int samplesPerBlock = RemoteNbBytesPerBlock / (2 * m_nbTxBytes); // two I or Q samples
|
||||||
if (m_sampleIndex + inRemainingSamples < samplesPerBlock) // there is still room in the current super block
|
if (m_sampleIndex + inRemainingSamples < samplesPerBlock) // there is still room in the current super block
|
||||||
{
|
{
|
||||||
convertSampleToData(begin + inSamplesIndex, inRemainingSamples, false);
|
convertSampleToData(begin + inSamplesIndex, inRemainingSamples, false);
|
||||||
|
@ -96,12 +96,12 @@ private:
|
|||||||
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag;
|
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_nbTxBytes == 1) // 16 -> 8
|
else if (m_nbTxBytes == 1) // 16 or 24 -> 8
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2] = (uint8_t) ((begin+i)->m_real / 256);
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (int8_t) ((begin+i)->m_real / (1<<8));
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes] = (uint8_t) ((begin+i)->m_imag / 256);
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (int8_t) ((begin+i)->m_imag / (1<<8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -111,26 +111,32 @@ private:
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real << 8;
|
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real * (1<<8);
|
||||||
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag << 8;
|
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag * (1<<8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_nbTxBytes == 2) // 24 -> 16
|
else if (m_nbTxBytes == 2) // 24 -> 16
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real >> 8;
|
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real / (1<<8);
|
||||||
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag >> 8;
|
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag / (1<<8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_nbTxBytes == 1) // 16 or 24 -> 8
|
else if ((m_nbTxBytes == 1) && (sizeof(Sample) == 4)) // 16 -> 8
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2] =
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (int8_t) ((begin+i)->m_real / (1<<8));
|
||||||
(uint8_t) (((begin+i)->m_real / (1<<sizeof(Sample)*2)) & 0xFF);
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (int8_t) ((begin+i)->m_imag / (1<<8));
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes] =
|
}
|
||||||
(uint8_t) (((begin+i)->m_imag / (1<<sizeof(Sample)*2)) & 0xFF);
|
}
|
||||||
|
else if ((m_nbTxBytes == 1) && (sizeof(Sample) == 8)) // 24 -> 8
|
||||||
|
{
|
||||||
|
for (int i = 0; i < nbSamples; i++)
|
||||||
|
{
|
||||||
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (int8_t) ((begin+i)->m_real / (1<<16));
|
||||||
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (int8_t) ((begin+i)->m_imag / (1<<16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,12 +128,12 @@ private:
|
|||||||
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag;
|
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_nbTxBytes == 1) // 16 -> 8
|
else if (m_nbTxBytes == 1) // 16 or 24 -> 8
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2] = (uint8_t) ((begin+i)->m_real / 256);
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (int8_t) ((begin+i)->m_real / (1<<8));
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes] = (uint8_t) ((begin+i)->m_imag / 256);
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (int8_t) ((begin+i)->m_imag / (1<<8));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -143,26 +143,32 @@ private:
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real << 8;
|
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real * (1<<8);
|
||||||
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag << 8;
|
*((int32_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag * (1<<8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_nbTxBytes == 2) // 24 -> 16
|
else if (m_nbTxBytes == 2) // 24 -> 16
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real >> 8;
|
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (begin+i)->m_real / (1<<8);
|
||||||
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag >> 8;
|
*((int16_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (begin+i)->m_imag / (1<<8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_nbTxBytes == 1) // 16 or 24 -> 8
|
else if ((m_nbTxBytes == 1) && (sizeof(Sample) == 4)) // 16 -> 8
|
||||||
{
|
{
|
||||||
for (int i = 0; i < nbSamples; i++)
|
for (int i = 0; i < nbSamples; i++)
|
||||||
{
|
{
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2] =
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (int8_t) ((begin+i)->m_real / (1<<8));
|
||||||
(uint8_t) (((begin+i)->m_real / (1<<sizeof(Sample)*2)) & 0xFF);
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (int8_t) ((begin+i)->m_imag / (1<<8));
|
||||||
m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes] =
|
}
|
||||||
(uint8_t) (((begin+i)->m_imag / (1<<sizeof(Sample)*2)) & 0xFF);
|
}
|
||||||
|
else if ((m_nbTxBytes == 1) && (sizeof(Sample) == 4)) // 24 -> 8
|
||||||
|
{
|
||||||
|
for (int i = 0; i < nbSamples; i++)
|
||||||
|
{
|
||||||
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2]) = (int8_t) ((begin+i)->m_real / (1<<16));
|
||||||
|
*((int8_t*) &m_superBlock.m_protectedBlock.buf[(m_sampleIndex+ i)*m_nbTxBytes*2 + m_nbTxBytes]) = (int8_t) ((begin+i)->m_imag / (1<<16));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -340,13 +340,13 @@ void RemoteInputUDPHandler::tick()
|
|||||||
m_converterBuffer = new int32_t[m_readLengthSamples];
|
m_converterBuffer = new int32_t[m_readLengthSamples];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *buf = m_remoteInputBuffer.readData(m_readLength);
|
int8_t *buf = (int8_t*) m_remoteInputBuffer.readData(m_readLength);
|
||||||
|
|
||||||
for (int is = 0; is < m_readLengthSamples; is++)
|
for (int is = 0; is < m_readLengthSamples; is++)
|
||||||
{
|
{
|
||||||
m_converterBuffer[is] = buf[2*is+1] << 8; // Q -> MSB
|
m_converterBuffer[is] = buf[2*is+1] * (1<<8); // Q -> MSB
|
||||||
m_converterBuffer[is] <<= 16;
|
m_converterBuffer[is] <<= 16;
|
||||||
m_converterBuffer[is] += buf[2*is] << 8; // I -> LSB
|
m_converterBuffer[is] += buf[2*is] * (1<<8); // I -> LSB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((metaData.m_sampleBits == 8) && (SDR_RX_SAMP_SZ == 24)) // 8 -> 24
|
else if ((metaData.m_sampleBits == 8) && (SDR_RX_SAMP_SZ == 24)) // 8 -> 24
|
||||||
@ -357,14 +357,12 @@ void RemoteInputUDPHandler::tick()
|
|||||||
m_converterBuffer = new int32_t[m_readLengthSamples*2];
|
m_converterBuffer = new int32_t[m_readLengthSamples*2];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *buf = m_remoteInputBuffer.readData(m_readLength);
|
int8_t *buf = (int8_t*) m_remoteInputBuffer.readData(m_readLength);
|
||||||
|
|
||||||
for (int is = 0; is < m_readLengthSamples; is++)
|
for (int is = 0; is < m_readLengthSamples; is++)
|
||||||
{
|
{
|
||||||
m_converterBuffer[2*is] = buf[2*is]; // I
|
m_converterBuffer[2*is] = buf[2*is] * (1<<16); // I
|
||||||
m_converterBuffer[2*is] <<= 16;
|
m_converterBuffer[2*is+1] = buf[2*is+1] * (1<<16); // Q
|
||||||
m_converterBuffer[2*is+1] = buf[2*is+1]; // Q
|
|
||||||
m_converterBuffer[2*is+1] <<= 16;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
||||||
@ -377,14 +375,12 @@ void RemoteInputUDPHandler::tick()
|
|||||||
m_converterBuffer = new int32_t[m_readLengthSamples*2];
|
m_converterBuffer = new int32_t[m_readLengthSamples*2];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *buf = m_remoteInputBuffer.readData(m_readLength);
|
int16_t *buf = (int16_t*) m_remoteInputBuffer.readData(m_readLength);
|
||||||
|
|
||||||
for (int is = 0; is < m_readLengthSamples; is++)
|
for (int is = 0; is < m_readLengthSamples; is++)
|
||||||
{
|
{
|
||||||
m_converterBuffer[2*is] = ((int16_t*)buf)[2*is]; // I
|
m_converterBuffer[2*is] = buf[2*is] * (1<<8); // I
|
||||||
m_converterBuffer[2*is] <<= 8;
|
m_converterBuffer[2*is+1] = buf[2*is+1] * (1<<8); // Q
|
||||||
m_converterBuffer[2*is+1] = ((int16_t*)buf)[2*is+1]; // Q
|
|
||||||
m_converterBuffer[2*is+1] <<= 8;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
||||||
@ -397,13 +393,13 @@ void RemoteInputUDPHandler::tick()
|
|||||||
m_converterBuffer = new int32_t[m_readLengthSamples];
|
m_converterBuffer = new int32_t[m_readLengthSamples];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *buf = m_remoteInputBuffer.readData(m_readLength);
|
int32_t *buf = (int32_t*) m_remoteInputBuffer.readData(m_readLength);
|
||||||
|
|
||||||
for (int is = 0; is < m_readLengthSamples; is++)
|
for (int is = 0; is < m_readLengthSamples; is++)
|
||||||
{
|
{
|
||||||
m_converterBuffer[is] = ((int32_t *)buf)[2*is+1]>>8; // Q -> MSB
|
m_converterBuffer[is] = buf[2*is+1] / (1<<8); // Q -> MSB
|
||||||
m_converterBuffer[is] <<= 16;
|
m_converterBuffer[is] <<= 16;
|
||||||
m_converterBuffer[is] += ((int32_t *)buf)[2*is]>>8; // I -> LSB
|
m_converterBuffer[is] += buf[2*is] / (1<<8); // I -> LSB
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
||||||
|
@ -70,24 +70,23 @@ private:
|
|||||||
{
|
{
|
||||||
if (sampleSize == 2) // 8 -> 16 bits
|
if (sampleSize == 2) // 8 -> 16 bits
|
||||||
{
|
{
|
||||||
int8_t iu = m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize];
|
int8_t *buf = (int8_t*) m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf;
|
||||||
int8_t qu = m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+1];
|
iconv = buf[sampleIndex*sampleSize] * (1<<8);
|
||||||
iconv = iu * (1 << 8);
|
qconv = buf[sampleIndex*sampleSize+1] * (1<<8);
|
||||||
qconv = qu * (1 << 8);
|
|
||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
else if (sampleSize == 4) // just convert types (always 16 bits wide)
|
else if (sampleSize == 4) // just convert types (always 16 bits wide)
|
||||||
{
|
{
|
||||||
iconv = ((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]))[0];
|
iconv = *((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]));
|
||||||
qconv = ((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+2]))[0];
|
qconv = *((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+2]));
|
||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
else if (sampleSize == 8) // just convert types (always 16 bits wide)
|
else if (sampleSize == 8) // just convert types (always 16 bits wide)
|
||||||
{
|
{
|
||||||
iconv = ((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]))[0];
|
iconv = *((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]));
|
||||||
qconv = ((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+4]))[0];
|
qconv = *((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+4]));
|
||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
@ -98,26 +97,33 @@ private:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sampleSize == 2) // 8 -> 16 or 24 bits
|
if ((sampleSize == 2) && (sizeof(Sample) == 2)) // 8 -> 16 bits
|
||||||
{
|
{
|
||||||
int8_t iu = m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize];
|
int8_t *buf = (int8_t*) m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf;
|
||||||
int8_t qu = m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+1];
|
iconv = buf[sampleIndex*sampleSize] * (1<<8);
|
||||||
iconv = iu * (1 << sizeof(Sample)*2);
|
qconv = buf[sampleIndex*sampleSize+1] * (1<<8);
|
||||||
qconv = qu * (1 << sizeof(Sample)*2);
|
s.setReal(iconv);
|
||||||
|
s.setImag(qconv);
|
||||||
|
}
|
||||||
|
else if ((sampleSize == 2) && (sizeof(Sample) == 4)) // 8 -> 24 bits
|
||||||
|
{
|
||||||
|
int8_t *buf = (int8_t*) m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf;
|
||||||
|
iconv = buf[sampleIndex*sampleSize] * (1<<16);
|
||||||
|
qconv = buf[sampleIndex*sampleSize+1] * (1<<16);
|
||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
else if (sampleSize == 4) // 16 -> 24 bits
|
else if (sampleSize == 4) // 16 -> 24 bits
|
||||||
{
|
{
|
||||||
iconv = ((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]))[0] << 8;
|
iconv = *((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize])) * (1<<8);
|
||||||
qconv = ((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+2]))[0] << 8;
|
qconv = *((int16_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+2])) * (1<<8);
|
||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
else if (sampleSize == 8) // 24 -> 16 bits
|
else if (sampleSize == 8) // 24 -> 16 bits
|
||||||
{
|
{
|
||||||
iconv = ((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize]))[0] >> 8;
|
iconv = *((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize])) / (1<<8);
|
||||||
qconv = ((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+4]))[0] >> 8;
|
qconv = *((int32_t*) &(m_dataFrame->m_superBlocks[blockIndex].m_protectedBlock.buf[sampleIndex*sampleSize+4])) / (1<<8);
|
||||||
s.setReal(iconv);
|
s.setReal(iconv);
|
||||||
s.setImag(qconv);
|
s.setImag(qconv);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user