Render the video preview draft first: every third frame, then the rest

The preview plays a draft of every third frame, each held for three, as
soon as those are in, and fills in the frames between while it plays.
renderFrames takes an optional frame order (draftFirstOrder builds this
one); a frame is the same whatever order it is rendered in.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Si
2026-09-26 19:49:59 +02:00
co-authored by Claude Opus 5.5
parent 6df4bcb079
commit ac8b62208c
6 changed files with 132 additions and 33 deletions
+19
View File
@@ -1959,6 +1959,25 @@ int main() {
[&](int, effector::Image&&) { return ++seen < 3; });
check(seen == 3, "returning false stops a clip early");
// A preview renders a draft of every third frame first; the frames
// are the same whichever order they come in.
const auto order = effector::draftFirstOrder(8, 3);
check(order == std::vector<int>({0, 3, 6, 1, 2, 4, 5, 7}),
"a draft order takes every third frame first, then the rest");
std::vector<effector::Image> drafted(8);
const int draftHanded = effector::renderFrames(
chain, sources, 80, 48, 21, {}, video,
[&](int index, effector::Image&& frame) {
drafted[static_cast<std::size_t>(index)] = std::move(frame);
return true;
},
order);
bool sameClip = draftHanded == 8;
for (std::size_t i = 0; sameClip && i < first.size(); ++i) {
sameClip = sameBytes(first[i], drafted[i]);
}
check(sameClip, "a clip rendered draft first holds exactly the same frames");
chain[1].enabled = false;
std::vector<effector::Image> skipped;
effector::renderFrames(chain, sources, 80, 48, 21, {}, video,