Re-landing r6961

common_audio/signal_processing: Remove macro WEBRTC_SPL_MEMCPY_W8

This macro is nothing but memcpy() and further used at one single place in webrtc, so it makes no sense to keep it. Replaced the operation where it is used.

BUG=3348,3353
TESTED=locally on linux
TBR=aluebs@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18259004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6963 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org
2014-08-25 11:19:05 +00:00
parent 4a616be12b
commit d32c4389ac
4 changed files with 21 additions and 31 deletions

View File

@@ -26,17 +26,17 @@ 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 length_samples,
int16_t* speechOut16b);
/****************************************************************************
@@ -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);

View File

@@ -12,13 +12,12 @@
#include "pcm16b.h"
#include <stdlib.h>
#ifdef WEBRTC_ARCH_BIG_ENDIAN
#include <string.h>
#endif
#include "typedefs.h"
#ifdef WEBRTC_ARCH_BIG_ENDIAN
#include "signal_processing_library.h"
#endif
#define HIGHEND 0xFF00
#define LOWEND 0xFF
@@ -26,18 +25,18 @@
/* Encoder with int16_t Output */
int16_t WebRtcPcm16b_EncodeW16(const int16_t* speechIn16b,
int16_t len,
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<len;i++) {
for (i = 0; i < length_samples; i++) {
speechOut16b[i]=(((uint16_t)speechIn16b[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<samples;i++) {
speechOut16b[i]=(((uint16_t)speechIn16b[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) */