Commit 31590223 authored by astrange's avatar astrange

Reorder the if/else for residual cats to match gcc's branch prediction.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@14053 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 0da6f2ee
...@@ -5350,13 +5350,13 @@ static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx, ...@@ -5350,13 +5350,13 @@ static av_always_inline int get_cabac_cbf_ctx( H264Context *h, int cat, int idx,
nzb = (h-> top_cbp>>(6+idx))&0x01; nzb = (h-> top_cbp>>(6+idx))&0x01;
} }
} else { } else {
if( cat == 1 || cat == 2 ) { if( cat == 4 ) {
nza = h->non_zero_count_cache[scan8[idx] - 1];
nzb = h->non_zero_count_cache[scan8[idx] - 8];
} else {
assert(cat == 4);
nza = h->non_zero_count_cache[scan8[16+idx] - 1]; nza = h->non_zero_count_cache[scan8[16+idx] - 1];
nzb = h->non_zero_count_cache[scan8[16+idx] - 8]; nzb = h->non_zero_count_cache[scan8[16+idx] - 8];
} else {
assert(cat == 1 || cat == 2);
nza = h->non_zero_count_cache[scan8[idx] - 1];
nzb = h->non_zero_count_cache[scan8[idx] - 8];
} }
} }
...@@ -5447,10 +5447,10 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT ...@@ -5447,10 +5447,10 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
if( is_dc || cat != 5 ) { if( is_dc || cat != 5 ) {
if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) { if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) {
if( !is_dc ) { if( !is_dc ) {
if( cat == 1 || cat == 2 ) if( cat == 4 )
h->non_zero_count_cache[scan8[n]] = 0;
else
h->non_zero_count_cache[scan8[16+n]] = 0; h->non_zero_count_cache[scan8[16+n]] = 0;
else
h->non_zero_count_cache[scan8[n]] = 0;
} }
#ifdef CABAC_ON_STACK #ifdef CABAC_ON_STACK
...@@ -5504,13 +5504,13 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT ...@@ -5504,13 +5504,13 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
else else
h->cbp_table[h->mb_xy] |= 0x40 << n; h->cbp_table[h->mb_xy] |= 0x40 << n;
} else { } else {
if( cat == 1 || cat == 2 ) if( cat == 5 )
h->non_zero_count_cache[scan8[n]] = coeff_count; fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
else if( cat == 4 ) else if( cat == 4 )
h->non_zero_count_cache[scan8[16+n]] = coeff_count; h->non_zero_count_cache[scan8[16+n]] = coeff_count;
else { else {
assert( cat == 5 ); assert( cat == 1 || cat == 2 );
fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1); h->non_zero_count_cache[scan8[n]] = coeff_count;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment