diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-12-18 16:11:19 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-12-18 16:11:19 +0000 |
commit | 04824298a9e2fec292cc2859c6a50a5d5a6d7752 (patch) | |
tree | d50e341a6ac12e48a62477dd9545e1fd02d574bc | |
parent | 93445d16171a1bb9ddfdd207ae251a90b5b623c1 (diff) | |
download | ffmpeg-04824298a9e2fec292cc2859c6a50a5d5a6d7752.tar.gz |
Faster CAVLC decoding of trailing_ones. Based on a patch by dark shikari.
decode_residual is about 3.3% faster.
Originally committed as revision 16219 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c index d3a8e56bbc..6f68095ae2 100644 --- a/libavcodec/h264.c +++ b/libavcodec/h264.c @@ -4087,9 +4087,11 @@ static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, in tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff); assert(total_coeff<=16); - for(i=0; i<trailing_ones; i++){ - level[i]= 1 - 2*get_bits1(gb); - } + i = show_bits(gb, 3); + skip_bits(gb, trailing_ones); + level[0] = 1-((i&4)>>1); + level[1] = 1-((i&2) ); + level[2] = 1-((i&1)<<1); if(trailing_ones<total_coeff) { int level_code, mask; |