cache: attempt to automatically re-match hashes on invalidate

This code is slow and unoptimized. Will require some more work.
This commit is contained in:
itsmattkc
2020-05-21 16:49:02 +10:00
parent cb72736f52
commit 34fade9d81
7 changed files with 73 additions and 21 deletions
+3 -18
View File
@@ -73,25 +73,10 @@ void RenderTask::Render(const TimeRangeList& range_to_cache,
QLinkedList<TimeHashFuturePair> hash_list;
{
TimeRangeList range_list = range_to_cache;
while (!range_list.isEmpty()) {
const TimeRange& range = range_list.first();
QList<rational> times = viewer_->video_frame_cache()->GetFrameListFromTimeRange(range_to_cache);
const rational& timebase = viewer_->video_params().time_base();
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;
}
hash_list.append({snapped, backend.Hash(snapped, false)});
range_list.RemoveTimeRange(TimeRange(snapped, next));
foreach (const rational& r, times) {
hash_list.append({r, backend.Hash(r, false)});
}
}