aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/nutdec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-06-24 18:32:14 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-06-24 18:40:40 +0200
commit74bd039f8cc2edfd869d3feb75be9525b92a431f (patch)
tree63d8b791440037e37984e1a89239187aba6c4f6b /libavformat/nutdec.c
parent501158c682ceb7546d71209374dac406a7f43238 (diff)
downloadffmpeg-74bd039f8cc2edfd869d3feb75be9525b92a431f.tar.gz
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.c8
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;