ref: 233e3172027f093be841363fc8ca5afaace6256e
parent: a56c34f3816ece0cd46338c04af97cd715da9bc0
author: Jean-Marc Valin <[email protected]>
date: Wed Mar 26 11:46:51 EDT 2008
optimisation: shaving a few cycles off prev_cwrs* by not computed the values we're not going to use.
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -181,9 +181,9 @@
_x[k]=j;
if(_s[k])_i-=t;
if (k<_m-2)
- prev_ncwrs32(nc, _n+1, 0);
+ prev_ncwrs32(nc, _n-j+1, 0);
else
- prev_ncwrs32(nc, _n+1, 1);
+ prev_ncwrs32(nc, _n-j+1, 1);
}
RESTORE_STACK;
}
@@ -210,9 +210,9 @@
celt_uint32_t pn;
celt_uint32_t p;
if (k<_m-1)
- prev_ncwrs32(nc, _n+1, 0);
+ prev_ncwrs32(nc, _n-j+1, 0);
else
- prev_ncwrs32(nc, _n+1, 1);
+ prev_ncwrs32(nc, _n-j+1, 1);
/*p=ncwrs(_n-j,_m-k-1);
pn=ncwrs(_n-j-1,_m-k-1);*/
p=nc[_n-j];
@@ -271,9 +271,9 @@
_x[k]=j;
if(_s[k])_i-=t;
if (k<_m-2)
- prev_ncwrs64(nc, _n+1, 0);
+ prev_ncwrs64(nc, _n-j+1, 0);
else
- prev_ncwrs64(nc, _n+1, 1);
+ prev_ncwrs64(nc, _n-j+1, 1);
}
RESTORE_STACK;
}
@@ -300,9 +300,9 @@
celt_uint64_t pn;
celt_uint64_t p;
if (k<_m-1)
- prev_ncwrs64(nc, _n+1, 0);
+ prev_ncwrs64(nc, _n-j+1, 0);
else
- prev_ncwrs64(nc, _n+1, 1);
+ prev_ncwrs64(nc, _n-j+1, 1);
/*p=ncwrs64(_n-j,_m-k-1);
pn=ncwrs64(_n-j-1,_m-k-1);*/
p=nc[_n-j];
--- a/libcelt/vq.c
+++ b/libcelt/vq.c
@@ -179,7 +179,7 @@
den = ROUND16(Ryy,14);
/* The idea is to check for num/den >= best_num/best_den, but that way
we can do it without any division */
- if (MULT16_32_Q15(best_den, num) >= MULT16_32_Q15(den, best_num))
+ if (MULT16_32_Q15(best_den, num) > MULT16_32_Q15(den, best_num))
{
best_den = den;
best_num = num;