Introducing the filmic module in darktable

That also depends. There is nothing in ISO 12232:2019 that mandates this, and cameras deviate from this to varying extents and in both directions. (Yes, apparently, there have been a few Panasonic cameras with negative raw headroom.)

And so this does not necessarily follow:

1 Like

Yes, I am assuming a 18% grey but if it is not the case the corresponding EV will vary, don’t it?

if you set grey to 25% whiteEV would be only 2 EV, to steps from grey point to clipping.

I understand that if the photometer is calibrated to 18% you should use that at first.

But ir you have subexposed your image 1 EV you should use a greater grey point to get the correct exposure (may be you have made it intentionally or you have read in a brighter part of the scene).

Let me try to clarify: camera manufacturers are free to map whatever raw value they want to middle grey as long as it corresponds to the nominal focal plane exposure for the ISO setting in use (0.1 lx·s for a standard output sensitivity of 100 for example). Literally the only thing that the ISO standard says about RAW is that ISO speeds shall not be reported for them because they haven’t been processed yet.

It is perfectly legal to implement all ISO settings with the same analog amplification and RAW values, and so then you have more headroom above middle grey at higher ISO settings, because the RAW value that will be mapped to middle grey is lower.

This is not just theoretical: my E-M1 Mark II does exactly that for ISO 64 and ISO 200. For a given exposure, the RAW files are identical with both settings (verified in RawDigger).

Have you watched @anon41087856 extensive videos? I feel like he covers this in a lot of detail.

Well I have finished the excel file to implement calculations of the filmic curve that @anon41087856 provided.

I was having some problems because I was in the error of thinking that a 18% value in the raw file from white point should be mapped to a 50% value after applying the shaper function.

And then I had a bug in the formulas of the transfer function that keep me getting negative values of TD.

But I have corrected it and now it works well.

I can input the white point and black point of the camera values (and the number of bits) and get BlackEV an WhiteEV calculated.

I calculate also the output display values with a given gamma and number of bits of the display.

So I can show the shaper transform, the transfer function transform, normalize output (before gamma conversion) against camera normalize values and display data versus camera raw data.

If I understood well what @anon41087856 explained the transfer function has to be applied to the output of the shaper function.
Then you apply the gamma correction to get the display values.

For the example I give before:

RAW values (12 bits)

white clip value: 4090
black value: 4

grey 18%

this gives -7.5 BlackEV and 2.47 whiteEV. Dynamic range about 10.

lattitude: 7
contrast: 1.2

Display 8 bits, gamma 1.1

This is the shaper function against normalize camera data

This the transfer function (Hermite spline interpolation) with lattitude 7 and 1.2 contrast

What I wanted to see the normalize output of combined transfer and shaper (before final converstion to display with gamma) against normalize input of the raw sensor data.
And the final display data after gamma conversion and in display units against raw input data.

I will put it later (I had uploaded come curves but they were incorrect, I will upload them when I get them correct).

I am not sure yet if all is correct, I think this is the way filmic does its job.

If somebody is interested in the excel file in order to play his own games with numbers, no problem to provide it.

1 Like

Would be interesting to play around with this spreadsheet, therefore it’s a good idea to share the file.

Ok, I have detected that it has some flaws yet.

The ouput of shaper and transform functions is not ok (you can see it because curves don’t cross at the gray point), I have multiplied the two curves instead of applying the result of shaper as input to the transfer function :scream: :hot_face:

That is the result of using a computer late at night :stuck_out_tongue_closed_eyes:

I will correct it and make some improvements and cleaning, and add comparations with other curves as a gamma curve.

And I will create a new thread to comment results and upload the excel file.

Well I have been polishing the excel.

I have corrected previous errors, reorganized things and commenting it.
I have added the balance function that was missing in previous versions.

Here it is (I will create a thread introducing the datasheet calculations and giving some exapmple).

https://we.tl/t-COkEAj2cA0

And here are the curves that where incorrect in previous message.

The shaper only transformation versus normalize input and compare to a gamma curve that conserves same grey point.


We can see the difference between them, logarithmic shaper having a more smooth local contrast transition in shadows and a bit more local contrast in lights near grey point.

The normalized output versus normalized input (with no display transformation yet).


Again smooth transition in shadows, and more local contrast in lights until the shoulder.
But we see more compression in high lights near the white point, so theree will be less detail.

Of course we can tweak the parameters to change that behaviour if that is what we want.

Fianally the final screen versus raw data curves. Here I have used the standard 2.2 gamma and 8 bit screen, but that can be changed, use a linear gamma or whaterver you feel fits your needs for comparations.