summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorAlexander Strange <astrange@ithinksw.com>2008-07-02 22:20:06 +0000
committerAlexander Strange <astrange@ithinksw.com>2008-07-02 22:20:06 +0000
commit142ee5d73db1389f95434c2c27e9346a08f2db4c (patch)
tree1bf8f3d9e59cc635a940a68fe318c1d15ece2437 /libavcodec
parent47775cb8de880dfd2f82029d109229ae65aae767 (diff)
Reorder the if/else for residual cats to match gcc's branch prediction.
Originally committed as revision 14053 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/h264.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 57e97e3d2c..561d68ea5f 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -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;
}
} else {
- if( cat == 1 || cat == 2 ) {
- nza = h->non_zero_count_cache[scan8[idx] - 1];
- nzb = h->non_zero_count_cache[scan8[idx] - 8];
- } else {
- assert(cat == 4);
+ if( cat == 4 ) {
nza = h->non_zero_count_cache[scan8[16+idx] - 1];
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
if( is_dc || cat != 5 ) {
if( get_cabac( CC, &h->cabac_state[85 + get_cabac_cbf_ctx( h, cat, n, is_dc ) ] ) == 0 ) {
if( !is_dc ) {
- if( cat == 1 || cat == 2 )
- h->non_zero_count_cache[scan8[n]] = 0;
- else
+ if( cat == 4 )
h->non_zero_count_cache[scan8[16+n]] = 0;
+ else
+ h->non_zero_count_cache[scan8[n]] = 0;
}
#ifdef CABAC_ON_STACK
@@ -5504,13 +5504,13 @@ static av_always_inline void decode_cabac_residual_internal( H264Context *h, DCT
else
h->cbp_table[h->mb_xy] |= 0x40 << n;
} else {
- if( cat == 1 || cat == 2 )
- h->non_zero_count_cache[scan8[n]] = coeff_count;
+ if( cat == 5 )
+ fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
else if( cat == 4 )
h->non_zero_count_cache[scan8[16+n]] = coeff_count;
else {
- assert( cat == 5 );
- fill_rectangle(&h->non_zero_count_cache[scan8[n]], 2, 2, 8, coeff_count, 1);
+ assert( cat == 1 || cat == 2 );
+ h->non_zero_count_cache[scan8[n]] = coeff_count;
}
}