diff --git a/webrtc/common_audio/signal_processing/include/signal_processing_library.h b/webrtc/common_audio/signal_processing/include/signal_processing_library.h index fcc5cea00..2ca7aff2f 100644 --- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h +++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h @@ -109,8 +109,6 @@ extern "C" { #endif -#define WEBRTC_SPL_MEMCPY_W8(v1, v2, length) \ - memcpy(v1, v2, (length) * sizeof(char)) #define WEBRTC_SPL_MEMCPY_W16(v1, v2, length) \ memcpy(v1, v2, (length) * sizeof(int16_t)) diff --git a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc index c21263b2b..ddcf70a0c 100644 --- a/webrtc/common_audio/signal_processing/signal_processing_unittest.cc +++ b/webrtc/common_audio/signal_processing/signal_processing_unittest.cc @@ -165,11 +165,9 @@ TEST_F(SplTest, MathOperationsTest) { TEST_F(SplTest, BasicArrayOperationsTest) { const int kVectorSize = 4; int B[] = {4, 12, 133, 1100}; - uint8_t b8[kVectorSize]; int16_t b16[kVectorSize]; int32_t b32[kVectorSize]; - uint8_t bTmp8[kVectorSize]; int16_t bTmp16[kVectorSize]; int32_t bTmp32[kVectorSize]; @@ -198,14 +196,9 @@ TEST_F(SplTest, BasicArrayOperationsTest) { EXPECT_EQ(1, b32[kk]); } for (int kk = 0; kk < kVectorSize; ++kk) { - bTmp8[kk] = (int8_t)kk; bTmp16[kk] = (int16_t)kk; bTmp32[kk] = (int32_t)kk; } - WEBRTC_SPL_MEMCPY_W8(b8, bTmp8, kVectorSize); - for (int kk = 0; kk < kVectorSize; ++kk) { - EXPECT_EQ(b8[kk], bTmp8[kk]); - } WEBRTC_SPL_MEMCPY_W16(b16, bTmp16, kVectorSize); for (int kk = 0; kk < kVectorSize; ++kk) { EXPECT_EQ(b16[kk], bTmp16[kk]); diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h b/webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h index 505142e75..14e781325 100644 --- a/webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h +++ b/webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h @@ -26,18 +26,18 @@ extern "C" { * "Encode" a sample vector to 16 bit linear (Encoded standard is big endian) * * Input: - * - speechIn16b : Input speech vector - * - len : Number of samples in speech vector + * - speechIn16b : Input speech vector + * - length_samples : Number of samples in speech vector * * Output: - * - speechOut16b : Encoded data vector (big endian 16 bit) + * - speechOut16b : Encoded data vector (big endian 16 bit) * - * Returned value : Size in bytes of speechOut16b + * Returned value : Size in bytes of speechOut16b */ -int16_t WebRtcPcm16b_EncodeW16(const int16_t* speechIn16b, - int16_t len, - int16_t* speechOut16b); +int16_t WebRtcPcm16b_EncodeW16(int16_t *speechIn16b, + int16_t length_samples, + int16_t *speechOut16b); /**************************************************************************** * WebRtcPcm16b_Encode(...) @@ -64,18 +64,18 @@ int16_t WebRtcPcm16b_Encode(int16_t *speech16b, * "Decode" a vector to 16 bit linear (Encoded standard is big endian) * * Input: - * - speechIn16b : Encoded data vector (big endian 16 bit) - * - len : Number of bytes in speechIn16b + * - speechIn16b : Encoded data vector (big endian 16 bit) + * - length_bytes : Number of bytes in speechIn16b * * Output: - * - speechOut16b : Decoded speech vector + * - speechOut16b : Decoded speech vector * - * Returned value : Samples in speechOut16b + * Returned value : Samples in speechOut16b */ int16_t WebRtcPcm16b_DecodeW16(void *inst, int16_t *speechIn16b, - int16_t len, + int16_t length_bytes, int16_t *speechOut16b, int16_t* speechType); diff --git a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c b/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c index 7661dc132..41f4e1065 100644 --- a/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c +++ b/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.c @@ -12,32 +12,31 @@ #include "pcm16b.h" #include +#ifdef WEBRTC_ARCH_BIG_ENDIAN +#include +#endif #include "typedefs.h" -#ifdef WEBRTC_ARCH_BIG_ENDIAN -#include "signal_processing_library.h" -#endif - #define HIGHEND 0xFF00 #define LOWEND 0xFF /* Encoder with int16_t Output */ -int16_t WebRtcPcm16b_EncodeW16(const int16_t* speechIn16b, - int16_t len, - int16_t* speechOut16b) +int16_t WebRtcPcm16b_EncodeW16(int16_t *speechIn16b, + int16_t length_samples, + int16_t *speechOut16b) { #ifdef WEBRTC_ARCH_BIG_ENDIAN - WEBRTC_SPL_MEMCPY_W16(speechOut16b, speechIn16b, len); + memcpy(speechOut16b, speechIn16b, length_samples * sizeof(int16_t)); #else int i; - for (i=0;i>8)|((((uint16_t)speechIn16b[i])<<8)&0xFF00); } #endif - return(len<<1); + return length_samples << 1; } @@ -64,15 +63,15 @@ int16_t WebRtcPcm16b_Encode(int16_t *speech16b, /* Decoder with int16_t Input instead of char when the int16_t Encoder is used */ int16_t WebRtcPcm16b_DecodeW16(void *inst, int16_t *speechIn16b, - int16_t len, + int16_t length_bytes, int16_t *speechOut16b, int16_t* speechType) { #ifdef WEBRTC_ARCH_BIG_ENDIAN - WEBRTC_SPL_MEMCPY_W8(speechOut16b, speechIn16b, ((len*sizeof(int16_t)+1)>>1)); + memcpy(speechOut16b, speechIn16b, length_bytes); #else int i; - int samples=len>>1; + int samples = length_bytes >> 1; for (i=0;i>8)|(((uint16_t)(speechIn16b[i]&0xFF))<<8); @@ -84,7 +83,7 @@ int16_t WebRtcPcm16b_DecodeW16(void *inst, // Avoid warning. (void)(inst = NULL); - return(len>>1); + return length_bytes >> 1; } /* "old" version of the decoder that uses char as input (not used in NetEq any more) */