Skip to content

BUG: Improve CDF 9/7 filter coefficient precision - #912

Open
go165 wants to merge 1 commit into
PyWavelets:mainfrom
go165:codex/cdf97-coefficient-precision
Open

go165 wants to merge 1 commit into
PyWavelets:mainfrom
go165:codex/cdf97-coefficient-precision

Conversation

@go165

@go165 go165 commented Dec 2, 2026

Copy link
Copy Markdown

Refs #900. This covers the CDF 9/7 filters used by bior4.4 and rbio4.4.

The stored taps leave enough low-pass leakage to overwhelm very small double-precision detail coefficients. In a synthetic unit-pedestal stripe image with contrast ±2⁻⁴⁴, the expected detail is +1.13687e−13. The current filter produces −1.88653e−12. The revised filter produces +1.13659e−13, within 2.78e−17 of the expected value.

Derive the two low-pass factors from the polynomial in Cohen, Daubechies and Feauveau (1992), §6.B at high precision. Preserve the existing phase, signs and zero padding so both biorthogonal orders use the same corrected taps.

Verification

  • Four new 2-D reconstruction cases fail on c3cd0a0 and pass with the patch. They exercise both orders, periodization and symmetric extension, and an odd input dimension.
  • Independently recomputed taps agree with the native binary64 filter banks. Across 432 round trips, the worst relative float64 error drops from 11,831.14 to 1.169 machine epsilons. The float32 taps compare bit-for-bit with the baseline.
  • Native Windows x64 MSVC builds were used for both revisions with Python 3.13.13 and NumPy 2.5.5.

AI disclosure

OpenAI Codex derived and checked the coefficients, prepared the patch and tests, and ran local validation on behalf of go165.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant