shithub: opus

Download patch

ref: d04f59b4bfbb2ca105f0ee7109913ac0f0bca6b8
parent: d4744e0ba0013beb745f8ae1aef990eda5c79299
author: Jean-Marc Valin <jeanmarcv@google.com>
date: Wed Jun 12 12:25:54 EDT 2024

Cleaning up projection encode/decoder functions

--- a/src/opus_projection_decoder.c
+++ b/src/opus_projection_decoder.c
@@ -210,24 +210,19 @@
 }
 
 #ifdef FIXED_POINT
-int opus_projection_decode(OpusProjectionDecoder *st, const unsigned char *data,
-                           opus_int32 len, opus_int16 *pcm, int frame_size,
-                           int decode_fec)
-{
-  return opus_multistream_decode_native(get_multistream_decoder(st), data, len,
-    pcm, opus_projection_copy_channel_out_short, frame_size, decode_fec, 0,
-    get_dec_demixing_matrix(st));
-}
+#define OPTIONAL_CLIP 0
 #else
+#define OPTIONAL_CLIP 1
+#endif
+
 int opus_projection_decode(OpusProjectionDecoder *st, const unsigned char *data,
                            opus_int32 len, opus_int16 *pcm, int frame_size,
                            int decode_fec)
 {
   return opus_multistream_decode_native(get_multistream_decoder(st), data, len,
-    pcm, opus_projection_copy_channel_out_short, frame_size, decode_fec, 1,
+    pcm, opus_projection_copy_channel_out_short, frame_size, decode_fec, OPTIONAL_CLIP,
     get_dec_demixing_matrix(st));
 }
-#endif
 
 #ifndef DISABLE_FLOAT_API
 int opus_projection_decode_float(OpusProjectionDecoder *st, const unsigned char *data,
--- a/src/opus_projection_encoder.c
+++ b/src/opus_projection_encoder.c
@@ -393,7 +393,6 @@
 }
 
 #ifndef DISABLE_FLOAT_API
-#ifdef FIXED_POINT
 int opus_projection_encode_float(OpusProjectionEncoder *st, const float *pcm,
                                  int frame_size, unsigned char *data,
                                  opus_int32 max_data_bytes)
@@ -400,18 +399,8 @@
 {
   return opus_multistream_encode_native(get_multistream_encoder(st),
     opus_projection_copy_channel_in_float, pcm, frame_size, data,
-    max_data_bytes, 16, downmix_float, 1, get_mixing_matrix(st));
+    max_data_bytes, MAX_ENCODING_DEPTH, downmix_float, 1, get_mixing_matrix(st));
 }
-#else
-int opus_projection_encode_float(OpusProjectionEncoder *st, const float *pcm,
-                                 int frame_size, unsigned char *data,
-                                 opus_int32 max_data_bytes)
-{
-  return opus_multistream_encode_native(get_multistream_encoder(st),
-    opus_projection_copy_channel_in_float, pcm, frame_size, data,
-    max_data_bytes, 24, downmix_float, 1, get_mixing_matrix(st));
-}
-#endif
 #endif
 
 void opus_projection_encoder_destroy(OpusProjectionEncoder *st)
--