diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-01-25 02:44:34 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-01-25 02:44:34 +0000 |
commit | 2773920698beab30525bbd7249655f3223874d65 (patch) | |
tree | 4811287a3ad1a7ef90fec98aae620b2bbc7083e0 /libavcodec/h264_cabac.c | |
parent | 7f8c3d1f4d903b3a884175c3da7ffb1e80698d9d (diff) | |
download | ffmpeg-2773920698beab30525bbd7249655f3223874d65.tar.gz |
Optimize decode_cabac_field_decoding_flag().
~4 cpu cycles faster
Originally committed as revision 21447 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264_cabac.c')
-rw-r--r-- | libavcodec/h264_cabac.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/libavcodec/h264_cabac.c b/libavcodec/h264_cabac.c index 0c2a2466c0..aba25a539a 100644 --- a/libavcodec/h264_cabac.c +++ b/libavcodec/h264_cabac.c @@ -706,21 +706,15 @@ void ff_h264_init_cabac_states(H264Context *h) { static int decode_cabac_field_decoding_flag(H264Context *h) { MpegEncContext * const s = &h->s; - const int mb_x = s->mb_x; - const int mb_y = s->mb_y & ~1; - const int mba_xy = mb_x - 1 + mb_y *s->mb_stride; - const int mbb_xy = mb_x + (mb_y-2)*s->mb_stride; + const long mba_xy = h->mb_xy - 1L; + const long mbb_xy = h->mb_xy - 2L*s->mb_stride; - unsigned int ctx = 0; + unsigned long ctx = 0; - if( h->slice_table[mba_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mba_xy] ) ) { - ctx += 1; - } - if( h->slice_table[mbb_xy] == h->slice_num && IS_INTERLACED( s->current_picture.mb_type[mbb_xy] ) ) { - ctx += 1; - } + ctx += (s->current_picture.mb_type[mba_xy]>>7)&(h->slice_table[mba_xy] == h->slice_num); + ctx += (s->current_picture.mb_type[mbb_xy]>>7)&(h->slice_table[mbb_xy] == h->slice_num); - return get_cabac_noinline( &h->cabac, &h->cabac_state[70 + ctx] ); + return get_cabac_noinline( &h->cabac, &(h->cabac_state+70)[ctx] ); } static int decode_cabac_intra_mb_type(H264Context *h, int ctx_base, int intra_slice) { |