summaryrefslogtreecommitdiff
path: root/celt/entdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'celt/entdec.c')
-rw-r--r--celt/entdec.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/celt/entdec.c b/celt/entdec.c
index 0b3433ed..027aa24b 100644
--- a/celt/entdec.c
+++ b/celt/entdec.c
@@ -195,6 +195,27 @@ int ec_dec_icdf(ec_dec *_this,const unsigned char *_icdf,unsigned _ftb){
return ret;
}
+int ec_dec_icdf16(ec_dec *_this,const opus_uint16 *_icdf,unsigned _ftb){
+ opus_uint32 r;
+ opus_uint32 d;
+ opus_uint32 s;
+ opus_uint32 t;
+ int ret;
+ s=_this->rng;
+ d=_this->val;
+ r=s>>_ftb;
+ ret=-1;
+ do{
+ t=s;
+ s=IMUL32(r,_icdf[++ret]);
+ }
+ while(d<s);
+ _this->val=d-s;
+ _this->rng=t-s;
+ ec_dec_normalize(_this);
+ return ret;
+}
+
opus_uint32 ec_dec_uint(ec_dec *_this,opus_uint32 _ft){
unsigned ft;
unsigned s;