Commit 74bd039f authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/nutdec: improve probe speed by 30%

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 501158c6
...@@ -183,11 +183,11 @@ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos) ...@@ -183,11 +183,11 @@ static int64_t find_startcode(AVIOContext *bc, uint64_t code, int64_t pos)
static int nut_probe(AVProbeData *p) static int nut_probe(AVProbeData *p)
{ {
int i; int i;
uint64_t code = 0;
for (i = 0; i < p->buf_size; i++) { for (i = 0; i < p->buf_size-8; i++) {
code = (code << 8) | p->buf[i]; if (AV_RB32(p->buf+i) != MAIN_STARTCODE>>32)
if (code == MAIN_STARTCODE) continue;
if (AV_RB32(p->buf+i+4) == (MAIN_STARTCODE & 0xFFFFFFFF))
return AVPROBE_SCORE_MAX; return AVPROBE_SCORE_MAX;
} }
return 0; return 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment