Skip to content

Fix incorrect mean FLIP error - #11

Merged
nowsprinting merged 2 commits into
mainfrom
fix/mean-precision
Oct 15, 2026
Merged

nowsprinting merged 2 commits into
mainfrom
fix/mean-precision

Conversation

@nowsprinting

Copy link
Copy Markdown
Contributor

Changes

  • Accumulate the per-pixel sum in double in flip-native/flip_capi.cpp so that MeanError matches the actual mean of the error map
    • Same issue as fixed upstream in NVlabs/flip#45. flip-native computes the mean itself (to also take the peak before colormapping), so updating the submodule alone does not fix it
  • Add a test that MeanError equals the double-precision mean of ErrorMap
  • Sync the expected means with upstream test.py (LDR 0.159693, HDR 0.283547)

Notes

  • MeanError values change slightly (e.g. LDR test images: 0.159691 → 0.159693)
  • Native libraries need to be rebuilt for all platforms

🤖 Generated with Claude Code

nowsprinting and others added 2 commits October 15, 2026 19:00
Upstream FLIP (NVlabs/flip#45) found that accumulating the sum in float
makes the reported mean drift from the actual mean of the error map.
flip_capi.cpp has its own copy of that accumulation, so pin the expected
behavior here and sync the expected means with upstream test.py.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Accumulating the per-pixel sum in float loses precision as the pixel
count grows, so the reported mean did not match the actual mean of the
error map. Same issue as fixed upstream in NVlabs/flip#45.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused precision correction has appropriate regression coverage and no identified blocking issues; tests were not run.

0 open findings

What changed in this PR

Corrects mean FLIP error calculation in the native wrapper used by the C# bindings.

Changes:

  • Accumulates pixel errors in double precision.
  • Adds regression coverage comparing MeanError with the error-map mean.
  • Updates expected LDR and HDR means to upstream values.
File Description
FlipBinding.CSharp.Tests/​FlipTest.cs Adds mean-consistency coverage and updates expected values.
flip-native/​flip_capi.cpp Uses double precision when calculating mean error.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@nowsprinting nowsprinting added the bug Something isn't working label Oct 15, 2026
@nowsprinting
nowsprinting merged commit 6791e24 into main Oct 15, 2026
8 checks passed
@nowsprinting
nowsprinting deleted the fix/mean-precision branch October 15, 2026 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants