avformat/nutdec: improve probe speed by 30%

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-06-24 18:32:14 +02:00
parent 501158c682
commit 74bd039f8c

View File

@ -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;