max_w maximum white valueinput scene referred and debayered data, works in-place or before a display transformoutput histogram compressed image datathis is mostly a port of the reinhard_extended_luminance function by Matt Taylor found at https://64.github.io/tonemapping/#extended-reinhard-luminance-tone-map