diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-12-23 02:34:58 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-12-23 02:34:58 +0000 |
commit | 5cb5023c78ceb43d02db609db948fce62221b554 (patch) | |
tree | 9d7c47785027db530d46f39b508c4bb5b45b8fd7 /libavcodec/h264_parser.c | |
parent | abb27cfb24f0406c8aca112918fc812f61507f7f (diff) | |
download | ffmpeg-5cb5023c78ceb43d02db609db948fce62221b554.tar.gz |
Make h264 parser 50% faster.
Originally committed as revision 16286 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/h264_parser.c')
-rw-r--r-- | libavcodec/h264_parser.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavcodec/h264_parser.c b/libavcodec/h264_parser.c index e0973bf6e0..62cd948595 100644 --- a/libavcodec/h264_parser.c +++ b/libavcodec/h264_parser.c @@ -44,6 +44,15 @@ int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size) for(i=0; i<buf_size; i++){ if(state==7){ +#ifdef HAVE_FAST_UNALIGNED +# ifdef HAVE_FAST_64BIT + while(i<buf_size && !((~*(uint64_t*)(buf+i) & (*(uint64_t*)(buf+i) - 0x0101010101010101ULL)) & 0x8080808080808080ULL)) + i+=8; +# else + while(i<buf_size && !((~*(uint32_t*)(buf+i) & (*(uint32_t*)(buf+i) - 0x01010101U)) & 0x80808080U)) + i+=4; +# endif +#endif for(; i<buf_size; i++){ if(!buf[i]){ state=2; |