Repository navigation
Keep the shape when compressing a curve, so a step is not a ramp - #8
Merged
Merged
Conversation
compress() dropped a point when it was within --threshold of the last kept
one. That is the right rule for noticing a change and the wrong one for a
series read back by interpolation: a long flat stretch was dropped whole, so
nothing held the flat value just before a step and the reader slid all the way
from the last kept point up to it.
hack/windramp.py is the smallest case. A hundred seconds of silence then a
four second gust at 0.55: 496 frames became 4 points, and a fan that should
have blown for four seconds blew for ninety-four, reaching half power a full
minute before anything happened.
A point kept because it differs now brings the frame before it along, at the
old value. The reader holds flat and steps, which is what the samples said. A
curve that genuinely ramps is untouched, because there the frame before was
itself kept and there is nothing to add. scenes.snap has done exactly this at
scene cuts since it was written, for exactly this reason; it could only ever
help where a change landed on a cut, and a cue starting or a gust ending
rarely does.
Four tests, and they ask a different question from the four that were already
there. Those asked which points were kept. These read the curve back through
the interpolation a fan actually experiences, which is how a four second gust
came to blow for ninety-four seconds without a single test noticing.
Measured on the same fifteen minutes, four builds, identical arguments but for
the two variables:
vision, old compressor, no gate silent 24.1% 1386 points
vision, fixed, no gate silent 28.2% 2021 points
vision, fixed, gate 0.25 silent 59.1% 947 points
The two changes only work as a pair. The gate alone did nothing, because the
compressor put back every silence it created; the compressor alone does little,
because without the gate the curve has few hard steps to preserve. Together
they are the difference between a fan that is on for three quarters of a film
and one that is on for two fifths.
Size is not the worry it looked like. More points where there are steps, 46
per cent on this cut without the gate, and fewer with it: 947 against 1386,
because a gate makes long silences that compress to almost nothing.
Co-Authored-By: Claude Opus 5 <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.
compress()dropped a point when it was within--thresholdof the last kept one. That is the right rule for noticing a change and the wrong one for a series read back by interpolation: a long flat stretch was dropped whole, so nothing held the flat value just before a step, and the reader slid all the way from the last kept point up to it.hack/windramp.pyis the smallest case. A hundred seconds of silence, then a four-second gust at 0.55:At second 50 the score says
0.0and the fan reads0.275.A point kept because it differs now brings the frame before it along, at the old value. The reader holds flat and steps, which is what the samples said. A curve that genuinely ramps is untouched: there the frame before was itself kept, and there is nothing to add.
scenes.snaphas done exactly this at scene cuts since it was written, for exactly this reason — it could only ever help where a change landed on a cut, and a cue starting or a gust ending rarely does.Measured
Same fifteen minutes, four builds, identical arguments but for the two variables:
The two changes only work as a pair. The gate alone did nothing, because the compressor put back every silence it created. The compressor alone does little, because without the gate the curve has few hard steps to preserve. Together they are the difference between a fan on for three quarters of a film and one on for two fifths — and 59.1% is what the offline simulation predicted (59.3%) before either landed.
Size is not the worry it looked like: more points where there are steps, +46% on this cut without the gate, and fewer with it (947 against 1386), because a gate makes long silences that compress to almost nothing.
Tests
Four new ones, asking a different question from the four that were already there. Those asked which points were kept. These read the curve back through the interpolation a fan actually experiences — which is how a four-second gust came to blow for ninety-four seconds without a single test noticing. Mutation-checked against the old rule.
329 composer tests, 758 unit, 18 browser.
🤖 Generated with Claude Code