aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-11-09 14:43:51 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-11-09 14:46:14 +0100
commit76a47d66c41417184b777fd925d8907498c24177 (patch)
treee065e224c15e7b501c49d4ec4e0c529dd2c8046b
parentdbb41f93c16cbc65a899a75723c95da51c851cd5 (diff)
downloadffmpeg-76a47d66c41417184b777fd925d8907498c24177.tar.gz
avformat/dv: about 3 times faster probe
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/dv.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/libavformat/dv.c b/libavformat/dv.c
index e3b0d0a31e..bc649e637e 100644
--- a/libavformat/dv.c
+++ b/libavformat/dv.c
@@ -590,19 +590,21 @@ static int dv_probe(AVProbeData *p)
if (p->buf_size < 5)
return 0;
- state = AV_RB32(p->buf);
- for (i = 4; i < p->buf_size; i++) {
- if ((state & 0xffffff7f) == 0x1f07003f)
- matches++;
- // any section header, also with seq/chan num != 0,
- // should appear around every 12000 bytes, at least 10 per frame
- if ((state & 0xff07ff7f) == 0x1f07003f)
- secondary_matches++;
- if (state == 0x003f0700 || state == 0xff3f0700)
- marker_pos = i;
- if (state == 0xff3f0701 && i - marker_pos == 80)
- matches++;
- state = (state << 8) | p->buf[i];
+ for (i = 0; i < p->buf_size-4; i++) {
+ unsigned state = AV_RB32(p->buf+i);
+ if ((state & 0x0007f840) == 0x00070000) {
+ // any section header, also with seq/chan num != 0,
+ // should appear around every 12000 bytes, at least 10 per frame
+ if ((state & 0xff07ff7f) == 0x1f07003f) {
+ secondary_matches++;
+ if ((state & 0xffffff7f) == 0x1f07003f)
+ matches++;
+ }
+ if (state == 0x003f0700 || state == 0xff3f0700)
+ marker_pos = i;
+ if (state == 0xff3f0701 && i - marker_pos == 80)
+ matches++;
+ }
}
if (matches && p->buf_size / matches < 1024 * 1024) {