diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-06-24 20:32:14 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-06-24 20:40:40 +0400 |
commit | 74bd039f8cc2edfd869d3feb75be9525b92a431f (patch) | |
tree | 63d8b791440037e37984e1a89239187aba6c4f6b /libavformat/nutdec.c | |
parent | 501158c682ceb7546d71209374dac406a7f43238 (diff) |
avformat/nutdec: improve probe speed by 30%
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/nutdec.c')
-rw-r--r-- | libavformat/nutdec.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 7da6f2c441..093ae6376d 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -183,11 +183,11 @@ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos) static int nut_probe(AVProbeData *p) { int i; - uint64_t code = 0; - for (i = 0; i < p->buf_size; i++) { - code = (code << 8) | p->buf[i]; - if (code == MAIN_STARTCODE) + for (i = 0; i < p->buf_size-8; i++) { + if (AV_RB32(p->buf+i) != MAIN_STARTCODE>>32) + continue; + if (AV_RB32(p->buf+i+4) == (MAIN_STARTCODE & 0xFFFFFFFF)) return AVPROBE_SCORE_MAX; } return 0; |