The calculation is:
X represents the set of input image pixels, N the new output
L is the Lehmer mean of the image (p is used to adjust brightness, default 0 i.e. harmonic mean)
G is a gaussian kernel centred around each pixel
A is the resulting per pixel map used to apply the tone curve (i.e. the final step N)
The input range is assumed to be 0 < i < 1 because of division by zero (I just add a small value) and if normalizing at the end it doesn't matter too much.
Not the best explanation I know but perhaps it's of use to somebody!
Edit: yikes, forgot to actually use the h term... updated