Skip to content

feat(slitscan0r): add slit scan filter with Scan and Stargate modes - #321

Merged
jaromil merged 3 commits into
dyne:masterfrom
phoebus-84:claude/slitscan0r
Nov 5, 2026
Merged

jaromil merged 3 commits into
dyne:masterfrom
phoebus-84:claude/slitscan0r

Conversation

@phoebus-84

@phoebus-84 phoebus-84 commented Nov 4, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds slitscan0r, a slit scan filter. Every frame contributes only the pixels under a thin slit, and the slits of consecutive frames are laid side by side, so one axis of the image becomes time. frei0r had no slit scan so far, and as far as I could find neither FFmpeg nor MLT ships one, so this makes the effect available to all frei0r hosts.

Two compositions share the same slit history:

  • Scan: the classic slit scan / photo-finish image. The newest slit enters at one edge and older slits scroll towards the other.
  • Stargate: the slit history is projected onto two walls (left/right for a vertical slit, floor/ceiling for a horizontal one) receding to a vanishing point. New slits appear in the distance and flow outwards. This mode is inspired by Douglas Trumbull's slit-scan photography for the Star Gate sequence of 2001: A Space Odyssey: The Making of 2001's Star Gate Sequence (Smithsonian National Air and Space Museum).

Preview

Rendered from an FFmpeg testsrc2 pattern (rotating, hue-shifting) at 640x360, frame at 5.5 s. Top: source, Scan. Bottom: Stargate with a vertical slit, Stargate with a horizontal slit.

sheet

Stargate with a horizontal slit (frei0r=slitscan0r:1|0.5|n|0.05|n|0.4|0.8):

stargate_h.mp4

Parameters

Name Type Default Meaning
Mode double 0 < 0.5 Scan, >= 0.5 Stargate
Position double 0.5 position of the slit across the input
Vertical bool true sample a column instead of a row; changing it restarts the image
Width double 0 slit width, 1–64 px: how far the image advances per frame
Reverse bool false Scan: new slits enter at the left/top edge; Stargate: slits flow inwards
Depth double 0.25 Stargate: how far the tunnel reaches (size of the dark hole in the middle)
Fade double 1 Stargate: darken the walls with distance, as in a long exposure

Parameters are stored as set, so they read back unchanged; values are clamped to [0, 1] and NaN is treated as 0.

Design notes

  • Plain C on the frei0r.h API, following the structure of harris0r.
  • Memory: the history is exactly one frame of slits (width * height pixels, ~8 MiB at 1080p), allocated in f0r_construct with overflow checks; construction returns NULL on failure. Rendering never allocates.
  • The history is seeded with the first frame, so the output starts as the input and the slit image builds over it. It restarts when time goes backwards (seeking) or the orientation changes. Switching Mode does not restart: both modes read the same history. Repeated timestamps rerender the existing history without advancing it, including when Mode or Fade changes.
  • Input is fully read before output is written, so in-place rendering is safe.
  • delaygrab belongs to the related "time displacement" family (each block from a different past frame) but keeps a fixed 71-frame queue and exposes no parameters, so this is a separate plugin rather than an extension of it.

Tests

test/slitscan0r-contract.c compiles the plugin with injectable allocators (same approach as harris0r-contract) and checks:

  • metadata, parameter defaults, round trip, clamping and NaN;
  • invalid sizes and allocation failures at construction;
  • the Scan image against an independent scrolling model: both orientations, reversed, multi-pixel and clamped slits, in place and out of place, including frames rendered in Stargate mode in between;
  • restarts on backward seeks and orientation changes;
  • paused redraws and Mode/Fade changes against playback without duplicate calls, in both orientations and directions, including in-place rendering;
  • Stargate symmetry, the opaque black hole, flow direction with and without Reverse, and Fade.

Locally: full ctest 183/183, the contract test clean under ASan/UBSan, cpplint clean with the CI filter. Also tested on real footage with ffplay -vf frei0r=slitscan0r:... on macOS.

phoebus-84 and others added 2 commits November 4, 2026 19:02
Every frame contributes only the pixels under a thin slit, and the
slits of consecutive frames are laid side by side so that one axis of
the image becomes time.

Scan shows the classic slit scan / photo-finish image. Stargate
projects the same slit history onto two walls receding to a vanishing
point, recalling the slit-scan photography of the Star Gate sequence
in "2001: A Space Odyssey".

Parameters: Mode, Position, Vertical, Width (1-64 px per frame),
Reverse, and for Stargate Depth and Fade. The history is exactly one
frame of slits, allocated at construction, so rendering never
allocates; it is seeded from the first frame and restarts when time
goes backwards or the orientation changes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XnoxvoRbSLkQ3sTCkxgiyi
Check metadata, parameter defaults, round trip and clamping, invalid
sizes and allocation failures at construction, the Scan image against
an independent scrolling model (both orientations, reversed, wide and
clamped slits, in place and out of place, across Stargate frames),
restarts on backward seeks and orientation changes, and the symmetry,
black hole, flow direction and fade of the Stargate projection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XnoxvoRbSLkQ3sTCkxgiyi
jaromil
jaromil previously requested changes Nov 5, 2026

@jaromil jaromil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found one reproducible temporal-state issue: re-rendering the same application timestamp advances the slit history, changing both the paused image and later output. Please avoid advancing history for repeated timestamps and add coverage for this case.

Validation at d959c0a: the native slitscan0r smoke test, slitscan0r-contract, and bundle-classification-coverage all passed; slitscan0r-contract also passed under combined AddressSanitizer/UndefinedBehaviorSanitizer. The new filter is correctly classified and selected by the core bundle. The duplicate-timestamp reproducer used the actual built module through its exported C API.

Comment thread src/filter/slitscan0r/slitscan0r.c Resolved
Push a new slit only when the application timestamp advances. Repeated timestamps still render the current history so Mode and Fade changes remain visible.

Compare playback with and without duplicate renders across both orientations, both directions, in-place updates, and changes between Scan and Stargate projections.
@jaromil
jaromil merged commit f49627b into dyne:master Nov 5, 2026
9 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