comparison cabac.h @ 3955:051a9c8b257f libavcodec

5% faster get_cabac()
author michael
date Sun, 08 Oct 2006 11:24:37 +0000
parents 751bfc30df72
children 0910f2844f9a
comparison
equal deleted inserted replaced
3954:00a12ef7d800 3955:051a9c8b257f
37 int range; 37 int range;
38 int outstanding_count; 38 int outstanding_count;
39 #ifdef STRICT_LIMITS 39 #ifdef STRICT_LIMITS
40 int symCount; 40 int symCount;
41 #endif 41 #endif
42 uint8_t lps_range[2*65][4]; ///< rangeTabLPS 42 uint8_t lps_range[2*66][4]; ///< rangeTabLPS
43 uint8_t lps_state[2*64]; ///< transIdxLPS 43 uint8_t lps_state[2*65]; ///< transIdxLPS
44 uint8_t mps_state[2*64]; ///< transIdxMPS 44 uint8_t mps_state[2*65]; ///< transIdxMPS
45 const uint8_t *bytestream_start; 45 const uint8_t *bytestream_start;
46 const uint8_t *bytestream; 46 const uint8_t *bytestream;
47 const uint8_t *bytestream_end; 47 const uint8_t *bytestream_end;
48 PutBitContext pb; 48 PutBitContext pb;
49 }CABACContext; 49 }CABACContext;
374 374
375 c->range -= RangeLPS; 375 c->range -= RangeLPS;
376 #if 1 376 #if 1
377 if(c->low < c->range){ 377 if(c->low < c->range){
378 bit= s&1; 378 bit= s&1;
379 *state= c->mps_state[s]; 379 #ifdef ARCH_X86
380 //P3:627
381 asm(
382 "addb $2, %b0 \n\t"
383 " js 1f \n\t"
384 "movb %b0, %1 \n\t"
385 "1: \n\t"
386 : "+q"(s), "=m"(*state)
387 );
388 #else
389 *state= c->mps_state[s]; //P3:655
390 /* if(s<126) //P3:657
391 *state= s+2;*/
392 s+=2; //P3:631
393 if(s<128)
394 *state= s;
395 #endif
380 renorm_cabac_decoder_once(c); 396 renorm_cabac_decoder_once(c);
381 }else{ 397 }else{
382 // int shift= ff_h264_norm_shift[RangeLPS>>17]; 398 // int shift= ff_h264_norm_shift[RangeLPS>>17];
383 bit= (s&1)^1; 399 bit= (s&1)^1;
384 c->low -= c->range; 400 c->low -= c->range;