summaryrefslogtreecommitdiff
path: root/src/opus_multistream_decoder.c
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2013-03-01 15:18:23 -0500
committerJean-Marc Valin <jmvalin@jmvalin.ca>2013-03-01 15:23:01 -0500
commit32c4a0c96e239bee7623aef8ae592a5c7f7ec753 (patch)
treea0125b967107e50702851b1bb7007a18ee01e23f /src/opus_multistream_decoder.c
parent69c3dcd105432a72220478cbde851cc7917e5768 (diff)
downloadopus-32c4a0c96e239bee7623aef8ae592a5c7f7ec753.tar.gz
Applies soft-clipping to the int decoder API.
opus_decode() and opus_multistream_decode() now apply soft clipping before converting to 16-bit int. This should produce better a higher quality result than hard clipping like we were doing before. The _float() API isn't affected, but the clipping function is exported so users can manually apply the soft clipping.
Diffstat (limited to 'src/opus_multistream_decoder.c')
-rw-r--r--src/opus_multistream_decoder.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/opus_multistream_decoder.c b/src/opus_multistream_decoder.c
index 7564c735..47f87b19 100644
--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -159,7 +159,8 @@ static int opus_multistream_decode_native(
void *pcm,
opus_copy_channel_out_func copy_channel_out,
int frame_size,
- int decode_fec
+ int decode_fec,
+ int soft_clip
)
{
opus_int32 Fs;
@@ -199,7 +200,7 @@ static int opus_multistream_decode_native(
return OPUS_INVALID_PACKET;
}
packet_offset = 0;
- ret = opus_decode_native(dec, data, len, buf, frame_size, decode_fec, s!=st->layout.nb_streams-1, &packet_offset);
+ ret = opus_decode_native(dec, data, len, buf, frame_size, decode_fec, s!=st->layout.nb_streams-1, &packet_offset, soft_clip);
data += packet_offset;
len -= packet_offset;
if (ret > frame_size)
@@ -333,7 +334,7 @@ int opus_multistream_decode(
)
{
return opus_multistream_decode_native(st, data, len,
- pcm, opus_copy_channel_out_short, frame_size, decode_fec);
+ pcm, opus_copy_channel_out_short, frame_size, decode_fec, 0);
}
#ifndef DISABLE_FLOAT_API
@@ -341,7 +342,7 @@ int opus_multistream_decode_float(OpusMSDecoder *st, const unsigned char *data,
opus_int32 len, float *pcm, int frame_size, int decode_fec)
{
return opus_multistream_decode_native(st, data, len,
- pcm, opus_copy_channel_out_float, frame_size, decode_fec);
+ pcm, opus_copy_channel_out_float, frame_size, decode_fec, 0);
}
#endif
@@ -351,7 +352,7 @@ int opus_multistream_decode(OpusMSDecoder *st, const unsigned char *data,
opus_int32 len, opus_int16 *pcm, int frame_size, int decode_fec)
{
return opus_multistream_decode_native(st, data, len,
- pcm, opus_copy_channel_out_short, frame_size, decode_fec);
+ pcm, opus_copy_channel_out_short, frame_size, decode_fec, 1);
}
int opus_multistream_decode_float(
@@ -364,7 +365,7 @@ int opus_multistream_decode_float(
)
{
return opus_multistream_decode_native(st, data, len,
- pcm, opus_copy_channel_out_float, frame_size, decode_fec);
+ pcm, opus_copy_channel_out_float, frame_size, decode_fec, 0);
}
#endif