Browse code

avformat/mov: Break out of inner loop early in mov_estimate_video_delay()

0.266 <- 0.299 sec (this is time ffmpeg so containing alot other things)

Sample for benchmark was: ffmpeg -f rawvideo -pix_fmt yuv420p -s 32x32 -i /dev/zero -t 24:00:00.00 out.mp4

Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit aba13dc13e5233545bdd06f514e0addbb0155c69)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2018/07/11 09:17:58
Showing 1 changed files
... ...
@@ -3330,6 +3330,8 @@ static void mov_estimate_video_delay(MOVContext *c, AVStream* st) {
3330 3330
                 if (pts_buf[j] < pts_buf[r]) {
3331 3331
                     FFSWAP(int64_t, pts_buf[j], pts_buf[r]);
3332 3332
                     ++num_swaps;
3333
+                } else {
3334
+                    break;
3333 3335
                 }
3334 3336
                 j = r;
3335 3337
             }