optimzation

Originally committed as revision 3630 to svn://svn.ffmpeg.org/ffmpeg/trunk
pull/126/head
Michael Niedermayer 21 years ago
parent 58897665ae
commit db4d9faf8d
  1. 18
      libavcodec/h264.c

@ -4118,8 +4118,7 @@ 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] ) + int amvd = abs( h->mvd_cache[list][scan8[n] - 1][l] ) +
abs( h->mvd_cache[list][scan8[n] - 8][l] ); abs( h->mvd_cache[list][scan8[n] - 8][l] );
int ctxbase = (l == 0) ? 40 : 47; int ctxbase = (l == 0) ? 40 : 47;
int ctx; int ctx, mvd;
int mvd = 0;
if( amvd < 3 ) if( amvd < 3 )
ctx = 0; ctx = 0;
@ -4128,11 +4127,14 @@ static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) {
else else
ctx = 1; ctx = 1;
if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+ctx]))
return 0;
mvd= 1;
ctx= 3;
while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase+ctx] ) ) { while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase+ctx] ) ) {
mvd++; mvd++;
if( ctx < 3 ) if( ctx < 6 )
ctx = 3;
else if( ctx < 6 )
ctx++; ctx++;
} }
@ -4147,12 +4149,10 @@ static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) {
mvd += 1 << k; mvd += 1 << k;
} }
} }
if( mvd != 0 && get_cabac_bypass( &h->cabac ) ) if( get_cabac_bypass( &h->cabac ) ) return -mvd;
return -mvd; else return mvd;
return mvd;
} }
static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) {
int nza, nzb; int nza, nzb;
int ctx = 0; int ctx = 0;

Loading…
Cancel
Save