FAQ: Conversion in Elite framework from 16-bit to 24-bit in the decoder side before sending to POPP topology
Join Date: 5 Dec 12
Posts: 41
Posted: Thu, 2013-10-10 18:19
If a 24-bit audio playback session is created and the decoder generates the output in 16-bit then after completing the decoding process Elite framework converts the 16-bit data into 24-bit in AudioDecSvc dynamic service.
Please see, AudioDecSvc_Process() in AudioDecSvc.cpp (Piece of code given below)
//get the decoder output bits per sample
int dec_bits_per_sample;
pMe->pDecoderLib->GetParam(eIcapiBitsPerSample,
&dec_bits_per_sample);
//if input is 16 bits and output is 24 bits need to shift
if((16 == dec_bits_per_sample) && (24 == pMe->output_bits_per_sample))
{
/* 16 -> 24 bit conversion if required */
uint32_t num_samples_per_chan = (pMe->PcmData.pBuf[0].nActualDataLen) / (channel_cfg_after->nChannels * BYTES_PER_SAMPLE_TWO);
int8_t * final_dst_ptr = (int8_t *)pMe->PcmData.pBuf[0].Data;
uint32_t num_channels = channel_cfg_after->nChannels;
memcpy(pMe->scratch_out_buf, final_dst_ptr, pMe->PcmData.pBuf[0].nActualDataLen);
/* Q15->Q28 conversion */
byte_up_down_convertor_deintlv((int8_t *)pMe->scratch_out_buf,
final_dst_ptr,
num_samples_per_chan,
num_channels,
num_samples_per_chan,
num_samples_per_chan,
BYTE_UP_CONV);
/* Double the out size in bytes */
pMe->PcmData.pBuf[0].nActualDataLen <<= 1;
}