Skip to content

feature: edgeDepth, smoothing and snapAbove added to PictureEffect - #149

Merged
ewowi merged 3 commits into
MoonModules:mainfrom
Gohnnyman:feat/border-sampling
Oct 19, 2026
Merged

ewowi merged 3 commits into
MoonModules:mainfrom
Gohnnyman:feat/border-sampling

Conversation

@Gohnnyman

Copy link
Copy Markdown
Contributor

What's new

Extends PictureEffect's area sampling with the border-strip part of #138.

  • edgeDepth — the outermost lights reach this far into the picture instead of their own sliver at the edge
  • smoothing — each light eases toward its new colour over several pictures, which settles a noisy source
  • snapAbove — a move bigger than this lands whole, so a cut stays a cut
  • 5 tests on top of the existing 6: the depth, edgeDepth 0 as a no-op, exact convergence, a snapped cut, and no smoothing following tick-for-tick

Note

smoothing and snapAbove are almost no-op at this point as these settings could only be observed on dynamic changes.
Right now PictureService doesn't implement Video/USB MJPEG source, but when It'll be added, these setting will take effect

@coderabbitai

coderabbitai Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: MoonModules/MoonLight/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 24785836-9985-478e-a033-d7f58b0ab8a9

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ewowi

ewowi commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator

Hi @Gohnnyman, thanks, this is exactly the shape we hoped for: one topic, two files, on main, and five tests that read as what the controls do. The edge depth on the existing area ranges, and the 8.8 state that keeps fractions of a step between pictures, are both nicely done.

Your branch allows maintainer edits, so we'll add one commit for the remaining points and merge:

  1. Smoothing by time, not by tick. While a light is still easing, the effect redraws every render tick, so the easing advances per tick rather than per picture. A 30 fps capture on a 100 fps render then settles three times faster than on a 30 fps render. We'll make it the textbook exponential smoothing: a half-life in milliseconds, scaled by the time since the last frame, so it settles at the same speed on every source and every board.
  2. edgeDepth's help says a deeper edge "costs reads in proportion", but the area average samples each light at a stride (about 16 reads), so it costs about the same. We'll correct the line.
  3. American spelling: "colour" becomes "color" in the help and the test comment.
  4. Credit: "Hyperion samples ~8%" moves into the header as prior art.

One thing for later, on our side: the smoothing state is sized per grid cell, so a backlight frame keeps state for the empty middle too. Sizing it by the lit lights needs a list of a layer's lit cells, which is core work of ours.

As you noted, smoothing and snapAbove only show their worth on a moving source, so the natural next step is the USB capture from #139: a fresh PR on main that adds the grabber as a PictureService source, with the points from our earlier comment (Teensy stubs, no 3 s freeze without a grabber, the USB tasks on core 1, the UVC header length from its flags, the flash cost measured, mm::formatTo). Then #139 can close.

Thanks again!

The smoothing eases each light by time rather than by tick, so it settles at the same speed whatever the source's frame rate or the board's.

**Light domain**
- `smoothing` is a half-life (20 ms to about 4 s): each tick measures the time since the last, and `easeToward` applies `halfLifeKeep`; a step below one 8.8 count still moves one, so a light arrives.
- The edge reach is its own step, `reachEdge`, which keeps `fillRanges` within the complexity limit.
- The help: edgeDepth's no longer says a deeper edge costs more reads (an area is sampled at a stride) and credits Hyperion's 8%; American spelling; the control lines and guides within the catalog's 80 characters and 40 words.

**Tests**
- One half-life closes half the gap, ten short steps land where one long step does, and a light arrives exactly while no time passed moves nothing.

**Docs/CI**
- `help.json` regenerated for the new control lines.

Checks: build_desktop and --tests, test_desktop (2586), check_code --module PictureEffect (0 findings), check_docgen (0 errors), check_prose, check_specs pass. The generated metrics stay out, as the contribution rules ask.

**Reviews**
- 🧑 ewowi on MoonModules#149: smoothing by time, the edgeDepth help, the spelling, the Hyperion credit → done in this commit.
@ewowi
ewowi merged commit ee5801c into MoonModules:main Oct 19, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants