From 37915d1c8c90cfa668092577f8b2be2ab3c2c6db Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Fri, 14 May 2021 00:11:20 +1000 Subject: [PATCH] framehashcache: improve time list function Old implementation was particularly slow, this is significantly faster and should be identical in output. --- app/render/framehashcache.cpp | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/render/framehashcache.cpp b/app/render/framehashcache.cpp index bfc0aaa11..8b7fc8fa7 100644 --- a/app/render/framehashcache.cpp +++ b/app/render/framehashcache.cpp @@ -152,22 +152,13 @@ QVector FrameHashCache::GetFrameListFromTimeRange(TimeRangeList range_ QVector times; - while (!range_list.isEmpty()) { - const TimeRange& range = range_list.first(); + foreach (const TimeRange &range, range_list) { + rational frame = Timecode::snap_time_to_timebase(range.in(), timebase, true); - rational time = range.in(); - rational snapped = Timecode::snap_time_to_timebase(time, timebase); - rational next; - - if (snapped > time) { - next = snapped; - snapped -= timebase; - } else { - next = snapped + timebase; + while (frame < range.out()) { + times.append(frame); + frame += timebase; } - - times.append(snapped); - range_list.remove(TimeRange(snapped, next)); } return times;