summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2011-08-30 14:02:41 -0400
committerGregory Maxwell <greg@xiph.org>2011-08-30 14:08:25 -0400
commit75d27803d52f44f4618c4796111c179e24ba558e (patch)
tree398002c881281cb98199cd286d6bee6dbbc66557
parentbe89c395872c57087a6fd0b004ee175677bb3d79 (diff)
downloadopus-75d27803d52f44f4618c4796111c179e24ba558e.tar.gz
Adds many syntactically unnecessary parentheses to silence MSVC C4554.
The object code is unchanged.
-rw-r--r--libcelt/bands.c8
-rw-r--r--libcelt/celt.c14
-rw-r--r--libcelt/cwrs.c12
-rw-r--r--libcelt/entcode.c2
-rw-r--r--libcelt/entdec.c4
-rw-r--r--libcelt/entenc.c12
-rw-r--r--libcelt/mathops.c4
-rw-r--r--libcelt/mfrngcod.h2
-rw-r--r--libcelt/rate.c2
9 files changed, 30 insertions, 30 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c
index d057c261..75c32247 100644
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -68,7 +68,7 @@ static int bitexact_log2tan(int isin,int icos)
ls=EC_ILOG(isin);
icos<<=15-lc;
isin<<=15-ls;
- return (ls-lc<<11)
+ return ((ls-lc)<<11)
+FRAC_MUL16(isin, FRAC_MUL16(isin, -2597) + 7932)
-FRAC_MUL16(icos, FRAC_MUL16(icos, -2597) + 7932);
}
@@ -222,7 +222,7 @@ void anti_collapse(const CELTMode *m, celt_norm *_X, unsigned char *collapse_mas
N0 = m->eBands[i+1]-m->eBands[i];
/* depth in 1/8 bits */
- depth = (1+pulses[i])/(m->eBands[i+1]-m->eBands[i]<<LM);
+ depth = (1+pulses[i])/((m->eBands[i+1]-m->eBands[i])<<LM);
#ifdef FIXED_POINT
thresh = MULT16_32_Q15(QCONST16(0.5f, 15), MIN32(32767,SHR32(celt_exp2(-SHL16(depth, 10-BITRES)),1) ));
@@ -903,14 +903,14 @@ static unsigned quant_band(int encode, const CELTMode *m, int i, celt_norm *X, c
{
imid = 0;
iside = 32767;
- fill &= (1<<B)-1<<B;
+ fill &= ((1<<B)-1)<<B;
delta = 16384;
} else {
imid = bitexact_cos(itheta);
iside = bitexact_cos(16384-itheta);
/* This is the mid vs side allocation that minimizes squared error
in that band. */
- delta = FRAC_MUL16(N-1<<7,bitexact_log2tan(iside,imid));
+ delta = FRAC_MUL16((N-1)<<7,bitexact_log2tan(iside,imid));
}
#ifdef FIXED_POINT
diff --git a/libcelt/celt.c b/libcelt/celt.c
index d5abb8a8..b3257926 100644
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -1025,7 +1025,7 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
was entirely empty, but to allow 0 in hybrid mode. */
vbr_bound = vbr_rate;
max_allowed = IMIN(IMAX(tell==1?2:0,
- vbr_rate+vbr_bound-st->vbr_reservoir>>(BITRES+3)),
+ (vbr_rate+vbr_bound-st->vbr_reservoir)>>(BITRES+3)),
nbAvailableBytes);
if(max_allowed < nbAvailableBytes)
{
@@ -1404,9 +1404,9 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
result in the encoder running out of bits.
The margin of 2 bytes ensures that none of the bust-prevention logic
in the decoder will have triggered so far. */
- min_allowed = (tell+total_boost+(1<<BITRES+3)-1>>(BITRES+3)) + 2 - nbFilledBytes;
+ min_allowed = ((tell+total_boost+(1<<(BITRES+3))-1)>>(BITRES+3)) + 2 - nbFilledBytes;
- nbAvailableBytes = target+(1<<(BITRES+2))>>(BITRES+3);
+ nbAvailableBytes = (target+(1<<(BITRES+2)))>>(BITRES+3);
nbAvailableBytes = IMAX(min_allowed,nbAvailableBytes);
nbAvailableBytes = IMIN(nbCompressedBytes,nbAvailableBytes+nbFilledBytes) - nbFilledBytes;
@@ -1492,8 +1492,8 @@ int celt_encode_with_ec(CELTEncoder * restrict st, const opus_val16 * pcm, int f
ALLOC(fine_priority, st->mode->nbEBands, int);
/* bits = packet size - where we are - safety*/
- bits = ((opus_int32)nbCompressedBytes*8<<BITRES) - ec_tell_frac(enc) - 1;
- anti_collapse_rsv = isTransient&&LM>=2&&bits>=(LM+2<<BITRES) ? (1<<BITRES) : 0;
+ bits = (((opus_int32)nbCompressedBytes*8)<<BITRES) - ec_tell_frac(enc) - 1;
+ anti_collapse_rsv = isTransient&&LM>=2&&bits>=((LM+2)<<BITRES) ? (1<<BITRES) : 0;
bits -= anti_collapse_rsv;
codedBands = compute_allocation(st->mode, st->start, st->end, offsets, cap,
alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses,
@@ -2480,8 +2480,8 @@ int celt_decode_with_ec(CELTDecoder * restrict st, const unsigned char *data, in
alloc_trim = tell+(6<<BITRES) <= total_bits ?
ec_dec_icdf(dec, trim_icdf, 7) : 5;
- bits = ((opus_int32)len*8<<BITRES) - ec_tell_frac(dec) - 1;
- anti_collapse_rsv = isTransient&&LM>=2&&bits>=(LM+2<<BITRES) ? (1<<BITRES) : 0;
+ bits = (((opus_int32)len*8)<<BITRES) - ec_tell_frac(dec) - 1;
+ anti_collapse_rsv = isTransient&&LM>=2&&bits>=((LM+2)<<BITRES) ? (1<<BITRES) : 0;
bits -= anti_collapse_rsv;
codedBands = compute_allocation(st->mode, st->start, st->end, offsets, cap,
alloc_trim, &intensity, &dual_stereo, bits, &balance, pulses,
diff --git a/libcelt/cwrs.c b/libcelt/cwrs.c
index 38051655..e5cd08d7 100644
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -118,12 +118,12 @@ static inline opus_uint32 imusdiv32even(opus_uint32 _a,opus_uint32 _b,
celt_assert(_d>0);
celt_assert(_d<=54);
shift=EC_ILOG(_d^_d-1);
- inv=INV_TABLE[_d-1>>shift];
+ inv=INV_TABLE[(_d-1)>>shift];
shift--;
one=1<<shift;
mask=one-1;
return (_a*(_b>>shift)-(_c>>shift)+
- (_a*(_b&mask)+one-(_c&mask)>>shift)-1)*inv&MASK32;
+ ((_a*(_b&mask)+one-(_c&mask))>>shift)-1)*inv&MASK32;
}
#endif /* SMALL_FOOTPRINT */
@@ -356,7 +356,7 @@ static opus_uint32 ncwrs_urow(unsigned _n,unsigned _k,opus_uint32 *_u){
/*U(N,K) = ((2*N-1)*U(N,K-1)-U(N,K-2))/(K-1) + U(N,K-2)*/
_u[k]=um2=imusdiv32even(n2m1,um1,um2,k-1)+um2;
if(++k>=len)break;
- _u[k]=um1=imusdiv32odd(n2m1,um2,um1,k-1>>1)+um1;
+ _u[k]=um1=imusdiv32odd(n2m1,um2,um1,(k-1)>>1)+um1;
}
}
#endif /* SMALL_FOOTPRINT */
@@ -385,7 +385,7 @@ static inline void cwrsi2(int _k,opus_uint32 _i,int *_y){
s=-(_i>=p);
_i-=p&s;
yj=_k;
- _k=_i+1>>1;
+ _k=(_i+1)>>1;
p=_k?ucwrs2(_k):0;
_i-=p;
yj-=_k;
@@ -406,7 +406,7 @@ static void cwrsi3(int _k,opus_uint32 _i,int *_y){
yj=_k;
/*Finds the maximum _k such that ucwrs3(_k)<=_i (tested for all
_i<2147418113=U(3,32768)).*/
- _k=_i>0?isqrt32(2*_i-1)+1>>1:0;
+ _k=_i>0?(isqrt32(2*_i-1)+1)>>1:0;
p=_k?ucwrs3(_k):0;
_i-=p;
yj-=_k;
@@ -433,7 +433,7 @@ static void cwrsi4(int _k,opus_uint32 _i,int *_y){
kl=0;
kr=_k;
for(;;){
- _k=kl+kr>>1;
+ _k=(kl+kr)>>1;
p=_k?ucwrs4(_k):0;
if(p<_i){
if(_k>=kr)break;
diff --git a/libcelt/entcode.c b/libcelt/entcode.c
index 984987ee..0d9c7fc5 100644
--- a/libcelt/entcode.c
+++ b/libcelt/entcode.c
@@ -76,7 +76,7 @@ opus_uint32 ec_tell_frac(ec_ctx *_this){
encoder or decoder claims to have used 1 bit.*/
nbits=_this->nbits_total<<BITRES;
l=EC_ILOG(_this->rng);
- r=_this->rng>>l-16;
+ r=_this->rng>>(l-16);
for(i=BITRES;i-->0;){
int b;
r=r*r>>15;
diff --git a/libcelt/entdec.c b/libcelt/entdec.c
index 47d710bd..00aac6ca 100644
--- a/libcelt/entdec.c
+++ b/libcelt/entdec.c
@@ -114,7 +114,7 @@ static void ec_dec_normalize(ec_dec *_this){
/*Read the next value from the input.*/
_this->rem=ec_read_byte(_this);
/*Take the rest of the bits we need from this new symbol.*/
- sym=(sym<<EC_SYM_BITS|_this->rem)>>EC_SYM_BITS-EC_CODE_EXTRA;
+ sym=(sym<<EC_SYM_BITS|_this->rem)>>(EC_SYM_BITS-EC_CODE_EXTRA);
/*And subtract them from val, capped to be less than EC_CODE_TOP.*/
_this->val=(_this->val<<EC_SYM_BITS)+(EC_SYM_MAX&~sym)&EC_CODE_TOP-1;
}
@@ -129,7 +129,7 @@ void ec_dec_init(ec_dec *_this,unsigned char *_buf,opus_uint32 _storage){
_this->offs=0;
_this->rng=1U<<EC_CODE_EXTRA;
_this->rem=ec_read_byte(_this);
- _this->val=_this->rng-1-(_this->rem>>EC_SYM_BITS-EC_CODE_EXTRA);
+ _this->val=_this->rng-1-(_this->rem>>(EC_SYM_BITS-EC_CODE_EXTRA));
_this->error=0;
/*Normalize the interval.*/
ec_dec_normalize(_this);
diff --git a/libcelt/entenc.c b/libcelt/entenc.c
index 68aee104..6a4de9ed 100644
--- a/libcelt/entenc.c
+++ b/libcelt/entenc.c
@@ -103,7 +103,7 @@ static void ec_enc_normalize(ec_enc *_this){
while(_this->rng<=EC_CODE_BOT){
ec_enc_carry_out(_this,(int)(_this->val>>EC_CODE_SHIFT));
/*Move the next-to-high-order symbol into the high-order position.*/
- _this->val=_this->val<<EC_SYM_BITS&EC_CODE_TOP-1;
+ _this->val=(_this->val<<EC_SYM_BITS)&EC_CODE_TOP-1;
_this->rng<<=EC_SYM_BITS;
_this->nbits_total+=EC_SYM_BITS;
}
@@ -215,7 +215,7 @@ void ec_enc_patch_initial_bits(ec_enc *_this,unsigned _val,unsigned _nbits){
unsigned mask;
celt_assert(_nbits<=EC_SYM_BITS);
shift=EC_SYM_BITS-_nbits;
- mask=(1<<_nbits)-1<<shift;
+ mask=((1<<_nbits)-1)<<shift;
if(_this->offs>0){
/*The first byte has been finalized.*/
_this->buf[0]=(unsigned char)(_this->buf[0]&~mask|_val<<shift);
@@ -224,10 +224,10 @@ void ec_enc_patch_initial_bits(ec_enc *_this,unsigned _val,unsigned _nbits){
/*The first byte is still awaiting carry propagation.*/
_this->rem=_this->rem&~mask|_val<<shift;
}
- else if(_this->rng<=EC_CODE_TOP>>shift){
+ else if(_this->rng<=(EC_CODE_TOP>>shift)){
/*The renormalization loop has never been run.*/
_this->val=_this->val&~((opus_uint32)mask<<EC_CODE_SHIFT)|
- (opus_uint32)_val<<EC_CODE_SHIFT+shift;
+ (opus_uint32)_val<<(EC_CODE_SHIFT+shift);
}
/*The encoder hasn't even encoded _nbits of data yet.*/
else _this->error=-1;
@@ -249,7 +249,7 @@ void ec_enc_done(ec_enc *_this){
/*We output the minimum number of bits that ensures that the symbols encoded
thus far will be decoded correctly regardless of the bits that follow.*/
l=EC_CODE_BITS-EC_ILOG(_this->rng);
- msk=EC_CODE_TOP-1>>l;
+ msk=(EC_CODE_TOP-1)>>l;
end=_this->val+msk&~msk;
if((end|msk)>=_this->val+_this->rng){
l++;
@@ -258,7 +258,7 @@ void ec_enc_done(ec_enc *_this){
}
while(l>0){
ec_enc_carry_out(_this,(int)(end>>EC_CODE_SHIFT));
- end=end<<EC_SYM_BITS&EC_CODE_TOP-1;
+ end=(end<<EC_SYM_BITS)&EC_CODE_TOP-1;
l-=EC_SYM_BITS;
}
/*If we have a buffered byte flush it into the output buffer.*/
diff --git a/libcelt/mathops.c b/libcelt/mathops.c
index a48ca76c..9163eed1 100644
--- a/libcelt/mathops.c
+++ b/libcelt/mathops.c
@@ -48,11 +48,11 @@ unsigned isqrt32(opus_uint32 _val){
The main idea is to search for the largest binary digit b such that
(g+b)*(g+b) <= _val, and add it to the solution g.*/
g=0;
- bshift=EC_ILOG(_val)-1>>1;
+ bshift=(EC_ILOG(_val)-1)>>1;
b=1U<<bshift;
do{
opus_uint32 t;
- t=((opus_uint32)g<<1)+b<<bshift;
+ t=(((opus_uint32)g<<1)+b)<<bshift;
if(t<=_val){
g+=b;
_val-=t;
diff --git a/libcelt/mfrngcod.h b/libcelt/mfrngcod.h
index ca94c87e..6af128a6 100644
--- a/libcelt/mfrngcod.h
+++ b/libcelt/mfrngcod.h
@@ -40,7 +40,7 @@
/*Bits to shift by to move a symbol into the high-order position.*/
# define EC_CODE_SHIFT (EC_CODE_BITS-EC_SYM_BITS-1)
/*Carry bit of the high-order range symbol.*/
-# define EC_CODE_TOP (((opus_uint32)1U)<<EC_CODE_BITS-1)
+# define EC_CODE_TOP (((opus_uint32)1U)<<(EC_CODE_BITS-1))
/*Low-order bit of the high-order range symbol.*/
# define EC_CODE_BOT (EC_CODE_TOP>>EC_SYM_BITS)
/*The number of bits available for the last, partial symbol in the code field.*/
diff --git a/libcelt/rate.c b/libcelt/rate.c
index 9ac85740..145b1d46 100644
--- a/libcelt/rate.c
+++ b/libcelt/rate.c
@@ -497,7 +497,7 @@ static inline int interp_bits2pulses(const CELTMode *m, int start, int end, int
{
int extra_fine;
int extra_bits;
- extra_fine = IMIN(excess >> stereo+BITRES, MAX_FINE_BITS-ebits[j]);
+ extra_fine = IMIN(excess>>(stereo+BITRES),MAX_FINE_BITS-ebits[j]);
ebits[j] += extra_fine;
extra_bits = extra_fine*C<<BITRES;
fine_priority[j] = extra_bits >= excess-balance;