Mercurial > libavcodec.hg
comparison cabac.h @ 3974:93746612bc78 libavcodec
optimize branchless C CABAC decoder
author | michael |
---|---|
date | Mon, 09 Oct 2006 20:44:11 +0000 |
parents | f5f1c9af095d |
children | 6cc9eb5ee5e3 |
comparison
equal
deleted
inserted
replaced
3973:b28edd190fc0 | 3974:93746612bc78 |
---|---|
450 int s = *state; | 450 int s = *state; |
451 int RangeLPS= c->lps_range[s][c->range>>(CABAC_BITS+7)]<<(CABAC_BITS+1); | 451 int RangeLPS= c->lps_range[s][c->range>>(CABAC_BITS+7)]<<(CABAC_BITS+1); |
452 int bit, lps_mask attribute_unused; | 452 int bit, lps_mask attribute_unused; |
453 | 453 |
454 c->range -= RangeLPS; | 454 c->range -= RangeLPS; |
455 #if 1 | 455 #ifndef BRANCHLESS_CABAD |
456 if(c->low < c->range){ | 456 if(c->low < c->range){ |
457 bit= s&1; | 457 bit= s&1; |
458 *state= c->mps_state[s]; | 458 *state= c->mps_state[s]; |
459 renorm_cabac_decoder_once(c); | 459 renorm_cabac_decoder_once(c); |
460 }else{ | 460 }else{ |
473 lps_mask= (c->range - c->low)>>31; | 473 lps_mask= (c->range - c->low)>>31; |
474 | 474 |
475 c->low -= c->range & lps_mask; | 475 c->low -= c->range & lps_mask; |
476 c->range += (RangeLPS - c->range) & lps_mask; | 476 c->range += (RangeLPS - c->range) & lps_mask; |
477 | 477 |
478 bit= (s^lps_mask)&1; | 478 s^=lps_mask; |
479 *state= c->mps_state[s - (130&lps_mask)]; | 479 *state= c->mps_state[s]; |
480 bit= s&1; | |
480 | 481 |
481 lps_mask= ff_h264_norm_shift[c->range>>(CABAC_BITS+3)]; | 482 lps_mask= ff_h264_norm_shift[c->range>>(CABAC_BITS+3)]; |
482 c->range<<= lps_mask; | 483 c->range<<= lps_mask; |
483 c->low <<= lps_mask; | 484 c->low <<= lps_mask; |
484 if(!(c->low & CABAC_MASK)) | 485 if(!(c->low & CABAC_MASK)) |