shithub: opus

Download patch

ref: 1aaa50d1c10f165bfb0572d5f0820ad21fd17502
parent: de31e7e09ab8958558147e7367532d0409d86744
author: Timothy B. Terriberry <[email protected]>
date: Tue Dec 21 12:45:08 EST 2010

Update ec_dec_cdf() to use an unsigned cdf[].

For our current usage, this doesn't matter, but is more consistent
 with the rest of the API.
We may want to reduce this to an unsigned char[], but I'd rather
 coordinate that optimization with SILK's planned reduction to
 8-bit CDFs, as we may be able to use the same code.

--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -53,8 +53,8 @@
 #include <stdarg.h>
 #include "plc.h"
 
-static const int trim_cdf[12] = {0, 2, 4, 9, 19, 41, 87, 109, 119, 124, 126, 128};
-static const int spread_cdf[5] = {0, 7, 9, 30, 32};
+static const unsigned trim_cdf[12] = {0, 2, 4, 9, 19, 41, 87, 109, 119, 124, 126, 128};
+static const unsigned spread_cdf[5] = {0, 7, 9, 30, 32};
 
 #define COMBFILTER_MAXPERIOD 1024
 #define COMBFILTER_MINPERIOD 16
--- a/libcelt/entdec.h
+++ b/libcelt/entdec.h
@@ -121,7 +121,7 @@
   _ftb: The number of bits of precision in the cumulative distribution.
   Return: The decoded symbol s, which must have been encoded with
    ec_encode_bin(enc,_cdf[s],_cdf[s+1],_ftb).*/
-int ec_dec_cdf(ec_dec *_this,const int *_cdf,unsigned _ftb);
+int ec_dec_cdf(ec_dec *_this,const unsigned *_cdf,unsigned _ftb);
 
 /* Decode a bit that has a _prob/65536 probability of being a one */
 int ec_dec_bit_prob(ec_dec *_this,unsigned _prob);
--- a/libcelt/rangedec.c
+++ b/libcelt/rangedec.c
@@ -187,7 +187,7 @@
   return val;
 }
 
-int ec_dec_cdf(ec_dec *_this,const int *_cdf,unsigned _ftb){
+int ec_dec_cdf(ec_dec *_this,const unsigned *_cdf,unsigned _ftb){
   ec_uint32 r;
   ec_uint32 d;
   ec_uint32 s;
--- a/tests/ectest.c
+++ b/tests/ectest.c
@@ -238,7 +238,7 @@
           sym=ec_dec_bit_logp(&dec,logp1[j]);
         }break;
         case 3:{
-          int cdf[3];
+          unsigned cdf[3];
           cdf[0]=0;
           cdf[1]=(1<<logp1[j])-1;
           cdf[2]=1<<logp1[j];