Managed WWXD-like scene-change detection for .NET 10, port from vapoursynth-wwxd.
vendor/vapoursynth-wwxd is a public submodule used by scripts/build_wwxdref.ps1 to build the optional WWXD reference DLL:
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build_wwxdref.ps1The NativeAOT export library is a file-based app in scripts/scenechange_native.cs:
dotnet publish scripts\scenechange_native.cs -c Release -r win-x64The exported ABI is intentionally small: API version, detector create/destroy, optional progress callback, direct write-buffer access, and commit. Detector creation takes only width and height; callers provide error buffers and own no returned allocations.
The native progress callback is synchronous and runs on the thread calling scenechange_wwxd_commit_written_frame_no_pad:
typedef int (*scenechange_progress_callback)(void* user_data, int processed_frames, int scene_change);
int scenechange_wwxd_set_progress_callback(
void* handle,
scenechange_progress_callback callback,
void* user_data,
char* error_buffer,
size_t error_buffer_size);Return 0 to continue. Return non-zero to request cancellation; commit returns 1 after writing the current frame result.
The callback pointer remains owned by the caller and must stay valid until it is replaced, cleared with NULL, or the detector is destroyed.
The CLI can decode through lsmasnative.dll and compare frame-level scene-change decisions against wwxdref.dll:
dotnet run -c Release --project src\SceneChange.Cli -- --verify-wwxdref --bench-wwxdref --max-frames 300 --wwxdref build-deps\wwxdref-win64\wwxdref.dll <video>Expected stderr includes mismatches=0.