Repository navigation
Make FFT3DFilter deterministic: build R2 from source with a patch (task #62) - #222
Merged
StuartCameronCode merged 1 commit intoNov 18, 2026
Conversation
…(task #62) TemporalDegrain2, the FFT3D Noise Reduction method and QTGMC's fft3dfilter denoiser gave a different picture on every run, so the preview never matched the encode. Both faults are in FFT3DFilter itself: the left border was mirrored before the source line was copied (stale memory), and a per-frame Wiener sigma lived in a shared member of an fmParallel filter. Scripts/patches/fft3dfilter-r2-determinism.patch fixes both; every download-deps-* script builds R2 from source with it (Windows via a Zig cross-compile) and fails if it stops applying. Push-gate and heavy tests, report docs/reports/task-62-fft3dfilter-determinism. Needs deps 1.18.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
StuartCameronCode
force-pushed
the
stuart/62-temporaldegrain2-noise-reduction-gives-d
branch
from
November 18, 2026 02:25
90380d5 to
4972554
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes task #62: TemporalDegrain2 (and every other FFT3DFilter user) gave a different output on every run, so a preview never matched its encode.
Cause
The fault is in FFT3DFilter itself (R2, and every other published build), not TemporalDegrain2 or MVTools. It has two bugs:
FramePlaneToCoverbuf). The left 10 luma / 6 chroma columns came from the previous frame's pixels or uninitialised memory. This is upstream regression da50417.fmParallelfilter. An edge frame (btcur1) could overwrite it while a middle frame was using it. This happens wheneverbt > 1with a single sigma: the FFT3D method, TD2's post pass, and QTGMC with NoiseTR > 0.Change
Scripts/patches/fft3dfilter-r2-determinism.patch.sigmaSquaredNoiseNormeda local inWiener3DandApplyFilter..def. This replaces the R2 release DLL.vapoursynth_integration_test.dartadds "fft3dfilter is deterministic (task perf(arm64): route std.Expr through akarin's LLVM JIT #62)".integration_fft3dfilter_determinism_test.dart. Two previews must be identical, and the preview must be identical to the FFV1 encode. It covers the FFT3D method and TD2 with its post pass.docs/reports/task-62-fft3dfilter-determinism.bt=0(Kalman) stays unreachable:NoiseReductionParameters::fft3d_effective_btclamps to 1–5.Testing
VapourSynthPluginInit2.libfftw3f-3.dll, KERNEL32 and the CRT.vapoursynth_integration_test.dartandattribution_test.dartpass. The new test skips on the local 1.16 bundle.Takes effect only in deps 1.18.0
The fix only reaches users through a new deps release (1.18.0), and
deps-version.jsonis not bumped here. After the bundles are built, run the push gate on all four platforms withdeps_run_id. That will be the first run of the Windows Zig build, and of the new test anywhere other than macOS arm64.If any platform's second process disagrees, the fallback is
measure=0(FFTW_ESTIMATE). It goes at our call sites and as the plugin's default in the patch.🤖 Generated with Claude Code