andrew@webrtc.org
2014-09-23 01:32:57 +00:00
parent 8c5740b485
commit a3c4d4dd2c
15 changed files with 68 additions and 73 deletions

View File

@ -17,7 +17,6 @@
#include "webrtc/modules/audio_coding/codecs/isac/fix/interface/isacfix.h"
#include <assert.h>
#include <stdlib.h>
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h"
@ -356,7 +355,7 @@ int16_t WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst,
int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst,
const int16_t *speechIn,
uint8_t* encoded)
int16_t *encoded)
{
ISACFIX_SubStruct *ISAC_inst;
int16_t stream_len;
@ -383,20 +382,16 @@ int16_t WebRtcIsacfix_Encode(ISACFIX_MainStruct *ISAC_main_inst,
return -1;
}
assert(stream_len % 2 == 0);
/* convert from bytes to int16_t */
#ifndef WEBRTC_ARCH_BIG_ENDIAN
/* The encoded data vector is supposesd to be big-endian, but our internal
representation is little-endian. So byteswap. */
for (k = 0; k < stream_len / 2; ++k) {
uint16_t s = ISAC_inst->ISACenc_obj.bitstr_obj.stream[k];
/* In big-endian, we have... */
encoded[2 * k] = s >> 8; /* ...most significant byte at low address... */
encoded[2 * k + 1] = s; /* ...least significant byte at high address. */
for (k=0;k<(stream_len+1)>>1;k++) {
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));
}
#else
/* The encoded data vector and our internal representation are both
big-endian. */
memcpy(encoded, ISAC_inst->ISACenc_obj.bitstr_obj.stream, stream_len);
WEBRTC_SPL_MEMCPY_W16(encoded, (ISAC_inst->ISACenc_obj.bitstr_obj).stream, (stream_len + 1)>>1);
#endif