WEBRTC_{BIG, LITTLE}_ENDIAN -> WEBRTC_ARCH_{BIG, LITTLE}_ENDIAN.

Mostly to remove a long-standing TODO...

TESTED=trybots
R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5013 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org
2013-10-22 10:27:23 +00:00
parent 943e3b95a6
commit 621df678c8
15 changed files with 68 additions and 85 deletions

View File

@@ -31,7 +31,7 @@ int16_t WebRtcG711_EncodeA(void* state,
for (n = 0; n < len; n++) { for (n = 0; n < len; n++) {
tempVal = (uint16_t) linear_to_alaw(speechIn[n]); tempVal = (uint16_t) linear_to_alaw(speechIn[n]);
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
if ((n & 0x1) == 1) { if ((n & 0x1) == 1) {
encoded[n >> 1] |= ((uint16_t) tempVal); encoded[n >> 1] |= ((uint16_t) tempVal);
} else { } else {
@@ -69,7 +69,7 @@ int16_t WebRtcG711_EncodeU(void* state,
for (n = 0; n < len; n++) { for (n = 0; n < len; n++) {
tempVal = (uint16_t) linear_to_ulaw(speechIn[n]); tempVal = (uint16_t) linear_to_ulaw(speechIn[n]);
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
if ((n & 0x1) == 1) { if ((n & 0x1) == 1) {
encoded[n >> 1] |= ((uint16_t) tempVal); encoded[n >> 1] |= ((uint16_t) tempVal);
} else { } else {
@@ -103,7 +103,7 @@ int16_t WebRtcG711_DecodeA(void* state,
} }
for (n = 0; n < len; n++) { for (n = 0; n < len; n++) {
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
if ((n & 0x1) == 1) { if ((n & 0x1) == 1) {
tempVal = ((uint16_t) encoded[n >> 1] & 0xFF); tempVal = ((uint16_t) encoded[n >> 1] & 0xFF);
} else { } else {
@@ -140,7 +140,7 @@ int16_t WebRtcG711_DecodeU(void* state,
} }
for (n = 0; n < len; n++) { for (n = 0; n < len; n++) {
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
if ((n & 0x1) == 1) { if ((n & 0x1) == 1) {
tempVal = ((uint16_t) encoded[n >> 1] & 0xFF); tempVal = ((uint16_t) encoded[n >> 1] & 0xFF);
} else { } else {

View File

@@ -28,7 +28,7 @@
#include "decode_residual.h" #include "decode_residual.h"
#include "unpack_bits.h" #include "unpack_bits.h"
#include "hp_output.h" #include "hp_output.h"
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
#include "swap_bytes.h" #include "swap_bytes.h"
#endif #endif
@@ -54,7 +54,7 @@ void WebRtcIlbcfix_DecodeImpl(
int16_t PLCresidual[BLOCKL_MAX + LPC_FILTERORDER]; int16_t PLCresidual[BLOCKL_MAX + LPC_FILTERORDER];
int16_t syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)]; int16_t syntdenum[NSUB_MAX*(LPC_FILTERORDER+1)];
int16_t PLClpc[LPC_FILTERORDER + 1]; int16_t PLClpc[LPC_FILTERORDER + 1];
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
uint16_t swapped[NO_OF_WORDS_30MS]; uint16_t swapped[NO_OF_WORDS_30MS];
#endif #endif
iLBC_bits *iLBCbits_inst = (iLBC_bits*)PLCresidual; iLBC_bits *iLBCbits_inst = (iLBC_bits*)PLCresidual;
@@ -68,7 +68,7 @@ void WebRtcIlbcfix_DecodeImpl(
/* Unpacketize bits into parameters */ /* Unpacketize bits into parameters */
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
WebRtcIlbcfix_SwapBytes(bytes, iLBCdec_inst->no_of_words, swapped); WebRtcIlbcfix_SwapBytes(bytes, iLBCdec_inst->no_of_words, swapped);
last_bit = WebRtcIlbcfix_UnpackBits(swapped, iLBCbits_inst, iLBCdec_inst->mode); last_bit = WebRtcIlbcfix_UnpackBits(swapped, iLBCbits_inst, iLBCdec_inst->mode);
#else #else

View File

@@ -32,7 +32,7 @@
#include "unpack_bits.h" #include "unpack_bits.h"
#include "index_conv_dec.h" #include "index_conv_dec.h"
#endif #endif
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
#include "swap_bytes.h" #include "swap_bytes.h"
#endif #endif
@@ -489,7 +489,7 @@ void WebRtcIlbcfix_EncodeImpl(
WebRtcIlbcfix_PackBits(bytes, iLBCbits_inst, iLBCenc_inst->mode); WebRtcIlbcfix_PackBits(bytes, iLBCbits_inst, iLBCenc_inst->mode);
#endif #endif
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
/* Swap bytes for LITTLE ENDIAN since the packbits() /* Swap bytes for LITTLE ENDIAN since the packbits()
function assumes BIG_ENDIAN machine */ function assumes BIG_ENDIAN machine */
#ifdef SPLIT_10MS #ifdef SPLIT_10MS

View File

@@ -327,7 +327,7 @@ int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst,
{ {
ISACFIX_SubStruct *ISAC_inst; ISACFIX_SubStruct *ISAC_inst;
int16_t stream_len; int16_t stream_len;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
@@ -352,7 +352,7 @@ int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst,
/* convert from bytes to int16_t */ /* convert from bytes to int16_t */
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0;k<(stream_len+1)>>1;k++) { for (k=0;k<(stream_len+1)>>1;k++) {
encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 ) encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 )
| (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8)); | (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8));
@@ -442,7 +442,7 @@ int16_t WebRtcIsacfix_EncodeNb(ISACFIX_MainStruct *ISAC_main_inst,
/* convert from bytes to int16_t */ /* convert from bytes to int16_t */
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0;k<(stream_len+1)>>1;k++) { for (k=0;k<(stream_len+1)>>1;k++) {
encoded[k] = (int16_t)(((uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8) encoded[k] = (int16_t)(((uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8)
| (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8)); | (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8));
@@ -485,7 +485,7 @@ int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
{ {
ISACFIX_SubStruct *ISAC_inst; ISACFIX_SubStruct *ISAC_inst;
int16_t stream_len; int16_t stream_len;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
@@ -507,7 +507,7 @@ int16_t WebRtcIsacfix_GetNewBitStream(ISACFIX_MainStruct *ISAC_main_inst,
return -1; return -1;
} }
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0;k<(stream_len+1)>>1;k++) { for (k=0;k<(stream_len+1)>>1;k++) {
encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 ) encoded[k] = (int16_t)( ( (uint16_t)(ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] >> 8 )
| (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8)); | (((ISAC_inst->ISACenc_obj.bitstr_obj).stream[k] & 0x00FF) << 8));
@@ -588,7 +588,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst,
ISACFIX_SubStruct *ISAC_inst; ISACFIX_SubStruct *ISAC_inst;
Bitstr_dec streamdata; Bitstr_dec streamdata;
uint16_t partOfStream[5]; uint16_t partOfStream[5];
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
@@ -621,7 +621,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate1(ISACFIX_MainStruct *ISAC_main_inst,
streamdata.stream_index = 0; streamdata.stream_index = 0;
streamdata.full = 1; streamdata.full = 1;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0; k<5; k++) { for (k=0; k<5; k++) {
streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
} }
@@ -676,7 +676,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst,
ISACFIX_SubStruct *ISAC_inst; ISACFIX_SubStruct *ISAC_inst;
Bitstr_dec streamdata; Bitstr_dec streamdata;
uint16_t partOfStream[5]; uint16_t partOfStream[5];
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
@@ -709,7 +709,7 @@ int16_t WebRtcIsacfix_UpdateBwEstimate(ISACFIX_MainStruct *ISAC_main_inst,
streamdata.stream_index = 0; streamdata.stream_index = 0;
streamdata.full = 1; streamdata.full = 1;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0; k<5; k++) { for (k=0; k<5; k++) {
streamdata.stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); streamdata.stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
} }
@@ -765,7 +765,7 @@ int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst,
/* number of samples (480 or 960), output from decoder */ /* number of samples (480 or 960), output from decoder */
/* that were actually used in the encoder/decoder (determined on the fly) */ /* that were actually used in the encoder/decoder (determined on the fly) */
int16_t number_of_samples; int16_t number_of_samples;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t declen = 0; int16_t declen = 0;
@@ -793,7 +793,7 @@ int16_t WebRtcIsacfix_Decode(ISACFIX_MainStruct *ISAC_main_inst,
(ISAC_inst->ISACdec_obj.bitstr_obj).stream = (uint16_t *)encoded; (ISAC_inst->ISACdec_obj.bitstr_obj).stream = (uint16_t *)encoded;
/* convert bitstream from int16_t to bytes */ /* convert bitstream from int16_t to bytes */
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0; k<(len>>1); k++) { for (k=0; k<(len>>1); k++) {
(ISAC_inst->ISACdec_obj.bitstr_obj).stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); (ISAC_inst->ISACdec_obj.bitstr_obj).stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
} }
@@ -868,7 +868,7 @@ int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst,
/* twice the number of samples (480 or 960), output from decoder */ /* twice the number of samples (480 or 960), output from decoder */
/* that were actually used in the encoder/decoder (determined on the fly) */ /* that were actually used in the encoder/decoder (determined on the fly) */
int16_t number_of_samples; int16_t number_of_samples;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t declen = 0; int16_t declen = 0;
@@ -894,7 +894,7 @@ int16_t WebRtcIsacfix_DecodeNb(ISACFIX_MainStruct *ISAC_main_inst,
(ISAC_inst->ISACdec_obj.bitstr_obj).stream = (uint16_t *)encoded; (ISAC_inst->ISACdec_obj.bitstr_obj).stream = (uint16_t *)encoded;
/* convert bitstream from int16_t to bytes */ /* convert bitstream from int16_t to bytes */
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0; k<(len>>1); k++) { for (k=0; k<(len>>1); k++) {
(ISAC_inst->ISACdec_obj.bitstr_obj).stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); (ISAC_inst->ISACdec_obj.bitstr_obj).stream[k] = (uint16_t) ((encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
} }
@@ -1267,7 +1267,7 @@ int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded,
{ {
Bitstr_dec streamdata; Bitstr_dec streamdata;
uint16_t partOfStream[5]; uint16_t partOfStream[5];
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
@@ -1280,7 +1280,7 @@ int16_t WebRtcIsacfix_ReadFrameLen(const int16_t* encoded,
streamdata.stream_index = 0; streamdata.stream_index = 0;
streamdata.full = 1; streamdata.full = 1;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0; k<5; k++) { for (k=0; k<5; k++) {
streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
} }
@@ -1316,7 +1316,7 @@ int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded,
{ {
Bitstr_dec streamdata; Bitstr_dec streamdata;
uint16_t partOfStream[5]; uint16_t partOfStream[5];
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
@@ -1329,7 +1329,7 @@ int16_t WebRtcIsacfix_ReadBwIndex(const int16_t* encoded,
streamdata.stream_index = 0; streamdata.stream_index = 0;
streamdata.full = 1; streamdata.full = 1;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k=0; k<5; k++) { for (k=0; k<5; k++) {
streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8)); streamdata.stream[k] = (uint16_t) (((uint16_t)encoded[k] >> 8)|((encoded[k] & 0xFF)<<8));
} }

View File

@@ -742,7 +742,7 @@ int16_t WebRtcIsac_Encode(ISACStruct* ISAC_main_inst,
WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])), WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])),
streamLenUB + garbageLen, &crc); streamLenUB + garbageLen, &crc);
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] = ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] =
(uint8_t)((crc >> (24 - k * 8)) & 0xFF); (uint8_t)((crc >> (24 - k * 8)) & 0xFF);
@@ -805,7 +805,7 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
int32_t currentBN; int32_t currentBN;
uint8_t* encodedPtrUW8 = (uint8_t*)encoded; uint8_t* encodedPtrUW8 = (uint8_t*)encoded;
uint32_t crc; uint32_t crc;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int16_t k; int16_t k;
#endif #endif
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
@@ -896,7 +896,7 @@ int16_t WebRtcIsac_GetNewBitStream(ISACStruct* ISAC_main_inst,
WebRtcIsac_GetCrc((int16_t*)(&(encodedPtrUW8[streamLenLB + 1])), WebRtcIsac_GetCrc((int16_t*)(&(encodedPtrUW8[streamLenLB + 1])),
streamLenUB, &crc); streamLenUB, &crc);
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
encodedPtrUW8[totalStreamLen - LEN_CHECK_SUM_WORD8 + k] = encodedPtrUW8[totalStreamLen - LEN_CHECK_SUM_WORD8 + k] =
(uint8_t)((crc >> (24 - k * 8)) & 0xFF); (uint8_t)((crc >> (24 - k * 8)) & 0xFF);
@@ -1008,7 +1008,7 @@ int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
uint32_t arr_ts) { uint32_t arr_ts) {
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
Bitstr streamdata; Bitstr streamdata;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
@@ -1029,7 +1029,7 @@ int16_t WebRtcIsac_UpdateBwEstimate(ISACStruct* ISAC_main_inst,
WebRtcIsac_ResetBitstream(&(streamdata)); WebRtcIsac_ResetBitstream(&(streamdata));
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k = 0; k < 10; k++) { for (k = 0; k < 10; k++) {
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >> streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
((k & 1) << 3)) & 0xFF); ((k & 1) << 3)) & 0xFF);
@@ -1741,14 +1741,14 @@ int16_t WebRtcIsac_UpdateUplinkBw(ISACStruct* ISAC_main_inst,
int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded, int16_t WebRtcIsac_ReadBwIndex(const int16_t* encoded,
int16_t* bweIndex) { int16_t* bweIndex) {
Bitstr streamdata; Bitstr streamdata;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
WebRtcIsac_ResetBitstream(&(streamdata)); WebRtcIsac_ResetBitstream(&(streamdata));
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k = 0; k < 10; k++) { for (k = 0; k < 10; k++) {
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >> streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
((k & 1) << 3)) & 0xFF); ((k & 1) << 3)) & 0xFF);
@@ -1790,7 +1790,7 @@ int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
const int16_t* encoded, const int16_t* encoded,
int16_t* frameLength) { int16_t* frameLength) {
Bitstr streamdata; Bitstr streamdata;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
int16_t err; int16_t err;
@@ -1798,7 +1798,7 @@ int16_t WebRtcIsac_ReadFrameLen(ISACStruct* ISAC_main_inst,
WebRtcIsac_ResetBitstream(&(streamdata)); WebRtcIsac_ResetBitstream(&(streamdata));
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k = 0; k < 10; k++) { for (k = 0; k < 10; k++) {
streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >> streamdata.stream[k] = (uint8_t)((encoded[k >> 1] >>
((k & 1) << 3)) & 0xFF); ((k & 1) << 3)) & 0xFF);
@@ -2108,7 +2108,7 @@ int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
int16_t totalLenUB; int16_t totalLenUB;
uint8_t* ptrEncodedUW8 = (uint8_t*)encoded; uint8_t* ptrEncodedUW8 = (uint8_t*)encoded;
ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst; ISACMainStruct* instISAC = (ISACMainStruct*)ISAC_main_inst;
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
int k; int k;
#endif #endif
@@ -2164,7 +2164,7 @@ int16_t WebRtcIsac_GetRedPayload(ISACStruct* ISAC_main_inst,
WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])), WebRtcIsac_GetCrc((int16_t*)(&(ptrEncodedUW8[streamLenLB + 1])),
streamLenUB, &crc); streamLenUB, &crc);
#ifndef WEBRTC_BIG_ENDIAN #ifndef WEBRTC_ARCH_BIG_ENDIAN
for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) { for (k = 0; k < LEN_CHECK_SUM_WORD8; k++) {
ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] = ptrEncodedUW8[streamLen - LEN_CHECK_SUM_WORD8 + k] =
(uint8_t)((crc >> (24 - k * 8)) & 0xFF); (uint8_t)((crc >> (24 - k * 8)) & 0xFF);

View File

@@ -15,7 +15,7 @@
#include "typedefs.h" #include "typedefs.h"
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
#include "signal_processing_library.h" #include "signal_processing_library.h"
#endif #endif
@@ -29,7 +29,7 @@ int16_t WebRtcPcm16b_EncodeW16(int16_t *speechIn16b,
int16_t len, int16_t len,
int16_t *speechOut16b) int16_t *speechOut16b)
{ {
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
WEBRTC_SPL_MEMCPY_W16(speechOut16b, speechIn16b, len); WEBRTC_SPL_MEMCPY_W16(speechOut16b, speechIn16b, len);
#else #else
int i; int i;
@@ -68,7 +68,7 @@ int16_t WebRtcPcm16b_DecodeW16(void *inst,
int16_t *speechOut16b, int16_t *speechOut16b,
int16_t* speechType) int16_t* speechType)
{ {
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
WEBRTC_SPL_MEMCPY_W8(speechOut16b, speechIn16b, ((len*sizeof(int16_t)+1)>>1)); WEBRTC_SPL_MEMCPY_W8(speechOut16b, speechIn16b, ((len*sizeof(int16_t)+1)>>1));
#else #else
int i; int i;

View File

@@ -93,7 +93,7 @@ int16_t WebRtcNetEQ_DtmfInsertEvent(dtmf_inst_t *DTMFdec_inst,
if (len == 4) if (len == 4)
{ {
EventStart = encoded; EventStart = encoded;
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
value=((*EventStart)>>8); value=((*EventStart)>>8);
endEvent=((*EventStart)&0x80)>>7; endEvent=((*EventStart)&0x80)>>7;
Volume=((*EventStart)&0x3F); Volume=((*EventStart)&0x3F);

View File

@@ -31,7 +31,7 @@ int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen,
return RTP_TOO_SHORT_PACKET; return RTP_TOO_SHORT_PACKET;
} }
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
i_IPver = (((uint16_t) (pw16_Datagram[0] & 0xC000)) >> 14); /* Extract the version */ i_IPver = (((uint16_t) (pw16_Datagram[0] & 0xC000)) >> 14); /* Extract the version */
i_P = (((uint16_t) (pw16_Datagram[0] & 0x2000)) >> 13); /* Extract the P bit */ i_P = (((uint16_t) (pw16_Datagram[0] & 0x2000)) >> 13); /* Extract the P bit */
i_X = (((uint16_t) (pw16_Datagram[0] & 0x1000)) >> 12); /* Extract the X bit */ i_X = (((uint16_t) (pw16_Datagram[0] & 0x1000)) >> 12); /* Extract the X bit */
@@ -62,7 +62,7 @@ int WebRtcNetEQ_RTPPayloadInfo(int16_t* pw16_Datagram, int i_DatagramLen,
i_padlength = ((pw16_Datagram[(i_DatagramLen >> 1) - 1]) & 0xFF); i_padlength = ((pw16_Datagram[(i_DatagramLen >> 1) - 1]) & 0xFF);
} }
} }
#else /* WEBRTC_LITTLE_ENDIAN */ #else /* WEBRTC_ARCH_LITTLE_ENDIAN */
i_IPver = (((uint16_t) (pw16_Datagram[0] & 0xC0)) >> 6); /* Extract the IP version */ i_IPver = (((uint16_t) (pw16_Datagram[0] & 0xC0)) >> 6); /* Extract the IP version */
i_P = (((uint16_t) (pw16_Datagram[0] & 0x20)) >> 5); /* Extract the P bit */ i_P = (((uint16_t) (pw16_Datagram[0] & 0x20)) >> 5); /* Extract the P bit */
i_X = (((uint16_t) (pw16_Datagram[0] & 0x10)) >> 4); /* Extract the X bit */ i_X = (((uint16_t) (pw16_Datagram[0] & 0x10)) >> 4); /* Extract the X bit */
@@ -126,7 +126,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
int i_discardedBlockLength = 0; int i_discardedBlockLength = 0;
int singlePayload = 0; int singlePayload = 0;
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
if ((pw16_data[0] & 0x8000) == 0) if ((pw16_data[0] & 0x8000) == 0)
{ {
/* Only one payload in this packet*/ /* Only one payload in this packet*/
@@ -155,7 +155,7 @@ int WebRtcNetEQ_RedundancySplit(RTPPacket_t* RTPheader[], int i_MaximumPayloads,
((((uint16_t)pw16_data[1]) & 0xFC00) >> 10); ((((uint16_t)pw16_data[1]) & 0xFC00) >> 10);
i_blockLength = (((uint16_t)pw16_data[1]) & 0x3FF); i_blockLength = (((uint16_t)pw16_data[1]) & 0x3FF);
} }
#else /* WEBRTC_LITTLE_ENDIAN */ #else /* WEBRTC_ARCH_LITTLE_ENDIAN */
if ((pw16_data[0] & 0x80) == 0) if ((pw16_data[0] & 0x80) == 0)
{ {
/* Only one payload in this packet */ /* Only one payload in this packet */

View File

@@ -1177,7 +1177,7 @@ int32_t AudioDeviceLinuxALSA::InitPlayout()
_playoutFramesIn10MS = _playoutFreq/100; _playoutFramesIn10MS = _playoutFreq/100;
if ((errVal = LATE(snd_pcm_set_params)( _handlePlayout, if ((errVal = LATE(snd_pcm_set_params)( _handlePlayout,
#if defined(WEBRTC_BIG_ENDIAN) #if defined(WEBRTC_ARCH_BIG_ENDIAN)
SND_PCM_FORMAT_S16_BE, SND_PCM_FORMAT_S16_BE,
#else #else
SND_PCM_FORMAT_S16_LE, //format SND_PCM_FORMAT_S16_LE, //format
@@ -1333,7 +1333,7 @@ int32_t AudioDeviceLinuxALSA::InitRecording()
_recordingFramesIn10MS = _recordingFreq/100; _recordingFramesIn10MS = _recordingFreq/100;
if ((errVal = LATE(snd_pcm_set_params)(_handleRecord, if ((errVal = LATE(snd_pcm_set_params)(_handleRecord,
#if defined(WEBRTC_BIG_ENDIAN) #if defined(WEBRTC_ARCH_BIG_ENDIAN)
SND_PCM_FORMAT_S16_BE, //format SND_PCM_FORMAT_S16_BE, //format
#else #else
SND_PCM_FORMAT_S16_LE, //format SND_PCM_FORMAT_S16_LE, //format
@@ -1352,7 +1352,7 @@ int32_t AudioDeviceLinuxALSA::InitRecording()
_recChannels = 1; _recChannels = 1;
if ((errVal = LATE(snd_pcm_set_params)(_handleRecord, if ((errVal = LATE(snd_pcm_set_params)(_handleRecord,
#if defined(WEBRTC_BIG_ENDIAN) #if defined(WEBRTC_ARCH_BIG_ENDIAN)
SND_PCM_FORMAT_S16_BE, //format SND_PCM_FORMAT_S16_BE, //format
#else #else
SND_PCM_FORMAT_S16_LE, //format SND_PCM_FORMAT_S16_LE, //format

View File

@@ -97,7 +97,7 @@ void AudioDeviceMac::logCAMsg(const TraceLevel level,
assert(msg != NULL); assert(msg != NULL);
assert(err != NULL); assert(err != NULL);
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err); WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err);
#else #else
// We need to flip the characters in this case. // We need to flip the characters in this case.
@@ -1457,7 +1457,7 @@ int32_t AudioDeviceMac::InitPlayout()
_outDesiredFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger _outDesiredFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
| kLinearPCMFormatFlagIsPacked; | kLinearPCMFormatFlagIsPacked;
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
_outDesiredFormat.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; _outDesiredFormat.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
#endif #endif
_outDesiredFormat.mFormatID = kAudioFormatLinearPCM; _outDesiredFormat.mFormatID = kAudioFormatLinearPCM;
@@ -1681,7 +1681,7 @@ int32_t AudioDeviceMac::InitRecording()
_inDesiredFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger _inDesiredFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger
| kLinearPCMFormatFlagIsPacked; | kLinearPCMFormatFlagIsPacked;
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
_inDesiredFormat.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian; _inDesiredFormat.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
#endif #endif
_inDesiredFormat.mFormatID = kAudioFormatLinearPCM; _inDesiredFormat.mFormatID = kAudioFormatLinearPCM;

View File

@@ -1154,7 +1154,7 @@ void AudioMixerManagerMac::logCAMsg(const TraceLevel level,
assert(msg != NULL); assert(msg != NULL);
assert(err != NULL); assert(err != NULL);
#ifdef WEBRTC_BIG_ENDIAN #ifdef WEBRTC_ARCH_BIG_ENDIAN
WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err); WEBRTC_TRACE(level, module, id, "%s: %.4s", msg, err);
#else #else
// We need to flip the characters in this case. // We need to flip the characters in this case.

View File

@@ -638,7 +638,7 @@ int AudioProcessingImpl::WriteMessageToDebugFile() {
if (size <= 0) { if (size <= 0) {
return kUnspecifiedError; return kUnspecifiedError;
} }
#if defined(WEBRTC_BIG_ENDIAN) #if defined(WEBRTC_ARCH_BIG_ENDIAN)
// TODO(ajm): Use little-endian "on the wire". For the moment, we can be // TODO(ajm): Use little-endian "on the wire". For the moment, we can be
// pretty safe in assuming little-endian. // pretty safe in assuming little-endian.
#endif #endif

View File

@@ -125,16 +125,12 @@ bool StringCompare(const char* str1, const char* str2,
} }
#endif #endif
#if !defined(WEBRTC_LITTLE_ENDIAN) && !defined(WEBRTC_BIG_ENDIAN)
#error Either WEBRTC_LITTLE_ENDIAN or WEBRTC_BIG_ENDIAN must be defined
#endif
/* for RTP/RTCP /* for RTP/RTCP
All integer fields are carried in network byte order, that is, most All integer fields are carried in network byte order, that is, most
significant byte (octet) first. AKA big-endian. significant byte (octet) first. AKA big-endian.
*/ */
void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value) { void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value) {
#if defined(WEBRTC_LITTLE_ENDIAN) #if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
dataBuffer[0] = static_cast<uint8_t>(value >> 24); dataBuffer[0] = static_cast<uint8_t>(value >> 24);
dataBuffer[1] = static_cast<uint8_t>(value >> 16); dataBuffer[1] = static_cast<uint8_t>(value >> 16);
dataBuffer[2] = static_cast<uint8_t>(value >> 8); dataBuffer[2] = static_cast<uint8_t>(value >> 8);
@@ -146,7 +142,7 @@ void AssignUWord32ToBuffer(uint8_t* dataBuffer, uint32_t value) {
} }
void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value) { void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value) {
#if defined(WEBRTC_LITTLE_ENDIAN) #if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
dataBuffer[0] = static_cast<uint8_t>(value >> 16); dataBuffer[0] = static_cast<uint8_t>(value >> 16);
dataBuffer[1] = static_cast<uint8_t>(value >> 8); dataBuffer[1] = static_cast<uint8_t>(value >> 8);
dataBuffer[2] = static_cast<uint8_t>(value); dataBuffer[2] = static_cast<uint8_t>(value);
@@ -158,7 +154,7 @@ void AssignUWord24ToBuffer(uint8_t* dataBuffer, uint32_t value) {
} }
void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value) { void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value) {
#if defined(WEBRTC_LITTLE_ENDIAN) #if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
dataBuffer[0] = static_cast<uint8_t>(value >> 8); dataBuffer[0] = static_cast<uint8_t>(value >> 8);
dataBuffer[1] = static_cast<uint8_t>(value); dataBuffer[1] = static_cast<uint8_t>(value);
#else #else
@@ -168,7 +164,7 @@ void AssignUWord16ToBuffer(uint8_t* dataBuffer, uint16_t value) {
} }
uint16_t BufferToUWord16(const uint8_t* dataBuffer) { uint16_t BufferToUWord16(const uint8_t* dataBuffer) {
#if defined(WEBRTC_LITTLE_ENDIAN) #if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
return (dataBuffer[0] << 8) + dataBuffer[1]; return (dataBuffer[0] << 8) + dataBuffer[1];
#else #else
return *reinterpret_cast<const uint16_t*>(dataBuffer); return *reinterpret_cast<const uint16_t*>(dataBuffer);
@@ -180,7 +176,7 @@ uint32_t BufferToUWord24(const uint8_t* dataBuffer) {
} }
uint32_t BufferToUWord32(const uint8_t* dataBuffer) { uint32_t BufferToUWord32(const uint8_t* dataBuffer) {
#if defined(WEBRTC_LITTLE_ENDIAN) #if defined(WEBRTC_ARCH_LITTLE_ENDIAN)
return (dataBuffer[0] << 24) + (dataBuffer[1] << 16) + (dataBuffer[2] << 8) + return (dataBuffer[0] << 24) + (dataBuffer[1] << 16) + (dataBuffer[2] << 8) +
dataBuffer[3]; dataBuffer[3];
#else #else

View File

@@ -245,37 +245,25 @@ inline uint32_t RtpDumpImpl::GetTimeInMS() const
gettimeofday(&tv, &tz); gettimeofday(&tv, &tz);
val = tv.tv_sec * 1000 + tv.tv_usec / 1000; val = tv.tv_sec * 1000 + tv.tv_usec / 1000;
return val; return val;
#else
#error Either _WIN32 or LINUX or WEBRTC_MAC has to be defined!
assert(false);
return 0;
#endif #endif
} }
inline uint32_t RtpDumpImpl::RtpDumpHtonl(uint32_t x) const inline uint32_t RtpDumpImpl::RtpDumpHtonl(uint32_t x) const
{ {
#if defined(WEBRTC_BIG_ENDIAN) #if defined(WEBRTC_ARCH_BIG_ENDIAN)
return x; return x;
#elif defined(WEBRTC_LITTLE_ENDIAN) #elif defined(WEBRTC_ARCH_LITTLE_ENDIAN)
return (x >> 24) + ((((x >> 16) & 0xFF) << 8) + ((((x >> 8) & 0xFF) << 16) + return (x >> 24) + ((((x >> 16) & 0xFF) << 8) + ((((x >> 8) & 0xFF) << 16) +
((x & 0xFF) << 24))); ((x & 0xFF) << 24)));
#else
#error Either WEBRTC_BIG_ENDIAN or WEBRTC_LITTLE_ENDIAN has to be defined!
assert(false);
return 0;
#endif #endif
} }
inline uint16_t RtpDumpImpl::RtpDumpHtons(uint16_t x) const inline uint16_t RtpDumpImpl::RtpDumpHtons(uint16_t x) const
{ {
#if defined(WEBRTC_BIG_ENDIAN) #if defined(WEBRTC_ARCH_BIG_ENDIAN)
return x; return x;
#elif defined(WEBRTC_LITTLE_ENDIAN) #elif defined(WEBRTC_ARCH_LITTLE_ENDIAN)
return (x >> 8) + ((x & 0xFF) << 8); return (x >> 8) + ((x & 0xFF) << 8);
#else
#error Either WEBRTC_BIG_ENDIAN or WEBRTC_LITTLE_ENDIAN has to be defined!
assert(false);
return 0;
#endif #endif
} }
} // namespace webrtc } // namespace webrtc

View File

@@ -25,38 +25,37 @@
// http://msdn.microsoft.com/en-us/library/b0084kay.aspx // http://msdn.microsoft.com/en-us/library/b0084kay.aspx
// http://www.agner.org/optimize/calling_conventions.pdf // http://www.agner.org/optimize/calling_conventions.pdf
// or with gcc, run: "echo | gcc -E -dM -" // or with gcc, run: "echo | gcc -E -dM -"
// TODO(andrew): replace WEBRTC_LITTLE_ENDIAN with WEBRTC_ARCH_LITTLE_ENDIAN.
#if defined(_M_X64) || defined(__x86_64__) #if defined(_M_X64) || defined(__x86_64__)
#define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86_FAMILY
#define WEBRTC_ARCH_X86_64 #define WEBRTC_ARCH_X86_64
#define WEBRTC_ARCH_64_BITS #define WEBRTC_ARCH_64_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#elif defined(_M_IX86) || defined(__i386__) #elif defined(_M_IX86) || defined(__i386__)
#define WEBRTC_ARCH_X86_FAMILY #define WEBRTC_ARCH_X86_FAMILY
#define WEBRTC_ARCH_X86 #define WEBRTC_ARCH_X86
#define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#elif defined(__ARMEL__) #elif defined(__ARMEL__)
// TODO(andrew): We'd prefer to control platform defines here, but this is // TODO(ajm): We'd prefer to control platform defines here, but this is
// currently provided by the Android makefiles. Commented to avoid duplicate // currently provided by the Android makefiles. Commented to avoid duplicate
// definition warnings. // definition warnings.
//#define WEBRTC_ARCH_ARM //#define WEBRTC_ARCH_ARM
// TODO(andrew): Chromium uses the following two defines. Should we switch? // TODO(ajm): Chromium uses the following two defines. Should we switch?
//#define WEBRTC_ARCH_ARM_FAMILY //#define WEBRTC_ARCH_ARM_FAMILY
//#define WEBRTC_ARCH_ARMEL //#define WEBRTC_ARCH_ARMEL
#define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#elif defined(__MIPSEL__) #elif defined(__MIPSEL__)
#define WEBRTC_ARCH_32_BITS #define WEBRTC_ARCH_32_BITS
#define WEBRTC_ARCH_LITTLE_ENDIAN #define WEBRTC_ARCH_LITTLE_ENDIAN
#define WEBRTC_LITTLE_ENDIAN
#else #else
#error Please add support for your architecture in typedefs.h #error Please add support for your architecture in typedefs.h
#endif #endif
#if !(defined(WEBRTC_ARCH_LITTLE_ENDIAN) ^ defined(WEBRTC_ARCH_BIG_ENDIAN))
#error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN
#endif
#if defined(__SSE2__) || defined(_MSC_VER) #if defined(__SSE2__) || defined(_MSC_VER)
#define WEBRTC_USE_SSE2 #define WEBRTC_USE_SSE2
#endif #endif