[Mndiff-dev] [mndiff]: r22 - trunk/mnzip/mnzip.c

michael subversion at mplayerhq.hu
Fri Jun 15 03:01:20 CEST 2007


Author: michael
Date: Fri Jun 15 03:01:20 2007
New Revision: 22

Log:
get rid of av_log2() dependancy


Modified:
   trunk/mnzip/mnzip.c

Modified: trunk/mnzip/mnzip.c
==============================================================================
--- trunk/mnzip/mnzip.c	(original)
+++ trunk/mnzip/mnzip.c	Fri Jun 15 03:01:20 2007
@@ -461,15 +461,16 @@ static inline int getbit(RangeCoder *c, 
 }
 
 static inline void put_symbol_255(RangeCoder *c, uint8_t *state, int v){
-    const int e= av_log2(v);
-    int i;
+    const static uint8_t log2_tab[16]={0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3};
+    int e, i;
 
     putbit(c, state+14,  v==0, prob[14]);  //14
     if(!v)
         return;
 
-    assert(v);
-    assert(e<8);
+    if(v<16) e=   log2_tab[v   ];
+    else     e= 4+log2_tab[v>>4];
+
     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



More information about the Mndiff-dev mailing list