Refactor audio_coding/ilbc: removes usage of macro WEBRTC_SPL_LSHIFT_W32

The macro is defined as
#define WEBRTC_SPL_LSHIFT_W32(a, b) ((a) << (b))
It is a trivial operation that need no macro. In fact it may be confusing for to the user, since it can be interpreted as having an implicit cast to int32_t.

Also removes unnecessary casts to int32_t from int16_t.

BUG=3348,3353
TESTED=locally on linux and trybots
R=kwiberg@webrtc.org

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

Cr-Commit-Position: refs/heads/master@{#8800}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8800 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c
index 50ad0ad..f8a0933 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy.c
@@ -53,7 +53,7 @@
 
   /* Normalize the energy and store the number of shifts */
   energyShifts[0] = (int16_t)WebRtcSpl_NormW32(energy);
-  tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, energyShifts[0]);
+  tmp32 = energy << energyShifts[0];
   energyW16[0] = (int16_t)(tmp32 >> 16);
 
   /* Compute the energy of the rest of the cb memory
@@ -69,7 +69,7 @@
 
   /* Normalize the energy and store the number of shifts */
   energyShifts[base_size] = (int16_t)WebRtcSpl_NormW32(energy);
-  tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, energyShifts[base_size]);
+  tmp32 = energy << energyShifts[base_size];
   energyW16[base_size] = (int16_t)(tmp32 >> 16);
 
   ppi = filteredCB + lMem - 1 - lTarget;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c
index 6161f20..7e6daf9 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_augmentation.c
@@ -58,7 +58,7 @@
 
     /* Normalize the energy and store the number of shifts */
     (*enShPtr) = (int16_t)WebRtcSpl_NormW32(energy);
-    tmp32 = WEBRTC_SPL_LSHIFT_W32(energy, (*enShPtr));
+    tmp32 = energy << *enShPtr;
     *enPtr = (int16_t)(tmp32 >> 16);
     enShPtr++;
     enPtr++;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c
index 87a510d..e5d1424 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_mem_energy_calc.c
@@ -58,7 +58,7 @@
     shft = (int16_t)WebRtcSpl_NormW32(energy);
     *eSh_ptr++ = shft;
 
-    tmp = WEBRTC_SPL_LSHIFT_W32(energy, shft);
+    tmp = energy << shft;
     *eW16_ptr++ = (int16_t)(tmp >> 16);
   }
 }
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c b/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c
index 559d998..3deb08a 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/cb_search_core.c
@@ -65,7 +65,7 @@
 
   for (i=0;i<range;i++) {
     /* Calculate cDot*cDot and put the result in a int16_t */
-    tmp32 = WEBRTC_SPL_LSHIFT_W32(*cDotPtr,sh);
+    tmp32 = *cDotPtr << sh;
     tmp16 = (int16_t)(tmp32 >> 16);
     cDotSqW16 = (int16_t)(((int32_t)(tmp16)*(tmp16))>>16);
 
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c
index 96c1aed..21a8f40 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/chebyshev.c
@@ -39,8 +39,7 @@
 
   b2 = (int32_t)0x1000000; /* b2 = 1.0 (Q23) */
   /* Calculate b1 = 2*x + f[1] */
-  tmp1W32 = WEBRTC_SPL_LSHIFT_W32((int32_t)x, 10);
-  tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[1], 14);
+  tmp1W32 = (x << 10) + (f[1] << 14);
 
   for (i = 2; i < 5; i++) {
     tmp2W32 = tmp1W32;
@@ -50,10 +49,7 @@
     b1_low = (int16_t)((tmp1W32 - ((int32_t)b1_high << 16)) >> 1);
 
     /* Calculate 2*x*b1-b2+f[i] */
-    tmp1W32 = WEBRTC_SPL_LSHIFT_W32(b1_high * x + ((b1_low * x) >> 15), 2);
-
-    tmp1W32 -= b2;
-    tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[i], 14);
+    tmp1W32 = ((b1_high * x + ((b1_low * x) >> 15)) << 2) - b2 + (f[i] << 14);
 
     /* Update b2 for next round */
     b2 = tmp2W32;
@@ -64,11 +60,8 @@
   b1_low = (int16_t)((tmp1W32 - ((int32_t)b1_high << 16)) >> 1);
 
   /* tmp1W32 = x*b1 - b2 + f[i]/2 */
-  tmp1W32 = WEBRTC_SPL_LSHIFT_W32(b1_high * x, 1) +
-      WEBRTC_SPL_LSHIFT_W32((b1_low * x) >> 15, 1);
-
-  tmp1W32 -= b2;
-  tmp1W32 += WEBRTC_SPL_LSHIFT_W32((int32_t)f[i], 13);
+  tmp1W32 = ((b1_high * x) << 1) + (((b1_low * x) >> 15) << 1) -
+      b2 + (f[i] << 13);
 
   /* Handle overflows and set to maximum or minimum int16_t instead */
   if (tmp1W32>((int32_t)33553408)) {
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/enhancer_interface.c b/webrtc/modules/audio_coding/codecs/ilbc/enhancer_interface.c
index d31af1b..fde5414 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/enhancer_interface.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/enhancer_interface.c
@@ -151,7 +151,7 @@
       corr16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(corrmax[i], corrSh);
       corr16[i] = (int16_t)((corr16[i] * corr16[i]) >> 16);
       en16[i] = (int16_t)WEBRTC_SPL_SHIFT_W32(ener, enerSh);
-      totsh[i] = enerSh - WEBRTC_SPL_LSHIFT_W32(corrSh, 1);
+      totsh[i] = enerSh - (corrSh << 1);
     }
 
     /* Compare lagmax[0..3] for the (corr^2)/ener criteria */
@@ -278,8 +278,7 @@
                                                       (int16_t)tmp1);
 
         /* Calculate the Sqrt of the energy in Q15 ((14+16)/2) */
-        SqrtEnChange = (int16_t)WebRtcSpl_SqrtFloor(
-            WEBRTC_SPL_LSHIFT_W32((int32_t)EnChange, 14));
+        SqrtEnChange = (int16_t)WebRtcSpl_SqrtFloor(EnChange << 14);
 
 
         /* Multiply first part of vector with 2*SqrtEnChange */
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c b/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c
index 983c6db..90b4114 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/gain_quant.c
@@ -48,7 +48,7 @@
 
   /* Multiply the gain with 2^14 to make the comparison
      easier and with higher precision */
-  gainW32 = WEBRTC_SPL_LSHIFT_W32((int32_t)gain, 14);
+  gainW32 = gain << 14;
 
   /* Do a binary search, starting in the middle of the CB
      loc - defines the current position in the table
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
index 5cb1ab2..62a6864 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/get_lsp_poly.c
@@ -67,14 +67,13 @@
       high = (int16_t)(fPtr[-1] >> 16);
       low = (int16_t)((fPtr[-1] - ((int32_t)high << 16)) >> 1);
 
-      tmpW32 = WEBRTC_SPL_LSHIFT_W32(high * *lspPtr, 2) +
-          WEBRTC_SPL_LSHIFT_W32((low * *lspPtr) >> 15, 2);
+      tmpW32 = ((high * *lspPtr) << 2) + (((low * *lspPtr) >> 15) << 2);
 
       (*fPtr) += fPtr[-2];
       (*fPtr) -= tmpW32;
       fPtr--;
     }
-    (*fPtr) -= (int32_t)WEBRTC_SPL_LSHIFT_W32((int32_t)(*lspPtr), 10);
+    *fPtr -= *lspPtr << 10;
 
     fPtr+=i;
     lspPtr+=2;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c
index a36ea39..260591e 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_input.c
@@ -77,11 +77,11 @@
     } else if (tmpW32<-268435456) {
       tmpW32 = WEBRTC_SPL_WORD32_MIN;
     } else {
-      tmpW32 = WEBRTC_SPL_LSHIFT_W32(tmpW32, 3);
+      tmpW32 <<= 3;
     }
 
     y[0] = (int16_t)(tmpW32 >> 16);
-    y[1] = (int16_t)((tmpW32 - WEBRTC_SPL_LSHIFT_W32((int32_t)y[0], 16))>>1);
+    y[1] = (int16_t)((tmpW32 - (y[0] << 16)) >> 1);
   }
 
   return;
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
index 970ae11..3abb427 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/hp_output.c
@@ -77,11 +77,11 @@
     } else if (tmpW32<-268435456) {
       tmpW32 = WEBRTC_SPL_WORD32_MIN;
     } else {
-      tmpW32 = WEBRTC_SPL_LSHIFT_W32(tmpW32, 3);
+      tmpW32 <<= 3;
     }
 
     y[0] = (int16_t)(tmpW32 >> 16);
-    y[1] = (int16_t)((tmpW32 - WEBRTC_SPL_LSHIFT_W32((int32_t)y[0], 16))>>1);
+    y[1] = (int16_t)((tmpW32 - (y[0] << 16)) >> 1);
 
   }
 
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/smooth.c b/webrtc/modules/audio_coding/codecs/ilbc/smooth.c
index 57bd4ae..f58e72c 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/smooth.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/smooth.c
@@ -76,13 +76,12 @@
     scale1 = scale2 + 16;
   }
 
-  w00prim = WEBRTC_SPL_LSHIFT_W32(w00, scale1);
+  w00prim = w00 << scale1;
   w11prim = (int16_t) WEBRTC_SPL_SHIFT_W32(w11, scale2);
 
   /* Perform C = sqrt(w11/w00) (C is in Q11 since (16+6)/2=11) */
   if (w11prim>64) {
-    endiff = WEBRTC_SPL_LSHIFT_W32(
-        (int32_t)WebRtcSpl_DivW32W16(w00prim, w11prim), 6);
+    endiff = WebRtcSpl_DivW32W16(w00prim, w11prim) << 6;
     C = (int16_t)WebRtcSpl_SqrtFloor(endiff); /* C is in Q11 */
   } else {
     C = 1;
@@ -166,7 +165,7 @@
       /* B_W32 is in Q30 ( B = 1 - ENH_A0/2 - A * w10/w00 ) */
       scale1 = 31-bitsw10;
       scale2 = 21-scale1;
-      w10prim = WEBRTC_SPL_LSHIFT_W32(w10, scale1);
+      w10prim = w10 << scale1;
       w00prim = WEBRTC_SPL_SHIFT_W32(w00, -scale2);
       scale = bitsw00-scale2-15;
 
diff --git a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c
index a0278bb..dbecc33 100644
--- a/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c
+++ b/webrtc/modules/audio_coding/codecs/ilbc/window32_w32.c
@@ -46,11 +46,9 @@
     y_hi = (int16_t)(y[i] >> 16);
 
     /* Extract lower bytes, defined as (w32 - hi<<16)>>1 */
-    temp = WEBRTC_SPL_LSHIFT_W32((int32_t)x_hi, 16);
-    x_low = (int16_t)((x[i] - temp) >> 1);
+    x_low = (int16_t)((x[i] - (x_hi << 16)) >> 1);
 
-    temp = WEBRTC_SPL_LSHIFT_W32((int32_t)y_hi, 16);
-    y_low = (int16_t)((y[i] - temp) >> 1);
+    y_low = (int16_t)((y[i] - (y_hi << 16)) >> 1);
 
     /* Calculate z by a 32 bit multiplication using both low and high from x and y */
     temp = ((x_hi * y_hi) << 1) + ((x_hi * y_low) >> 14);