[FFmpeg-cvslog] r22400 - trunk/libavformat/utils.c

michael subversion
Tue Mar 9 16:19:23 CET 2010


Author: michael
Date: Tue Mar  9 16:19:23 2010
New Revision: 22400

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

Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Tue Mar  9 16:10:23 2010	(r22399)
+++ trunk/libavformat/utils.c	Tue Mar  9 16:19:23 2010	(r22400)
@@ -1305,6 +1305,10 @@ int av_index_search_timestamp(AVStream *
     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;



More information about the ffmpeg-cvslog mailing list