Skip to content

Perf/performance improvements#8

Merged
epalosh merged 3 commits into
mainfrom
perf/performance-improvements
May 29, 2026
Merged

Perf/performance improvements#8
epalosh merged 3 commits into
mainfrom
perf/performance-improvements

Conversation

@epalosh

@epalosh epalosh commented May 29, 2026

Copy link
Copy Markdown
Owner

[0.2.0] — Head-tracking feel + game-contention performance

Added

  • Global hotkey (default F10) to toggle inference on/off entirely.
    Disabling stops MediaPipe (frees CPU) and snaps the in-game view to
    center; re-enabling resumes from the last calibration (no recenter).
    Rebindable in Settings → Hotkeys.
  • Pause preview button — stops the camera-preview rendering (a
    diagnostic to measure its CPU cost) while tracking and the fps/inference
    readout keep running.
  • CPU-contention controls so tracking holds up while a game saturates the
    CPU:
    • Window-visibility gating — preview frames + pose updates are skipped
      while the window is minimized / hidden to tray (tracking + game output
      continue).
    • OpenCV thread-pool cap (default 2) on the per-frame cvtColor / resize /
      decode work.
    • Optional Reserve CPU cores mode (Settings → Performance) pinning the
      process to the top logical CPUs so MediaPipe stays off the game's
      cores. Off by default; experimental.

Changed

  • Default yaw mapping is now the soft-center curve at 3x sensitivity
    (fine control near forward view, fast swing to the apex). Pitch and roll
    keep the gentle linear default.
  • Sensitivity sliders now range 0–5x (was 0–3x).
  • Settings → Performance simplified — the raw "inference downscale" spinbox
    is gone (driven by the preset), and the OpenCV thread cap is not
    surfaced.
  • Camera preview shows an explicit "tracking disabled" banner when
    inference is toggled off, instead of the misleading "no face detected".
  • Reworded a setup-wizard tip ("Constant motion can be disorienting!").

Fixed

  • Process priority was never actually raised to HIGH on 64-bit Windows —
    the ctypes SetPriorityClass call mis-marshalled the process handle
    and failed silently. Now set via psutil, so OpenFOV runs at HIGH and
    stops losing scheduler contests with the game's render thread.
  • Shutdown crash ('Event' object is not callable): the camera-reader
    thread's stop Event shadowed threading.Thread._stop, so every exit
    threw and skipped pipeline cleanup. Renamed the attribute.

Packaging

  • Bundle MediaPipe's libmediapipe.dll (~27 MB). It's loaded via dlopen
    at runtime, so Nuitka never saw it and --include-package-data skips
    DLLs — the standalone imported MediaPipe fine but the tracker failed to
    initialize ("Could not find module libmediapipe.dll").
  • Bundle NPClient64.dll + TrackIR.exe. Nuitka's --include-data-dir
    silently skips .dll/.exe, so the installed app couldn't deliver
    tracking to iRacing (the registry pointed at a missing DLL).
  • bundled_bin_dir() now detects a Nuitka build (__compiled__) so it
    resolves <exe>/resources/bin instead of over-shooting to dist/.
  • Installer output renamed to OpenFOV-<ver>-setup.exe to match the
    release workflow, the winget manifest, and the docs.

Tests

  • Full suite: 158/158 passing.

epalosh added 3 commits May 29, 2026 14:41
Added
- F10 hotkey to toggle inference on/off: disabling stops MediaPipe (frees
  CPU) and centers the in-game view; re-enabling resumes from the last
  calibration (no recenter). Rebindable in Settings > Hotkeys.
- "Pause preview" button to measure the preview's CPU cost while tracking
  and the fps/inference readout keep running.
- Anti-contention controls: skip preview/pose emits while minimized; cap
  OpenCV's thread pool (default 2); optional "Reserve CPU cores" affinity
  mode (off by default, experimental).

Changed
- Default yaw: soft-center curve at 3x sensitivity; sensitivity sliders
  now span 0-5x.
- Settings > Performance simplified (inference-downscale spinbox removed,
  driven by the preset; thread cap not surfaced).
- Preview shows an explicit "tracking disabled" banner when toggled off
  instead of "no face detected". Reworded a wizard tip.

Fixed
- HIGH process priority never applied on 64-bit Windows (untyped ctypes
  SetPriorityClass mis-marshalled the handle); now set via psutil.
- Shutdown crash: the camera-reader's stop Event shadowed
  threading.Thread._stop, throwing on every exit and skipping cleanup.

Packaging (standalone was broken without these; caught by running the exe)
- Bundle mediapipe's libmediapipe.dll: dlopen'd at runtime so Nuitka never
  bundled it -> tracker init failed in the standalone.
- Bundle NPClient64.dll + TrackIR.exe: Nuitka's --include-data-dir skips
  binaries, so the installed app couldn't deliver tracking to iRacing.
- bundled_bin_dir(): detect Nuitka (__compiled__) so it resolves
  <exe>/resources/bin instead of over-shooting to dist/.
- Bump version to 0.2.0 (pyproject, __init__, build/installer defaults).

Validated: 158 tests pass, ruff clean, and a from-scratch local install
(uninstall + bare machine + fresh installer) runs end-to-end.
The .iss OutputBaseFilename produced -win-x64.exe, but release.yml,
build_installer.ps1, the README, and the winget manifest all expect
-setup.exe -- so the CI release's upload step (if-no-files-found: error)
would have failed to find the artifact. Align the .iss to -setup. Also
record the packaging fixes (libmediapipe + NPClient/TrackIR bundling,
bundled_bin_dir Nuitka detection) in the changelog.
Two issues that would break the tag-triggered release (never exercised
end-to-end before; v0.1.0 was built locally):

- release.yml invoked iscc directly, skipping the VC++ redist download.
  openfov.iss requires redist\vc_redist.x64.exe as a bundled source file
  (gitignored, ~25 MB), so ISCC would fail on the missing file. Now calls
  build_installer.ps1, which downloads the redist before compiling.
- npclient-vendor/build.ps1 hard-required the triplet-named
  x86_64-w64-mingw32-gcc, which local WinLibs provides but CI's
  `choco install mingw` does not (it exposes plain `gcc`). Falls back to
  `gcc` so the NPClient build works in both environments.
@epalosh epalosh merged commit d1fd215 into main May 29, 2026
2 checks passed
@epalosh epalosh deleted the perf/performance-improvements branch May 29, 2026 20:02
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.

1 participant