shithub: opus

Download patch

ref: 59354a7742ff0fc182886f2f2567026e516c1eef
parent: 8770b0709bd3c06690bb9bfb025da913d1ccd55f
author: Jean-Marc Valin <[email protected]>
date: Thu Mar 8 07:19:07 EST 2012

Fixes int vs opus_int32 compile errors on C5x

--- a/include/opus_multistream.h
+++ b/include/opus_multistream.h
@@ -77,7 +77,7 @@
     const opus_int16 *pcm,      /**< Input signal as interleaved samples. Length is frame_size*channels */
     int frame_size,             /**< Number of samples per frame of input signal */
     unsigned char *data,        /**< Output buffer for the compressed payload (no more than max_data_bytes long) */
-    int max_data_bytes          /**< Allocated memory for payload; don't use for controlling bitrate */
+    opus_int32 max_data_bytes   /**< Allocated memory for payload; don't use for controlling bitrate */
 );
 
 /** Returns length of the data payload (in bytes) or a negative error code. */
@@ -86,7 +86,7 @@
       const float *pcm,         /**< Input signal interleaved in channel order. length is frame_size*channels */
       int frame_size,           /**< Number of samples per frame of input signal */
       unsigned char *data,      /**< Output buffer for the compressed payload (no more than max_data_bytes long) */
-      int max_data_bytes        /**< Allocated memory for payload; don't use for controlling bitrate */
+      opus_int32 max_data_bytes /**< Allocated memory for payload; don't use for controlling bitrate */
   );
 
 /** Gets the size of an OpusMSEncoder structure.
@@ -129,7 +129,7 @@
 OPUS_EXPORT int opus_multistream_decode(
     OpusMSDecoder *st,          /**< Decoder state */
     const unsigned char *data,  /**< Input payload. Use a NULL pointer to indicate packet loss */
-    int len,                    /**< Number of bytes in payload */
+    opus_int32 len,             /**< Number of bytes in payload */
     opus_int16 *pcm,            /**< Output signal, samples interleaved in channel order . length is frame_size*channels */
     int frame_size,             /**< Number of samples per frame of input signal */
     int decode_fec              /**< Flag (0/1) to request that any in-band forward error correction data be */
@@ -140,7 +140,7 @@
 OPUS_EXPORT int opus_multistream_decode_float(
     OpusMSDecoder *st,          /**< Decoder state */
     const unsigned char *data,  /**< Input payload buffer. Use a NULL pointer to indicate packet loss */
-    int len,                    /**< Number of payload bytes in data */
+    opus_int32 len,             /**< Number of payload bytes in data */
     float *pcm,                 /**< Buffer for the output signal (interleaved iin channel order). length is frame_size*channels */
     int frame_size,             /**< Number of samples per frame of input signal */
     int decode_fec              /**< Flag (0/1) to request that any in-band forward error correction data be */
--- a/silk/API.h
+++ b/silk/API.h
@@ -86,7 +86,7 @@
     const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
     opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
     ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
-    opus_int                        *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
+    opus_int32                      *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
     const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
 );
 
--- a/silk/enc_API.c
+++ b/silk/enc_API.c
@@ -133,7 +133,7 @@
     const opus_int16                *samplesIn,         /* I    Speech sample input vector                      */
     opus_int                        nSamplesIn,         /* I    Number of samples in input vector               */
     ec_enc                          *psRangeEnc,        /* I/O  Compressor data structure                       */
-    opus_int                        *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
+    opus_int32                      *nBytesOut,         /* I/O  Number of bytes in payload (input: Max bytes)   */
     const opus_int                  prefillFlag         /* I    Flag to indicate prefilling buffers no coding   */
 )
 {
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -441,7 +441,7 @@
                 unsigned char *data, opus_int32 out_data_bytes)
 #else
 #define opus_encode_native opus_encode_float
-int opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
+opus_int32 opus_encode_float(OpusEncoder *st, const opus_val16 *pcm, int frame_size,
                       unsigned char *data, opus_int32 out_data_bytes)
 #endif
 {
@@ -449,7 +449,7 @@
     CELTEncoder *celt_enc;
     int i;
     int ret=0;
-    int nBytes;
+    opus_int32 nBytes;
     ec_enc enc;
     int bytes_target;
     int prefill=0;
@@ -937,7 +937,7 @@
 
         if (prefill)
         {
-            int zero=0;
+            opus_int32 zero=0;
 #ifdef FIXED_POINT
             pcm_silk = st->delay_buffer;
 #else
@@ -1272,7 +1272,7 @@
 #endif
 
 #else
-int opus_encode(OpusEncoder *st, const opus_int16 *pcm, int frame_size,
+opus_int32 opus_encode(OpusEncoder *st, const opus_int16 *pcm, int frame_size,
       unsigned char *data, opus_int32 max_data_bytes)
 {
    int i, ret;
--- a/src/opus_private.h
+++ b/src/opus_private.h
@@ -71,7 +71,7 @@
 
 int encode_size(int size, unsigned char *data);
 
-int opus_decode_native(OpusDecoder *st, const unsigned char *data, int len,
+int opus_decode_native(OpusDecoder *st, const unsigned char *data, opus_int32 len,
       opus_val16 *pcm, int frame_size, int decode_fec, int self_delimited, int *packet_offset);
 
 /* Make sure everything's aligned to 4 bytes (this may need to be increased
@@ -81,6 +81,6 @@
     return (i+3)&-4;
 }
 
-int opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);
+opus_int32 opus_repacketizer_out_range_impl(OpusRepacketizer *rp, int begin, int end, unsigned char *data, opus_int32 maxlen, int self_delimited);
 
 #endif /* OPUS_PRIVATE_H */
--- a/src/repacketizer.c
+++ b/src/repacketizer.c
@@ -58,7 +58,7 @@
    opus_free(rp);
 }
 
-int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, int len)
+int opus_repacketizer_cat(OpusRepacketizer *rp, const unsigned char *data, opus_int32 len)
 {
    unsigned char tmp_toc;
    int curr_nb_frames,ret;