common_audio: Removes macro WEBRTC_SPL_LSHIFT_U16

We should avoid macros in general (see style guide) and the shift ones are particular dangerous since they assume that the user apply a non-negative shift.

Related CL: https://webrtc-codereview.appspot.com/16669004

BUG=3348,3353
TESTED=trybots and manually on linux
R=turaj@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6444 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
bjornv@webrtc.org
2014-06-16 10:30:14 +00:00
parent eb16b811fb
commit 721f970cba
5 changed files with 20 additions and 16 deletions

View File

@@ -15,18 +15,21 @@
*
*/
#include "arith_routins.h"
#include "bandwidth_estimator.h"
#include "codec.h"
#include "pitch_gain_tables.h"
#include "pitch_lag_tables.h"
#include "entropy_coding.h"
#include "lpc_tables.h"
#include "lpc_masking_model.h"
#include "pitch_estimator.h"
#include "structs.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h"
#include <assert.h>
#include <stdio.h>
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/arith_routins.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/bandwidth_estimator.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_masking_model.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/lpc_tables.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_gain_tables.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_lag_tables.h"
#include "webrtc/modules/audio_coding/codecs/isac/fix/source/structs.h"
int WebRtcIsacfix_EncodeImpl(int16_t *in,
ISACFIX_EncInst_t *ISACenc_obj,
@@ -450,12 +453,14 @@ int WebRtcIsacfix_EncodeImpl(int16_t *in,
while (stream_length < MinBytes)
{
assert(stream_length >= 0);
if (stream_length & 0x0001){
ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed );
ISACenc_obj->bitstr_obj.stream[ WEBRTC_SPL_RSHIFT_W16(stream_length, 1) ] |= (uint16_t)(ISACenc_obj->bitstr_seed & 0xFF);
} else {
ISACenc_obj->bitstr_seed = WEBRTC_SPL_RAND( ISACenc_obj->bitstr_seed );
ISACenc_obj->bitstr_obj.stream[ WEBRTC_SPL_RSHIFT_W16(stream_length, 1) ] = WEBRTC_SPL_LSHIFT_U16(ISACenc_obj->bitstr_seed, 8);
ISACenc_obj->bitstr_obj.stream[stream_length / 2] =
((uint16_t)ISACenc_obj->bitstr_seed << 8);
}
stream_length++;
}
@@ -467,7 +472,8 @@ int WebRtcIsacfix_EncodeImpl(int16_t *in,
}
else {
ISACenc_obj->bitstr_obj.stream[usefulstr_len>>1] &= 0x00FF;
ISACenc_obj->bitstr_obj.stream[usefulstr_len>>1] += WEBRTC_SPL_LSHIFT_U16((MinBytes - usefulstr_len) & 0x00FF, 8);
ISACenc_obj->bitstr_obj.stream[usefulstr_len >> 1] +=
((uint16_t)((MinBytes - usefulstr_len) & 0x00FF) << 8);
}
}
else