[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
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)

opus_decoder_ctl(sOpusDec, OPUS_SET_LSB_DEPTH(ui32BitsPerSample));

ui32SizeOfWrBuf =
opi16_out =
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

-------------- 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