Repository navigation
fix: count every per-frame stage in the overall render progress - #42
Merged
Merged
Conversation
The overall budget was len(timestamps) * 2 while a render runs three per-frame stages. Segmentation filled the first half, encode the second, and post-process reported nothing at all: it published its own stage progress but left the overall figure untouched. The dialog derives both the frame rate and the remaining time from that figure, so both froze with it. The reporter measured 23:47 remaining, unchanged across 72 seconds, while about 18 seconds of work were left. Two things the transform stage changed since the issue was filed make a single multiplier wrong in any case. The rebuild path reaches the same code without ever setting an overall context, so its counter was empty through post-process and then started a fresh scale at encode; that is now the common path, because rebuilding is what a transform edit does. And post-process stages only the kept frames, so after a trim the three stages have different lengths. The budget is therefore computed from the work the job will do: timestamps plus twice the kept count for a render, twice the kept count for a rebuild, with each stage occupying its own share. Auto-fit still reports the encode stage as indeterminate, since the number of attempts is unknown. Deliberately not weighting the stages by their measured rates. The defect is a counter that stops and an estimate that stops being recomputed; honest counting fixes both, and an imprecise estimate is a smaller, separate question best answered with numbers from the fixed build. Closes #23 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #23
Summary
The overall progress budget was
len(timestamps) * 2while a render runs three per-frame stages. Segmentation filled the first half, encode the second, and post-process reported nothing: it published its own stage progress but left the overall figure untouched. The dialog derives both the frame rate and the remaining time from that figure (ui/source_presentation.py:99-100,remaining = total - completedover a rate sampled from the same counter), so both froze with it. The reporter measured 23:47 remaining, unchanged across 72 seconds, with roughly 18 seconds of work left.What #27 changed about the fix
Two things make a single multiplier wrong regardless of whether it is two or three.
_encode_snapshotis reached fromrender()and fromrebuild(), andrebuild()never set an overall context, so the counter was empty through the whole post-process stage and the encode stage then started a fresh0..frame_countscale — the bar jumped from nothing to a new maximum mid-job. Since the transform stage exists to make the cheap re-encode the normal path, that is now the progress users see most often.transform_stage.stage_encoder_framesstages onlytransform.kept_range(frame_count), so after a trim segmentation runs over the full grid while post-process and encode run over the kept frames.The budget
timestamps + 2 × kept2 × keptmax_bytes)Observed streams: a two-frame render publishes
1, 2, 2, 3, 4, 4, 6, 6against a total of 6; a two-frame rebuild publishes1, 2, 2, 4, 4against 4. Non-decreasing, and exactly at the total when the job ends.Deliberately not done
The issue's closing note suggests weighting the stages, since they run at roughly 0.7, 5.3 and 1 frames per second. Not taken here: the measured defect is a counter that stops and an estimate that stops being recomputed, and honest unit counting fixes both. An estimate that is imprecise because the stages differ in rate is a smaller, separate question, and better answered with numbers from the fixed build than guessed at now.
jobs/render.pyshrinks from 2938 to 2871 lines in the baseline.Test plan
uv run ruff check . && uv run mypy src && QT_QPA_PLATFORM=offscreen uv run pytest -q: 1781 passed, 4 skipped.ProgressEventstream for a full render, a trimmed render, a transform rebuild, and an auto-fit render, plus the framing helper in isolation.🤖 Generated with Claude Code