Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/celt.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2010-07-28 02:09:51 +0400
committerJean-Marc Valin <jean-marc.valin@usherbrooke.ca>2010-07-28 02:20:16 +0400
commit68242ac58cca3d09b55d57f33d22144e701c923b (patch)
tree9c48651d517a6e4d10b36fb7a3f5e78e7e8836af /libcelt/cwrs.c
parent5bdb7dbafc1b07d0dcea2715f84b8096f4a95112 (diff)
Eliminate the loop when decoding the split angle.
Use a closed-form formula for the search instead. This requires an integer sqrt, so it is not actually closed-form, but the number of iterations is O(qb) instead of O(2**qb).
Diffstat (limited to 'libcelt/cwrs.c')
-rw-r--r--libcelt/cwrs.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/libcelt/cwrs.c b/libcelt/cwrs.c
index 0c07709..2d9975c 100644
--- a/libcelt/cwrs.c
+++ b/libcelt/cwrs.c
@@ -148,33 +148,6 @@ static inline celt_uint32 imusdiv32even(celt_uint32 _a,celt_uint32 _b,
(_a*(_b&mask)+one-(_c&mask)>>shift)-1)*inv&MASK32;
}
-/*Compute floor(sqrt(_val)) with exact arithmetic.
- This has been tested on all possible 32-bit inputs.*/
-static unsigned isqrt32(celt_uint32 _val){
- unsigned b;
- unsigned g;
- int bshift;
- /*Uses the second method from
- http://www.azillionmonkeys.com/qed/sqroot.html
- 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;
- b=1U<<bshift;
- do{
- celt_uint32 t;
- t=((celt_uint32)g<<1)+b<<bshift;
- if(t<=_val){
- g+=b;
- _val-=t;
- }
- b>>=1;
- bshift--;
- }
- while(bshift>=0);
- return g;
-}
-
#endif /* SMALL_FOOTPRINT */
/*Although derived separately, the pulse vector coding scheme is equivalent to