PrepareImage copied the finite pixels and ran two nth_element over them (18 M pixels on a 16M
detector, ~200 ms single-threaded). Two counting passes over the float bits (upper, then lower
16 bits of an order-preserving key) give the same k-th values in ~55 ms without the copy. Values
are identical; only the sign of a zero picked as a quantile may differ, which the clipping maps
to the same prepared image.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PXc1zD1yxHqaR1DGdCTHL4