Skip to content

A 60-picture nn::codec movie holds the frame step at 60, so a 30 fps cap no longer plays Ocarina of Time's movies at half speed - #2622

Closed
AdyaGMD wants to merge 1 commit into
seedds:mainfrom
AdyaGMD:oot-movie-speed
Closed

AdyaGMD wants to merge 1 commit into
seedds:mainfrom
AdyaGMD:oot-movie-speed

Conversation

@AdyaGMD

@AdyaGMD AdyaGMD commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

What

Ocarina of Time's title and opening movies are AV1 streams of 60 pictures a second, decoded through nn::codec. Its player takes one picture per game frame. With DM_FPS_TARGET=30 the frame step held 30, so the movie got 30 pictures a second and played at half speed.

nn::movie's decoders already report a playing movie (hle_movie.c dm_movie_playing, which holds 30 for players paced for the Switch's 30). nn::codec's decoders didn't.

  • hle_codec_video.c keeps the picture rate of a video that is handing out pictures (dm_codec_movie_hz, from the pictures' time stamps). Half a second without a picture ends it.
  • fps_step_cap (hle_nvn.c) holds 60 while that rate is 50 or more, unless the thermal cap is on.

Measured

Ocarina of Time (0400486024DEC000), MacBook M1 (8-core GPU), from an empty save into the opening movie, with a temporary log of each picture's stream time against the clock:

Cap Before After
DM_FPS_TARGET=30 2 s of movie per 4 s (0.5x) frame step 30 → 60 while it plays, p50 16.7 ms

On the M1 the movie frame only fits in 16.7 ms with the movie enhancement network left out (#1953, which now also skips the NDVE engine's network there). With the network on, an M1 can't hold 60, so its movies stay slow. Faster Macs get the movie's speed back from this PR alone.

Not run

  • Measured in a tree with Movie enhancement setting: leave out nn::movie's NDVE network #1953 and other local changes, not on this branch alone. The host compiles on this branch.
  • Any test suite.
  • iPhone.
  • Other games with nn::codec movies. A 30-picture stream keeps the cap as it is.
  • Checking that the cap drops back to 30 after the movie ends (by the code, half a second after the last picture).

🤖 Generated with Claude Code

…cap no longer plays Ocarina of Time's movies at half speed

Ocarina of Time's title and opening movies are AV1 streams of 60 pictures a second, decoded through
nn::codec, and its player takes one picture per game frame. At DM_FPS_TARGET=30 the frame step held 30,
so the movie got 30 pictures a second: 2 s of movie in 4 s (measured from the pictures' times against
the clock). nn::movie's decoders already set the movie state (hle_movie.c dm_movie_playing, which holds
30 for players paced for the Switch's 30); nn::codec's did not.

hle_codec_video.c now keeps the picture rate of a video handing out pictures (dm_codec_movie_hz, from
the pictures' time stamps; half a second without one ends it), and fps_step_cap holds 60 while it is 50
or more, unless the thermal cap is on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added host The Horizon host: SVCs, services, threads, memory (dm/host) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) labels Nov 14, 2026
gnosticgeek pushed a commit to gnosticgeek/nxforge that referenced this pull request Nov 14, 2026
…rly (patches 0022-0024)

Ocarina movies at a 30 fps cap, prewarm pipelines kept at quit, Mario
Kart World 1.8.0 build row. seedds#2625's test Makefile line rebased onto the
pinned engine (no t_wline there).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016qteK4T7SLBnbRPXQUVaNR
seedds added a commit that referenced this pull request Nov 14, 2026
…nn::codec's movies included (PR #2622)

Ocarina of Time's title and opening movies are AV1 at 60 pictures a second through nn::codec, and its player
takes one picture per game frame. nn::codec's decoders never reached the frame step, so at a 30 fps cap
(DM_FPS_TARGET=30) the movies played at half speed. nn::movie's decoders held a fixed 30, right for Breath of
the Wild's 30-picture movies, wrong for a 60-picture one.

Both libraries now report each picture they hand out with its time (dm_movie_picture). Each decoder keeps its
own slot: its rate over its last 8 pictures (Ocarina's times are whole milliseconds, so one gap reads 59 or 63)
and when it last handed one out. dm_movie_hz is the fastest rate among decoders that handed out a picture in the
last 0.5 s. A Stop or Finalize ends a decoder's movie at once; a Flush keeps it. Times that give no rate count
as 30 after three pictures for nn::movie (the old rule) and not at all for nn::codec. fps_step_cap holds 60 for
a movie of 50 pictures a second or more and 30 for a slower one, whatever the target, with the thermal cap
first; the 120 fps cap and the state page's movie flag take every movie. Every 600 pictures a decoder logs how
much of its stream it handed out in how much time.

Measured on an M6 Mac at DM_FPS_TARGET=30, from an empty save into the opening movie, against the same tree
without the rule: 10 s of movie took 20.0-24.2 s before and 10.0-10.4 s after; the cap returns to 30 at the
present after the title's decoder is finalized (title -> Continue). Unit tests: t_movie_vpx, t_codec_video,
t_thermal (+ tsan), t_nvn, t_fstep. Not run: Breath of the Wild, Tears of the Kingdom, Fire Emblem Fortune's
Weave at 120 fps, Mario Kart World, the iPhone; regress.py (its routes run at 60, where nothing changes).

Co-authored-by: Adya <114347520+AdyaGMD@users.noreply.github.com>
@seedds

seedds commented Nov 14, 2026

Copy link
Copy Markdown
Owner

Thanks: the diagnosis was right and it landed on main as 9f824c7, reworked, with you credited as co-author.

What changed from this PR:

  • One movie signal for both libraries. nn::movie held a fixed 30 and nn::codec 60 at 50 or more, through two separate paths. Now both report each picture they hand out with its time (dm_movie_picture in hle_movie.c), and the frame step follows the playing movie's rate: 60 for 50 pictures a second or more, 30 below, whatever the target, with the thermal cap first. The 120 fps cap and the state page's movie flag see nn::codec movies too.
  • Per decoder. The PR kept one static int64_t last for every decoder, written from each decoder's thread. Each decoder now has its own slot, and the rate is the fastest live one.
  • The rate is taken over 8 pictures. Ocarina's picture times are whole milliseconds, so a single gap reads 59 or 63.
  • A Stop or Finalize ends the movie at once. A Flush keeps it. Before, only the 0.5 s timeout ended it.
  • A pace line every 600 pictures: [movie] nn::codec decoder …: 10.00 s of pictures in 10.02 s.

Measured on its own branch (M6 Mac, DM_FPS_TARGET=30, empty save into the opening movie, A/B against the same tree without the rule): 10 s of movie took 20.0-24.2 s before and 10.0-10.4 s after. The cap goes back to 30 at the first present after the title's decoder is finalized. The opening's story section is also 60 pictures a second, so it plays at full speed too.

Still open, as you noted: where frames can't hold 60 (an M1 with the movie network on), the frame step drops to 30 for the late frames and the movies still play slowly. Only stepping pictures in the player itself (main+0x3b61ea0) would cover that.

@seedds seedds closed this Nov 14, 2026
cheemu21 added a commit to cheemu21/kid-with-sword-remake that referenced this pull request Nov 16, 2026
…nxnative PR seedds#2622)

Cherry-picked from nxnative 9f824c7. Ocarina of Time's title and opening movies are AV1 at
60 pictures a second through nn::codec, and the player takes one picture per game frame, so at
a 30 fps cap they played at half speed. The frame step now holds 60 while a 60-picture movie
plays and returns to the cap when it ends.

Adapted to this branch's nn::codec decoder, which decodes on submission (upstream's decodes on
a thread of its own): drain reports each picture it hands out (dm_movie_picture), Finalize and
Stop end the movie (dm_movie_stopped), Flush keeps it. The decoder's unit test keeps this
branch's flush check and gains the movie-rate check.

Checked on an M5 Mac at DM_FPS_TARGET=30: "frame step cap 30 -> 60 fps (a movie of 59 pictures
a second)", 10.00 s of pictures in 10.25 s (about 20 s before). t_codec_video, t_movie_vpx,
t_fstep (80 checks) and t_thermal (26 checks) pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

host The Horizon host: SVCs, services, threads, memory (dm/host) nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants