[Mndiff-dev] [mndiff]: r24 - trunk/mnzip/mnzip.c
michael
subversion at mplayerhq.hu
Fri Jun 15 03:34:39 CEST 2007
Author: michael
Date: Fri Jun 15 03:34:39 2007
New Revision: 24
Log:
simplify
Modified:
trunk/mnzip/mnzip.c
Modified: trunk/mnzip/mnzip.c
==============================================================================
--- trunk/mnzip/mnzip.c (original)
+++ trunk/mnzip/mnzip.c Fri Jun 15 03:34:39 2007
@@ -75,19 +75,17 @@ static inline void renorm_encoder(RangeC
}
}
-static inline void put_rac(RangeCoder *c, uint8_t * const state, int bit){
- int range1= (c->range * (*state)) >> 8;
+static inline void put_rac(RangeCoder *c, uint8_t prob, int bit){
+ int range1= (c->range * prob) >> 8;
- assert(*state);
+ assert(prob);
assert(range1 < c->range);
assert(range1 > 0);
if(!bit){
c->range -= range1;
-// *state= c->zero_state[*state];
}else{
c->low += c->range - range1;
c->range = range1;
-// *state= c->one_state[*state];
}
renorm_encoder(c);
@@ -103,18 +101,16 @@ static inline void refill(RangeCoder *c)
}
}
-static inline int get_rac(RangeCoder *c, uint8_t * const state){
- int range1= (c->range * (*state)) >> 8;
+static inline int get_rac(RangeCoder *c, uint8_t prob){
+ int range1= (c->range * prob) >> 8;
c->range -= range1;
if(c->low < c->range){
-// *state= c->zero_state[*state];
refill(c);
return 0;
}else{
c->low -= c->range;
-// *state= c->one_state[*state];
c->range = range1;
refill(c);
return 1;
@@ -562,8 +558,7 @@ static inline void putbit(RangeCoder *c,
int ctx= *state;
int p8= (prob[ctx] + 128)>>8;
- uint8_t s= clip(p8, 1, 255);
- put_rac(c, &s, b);
+ put_rac(c, clip(p8, 1, 255), b);
prob[ctx]+= b*256 - p8;
*state= state_table[ctx][b];
@@ -573,8 +568,7 @@ static inline int getbit(RangeCoder *c,
int ctx= *state;
int p8= (prob[ctx] + 128)>>8;
- uint8_t s= clip(p8, 1, 255);
- int b= get_rac(c, &s);
+ int b= get_rac(c, clip(p8, 1, 255));
prob[ctx]+= b*256 - p8;
*state= state_table[ctx][b];
More information about the Mndiff-dev
mailing list