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.
This commit is contained in:
Timothy B. Terriberry 2010-12-21 17:45:08 -08:00 committed by Jean-Marc Valin
parent de31e7e09a
commit 1aaa50d1c1
4 changed files with 5 additions and 5 deletions

View file

@ -53,8 +53,8 @@
#include <stdarg.h> #include <stdarg.h>
#include "plc.h" #include "plc.h"
static const int trim_cdf[12] = {0, 2, 4, 9, 19, 41, 87, 109, 119, 124, 126, 128}; static const unsigned 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 spread_cdf[5] = {0, 7, 9, 30, 32};
#define COMBFILTER_MAXPERIOD 1024 #define COMBFILTER_MAXPERIOD 1024
#define COMBFILTER_MINPERIOD 16 #define COMBFILTER_MINPERIOD 16

View file

@ -121,7 +121,7 @@ ec_uint32 ec_dec_uint(ec_dec *_this,ec_uint32 _ft);
_ftb: The number of bits of precision in the cumulative distribution. _ftb: The number of bits of precision in the cumulative distribution.
Return: The decoded symbol s, which must have been encoded with Return: The decoded symbol s, which must have been encoded with
ec_encode_bin(enc,_cdf[s],_cdf[s+1],_ftb).*/ 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 */ /* Decode a bit that has a _prob/65536 probability of being a one */
int ec_dec_bit_prob(ec_dec *_this,unsigned _prob); int ec_dec_bit_prob(ec_dec *_this,unsigned _prob);

View file

@ -187,7 +187,7 @@ int ec_dec_bit_logp(ec_dec *_this,unsigned _logp){
return val; 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 r;
ec_uint32 d; ec_uint32 d;
ec_uint32 s; ec_uint32 s;

View file

@ -238,7 +238,7 @@ int main(int _argc,char **_argv){
sym=ec_dec_bit_logp(&dec,logp1[j]); sym=ec_dec_bit_logp(&dec,logp1[j]);
}break; }break;
case 3:{ case 3:{
int cdf[3]; unsigned cdf[3];
cdf[0]=0; cdf[0]=0;
cdf[1]=(1<<logp1[j])-1; cdf[1]=(1<<logp1[j])-1;
cdf[2]=1<<logp1[j]; cdf[2]=1<<logp1[j];