Commit 1c3505ff authored by michael's avatar michael

Add special case to avoid binary search when appending index entries.


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22400 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent ed873045
...@@ -1305,6 +1305,10 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp, ...@@ -1305,6 +1305,10 @@ int av_index_search_timestamp(AVStream *st, int64_t wanted_timestamp,
a = - 1; a = - 1;
b = nb_entries; 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) { while (b - a > 1) {
m = (a + b) >> 1; m = (a + b) >> 1;
timestamp = entries[m].timestamp; timestamp = entries[m].timestamp;
......
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