shithub: opus

Download patch

ref: f7495d4af192c511fe4afe8002a9bafe904f6558
parent: 3171ed6fceb38a16b0e0c06016fa711c031eadf7
author: Jean-Marc Valin <jeanmarcv@google.com>
date: Wed Jun 12 11:24:14 EDT 2024

Cleanup multistream encode/decode API functions

--- a/src/opus_multistream_decoder.c
+++ b/src/opus_multistream_decoder.c
@@ -360,9 +360,12 @@
    }
 }
 
-
-
 #ifdef FIXED_POINT
+#define OPTIONAL_CLIP 0
+#else
+#define OPTIONAL_CLIP 1
+#endif
+
 int opus_multistream_decode(
       OpusMSDecoder *st,
       const unsigned char *data,
@@ -373,35 +376,12 @@
 )
 {
    return opus_multistream_decode_native(st, data, len,
-       pcm, opus_copy_channel_out_short, frame_size, decode_fec, 0, NULL);
+       pcm, opus_copy_channel_out_short, frame_size, decode_fec, OPTIONAL_CLIP, NULL);
 }
 
 #ifndef DISABLE_FLOAT_API
 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, 0, NULL);
-}
-#endif
-
-#else
-
-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, 1, NULL);
-}
-
-int opus_multistream_decode_float(
-      OpusMSDecoder *st,
-      const unsigned char *data,
-      opus_int32 len,
-      opus_val16 *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, 0, NULL);
--- a/src/opus_multistream_encoder.c
+++ b/src/opus_multistream_encoder.c
@@ -1051,10 +1051,9 @@
 }
 
 
-#ifdef FIXED_POINT
 int opus_multistream_encode(
     OpusMSEncoder *st,
-    const opus_val16 *pcm,
+    const opus_int16 *pcm,
     int frame_size,
     unsigned char *data,
     opus_int32 max_data_bytes
@@ -1074,35 +1073,7 @@
 )
 {
    return opus_multistream_encode_native(st, opus_copy_channel_in_float,
-      pcm, frame_size, data, max_data_bytes, 16, downmix_float, 1, NULL);
-}
-#endif
-
-#else
-
-int opus_multistream_encode_float
-(
-    OpusMSEncoder *st,
-    const opus_val16 *pcm,
-    int frame_size,
-    unsigned char *data,
-    opus_int32 max_data_bytes
-)
-{
-   return opus_multistream_encode_native(st, opus_copy_channel_in_float,
-      pcm, frame_size, data, max_data_bytes, 24, downmix_float, 1, NULL);
-}
-
-int opus_multistream_encode(
-    OpusMSEncoder *st,
-    const opus_int16 *pcm,
-    int frame_size,
-    unsigned char *data,
-    opus_int32 max_data_bytes
-)
-{
-   return opus_multistream_encode_native(st, opus_copy_channel_in_short,
-      pcm, frame_size, data, max_data_bytes, 16, downmix_int, 0, NULL);
+      pcm, frame_size, data, max_data_bytes, MAX_ENCODING_DEPTH, downmix_float, 1, NULL);
 }
 #endif
 
--