[FFmpeg-cvslog] avformat/nutdec: improve probe speed by 30%
Michael Niedermayer
git at videolan.org
Tue Jun 24 18:41:28 CEST 2014
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jun 24 18:32:14 2014 +0200| [74bd039f8cc2edfd869d3feb75be9525b92a431f] | committer: Michael Niedermayer
avformat/nutdec: improve probe speed by 30%
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=74bd039f8cc2edfd869d3feb75be9525b92a431f
---
libavformat/nutdec.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 7da6f2c..093ae63 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;
More information about the ffmpeg-cvslog
mailing list