Mercurial > libavcodec.hg
changeset 8442:60be1c7d8345 libavcodec
Make h264 parser 50% faster.
author | michael |
---|---|
date | Tue, 23 Dec 2008 02:34:58 +0000 |
parents | f97c423dcb7f |
children | cf81cdbf8ca9 |
files | h264_parser.c |
diffstat | 1 files changed, 9 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/h264_parser.c Tue Dec 23 01:11:56 2008 +0000 +++ b/h264_parser.c Tue Dec 23 02:34:58 2008 +0000 @@ -44,6 +44,15 @@ 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;