Mercurial > libavcodec.hg
comparison h264.c @ 2317:2865f759882a libavcodec
optimzation
author | michael |
---|---|
date | Sun, 24 Oct 2004 02:59:36 +0000 |
parents | fe25f849a169 |
children | 9cd834fc7325 |
comparison
equal
deleted
inserted
replaced
2316:fe25f849a169 | 2317:2865f759882a |
---|---|
4116 | 4116 |
4117 static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) { | 4117 static int decode_cabac_mb_mvd( H264Context *h, int list, int n, int l ) { |
4118 int amvd = abs( h->mvd_cache[list][scan8[n] - 1][l] ) + | 4118 int amvd = abs( h->mvd_cache[list][scan8[n] - 1][l] ) + |
4119 abs( h->mvd_cache[list][scan8[n] - 8][l] ); | 4119 abs( h->mvd_cache[list][scan8[n] - 8][l] ); |
4120 int ctxbase = (l == 0) ? 40 : 47; | 4120 int ctxbase = (l == 0) ? 40 : 47; |
4121 int ctx; | 4121 int ctx, mvd; |
4122 int mvd = 0; | |
4123 | 4122 |
4124 if( amvd < 3 ) | 4123 if( amvd < 3 ) |
4125 ctx = 0; | 4124 ctx = 0; |
4126 else if( amvd > 32 ) | 4125 else if( amvd > 32 ) |
4127 ctx = 2; | 4126 ctx = 2; |
4128 else | 4127 else |
4129 ctx = 1; | 4128 ctx = 1; |
4130 | 4129 |
4130 if(!get_cabac(&h->cabac, &h->cabac_state[ctxbase+ctx])) | |
4131 return 0; | |
4132 | |
4133 mvd= 1; | |
4134 ctx= 3; | |
4131 while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase+ctx] ) ) { | 4135 while( mvd < 9 && get_cabac( &h->cabac, &h->cabac_state[ctxbase+ctx] ) ) { |
4132 mvd++; | 4136 mvd++; |
4133 if( ctx < 3 ) | 4137 if( ctx < 6 ) |
4134 ctx = 3; | |
4135 else if( ctx < 6 ) | |
4136 ctx++; | 4138 ctx++; |
4137 } | 4139 } |
4138 | 4140 |
4139 if( mvd >= 9 ) { | 4141 if( mvd >= 9 ) { |
4140 int k = 3; | 4142 int k = 3; |
4145 while( k-- ) { | 4147 while( k-- ) { |
4146 if( get_cabac_bypass( &h->cabac ) ) | 4148 if( get_cabac_bypass( &h->cabac ) ) |
4147 mvd += 1 << k; | 4149 mvd += 1 << k; |
4148 } | 4150 } |
4149 } | 4151 } |
4150 if( mvd != 0 && get_cabac_bypass( &h->cabac ) ) | 4152 if( get_cabac_bypass( &h->cabac ) ) return -mvd; |
4151 return -mvd; | 4153 else return mvd; |
4152 return mvd; | 4154 } |
4153 } | |
4154 | |
4155 | 4155 |
4156 static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { | 4156 static int inline get_cabac_cbf_ctx( H264Context *h, int cat, int idx ) { |
4157 int nza, nzb; | 4157 int nza, nzb; |
4158 int ctx = 0; | 4158 int ctx = 0; |
4159 | 4159 |