From: Jason Garrett-Glaser Date: Mon, 30 Aug 2010 05:18:07 +0000 (-0700) Subject: Faster cabac_encode_ue_bypass X-Git-Url: http://www.zmx.ovh/git.videolan.org/?a=commitdiff_plain;h=6e8530793eb849f6ec17847acd39b69504f8fd49;p=x264.git Faster cabac_encode_ue_bypass Use CLZ + a lut instead of a loop. --- diff --git a/common/cabac.c b/common/cabac.c index d0888d09..cd57d904 100644 --- a/common/cabac.c +++ b/common/cabac.c @@ -850,14 +850,19 @@ void x264_cabac_encode_bypass_c( x264_cabac_t *cb, int b ) x264_cabac_putbyte( cb ); } +static const int bypass_lut[16] = +{ + -1, 0x2, 0x14, 0x68, 0x1d0, 0x7a0, 0x1f40, 0x7e80, + 0x1fd00, 0x7fa00, 0x1ff400, 0x7fe800, 0x1ffd000, 0x7ffa000, 0x1fff4000, 0x7ffe8000 +}; + void x264_cabac_encode_ue_bypass( x264_cabac_t *cb, int exp_bits, int val ) { - int k, i; - for( k = exp_bits; val >= (1<i_low <<= i;