diff --git a/CLAUDE.md b/CLAUDE.md index 0232f646..d9f9a5a2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -3381,6 +3381,52 @@ x86_64 build is git-18a9cecb, pre-r31, which is what deps ≤ 1.16.0 shipped chroma placement by its pixels on every platform; it skips only on a macOS x64 bundle at 1.16.0 or older, the known skew. +### FFT3DFilter: built from source with our determinism patch (task #62) + +Every published FFT3DFilter build (myrsloik's R1/R2 releases, yuygfgg's +macOS arm64 prebuilt, upstream HEAD, the AmusementClub fork) gives a +**different output on every run**, so the Noise Reduction FFT3DFilter method, +TemporalDegrain2 (its spatial pass at every setting, and its post pass) and +QTGMC's `Denoiser='fft3dfilter'` never previewed exactly what they encoded. +Two faults, both fixed by `Scripts/patches/fft3dfilter-r2-determinism.patch`: + +- **The left border was mirrored before the source line was copied** + (`FramePlaneToCoverbuf`), so the left 10 luma / 6 chroma columns came from + the previous frame's pixels, or uninitialised memory. Upstream regression + da50417 (2018). +- **A per-frame Wiener sigma lived in a shared member** of a filter + registered `fmParallel`: an edge frame (`btcur` 1) could overwrite it while + a middle frame used it, filtering that frame at 1/bt of its sigma. Hit + whenever `bt > 1` with a single sigma (the FFT3D method, TD2's post pass, + QTGMC with NoiseTR > 0). + +Rules: + +- **Built from source at tag R2 on every platform, patched; never a + prebuilt.** `FFT3DFILTER_TAG` in `download-deps-{macos,linux}.sh` and + `$Fft3dTag` in `download-deps-windows.ps1` stay in step. macOS compiles the + four files directly (its meson.build can't find `fftw3f_threads` on arm64) + and links the bundle's own FFTW; Linux uses meson; Windows cross-compiles + with the Zig the script already pins, against FFTW 3.3.5's DLL through an + import library from its `.def`. All three **fail the build** if the patch + stops applying. Plain C++, so one build serves both x64 tiers. +- **Never `bt=0` (Kalman).** It carries state from frame to frame by design + (upstream says it is "broken due to non-linear access"), so it can never + preview what it encodes. `NoiseReductionParameters::fft3d_effective_bt` clamps to + 1..5 and no other call site passes 0; keep it that way. +- **FFTW plans are measured per process** (`measure=1`, the default). Seven + processes agreed on macOS arm64, and so does the push gate's second process + everywhere it runs; if one platform ever disagrees, pass `measure=0` + (FFTW_ESTIMATE) at our call sites and make it the plugin's default in the + patch (havsfunc's QTGMC call). +- `vapoursynth_integration_test.dart`'s `fft3dfilter is deterministic (task + #62)` (push gate) runs each argument class six times in fresh graphs at 8 + threads, compares a second process, and checks a flat picture stays flat at + the left edge; it skips on bundles up to 1.17.x. + `integration_fft3dfilter_determinism_test.dart` (heavy) checks that two + previews and the lossless encode agree sample for sample, for the FFT3D + method and TD2 with its post pass (docs/reports/task-62-fft3dfilter-determinism). + ## Debugging Tips 1. **Worker crashes**: Run worker standalone with `--config` to isolate @@ -3853,3 +3899,4 @@ Full write-ups (root causes, measurements) for each entry are in | 1.15.0 | 2026-11-03 | **Issue #144**: KNLMeansCL moves to Jaded Encoding Thaumaturgy's fork **v1.3** on every platform (Windows: PyPI wheel, replacing Khanattila's 2018 v1.1.1 zip, which refused 10-bit 4:2:0; macOS/Linux: the `v1.3` tag, replacing unpinned master, which gave unrepeatable results on Apple's OpenCL). Both meson patchers learn v1.3's assigned `run_command` include probe. Published as the tested `deps-v1.15.0-rc1` bundles with only the version changed | | 1.16.0 | 2026-11-09 | **vszip 22.1.0 → 24.0.0** on every platform (CPU `NLMeans` for Noise Reduction's NLMeans (CPU) and the vine dehalo; macOS x64 sdist now built with Zig 0.17.0). Adds **SangNom** r45 (PyPI wheels; MIT source, GPL-2.0 binaries) on every platform for Anti-aliasing's SangNom method. Both single-file on x64 (no AVX), so `_tierFiles` is unchanged. **rc2: the AI models leave the bundle** — RIFE 4.26's (now the `frame-rate-rife` add-on) and the Real-ESRGAN anime / Real-CUGAN ones (now `upscale-anime`); the plugins stay, and their probes run stand-in models. Published as the tested `deps-v1.16.0-rc2` bundles with only the version changed (`Scripts/promote-deps-rc.py`) | | 1.17.0 | rc1 2026-11-15, rc2 2026-11-16, rc3 2026-11-17 | **Task #36**: macOS arm64 libdvdread built from 6.1.3 source (patched to find a user's libdvdcss in `/opt/homebrew/lib`, `/usr/local/lib`, `/opt/local/lib`) instead of Homebrew's bottle, which linked `/opt/homebrew/opt/libdvdcss/…` and failed to load on Macs without it; macOS x64 gets the same patched build. Absolute build-machine rpaths stripped from libvapoursynth, vapoursynth.abi3.so, libfftw3f*, libboost_charconv, bm3d, dctfilter and mvtools (inert: nothing used `@rpath`). Windows and Linux binaries unchanged; libdvdread is now a required file on every platform. **rc2** (task #45): macOS x64 FFmpeg evermeet 9.0.1 → martin-riedl 9.0.2 (build 1789931006, pinned by SHA-256), which has SVT-AV1, so AV1 output works on Intel Macs; x264/x265/MP3 bitstreams change there, native codecs byte-identical. **rc3** (task #60): **Bifrost** v3.0 → **4.0** from its PyPI wheels on every platform (was the v3.0 tag's `bifrost.c` built from source on macOS/Linux, v3.0's 7z on Windows), under the same file names; v3.0 left chroma past the last whole 4x4 block uninitialised (different output run to run at width 98, 720x486), v4.0 initialises it and runs at 8–16 bits natively. No AVX, so `_tierFiles` unchanged | +| 1.18.0 | unreleased | **Task #62**: FFT3DFilter built from source at R2 with `patches/fft3dfilter-r2-determinism.patch` on every platform (Windows: Zig cross-compile replacing the R2 release DLL; macOS arm64: replacing yuygfgg's prebuilt), so its output no longer differs from run to run. One build for both x64 tiers; file names unchanged | diff --git a/Scripts/download-deps-linux.sh b/Scripts/download-deps-linux.sh index 1f4837db..e1145680 100755 --- a/Scripts/download-deps-linux.sh +++ b/Scripts/download-deps-linux.sh @@ -927,11 +927,20 @@ build_plugin "ttempsmooth" \ "libttempsmooth.so" \ "$PLUGIN_BUILD_ENV meson setup build --buildtype=release && ninja -C build" -# FFT3DFilter +# FFT3DFilter, pinned to R2 and patched with +# patches/fft3dfilter-r2-determinism.patch (task #62): every published build +# has two faults that make its output differ from run to run (the left border +# mirrored from the previous frame's pixels; a per-frame sigma in a shared +# member of a parallel filter), so a preview never matched its encode. The +# patch header has both. A patch that stops applying exits the script (the +# `exit` runs inside build_plugin's eval). Keep FFT3DFILTER_TAG in step with +# download-deps-macos.sh and download-deps-windows.ps1. +FFT3DFILTER_TAG="R2" build_plugin "fft3dfilter" \ "https://github.com/myrsloik/VapourSynth-FFT3DFilter.git" \ "libfft3dfilter.so" \ - "$PLUGIN_BUILD_ENV meson setup build --buildtype=release && ninja -C build" + "{ git apply \"$SCRIPT_DIR/patches/fft3dfilter-r2-determinism.patch\" || { echo ' ERROR: patches/fft3dfilter-r2-determinism.patch did not apply to FFT3DFilter $FFT3DFILTER_TAG.' >&2; exit 1; }; } && $PLUGIN_BUILD_ENV meson setup build --buildtype=release && ninja -C build" \ + "$FFT3DFILTER_TAG" # MiscFilters build_plugin "miscfilters" \ diff --git a/Scripts/download-deps-macos.sh b/Scripts/download-deps-macos.sh index b78bdf9b..4bd401fe 100755 --- a/Scripts/download-deps-macos.sh +++ b/Scripts/download-deps-macos.sh @@ -791,12 +791,6 @@ if [ "$ARCH" = "arm64" ]; then install_name_tool -id "@loader_path/libttempsmooth.dylib" "$PLUGINS_DIR/libttempsmooth.dylib" 2>/dev/null || true codesign -s - -f "$PLUGINS_DIR/libttempsmooth.dylib" 2>/dev/null - # FFT3DFilter (also used by MCTemporalDenoise; links FFTW like dfttest) - curl -sL "$YUYGFGG_BASE/lib/libfft3dfilter.dylib" -o "$PLUGINS_DIR/libfft3dfilter.dylib" - install_name_tool -change "@rpath/libfftw3f.3.dylib" "@loader_path/../../lib/libfftw3f.3.dylib" "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null || true - install_name_tool -change "@rpath/libfftw3f_threads.3.dylib" "@loader_path/../../lib/libfftw3f_threads.3.dylib" "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null || true - codesign -s - -f "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null - # VIVTC (inverse telecine - VFM + VDecimate) curl -sL "$YUYGFGG_BASE/lib/libvivtc.dylib" -o "$PLUGINS_DIR/libvivtc.dylib" install_name_tool -id "@loader_path/libvivtc.dylib" "$PLUGINS_DIR/libvivtc.dylib" @@ -1300,31 +1294,6 @@ PYEOF cd "$BUILD_DIR" fi - # fft3dfilter (meson; links Homebrew FFTW, repoint at the bundled lib/ copy). - # Also used by havsfunc MCTemporalDenoise. - if [ "$FORCE" = true ] || [ ! -f "$PLUGINS_DIR/libfft3dfilter.dylib" ]; then - echo ""; echo "=== Building FFT3DFilter (x86_64) ===" - rm -rf fft3dfilter - if git clone --depth 1 https://github.com/myrsloik/VapourSynth-FFT3DFilter.git fft3dfilter \ - && PKG_CONFIG_PATH="$VS_PC_DIR:$BREW_PREFIX/lib/pkgconfig:${PKG_CONFIG_PATH:-}" \ - meson setup fft3dfilter/build fft3dfilter --buildtype=release \ - && ninja -C fft3dfilter/build; then - lib=$(find fft3dfilter/build -name "*.dylib" -type f | head -1) - if [ -n "$lib" ]; then - cp "$lib" "$PLUGINS_DIR/libfft3dfilter.dylib" - install_name_tool -change "$BREW_PREFIX/opt/fftw/lib/libfftw3f.3.dylib" \ - "@loader_path/../../lib/libfftw3f.3.dylib" "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null || true - install_name_tool -change "$BREW_PREFIX/opt/fftw/lib/libfftw3f_threads.3.dylib" \ - "@loader_path/../../lib/libfftw3f_threads.3.dylib" "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null || true - codesign -s - -f "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null || true - echo " Built FFT3DFilter" - else echo " no dylib"; FAILED_PLUGINS+=("fft3dfilter"); fi - else - echo " Failed to build FFT3DFilter"; FAILED_PLUGINS+=("fft3dfilter") - fi - cd "$BUILD_DIR" - fi - # BM3D (core.bm3d - Noise Reduction's BM3D method). Stefan-Olt has no # current x86_64 build and the PyPI wheel is minos 15.0 (our floor is 12.0), # so build the same tag as arm64 from source. Its meson.build probes the host @@ -1466,18 +1435,6 @@ else echo " DFTTest: using pre-built ARM64 version from yuygfgg" fi -# FFT3DFilter -# On ARM64 we use the pre-built version from yuygfgg (downloaded above); its -# from-source build needs fftw3f_threads which isn't reliably discoverable here. -if [ "$ARCH" != "arm64" ]; then - build_plugin "fft3dfilter" \ - "https://github.com/myrsloik/VapourSynth-FFT3DFilter.git" \ - "libfft3dfilter.dylib" \ - "meson setup build --buildtype=release && ninja -C build" -else - echo " FFT3DFilter: using pre-built ARM64 version from yuygfgg" -fi - # MiscFilters build_plugin "miscfilters" \ "https://github.com/vapoursynth/vs-miscfilters-obsolete.git" \ @@ -1713,6 +1670,62 @@ else echo " fmtconv already exists, skipping" fi +# FFT3DFilter (core.fft3dfilter - Noise Reduction's FFT3DFilter method, +# TemporalDegrain2's spatial and post passes, QTGMC's Denoiser=fft3dfilter), +# built from source on BOTH arches at tag R2 with +# patches/fft3dfilter-r2-determinism.patch (task #62). Every published build, +# R2 included, has two faults that make its output differ from run to run, so +# a preview never matched its encode: the left border was mirrored from the +# previous frame's pixels, and a per-frame sigma lived in a shared member of a +# parallel filter. The patch header has both. Never take a prebuilt (arm64 had +# yuygfgg's, which has both faults). Keep FFT3DFILTER_TAG in step with +# download-deps-linux.sh and download-deps-windows.ps1. +# +# Compiled directly rather than through its meson.build, whose fftw3f_threads +# probe does not find the library on arm64: four .cpp files, upstream's own +# flags (release -O3, C++17, hidden visibility), FFTW's header from Homebrew, +# linked against the bundle's own lib/libfftw3f{,_threads}.3.dylib and then +# repointed at them through @loader_path. Plain C++ with no intrinsics, so one +# build serves both x64 tiers (no _tierFiles entry); MACOSX_DEPLOYMENT_TARGET +# (exported near the top) sets its minos. +FFT3DFILTER_TAG="R2" +cd "$BUILD_DIR" +if [ "$FORCE" = true ] || [ ! -f "$PLUGINS_DIR/libfft3dfilter.dylib" ]; then + echo "" + echo "=== Building FFT3DFilter ($FFT3DFILTER_TAG, patched) ===" + rm -rf fft3dfilter + git clone --depth 1 --branch "$FFT3DFILTER_TAG" -q \ + https://github.com/myrsloik/VapourSynth-FFT3DFilter.git fft3dfilter + (cd fft3dfilter && git apply "$SCRIPT_DIR/patches/fft3dfilter-r2-determinism.patch") || { + echo " ERROR: patches/fft3dfilter-r2-determinism.patch did not apply." >&2 + echo " FFT3DFilter $FFT3DFILTER_TAG may have changed upstream - re-check the patch." >&2 + exit 1 + } + FFTW_INC="$(brew --prefix fftw)/include" + if c++ -std=c++17 -O3 -fPIC -fvisibility=hidden -dynamiclib \ + -I"$VS_INC_DIR" -I"$FFTW_INC" \ + fft3dfilter/FFT3DFilter.cpp fft3dfilter/FFT3DFilterTransform.cpp \ + fft3dfilter/fft3dfilter_c.cpp fft3dfilter/Plugin.cpp \ + "$LIB_DIR/libfftw3f.3.dylib" "$LIB_DIR/libfftw3f_threads.3.dylib" \ + -install_name "@loader_path/libfft3dfilter.dylib" -headerpad_max_install_names \ + -o "$PLUGINS_DIR/libfft3dfilter.dylib"; then + # Whatever install name the bundled FFTW carries, point the plugin at + # the copy in deps//lib (two levels up from the plugin dir). + for ref in $(otool -L "$PLUGINS_DIR/libfft3dfilter.dylib" | awk 'NR > 1 && /libfftw3f/ {print $1}'); do + install_name_tool -change "$ref" "@loader_path/../../lib/$(basename "$ref")" \ + "$PLUGINS_DIR/libfft3dfilter.dylib" + done + codesign -s - -f "$PLUGINS_DIR/libfft3dfilter.dylib" 2>/dev/null || true + echo " Built FFT3DFilter -> libfft3dfilter.dylib" + BUILT_PLUGINS+=("fft3dfilter") + else + echo " Failed to build FFT3DFilter" + FAILED_PLUGINS+=("fft3dfilter") + fi +else + echo " FFT3DFilter already exists, skipping" +fi + # The three plugins below sit outside the arch split above, on BOTH arches. # They started inside its arm64 branch, where x64 never reached them and the # packaging guard failed on all three missing dylibs. x64 takes pre-built diff --git a/Scripts/download-deps-windows.ps1 b/Scripts/download-deps-windows.ps1 index dfc92bb5..6871736f 100644 --- a/Scripts/download-deps-windows.ps1 +++ b/Scripts/download-deps-windows.ps1 @@ -344,11 +344,6 @@ $Plugins7z = @( Url = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-CTMF/releases/download/r5/CTMF-r5.7z" Check = "CTMF.dll" }, - @{ - Name = "fft3dfilter" - Url = "https://github.com/myrsloik/VapourSynth-FFT3DFilter/releases/download/R2/FFT3DFilter-r2.7z" - Check = "fft3dfilter.dll" - }, @{ Name = "addgrain" Url = "https://github.com/HomeOfVapourSynthEvolution/VapourSynth-AddGrain/releases/download/r10/AddGrain-r10-win64.7z" @@ -430,6 +425,8 @@ $PluginsZip = @( # KNLMeansCL is NOT here: it is a PyPI wheel, see the wheel section below. # zsmooth is NOT here: which build ships depends on the CPU tier. See # section 4a below. + # FFT3DFilter is NOT here: it is built from source with a patch. See + # section 4b2 below. ) foreach ($Plugin in $Plugins7z) { @@ -673,6 +670,88 @@ if (-not (Test-Path $FFTWPath)) { Write-Host " FFTW library already installed" -ForegroundColor Gray } +# ============================================================================= +# 4b2. FFT3DFilter, built from source at R2 with VapourBox's patch (task #62) +# ============================================================================= +# Every published build of FFT3DFilter, R2's FFT3DFilter-r2.7z included, has +# two faults that make its output differ from run to run, so a preview never +# matched its encode: the left border was mirrored from the previous frame's +# pixels, and a per-frame sigma lived in a shared member of a parallel filter. +# patches/fft3dfilter-r2-determinism.patch fixes both (its header explains); +# download-deps-{macos,linux}.sh build the same tag with the same patch. Keep +# $Fft3dTag in step with them. +# +# Zig cross-compiles it as it does zsmooth's v2 build ($ZigVersion above), for +# both tiers: four C++ files with no intrinsics, at the x86-64 baseline, so one +# build serves both (no _tierFiles entry). It links FFTW 3.3.5's DLL (the one +# section 4b installs, which exports the threads API itself) through an import +# library made from that zip's .def, and takes VapourSynth's API4 headers from +# the R78 tag. Zig links its libc++ statically against the UCRT, so the DLL +# imports only libfftw3f-3.dll, KERNEL32 and api-ms-win-crt-*. Any failure +# throws: shipping without it removes three passes' denoiser. +Write-Host "" +Write-Host "[4b2/8] Building FFT3DFilter (patched)..." -ForegroundColor Yellow + +$Fft3dTag = "R2" +$Fft3dOut = "$PluginsDir\fft3dfilter.dll" +if (Test-Path $Fft3dOut) { + Write-Host " fft3dfilter.dll already installed" -ForegroundColor Gray +} else { + $Fft3dWork = Join-Path $TempDir "fft3dfilter-build" + Remove-Item $Fft3dWork -Recurse -Force -ErrorAction SilentlyContinue + New-Item -ItemType Directory -Path $Fft3dWork -Force | Out-Null + Push-Location $Fft3dWork + try { + $ZigZip = Join-Path $Fft3dWork "zig.zip" + Download-File -Url "https://ziglang.org/download/$ZigVersion/zig-x86_64-windows-$ZigVersion.zip" -OutFile $ZigZip + Expand-Archive -Path $ZigZip -DestinationPath (Join-Path $Fft3dWork "zig") -Force + $ZigExe = (Get-ChildItem -Path (Join-Path $Fft3dWork "zig") -Recurse -Filter "zig.exe" | Select-Object -First 1).FullName + if (-not $ZigExe) { throw "zig.exe not found in the toolchain archive" } + + # fftw3.h and libfftw3f-3.def for the import library. + $FftwZip = Join-Path $Fft3dWork "fftw.zip" + Download-File -Url "https://fftw.org/pub/fftw/fftw-3.3.5-dll64.zip" -OutFile $FftwZip + $FftwDir = Join-Path $Fft3dWork "fftw" + Expand-Archive -Path $FftwZip -DestinationPath $FftwDir -Force + + $VsInc = Join-Path $Fft3dWork "vsinc" + New-Item -ItemType Directory -Path $VsInc -Force | Out-Null + foreach ($Hdr in @("VapourSynth4.h", "VSHelper4.h", "VSConstants4.h")) { + Download-File -Url "https://raw.githubusercontent.com/vapoursynth/vapoursynth/$VSRelease/include/$Hdr" -OutFile (Join-Path $VsInc $Hdr) + } + + # LF on both sides: the runner's git may check out CRLF, and this repo's + # own copy of the patch is CRLF on a Windows checkout. + $Src = Join-Path $Fft3dWork "src" + & git -c advice.detachedHead=false -c core.autocrlf=false clone --quiet --depth 1 --branch $Fft3dTag https://github.com/myrsloik/VapourSynth-FFT3DFilter.git $Src + if ($LASTEXITCODE -ne 0) { throw "git clone of FFT3DFilter failed (exit $LASTEXITCODE)" } + $Patch = Join-Path $Fft3dWork "fft3dfilter.patch" + $PatchText = [IO.File]::ReadAllText((Join-Path $ScriptDir "patches\fft3dfilter-r2-determinism.patch")).Replace("`r`n", "`n") + [IO.File]::WriteAllText($Patch, $PatchText, (New-Object System.Text.UTF8Encoding($false))) + & git -C $Src apply $Patch + if ($LASTEXITCODE -ne 0) { + throw "patches/fft3dfilter-r2-determinism.patch did not apply to FFT3DFilter $Fft3dTag - re-check the patch" + } + + & $ZigExe dlltool -m i386:x86-64 -d (Join-Path $FftwDir "libfftw3f-3.def") -D libfftw3f-3.dll -l (Join-Path $Fft3dWork "libfftw3f-3.lib") + if ($LASTEXITCODE -ne 0) { throw "zig dlltool failed (exit $LASTEXITCODE)" } + + $Sources = @("FFT3DFilter.cpp", "FFT3DFilterTransform.cpp", "fft3dfilter_c.cpp", "Plugin.cpp") | ForEach-Object { Join-Path $Src $_ } + & $ZigExe c++ -target x86_64-windows-gnu -mcpu=x86_64 -shared -O3 -std=c++17 -fvisibility=hidden ` + "-I$VsInc" "-I$FftwDir" @Sources (Join-Path $Fft3dWork "libfftw3f-3.lib") -o (Join-Path $Fft3dWork "fft3dfilter.dll") + if ($LASTEXITCODE -ne 0) { throw "zig c++ failed (exit $LASTEXITCODE)" } + + Copy-Item (Join-Path $Fft3dWork "fft3dfilter.dll") $Fft3dOut -Force + Write-Host " Built: fft3dfilter.dll ($Fft3dTag, patched)" -ForegroundColor Gray + } finally { + Pop-Location + Remove-Item $Fft3dWork -Recurse -Force -ErrorAction SilentlyContinue + } +} +if (-not (Test-Path $Fft3dOut)) { + throw "fft3dfilter.dll is missing" +} + # ============================================================================= # 4c. libdvdread (required for DVD disc import) # ============================================================================= diff --git a/Scripts/patches/fft3dfilter-r2-determinism.patch b/Scripts/patches/fft3dfilter-r2-determinism.patch new file mode 100644 index 00000000..b3b84ca1 --- /dev/null +++ b/Scripts/patches/fft3dfilter-r2-determinism.patch @@ -0,0 +1,83 @@ +FFT3DFilter R2 (myrsloik/VapourSynth-FFT3DFilter, tag R2 = 50194b4): two +faults that make its output differ from run to run, so a preview never +matches the encode (VapourBox task #62, +docs/reports/task-62-fft3dfilter-determinism). + +1. FFT3DFilterTransform.cpp, FramePlaneToCoverbuf: each line of the padded + cover buffer mirrored its left border BEFORE copying the source line into + it, so the border was mirrored from the previous frame's pixels (or + uninitialised heap memory on the first frame). The left 10 luma / 6 chroma + columns depended on request order. Introduced upstream in da50417 + (2018-01-11, "Turn several functions into templates"); the 2015 original + copied the line first. Fixed in all three loops (progressive, both fields). + +2. FFT3DFilter.cpp, ApplyFilter / Wiener3D: the per-frame Wiener sigma was + written to the shared member sigmaSquaredNoiseNormed, but the filter is + fmParallel and the edge frames (btcur 1) write the 2D value while middle + frames write and read the 3D one (x bt). Two threads interleaving filtered + a middle frame at 1/bt of its sigma. Now a local in both functions. + +Applied by download-deps-{macos,linux}.sh and download-deps-windows.ps1 right +after the clone; each build fails if it stops applying. + +diff --git a/FFT3DFilter.cpp b/FFT3DFilter.cpp +index 7686e6a..e5dfdab 100644 +--- a/FFT3DFilter.cpp ++++ b/FFT3DFilter.cpp +@@ -303,6 +303,7 @@ void FFT3DFilter::Wiener3D + VSFrameContext *frame_ctx, + const VSAPI *vsapi + ) { ++ const float sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm; /* local: see ApplyFilter */ + int fromframe = n - btcur / 2; + int outcenter = btcur / 2; + const fftwf_complex *frames[btcur] = {}; +@@ -357,7 +358,7 @@ const VSFrame *FFT3DFilter::ApplyFilter + + if (btcur > 0) /* Wiener */ + { +- sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm; /* normalized variation=sigma^2 */ ++ const float sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm; /* normalized variation=sigma^2; a local, not the shared member: frames run in parallel and edge frames use btcur 1 */ + + /* get power spectral density (abs quadrat) for every block and apply filter */ + +diff --git a/FFT3DFilterTransform.cpp b/FFT3DFilterTransform.cpp +index a7a7e7e..91adbc8 100644 +--- a/FFT3DFilterTransform.cpp ++++ b/FFT3DFilterTransform.cpp +@@ -150,10 +150,10 @@ static void FramePlaneToCoverbuf(int plane, const VSFrame *src, T *__restrict co + if (!interlaced) /* progressive */ + { + for (int h = mirh; h < src_height + mirh; h++) { ++ memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */ + for (int w = 0; w < mirw; w++) { + coverbuf1[w] = coverbuf1[mirw + mirw - w]; /* mirror left border */ + } +- memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */ + for (int w = src_width + mirw; w < coverwidth; w++) { + coverbuf1[w] = coverbuf1[width2 - w]; /* mirror right border */ + } +@@ -164,10 +164,10 @@ static void FramePlaneToCoverbuf(int plane, const VSFrame *src, T *__restrict co + { + for (int h = mirh; h < src_height / 2 + mirh; h++) /* first field */ + { ++ memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */ + for (int w = 0; w < mirw; w++) { + coverbuf1[w] = coverbuf1[mirw + mirw - w]; /* mirror left border */ + } +- memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */ + for (int w = src_width + mirw; w < coverwidth; w++) { + coverbuf1[w] = coverbuf1[width2 - w]; /* mirror right border */ + } +@@ -178,10 +178,10 @@ static void FramePlaneToCoverbuf(int plane, const VSFrame *src, T *__restrict co + srcp -= src_pitch; + for (int h = src_height / 2 + mirh; h < src_height + mirh; h++) /* flip second field */ + { ++ memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */ + for (int w = 0; w < mirw; w++) { + coverbuf1[w] = coverbuf1[mirw + mirw - w]; /* mirror left border */ + } +- memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */ + for (int w = src_width + mirw; w < coverwidth; w++) { + coverbuf1[w] = coverbuf1[width2 - w]; /* mirror right border */ + } diff --git a/app/test/integration_fft3dfilter_determinism_test.dart b/app/test/integration_fft3dfilter_determinism_test.dart new file mode 100644 index 00000000..fbbefc15 --- /dev/null +++ b/app/test/integration_fft3dfilter_determinism_test.dart @@ -0,0 +1,130 @@ +// Task #62: FFT3DFilter, and so the two Noise Reduction methods built on it, +// gave a different picture on every run, so the preview never showed exactly +// what the encode wrote. The bundle's FFT3DFilter is now built from source +// with patches/fft3dfilter-r2-determinism.patch; the push gate checks the +// plugin itself (vapoursynth_integration_test.dart, "fft3dfilter is +// deterministic"). This checks what the user sees, through the worker: +// +// * two previews of the same frame are identical, and +// * the preview is the lossless encode's frame, sample for sample, +// +// for the FFT3DFilter method (bt 3, where the parallel sigma race was) and +// TemporalDegrain2 with its FFT3D post pass, at frames away from the trim's +// ends so the preview's temporal neighbours are the encode's. +// docs/reports/task-62-fft3dfilter-determinism. +@Tags(['heavy']) +@Timeout(Duration(minutes: 30)) +library; + +import 'dart:convert'; +import 'dart:io'; +import 'dart:typed_data'; + +import 'package:flutter_test/flutter_test.dart'; +import 'package:path/path.dart' as p; +import 'package:uuid/uuid.dart'; + +import 'package:vapourbox/models/encoding_settings.dart'; +import 'package:vapourbox/models/noise_reduction_parameters.dart'; +import 'package:vapourbox/models/processing_pipeline.dart'; +import 'package:vapourbox/models/qtgmc_parameters.dart'; +import 'package:vapourbox/models/video_job.dart'; + +import 'support/worker_harness.dart'; + +// Real film with grain and motion: 640x480, 24 fps, 120 frames, progressive. +String get _fixture => + p.join(WorkerHarness.repoRoot, 'Tests', 'TestResources', 'colorize_test.mp4'); +String get _dir => p.join(WorkerHarness.outputDir, 'fft3dfilter_determinism'); +const _start = 40, _end = 59; + +Map _job(String name, NoiseReductionParameters nr, {bool trimmed = true}) => + VideoJob( + id: const Uuid().v4(), + inputPath: _fixture, + outputPath: p.join(_dir, '$name.mkv'), + processingPipeline: ProcessingPipeline( + deinterlace: const QTGMCParameters(enabled: false), + noiseReduction: nr, + ), + encodingSettings: const EncodingSettings( + codec: VideoCodec.ffv1, container: ContainerFormat.mkv, audioMode: AudioMode.none), + inputWidth: 640, + inputHeight: 480, + inputPixelFormat: 'yuv420p', + inputFrameRate: 24, + totalFrames: trimmed ? _end - _start + 1 : 120, + startFrame: trimmed ? _start : null, + endFrame: trimmed ? _end : null, + ).toJson(); + +int _maxAbsDiff(Uint8List a, Uint8List b) { + expect(a.length, b.length, reason: 'frame sizes differ'); + var worst = 0; + for (var i = 0; i < a.length; i++) { + final d = (a[i] - b[i]).abs(); + if (d > worst) worst = d; + } + return worst; +} + +/// deps <= 1.17.x ship an unpatched FFT3DFilter; the check starts with the +/// first bundle that has the patch. +bool _unpatchedBundle() { + try { + final v = (jsonDecode(File(p.join(WorkerHarness.depsDir, 'version.json')).readAsStringSync()) + as Map)['version'] as String; + final parts = v.split('-').first.split('.').map(int.parse).toList(); + return parts[0] < 1 || (parts[0] == 1 && parts[1] <= 17); + } catch (_) { + return false; + } +} + +void main() { + setUpAll(() async { + await WorkerHarness.ensureReady(); + await Directory(_dir).create(recursive: true); + }); + + final cases = { + 'fft3d_bt3': NoiseReductionParameters( + enabled: true, method: NoiseReductionMethod.fft3dFilter, fft3dSigma: 2.0, fft3dBt: 3), + 'td2_postfft': NoiseReductionParameters( + enabled: true, method: NoiseReductionMethod.temporalDegrain2, td2PostFft: 1), + }; + + for (final MapEntry(key: name, value: nr) in cases.entries) { + test('$name: previews repeat and match the encode (task #62)', () async { + if (_unpatchedBundle()) { + markTestSkipped('deps <= 1.17.x ship an unpatched FFT3DFilter (task #62)'); + return; + } + final r = await WorkerHarness.runJob(_job(name, nr), label: '$name encode', + timeout: const Duration(minutes: 20)); + expect(r.success, isTrue, + reason: '${r.error}\n${r.logs.reversed.take(30).toList().reversed.join('\n')}'); + final out = r.outputPath ?? p.join(_dir, '$name.mkv'); + + for (final frame in [_start + 8, _start + 12]) { + final encoded = await WorkerHarness.frameRgb24(out, frame - _start, label: '${name}_enc'); + Future preview(int run) async { + final pv = await WorkerHarness.runPreview(_job('${name}_pv', nr, trimmed: false), + frame: frame); + expect(pv.success, isTrue, reason: '${pv.error}\n${pv.logs}'); + return WorkerHarness.imageToRgb24(pv.png!, label: '${name}_pv$run'); + } + + final a = await preview(1); + final b = await preview(2); + final repeat = _maxAbsDiff(a, b); + final vsEncode = _maxAbsDiff(a, encoded); + // ignore: avoid_print + print(' $name frame $frame: preview vs preview max $repeat, ' + 'preview vs encode max $vsEncode (mean ${WorkerHarness.meanAbsDiff(a, encoded)})'); + expect(repeat, 0, reason: 'two previews of frame $frame differ'); + expect(vsEncode, 0, reason: 'the preview of frame $frame is not the encode\'s frame'); + } + }); + } +} diff --git a/app/test/vapoursynth_integration_test.dart b/app/test/vapoursynth_integration_test.dart index 737d7da5..a3fb9637 100644 --- a/app/test/vapoursynth_integration_test.dart +++ b/app/test/vapoursynth_integration_test.dart @@ -603,6 +603,120 @@ print("fmtconv r31 chroma placement OK") }); }); + // Task #62: every published FFT3DFilter build gave a different output on + // every run (the left border mirrored from stale memory; a per-frame sigma + // in a shared member of a parallel filter), so the Noise Reduction FFT3D + // method, TemporalDegrain2 and QTGMC's fft3dfilter denoiser never previewed + // what they encoded. download-deps-* build R2 with + // patches/fft3dfilter-r2-determinism.patch. This holds every bundle to it: + // six fresh graphs per argument set at 8 threads must agree, a second + // process must agree with the first (FFTW plans are chosen per process), + // and a flat picture must come out flat at the left edge. + // docs/reports/task-62-fft3dfilter-determinism. + group('fft3dfilter determinism', () { + test('fft3dfilter is deterministic (task #62)', () async { + if (_depsVersionAtMost(depsDir, [1, 17])) { + markTestSkipped('deps <= 1.17.x ship an unpatched FFT3DFilter ' + '(task #62); enforced from deps 1.18.0'); + return; + } + const script = r''' +import ctypes +import hashlib +import random +import vapoursynth as vs +core = vs.core +core.num_threads = 8 + +# A textured, moving picture: seeded noise (a new pattern every frame) half +# blurred, so every block has detail and every frame differs, on any platform. +blank = core.std.BlankClip(format=vs.YUV420P8, width=352, height=288, length=12) + +def fill(n, f): + out = f.copy() + rnd = random.Random(1000 + n) + for p in range(3): + w, h = out.width >> (1 if p else 0), out.height >> (1 if p else 0) + base = ctypes.cast(out.get_write_ptr(p), ctypes.c_void_p).value + stride = out.get_stride(p) + for y in range(h): + ctypes.memmove(base + y * stride, rnd.randbytes(w), w) + return out + +noise = core.std.ModifyFrame(blank, blank, fill) +clip8 = core.std.Merge(noise, core.std.BoxBlur(noise, hradius=3, vradius=3), 0.6) +assert clip8.format.id == vs.YUV420P8, clip8.format.name +clip16 = core.resize.Point(clip8, format=vs.YUV420P16) + +ARGS = { + # TemporalDegrain2's spatial pass: a sigma pattern, bt=3. + 'td2_spat': dict(planes=[0, 1, 2], sigma=16, sigma2=10, sigma3=6, sigma4=4, + bt=3, bw=32, bh=32, ow=8, oh=8), + # Noise Reduction's FFT3DFilter method and TD2's post pass: one sigma, bt>1. + 'single_sigma_bt3': dict(sigma=2.0, bt=3), + 'single_sigma_bt5': dict(sigma=4.0, bt=5), + 'bt1': dict(sigma=16, bt=1), +} + +def digest(c): + m = hashlib.md5() + for f in c.frames(prefetch=16): + for p in range(f.format.num_planes): + m.update(bytes(f[p])) + return m.hexdigest() + +bad = [] +for depth, src in (('8', clip8), ('16', clip16)): + for name, kw in ARGS.items(): + hashes = {digest(core.fft3dfilter.FFT3DFilter(src, **kw)) for _ in range(6)} + print(f'HASH {depth}-bit {name} {len(hashes)} {sorted(hashes)[0]}') + if len(hashes) != 1: + bad.append(f'{depth}-bit {name}: {len(hashes)} different outputs in 6 runs') + +# The left-border oracle: on a flat picture every column must come out equal, +# per row. The unpatched mirror read stale memory into the left 10 luma / 6 +# chroma columns (x = 0 read 90 against 100). +flat = core.std.BlankClip(format=vs.YUV420P8, width=352, height=288, length=6, + color=[100, 128, 128]) +# The patched plugin rounds a flat picture to within 1 level everywhere, at +# the edge as in the interior; the stale mirror was 4-33 levels off. +worst = 0 +for f in core.fft3dfilter.FFT3DFilter(flat, sigma=2.0, bt=3).frames(): + for p in range(3): + for row in f[p].tolist(): + ref = row[32 if p == 0 else 16] + worst = max(worst, max(abs(v - ref) for v in row[:16])) +print(f'LEFT_EDGE_MAX_DIFF {worst}') +if worst > 1: + bad.append(f'flat picture: the left 16 columns differ from the interior by up to {worst} levels') + +if bad: + raise Exception('FFT3DFilter is not deterministic (task #62): ' + '; '.join(bad)) +print('fft3dfilter deterministic OK') +flat.set_output()'''; + + Map hashes(ProcessResult r) => { + for (final m in RegExp(r'^HASH (\S+ \S+) \d+ ([0-9a-f]{32})', + multiLine: true) + .allMatches(r.stdout.toString())) + m.group(1)!: m.group(2)!, + }; + + final first = await _runVspipeScript(vspipePath, script, depsDir: depsDir); + expect(first.exitCode, 0, + reason: 'stdout: ${first.stdout}\nstderr: ${first.stderr}'); + expect(first.stdout.toString(), contains('fft3dfilter deterministic OK')); + final second = + await _runVspipeScript(vspipePath, script, depsDir: depsDir); + expect(second.exitCode, 0, + reason: 'stdout: ${second.stdout}\nstderr: ${second.stderr}'); + expect(hashes(first), hasLength(8)); + expect(hashes(second), equals(hashes(first)), + reason: 'a second process filtered differently: FFTW chose another ' + 'plan (task #62 plan, P5: pass measure=0)'); + }); + }); + // Task #40: AV1 output needs SVT-AV1 in the bundled FFmpeg. BtbN's builds // (Windows, Linux) and martin-riedl's (macOS arm64 and, from deps // 1.17.0-rc2, x64; task #45) carry it. This proves every bundle has it, on diff --git a/docs/BUILDING.md b/docs/BUILDING.md index b281d08f..e29594d3 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -115,8 +115,9 @@ build ID and SHA-256; evermeet.cx's build, used up to deps 1.17.0-rc1, has no SVT-AV1); most plugins come pre-built from [Stefan-Olt/vs-plugin-build](https://github.com/Stefan-Olt/vs-plugin-build), and -`descratch`/`neo-f3kdb`/`nnedi3cl`/`vivtc` build from source, as does `fmtconv` -(Stefan-Olt's x86_64 build predates the pinned r31). +`descratch`/`neo-f3kdb`/`nnedi3cl`/`vivtc` build from source, as do `fmtconv` +(Stefan-Olt's x86_64 build predates the pinned r31) and FFT3DFilter (patched, +on every platform; below). ```bash ./Scripts/download-deps-macos.sh --force @@ -416,6 +417,7 @@ VapourBox bundles all runtime dependencies. No external installations are requir | fmtconv | **r31** (pinned, from GitLab) | Format conversion | | neo_f3kdb | Latest | Debanding | | DFTTest / KNLMeansCL / TTempSmooth | Latest | Denoising | +| FFT3DFilter | **R2** + patch, from source on every platform | Denoising (also TemporalDegrain2, QTGMC's fft3dfilter denoiser) | | zsmooth | 0.19.0 | CCD chroma denoise, Cnr4, RemoveGrain/TemporalMedian family | | DeScratch / tmedian | Latest | Scratch and spot removal | | VIVTC | Latest | Inverse telecine (VFM + VDecimate) | @@ -427,5 +429,9 @@ fmtconv is **pinned to r31 on every platform** (both macOS arches and Linux build it from source; Windows downloads upstream's r31 zip) and carries a local patch (`Scripts/patches/fmtconv-r31-arm-int-scaler.patch`) that fixes black output from its non-SIMD integer scaler on arm64; havsfunc carries five compatibility patches. +FFT3DFilter is built from its R2 tag on every platform (Windows cross-compiles +it with Zig, which the script downloads) with +`Scripts/patches/fft3dfilter-r2-determinism.patch`, without which its output +differs from run to run (task #62). Both are explained in [CLAUDE.md](../CLAUDE.md) — keep the versions in step across platforms, or the same job produces different output per OS. diff --git a/docs/ENGINEERING_NOTES.md b/docs/ENGINEERING_NOTES.md index 96bbc961..00d5b69a 100644 --- a/docs/ENGINEERING_NOTES.md +++ b/docs/ENGINEERING_NOTES.md @@ -5188,3 +5188,37 @@ Report: [docs/reports/task-60-bifrost-v4](reports/task-60-bifrost-v4/index.html) v3.0 (one run each). - **The earlier 2026-08-15 note "Bifrost is 8-bit only", and its include-farm note, describe v3.0.** + +### FFT3DFilter differed on every run: two plugin faults, patched (task #62, 2026-11-17) + +Task #57 found TemporalDegrain2 giving a different picture on every run. The +bisect (fresh graphs, 1 and 8 threads) put it on **FFT3DFilter**, not +TemporalDegrain2, MVTools or DFTTest, and on every argument set: a flat clip +came back up to 80 levels off. Two faults, in every published build (R1, R2, +HEAD, yuygfgg's arm64 prebuilt, the AmusementClub fork): + +- `FramePlaneToCoverbuf` mirrors each line's left border **before** copying + the line in, so the left 10 luma / 6 chroma columns came from the previous + frame's pixels (or uninitialised memory). Upstream regression da50417 + (2018); the 2015 original copied first. +- `ApplyFilter` keeps the per-frame Wiener sigma in a member of an + `fmParallel` filter; an edge frame (`btcur` 1) overwriting it filters a + middle frame at 1/bt of its noise level. Hit by bt > 1 with one sigma: the + FFT3D method, TD2's post pass, QTGMC's fft3dfilter denoiser. + +`Scripts/patches/fft3dfilter-r2-determinism.patch` (five lines) fixes both; +every platform now builds R2 from source with it (Windows by a Zig +cross-compile against FFTW 3.3.5's DLL, checked from macOS: links, imports +only `libfftw3f-3.dll`, KERNEL32 and the UCRT). Patched: 1 hash in every +cell, across 7 processes, in any access order, and through the worker the +preview equals the FFV1 encode sample for sample (unpatched: up to 27 levels +between two previews). Output change for users: mostly the left 16 columns +(mean 0.15–0.27 levels there), plus whole-picture corrections where the sigma +race had hit (FFT3D method at bt 3, up to 0.08 mean). A template wrapper was +deterministic but matched the patched plugin in only 27 of 90 cells and could +not reach havsfunc. Kalman (bt 0) is stateful by design and stays +unreachable. One correction to the plan: `measure=0` is not output-neutral +for 48-px blocks. Ships in deps 1.18.0; the push gate's `fft3dfilter is +deterministic` and the heavy `integration_fft3dfilter_determinism_test.dart` +skip on bundles up to 1.17.x. Report: +[docs/reports/task-62-fft3dfilter-determinism](reports/task-62-fft3dfilter-determinism/index.html). diff --git a/docs/reports/README.md b/docs/reports/README.md index a7dc42ea..e23c5c8c 100644 --- a/docs/reports/README.md +++ b/docs/reports/README.md @@ -66,6 +66,7 @@ to it. | Date | Report | Outcome | |---|---|---| +| 2026-11-17 | [Task #62: FFT3DFilter differs on every run](task-62-fft3dfilter-determinism/index.html) | Patched and built from source on every platform (deps 1.18.0): the left border was mirrored from memory not yet written (upstream regression da50417), and a per-frame sigma lived in a shared member of a parallel filter. Reached TemporalDegrain2 at every setting, the FFT3D method and QTGMC's fft3dfilter denoiser. Patched: one hash everywhere, across processes, preview = FFV1 encode exactly (before: up to 27 levels). A template wrapper was rejected (matched the fix in 27/90 cells, could not reach havsfunc). macOS arm64 only; Windows cross-compiled, not run | | 2026-11-17 | [Format sweep findings: nine faults, fixed](task-56-format-sweep-findings/index.html) | Fixed every row task #47's sweep pinned. MVTools divides by zero on a picture two block rows tall (SIGFPE on x86, up to 127 levels silently wrong on arm64; one row or column is wrong everywhere): every caller pads under 64x96. Width-2-mod-4 refusals (MCTD, QTGMC SrchClipPP 1) and Bifrost's uninitialised chroma (720x486 4:2:2 too) are Contract steps. CLAHE decides on an 8-bit copy (parity 3–22 → ~1 level; a smooth deep ramp now steps like 8-bit). Rotate/Flip field order, field-aware resize height, Deband's depth under "original", preview chroma. Synthetic pictures; x86 under Rosetta, CI native | | 2026-11-17 | [4:2:0 at a height 2 mod 4 (720x486), and RemoveDirt's race](task-57-height-2-mod-4-and-removedirt/index.html) | Fixed: a 4:2:0 frame 2 mod 4 high has no whole chroma rows per field, so `SeparateFields` and every field-aware zimg resize refused it (12 probed calls plus 8 template sites, every such height; a 4:2:2 D1 capture written as 4:2:0 failed at the end). Now padded around each refusing call (`pad_around`, period-2 rows, no build-time field flag) and only on field-flagged frames where only those refused: progressive outputs that ran before are bit-identical (padding LSFmod every time moved it 26 levels). RemoveDirt's `RestoreMotionBlocks` raced on shared buffers (18 results in 20 runs at 8 threads; upstream #5): each frame gets an instance to itself from a pool, which equals the 1-thread result (a new instance per frame leaked ~0.6 MB each in the plugin: corrected in review). TemporalDegrain2 is also nondeterministic (filed). macOS arm64 only | | 2026-11-17 | [The timestamp-reset scan no longer blocks analysis](task-55-deferred-reset-scan/index.html) | Built: a TS/PS's whole-file reset scan (77 s for a 2 h DVD title on a share, #51) now runs after analysis, one source at a time, with progress (`--probe-source --defer-scan`, `--complete-source`); 1 GB PS on SSD: 0.98 s → 0.35 s to Video Info and frame 0. Seeks can't go early (a seek before a reset can land after it), so thumbnails, scrubbing, detectors and jobs wait for the answer; the join reuses the scan (2 GB: 4.2 → 2.7 s). **The share itself was not measured** (unmounted); synthetic source, macOS only | diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/access_order_script_build.txt b/docs/reports/task-62-fft3dfilter-determinism/data/access_order_script_build.txt new file mode 100644 index 00000000..797e5b6b --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/access_order_script_build.txt @@ -0,0 +1,2 @@ +bt3 alone {'ab06eae2'} sequential {'ab06eae2'} after 9,2 {'ab06eae2'} +bt1 alone {'333a0f75'} sequential {'333a0f75'} after 9,2 {'333a0f75'} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/bisect.txt b/docs/reports/task-62-fft3dfilter-determinism/data/bisect.txt new file mode 100644 index 00000000..4611ce25 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/bisect.txt @@ -0,0 +1,13 @@ +full 8 6 1.2 +full 1 6 3.4 +fft3d_spat 8 6 0.2 +fft3d_spat 1 6 0.4 +fft3d_bt1 8 6 0.1 +fft3d_bt1 1 6 0.4 +fft3d_post 8 6 0.2 +fft3d_post 1 6 0.7 +mvdegrain 8 1 0.3 +mvdegrain 1 1 1.2 +dfttest 8 1 1.1 +dfttest 1 1 4.4 +{"full": {"8": 6, "1": 6}, "fft3d_spat": {"8": 6, "1": 6}, "fft3d_bt1": {"8": 6, "1": 6}, "fft3d_post": {"8": 6, "1": 6}, "mvdegrain": {"8": 1, "1": 1}, "dfttest": {"8": 1, "1": 1}} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/builds.txt b/docs/reports/task-62-fft3dfilter-determinism/data/builds.txt new file mode 100644 index 00000000..21f55ad5 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/builds.txt @@ -0,0 +1,73 @@ +8 720 480 td2_spat bundled 5 +8 720 480 td2_spat orig_build 3 +8 720 480 td2_spat fixed_build 1 +8 720 480 td2_post bundled 5 +8 720 480 td2_post orig_build 5 +8 720 480 td2_post fixed_build 1 +8 720 480 default_bt1 bundled 5 +8 720 480 default_bt1 orig_build 5 +8 720 480 default_bt1 fixed_build 1 +8 720 480 sharpen bundled 5 +8 720 480 sharpen orig_build 4 +8 720 480 sharpen fixed_build 1 +8 720 480 kalman_bt0 bundled 5 +8 720 480 kalman_bt0 orig_build 5 +8 720 480 kalman_bt0 fixed_build 3 +8 720 480 measure0 bundled 5 +8 720 480 measure0 orig_build 5 +8 720 480 measure0 fixed_build 1 +8 720 486 td2_spat bundled 5 +8 720 486 td2_spat orig_build 3 +8 720 486 td2_spat fixed_build 1 +8 720 486 td2_post bundled 5 +8 720 486 td2_post orig_build 3 +8 720 486 td2_post fixed_build 1 +8 720 486 default_bt1 bundled 5 +8 720 486 default_bt1 orig_build 4 +8 720 486 default_bt1 fixed_build 1 +8 720 486 sharpen bundled 5 +8 720 486 sharpen orig_build 5 +8 720 486 sharpen fixed_build 1 +8 720 486 kalman_bt0 bundled 5 +8 720 486 kalman_bt0 orig_build 5 +8 720 486 kalman_bt0 fixed_build 3 +8 720 486 measure0 bundled 5 +8 720 486 measure0 orig_build 5 +8 720 486 measure0 fixed_build 1 +16 720 480 td2_spat bundled 5 +16 720 480 td2_spat orig_build 3 +16 720 480 td2_spat fixed_build 1 +16 720 480 td2_post bundled 5 +16 720 480 td2_post orig_build 4 +16 720 480 td2_post fixed_build 1 +16 720 480 default_bt1 bundled 5 +16 720 480 default_bt1 orig_build 5 +16 720 480 default_bt1 fixed_build 1 +16 720 480 sharpen bundled 5 +16 720 480 sharpen orig_build 4 +16 720 480 sharpen fixed_build 1 +16 720 480 kalman_bt0 bundled 5 +16 720 480 kalman_bt0 orig_build 5 +16 720 480 kalman_bt0 fixed_build 2 +16 720 480 measure0 bundled 5 +16 720 480 measure0 orig_build 4 +16 720 480 measure0 fixed_build 1 +16 720 486 td2_spat bundled 5 +16 720 486 td2_spat orig_build 3 +16 720 486 td2_spat fixed_build 1 +16 720 486 td2_post bundled 5 +16 720 486 td2_post orig_build 4 +16 720 486 td2_post fixed_build 1 +16 720 486 default_bt1 bundled 5 +16 720 486 default_bt1 orig_build 5 +16 720 486 default_bt1 fixed_build 1 +16 720 486 sharpen bundled 5 +16 720 486 sharpen orig_build 5 +16 720 486 sharpen fixed_build 1 +16 720 486 kalman_bt0 bundled 5 +16 720 486 kalman_bt0 orig_build 4 +16 720 486 kalman_bt0 fixed_build 4 +16 720 486 measure0 bundled 5 +16 720 486 measure0 orig_build 3 +16 720 486 measure0 fixed_build 1 +{"8-bit 720x480 td2_spat bundled": 5, "8-bit 720x480 td2_spat orig_build": 3, "8-bit 720x480 td2_spat fixed_build": 1, "8-bit 720x480 td2_post bundled": 5, "8-bit 720x480 td2_post orig_build": 5, "8-bit 720x480 td2_post fixed_build": 1, "8-bit 720x480 default_bt1 bundled": 5, "8-bit 720x480 default_bt1 orig_build": 5, "8-bit 720x480 default_bt1 fixed_build": 1, "8-bit 720x480 sharpen bundled": 5, "8-bit 720x480 sharpen orig_build": 4, "8-bit 720x480 sharpen fixed_build": 1, "8-bit 720x480 kalman_bt0 bundled": 5, "8-bit 720x480 kalman_bt0 orig_build": 5, "8-bit 720x480 kalman_bt0 fixed_build": 3, "8-bit 720x480 measure0 bundled": 5, "8-bit 720x480 measure0 orig_build": 5, "8-bit 720x480 measure0 fixed_build": 1, "8-bit 720x486 td2_spat bundled": 5, "8-bit 720x486 td2_spat orig_build": 3, "8-bit 720x486 td2_spat fixed_build": 1, "8-bit 720x486 td2_post bundled": 5, "8-bit 720x486 td2_post orig_build": 3, "8-bit 720x486 td2_post fixed_build": 1, "8-bit 720x486 default_bt1 bundled": 5, "8-bit 720x486 default_bt1 orig_build": 4, "8-bit 720x486 default_bt1 fixed_build": 1, "8-bit 720x486 sharpen bundled": 5, "8-bit 720x486 sharpen orig_build": 5, "8-bit 720x486 sharpen fixed_build": 1, "8-bit 720x486 kalman_bt0 bundled": 5, "8-bit 720x486 kalman_bt0 orig_build": 5, "8-bit 720x486 kalman_bt0 fixed_build": 3, "8-bit 720x486 measure0 bundled": 5, "8-bit 720x486 measure0 orig_build": 5, "8-bit 720x486 measure0 fixed_build": 1, "16-bit 720x480 td2_spat bundled": 5, "16-bit 720x480 td2_spat orig_build": 3, "16-bit 720x480 td2_spat fixed_build": 1, "16-bit 720x480 td2_post bundled": 5, "16-bit 720x480 td2_post orig_build": 4, "16-bit 720x480 td2_post fixed_build": 1, "16-bit 720x480 default_bt1 bundled": 5, "16-bit 720x480 default_bt1 orig_build": 5, "16-bit 720x480 default_bt1 fixed_build": 1, "16-bit 720x480 sharpen bundled": 5, "16-bit 720x480 sharpen orig_build": 4, "16-bit 720x480 sharpen fixed_build": 1, "16-bit 720x480 kalman_bt0 bundled": 5, "16-bit 720x480 kalman_bt0 orig_build": 5, "16-bit 720x480 kalman_bt0 fixed_build": 2, "16-bit 720x480 measure0 bundled": 5, "16-bit 720x480 measure0 orig_build": 4, "16-bit 720x480 measure0 fixed_build": 1, "16-bit 720x486 td2_spat bundled": 5, "16-bit 720x486 td2_spat orig_build": 3, "16-bit 720x486 td2_spat fixed_build": 1, "16-bit 720x486 td2_post bundled": 5, "16-bit 720x486 td2_post orig_build": 4, "16-bit 720x486 td2_post fixed_build": 1, "16-bit 720x486 default_bt1 bundled": 5, "16-bit 720x486 default_bt1 orig_build": 5, "16-bit 720x486 default_bt1 fixed_build": 1, "16-bit 720x486 sharpen bundled": 5, "16-bit 720x486 sharpen orig_build": 5, "16-bit 720x486 sharpen fixed_build": 1, "16-bit 720x486 kalman_bt0 bundled": 5, "16-bit 720x486 kalman_bt0 orig_build": 4, "16-bit 720x486 kalman_bt0 fixed_build": 4, "16-bit 720x486 measure0 bundled": 5, "16-bit 720x486 measure0 orig_build": 3, "16-bit 720x486 measure0 fixed_build": 1} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/bundle_1.16.0.txt b/docs/reports/task-62-fft3dfilter-determinism/data/bundle_1.16.0.txt new file mode 100644 index 00000000..2ea68ec4 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/bundle_1.16.0.txt @@ -0,0 +1,33 @@ +5 8 720x480 fft3d td2_spat +5 8 720x480 fft3d td2_post +5 8 720x480 fft3d nr_bt3 +5 8 720x480 fft3d nr_bt5 +5 8 720x480 fft3d default_bt1 +5 8 720x480 fft3d sharpen +5 8 720x480 td2 postFFT=0 +5 8 720x480 td2 postFFT=1 +5 8 720x486 fft3d td2_spat +5 8 720x486 fft3d td2_post +5 8 720x486 fft3d nr_bt3 +5 8 720x486 fft3d nr_bt5 +5 8 720x486 fft3d default_bt1 +5 8 720x486 fft3d sharpen +5 8 720x486 td2 postFFT=0 +5 8 720x486 td2 postFFT=1 +5 16 720x480 fft3d td2_spat +5 16 720x480 fft3d td2_post +5 16 720x480 fft3d nr_bt3 +5 16 720x480 fft3d nr_bt5 +5 16 720x480 fft3d default_bt1 +5 16 720x480 fft3d sharpen +5 16 720x480 td2 postFFT=0 +5 16 720x480 td2 postFFT=1 +5 16 720x486 fft3d td2_spat +5 16 720x486 fft3d td2_post +5 16 720x486 fft3d nr_bt3 +5 16 720x486 fft3d nr_bt5 +5 16 720x486 fft3d default_bt1 +5 16 720x486 fft3d sharpen +5 16 720x486 td2 postFFT=0 +5 16 720x486 td2 postFFT=1 +MAX 5 diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/bundle_with_script_build.txt b/docs/reports/task-62-fft3dfilter-determinism/data/bundle_with_script_build.txt new file mode 100644 index 00000000..95437e6e --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/bundle_with_script_build.txt @@ -0,0 +1,33 @@ +1 8 720x480 fft3d td2_spat +1 8 720x480 fft3d td2_post +1 8 720x480 fft3d nr_bt3 +1 8 720x480 fft3d nr_bt5 +1 8 720x480 fft3d default_bt1 +1 8 720x480 fft3d sharpen +1 8 720x480 td2 postFFT=0 +1 8 720x480 td2 postFFT=1 +1 8 720x486 fft3d td2_spat +1 8 720x486 fft3d td2_post +1 8 720x486 fft3d nr_bt3 +1 8 720x486 fft3d nr_bt5 +1 8 720x486 fft3d default_bt1 +1 8 720x486 fft3d sharpen +1 8 720x486 td2 postFFT=0 +1 8 720x486 td2 postFFT=1 +1 16 720x480 fft3d td2_spat +1 16 720x480 fft3d td2_post +1 16 720x480 fft3d nr_bt3 +1 16 720x480 fft3d nr_bt5 +1 16 720x480 fft3d default_bt1 +1 16 720x480 fft3d sharpen +1 16 720x480 td2 postFFT=0 +1 16 720x480 td2 postFFT=1 +1 16 720x486 fft3d td2_spat +1 16 720x486 fft3d td2_post +1 16 720x486 fft3d nr_bt3 +1 16 720x486 fft3d nr_bt5 +1 16 720x486 fft3d default_bt1 +1 16 720x486 fft3d sharpen +1 16 720x486 td2 postFFT=0 +1 16 720x486 td2 postFFT=1 +MAX 1 diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/change.txt b/docs/reports/task-62-fft3dfilter-determinism/data/change.txt new file mode 100644 index 00000000..ed6e9e59 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/change.txt @@ -0,0 +1,13 @@ +Noise Reduction FFT3DFilter (sigma 2, bt 3) run 1 Y mean 0.0037 left 0.1674 rest 0.0000 max 14 | U mean 0.0054 left 0.2325 rest 0.0002 max 5 | V mean 0.0139 left 0.1078 rest 0.0118 max 4 +Noise Reduction FFT3DFilter (sigma 2, bt 3) run 2 Y mean 0.0826 left 0.2096 rest 0.0797 max 16 | U mean 0.0183 left 0.1551 rest 0.0152 max 4 | V mean 0.0024 left 0.1044 rest 0.0001 max 3 +Noise Reduction FFT3DFilter (sigma 2, bt 3) run 3 Y mean 0.0429 left 0.2666 rest 0.0378 max 27 | U mean 0.0231 left 0.3687 rest 0.0152 max 31 | V mean 0.0142 left 0.1205 rest 0.0118 max 6 +TemporalDegrain2 defaults (postFFT 0) run 1 Y mean 0.0002 left 0.0083 rest 0.0000 max 2 | U mean 0.0000 left 0.0000 rest 0.0000 max 0 | V mean 0.0000 left 0.0000 rest 0.0000 max 0 +TemporalDegrain2 defaults (postFFT 0) run 2 Y mean 0.0002 left 0.0083 rest 0.0000 max 2 | U mean 0.0000 left 0.0000 rest 0.0000 max 0 | V mean 0.0000 left 0.0000 rest 0.0000 max 0 +TemporalDegrain2 defaults (postFFT 0) run 3 Y mean 0.0002 left 0.0083 rest 0.0000 max 2 | U mean 0.0000 left 0.0000 rest 0.0000 max 0 | V mean 0.0000 left 0.0000 rest 0.0000 max 0 +TemporalDegrain2 postFFT 1 run 1 Y mean 0.0045 left 0.1912 rest 0.0002 max 4 | U mean 0.0026 left 0.0788 rest 0.0008 max 2 | V mean 0.0013 left 0.0386 rest 0.0004 max 1 +TemporalDegrain2 postFFT 1 run 2 Y mean 0.0039 left 0.1660 rest 0.0002 max 3 | U mean 0.0022 left 0.0676 rest 0.0007 max 1 | V mean 0.0012 left 0.0358 rest 0.0004 max 1 +TemporalDegrain2 postFFT 1 run 3 Y mean 0.0040 left 0.1689 rest 0.0002 max 5 | U mean 0.0023 left 0.0728 rest 0.0007 max 3 | V mean 0.0012 left 0.0332 rest 0.0004 max 1 +QTGMC Fast, Denoiser='fft3dfilter', NoiseTR 1 run 1 Y mean 0.0035 left 0.1567 rest 0.0000 max 7 | U mean 0.0000 left 0.0000 rest 0.0000 max 0 | V mean 0.0000 left 0.0000 rest 0.0000 max 0 +QTGMC Fast, Denoiser='fft3dfilter', NoiseTR 1 run 2 Y mean 0.0035 left 0.1567 rest 0.0000 max 7 | U mean 0.0000 left 0.0000 rest 0.0000 max 0 | V mean 0.0000 left 0.0000 rest 0.0000 max 0 +QTGMC Fast, Denoiser='fft3dfilter', NoiseTR 1 run 3 Y mean 0.0034 left 0.1532 rest 0.0000 max 7 | U mean 0.0000 left 0.0000 rest 0.0000 max 0 | V mean 0.0000 left 0.0000 rest 0.0000 max 0 +{"Noise Reduction FFT3DFilter (sigma 2, bt 3)": [[{"mean": 0.0037, "left": 0.1674, "rest": 0.0, "max": 14}, {"mean": 0.0054, "left": 0.2325, "rest": 0.0002, "max": 5}, {"mean": 0.0139, "left": 0.1078, "rest": 0.0118, "max": 4}], [{"mean": 0.0826, "left": 0.2096, "rest": 0.0797, "max": 16}, {"mean": 0.0183, "left": 0.1551, "rest": 0.0152, "max": 4}, {"mean": 0.0024, "left": 0.1044, "rest": 0.0001, "max": 3}], [{"mean": 0.0429, "left": 0.2666, "rest": 0.0378, "max": 27}, {"mean": 0.0231, "left": 0.3687, "rest": 0.0152, "max": 31}, {"mean": 0.0142, "left": 0.1205, "rest": 0.0118, "max": 6}]], "TemporalDegrain2 defaults (postFFT 0)": [[{"mean": 0.0002, "left": 0.0083, "rest": 0.0, "max": 2}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}], [{"mean": 0.0002, "left": 0.0083, "rest": 0.0, "max": 2}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}], [{"mean": 0.0002, "left": 0.0083, "rest": 0.0, "max": 2}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}]], "TemporalDegrain2 postFFT 1": [[{"mean": 0.0045, "left": 0.1912, "rest": 0.0002, "max": 4}, {"mean": 0.0026, "left": 0.0788, "rest": 0.0008, "max": 2}, {"mean": 0.0013, "left": 0.0386, "rest": 0.0004, "max": 1}], [{"mean": 0.0039, "left": 0.166, "rest": 0.0002, "max": 3}, {"mean": 0.0022, "left": 0.0676, "rest": 0.0007, "max": 1}, {"mean": 0.0012, "left": 0.0358, "rest": 0.0004, "max": 1}], [{"mean": 0.004, "left": 0.1689, "rest": 0.0002, "max": 5}, {"mean": 0.0023, "left": 0.0728, "rest": 0.0007, "max": 3}, {"mean": 0.0012, "left": 0.0332, "rest": 0.0004, "max": 1}]], "QTGMC Fast, Denoiser='fft3dfilter', NoiseTR 1": [[{"mean": 0.0035, "left": 0.1567, "rest": 0.0, "max": 7}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}], [{"mean": 0.0035, "left": 0.1567, "rest": 0.0, "max": 7}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}], [{"mean": 0.0034, "left": 0.1532, "rest": 0.0, "max": 7}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}, {"mean": 0.0, "left": 0.0, "rest": 0.0, "max": 0}]]} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_16bit.txt b/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_16bit.txt new file mode 100644 index 00000000..ca4e732c --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_16bit.txt @@ -0,0 +1,7 @@ +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} +{"td2_spat": "f8ce4bd4221e53b781f5cf9be8d81214", "td2_post": "e5cfc76ee21ee560e77c06a10bc54ccd", "default_bt1": "689fc85767f6f45b62cb70f36ab98798", "sharpen": "42f389d14d0c8681727b07cec10649c8", "measure0": "689fc85767f6f45b62cb70f36ab98798"} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_8bit.txt b/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_8bit.txt new file mode 100644 index 00000000..4807069d --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_8bit.txt @@ -0,0 +1,7 @@ +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} +{"td2_spat": "38778ab91af84d63559d727979973b79", "td2_post": "cc2e0c10ca653ae55388c758e5c415c2", "default_bt1": "f5ad4597b5a75ad796a69177aabffedc", "sharpen": "b7ba687208fe00d0938d2d7bb36c4f26", "measure0": "f5ad4597b5a75ad796a69177aabffedc"} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_script_build.txt b/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_script_build.txt new file mode 100644 index 00000000..042203b2 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/cross_process_script_build.txt @@ -0,0 +1,12 @@ +measure=1 640x480 + 5 {'bt3': '89ca8efa', 'td2_spat': '8f8f5079', 'td2_post': '73d8833b'} +measure=1 720x480 + 5 {'bt3': 'd4e013e0', 'td2_spat': '38778ab9', 'td2_post': 'cc2e0c10'} +measure=1 352x288 + 5 {'bt3': 'cd5a384b', 'td2_spat': '5ae7945a', 'td2_post': '0f1addb6'} +measure=0 640x480 + 5 {'bt3': '89ca8efa', 'td2_spat': '8f8f5079', 'td2_post': '798b1dd7'} +measure=0 720x480 + 5 {'bt3': 'd4e013e0', 'td2_spat': '38778ab9', 'td2_post': 'f78fcad1'} +measure=0 352x288 + 5 {'bt3': 'cd5a384b', 'td2_spat': '5ae7945a', 'td2_post': '9da1593b'} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/edge.txt b/docs/reports/task-62-fft3dfilter-determinism/data/edge.txt new file mode 100644 index 00000000..7d68effa --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/edge.txt @@ -0,0 +1,10 @@ +# 1.16.0 bundle +left 4 interior 1 +left 4 interior 1 +left 25 interior 1 +left 33 interior 1 +# bundle with the script build +left 1 interior 1 +left 1 interior 1 +left 1 interior 1 +left 1 interior 1 diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/figures.txt b/docs/reports/task-62-fft3dfilter-determinism/data/figures.txt new file mode 100644 index 00000000..142ce051 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/figures.txt @@ -0,0 +1,4 @@ +01-flat-unpatched.png max diff 12 differing columns (0, 9, 10) +02-flat-patched.png max diff 0 differing columns None +03-fixture-unpatched.png max diff 25 differing columns (0, 9, 10) +04-fixture-patched.png max diff 0 differing columns None diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/td2_qtgmc_builds.txt b/docs/reports/task-62-fft3dfilter-determinism/data/td2_qtgmc_builds.txt new file mode 100644 index 00000000..435d186c --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/td2_qtgmc_builds.txt @@ -0,0 +1,41 @@ +8 threads 8-bit 720x480 td2_post1 fft3dorig 4 +8 threads 8-bit 720x480 td2_default fft3dorig 1 +8 threads 8-bit 720x480 qtgmc_fft3d fft3dorig 3 +8 threads 8-bit 720x480 td2_post1 fft3dfixed 1 +8 threads 8-bit 720x480 td2_default fft3dfixed 1 +8 threads 8-bit 720x480 qtgmc_fft3d fft3dfixed 1 +8 threads 8-bit 720x486 td2_post1 fft3dorig 4 +8 threads 8-bit 720x486 td2_default fft3dorig 1 +8 threads 8-bit 720x486 td2_post1 fft3dfixed 1 +8 threads 8-bit 720x486 td2_default fft3dfixed 1 +8 threads 16-bit 720x480 td2_post1 fft3dorig 4 +8 threads 16-bit 720x480 td2_default fft3dorig 1 +8 threads 16-bit 720x480 qtgmc_fft3d fft3dorig 4 +8 threads 16-bit 720x480 td2_post1 fft3dfixed 1 +8 threads 16-bit 720x480 td2_default fft3dfixed 1 +8 threads 16-bit 720x480 qtgmc_fft3d fft3dfixed 1 +8 threads 16-bit 720x486 td2_post1 fft3dorig 4 +8 threads 16-bit 720x486 td2_default fft3dorig 1 +8 threads 16-bit 720x486 td2_post1 fft3dfixed 1 +8 threads 16-bit 720x486 td2_default fft3dfixed 1 +1 threads 8-bit 720x480 td2_post1 fft3dorig 1 +1 threads 8-bit 720x480 td2_default fft3dorig 1 +1 threads 8-bit 720x480 qtgmc_fft3d fft3dorig 1 +1 threads 8-bit 720x480 td2_post1 fft3dfixed 1 +1 threads 8-bit 720x480 td2_default fft3dfixed 1 +1 threads 8-bit 720x480 qtgmc_fft3d fft3dfixed 1 +1 threads 8-bit 720x486 td2_post1 fft3dorig 1 +1 threads 8-bit 720x486 td2_default fft3dorig 1 +1 threads 8-bit 720x486 td2_post1 fft3dfixed 1 +1 threads 8-bit 720x486 td2_default fft3dfixed 1 +1 threads 16-bit 720x480 td2_post1 fft3dorig 1 +1 threads 16-bit 720x480 td2_default fft3dorig 1 +1 threads 16-bit 720x480 qtgmc_fft3d fft3dorig 1 +1 threads 16-bit 720x480 td2_post1 fft3dfixed 1 +1 threads 16-bit 720x480 td2_default fft3dfixed 1 +1 threads 16-bit 720x480 qtgmc_fft3d fft3dfixed 1 +1 threads 16-bit 720x486 td2_post1 fft3dorig 1 +1 threads 16-bit 720x486 td2_default fft3dorig 1 +1 threads 16-bit 720x486 td2_post1 fft3dfixed 1 +1 threads 16-bit 720x486 td2_default fft3dfixed 1 +{"8 threads 8-bit 720x480 td2_post1 fft3dorig": 4, "8 threads 8-bit 720x480 td2_default fft3dorig": 1, "8 threads 8-bit 720x480 qtgmc_fft3d fft3dorig": 3, "8 threads 8-bit 720x480 td2_post1 fft3dfixed": 1, "8 threads 8-bit 720x480 td2_default fft3dfixed": 1, "8 threads 8-bit 720x480 qtgmc_fft3d fft3dfixed": 1, "8 threads 8-bit 720x486 td2_post1 fft3dorig": 4, "8 threads 8-bit 720x486 td2_default fft3dorig": 1, "8 threads 8-bit 720x486 td2_post1 fft3dfixed": 1, "8 threads 8-bit 720x486 td2_default fft3dfixed": 1, "8 threads 16-bit 720x480 td2_post1 fft3dorig": 4, "8 threads 16-bit 720x480 td2_default fft3dorig": 1, "8 threads 16-bit 720x480 qtgmc_fft3d fft3dorig": 4, "8 threads 16-bit 720x480 td2_post1 fft3dfixed": 1, "8 threads 16-bit 720x480 td2_default fft3dfixed": 1, "8 threads 16-bit 720x480 qtgmc_fft3d fft3dfixed": 1, "8 threads 16-bit 720x486 td2_post1 fft3dorig": 4, "8 threads 16-bit 720x486 td2_default fft3dorig": 1, "8 threads 16-bit 720x486 td2_post1 fft3dfixed": 1, "8 threads 16-bit 720x486 td2_default fft3dfixed": 1, "1 threads 8-bit 720x480 td2_post1 fft3dorig": 1, "1 threads 8-bit 720x480 td2_default fft3dorig": 1, "1 threads 8-bit 720x480 qtgmc_fft3d fft3dorig": 1, "1 threads 8-bit 720x480 td2_post1 fft3dfixed": 1, "1 threads 8-bit 720x480 td2_default fft3dfixed": 1, "1 threads 8-bit 720x480 qtgmc_fft3d fft3dfixed": 1, "1 threads 8-bit 720x486 td2_post1 fft3dorig": 1, "1 threads 8-bit 720x486 td2_default fft3dorig": 1, "1 threads 8-bit 720x486 td2_post1 fft3dfixed": 1, "1 threads 8-bit 720x486 td2_default fft3dfixed": 1, "1 threads 16-bit 720x480 td2_post1 fft3dorig": 1, "1 threads 16-bit 720x480 td2_default fft3dorig": 1, "1 threads 16-bit 720x480 qtgmc_fft3d fft3dorig": 1, "1 threads 16-bit 720x480 td2_post1 fft3dfixed": 1, "1 threads 16-bit 720x480 td2_default fft3dfixed": 1, "1 threads 16-bit 720x480 qtgmc_fft3d fft3dfixed": 1, "1 threads 16-bit 720x486 td2_post1 fft3dorig": 1, "1 threads 16-bit 720x486 td2_default fft3dorig": 1, "1 threads 16-bit 720x486 td2_post1 fft3dfixed": 1, "1 threads 16-bit 720x486 td2_default fft3dfixed": 1} diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/variants.txt b/docs/reports/task-62-fft3dfilter-determinism/data/variants.txt new file mode 100644 index 00000000..85253732 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/variants.txt @@ -0,0 +1,11 @@ +default max 23, differing runs 3 of 3, max fraction of samples 0.00869 +bt1 max 27, differing runs 3 of 3, max fraction of samples 0.00662 +bt0_kalman max 22, differing runs 3 of 3, max fraction of samples 0.21384 +bt-1_sharpen max 72, differing runs 3 of 3, max fraction of samples 0.02116 +sigma0 max 1, differing runs 3 of 3, max fraction of samples 0.00947 +bt1_sigma16_bw32 max 83, differing runs 3 of 3, max fraction of samples 0.01791 +ncpu1 max 38, differing runs 3 of 3, max fraction of samples 0.00918 +ncpu4 max 30, differing runs 3 of 3, max fraction of samples 0.00881 +post_bt3_bw48 max 20, differing runs 3 of 3, max fraction of samples 0.00928 +y_only max 27, differing runs 3 of 3, max fraction of samples 0.00619 +blank (80, 3, 3, 0.01406) diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/where_blank.txt b/docs/reports/task-62-fft3dfilter-determinism/data/where_blank.txt new file mode 100644 index 00000000..1dd31c23 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/where_blank.txt @@ -0,0 +1,22 @@ +0 0 count 2686 rows 0 .. 317 318 cols 0 .. 9 10 [(0, 0, 101, 90), (1, 0, 98, 97), (3, 0, 99, 101), (4, 0, 93, 101), (5, 0, 96, 101), (6, 0, 106, 100)] +1 0 count 3584 rows 0 .. 479 480 cols 0 .. 9 10 [(0, 0, 99, 90), (1, 0, 99, 97), (2, 0, 99, 100), (3, 0, 99, 101), (4, 0, 99, 101), (5, 0, 99, 101)] +1 1 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 119, 128), (1, 0, 127, 128), (2, 0, 129, 128), (3, 0, 129, 128), (4, 0, 129, 128), (5, 0, 129, 128)] +1 2 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +2 1 count 1062 rows 0 .. 239 240 cols 0 .. 9 10 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +2 2 count 520 rows 0 .. 119 120 cols 0 .. 8 9 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +3 0 count 3316 rows 0 .. 479 480 cols 0 .. 9 10 [(0, 0, 90, 99), (1, 0, 97, 99), (2, 0, 100, 99), (3, 0, 101, 99), (4, 0, 101, 100), (5, 0, 101, 100)] +3 2 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 119, 128), (1, 0, 127, 128), (2, 0, 129, 128), (3, 0, 129, 128), (4, 0, 129, 128), (5, 0, 129, 128)] +4 0 count 3584 rows 0 .. 479 480 cols 0 .. 9 10 [(0, 0, 99, 90), (1, 0, 99, 97), (2, 0, 99, 100), (3, 0, 99, 101), (4, 0, 99, 101), (5, 0, 99, 101)] +4 1 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +5 1 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 119, 128), (1, 0, 127, 128), (2, 0, 129, 128), (3, 0, 129, 128), (4, 0, 129, 128), (5, 0, 129, 128)] +5 2 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 119, 128), (1, 0, 127, 128), (2, 0, 129, 128), (3, 0, 129, 128), (4, 0, 129, 128), (5, 0, 129, 128)] +6 0 count 2323 rows 0 .. 479 426 cols 0 .. 9 10 [(4, 0, 100, 99), (5, 0, 100, 99), (1, 1, 100, 99), (2, 1, 100, 99), (3, 1, 100, 99), (4, 1, 100, 99)] +6 2 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +7 0 count 3316 rows 0 .. 479 480 cols 0 .. 9 10 [(0, 0, 99, 90), (1, 0, 99, 97), (2, 0, 99, 100), (3, 0, 99, 101), (4, 0, 100, 101), (5, 0, 100, 101)] +7 1 count 520 rows 0 .. 119 120 cols 0 .. 8 9 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +7 2 count 211 rows 177 .. 228 52 cols 0 .. 9 10 [(0, 177, 129, 128), (0, 178, 129, 128), (1, 179, 126, 128), (2, 179, 127, 128), (1, 180, 125, 128), (2, 180, 126, 128)] +8 0 count 3316 rows 0 .. 479 480 cols 0 .. 9 10 [(0, 0, 90, 99), (1, 0, 97, 99), (2, 0, 100, 99), (3, 0, 101, 99), (4, 0, 101, 100), (5, 0, 101, 100)] +8 2 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 119, 128), (1, 0, 127, 128), (2, 0, 129, 128), (3, 0, 129, 128), (4, 0, 129, 128), (5, 0, 129, 128)] +9 0 count 3316 rows 0 .. 479 480 cols 0 .. 9 10 [(0, 0, 99, 90), (1, 0, 99, 97), (2, 0, 99, 100), (3, 0, 99, 101), (4, 0, 100, 101), (5, 0, 100, 101)] +9 1 count 1003 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 128, 119), (1, 0, 128, 127), (2, 0, 128, 129), (3, 0, 128, 129), (4, 0, 128, 129), (5, 0, 128, 129)] +9 2 count 1121 rows 0 .. 239 240 cols 0 .. 5 6 [(0, 0, 117, 119), (1, 0, 124, 127), (2, 0, 127, 129), (3, 0, 127, 129), (4, 0, 127, 129), (5, 0, 128, 129)] diff --git a/docs/reports/task-62-fft3dfilter-determinism/data/wrapper.txt b/docs/reports/task-62-fft3dfilter-determinism/data/wrapper.txt new file mode 100644 index 00000000..6534d7af --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/data/wrapper.txt @@ -0,0 +1,91 @@ +420 p8 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +420 p8 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +420 p8 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +420 p8 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +420 p8 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +420 p8 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +420 p8 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +420 p8 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +420 p8 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +420 p8 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +420 p10 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +420 p10 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +420 p10 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +420 p10 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +420 p16 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +420 p16 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +420 p16 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +422 p8 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +422 p8 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +422 p8 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +422 p8 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +422 p8 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +422 p8 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +422 p8 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +422 p8 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +422 p8 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +422 p8 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +422 p10 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +422 p10 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +422 p10 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +422 p10 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +422 p16 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +422 p16 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +422 p16 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +444 p8 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +444 p8 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +444 p8 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +444 p8 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +444 p8 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +444 p8 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +444 p8 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +444 p8 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +444 p8 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +444 p8 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +444 p10 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': True} +444 p10 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +444 p10 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +444 p10 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 720x480 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +444 p16 720x480 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 720x480 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 720x480 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 720x480 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 96x64 td2_spat {'distinct': 1, 'equals_fixed_plugin': True} +444 p16 96x64 td2_post {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 96x64 nr_default {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 96x64 nr_bt5 {'distinct': 1, 'equals_fixed_plugin': False} +444 p16 96x64 bt1 {'distinct': 1, 'equals_fixed_plugin': False} +{"420 p8 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "420 p8 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "420 p8 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "420 p8 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "420 p8 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "420 p8 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "420 p8 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "420 p8 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "420 p8 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "420 p8 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "420 p10 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "420 p10 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "420 p10 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "420 p10 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "420 p16 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "420 p16 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "420 p16 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "422 p8 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "422 p8 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "422 p8 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "422 p8 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "422 p8 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "422 p8 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "422 p8 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "422 p8 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "422 p8 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "422 p8 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "422 p10 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "422 p10 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "422 p10 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "422 p10 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "422 p16 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "422 p16 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "422 p16 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "444 p8 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "444 p8 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "444 p8 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "444 p8 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "444 p8 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "444 p8 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "444 p8 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "444 p8 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "444 p8 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "444 p8 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "444 p10 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": true}, "444 p10 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "444 p10 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "444 p10 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 720x480 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "444 p16 720x480 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 720x480 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 720x480 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 720x480 bt1": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 96x64 td2_spat": {"distinct": 1, "equals_fixed_plugin": true}, "444 p16 96x64 td2_post": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 96x64 nr_default": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 96x64 nr_bt5": {"distinct": 1, "equals_fixed_plugin": false}, "444 p16 96x64 bt1": {"distinct": 1, "equals_fixed_plugin": false}} diff --git a/docs/reports/task-62-fft3dfilter-determinism/img/01-flat-unpatched.png b/docs/reports/task-62-fft3dfilter-determinism/img/01-flat-unpatched.png new file mode 100644 index 00000000..9b3fe132 Binary files /dev/null and b/docs/reports/task-62-fft3dfilter-determinism/img/01-flat-unpatched.png differ diff --git a/docs/reports/task-62-fft3dfilter-determinism/img/02-flat-patched.png b/docs/reports/task-62-fft3dfilter-determinism/img/02-flat-patched.png new file mode 100644 index 00000000..1f8d1516 Binary files /dev/null and b/docs/reports/task-62-fft3dfilter-determinism/img/02-flat-patched.png differ diff --git a/docs/reports/task-62-fft3dfilter-determinism/img/03-fixture-unpatched.png b/docs/reports/task-62-fft3dfilter-determinism/img/03-fixture-unpatched.png new file mode 100644 index 00000000..edce84ab Binary files /dev/null and b/docs/reports/task-62-fft3dfilter-determinism/img/03-fixture-unpatched.png differ diff --git a/docs/reports/task-62-fft3dfilter-determinism/img/04-fixture-patched.png b/docs/reports/task-62-fft3dfilter-determinism/img/04-fixture-patched.png new file mode 100644 index 00000000..1f8d1516 Binary files /dev/null and b/docs/reports/task-62-fft3dfilter-determinism/img/04-fixture-patched.png differ diff --git a/docs/reports/task-62-fft3dfilter-determinism/index.html b/docs/reports/task-62-fft3dfilter-determinism/index.html new file mode 100644 index 00000000..75503961 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/index.html @@ -0,0 +1,304 @@ + + + + + +FFT3DFilter determinism + + + +
+ +

FFT3DFilter gives a different picture on every run: two plugin faults, patched

+

2026-11-17 · task #62 (found by task #57) · measured on an Apple Silicon Mac with the macOS arm64 deps +bundle 1.16.0 and the bundle's Python · fixture Tests/TestResources/interlaced_test.avi scaled as in +task #57 (10 frames), plus colorize_test.mp4 through the worker · every number below is in +data/, produced by scripts/.

+ +
+

Outcome: built, waiting on a deps release. TemporalDegrain2's run-to-run difference is not in +TemporalDegrain2, MVTools or DFTTest. It is two faults in FFT3DFilter, in every build there is: +the left border of each block buffer is mirrored from memory that has not been written yet, and a per-frame noise +level is kept in a member shared by parallel frames. Scripts/patches/fft3dfilter-r2-determinism.patch +fixes both (five lines). The three download-deps-* scripts now build FFT3DFilter from its R2 tag with +the patch on every platform, and fail if it stops applying. Built that way, every configuration tried gives one output, +in one process and across processes, and through the worker the preview equals the lossless encode sample for sample +(before: up to 27 levels apart).

+

This reaches users in deps 1.18.0. Until then the new push-gate and heavy tests skip on bundles up to +1.17.x.

+
+ +

1. Bisect: it is FFT3DFilter

+

Distinct output hashes over 6 fresh graphs in one process, 720x480 4:2:0 8-bit (td2.py repeat, +data/bisect.txt):

+ + + + + + + + +
graph8 threads1 thread
TemporalDegrain2 as the probe calls it (degrainTR=1, grainLevel=2, postFFT=1)66
FFT3DFilter alone, TD2's spatial arguments (sigma pattern, bt 3)66
FFT3DFilter alone, sigma 16, bt 166
FFT3DFilter alone, TD2's post-pass arguments (sigma 1, bt 3, bw 48)66
MVTools Super → Analyse → Degrain, TD2's arguments11
DFTTest, tbsize 311
+

One thread does not help, so it is not only a race. Every FFT3DFilter argument set tried varied: bt −1/0/1/3, sharpen, +sigma 0, ncpu 1/4, luma only (fft.py variants, data/variants.txt; up to 83 levels, on +0.6–2% of samples). A flat BlankClip at luma 100 came back up to 80 levels off.

+ +

2. Fault 1: the left border is mirrored from memory not yet written

+

On the flat clip, the differing samples are always in the left 10 luma / 6 chroma columns, on +every row (where.py blank, data/where_blank.txt): one run read x = 0, 1, 2 as +101, 98, 99, the next 90, 97, 100, where the picture is 100.

+

FramePlaneToCoverbuf (FFT3DFilterTransform.cpp) builds each line of the padded block +buffer by mirroring the left border first, coverbuf1[w] = coverbuf1[2*mirw - w], and only then copying +the source line in with memcpy(coverbuf1 + mirw, srcp, …). The mirror therefore reads whatever that buffer +held before: the previous frame this transform instance processed, or uninitialised heap memory on its first frame. +What a frame looks like depends on which frame was processed before it, so a preview (one frame, out of order) and an +encode (in order) differ. The same order is in all three loops (progressive, and both fields when interlaced). It was +introduced upstream in da50417 (2018-01-11, "Turn several functions into templates"); the 2015 +original copied the line first. Releases R1 and R2 both have it.

+
+
Difference map, flat clip, unpatched +
1. Unpatched build, flat picture (luma 100), sigma 16 bt 1: where two runs of frame 4 differ +(top-left 64x128 luma, each sample drawn 4x4, difference ×48). Every row differs in its left 10 columns; max 12 levels.
+
Difference map, flat clip, patched +
2. The same pair through the patched build: no sample differs.
+
Difference map, fixture, unpatched +
3. Unpatched, the fixture: the same 10 columns, max 25 levels.
+
Difference map, fixture, patched +
4. Patched, the fixture: identical.
+
+

The pair is made so the two graphs' transform instances saw different previous frames (one requested +in reverse first). figures.py, data/figures.txt.

+ +

3. Fault 2: a per-frame value in a member shared by parallel frames

+

In FFT3DFilter::ApplyFilter, sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm +writes an instance member, which Wiener3D then reads. The filter is registered fmParallel +when bt ≠ 0. Edge frames (n < bt/2, and the last (bt−1)/2) run with btcur = 1 and write the 2D value; +middle frames write and read the 3D value (×bt). Two threads interleaving can filter a middle frame at 1/bt of its +noise level. It matters when every sigma is the same (no sigma pattern) and bt > 1: the Noise Reduction FFT3D method +(bt 1–5, default 3), TemporalDegrain2's post pass (postFFT 1 or 2, bt 3) and QTGMC's +Denoiser='fft3dfilter' with NoiseTR > 0.

+

With fault 1 fixed alone, TD2's post-pass arguments still gave 2–4 hashes in 5 runs at 8 threads (Plan stage). With +both fixed, 1. Section 6 shows it is not only edge samples: an unpatched run of the FFT3D method at bt 3 differed from +the patched one across the whole picture in two runs of three.

+ +

4. The patch, verified

+
--- FFT3DFilterTransform.cpp   (x3: progressive, first field, second field)
+         for (int h = mirh; h < src_height + mirh; h++) {
++            memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */
+             for (int w = 0; w < mirw; w++) {
+                 coverbuf1[w] = coverbuf1[mirw + mirw - w]; /* mirror left border */
+             }
+-            memcpy(coverbuf1 + mirw, srcp, src_width * sizeof(T)); /* copy line */
+--- FFT3DFilter.cpp
+ FFT3DFilter::Wiener3D(...) {
++    const float sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm;
+ FFT3DFilter::ApplyFilter(...) {
+-        sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm;
++        const float sigmaSquaredNoiseNormed = btcur * sigma * sigma / norm;
+ +

4a. Unpatched and patched builds side by side

+

build.sh builds R2 twice with the flags download-deps-macos.sh uses (-O3, +C++17, hidden visibility, the bundle's FFTW), under renamed namespaces so both load next to the bundle's own plugin. +Distinct hashes in 5 fresh graphs at 8 threads, over 4:2:0 × {8, 16}-bit × {720x480, 720x486} +(fixed.py repeat, data/builds.txt):

+ + + + + + + + +
argumentsbundled 1.16.0unpatched buildpatched build
TD2 spatial (sigma pattern, bt 3)531
TD2 post (sigma 1, bt 3, bw 48)53–51
sigma 16, bt 154–51
bt −1, sharpen 154–51
sigma 16, bt 1, measure 053–51
bt 0 (Kalman), see section 754–52–4
+

Through TemporalDegrain2 and havsfunc's QTGMC, with only core.fft3dfilter swapped +(td2fixed.py, data/td2_qtgmc_builds.txt; 4 runs, 8 and 1 threads, 8/16-bit, +720x480/486): patched, 1 hash in every cell for TD2 postFFT 1, TD2 defaults and +QTGMC(Preset='Fast', NoiseProcess=1, Denoiser='fft3dfilter', NoiseTR=1); unpatched, up to 4.

+ +

4b. The build the deps script makes, in place of the bundle's plugin

+

A copy of the 1.16.0 bundle with only libfft3dfilter.dylib replaced by the one the new +download-deps-macos.sh block builds (det.py, 5 runs, 8 threads; FFT3DFilter at six argument +sets and full TD2 at postFFT 0 and 1, 4:2:0 8/16-bit, 720x480/486): 1 hash in all 32 cells +(data/bundle_with_script_build.txt); the unmodified bundle gives 5 in all 32 +(data/bundle_1.16.0.txt). Its output is bit-identical to build.sh's patched build (same +hashes in cross_process_8bit.txt and cross_process_script_build.txt).

+
    +
  • Across processes: 7 processes per depth gave one hash for every argument set +(data/cross_process_{8,16}bit.txt); 5 processes at 640x480, 720x480 and 352x288 agreed too +(data/cross_process_script_build.txt). FFTW measures its plans per process, so this matters for preview +vs encode; here it never varied.
  • +
  • Access order: a frame requested alone, after a linear pass, or after frames 9 and 2 is the same +frame (order.py, data/access_order_script_build.txt).
  • +
  • Through the worker (app/test/integration_fft3dfilter_determinism_test.dart, on +colorize_test.mp4, 640x480, frames 48 and 52 of a 40–59 trim): two previews and the FFV1 encode, compared +as RGB, max difference 0 for the FFT3D method at bt 3 and for TD2 with postFFT 1. With the 1.16.0 +plugin, preview vs preview differed by up to 27 levels and preview vs encode by up to 8 (FFT3D) and 5 (TD2).
  • +
+ +
+

Correction to the Plan stage. The plan said measure=0 (FFTW_ESTIMATE) "gave the same +output as the default measure=1". That holds for 32-px blocks and the default size, but not for TD2's +post-pass arguments (48-px blocks): there the two give different (each deterministic) pictures +(data/cross_process_script_build.txt, td2_post). It does not change the plan: nothing passes +measure=0, and it remains the fallback if a platform's processes ever disagree.

+
+ +

5. Who reaches FFT3DFilter

+ + + + + + +
sitehowaffected by
Noise Reduction → FFT3DFilter method ({{#NR_FFT3D}})direct, one sigma, bt 1–5fault 1 always; fault 2 at bt > 1 (default 3)
Noise Reduction → TemporalDegrain2 (temporaldegrain2.py)spatial pass (sigma pattern, bt 3) whenever degrainTR ≥ 1; post pass at postFFT 1/2fault 1 at every setting; fault 2 in the post pass
Deinterlace → QTGMC Denoiser: fft3dfilterhavsfunc, bt=noiseTDfault 1; fault 2 when NoiseTR > 0
MCTemporalDenoisehavsfunc pfMode=0 / post>0not reached: the template keeps pfMode 3 (DFTTest) and post 0
+

No format-sweep or identity check had excluded these passes, so there was nothing to re-enable; the new tests are +the checks.

+ +

6. What changes for users

+

The patched output against three runs of the unpatched build, 720x480 4:2:0 8-bit, mean |difference| in 8-bit +levels over the picture, over the left 16 luma / 8 chroma columns, and over the rest (change.py, +data/change.txt; luma shown, chroma is similar or smaller):

+ + + + + + +
passmeanleft columnsrestmax
Noise Reduction FFT3DFilter (sigma 2, bt 3)0.004–0.0830.17–0.270.000–0.08014–27
TemporalDegrain2 defaults (postFFT 0)0.00020.00802
TemporalDegrain2 postFFT 10.0040.17–0.190.00023–5
QTGMC Fast, Denoiser fft3dfilter, NoiseTR 10.00350.15–0.1607
+

The left edge now holds the picture's own mirror instead of a previous frame's. For the FFT3D method at bt 3, the +whole-picture differences in two of the three runs are the sigma race filtering a middle frame at a third of its noise +level; the patched output is the one the arguments describe. The metric is a hash and a mean difference on one fixture, +not a perceptual comparison; the point is that the result is now repeatable, not that it looks different.

+ +

7. Kalman (bt 0) is stateful by design, and unreachable

+

With bt 0 the filter carries its last output from frame to frame; upstream comments that it "is broken due to +non-linear access". The patched build still gives 2–4 hashes there, and it can never preview what it encodes. The +worker clamps fft3dBt to 1–5 (NoiseReductionParameters::fft3d_effective_bt), TD2 passes 3 and havsfunc's +QTGMC passes 1, 3 or 5, so nothing reaches it. CLAUDE.md now says to keep it that way.

+ +

8. Upstream

+

myrsloik/VapourSynth-FFT3DFilter has been dormant since 2021 and has no issue or pull request about either fault. +The forks checked have both: AmusementClub's (the most active) and RyougiKukoc's (R2 unchanged). So there is nothing to +pick up. Offering the patch upstream is outward-facing and left for the maintainer to decide.

+ +

9. Rejected: wrapping the call in the template

+

Tried: pad each plane on the left by its reflection, by whole block steps, so the stale mirror lands only in +columns cropped off afterwards; and splice the edge frames from a bt 1 instance, so the bt > 1 instance never writes +the 2D sigma. Over 4:2:0/4:2:2/4:4:4 × 8/10/16-bit × 720x480/96x64 × 5 argument sets on the unpatched build it was +deterministic in 90 of 90 cells, but equal to the patched plugin in only 27 +(wrap.py, data/wrapper.txt): the extra blocks change FFTW's plan and the rounding. It also +could not reach havsfunc's QTGMC call without patching havsfunc's core. A second, approximate +implementation of a five-line fix.

+ +

10. The builds

+
    +
  • macOS (both arches): one block after the arch split. Clone R2, apply the patch (fail if it +doesn't), compile the four files with c++ -std=c++17 -O3 -fvisibility=hidden -dynamiclib against +Homebrew's fftw3.h and the bundle's lib/libfftw3f{,_threads}.3.dylib, repoint those to +@loader_path/../../lib/, sign. Its meson.build is not used: on arm64 it does not find +fftw3f_threads, which is why arm64 used yuygfgg's prebuilt. Run locally on arm64: minos 15.0, only +@loader_path and /usr/lib references (check-macho-refs.py passes for the plugin). +The x64 block is unverified until CI runs it.
  • +
  • Linux: the existing meson build, pinned to R2, with the patch applied inside +build_plugin's command; a failed apply exits the script.
  • +
  • Windows: the R2 release DLL has both faults, so it is replaced by a Zig 0.15.2 cross-compile +(zig c++ -target x86_64-windows-gnu -mcpu=x86_64 -O3) against FFTW 3.3.5's DLL through an import library +made with zig dlltool from the zip's .def, with VapourSynth's API4 headers from the R78 tag. +Cross-compiled from macOS here: it links, exports VapourSynthPluginInit2, imports only +libfftw3f-3.dll (including fftwf_init_threads), KERNEL32 and the UCRT +(api-ms-win-crt-*), no libstdc++/libgcc DLLs, and has no AVX instructions. It has not been loaded on +Windows; build-deps-windows.yml and the push gate there are the test.
  • +
  • Plain C++ with no intrinsics, so one build serves both x64 CPU tiers (no _tierFiles entry); file names +are unchanged, so deps-expected-plugins.json is too.
  • +
+ +

11. Tests

+
    +
  • vapoursynth_integration_test.dart → fft3dfilter is deterministic (task #62), push gate, +every platform: seeded-noise 4:2:0 picture at 8 and 16 bits, four argument classes (TD2 spatial, one sigma at bt 3 and +5, bt 1), six fresh graphs each at 8 threads; a second process must give the same hashes; a flat picture must stay +within 1 level of its interior in the left 16 columns (patched: 1, the interior's own rounding; unpatched: 4–33 over 4 runs, edge.py, data/edge.txt). +Passes on the patched bundle, fails on the unpatched one, skips on bundles up to 1.17.x.
  • +
  • integration_fft3dfilter_determinism_test.dart, heavy: section 4b's worker check; skips up to 1.17.x.
  • +
+ +

Limits and what was not tested

+
    +
  • Every measurement is macOS arm64. The Linux and Windows builds, and the macOS x64 build, are checked by CI only once +build-deps-* run; nothing here proves FFTW picks the same plan in two processes on those platforms (the +push gate's second-process check will).
  • +
  • Hashes and mean differences on one fixture (plus one film clip through the worker), not a perceptual metric.
  • +
  • The cross-process checks ran on one machine, close together; FFTW_MEASURE timing could differ under load.
  • +
  • A testing trap met on the way: the worker finds its deps by its own search (upward from the executable in a debug +build, else Application Support), not from VAPOURBOX_DEPS_DIR, so a heavy test pointed at another bundle +through that variable alone runs the worker against the installed one.
  • +
+ +

Decisions

+
    +
  • Patch the plugin, not the template: it is the only fix that reaches havsfunc's QTGMC call, and the +template workaround was not bit-identical to the fixed plugin (section 9).
  • +
  • Build from source on every platform, never a prebuilt: every prebuilt has both faults.
  • +
  • Keep measure=1 (the default): processes agreed, and changing it would change output +for no measured reason. measure=0 is the fallback if CI shows a platform disagreeing.
  • +
  • Kalman stays unreachable: no fix is possible without changing what it is.
  • +
+ +

Scripts

+
    +
  • reproduce.sh <deps> re-runs everything; run.sh runs one script with a bundle's +Python; build.sh builds the unpatched and patched plugins.
  • +
  • common.py (fixture at any size, from task #57), td2.py (bisect), fft.py / +where.py (variants, where samples differ), fixed.py (builds side by side; cross-process +hashes), td2fixed.py (TD2 and QTGMC through each build), det.py (whatever plugin a bundle +loads), xproc.py, order.py, change.py, figures.py, +wrap.py (the rejected wrapper), edge.py (the push gate's flat-picture oracle).
  • +
+
+ + diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/build.sh b/docs/reports/task-62-fft3dfilter-determinism/scripts/build.sh new file mode 100755 index 00000000..1fa8d9ef --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/build.sh @@ -0,0 +1,37 @@ +#!/bin/bash +# Build FFT3DFilter R2 twice, unpatched and with +# Scripts/patches/fft3dfilter-r2-determinism.patch, under renamed namespaces +# (core.fft3dorig, core.fft3dfixed) so both load next to the bundle's own +# core.fft3dfilter. Same flags as download-deps-macos.sh's build. +# +# build.sh +# macOS only (links the bundle's lib/libfftw3f*.3.dylib); FFTW's header comes +# from Homebrew (`brew install fftw`). +set -euo pipefail +DEPS="$1"; OUT="$2" +HERE="$(cd "$(dirname "$0")" && pwd)" +REPO="$(cd "$HERE/../../../.." && pwd)" +VS_INC="$OUT/vsinc" +mkdir -p "$OUT" "$VS_INC" +for h in VapourSynth4.h VSHelper4.h VSConstants4.h; do + [ -f "$VS_INC/$h" ] || curl -fsSL "https://raw.githubusercontent.com/vapoursynth/vapoursynth/R78/include/$h" -o "$VS_INC/$h" +done +[ -d "$OUT/src" ] || git clone -q --depth 1 --branch R2 https://github.com/myrsloik/VapourSynth-FFT3DFilter.git "$OUT/src" +for kind in orig fixed; do + d="$OUT/$kind" + rm -rf "$d"; mkdir -p "$d" + cp "$OUT"/src/*.cpp "$OUT"/src/*.h "$d/" + [ "$kind" = fixed ] && (cd "$d" && patch -p1 -s < "$REPO/Scripts/patches/fft3dfilter-r2-determinism.patch") + sed -i '' "s/\"systems.innocent.fft3dfilter\", \"fft3dfilter\"/\"systems.innocent.fft3d$kind\", \"fft3d$kind\"/" "$d/Plugin.cpp" + grep -q "fft3d$kind\"" "$d/Plugin.cpp" + c++ -std=c++17 -O3 -fPIC -fvisibility=hidden -dynamiclib \ + -I"$VS_INC" -I"$(brew --prefix fftw)/include" \ + "$d"/FFT3DFilter.cpp "$d"/FFT3DFilterTransform.cpp "$d"/fft3dfilter_c.cpp "$d"/Plugin.cpp \ + "$DEPS/lib/libfftw3f.3.dylib" "$DEPS/lib/libfftw3f_threads.3.dylib" \ + -headerpad_max_install_names -o "$d/libfft3d_$kind.dylib" + for ref in $(otool -L "$d/libfft3d_$kind.dylib" | awk 'NR > 1 && /libfftw3f/ {print $1}'); do + install_name_tool -change "$ref" "$DEPS/lib/$(basename "$ref")" "$d/libfft3d_$kind.dylib" + done + codesign -s - -f "$d/libfft3d_$kind.dylib" 2>/dev/null + echo "built $d/libfft3d_$kind.dylib" +done diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/change.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/change.py new file mode 100644 index 00000000..0a3fc95d --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/change.py @@ -0,0 +1,71 @@ +"""How much the patch changes what users get: each pass that reaches +FFT3DFilter, through the unpatched build (as shipped up to deps 1.17) and the +patched one (build.sh), on the fixture at 720x480 4:2:0 8-bit, 10 frames. +The unpatched output itself varies run to run, so it is run 3 times and each +run compared with the patched result. Reported per plane in 8-bit levels: +mean |diff| over the picture, over the left 16 luma (8 chroma) columns, over +the rest, and the max. + + run.sh change.py +""" +import json, sys +import vapoursynth as vs +from common import clip +import temporaldegrain2 as td +import havsfunc as haf +core = vs.core +B = sys.argv[1] +EXT = '.dylib' if sys.platform == 'darwin' else '.so' +core.std.LoadPlugin(B + '/orig/libfft3d_orig' + EXT) +core.std.LoadPlugin(B + '/fixed/libfft3d_fixed' + EXT) +core.num_threads = 8 + + +class Proxy: + def __init__(self, ns): self._ns = ns + def __getattr__(self, k): + return getattr(core, self._ns) if k == 'fft3dfilter' else getattr(core, k) + + +def with_ns(ns, fn): + td.core = Proxy(ns); haf.core = Proxy(ns) + try: return fn() + finally: td.core = core; haf.core = core + + +c = clip('420', 8, 0, 720, 480, frames=10) +ci = clip('420', 8, 1, 720, 480, frames=10) +PASSES = { + 'Noise Reduction FFT3DFilter (sigma 2, bt 3)': lambda: core.fft3dfilter.FFT3DFilter(c, sigma=2.0, bt=3), + 'TemporalDegrain2 defaults (postFFT 0)': lambda: td.TemporalDegrain2(c), + 'TemporalDegrain2 postFFT 1': lambda: td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, postFFT=1, postSigma=1.0), + "QTGMC Fast, Denoiser='fft3dfilter', NoiseTR 1": lambda: haf.QTGMC(ci, Preset='Fast', TFF=True, NoiseProcess=1, Denoiser='fft3dfilter', NoiseTR=1, EZDenoise=2.0), +} + + +def stats(a, b): + out = [] + for p in range(3): + edge = 16 if p == 0 else 8 + tot = n = te = ne = mx = 0 + for fa, fb in zip(a.frames(), b.frames()): + A, Bv = fa[p].tolist(), fb[p].tolist() + for ra, rb in zip(A, Bv): + for x, (u, v) in enumerate(zip(ra, rb)): + d = abs(u - v) + if x < edge: te += d; ne += 1 + else: tot += d; n += 1 + if d > mx: mx = d + out.append({'mean': round((tot + te) / (n + ne), 4), 'left': round(te / ne, 4), 'rest': round(tot / n, 4), 'max': mx}) + return out + + +res = {} +for name, fn in PASSES.items(): + fixed = with_ns('fft3dfixed', fn) + runs = [stats(with_ns('fft3dorig', fn), fixed) for _ in range(3)] + res[name] = runs + for i, r in enumerate(runs): + print(name, 'run', i + 1, ' | '.join('%s mean %.4f left %.4f rest %.4f max %d' % (pl, s['mean'], s['left'], s['rest'], s['max']) + for pl, s in zip('YUV', r)), flush=True) +print(json.dumps(res)) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/common.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/common.py new file mode 100644 index 00000000..ffe91444 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/common.py @@ -0,0 +1,82 @@ +"""Shared by this report's scripts: the repo, the probe's call list, and a +real picture (Tests/TestResources/interlaced_test.avi) at any size and format. + +Run every script with the deps bundle's Python and environment (reproduce.sh). +SCRATCH (environment) is where decoded pictures go. +""" +import ctypes +import importlib.util +import os +import subprocess +import sys +import tempfile + +import vapoursynth as vs + +core = vs.core +HERE = os.path.dirname(os.path.abspath(__file__)) +REPO = os.path.abspath(os.path.join(HERE, '..', '..', '..', '..')) +TEMPLATES = os.path.join(REPO, 'worker', 'templates') +FIXTURE = os.path.join(REPO, 'Tests', 'TestResources', 'interlaced_test.avi') +SCRATCH = os.environ.get('SCRATCH') or tempfile.mkdtemp() +FFMPEG = os.environ.get('VAPOURBOX_FFMPEG', 'ffmpeg') +SS = {'420': (1, 1), '422': (1, 0), '444': (0, 0)} + +sys.path.insert(0, TEMPLATES) + + +def probe_calls(): + """The probe's call list (Scripts/probe-plugin-formats.py): each plugin + call with the template's arguments.""" + path = os.path.join(REPO, 'Scripts', 'probe-plugin-formats.py') + spec = importlib.util.spec_from_file_location('probe', path) + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod._calls() + + +_raw = {} + + +def picture(w, h, frames=10, loop=0): + """The fixture scaled to w x h as 16-bit 4:4:4, [frames] long.""" + key = (w, h, frames) + if key not in _raw: + path = os.path.join(SCRATCH, 'src_%dx%d_%d.yuv' % key) + if not os.path.exists(path): + subprocess.run([FFMPEG, '-hide_banner', '-loglevel', 'error', '-y', + '-stream_loop', str(loop), '-i', FIXTURE, '-frames:v', str(frames), + '-vf', 'scale=%d:%d:flags=bicubic' % (w, h), '-pix_fmt', 'yuv444p16le', + '-f', 'rawvideo', path], check=True) + blank = core.std.BlankClip(width=w, height=h, format=vs.YUV444P16, length=frames, + fpsnum=30000, fpsden=1001) + size = w * h * 2 * 3 + + def fill(n, f, path=path): + o = f.copy() + with open(path, 'rb') as fh: + fh.seek(n * size) + data = fh.read(size) + off = 0 + for p in range(3): + base = ctypes.cast(o.get_write_ptr(p), ctypes.c_void_p).value + st = o.get_stride(p) + for y in range(h): + ctypes.memmove(base + y * st, data[off:off + w * 2], w * 2) + off += w * 2 + return o + _raw[key] = core.std.ModifyFrame(blank, blank, fill) + return _raw[key] + + +def clip(ss, bits, field, w, h, frames=10, loop=0): + """The probe's cell: the picture at p, _FieldBased=field.""" + sw, sh = SS[ss] + fmt = core.query_video_format(vs.YUV, vs.INTEGER, bits, sw, sh) + c = core.resize.Bicubic(picture(w, h, frames, loop), format=fmt.id, dither_type='none') + c = core.std.SetFrameProps(c, _Matrix=6, _Primaries=6, _Transfer=6, _Range=0, _ChromaLocation=0) + return core.std.SetFieldBased(c, field) + + +def first_line(e): + return ((str(e).strip().splitlines() or [type(e).__name__])[0])[:160] diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/det.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/det.py new file mode 100644 index 00000000..a74d48ca --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/det.py @@ -0,0 +1,33 @@ +"""Distinct output hashes of FFT3DFilter and TemporalDegrain2 over fresh +graphs, with whichever fft3dfilter the bundle autoloads.""" +import hashlib, json, sys +import vapoursynth as vs +from common import clip +core = vs.core +core.num_threads = int(sys.argv[1]) if len(sys.argv) > 1 else 8 +RUNS = 5 +print('plugin:', [p.plugin_path.rsplit('/', 3)[-3:] for p in core.plugins() if p.namespace == 'fft3dfilter']) + +def digest(c): + m = hashlib.md5() + for f in c.frames(prefetch=16): + for p in range(f.format.num_planes): m.update(bytes(f[p])) + return m.hexdigest() + +KW = {'td2_spat': dict(planes=[0,1,2], sigma=16, sigma2=10, sigma3=6, sigma4=4, bt=3, bw=32, bh=32, ow=8, oh=8), + 'td2_post': dict(planes=[0,1,2], sigma=1.0, bt=3, bw=48, bh=48), + 'nr_bt3': dict(sigma=2.0, bt=3), + 'nr_bt5': dict(sigma=4.0, bt=5), + 'default_bt1': dict(sigma=16, bt=1), + 'sharpen': dict(bt=-1, sharpen=1)} +out = {} +import temporaldegrain2 as td2 +for bits in (8, 16): + for w, h in ((720, 480), (720, 486)): + c = clip('420', bits, 0, w, h, frames=10) + for k, kw in KW.items(): + out['%d %dx%d fft3d %s' % (bits, w, h, k)] = len({digest(core.fft3dfilter.FFT3DFilter(c, **kw)) for _ in range(RUNS)}) + for pf in (0, 1): + out['%d %dx%d td2 postFFT=%d' % (bits, w, h, pf)] = len({digest(td2.TemporalDegrain2(c, degrainTR=1, grainLevel=2, postFFT=pf, postSigma=1.0)) for _ in range(RUNS)}) +for k, v in out.items(): print(v, k) +print('MAX', max(out.values())) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/edge.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/edge.py new file mode 100644 index 00000000..9595ff14 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/edge.py @@ -0,0 +1,16 @@ +"""The push gate's flat-picture oracle, measured: worst |left 16 columns - +column 32| (luma; chroma 16) and the same over interior columns, 4 runs. + run.sh edge.py""" +import vapoursynth as vs +core = vs.core +core.num_threads = 8 +for run in range(4): + flat = core.std.BlankClip(format=vs.YUV420P8, width=352, height=288, length=6, color=[100, 128, 128]) + left = ctrl = 0 + for f in core.fft3dfilter.FFT3DFilter(flat, sigma=2.0, bt=3).frames(): + for p in range(3): + for row in f[p].tolist(): + r = row[32 if p == 0 else 16] + left = max(left, max(abs(v - r) for v in row[:16])) + ctrl = max(ctrl, max(abs(v - r) for v in row[40:120 if p == 0 else 80])) + print('left', left, 'interior', ctrl) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/fft.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/fft.py new file mode 100644 index 00000000..55e88e5e --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/fft.py @@ -0,0 +1,59 @@ +import json, sys, hashlib +import vapoursynth as vs +from common import clip +core = vs.core +core.num_threads = int(sys.argv[2]) if len(sys.argv) > 2 else 8 +mode = sys.argv[1] + +def cmp(a, b): + """per frame: [(max abs diff, fraction differing) per plane]""" + d = core.std.Expr([a, b], 'x y - abs') + ne = core.std.Expr([a, b], 'x y = 0 255 ?', format=a.format.replace(bits_per_sample=8).id) if a.format.bits_per_sample == 8 else None + out = [] + planes = range(a.format.num_planes) + ds = [core.std.PlaneStats(d, plane=p) for p in planes] + ns = [core.std.PlaneStats(ne, plane=p) for p in planes] if ne else None + for n in range(a.num_frames): + row = [] + for p in planes: + mx = ds[p].get_frame(n).props['PlaneStatsMax'] + fr = ns[p].get_frame(n).props['PlaneStatsAverage'] if ns else None + row.append((mx, round(fr, 5) if fr is not None else None)) + out.append(row) + return out + +def src(w=720, h=480, bits=8, frames=10): + return clip('420', bits, 0, w, h, frames=frames) + +def worst(c, kw, n=4): + ref = core.fft3dfilter.FFT3DFilter(c, **kw) + mx, nd, frac = 0, 0, 0 + for _ in range(n - 1): + r = cmp(ref, core.fft3dfilter.FFT3DFilter(c, **kw)) + m = max(x[0] for row in r for x in row) + mx = max(mx, m) + nd += m > 0 + frac = max(frac, max((x[1] or 0) for row in r for x in row)) + return mx, nd, n - 1, frac + +if mode == 'detail': + c = src() + kw = dict(sigma=16, bt=1, bw=32, bh=32, ow=8, oh=8, planes=[0,1,2]) + r = cmp(core.fft3dfilter.FFT3DFilter(c, **kw), core.fft3dfilter.FFT3DFilter(c, **kw)) + for i, row in enumerate(r): print(i, row) +elif mode == 'variants': + c = src() + for name, kw in [('default', {}), ('bt1', dict(bt=1)), ('bt0_kalman', dict(bt=0)), ('bt-1_sharpen', dict(bt=-1, sharpen=1)), + ('sigma0', dict(sigma=0)), ('bt1_sigma16_bw32', dict(bt=1, sigma=16, bw=32, bh=32, ow=8, oh=8)), + ('ncpu1', dict(ncpu=1)), ('ncpu4', dict(ncpu=4)), ('post_bt3_bw48', dict(sigma=1, bt=3, bw=48, bh=48)), + ('y_only', dict(planes=[0]))]: + print(name, 'max %s, differing runs %d of %d, max fraction of samples %s' % worst(c, kw), flush=True) +elif mode == 'blank': + c = core.std.BlankClip(width=720, height=480, format=vs.YUV420P8, length=10, color=[100, 128, 128]) + print('blank', worst(c, dict(sigma=16, bt=1))) +elif mode == 'hash': + c = src() + m = hashlib.md5() + for f in core.fft3dfilter.FFT3DFilter(c, sigma=16, bt=1).frames(): + for p in range(3): m.update(bytes(f[p])) + print(m.hexdigest()) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/figures.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/figures.py new file mode 100644 index 00000000..a18469bb --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/figures.py @@ -0,0 +1,51 @@ +"""The report's two figures: where two runs of the unpatched FFT3DFilter +differ, on a flat picture and on the fixture (frame 4, luma), with the +difference amplified (x48, capped at 255) and drawn white on black. The same pair +through the patched build is all black. Writes img/*.png via ffmpeg. + + run.sh figures.py +""" +import os, subprocess, sys +import vapoursynth as vs +from common import clip, FFMPEG +core = vs.core +B, OUT = sys.argv[1], sys.argv[2] +EXT = '.dylib' if sys.platform == 'darwin' else '.so' +core.std.LoadPlugin(B + '/orig/libfft3d_orig' + EXT) +core.std.LoadPlugin(B + '/fixed/libfft3d_fixed' + EXT) +core.num_threads = 8 + +flat = core.std.BlankClip(width=720, height=480, format=vs.YUV420P8, length=10, color=[100, 128, 128]) +real = clip('420', 8, 0, 720, 480, frames=10) + + +def diff_png(ns, src, kw, name, frame=4): + fn = getattr(core, ns).FFT3DFilter + worst = None + # Two fresh graphs, frames in reverse then forward order, so each + # transform instance's previous frame differs between them. + a = fn(src, **kw); b = fn(src, **kw) + for n in reversed(range(src.num_frames)): a.get_frame(n) + fa, fb = a.get_frame(frame), b.get_frame(frame) + A, Bv = fa[0].tolist(), fb[0].tolist() + w, h = len(A[0]), len(A) + buf = bytearray() + mx = 0 + for ra, rb in zip(A, Bv): + for u, v in zip(ra, rb): + d = abs(u - v); mx = max(mx, d) + buf.append(min(255, d * 48)) + path = os.path.join(OUT, name) + # The left 64 columns of the top 128 rows, each sample drawn 4x4. + subprocess.run([FFMPEG, '-hide_banner', '-loglevel', 'error', '-y', '-f', 'rawvideo', '-pix_fmt', 'gray', + '-s', '%dx%d' % (w, h), '-i', '-', '-frames:v', '1', + '-vf', 'crop=64:128:0:0,scale=256:512:flags=neighbor', path], input=bytes(buf), check=True) + cols = sorted({x for ra, rb in zip(A, Bv) for x, (u, v) in enumerate(zip(ra, rb)) if u != v}) + print(name, 'max diff', mx, 'differing columns', (cols[0], cols[-1], len(cols)) if cols else None) + + +os.makedirs(OUT, exist_ok=True) +diff_png('fft3dorig', flat, dict(sigma=16, bt=1), '01-flat-unpatched.png') +diff_png('fft3dfixed', flat, dict(sigma=16, bt=1), '02-flat-patched.png') +diff_png('fft3dorig', real, dict(sigma=16, bt=1), '03-fixture-unpatched.png') +diff_png('fft3dfixed', real, dict(sigma=16, bt=1), '04-fixture-patched.png') diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/fixed.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/fixed.py new file mode 100644 index 00000000..d03926c8 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/fixed.py @@ -0,0 +1,42 @@ +import hashlib, json, sys, subprocess +import vapoursynth as vs +from common import clip +core = vs.core +B = sys.argv[1] # build.sh's output directory +EXT = '.dylib' if sys.platform == 'darwin' else '.so' +core.std.LoadPlugin(B + '/orig/libfft3d_orig' + EXT) +core.std.LoadPlugin(B + '/fixed/libfft3d_fixed' + EXT) +core.num_threads = 8 +mode = sys.argv[2] + +def digest(c): + m = hashlib.md5() + for f in c.frames(prefetch=16): + for p in range(f.format.num_planes): m.update(bytes(f[p])) + return m.hexdigest() + +def fns(): + return {'bundled': core.fft3dfilter.FFT3DFilter, 'orig_build': core.fft3dorig.FFT3DFilter, 'fixed_build': core.fft3dfixed.FFT3DFilter} + +KW = {'td2_spat': dict(planes=[0,1,2], sigma=16, sigma2=10, sigma3=6, sigma4=4, bt=3, bw=32, bh=32, ow=8, oh=8), + 'td2_post': dict(planes=[0,1,2], sigma=1.0, bt=3, bw=48, bh=48), + 'default_bt1': dict(sigma=16, bt=1), + 'sharpen': dict(bt=-1, sharpen=1), + 'kalman_bt0': dict(sigma=4, bt=0), + 'measure0': dict(sigma=16, bt=1, measure=0)} + +if mode == 'repeat': + out = {} + for bits in (8, 16): + for w, h in ((720, 480), (720, 486)): + c = clip('420', bits, 0, w, h, frames=10) + for kname, kw in KW.items(): + for fname, fn in fns().items(): + hs = {digest(fn(c, **kw)) for _ in range(5)} + out['%d-bit %dx%d %s %s' % (bits, w, h, kname, fname)] = len(hs) + print(bits, w, h, kname, fname, len(hs), flush=True) + print(json.dumps(out)) +elif mode == 'hash': + # one hash per process: cross-process determinism (FFTW_MEASURE plans) + c = clip('420', int(sys.argv[3]), 0, 720, 480, frames=10) + print(json.dumps({k: digest(core.fft3dfixed.FFT3DFilter(c, **kw)) for k, kw in KW.items() if k != 'kalman_bt0'})) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/order.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/order.py new file mode 100644 index 00000000..45491c29 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/order.py @@ -0,0 +1,25 @@ +"""Frame k of FFT3DFilter: alone in a fresh graph, vs after other frames.""" +import hashlib, sys +import vapoursynth as vs +from common import clip +core = vs.core +core.num_threads = int(sys.argv[1]) +c = clip('420', 8, 0, 640, 480, frames=10) +def h(f): + m = hashlib.md5() + for p in range(3): m.update(bytes(f[p])) + return m.hexdigest()[:8] +for name, kw in {'bt3': dict(sigma=2.0, bt=3), 'bt1': dict(sigma=2.0, bt=1)}.items(): + k = 5 + alone = {h(core.fft3dfilter.FFT3DFilter(c, **kw).get_frame(k)) for _ in range(4)} + seq = set() + for _ in range(4): + n = core.fft3dfilter.FFT3DFilter(c, **kw) + fr = list(n.frames()) + seq.add(h(fr[k])) + after9 = set() + for _ in range(4): + n = core.fft3dfilter.FFT3DFilter(c, **kw) + n.get_frame(9); n.get_frame(2) + after9.add(h(n.get_frame(k))) + print(name, 'alone', alone, 'sequential', seq, 'after 9,2', after9) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/reproduce.sh b/docs/reports/task-62-fft3dfilter-determinism/scripts/reproduce.sh new file mode 100755 index 00000000..b0a62e92 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/reproduce.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# Re-run every measurement in this report (macOS arm64; ~3 minutes). +# +# reproduce.sh +# +# is a deps/macos-arm64 bundle as released up to 1.17 (unpatched +# FFT3DFilter). SCRATCH (default a temp dir) holds the decoded fixture and the +# two plugin builds. bundle_with_script_build.txt, cross_process_script_build.txt +# and access_order_script_build.txt need a copy of the bundle whose +# vapoursynth/plugins/libfft3dfilter.dylib is the one download-deps-macos.sh +# builds; pass it as PATCHED_DEPS to include them. +set -euo pipefail +HERE="$(cd "$(dirname "$0")" && pwd)" +DEPS="$(cd "$1" && pwd)" +export SCRATCH="${SCRATCH:-$(mktemp -d)}" +DATA="$HERE/../data"; IMG="$HERE/../img" +mkdir -p "$DATA" "$IMG" +B="$SCRATCH/builds" +"$HERE/build.sh" "$DEPS" "$B" +run() { "$HERE/run.sh" "$DEPS" "$@"; } + +run td2.py repeat 6 full,fft3d_spat,fft3d_bt1,fft3d_post,mvdegrain,dfttest > "$DATA/bisect.txt" +{ run fft.py variants; run fft.py blank; } > "$DATA/variants.txt" +run where.py blank > "$DATA/where_blank.txt" +run det.py 8 > "$DATA/bundle_1.16.0.txt" +{ echo "# 1.16.0 bundle"; run edge.py; } > "$DATA/edge.txt" +run fixed.py "$B" repeat > "$DATA/builds.txt" +run td2fixed.py "$B" > "$DATA/td2_qtgmc_builds.txt" +for bits in 8 16; do + for i in 1 2 3 4 5 6 7; do run fixed.py "$B" hash $bits; done > "$DATA/cross_process_${bits}bit.txt" +done +run wrap.py "$B" > "$DATA/wrapper.txt" +run change.py "$B" > "$DATA/change.txt" +run figures.py "$B" "$IMG" > "$DATA/figures.txt" + +if [ -n "${PATCHED_DEPS:-}" ]; then + P="$(cd "$PATCHED_DEPS" && pwd)" + "$HERE/run.sh" "$P" det.py 8 > "$DATA/bundle_with_script_build.txt" + for m in 1 0; do for sz in 640x480 720x480 352x288; do + echo "measure=$m $sz" + for i in 1 2 3 4 5; do "$HERE/run.sh" "$P" xproc.py "${sz%x*}" "${sz#*x}" $m | tail -1; done | sort | uniq -c + done; done > "$DATA/cross_process_script_build.txt" + "$HERE/run.sh" "$P" order.py 8 > "$DATA/access_order_script_build.txt" + { echo "# bundle with the script build"; "$HERE/run.sh" "$P" edge.py; } >> "$DATA/edge.txt" +fi +echo "done: $DATA" diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/run.sh b/docs/reports/task-62-fft3dfilter-determinism/scripts/run.sh new file mode 100755 index 00000000..879361dd --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash +# Run one of this report's scripts with a deps bundle's Python and environment: +# run.sh [args...] +# SCRATCH (environment, default a temp dir) holds the decoded fixture. +D="$(cd "$1" && pwd)"; shift +cd "$(dirname "$0")" +PYTHONHOME="$D/python" PYTHONPATH="$D:$D/python-packages" PYTHONNOUSERSITE=1 \ +XDG_CONFIG_HOME="$D/config" VAPOURBOX_FFMPEG="$D/ffmpeg/ffmpeg" \ +SCRATCH="${SCRATCH:-$(mktemp -d)}" "$D/python/bin/python3" "$@" diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/td2.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/td2.py new file mode 100644 index 00000000..74b642ae --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/td2.py @@ -0,0 +1,53 @@ +import hashlib, json, sys, time +import vapoursynth as vs +from common import clip +import temporaldegrain2 as td +from hybrid_mv import MV +core = vs.core +RUNS = int(sys.argv[2]) if len(sys.argv) > 2 else 6 + +def digest(c): + m = hashlib.md5() + for f in c.frames(prefetch=16): + for p in range(f.format.num_planes): + m.update(bytes(f[p])) + return m.hexdigest() + +def src(w=720, h=480, bits=8, frames=10): + return clip('420', bits, 0, w, h, frames=frames) + +def graph(name, c): + if name == 'full': return td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, postFFT=1, postSigma=1.0) + if name == 'post0': return td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, postFFT=0) + if name == 'post3': return td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, postFFT=3) + if name == 'stage0': return td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, outputStage=0) + if name == 'stage1': return td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, outputStage=1) + if name == 'tr0_post1': return td.TemporalDegrain2(c, degrainTR=0, grainLevel=2, postFFT=1, postSigma=1.0) + if name == 'fft3d_spat': + return core.fft3dfilter.FFT3DFilter(c, planes=[0,1,2], sigma=16, sigma2=10, sigma3=6, sigma4=4, bt=3, bw=32, bh=32, ow=8, oh=8) + if name == 'fft3d_bt1': + return core.fft3dfilter.FFT3DFilter(c, planes=[0,1,2], sigma=16, bt=1, bw=32, bh=32, ow=8, oh=8) + if name == 'fft3d_post': + return core.fft3dfilter.FFT3DFilter(c, planes=[0,1,2], sigma=1.0, bt=3, bw=48, bh=48) + if name == 'dfttest': + return core.dfttest.DFTTest(c, sigma=4, tbsize=3, sbsize=12, sosize=9) + if name == 'mvdegrain': + sup = core.mv.Super(c, pel=4, sharp=2, hpad=8, vpad=8) + v = MV.AnalyseMany(sup, radius=1, blksize=8, overlap=4, search=4, searchparam=2, pelsearch=4, truemotion=False, lambda_=100, pnew=25, global_=True, dct=0, chroma=True) + s1 = core.mv.Super(c, pel=4, sharp=2, hpad=8, vpad=8, levels=1) + return MV.Degrain(c, s1, *v, plane=4, thsad=448, limit=255, thscd1=192, thscd2=128) + raise ValueError(name) + +if sys.argv[1] == 'repeat': + names = sys.argv[3].split(',') + threads = [int(t) for t in sys.argv[4].split(',')] if len(sys.argv) > 4 else [8, 1] + size = (720, 480) + out = {} + for name in names: + for t in threads: + core.num_threads = t + t0 = time.time() + hs = [digest(graph(name, src(*size))) for _ in range(RUNS)] + out.setdefault(name, {})[t] = len(set(hs)) + print(name, t, len(set(hs)), round(time.time()-t0, 1), flush=True) + print(json.dumps(out)) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/td2fixed.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/td2fixed.py new file mode 100644 index 00000000..d77f4836 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/td2fixed.py @@ -0,0 +1,43 @@ +import hashlib, json, sys +import vapoursynth as vs +from common import clip +import temporaldegrain2 as td +import havsfunc as haf +core = vs.core +B = sys.argv[1] # build.sh's output directory +EXT = '.dylib' if sys.platform == 'darwin' else '.so' +core.std.LoadPlugin(B + '/orig/libfft3d_orig' + EXT); core.std.LoadPlugin(B + '/fixed/libfft3d_fixed' + EXT) + +class Proxy: + def __init__(self, ns): self._ns = ns + def __getattr__(self, k): + if k == 'fft3dfilter': return getattr(core, self._ns) + return getattr(core, k) + +def digest(c): + m = hashlib.md5() + for f in c.frames(prefetch=16): + for p in range(f.format.num_planes): m.update(bytes(f[p])) + return m.hexdigest() + +def with_ns(ns, fn): + td.core = Proxy(ns); haf.core = Proxy(ns) + try: return fn() + finally: td.core = core; haf.core = core + +out = {} +for threads in (8, 1): + core.num_threads = threads + for bits in (8, 16): + for h in (480, 486): + c = clip('420', bits, 0, 720, h, frames=10) + ci = clip('420', bits, 1, 720, h, frames=10) + for ns in ('fft3dorig', 'fft3dfixed'): + for name, fn in (('td2_post1', lambda: td.TemporalDegrain2(c, degrainTR=1, grainLevel=2, postFFT=1, postSigma=1.0)), + ('td2_default', lambda: td.TemporalDegrain2(c)), + ('qtgmc_fft3d', lambda: haf.QTGMC(ci, Preset='Fast', TFF=True, NoiseProcess=1, Denoiser='fft3dfilter', NoiseTR=1, EZDenoise=2.0))): + if name.startswith('qtgmc') and h == 486: continue + hs = {digest(with_ns(ns, fn)) for _ in range(4)} + key = '%d threads %d-bit 720x%d %s %s' % (threads, bits, h, name, ns) + out[key] = len(hs); print(key, len(hs), flush=True) +print(json.dumps(out)) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/where.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/where.py new file mode 100644 index 00000000..9e3607bf --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/where.py @@ -0,0 +1,27 @@ +import sys +import vapoursynth as vs +from common import clip +core = vs.core +core.num_threads = 8 +kw = dict(sigma=16, bt=1) +if sys.argv[1] == 'blank': + c = core.std.BlankClip(width=720, height=480, format=vs.YUV420P8, length=10, color=[100, 128, 128]) +else: + c = clip('420', 8, 0, 720, 480, frames=10) +a = core.fft3dfilter.FFT3DFilter(c, **kw); b = core.fft3dfilter.FFT3DFilter(c, **kw) +for n in range(10): + fa, fb = a.get_frame(n), b.get_frame(n) + for p in range(3): + w, h = fa.width if p == 0 else fa.width // 2, fa.height if p == 0 else fa.height // 2 + A, B = bytes(fa[p]), bytes(fb[p]) + rows, cols = {}, {} + vals = [] + for y in range(h): + ra, rb = A[y*w:(y+1)*w], B[y*w:(y+1)*w] + for x in range(w): + if ra[x] != rb[x]: + rows[y] = rows.get(y, 0) + 1; cols[x] = cols.get(x, 0) + 1 + if len(vals) < 6: vals.append((x, y, ra[x], rb[x])) + if rows: + ys, xs = sorted(rows), sorted(cols) + print(n, p, 'count', sum(rows.values()), 'rows', ys[0], '..', ys[-1], len(ys), 'cols', xs[0], '..', xs[-1], len(xs), vals) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/wrap.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/wrap.py new file mode 100644 index 00000000..0e61f373 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/wrap.py @@ -0,0 +1,69 @@ +import hashlib, json, sys, time +import vapoursynth as vs +from common import clip +core = vs.core +B = sys.argv[1] # build.sh's output directory +EXT = '.dylib' if sys.platform == 'darwin' else '.so' +core.std.LoadPlugin(B + '/fixed/libfft3d_fixed' + EXT); core.std.LoadPlugin(B + '/orig/libfft3d_orig' + EXT) +core.num_threads = 8 + +def reflect_left(c, pl, pc): + """Each plane padded on the left by its reflection (edge sample not repeated).""" + if c.format.color_family == vs.GRAY: + planes = [c] + else: + planes = [core.std.ShufflePlanes(c, p, vs.GRAY) for p in range(3)] + out = [] + for i, p in enumerate(planes): + P = pl if i == 0 else pc + strip = core.std.FlipHorizontal(core.std.Crop(p, left=1, right=p.width - 1 - P)) + out.append(core.std.StackHorizontal([strip, p])) + if c.format.color_family == vs.GRAY: + return out[0] + return core.std.ShufflePlanes(out, [0, 0, 0], vs.YUV) + +def fft3d(fn, c, **kw): + bw = kw.get('bw', 48); ow = kw.get('ow', -1) + if ow < 0: ow = bw // 3 + mirw = bw - ow + ssw = c.format.subsampling_w + pc = mirw; pl = mirw << ssw + bt = kw.get('bt', 3) + sig = kw.get('sigma', 2.0) + pattern = any(k in kw and kw[k] != sig for k in ('sigma2', 'sigma3', 'sigma4')) or kw.get('pfactor', 0) != 0 + padded = reflect_left(c, pl, pc) + def run(**k): + o = fn(padded, **k) + return core.std.Crop(o, left=pl) + out = run(**kw) + if bt > 1 and not pattern: + a, b = bt // 2, (bt - 1) // 2 + k1 = dict(kw); k1['bt'] = 1 + edge = run(**k1) + n = c.num_frames + out = edge[:a] + out[a:n - b] + edge[n - b:] + return out + +def digest(c): + m = hashlib.md5() + for f in c.frames(prefetch=16): + for p in range(f.format.num_planes): m.update(bytes(f[p])) + return m.hexdigest() + +KW = {'td2_spat': dict(planes=[0,1,2], sigma=16, sigma2=10, sigma3=6, sigma4=4, bt=3, bw=32, bh=32, ow=8, oh=8), + 'td2_post': dict(planes=[0,1,2], sigma=1.0, bt=3, bw=48, bh=48), + 'nr_default': dict(sigma=2.0, bt=3), + 'nr_bt5': dict(sigma=2.0, bt=5, sharpen=0.5), + 'bt1': dict(sigma=16, bt=1)} +out = {} +for ss in ('420', '422', '444'): + for bits in (8, 10, 16): + for w, h in ((720, 480), (96, 64)): + c = clip(ss, bits, 0, w, h, frames=10) + for k, kw in KW.items(): + ref = digest(core.fft3dfixed.FFT3DFilter(c, **kw)) + hs = {digest(fft3d(core.fft3dorig.FFT3DFilter, c, **kw)) for _ in range(3)} + key = '%s p%d %dx%d %s' % (ss, bits, w, h, k) + out[key] = {'distinct': len(hs), 'equals_fixed_plugin': hs == {ref}} + print(key, out[key], flush=True) +print(json.dumps(out)) diff --git a/docs/reports/task-62-fft3dfilter-determinism/scripts/xproc.py b/docs/reports/task-62-fft3dfilter-determinism/scripts/xproc.py new file mode 100644 index 00000000..900fe6c0 --- /dev/null +++ b/docs/reports/task-62-fft3dfilter-determinism/scripts/xproc.py @@ -0,0 +1,15 @@ +"""One hash per process: does FFT3DFilter agree across processes? +argv: width height measure""" +import hashlib, sys +import vapoursynth as vs +from common import clip +core = vs.core +w, h, measure = int(sys.argv[1]), int(sys.argv[2]), int(sys.argv[3]) +c = clip('420', 8, 0, w, h, frames=10) +out = {} +for k, kw in {'bt3': dict(sigma=2.0, bt=3), 'td2_spat': dict(planes=[0,1,2], sigma=16, sigma2=10, sigma3=6, sigma4=4, bt=3, bw=32, bh=32, ow=8, oh=8), 'td2_post': dict(planes=[0,1,2], sigma=1.0, bt=3, bw=48, bh=48)}.items(): + m = hashlib.md5() + for f in core.fft3dfilter.FFT3DFilter(c, measure=measure, **kw).frames(): + for p in range(3): m.update(bytes(f[p])) + out[k] = m.hexdigest()[:8] +print(out) diff --git a/licenses/NOTICES.txt b/licenses/NOTICES.txt index 537ebcbe..6d0a6189 100644 --- a/licenses/NOTICES.txt +++ b/licenses/NOTICES.txt @@ -494,6 +494,12 @@ FFT3DFilter — GPL-2.0 Copyright (C) 2015 Yusuke Nakamura (VapourSynth port) https://github.com/myrsloik/VapourSynth-FFT3DFilter Licence text: GPL-2.0.txt + Built from source at tag R2 on every platform. VapourBox applies + Scripts/patches/fft3dfilter-r2-determinism.patch, which fixes two faults + that made its output differ from run to run (a left border mirrored from + memory not yet written; a per-frame sigma in a shared member of a parallel + filter). The patch header carries the analysis; the patched source is the + R2 tag with that file applied. TTempSmooth — GPL-3.0 Copyright (C) 2004-2005 Kevin Stone (tritical); VapourSynth port by HolyWu