[opus] Issue with decoding 8-bit PCM data
Amit Ashara
ashara.amit at gmail.com
Thu Jan 7 10:04:04 PST 2016
Hello All
I have successfully run the Opus Decoder for 16-bit WAV files. However when
doing the same on 8-bit, the decoder produces noise, but on 16 bit data the
output is working. Both the 8 and 16 bit files are from the same source and
hence except for some loss of quality on 8 bit, they are identical in total
play back duration.
For both 8 and 16 bit data I have used the following parameters
ui32SamplingRate = 8000
ui32Channel = 1
FRAME_SIZE_IN_MS is 20
MAX_PACKET is 1500
ui8ScaleFactor = 1 for 8-bit and 2 for 16-bit data
ui32BitsPerSample = 8 for 8-bit data and 16 for 16-bit data
The code is as follows
sOpusDec = opus_decoder_create(ui32SamplingRate, ui32Channel, &i32error);
if (i32error != OPUS_OK)
{
return((int)i32error);
}
opus_decoder_ctl(sOpusDec, OPUS_SET_LSB_DEPTH(ui32BitsPerSample));
ui32SizeOfWrBuf =
(ui32SamplingRate*ui32Channel*FRAME_SIZE_IN_MS*ui8ScaleFactor)/1000;
opi16_out =
(int16_t*)calloc(((ui32SizeOfWrBuf/ui8ScaleFactor)+1),sizeof(int16_t));
pcRdBuf = (uint8_t *)calloc(MAX_PACKET,sizeof(uint8_t));
output_samples = opus_decode(sOpusDec, (const unsigned char *)&pcRdBuf[0],
len, opi16_out, (ui32SizeOfWrBuf/ui8ScaleFactor), 0);
I am not able to understand what the issue is. Or do I need to look at the
encoder?
Regards
Amit
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/opus/attachments/20160107/806e7004/attachment.htm
More information about the opus
mailing list