Image files are loaded either into conventional memory if they are small enough so as not to exhaust the page pool which Windows makes available for pictures. Otherwise it is loaded as a memory mapped file which has a set of pointers to the lines of the image.
If the original file is in a known RAW format, this is first translated when loading by using a dynamic link library based on code from David Coffin's DCRAW programme, see:
Simplifying the method described in the published paper of Meylan, Alleyson and Süsstrunk, CFA chromaticity data is not needed in this programme. Instead, a standard Y-Cb-Cr transformation to extract luminance from RGB image data is used which gives almost equally good performance and much greater computational simplicity. The Y luminance data is written to a 32 bit floating point memory mapped file.
This file is passed through a separable Gaussian filter following Young & van Vliet as coded by Geusebroek and van der Weijer with a value of 3 sigma in the X direction resulting in the creation of another temporary file and then again in the Y direction. This Gaussian smoothed image is written to a temporary file. This is the first smoothed luminance.
The original luminance and the Gaussian smoothed file are then combined using the Naka-Rushton equation to create yet another temporary file. The Naka-Rushton response is determined by each pixel's luminance and the value of the luminance in the Gaussian filtered surrounding area:
This result is passed yet again through Gaussian filters with value sigma of 1.5 in both X and Y directions and re-passed through the Naka
Rushton equation a second time. This simulates a simplified model of the retina:
The first pass mimics horizontal cell behaviour, the second pass mimics the Amacrine response of the two layers in the retina which enable us to see in dark and light areas simultaneously.
Dark Areas Bright Areas
The low-pass Gaussian filtered data is shown here as used with the Naka-Rushton correction.
Then, the original luminance data as well as the doubly treated luminance data then have their gamma raised by a factor of 2.2. The ratio of smoothed gamma corrected luminance and the original gamma corrected luminance are applied to each RGB pixel from the original image which restores the chromaticity from the original data.
Finally, the gamma of this coloured result is reduced by an amount given by the user's choice of saturation/intensity with the track bar and the image displayed in 24 bit RGB true colour.
Graphics here are taken from the article by Meylan, Alleyson and Süsstrunk, see Bibliography.