shithub: sox

Download patch

ref: c3dcb0de857332a0104069d5ca8344a3599a871f
parent: c86e649b0b53d78afe9ea808a0d793306f36fc3f
author: rrt <rrt>
date: Sun Apr 15 12:39:46 EDT 2007

Rename round to roundL to avoid clashing with the standard math.h
function. math.h is not used here, but it is in src/amr-wb.c, where we
only got away with the cpp trick because of weirdness in the way that
round is declared on the systems we were building on. This broke the
build on mingw's rather more straightforward header files:

#define round AMR_WB_round
#include <math.h>

is obviously going, without weirdness, to try to redeclare
AMR_WB_round when it gets to the declaration of round.

I suppose we could've simply #included <math.h> first, but best to
avoid the name clash.

--- a/amr-wb/acelp.h
+++ b/amr-wb/acelp.h
@@ -459,7 +459,7 @@
 void Scale_sig(
      Word16 x[],                           /* (i/o) : signal to scale               */
      Word16 lg,                            /* (i)   : size of x[]                   */
-     Word16 exp                            /* (i)   : exponent: x = round(x << exp) */
+     Word16 exp                            /* (i)   : exponent: x = roundL(x << exp) */
 );
 
 void snr(Word16 x[], Word16 y[], Word16 l, Word16 Q_x);
--- a/amr-wb/agc2.c
+++ b/amr-wb/agc2.c
@@ -43,7 +43,7 @@
         return;
     }
     exp = sub(norm_l(s), 1);
-    gain_out = round(L_shl(s, exp));
+    gain_out = roundL(L_shl(s, exp));
 
     /* calculate gain_in with exponent */
 
@@ -63,7 +63,7 @@
     } else
     {
         i = norm_l(s);
-        gain_in = round(L_shl(s, i));
+        gain_in = roundL(L_shl(s, i));
         exp = sub(exp, i);
 
         /*---------------------------------------------------*
@@ -75,7 +75,7 @@
         s = L_shr(s, exp);                 /* add exponent */
 
         s = Isqrt(s);
-        g0 = round(L_shl(s, 9));
+        g0 = roundL(L_shl(s, 9));
     }
     /* sig_out(n) = gain(n) sig_out(n) */
 
--- a/amr-wb/az_isp.c
+++ b/amr-wb/az_isp.c
@@ -72,8 +72,8 @@
     for (i = 0; i < NC; i++)
     {
         t0 = L_mult(a[i], 16384);
-        f1[i] = round(L_mac(t0, a[M - i], 16384));      move16();  /* =(a[i]+a[M-i])/2 */
-        f2[i] = round(L_msu(t0, a[M - i], 16384));      move16();  /* =(a[i]-a[M-i])/2 */
+        f1[i] = roundL(L_mac(t0, a[M - i], 16384));      move16();  /* =(a[i]+a[M-i])/2 */
+        f2[i] = roundL(L_msu(t0, a[M - i], 16384));      move16();  /* =(a[i]-a[M-i])/2 */
     }
     f1[NC] = a[NC];                        move16();
 
--- a/amr-wb/basic_op.h
+++ b/amr-wb/basic_op.h
@@ -1,4 +1,3 @@
-#define round AMR_WB_round
 /*___________________________________________________________________________
  |                                                                           |
  |   Constants and Globals                                                   |
@@ -32,7 +31,7 @@
 Word16 negate (Word16 var1);              /* Short negate,        1   */
 Word16 extract_h (Word32 L_var1);         /* Extract high,        1   */
 Word16 extract_l (Word32 L_var1);         /* Extract low,         1   */
-Word16 round (Word32 L_var1);             /* Round,               1   */
+Word16 roundL (Word32 L_var1);             /* Round,               1   */
 Word32 L_mac (Word32 L_var3, Word16 var1, Word16 var2);   /* Mac,  1  */
 Word32 L_msu (Word32 L_var3, Word16 var1, Word16 var2);   /* Msu,  1  */
 Word32 L_macNs (Word32 L_var3, Word16 var1, Word16 var2); /* Mac without
--- a/amr-wb/basicop2.c
+++ b/amr-wb/basicop2.c
@@ -570,7 +570,7 @@
  |   Round the lower 16 bits of the 32 bit input number into the MS 16 bits  |
  |   with saturation. Shift the resulting bits right by 16 and return the 16 |
  |   bit number:                                                             |
- |               round(L_var1) = extract_h(L_add(L_var1,32768))              |
+ |               roundL(L_var1) = extract_h(L_add(L_var1,32768))              |
  |                                                                           |
  |   Complexity weight : 1                                                   |
  |                                                                           |
@@ -592,7 +592,7 @@
  |___________________________________________________________________________|
 */
 
-Word16 round (Word32 L_var1)
+Word16 roundL (Word32 L_var1)
 {
     Word16 var_out;
     Word32 L_rounded;
@@ -1474,7 +1474,7 @@
  |   result to L_var3 with saturation. Round the LS 16 bits of the result    |
  |   into the MS 16 bits with saturation and shift the result right by 16.   |
  |   Return a 16 bit result.                                                 |
- |            mac_r(L_var3,var1,var2) = round(L_mac(L_var3,var1,var2))       |
+ |            mac_r(L_var3,var1,var2) = roundL(L_mac(L_var3,var1,var2))       |
  |                                                                           |
  |   Complexity weight : 2                                                   |
  |                                                                           |
@@ -1533,7 +1533,7 @@
  |   bit result to L_var3 with saturation. Round the LS 16 bits of the res-  |
  |   ult into the MS 16 bits with saturation and shift the result right by   |
  |   16. Return a 16 bit result.                                             |
- |            msu_r(L_var3,var1,var2) = round(L_msu(L_var3,var1,var2))       |
+ |            msu_r(L_var3,var1,var2) = roundL(L_msu(L_var3,var1,var2))       |
  |                                                                           |
  |   Complexity weight : 2                                                   |
  |                                                                           |
--- a/amr-wb/c2t64fx.c
+++ b/amr-wb/c2t64fx.c
@@ -64,12 +64,12 @@
     s = Dot_product12(cn, cn, L_SUBFR, &exp);
     Isqrt_n(&s, &exp);
     s = L_shl(s, add(exp, 5));             /* saturation can occur here */
-    k_cn = round(s);
+    k_cn = roundL(s);
 
     /* set k_dn = 32..512 (ener_dn = 2^30..2^22) */
     s = Dot_product12(dn, dn, L_SUBFR, &exp);
     Isqrt_n(&s, &exp);
-    k_dn = round(L_shl(s, add(exp, 5 + 3)));    /* k_dn = 256..4096 */
+    k_dn = roundL(L_shl(s, add(exp, 5 + 3)));    /* k_dn = 256..4096 */
     k_dn = mult_r(alp, k_dn);              /* alp in Q12 */
 
     /* mix normalized cn[] and dn[] */
--- a/amr-wb/c4t64fx.c
+++ b/amr-wb/c4t64fx.c
@@ -210,12 +210,12 @@
     s = Dot_product12(cn, cn, L_SUBFR, &exp);
     Isqrt_n(&s, &exp);
     s = L_shl(s, add(exp, 5));             /* saturation can occur here */
-    k_cn = round(s);
+    k_cn = roundL(s);
 
     /* set k_dn = 32..512 (ener_dn = 2^30..2^22) */
     s = Dot_product12(dn, dn, L_SUBFR, &exp);
     Isqrt_n(&s, &exp);
-    k_dn = round(L_shl(s, add(exp, 5 + 3)));    /* k_dn = 256..4096 */
+    k_dn = roundL(L_shl(s, add(exp, 5 + 3)));    /* k_dn = 256..4096 */
     k_dn = mult_r(alp, k_dn);              /* alp in Q12 */
 
     /* mix normalized cn[] and dn[] */
@@ -528,7 +528,7 @@
             s = L_mac(s, rrixix[ipos[1]][j], 4096);
             i = add(shl(i, 4), j);         /* (ix/STEP)*NB_POS + (iy/STEP) */
             s = L_mac(s, rrixiy[ipos[0]][i], 8192);
-            alp = round(s);
+            alp = roundL(s);
             test();move16();move16();
             if (sign[ix] < 0)
                 p0 = h_inv - ix;
@@ -593,7 +593,7 @@
             for (i = 0; i < L_SUBFR; i++)
                 L_tmp = L_mac(L_tmp, vec[i], vec[i]);
 
-            alp = round(L_shr(L_tmp, 3));
+            alp = roundL(L_shr(L_tmp, 3));
 
             if (sub(nbbits, 72) == 0)
             {
@@ -813,7 +813,7 @@
 
         L_sum = L_shl(L_sum, 1);
 
-        corr = round(L_sum);
+        corr = roundL(L_sum);
 
         cor[i] = add(mult(corr, sign[pos]), *p0++);     move16();
 
--- a/amr-wb/cod_main.c
+++ b/amr-wb/cod_main.c
@@ -399,13 +399,13 @@
         L_tmp = L_mult(new_speech[i], 16384);
         L_tmp = L_msu(L_tmp, new_speech[i - 1], mu);
         L_tmp = L_shl(L_tmp, Q_new);
-        new_speech[i] = round(L_tmp);      move16();
+        new_speech[i] = roundL(L_tmp);      move16();
     }
 
     L_tmp = L_mult(new_speech[0], 16384);
     L_tmp = L_msu(L_tmp, st->mem_preemph, mu);
     L_tmp = L_shl(L_tmp, Q_new);
-    new_speech[0] = round(L_tmp);          move16();
+    new_speech[0] = roundL(L_tmp);          move16();
 
     st->mem_preemph = tmp;                 move16();
 
@@ -870,7 +870,7 @@
             for (j = 1; j <= M; j++)
                 L_tmp = L_msu(L_tmp, p_Aq[j], error[i + M - j]);
 
-            h1[i] = error[i + M] = round(L_shl(L_tmp, 3));      move16();move16();
+            h1[i] = error[i + M] = roundL(L_shl(L_tmp, 3));      move16();move16();
         }
         /* deemph without division by 2 -> Q14 to Q15 */
         tmp = 0;                           move16();
@@ -1057,7 +1057,7 @@
             L_tmp = L_mult(5898, exc[i - 1 + i_subfr]);
             L_tmp = L_mac(L_tmp, 20972, exc[i + i_subfr]);
             L_tmp = L_mac(L_tmp, 5898, exc[i + 1 + i_subfr]);
-            code[i] = round(L_tmp);        move16();
+            code[i] = roundL(L_tmp);        move16();
         }
 
         Convolve(code, h1, y2, L_SUBFR);
@@ -1242,7 +1242,7 @@
         Gp_clip_test_gain_pit(gain_pit, st->gp_clip);
 
         L_tmp = L_shl(L_gain_code, Q_new); /* saturation can occur here */
-        gain_code = round(L_tmp);          /* scaled gain_code with Qnew */
+        gain_code = roundL(L_tmp);          /* scaled gain_code with Qnew */
 
         /*----------------------------------------------------------*
          * Update parameters for the next subframe.                 *
@@ -1274,7 +1274,7 @@
         L_tmp = L_mac(L_tmp, xn[L_SUBFR - 1], 16384);
         L_tmp = L_msu(L_tmp, y1[L_SUBFR - 1], gain_pit);
         L_tmp = L_shl(L_tmp, sub(1, shift));
-        st->mem_w0 = round(L_tmp);         move16();
+        st->mem_w0 = roundL(L_tmp);         move16();
 
         if (sub(*ser_size, NBBITS_24k) >= 0)
             Copy(&exc[i_subfr], exc2, L_SUBFR);
@@ -1286,7 +1286,7 @@
             L_tmp = L_shl(L_tmp, 5);
             L_tmp = L_mac(L_tmp, exc[i + i_subfr], gain_pit);
             L_tmp = L_shl(L_tmp, 1);       /* saturation can occur here */
-            exc[i + i_subfr] = round(L_tmp);    move16();
+            exc[i + i_subfr] = roundL(L_tmp);    move16();
         }
 
         Syn_filt(p_Aq, M, &exc[i_subfr], synth, L_SUBFR, st->mem_syn, 1);
@@ -1349,7 +1349,7 @@
 
             L_tmp = L_deposit_h(code[0]);
             L_tmp = L_msu(L_tmp, code[1], tmp);
-            code2[0] = round(L_tmp);       move16();
+            code2[0] = roundL(L_tmp);       move16();
 
             for (i = 1; i < L_SUBFR - 1; i++)
             {
@@ -1356,16 +1356,16 @@
                 L_tmp = L_deposit_h(code[i]);
                 L_tmp = L_msu(L_tmp, code[i + 1], tmp);
                 L_tmp = L_msu(L_tmp, code[i - 1], tmp);
-                code2[i] = round(L_tmp);   move16();
+                code2[i] = roundL(L_tmp);   move16();
             }
 
             L_tmp = L_deposit_h(code[L_SUBFR - 1]);
             L_tmp = L_msu(L_tmp, code[L_SUBFR - 2], tmp);
-            code2[L_SUBFR - 1] = round(L_tmp);  move16();
+            code2[L_SUBFR - 1] = roundL(L_tmp);  move16();
 
             /* build excitation */
 
-            gain_code = round(L_shl(L_gain_code, Q_new));
+            gain_code = roundL(L_shl(L_gain_code, Q_new));
 
             for (i = 0; i < L_SUBFR; i++)
             {
@@ -1373,7 +1373,7 @@
                 L_tmp = L_shl(L_tmp, 5);
                 L_tmp = L_mac(L_tmp, exc2[i], gain_pit);
                 L_tmp = L_shl(L_tmp, 1);   /* saturation can occur here */
-                exc2[i] = round(L_tmp);    move16();
+                exc2[i] = roundL(L_tmp);    move16();
             }
 
             corr_gain = synthesis(p_Aq, exc2, Q_new, &speech16k[i_subfr * 5 / 4], st);
--- a/amr-wb/convolve.c
+++ b/amr-wb/convolve.c
@@ -27,7 +27,7 @@
         for (i = 0; i <= n; i++)
             L_sum = L_mac(L_sum, x[i], h[n - i]);
 
-        y[n] = round(L_sum);               move16();
+        y[n] = roundL(L_sum);               move16();
     }
 
     return;
--- a/amr-wb/cor_h_x.c
+++ b/amr-wb/cor_h_x.c
@@ -60,7 +60,7 @@
 
     for (i = 0; i < L_SUBFR; i++)
     {
-        dn[i] = round(L_shl(y32[i], j));   move16();
+        dn[i] = roundL(L_shl(y32[i], j));   move16();
     }
 
     return;
--- a/amr-wb/d_gain2.c
+++ b/amr-wb/d_gain2.c
@@ -239,7 +239,7 @@
         }
     }
     /* keep past gain code in Q3 for frame erasure (can saturate) */
-    *past_gain_code = round(L_shl(*gain_cod, 3));       move16();
+    *past_gain_code = roundL(L_shl(*gain_cod, 3));       move16();
     *past_gain_pit = *gain_pit;            move16();
 
     *prev_gc = *past_gain_code;            move16();
--- a/amr-wb/dec_main.c
+++ b/amr-wb/dec_main.c
@@ -330,7 +330,7 @@
             {
                 L_tmp = L_mult(isf_tmp[i], sub(32767, interpol_frac[j]));
                 L_tmp = L_mac(L_tmp, isf[i], interpol_frac[j]);
-                HfIsf[i] = round(L_tmp);   move16();
+                HfIsf[i] = roundL(L_tmp);   move16();
             }
             synthesis(Aq, &exc2[i_subfr], 0, &synth16k[i_subfr * 5 / 4], (short) 1, HfIsf, nb_bits, newDTXState, st, bfi);
         }
@@ -554,7 +554,7 @@
                 L_tmp = L_mult(5898, exc[i - 1 + i_subfr]);
                 L_tmp = L_mac(L_tmp, 20972, exc[i + i_subfr]);
                 L_tmp = L_mac(L_tmp, 5898, exc[i + 1 + i_subfr]);
-                code[i] = round(L_tmp);    move16();
+                code[i] = roundL(L_tmp);    move16();
             }
             Copy(code, &exc[i_subfr], L_SUBFR);
         }
@@ -692,7 +692,7 @@
             Q_new = add(Q_new, 1);
             test();test();
         }
-        gain_code = round(L_tmp);          /* scaled gain_code with Qnew */
+        gain_code = roundL(L_tmp);          /* scaled gain_code with Qnew */
 
         Scale_sig(exc + i_subfr - (PIT_MAX + L_INTERPOL),
             PIT_MAX + L_INTERPOL + L_SUBFR, sub(Q_new, st->Q_old));
@@ -735,7 +735,7 @@
                     tmp = mult(exc2[i], pit_sharp);
                     L_tmp = L_mult(tmp, gain_pit);
                     L_tmp = L_shr(L_tmp, 1);
-                    excp[i] = round(L_tmp);
+                    excp[i] = roundL(L_tmp);
                     move16();
                 }
             }
@@ -763,7 +763,7 @@
             L_tmp = L_shl(L_tmp, 5);
             L_tmp = L_mac(L_tmp, exc[i + i_subfr], gain_pit);
             L_tmp = L_shl(L_tmp, 1);
-            exc[i + i_subfr] = round(L_tmp);    move16();
+            exc[i + i_subfr] = roundL(L_tmp);    move16();
         }
 
         /* find maximum value of excitation for next scaling */
@@ -852,7 +852,7 @@
 
         L_tmp = L_deposit_h(code[0]);
         L_tmp = L_msu(L_tmp, code[1], tmp);
-        code2[0] = round(L_tmp);
+        code2[0] = roundL(L_tmp);
         move16();
 
         for (i = 1; i < L_SUBFR - 1; i++)
@@ -860,18 +860,18 @@
             L_tmp = L_deposit_h(code[i]);
             L_tmp = L_msu(L_tmp, code[i + 1], tmp);
             L_tmp = L_msu(L_tmp, code[i - 1], tmp);
-            code2[i] = round(L_tmp);
+            code2[i] = roundL(L_tmp);
             move16();
         }
 
         L_tmp = L_deposit_h(code[L_SUBFR - 1]);
         L_tmp = L_msu(L_tmp, code[L_SUBFR - 2], tmp);
-        code2[L_SUBFR - 1] = round(L_tmp);
+        code2[L_SUBFR - 1] = roundL(L_tmp);
         move16();
 
         /* build excitation */
 
-        gain_code = round(L_shl(L_gain_code, Q_new));
+        gain_code = roundL(L_shl(L_gain_code, Q_new));
 
         for (i = 0; i < L_SUBFR; i++)
         {
@@ -879,7 +879,7 @@
             L_tmp = L_shl(L_tmp, 5);
             L_tmp = L_mac(L_tmp, exc2[i], gain_pit);
             L_tmp = L_shl(L_tmp, 1);       /* saturation can occur here */
-            exc2[i] = round(L_tmp);
+            exc2[i] = roundL(L_tmp);
             move16();
         }
 
@@ -903,7 +903,7 @@
             {
                 L_tmp = L_mult(isf_tmp[i], sub(32767, interpol_frac[j]));
                 L_tmp = L_mac(L_tmp, isf[i], interpol_frac[j]);
-                HfIsf[i] = round(L_tmp);
+                HfIsf[i] = roundL(L_tmp);
             }
         } else
         {
--- a/amr-wb/decim54.c
+++ b/amr-wb/decim54.c
@@ -239,5 +239,5 @@
     }
     L_sum = L_shl(L_sum, 1);               /* saturation can occur here */
 
-    return (round(L_sum));
+    return (roundL(L_sum));
 }
--- a/amr-wb/deemph.c
+++ b/amr-wb/deemph.c
@@ -26,13 +26,13 @@
 
     L_tmp = L_deposit_h(x[0]);
     L_tmp = L_mac(L_tmp, *mem, mu);
-    x[0] = round(L_tmp);                   move16();
+    x[0] = roundL(L_tmp);                   move16();
 
     for (i = 1; i < L; i++)
     {
         L_tmp = L_deposit_h(x[i]);
         L_tmp = L_mac(L_tmp, x[i - 1], mu);
-        x[i] = round(L_tmp);               move16();
+        x[i] = roundL(L_tmp);               move16();
     }
 
     *mem = x[L - 1];                       move16();
@@ -55,13 +55,13 @@
 
     L_tmp = L_mult(x[0], 16384);
     L_tmp = L_mac(L_tmp, *mem, mu);
-    x[0] = round(L_tmp);                   move16();
+    x[0] = roundL(L_tmp);                   move16();
 
     for (i = 1; i < L; i++)
     {
         L_tmp = L_mult(x[i], 16384);
         L_tmp = L_mac(L_tmp, x[i - 1], mu);
-        x[i] = round(L_tmp);               move16();
+        x[i] = roundL(L_tmp);               move16();
     }
 
     *mem = x[L - 1];                       move16();
@@ -91,7 +91,7 @@
     L_tmp = L_shl(L_tmp, 3);
     L_tmp = L_mac(L_tmp, *mem, fac);
     L_tmp = L_shl(L_tmp, 1);               /* saturation can occur here */
-    y[0] = round(L_tmp);                   move16();
+    y[0] = roundL(L_tmp);                   move16();
 
     for (i = 1; i < L; i++)
     {
@@ -100,7 +100,7 @@
         L_tmp = L_shl(L_tmp, 3);
         L_tmp = L_mac(L_tmp, y[i - 1], fac);
         L_tmp = L_shl(L_tmp, 1);           /* saturation can occur here */
-        y[i] = round(L_tmp);               move16();
+        y[i] = roundL(L_tmp);               move16();
     }
 
     *mem = y[L - 1];                       move16();
--- a/amr-wb/dtx.c
+++ b/amr-wb/dtx.c
@@ -1152,7 +1152,7 @@
     tmp = norm_l(summax);
     summax = L_shl(summax, tmp);
     summin = L_shl(summin, tmp);
-    L_tmp = L_mult(round(summax), INV_MED_THRESH);
+    L_tmp = L_mult(roundL(summax), INV_MED_THRESH);
     test();
     if (L_sub(L_tmp, summin) <= 0)
     {
@@ -1162,7 +1162,7 @@
     /* minimum distance then the median ISF vector replacement is    */
     /* not performed                                                 */
     summax2nd = L_shl(summax2nd, tmp);
-    L_tmp = L_mult(round(summax2nd), INV_MED_THRESH);
+    L_tmp = L_mult(roundL(summax2nd), INV_MED_THRESH);
     test();
     if (L_sub(L_tmp, summin) <= 0)
     {
--- a/amr-wb/hp400.c
+++ b/amr-wb/hp400.c
@@ -84,7 +84,7 @@
         L_Extract(L_tmp, &y1_hi, &y1_lo);
 
         /* signal is divided by 16 to avoid overflow in energy computation */
-        signal[i] = round(L_tmp);          move16();
+        signal[i] = roundL(L_tmp);          move16();
     }
 
     mem[0] = y2_hi;                        move16();
--- a/amr-wb/hp50.c
+++ b/amr-wb/hp50.c
@@ -83,7 +83,7 @@
         L_Extract(L_tmp, &y1_hi, &y1_lo);
 
         L_tmp = L_shl(L_tmp, 1);           /* coeff Q14 --> Q15 with saturation */
-        signal[i] = round(L_tmp);          move16();
+        signal[i] = roundL(L_tmp);          move16();
     }
 
     mem[0] = y2_hi;                        move16();
--- a/amr-wb/hp6k.c
+++ b/amr-wb/hp6k.c
@@ -57,7 +57,7 @@
         L_tmp = 0;                         move32();
         for (j = 0; j < L_FIR; j++)
             L_tmp = L_mac(L_tmp, x[i + j], fir_6k_7k[j]);
-        signal[i] = round(L_tmp);          move16();
+        signal[i] = roundL(L_tmp);          move16();
     }
 
     Copy(x + lg, mem, L_FIR - 1);
--- a/amr-wb/hp7k.c
+++ b/amr-wb/hp7k.c
@@ -54,7 +54,7 @@
         L_tmp = 0;                         move32();
         for (j = 0; j < L_FIR; j++)
             L_tmp = L_mac(L_tmp, x[i + j], fir_7k[j]);
-        signal[i] = round(L_tmp);          move16();
+        signal[i] = roundL(L_tmp);          move16();
     }
 
     Copy(x + lg, mem, L_FIR - 1);
--- a/amr-wb/hp_wsp.c
+++ b/amr-wb/hp_wsp.c
@@ -60,7 +60,7 @@
     {
         L_tmp = L_deposit_h(mem[i]);       /* x[i] */
         L_tmp = L_shl(L_tmp, exp);
-        mem[i] = round(L_tmp);             move16();
+        mem[i] = roundL(L_tmp);             move16();
     }
 
     return;
@@ -122,7 +122,7 @@
         L_Extract(L_tmp, &y1_hi, &y1_lo);
 
         L_tmp = L_shl(L_tmp, 1);           /* coeff Q14 --> Q15 */
-        hp_wsp[i] = round(L_tmp);          move16();
+        hp_wsp[i] = roundL(L_tmp);          move16();
     }
 
     mem[0] = y3_hi;                        move16();
--- a/amr-wb/int_lpc.c
+++ b/amr-wb/int_lpc.c
@@ -33,7 +33,7 @@
         {
             L_tmp = L_mult(isp_old[i], fac_old);
             L_tmp = L_mac(L_tmp, isp_new[i], fac_new);
-            isp[i] = round(L_tmp);         move16();
+            isp[i] = roundL(L_tmp);         move16();
         }
         Isp_Az(isp, Az, M, 0);
         Az += MP1;
--- a/amr-wb/isfextrp.c
+++ b/amr-wb/isfextrp.c
@@ -35,7 +35,7 @@
     /* Mean of difference vector */
     for (i = 3; i < (M - 1); i++)
         L_tmp = L_mac(L_tmp, IsfDiff[i - 1], INV_LENGTH);
-    mean = round(L_tmp);
+    mean = roundL(L_tmp);
 
     IsfCorr[0] = 0;                        move32();
     IsfCorr[1] = 0;                        move32();
--- a/amr-wb/isp_isf.c
+++ b/amr-wb/isp_isf.c
@@ -41,7 +41,7 @@
         /* acos(isp[i])= ind*128 + ( ( isp[i]-table[ind] ) * slope[ind] )/2048 */
 
         L_tmp = L_mult(sub(isp[i], table[ind]), slope[ind]);
-        isf[i] = round(L_shl(L_tmp, 4));   /* (isp[i]-table[ind])*slope[ind])>>11 */
+        isf[i] = roundL(L_shl(L_tmp, 4));   /* (isp[i]-table[ind])*slope[ind])>>11 */
         move16();
         isf[i] = add(isf[i], shl(ind, 7)); move16();
     }
--- a/amr-wb/levinson.c
+++ b/amr-wb/levinson.c
@@ -223,7 +223,7 @@
     for (i = 1; i <= M; i++)
     {
         t0 = L_Comp(Ah[i], Al[i]);
-        old_A[i - 1] = A[i] = round(L_shl(t0, 1));      move16();move16();
+        old_A[i - 1] = A[i] = roundL(L_shl(t0, 1));      move16();move16();
     }
     old_rc[0] = rc[0];                     move16();
     old_rc[1] = rc[1];                     move16();
--- a/amr-wb/lp_dec2.c
+++ b/amr-wb/lp_dec2.c
@@ -52,7 +52,7 @@
         for (k = 0; k < L_FIR; k++)
             L_tmp = L_mac(L_tmp, *p_x++, h_fir[k]);
 
-        x[j] = round(L_tmp);               move16();
+        x[j] = roundL(L_tmp);               move16();
     }
 
     return;
--- a/amr-wb/p_med_ol.c
+++ b/amr-wb/p_med_ol.c
@@ -103,7 +103,7 @@
     R2 = L_shl(R2, exp_R2);
 
 
-    R1 = L_mult(round(R1), round(R2));
+    R1 = L_mult(roundL(R1), roundL(R2));
 
     i = norm_l(R1);
     R1 = L_shl(R1, i);
@@ -114,11 +114,11 @@
 
     Isqrt_n(&R1, &exp_R1);
 
-    R0 = L_mult(round(R0), round(R1));
+    R0 = L_mult(roundL(R0), roundL(R1));
     exp_R0 = sub(31, exp_R0);
     exp_R0 = add(exp_R0, exp_R1);
 
-    *gain = round(L_shl(R0, exp_R0));
+    *gain = roundL(L_shl(R0, exp_R0));
     move16();
 
     /* Shitf hp_wsp[] for next frame */
--- a/amr-wb/pit_shrp.c
+++ b/amr-wb/pit_shrp.c
@@ -23,7 +23,7 @@
     {
         L_tmp = L_deposit_h(x[i]);
         L_tmp = L_mac(L_tmp, x[i - pit_lag], sharp);
-        x[i] = round(L_tmp);
+        x[i] = roundL(L_tmp);
         move16();
     }
 
--- a/amr-wb/pitch_f4.c
+++ b/amr-wb/pitch_f4.c
@@ -215,7 +215,7 @@
         L_tmp = L_mult(corr, norm);
         L_tmp = L_shl(L_tmp, add(add(exp_corr, exp_norm), scale));
 
-        corr_norm[t] = round(L_tmp);       move16();
+        corr_norm[t] = roundL(L_tmp);       move16();
 
         /* modify the filtered excitation excf[] for the next iteration */
 
@@ -289,7 +289,7 @@
         L_sum = L_mac(L_sum, x[i], inter4_1[k]);
     }
 
-    sum = round(L_shl(L_sum, 1));
+    sum = roundL(L_shl(L_sum, 1));
 
     return (sum);
 }
--- a/amr-wb/pred_lt4.c
+++ b/amr-wb/pred_lt4.c
@@ -108,7 +108,7 @@
         }
         L_sum = L_shl(L_sum, 1);
 
-        exc[j] = round(L_sum);
+        exc[j] = roundL(L_sum);
         move16();
         x++;
     }
--- a/amr-wb/preemph.c
+++ b/amr-wb/preemph.c
@@ -28,12 +28,12 @@
     {
         L_tmp = L_deposit_h(x[i]);
         L_tmp = L_msu(L_tmp, x[i - 1], mu);
-        x[i] = round(L_tmp);               move16();
+        x[i] = roundL(L_tmp);               move16();
     }
 
     L_tmp = L_deposit_h(x[0]);
     L_tmp = L_msu(L_tmp, *mem, mu);
-    x[0] = round(L_tmp);                   move16();
+    x[0] = roundL(L_tmp);                   move16();
 
     *mem = temp;                           move16();
 
@@ -58,13 +58,13 @@
         L_tmp = L_deposit_h(x[i]);
         L_tmp = L_msu(L_tmp, x[i - 1], mu);
         L_tmp = L_shl(L_tmp, 1);
-        x[i] = round(L_tmp);               move16();
+        x[i] = roundL(L_tmp);               move16();
     }
 
     L_tmp = L_deposit_h(x[0]);
     L_tmp = L_msu(L_tmp, *mem, mu);
     L_tmp = L_shl(L_tmp, 1);
-    x[0] = round(L_tmp);                   move16();
+    x[0] = roundL(L_tmp);                   move16();
 
     *mem = temp;                           move16();
 
--- a/amr-wb/qpisf_2s.c
+++ b/amr-wb/qpisf_2s.c
@@ -298,7 +298,7 @@
             {
                 L_tmp = L_mac(L_tmp, isf_buf[j * M + i], 8192);
             }
-            ref_isf[i] = round(L_tmp);     move16();
+            ref_isf[i] = roundL(L_tmp);     move16();
         }
 
         /* use the past ISFs slightly shifted towards their mean */
@@ -397,7 +397,7 @@
                 L_tmp = L_mac(L_tmp, isf_buf[j * M + i], 8192);
             }
 
-            ref_isf[i] = round(L_tmp);     move16();
+            ref_isf[i] = roundL(L_tmp);     move16();
         }
 
         /* use the past ISFs slightly shifted towards their mean */
--- a/amr-wb/residu.c
+++ b/amr-wb/residu.c
@@ -29,7 +29,7 @@
             s = L_mac(s, a[j], x[i - j]);
 
         s = L_shl(s, 3 + 1);               /* saturation can occur here */
-        y[i] = round(s);                   move16();
+        y[i] = roundL(s);                   move16();
     }
 
     return;
--- a/amr-wb/scale.c
+++ b/amr-wb/scale.c
@@ -13,7 +13,7 @@
 void Scale_sig(
      Word16 x[],                           /* (i/o) : signal to scale               */
      Word16 lg,                            /* (i)   : size of x[]                   */
-     Word16 exp                            /* (i)   : exponent: x = round(x << exp) */
+     Word16 exp                            /* (i)   : exponent: x = roundL(x << exp) */
 )
 {
     Word16 i;
@@ -23,7 +23,7 @@
     {
         L_tmp = L_deposit_h(x[i]);
         L_tmp = L_shl(L_tmp, exp);         /* saturation can occur here */
-        x[i] = round(L_tmp);               move16();
+        x[i] = roundL(L_tmp);               move16();
     }
 
     return;
--- a/amr-wb/syn_filt.c
+++ b/amr-wb/syn_filt.c
@@ -48,7 +48,7 @@
 
         L_tmp = L_shl(L_tmp, add(3, s));
 
-        y[i] = yy[i] = round(L_tmp);       move16();move16();
+        y[i] = yy[i] = roundL(L_tmp);       move16();move16();
     }
 
     /* Update memory if required */
--- a/amr-wb/typedefs.h
+++ b/amr-wb/typedefs.h
@@ -164,7 +164,7 @@
 #define SUN
 #define PLATFORM "SUN"
 #undef LSBFIRST
-#elif defined(linux) && (defined(i386) || defined(__amd64__))
+#elif defined(linux) && (defined(i386) || defined(__amd64__)) || defined(__MINGW32__)
 #define PC
 #define PLATFORM "PC"
 #define LSBFIRST
--- a/amr-wb/weight_a.c
+++ b/amr-wb/weight_a.c
@@ -23,10 +23,10 @@
     fac = gamma;                           move16();
     for (i = 1; i < m; i++)
     {
-        ap[i] = round(L_mult(a[i], fac));  move16();
-        fac = round(L_mult(fac, gamma));
+        ap[i] = roundL(L_mult(a[i], fac));  move16();
+        fac = roundL(L_mult(fac, gamma));
     }
-    ap[m] = round(L_mult(a[m], fac));      move16();
+    ap[m] = roundL(L_mult(a[m], fac));      move16();
 
     return;
 }