[Mndiff-dev] [mndiff]: r20 - trunk/mnzip/mnzip.c
michael
subversion at mplayerhq.hu
Fri Jun 15 02:35:51 CEST 2007
Author: michael
Date: Fri Jun 15 02:35:51 2007
New Revision: 20
Log:
remove (now unused) put_symbol() space from arrays
Modified:
trunk/mnzip/mnzip.c
Modified: trunk/mnzip/mnzip.c
==============================================================================
--- trunk/mnzip/mnzip.c (original)
+++ trunk/mnzip/mnzip.c Fri Jun 15 02:35:51 2007
@@ -426,11 +426,11 @@ static inline int clip(int a, int amin,
}
#endif
-static unsigned short prob[32][256];
+static unsigned short prob[16][256];
static void init_prob(unsigned short *prob){
int i;
- for(i=0;i<256*32; i++){
+ for(i=0;i<256*16; i++){
int ctx= i&0xFF;
prob[i]= 256*256*(state_table[ctx][3]+1) / (state_table[ctx][2] + state_table[ctx][3]+2);
}
@@ -464,33 +464,33 @@ static inline void put_symbol_255(RangeC
const int e= av_log2(v);
int i;
- putbit(c, state+14, v==0, prob[17+14]); //14
+ putbit(c, state+14, v==0, prob[14]); //14
if(!v)
return;
assert(v);
assert(e<8);
- putbit(c, state , e>3 , prob[17]); //0
- putbit(c, state+1+(e>3) , (e&2)>>1, prob[17+1+(e>3)]); //1..2
- putbit(c, state+3+(e>>1), (e&1) , prob[17+3+(e>>1)]); //3..6
+ putbit(c, state , e>3 , prob[0]); //0
+ putbit(c, state+1+(e>3) , (e&2)>>1, prob[1+(e>3)]); //1..2
+ putbit(c, state+3+(e>>1), (e&1) , prob[3+(e>>1)]); //3..6
for(i=e-1; i>=0; i--)
- putbit(c, state+7+i, (v>>i)&1 , prob[17+7+i]); //7..13
+ putbit(c, state+7+i, (v>>i)&1 , prob[7+i]); //7..13
}
static inline int get_symbol_255(RangeCoder *c, uint32_t *state){
int e,a,i;
- if(getbit(c, state+14, prob[17+14]))
+ if(getbit(c, state+14, prob[14]))
return 0;
- e =4*getbit(c, state , prob[17]); //0
- e+=2*getbit(c, state+1+(e>3) , prob[17+1+(e>3)]); //1..2
- e+= getbit(c, state+3+(e>>1), prob[17+3+(e>>1)]); //3..6
+ e =4*getbit(c, state , prob[0]); //0
+ e+=2*getbit(c, state+1+(e>3) , prob[1+(e>3)]); //1..2
+ e+= getbit(c, state+3+(e>>1), prob[3+(e>>1)]); //3..6
a= 1;
for(i=e-1; i>=0; i--)
- a += a + getbit(c, state+7 + i, prob[17+7+i]); //7..13
+ a += a + getbit(c, state+7 + i, prob[7+i]); //7..13
return a;
}
@@ -543,7 +543,7 @@ fprintf(stderr,"range coding (%d %d)\n",
}
for(i=0; i<256; i++){
- put_symbol_255(&c, &state[256*32*2], mtf[i]);
+ put_symbol_255(&c, &state[256*16], mtf[i]);
}
for(i=0; i<len; i++){
@@ -554,7 +554,7 @@ fprintf(stderr,"range coding (%d %d)\n",
for(j=0; j<ndx; j++)
mtf[j]= mtf[j+1];
mtf[ndx]= v;
- put_symbol_255(&c, &state[v*32], ndx);
+ put_symbol_255(&c, &state[v*16], ndx);
}
//FIXME last byte mtf= 0 and run mess
//FIXME right order mtf optim
@@ -574,7 +574,7 @@ static int decompress(FILE *fi, int low_
int ret;
uint8_t *tmp; //FIXME reduce memory needs
RangeCoder c;
- uint32_t state[32*1024+1]; //FIXME isnt needed to be that large
+ uint32_t state[257*16];
unsigned int histogram[256]={0};
int mtf[256];
uint8_t tmpX[16];
@@ -609,7 +609,7 @@ fprintf(stderr," block (%d %d %d)\n", ou
for(i=0; i<256; i++){
int test[256]={0};
- mtf[i]= get_symbol_255(&c, &state[256*32*2]);
+ mtf[i]= get_symbol_255(&c, &state[256*16]);
if(mtf[i] > 255U || test[mtf[i]]++){
fprintf(stderr, "fatal error mtf invalid\n");
return -1;
@@ -618,7 +618,7 @@ fprintf(stderr," block (%d %d %d)\n", ou
for(i=0; i<out_len; ){
int v= mtf[0];
- int ndx= get_symbol_255(&c, &state[v*32]);
+ int ndx= get_symbol_255(&c, &state[v*16]);
for(j=0; j<ndx; j++)
mtf[j]= mtf[j+1];
More information about the Mndiff-dev
mailing list