From aba07ef6d92bf1ded7ad1af49b54a8e6652dfcbb Mon Sep 17 00:00:00 2001 From: Peter Kasting Date: Thu, 11 Jun 2015 18:19:24 -0700 Subject: [PATCH] Reland "Upconvert various types to int.", isac portion. This reverts portions of commit cb180976dd0e9672cde4523d87b5f4857478b5e9, which reverted commit 83ad33a8aed1fb00e422b6abd33c3e8942821c24. Specifically, the files in webrtc/modules/audio_coding/codecs/isac/ are relanded. The original commit message is below: Upconvert various types to int. Per comments from HL/kwiberg on https://webrtc-codereview.appspot.com/42569004 , when there is existing usage of mixed types (int16_t, int, etc.), we'd prefer to standardize on larger types like int and phase out use of int16_t. Specifically, "Using int16 just because we're sure all reasonable values will fit in 16 bits isn't usually meaningful in C." This converts some existing uses of int16_t (and, in a few cases, other types such as uint16_t) to int (or, in a few places, int32_t). Other locations will be converted to size_t in a separate change. BUG=none TBR=kwiberg Review URL: https://codereview.webrtc.org/1179093002 Cr-Commit-Position: refs/heads/master@{#9422} --- .../codecs/isac/audio_encoder_isac_t_impl.h | 2 +- .../fix/interface/audio_encoder_isacfix.h | 20 +++--- .../codecs/isac/fix/interface/isacfix.h | 32 +++++----- .../isac/fix/source/arith_routines_logist.c | 8 +-- .../codecs/isac/fix/source/arith_routins.h | 2 +- .../codecs/isac/fix/source/codec.h | 6 +- .../codecs/isac/fix/source/decode.c | 8 +-- .../codecs/isac/fix/source/entropy_coding.c | 10 +-- .../codecs/isac/fix/source/entropy_coding.h | 8 +-- .../codecs/isac/fix/source/isacfix.c | 48 +++++++------- .../codecs/isac/fix/test/kenny.cc | 7 ++- .../codecs/isac/fix/test/test_iSACfixfloat.c | 6 +- .../isac/main/interface/audio_encoder_isac.h | 20 +++--- .../codecs/isac/main/interface/isac.h | 10 +-- .../codecs/isac/main/source/crc.c | 6 +- .../codecs/isac/main/source/crc.h | 6 +- .../codecs/isac/main/source/isac.c | 62 +++++++++---------- .../codecs/isac/main/source/isac_unittest.cc | 2 +- .../test/ReleaseTest-API/ReleaseTest-API.cc | 4 +- .../SwitchingSampRate/SwitchingSampRate.cc | 2 +- .../codecs/isac/main/test/simpleKenny.c | 6 +- 21 files changed, 138 insertions(+), 137 deletions(-) diff --git a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h index 65c5b90300..befb3558be 100644 --- a/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h +++ b/webrtc/modules/audio_coding/codecs/isac/audio_encoder_isac_t_impl.h @@ -184,7 +184,7 @@ int AudioEncoderDecoderIsacT::DecodeInternal(const uint8_t* encoded, decoder_sample_rate_hz_ = sample_rate_hz; } int16_t temp_type = 1; // Default is speech. - int16_t ret = + int ret = T::DecodeInternal(isac_state_, encoded, static_cast(encoded_len), decoded, &temp_type); *speech_type = ConvertSpeechType(temp_type); diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h b/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h index bf9f875d78..a1eb2714f9 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/interface/audio_encoder_isacfix.h @@ -25,12 +25,12 @@ struct IsacFix { static const uint16_t kFixSampleRate = 16000; static inline int16_t Control(instance_type* inst, int32_t rate, - int16_t framesize) { + int framesize) { return WebRtcIsacfix_Control(inst, rate, framesize); } static inline int16_t ControlBwe(instance_type* inst, int32_t rate_bps, - int16_t frame_size_ms, + int frame_size_ms, int16_t enforce_frame_size) { return WebRtcIsacfix_ControlBwe(inst, rate_bps, frame_size_ms, enforce_frame_size); @@ -38,11 +38,11 @@ struct IsacFix { static inline int16_t Create(instance_type** inst) { return WebRtcIsacfix_Create(inst); } - static inline int16_t DecodeInternal(instance_type* inst, - const uint8_t* encoded, - int16_t len, - int16_t* decoded, - int16_t* speech_type) { + static inline int DecodeInternal(instance_type* inst, + const uint8_t* encoded, + int16_t len, + int16_t* decoded, + int16_t* speech_type) { return WebRtcIsacfix_Decode(inst, encoded, len, decoded, speech_type); } static inline int16_t DecodePlc(instance_type* inst, @@ -53,9 +53,9 @@ struct IsacFix { static inline int16_t DecoderInit(instance_type* inst) { return WebRtcIsacfix_DecoderInit(inst); } - static inline int16_t Encode(instance_type* inst, - const int16_t* speech_in, - uint8_t* encoded) { + static inline int Encode(instance_type* inst, + const int16_t* speech_in, + uint8_t* encoded) { return WebRtcIsacfix_Encode(inst, speech_in, encoded); } static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) { diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h b/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h index 421a08cc89..4dbc29d88d 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h @@ -128,9 +128,9 @@ extern "C" { * -1 - Error */ - int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, - const int16_t *speechIn, - uint8_t* encoded); + int WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, + const int16_t *speechIn, + uint8_t* encoded); @@ -251,11 +251,11 @@ extern "C" { * -1 - Error */ - int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, - const uint8_t* encoded, - int16_t len, - int16_t *decoded, - int16_t *speechType); + int WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst, + const uint8_t* encoded, + int16_t len, + int16_t *decoded, + int16_t *speechType); /**************************************************************************** @@ -280,11 +280,11 @@ extern "C" { */ #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED - int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, - const uint16_t *encoded, - int16_t len, - int16_t *decoded, - int16_t *speechType); + int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, + const uint16_t *encoded, + int16_t len, + int16_t *decoded, + int16_t *speechType); #endif // WEBRTC_ISAC_FIX_NB_CALLS_ENABLED @@ -378,8 +378,8 @@ extern "C" { */ int16_t WebRtcIsacfix_Control(ISACFIX_MainStruct *ISAC_main_inst, - int16_t rate, - int16_t framesize); + int16_t rate, + int framesize); @@ -407,7 +407,7 @@ extern "C" { int16_t WebRtcIsacfix_ControlBwe(ISACFIX_MainStruct *ISAC_main_inst, int16_t rateBPS, - int16_t frameSizeMs, + int frameSizeMs, int16_t enforceFrameSize); diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c index 23048a5c38..808aeb7fd9 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routines_logist.c @@ -226,10 +226,10 @@ int WebRtcIsacfix_EncLogisticMulti2(Bitstr_enc *streamData, * Return value : number of bytes in the stream so far * -1 if error detected */ -int16_t WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7, - Bitstr_dec *streamData, - const int32_t *envQ8, - const int16_t lenData) +int WebRtcIsacfix_DecLogisticMulti2(int16_t *dataQ7, + Bitstr_dec *streamData, + const int32_t *envQ8, + const int16_t lenData) { uint32_t W_lower; uint32_t W_upper; diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h index 584bc471f2..40bbb4cdaa 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h @@ -74,7 +74,7 @@ int16_t WebRtcIsacfix_EncTerminate(Bitstr_enc *streamData); * Return value : number of bytes in the stream so far * <0 if error detected */ -int16_t WebRtcIsacfix_DecLogisticMulti2( +int WebRtcIsacfix_DecLogisticMulti2( int16_t *data, Bitstr_dec *streamData, const int32_t *env, diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h index 55623a2ff3..d71decc67c 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h @@ -32,9 +32,9 @@ int WebRtcIsacfix_EstimateBandwidth(BwEstimatorstr* bwest_str, uint32_t send_ts, uint32_t arr_ts); -int16_t WebRtcIsacfix_DecodeImpl(int16_t* signal_out16, - IsacFixDecoderInstance* ISACdec_obj, - int16_t* current_framesamples); +int WebRtcIsacfix_DecodeImpl(int16_t* signal_out16, + IsacFixDecoderInstance* ISACdec_obj, + int16_t* current_framesamples); void WebRtcIsacfix_DecodePlcImpl(int16_t* decoded, IsacFixDecoderInstance* ISACdec_obj, diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c index 5e095da683..f0ae07e132 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/decode.c @@ -27,14 +27,14 @@ -int16_t WebRtcIsacfix_DecodeImpl(int16_t *signal_out16, - IsacFixDecoderInstance *ISACdec_obj, - int16_t *current_framesamples) +int WebRtcIsacfix_DecodeImpl(int16_t *signal_out16, + IsacFixDecoderInstance *ISACdec_obj, + int16_t *current_framesamples) { int k; int err; int16_t BWno; - int16_t len = 0; + int len = 0; int16_t model; diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c index 9f52c9dd75..5f6e6ac0b1 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.c @@ -450,10 +450,10 @@ static void GenerateDitherQ7(int16_t *bufQ7, * function to decode the complex spectrum from the bitstream * returns the total number of bytes in the stream */ -int16_t WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata, - int16_t *frQ7, - int16_t *fiQ7, - int16_t AvgPitchGain_Q12) +int WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata, + int16_t *frQ7, + int16_t *fiQ7, + int16_t AvgPitchGain_Q12) { int16_t data[FRAMESAMPLES]; int32_t invARSpec2_Q16[FRAMESAMPLES/4]; @@ -461,7 +461,7 @@ int16_t WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata, int16_t RCQ15[AR_ORDER]; int16_t gainQ10; int32_t gain2_Q10; - int16_t len; + int len; int k; /* create dither signal */ diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h index ec20c71f74..e4489df331 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h @@ -22,10 +22,10 @@ #include "structs.h" /* decode complex spectrum (return number of bytes in stream) */ -int16_t WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata, - int16_t *frQ7, - int16_t *fiQ7, - int16_t AvgPitchGain_Q12); +int WebRtcIsacfix_DecodeSpec(Bitstr_dec *streamdata, + int16_t *frQ7, + int16_t *fiQ7, + int16_t AvgPitchGain_Q12); /* encode complex spectrum */ int WebRtcIsacfix_EncodeSpec(const int16_t *fr, diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c index 25076d8d67..9b1927bef9 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c @@ -399,12 +399,12 @@ static void write_be16(const uint16_t* src, size_t nbytes, uint8_t* dest) { * : -1 - Error */ -int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, - const int16_t *speechIn, - uint8_t* encoded) +int WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, + const int16_t *speechIn, + uint8_t* encoded) { ISACFIX_SubStruct *ISAC_inst; - int16_t stream_len; + int stream_len; /* typecast pointer to rela structure */ ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; @@ -421,7 +421,7 @@ int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst, &ISAC_inst->bwestimator_obj, ISAC_inst->CodingMode); if (stream_len<0) { - ISAC_inst->errorcode = - stream_len; + ISAC_inst->errorcode = -(int16_t)stream_len; return -1; } @@ -767,17 +767,17 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst, */ -int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, - const uint8_t* encoded, - int16_t len, - int16_t* decoded, - int16_t* speechType) +int WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, + const uint8_t* encoded, + int16_t len, + int16_t* decoded, + int16_t* speechType) { ISACFIX_SubStruct *ISAC_inst; /* number of samples (480 or 960), output from decoder */ /* that were actually used in the encoder/decoder (determined on the fly) */ int16_t number_of_samples; - int16_t declen = 0; + int declen = 0; /* typecast pointer to real structure */ ISAC_inst = (ISACFIX_SubStruct *)ISAC_main_inst; @@ -810,7 +810,7 @@ int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, if (declen < 0) { /* Some error inside the decoder */ - ISAC_inst->errorcode = -declen; + ISAC_inst->errorcode = -(int16_t)declen; memset(decoded, 0, sizeof(int16_t) * MAX_FRAMESAMPLES); return -1; } @@ -860,17 +860,17 @@ int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct* ISAC_main_inst, */ #ifdef WEBRTC_ISAC_FIX_NB_CALLS_ENABLED -int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, - const uint16_t *encoded, - int16_t len, - int16_t *decoded, - int16_t *speechType) +int WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, + const uint16_t *encoded, + int16_t len, + int16_t *decoded, + int16_t *speechType) { ISACFIX_SubStruct *ISAC_inst; /* twice the number of samples (480 or 960), output from decoder */ /* that were actually used in the encoder/decoder (determined on the fly) */ int16_t number_of_samples; - int16_t declen = 0; + int declen = 0; int16_t dummy[FRAMESAMPLES/2]; @@ -904,7 +904,7 @@ int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst, if (declen < 0) { /* Some error inside the decoder */ - ISAC_inst->errorcode = -declen; + ISAC_inst->errorcode = -(int16_t)declen; memset(decoded, 0, sizeof(int16_t) * FRAMESAMPLES); return -1; } @@ -1075,8 +1075,8 @@ int16_t WebRtcIsacfix_DecodePlc(ISACFIX_MainStruct *ISAC_main_inst, */ int16_t WebRtcIsacfix_Control(ISACFIX_MainStruct *ISAC_main_inst, - int16_t rate, - int16_t framesize) + int16_t rate, + int framesize) { ISACFIX_SubStruct *ISAC_inst; /* typecast pointer to real structure */ @@ -1100,7 +1100,7 @@ int16_t WebRtcIsacfix_Control(ISACFIX_MainStruct *ISAC_main_inst, if (framesize == 30 || framesize == 60) - ISAC_inst->ISACenc_obj.new_framelength = (FS/1000) * framesize; + ISAC_inst->ISACenc_obj.new_framelength = (int16_t)((FS/1000) * framesize); else { ISAC_inst->errorcode = ISAC_DISALLOWED_FRAME_LENGTH; return -1; @@ -1135,7 +1135,7 @@ int16_t WebRtcIsacfix_Control(ISACFIX_MainStruct *ISAC_main_inst, int16_t WebRtcIsacfix_ControlBwe(ISACFIX_MainStruct *ISAC_main_inst, int16_t rateBPS, - int16_t frameSizeMs, + int frameSizeMs, int16_t enforceFrameSize) { ISACFIX_SubStruct *ISAC_inst; @@ -1169,7 +1169,7 @@ int16_t WebRtcIsacfix_ControlBwe(ISACFIX_MainStruct *ISAC_main_inst, /* Set initial framesize. If enforceFrameSize is set the frame size will not change */ if ((frameSizeMs == 30) || (frameSizeMs == 60)) { - ISAC_inst->ISACenc_obj.new_framelength = (FS/1000) * frameSizeMs; + ISAC_inst->ISACenc_obj.new_framelength = (int16_t)((FS/1000) * frameSizeMs); } else { ISAC_inst->errorcode = ISAC_DISALLOWED_FRAME_LENGTH; return -1; diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc b/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc index 7f4272b9a5..ab7c640eed 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc +++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/kenny.cc @@ -102,14 +102,15 @@ int main(int argc, char* argv[]) int i, errtype, h = 0, k, packetLossPercent = 0; int16_t CodingMode; int16_t bottleneck; - int16_t framesize = 30; /* ms */ + int framesize = 30; /* ms */ int cur_framesmpls, err = 0, lostPackets = 0; /* Runtime statistics */ double starttime, runtime, length_file; int16_t stream_len = 0; - int16_t framecnt, declen = 0; + int16_t framecnt; + int declen = 0; int16_t shortdata[FRAMESAMPLES_10ms]; int16_t decoded[MAX_FRAMESAMPLES]; uint16_t streamdata[500]; @@ -767,7 +768,7 @@ int main(int argc, char* argv[]) #else declen = -1; #endif - prevFrameSize = declen/240; + prevFrameSize = static_cast(declen / 240); } } diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c index fae6d6aa0f..6dbdb7eff8 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/test/test_iSACfixfloat.c @@ -88,8 +88,8 @@ int main(int argc, char* argv[]) { int16_t CodingMode; int16_t bottleneck; - int16_t framesize = 30; /* ms */ - // int16_t framesize = 60; /* To invoke cisco complexity case at frame 2252 */ + int framesize = 30; /* ms */ + // int framesize = 60; /* To invoke cisco complexity case at frame 2252 */ int cur_framesmpls, err; @@ -99,7 +99,7 @@ int main(int argc, char* argv[]) { double length_file; int16_t stream_len = 0; - int16_t declen; + int declen; int16_t shortdata[FRAMESAMPLES_10ms]; int16_t decoded[MAX_FRAMESAMPLES]; diff --git a/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h b/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h index 5a75807469..8c7053359d 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h +++ b/webrtc/modules/audio_coding/codecs/isac/main/interface/audio_encoder_isac.h @@ -24,12 +24,12 @@ struct IsacFloat { static const bool has_swb = true; static inline int16_t Control(instance_type* inst, int32_t rate, - int16_t framesize) { + int framesize) { return WebRtcIsac_Control(inst, rate, framesize); } static inline int16_t ControlBwe(instance_type* inst, int32_t rate_bps, - int16_t frame_size_ms, + int frame_size_ms, int16_t enforce_frame_size) { return WebRtcIsac_ControlBwe(inst, rate_bps, frame_size_ms, enforce_frame_size); @@ -37,11 +37,11 @@ struct IsacFloat { static inline int16_t Create(instance_type** inst) { return WebRtcIsac_Create(inst); } - static inline int16_t DecodeInternal(instance_type* inst, - const uint8_t* encoded, - int16_t len, - int16_t* decoded, - int16_t* speech_type) { + static inline int DecodeInternal(instance_type* inst, + const uint8_t* encoded, + int16_t len, + int16_t* decoded, + int16_t* speech_type) { return WebRtcIsac_Decode(inst, encoded, len, decoded, speech_type); } static inline int16_t DecodePlc(instance_type* inst, @@ -53,9 +53,9 @@ struct IsacFloat { static inline int16_t DecoderInit(instance_type* inst) { return WebRtcIsac_DecoderInit(inst); } - static inline int16_t Encode(instance_type* inst, - const int16_t* speech_in, - uint8_t* encoded) { + static inline int Encode(instance_type* inst, + const int16_t* speech_in, + uint8_t* encoded) { return WebRtcIsac_Encode(inst, speech_in, encoded); } static inline int16_t EncoderInit(instance_type* inst, int16_t coding_mode) { diff --git a/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h b/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h index 6d0c32deb1..1a83d722b4 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h +++ b/webrtc/modules/audio_coding/codecs/isac/main/interface/isac.h @@ -144,7 +144,7 @@ extern "C" { * : -1 - Error */ - int16_t WebRtcIsac_Encode( + int WebRtcIsac_Encode( ISACStruct* ISAC_main_inst, const int16_t* speechIn, uint8_t* encoded); @@ -214,7 +214,7 @@ extern "C" { * -1 - Error. */ - int16_t WebRtcIsac_Decode( + int WebRtcIsac_Decode( ISACStruct* ISAC_main_inst, const uint8_t* encoded, int16_t len, @@ -269,7 +269,7 @@ extern "C" { int16_t WebRtcIsac_Control( ISACStruct* ISAC_main_inst, int32_t rate, - int16_t framesize); + int framesize); /****************************************************************************** @@ -300,7 +300,7 @@ extern "C" { int16_t WebRtcIsac_ControlBwe( ISACStruct* ISAC_main_inst, int32_t rateBPS, - int16_t frameSizeMs, + int frameSizeMs, int16_t enforceFrameSize); @@ -701,7 +701,7 @@ extern "C" { * Return value : >0 - number of samples in decoded vector * -1 - Error */ - int16_t WebRtcIsac_DecodeRcu( + int WebRtcIsac_DecodeRcu( ISACStruct* ISAC_main_inst, const uint8_t* encoded, int16_t len, diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c b/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c index 06c15cb390..2419e24033 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/crc.c @@ -80,9 +80,9 @@ static const uint32_t kCrcTable[256] = { * -1 - Error */ -int16_t WebRtcIsac_GetCrc(const int16_t* bitstream, - int16_t len_bitstream_in_bytes, - uint32_t* crc) +int WebRtcIsac_GetCrc(const int16_t* bitstream, + int len_bitstream_in_bytes, + uint32_t* crc) { uint8_t* bitstream_ptr_uw8; uint32_t crc_state; diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/crc.h b/webrtc/modules/audio_coding/codecs/isac/main/source/crc.h index 19d1bf31d5..09583dfc5c 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/crc.h +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/crc.h @@ -36,10 +36,10 @@ * -1 - Error */ -int16_t WebRtcIsac_GetCrc( +int WebRtcIsac_GetCrc( const int16_t* encoded, - int16_t no_of_word8s, - uint32_t* crc); + int no_of_word8s, + uint32_t* crc); diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c index 3492bfae00..963270e7ef 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac.c @@ -494,15 +494,15 @@ int16_t WebRtcIsac_EncoderInit(ISACStruct* ISAC_main_inst, * samples. * : -1 - Error */ -int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst, - const int16_t* speechIn, - uint8_t* encoded) { +int WebRtcIsac_Encode(ISACStruct* ISAC_main_inst, + const int16_t* speechIn, + uint8_t* encoded) { float inFrame[FRAMESAMPLES_10ms]; int16_t speechInLB[FRAMESAMPLES_10ms]; int16_t speechInUB[FRAMESAMPLES_10ms]; - int16_t streamLenLB = 0; - int16_t streamLenUB = 0; - int16_t streamLen = 0; + int streamLenLB = 0; + int streamLenUB = 0; + int streamLen = 0; int16_t k = 0; uint8_t garbageLen = 0; int32_t bottleneck = 0; @@ -601,8 +601,8 @@ int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst, /* Tell to upper-band the number of bytes used so far. * This is for payload limitation. */ - instUB->ISACencUB_obj.numBytesUsed = streamLenLB + 1 + - LEN_CHECK_SUM_WORD8; + instUB->ISACencUB_obj.numBytesUsed = + (int16_t)(streamLenLB + 1 + LEN_CHECK_SUM_WORD8); /* Encode upper-band. */ switch (instISAC->bandwidthKHz) { case isac12kHz: { @@ -1045,12 +1045,12 @@ int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst, return 0; } -static int16_t Decode(ISACStruct* ISAC_main_inst, - const uint8_t* encoded, - int16_t lenEncodedBytes, - int16_t* decoded, - int16_t* speechType, - int16_t isRCUPayload) { +static int Decode(ISACStruct* ISAC_main_inst, + const uint8_t* encoded, + int16_t lenEncodedBytes, + int16_t* decoded, + int16_t* speechType, + int16_t isRCUPayload) { /* Number of samples (480 or 960), output from decoder that were actually used in the encoder/decoder (determined on the fly). */ @@ -1060,8 +1060,8 @@ static int16_t Decode(ISACStruct* ISAC_main_inst, float outFrame[MAX_FRAMESAMPLES]; int16_t outFrameLB[MAX_FRAMESAMPLES]; int16_t outFrameUB[MAX_FRAMESAMPLES]; - int16_t numDecodedBytesLB; - int16_t numDecodedBytesUB; + int numDecodedBytesLB; + int numDecodedBytesUB; int16_t lenEncodedLBBytes; int16_t validChecksum = 1; int16_t k; @@ -1350,11 +1350,11 @@ static int16_t Decode(ISACStruct* ISAC_main_inst, * -1 - Error */ -int16_t WebRtcIsac_Decode(ISACStruct* ISAC_main_inst, - const uint8_t* encoded, - int16_t lenEncodedBytes, - int16_t* decoded, - int16_t* speechType) { +int WebRtcIsac_Decode(ISACStruct* ISAC_main_inst, + const uint8_t* encoded, + int16_t lenEncodedBytes, + int16_t* decoded, + int16_t* speechType) { int16_t isRCUPayload = 0; return Decode(ISAC_main_inst, encoded, lenEncodedBytes, decoded, speechType, isRCUPayload); @@ -1382,11 +1382,11 @@ int16_t WebRtcIsac_Decode(ISACStruct* ISAC_main_inst, -int16_t WebRtcIsac_DecodeRcu(ISACStruct* ISAC_main_inst, - const uint8_t* encoded, - int16_t lenEncodedBytes, - int16_t* decoded, - int16_t* speechType) { +int WebRtcIsac_DecodeRcu(ISACStruct* ISAC_main_inst, + const uint8_t* encoded, + int16_t lenEncodedBytes, + int16_t* decoded, + int16_t* speechType) { int16_t isRCUPayload = 1; return Decode(ISAC_main_inst, encoded, lenEncodedBytes, decoded, speechType, isRCUPayload); @@ -1485,7 +1485,7 @@ static int16_t ControlUb(ISACUBStruct* instISAC, double rate) { int16_t WebRtcIsac_Control(ISACStruct* ISAC_main_inst, int32_t bottleneckBPS, - int16_t frameSize) { + int frameSize) { ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; int16_t status; double rateLB; @@ -1526,7 +1526,7 @@ int16_t WebRtcIsac_Control(ISACStruct* ISAC_main_inst, return -1; } - status = ControlLb(&instISAC->instLB, rateLB, frameSize); + status = ControlLb(&instISAC->instLB, rateLB, (int16_t)frameSize); if (status < 0) { instISAC->errorCode = -status; return -1; @@ -1594,7 +1594,7 @@ int16_t WebRtcIsac_Control(ISACStruct* ISAC_main_inst, */ int16_t WebRtcIsac_ControlBwe(ISACStruct* ISAC_main_inst, int32_t bottleneckBPS, - int16_t frameSizeMs, + int frameSizeMs, int16_t enforceFrameSize) { ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; enum ISACBandwidth bandwidth; @@ -1641,8 +1641,8 @@ int16_t WebRtcIsac_ControlBwe(ISACStruct* ISAC_main_inst, * will not change */ if (frameSizeMs != 0) { if ((frameSizeMs == 30) || (frameSizeMs == 60)) { - instISAC->instLB.ISACencLB_obj.new_framelength = (FS / 1000) * - frameSizeMs; + instISAC->instLB.ISACencLB_obj.new_framelength = + (int16_t)((FS / 1000) * frameSizeMs); } else { instISAC->errorCode = ISAC_DISALLOWED_FRAME_LENGTH; return -1; diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc index 29990368d8..73efee1280 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/isac/main/source/isac_unittest.cc @@ -80,7 +80,7 @@ TEST_F(IsacTest, DISABLED_ON_IOS(IsacUpdateBWE)) { WebRtcIsac_EncoderInit(isac_codec_, 0); WebRtcIsac_DecoderInit(isac_codec_); - int16_t encoded_bytes; + int encoded_bytes; // Test with call with a small packet (sync packet). EXPECT_EQ(-1, WebRtcIsac_UpdateBwEstimate(isac_codec_, bitstream_small_, 7, 1, diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc index 0574047e6a..4eeeed078f 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc +++ b/webrtc/modules/audio_coding/codecs/isac/main/test/ReleaseTest-API/ReleaseTest-API.cc @@ -45,14 +45,14 @@ int main(int argc, char* argv[]) { int i, errtype, VADusage = 0, packetLossPercent = 0; int16_t CodingMode; int32_t bottleneck = 0; - int16_t framesize = 30; /* ms */ + int framesize = 30; /* ms */ int cur_framesmpls, err; /* Runtime statistics */ double starttime, runtime, length_file; int16_t stream_len = 0; - int16_t declen = 0, declenTC = 0; + int declen = 0, declenTC = 0; bool lostFrame = false; int16_t shortdata[SWBFRAMESAMPLES_10ms]; diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc b/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc index 6ec818ee76..a11e408b3b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc +++ b/webrtc/modules/audio_coding/codecs/isac/main/test/SwitchingSampRate/SwitchingSampRate.cc @@ -191,7 +191,7 @@ int main(int argc, char* argv[]) short streamLen; short numSamplesRead; - short lenDecodedAudio; + int lenDecodedAudio; short senderIdx; short receiverIdx; diff --git a/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c b/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c index 7ea8bae945..e0d0f412c8 100644 --- a/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c +++ b/webrtc/modules/audio_coding/codecs/isac/main/test/simpleKenny.c @@ -62,7 +62,7 @@ int main(int argc, char* argv[]) { unsigned long totalsmpls = 0; int32_t bottleneck = 39; - int16_t frameSize = 30; /* ms */ + int frameSize = 30; /* ms */ int16_t codingMode = 1; int16_t shortdata[FRAMESAMPLES_SWB_10ms]; int16_t decoded[MAX_FRAMESAMPLES_SWB]; @@ -73,9 +73,9 @@ int main(int argc, char* argv[]) { ISACStruct* ISAC_main_inst; int16_t stream_len = 0; - int16_t declen = 0; + int declen = 0; int16_t err; - int16_t cur_framesmpls; + int cur_framesmpls; int endfile; #ifdef WIN32 double length_file;