diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-01-27 11:14:29 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-01-27 11:14:29 +0000 |
commit | e470ef7641a41b6acd0765b7031ad03c041ec186 (patch) | |
tree | edeedd56c4c44cfda4a489042cfabceb09af4868 | |
parent | e8a9d01846d5974011b4f3a6c26940ebbe67f594 (diff) | |
download | ffmpeg-e470ef7641a41b6acd0765b7031ad03c041ec186.tar.gz |
Use table to speedup access to non_zero_count in MBAFF with differing interlacing.
~4 cpu cycles speedup
Originally committed as revision 21474 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavcodec/h264_loopfilter.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/libavcodec/h264_loopfilter.c b/libavcodec/h264_loopfilter.c index 28557531e4..5d2f62f2c5 100644 --- a/libavcodec/h264_loopfilter.c +++ b/libavcodec/h264_loopfilter.c @@ -632,6 +632,16 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint *(uint64_t*)&bS[0]= *(uint64_t*)&bS[4]= 0x0004000400040004ULL; else { + static const uint8_t offset[2][2][8]={ + { + {7+8*0, 7+8*0, 7+8*0, 7+8*0, 7+8*1, 7+8*1, 7+8*1, 7+8*1}, + {7+8*2, 7+8*2, 7+8*2, 7+8*2, 7+8*3, 7+8*3, 7+8*3, 7+8*3}, + },{ + {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3}, + {7+8*0, 7+8*1, 7+8*2, 7+8*3, 7+8*0, 7+8*1, 7+8*2, 7+8*3}, + } + }; + const uint8_t *off= offset[MB_FIELD][mb_y&1]; for( i = 0; i < 8; i++ ) { int j= MB_FIELD ? i>>2 : i&1; int mbn_xy = h->left_mb_xy[j]; @@ -644,7 +654,7 @@ void ff_h264_filter_mb( H264Context *h, int mb_x, int mb_y, uint8_t *img_y, uint ((!h->pps.cabac && IS_8x8DCT(mbn_type)) ? (h->cbp_table[mbn_xy] & ((MB_FIELD ? (i&2) : (mb_y&1)) ? 8 : 2)) : - h->non_zero_count[mbn_xy][7+(MB_FIELD ? (i&3) : (i>>2)+(mb_y&1)*2)*8])); + h->non_zero_count[mbn_xy][ off[i] ])); } } } |