Mercurial > libavcodec.hg
comparison h264_cabac.c @ 11272:aa9317d124fc libavcodec
Replace mvd>2 + mvd>32 by MIN((mvd+28)*17>>9, 2)
same speed as far as i can meassure but it might have fewer branches on some
archs.
Idea from x264 / jason
author | michael |
---|---|
date | Wed, 24 Feb 2010 16:16:08 +0000 |
parents | bf3436efe037 |
children | a2cb557201bb |
comparison
equal
deleted
inserted
replaced
11271:bf3436efe037 | 11272:aa9317d124fc |
---|---|
913 int amvd = h->mvd_cache[list][scan8[n] - 1][l] + | 913 int amvd = h->mvd_cache[list][scan8[n] - 1][l] + |
914 h->mvd_cache[list][scan8[n] - 8][l]; | 914 h->mvd_cache[list][scan8[n] - 8][l]; |
915 int ctxbase = (l == 0) ? 40 : 47; | 915 int ctxbase = (l == 0) ? 40 : 47; |
916 int mvd; | 916 int mvd; |
917 | 917 |
918 if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+(amvd>2) + (amvd>32)])) | 918 if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+FFMIN(((amvd+28)*17)>>9,2)])) |
919 return 0; | 919 return 0; |
920 | 920 |
921 mvd= 1; | 921 mvd= 1; |
922 ctxbase+= 3; | 922 ctxbase+= 3; |
923 while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase] ) ) { | 923 while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase] ) ) { |