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

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy B. Terriberry <tterribe@xiph.org>2013-06-15 10:01:03 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2013-06-15 10:01:03 +0400
commit63f744d583938830e4b2860eacc8047ce022c5ec (patch)
treecba557e926259d13c064d256cbd25903e96baa26
parent533dbe705ba546774cb48f4989fae61309963eb6 (diff)
Further speedup in cwrsi() by using the special case for n=2
-rw-r--r--celt/cwrs.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/celt/cwrs.c b/celt/cwrs.c
index dc0257c4..d384dfe2 100644
--- a/celt/cwrs.c
+++ b/celt/cwrs.c
@@ -461,12 +461,12 @@ void encode_pulses(const int *_y,int _n,int _k,ec_enc *_enc){
}
static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y){
- int s;
+ opus_uint32 p;
+ int s;
+ int k0;
celt_assert(_k>0);
celt_assert(_n>1);
- do{
- opus_uint32 p;
- int k0;
+ while(_n>2){
/*Are the pulses in this dimension negative?*/
p=CELT_PVQ_U(_n,_k+1);
s=-(_i>=p);
@@ -495,9 +495,18 @@ static void cwrsi(int _n,int _k,opus_uint32 _i,int *_y){
for(;p>_i;p=CELT_PVQ_U_ROW[_k][_n])_k--;
_i-=p;
*_y++=(k0-_k+s)^s;
+ _n--;
}
- while(--_n>1);
- s=-(_i>=1);
+ /*_n==2*/
+ p=2*_k+1;
+ s=-(_i>=p);
+ _i-=p&s;
+ k0=_k;
+ _k=(_i+1)>>1;
+ if(_k)_i-=2*_k-1;
+ *_y++=(k0-_k+s)^s;
+ /*_n==1*/
+ s=-_i;
*_y=(_k+s)^s;
}