@aurelienpierre Of course i did take a look at the negadoctor source code while moving the RT filmneg code past demosaic

(BTW: the code is very well commented and clear to understand, thanks for that!)

I noticed you get the log10 first, then multiply and offset the resulting exponent, and finally exp10 to get the output, which *should* (i think…) be the same as exponentiating and multiplying the input (of course with different values), and in fact i get very similar results between the new RT filmneg and negadoctor.

But there’s one thing i wanted to ask you and never found the time: if i understand correctly, you do the calculation in the user-selected working space (which is Rec2020 by default).

Did you do it in purpose, so that a user can choose to do the non-linear calculation in a different space? For example, choosing ProPhoto gives a noticeably different output (of course after re-selecting the Dmin and neutral spots).

In my implementation i decided to create a dedicated colorspace with three spectral primaries at 650nm, 550nm, 460nm which are approximately the wavelengths of peak sensitivity according to both Kodak and Fujifilm datasheets.

(BTW i’ve used the wonderful tutorial and source code on ninedegreesbelow.com )

Then i’ve converted the image from whatever working profile to this color space, performed the non-linear stuff, and then converted back to the original working space. So that the inversion happens on the same red, green and blue primaries that were actually “recorded” by the film emulsion.

I don’t know, it seemed logical to me… do you think it can make sense? Or i just got everything wrong?

(…sorry about my bad math and explanation skills)

Any opinion or suggestion is appreciated