Files
filmcraft/crates/render
Romain PINSOLLE 85448940ef render: turn display-rotated video on the GPU (#3467) (#3484)
* render: turn display-rotated video on the GPU (#3467)

A portrait phone clip (4K60 HEVC with a 90° display matrix) dropped ~97 %
of its frames: every decoded 4K frame was turned on the CPU, which is too
slow at 60 fps, and with the GOP cache's lock held.

- GopCache caches decoded frames raw when they need a crop or a rotation;
  `frame_late` crops and turns them off the lock, and the new
  `frame_late_unturned` hands them over as decoded with the quarter turns
  still to apply.
- MediaSource gains `video_frame_unturned` (default: the upright frame, 0
  turns). MP4 and Matroska implement it; the pool's wrapping sources and
  the frame server's timed source pass it on.
- The render plan folds the turns into the layer matrix of plain layers,
  and into the GPU effect stage (`LayerFx::turns`): `fs_fx_source` reads
  the source on its decimated grid through the turn, and the CPU reference
  decimates then turns, so effects still see the upright picture.

Other paths (CPU-only effects, log media, a clean aperture, export) still
turn on the CPU as before.

* codecs: cache intra-only frames raw too (#3467)

Intra-only decoders (ProRes, DNx) cropped and turned every frame before
caching it, so frame_late_unturned found it already turned and the GPU
had nothing left to do. Their frames are now cached raw like long-GOP
output: frame_late still crops and turns them off the lock, and
frame_late_unturned hands them over as decoded.

* docs: document the unturned-frame entry points (#3467)

* codecs: follow main's frame lookup in the unturned paths (#3467)

main changed `from_tick` (Matroska) to take the frame rate and `snap`, and
MP4 looks frames up with `lookup_time(.., rate, snap)`. `video_frame_unturned`
still used the old calls: the Matroska one no longer compiled, and the MP4 one
could pick another sample than `video_frame` when `snap` is on. Both now use
the same lookup as their `video_frame`.

Also repairs the merge of main into this branch: a closing brace was lost in
the #3467 test (the test module did not compile) and a blank line was doubled
(cargo fmt --check failed).

* codecs: test every display turn, crop with turn, drafts and eviction of raw frames

* gpu: give the neutral-corrector test LayerFx its turns field

Merging main added a LayerFx initializer without the turns field, which
breaks compilation of the gpu tests (E0063).
2026-11-05 03:19:24 +01:00
..