FreeCalypso > hg > gsm-codec-lib
changeset 203:1c108dd5b33f
libgsmefr/vad.c: perf opt
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 04 Jan 2023 06:04:45 +0000 |
parents | 0faf23a9286f |
children | 0494279ae379 |
files | libgsmefr/vad.c |
diffstat | 1 files changed, 43 insertions(+), 43 deletions(-) [+] |
line wrap: on
line diff
--- a/libgsmefr/vad.c Wed Jan 04 04:54:02 2023 +0000 +++ b/libgsmefr/vad.c Wed Jan 04 06:04:45 2023 +0000 @@ -377,22 +377,22 @@ /* Update the array pointers */ - if (sub (vst->pt_sacf, 18) == 0) + if (vst->pt_sacf == 18) { vst->pt_sacf = 0; } else { - vst->pt_sacf = add (vst->pt_sacf, 9); + vst->pt_sacf += 9; } - if (sub (vst->pt_sav0, 27) == 0) + if (vst->pt_sav0 == 27) { vst->pt_sav0 = 0; } else { - vst->pt_sav0 = add (vst->pt_sav0, 9); + vst->pt_sav0 += 9; } return; @@ -488,7 +488,7 @@ { test (); if ((pp[0] == 0) || - (sub (pp[0], abs_s (pp[1])) < 0)) + (pp[0] < abs_s (pp[1]))) { for (i = n; i < 8; i++) { @@ -504,7 +504,7 @@ vpar[n] = negate (vpar[n]); move16 (); } test (); - if (sub (n, 7) == 0) + if (n == 7) { return; } @@ -719,7 +719,7 @@ temp = extract_h (L_shl (L_temp, shift)); test (); - if (sub (sav0[0], temp) >= 0) + if (sav0[0] >= temp) { divshift = 0; move16 (); temp = div_s (temp, sav0[0]); @@ -732,7 +732,7 @@ } test (); - if (sub (divshift, 1) == 0) + if (divshift == 1) { L_dm = 0x8000L; move32 (); } @@ -834,17 +834,17 @@ /*** Test if acf0 < pth; if yes set thvad to plev ***/ test (); - if (sub (acf0.e, E_PTH) < 0) + if (acf0.e < E_PTH) { comp = 1; move16 (); } test (); test (); - if ((sub (acf0.e, E_PTH) == 0) && (sub (acf0.m, M_PTH) < 0)) + if ((acf0.e == E_PTH) && (acf0.m < M_PTH)) { comp = 1; move16 (); } test (); - if (sub (comp, 1) == 0) + if (comp == 1) { thvad->e = E_PLEV; move16 (); thvad->m = M_PLEV; move16 (); @@ -854,7 +854,7 @@ /*** Test if an adaption is required ***/ test (); - if (sub (ptch, 1) == 0) + if (ptch == 1) { comp = 1; move16 (); } @@ -864,12 +864,12 @@ comp = 1; move16 (); } test (); - if (sub (tone, 1) == 0) + if (tone == 1) { comp = 1; move16 (); } test (); - if (sub (comp, 1) == 0) + if (comp == 1) { vst->adaptcount = 0; return; @@ -877,7 +877,7 @@ /*** Increment adaptcount ***/ vst->adaptcount = add (vst->adaptcount, 1); - if (sub (vst->adaptcount, 8) <= 0) + if (vst->adaptcount <= 8) { return; } @@ -886,7 +886,7 @@ thvad->m = sub (thvad->m, shr (thvad->m, 5)); move16 (); test (); - if (sub (thvad->m, 0x4000) < 0) + if (thvad->m < 0x4000) { thvad->m = shl (thvad->m, 1); move16 (); thvad->e = sub (thvad->e, 1); move16 (); @@ -908,20 +908,20 @@ /*** test if thvad < pvad*fac ***/ test (); - if (sub (thvad->e, p_temp.e) < 0) + if (thvad->e < p_temp.e) { comp = 1; move16 (); } test (); test (); - if ((sub (thvad->e, p_temp.e) == 0) && - (sub (thvad->m, p_temp.m) < 0)) + if ((thvad->e == p_temp.e) && + (thvad->m < p_temp.m)) { comp = 1; move16 (); } /*** compute minimum(thvad+(thvad/inc), pvad*fac) when comp = 1 ***/ test (); - if (sub (comp, 1) == 0) + if (comp == 1) { /*** compute thvad + (thvad/inc) ***/ @@ -929,7 +929,7 @@ L_deposit_l (shr (thvad->m, 4))); test (); - if (L_sub (L_temp, 0x7fffL) > 0) + if (L_temp > 0x7fffL) { thvad->m = extract_l (L_shr (L_temp, 1)); move16 (); thvad->e = add (thvad->e, 1); move16 (); @@ -942,18 +942,18 @@ comp2 = 0; move16 (); test (); - if (sub (p_temp.e, thvad->e) < 0) + if (p_temp.e < thvad->e) { comp2 = 1; move16 (); } test (); test (); - if ((sub (p_temp.e, thvad->e) == 0) && - (sub (p_temp.m, thvad->m) < 0)) + if ((p_temp.e == thvad->e) && + (p_temp.m < thvad->m)) { comp2 = 1; move16 (); } test (); - if (sub (comp2, 1) == 0) + if (comp2 == 1) { thvad->e = p_temp.e;move16 (); thvad->m = p_temp.m;move16 (); @@ -962,7 +962,7 @@ /*** compute pvad + margin ***/ test (); - if (sub (pvad.e, E_MARGIN) == 0) + if (pvad.e == E_MARGIN) { L_temp = L_add (L_deposit_l (pvad.m), L_deposit_l (M_MARGIN)); p_temp.m = extract_l (L_shr (L_temp, 1)); move16 (); @@ -971,14 +971,14 @@ else { test (); - if (sub (pvad.e, E_MARGIN) > 0) + if (pvad.e > E_MARGIN) { temp = sub (pvad.e, E_MARGIN); temp = shr (M_MARGIN, temp); L_temp = L_add (L_deposit_l (pvad.m), L_deposit_l (temp)); test (); - if (L_sub (L_temp, 0x7fffL) > 0) + if (L_temp > 0x7fffL) { p_temp.e = add (pvad.e, 1); move16 (); p_temp.m = extract_l (L_shr (L_temp, 1)); @@ -997,7 +997,7 @@ L_temp = L_add (L_deposit_l (M_MARGIN), L_deposit_l (temp)); test (); - if (L_sub (L_temp, 0x7fffL) > 0) + if (L_temp > 0x7fffL) { p_temp.e = add (E_MARGIN, 1); move16 (); p_temp.m = extract_l (L_shr (L_temp, 1)); @@ -1016,18 +1016,18 @@ comp = 0; move16 (); test (); - if (sub (thvad->e, p_temp.e) > 0) + if (thvad->e > p_temp.e) { comp = 1; move16 (); } test (); test (); - if ((sub (thvad->e, p_temp.e) == 0) && - (sub (thvad->m, p_temp.m) > 0)) + if ((thvad->e == p_temp.e) && + (thvad->m > p_temp.m)) { comp = 1; move16 (); } test (); - if (sub (comp, 1) == 0) + if (comp == 1) { thvad->e = p_temp.e; move16 (); thvad->m = p_temp.m; move16 (); @@ -1157,12 +1157,12 @@ Word16 vvad; test (); test (); test (); - if (sub (pvad.e, thvad.e) > 0) + if (pvad.e > thvad.e) { vvad = 1; move16 (); } - else if ((sub (pvad.e, thvad.e) == 0) && - (sub (pvad.m, thvad.m) > 0)) + else if ((pvad.e == thvad.e) && + (pvad.m > thvad.m)) { vvad = 1; move16 (); } @@ -1196,23 +1196,23 @@ { struct vad_state *vst = &st->vad; - if (sub (vvad, 1) == 0) + if (vvad == 1) { - vst->burstcount = add (vst->burstcount, 1); + vst->burstcount++; } else { vst->burstcount = 0; } - if (sub (vst->burstcount, BURSTCONST) >= 0) + if (vst->burstcount >= BURSTCONST) { vst->hangcount = HANGCONST; vst->burstcount = BURSTCONST; } if (vst->hangcount >= 0) { - vst->hangcount = sub (vst->hangcount, 1); + vst->hangcount--; return 1; /* vad = 1 */ } return vvad; /* vad = vvad */ @@ -1250,7 +1250,7 @@ { /*** Search the maximum and minimum of consecutive lags ***/ - if (sub (vst->oldlag, lags[i]) > 0) + if (vst->oldlag > lags[i]) { minlag = lags[i]; maxlag = vst->oldlag; @@ -1263,7 +1263,7 @@ temp = sub (maxlag, minlag); - if (sub (temp, LTHRESH) < 0) + if (temp < LTHRESH) { lagcount = add (lagcount, 1); } @@ -1281,7 +1281,7 @@ temp = add (vst->oldlagcount, vst->veryoldlagcount); - if (sub (temp, NTHRESH) >= 0) + if (temp >= NTHRESH) { st->ptch = 1; }