aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/h264.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2008-12-19 00:05:39 +0000
committerMichael Niedermayer <michaelni@gmx.at>2008-12-19 00:05:39 +0000
commit8955b66950c8c4050386ba07ecf76604fc3b55f6 (patch)
treed99d061ac33d7e3f084294408a9face1c0c32c6e /libavcodec/h264.c
parent17779f39b684cd8e545768155c37e97e604489b8 (diff)
downloadffmpeg-8955b66950c8c4050386ba07ecf76604fc3b55f6.tar.gz
Optimize ctx calculation in decode_cabac_mb_mvd(), code by dark shikari.
The case for 16x16 blocks becomes 10 cpu cycles faster on pentium dual, i could not find a speed difference in the case of subblocks though. Originally committed as revision 16226 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264.c')
-rw-r--r--libavcodec/h264.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 7d14d04fe9..3e19c97c60 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -5039,14 +5039,8 @@ static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) {
int amvd = abs( h->mvd_cache[list][scan8[n] - 1][l] ) +
abs( h->mvd_cache[list][scan8[n] - 8][l] );
int ctxbase = (l == 0) ? 40 : 47;
- int ctx, mvd;
-
- if( amvd < 3 )
- ctx = 0;
- else if( amvd > 32 )
- ctx = 2;
- else
- ctx = 1;
+ int mvd;
+ int ctx = (amvd>2) + (amvd>32);
if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+ctx]))
return 0;