diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2010-03-09 15:19:23 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2010-03-09 15:19:23 +0000 |
commit | 67c10de7d2a9c20681441d01f91221d9c853b6f4 (patch) | |
tree | 72f0b777824184b6b719526d57350733d3e8eecc | |
parent | 335ee1aaddd4de450d95352205f68373ec51bae5 (diff) | |
download | ffmpeg-67c10de7d2a9c20681441d01f91221d9c853b6f4.tar.gz |
Add special case to avoid binary search when appending index entries.
Originally committed as revision 22400 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/utils.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 86bae7b357..2b579ca67d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -1305,6 +1305,10 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, a = - 1; b = nb_entries; + //optimize appending index entries at the end + if(b && entries[b-1].timestamp < wanted_timestamp) + a= b-1; + while (b - a > 1) { m = (a + b) >> 1; timestamp = entries[m].timestamp; |