Reduce memory use for Linear DNG decoding and CPU export - #1078
Conversation
Preserve float64 normalization, preview caching, filter halos, and full-frame Numba dispatch for short tails. Based on upstream e8dc997; retain upstream shadow-dependent sharpening. Validation: Linux 5487 tests and Windows 5503 tests passed, with 69 subtests each. All 67 exact baseline comparisons passed on each platform. Ruff formatting/lint and type checks passed.
Update to 6d93baf and preserve Positive Source and Scanlight changes. Validation: Windows 5523 tests and Linux 5507 tests passed, with 71 subtests on each. All 73 exact upstream comparisons passed on each platform. Ruff format/lint and type checks passed.
Merge upstream 8e7474f, including incremental painted-heal bakes. Full default suites pass on Windows (5530 tests) and Linux (5514 tests), with 71 subtests per platform. Ruff formatting/lint and type checks pass on both.
|
I'm doing 244MP DNG conversions with JPEG XL inside, and got issues with too high memory usage. This PR reduces the memory use by 51% by processing data in chunks rather than all at once. This makes huge conversions possible on limited RAM (32GB), but may slow down the process by some amount which should probably be measured before taking this in. Thumbs up if I can continue - then I'll try measure if it affects the processing time (for images I can fit in memory). |
|
AI-assisted comment (model: gpt-6-astra). Windows CPU timing follow-up: compared Median paired changes:
All corresponding rendered-pixel and encoded-file hashes matched. These results are fixture-specific, not a full-resolution 244 MP speed claim. Linux timing remains incomplete: the baseline repeatedly reached the host-memory safety limit, so no reliable Linux percentage is available yet. |
Summary
Reduce temporary memory use for Linear DNG decoding and full-resolution CPU export without early downsampling or reduced arithmetic precision.
Validated candidate: 5b17c49, pushed to
hsnilsson/NegPyoncodex/reduce-linear-dng-memory-pr. All results below refer to this candidate. Baseline comparisons use upstream main at8e7474f(2026-09-10), including incremental painted-heal bakes. No product code changed after the final validation.Regression checks (2026-09-10)
Full-resolution comparison (2026-09-10)
The full-original Linux baseline/candidate comparison completed successfully for both JPEG and 16-bit TIFF. The input was a 19,200 x 12,752 JPEG XL DNG, exported at its normal 19,120 x 12,736 DNG crop without extra cropping or resizing. Color Negative, saturation, skin protection, and masked USM were enabled; each version reused one ImageProcessor for JPEG followed by TIFF.
Memory and batch validation (2026-09-10)
These checks use the same candidate and baseline identified above. Memory figures below are decimal GB.
Limits
Full-original parity covers one image and one process mode on Linux. Full-original Windows baseline attempts stopped at the memory guard, so full-original Windows baseline/candidate parity remains unverified. The measurements are fixture-specific, not guarantees of a general reduction or the absence of leaks. Longer production batches and desktop queue/prefetch behavior were not validated. The default suite excludes slow tests and skips unavailable platform/sample/profile cases. GPU processing, Richardson-Lucy sharpening, and denoise are unchanged. Full-frame source/output buffers and other stages still use substantial memory.