filmic v4 on the way

From memory, dt’s module is much less capable than RT’s, so having this in filmic will help. The question is whether the latter should be improved or replaced.

Improved, probably. Replaced, no. There are benefits of solving clipping before demosaicing, but it depends on which problem you try to address.

But the mosaiced maths are out of my league. Filters for sparse pixels don’t agree with my vector field understanding.

No problem, we do what we can. :slight_smile:

hello, I’d like to try V4 and compile it but I don’t know how to tweak my simple command sequence, can anyone show what’s needed please? I don’t know what to check out. This is how I would normally compile dt (Ubuntu 18.04) -

mkdir -p ~/DT-filmicV4-10May20
cd ~/DT-filmicV4-10May20
git clone https://github.com/darktable-org/darktable.git ~/DT-filmicV4-10May20/darktable-code
cd ~/DT-filmicV4-10May20/darktable-code
git checkout release-3.0.1
git submodule init
git submodule update
./build.sh AND SO ON…

Please be very specific! I have little understanding of Git…
Cheers

mkdir -p ~/DT-filmicV4-10May20
cd ~/DT-filmicV4-10May20
git clone https://github.com/aurelienpierre/darktable.git darktable
cd darktable
git checkout steroid-filmic
git submodule init
git submodule update
./build.sh --build-type Release
3 Likes

Thanks @anon41087856 , just what I needed. Have successfully built, and here is my first effort with it, a Banksy in Bristol UK with recently added (and hopefully eventually will be removed) mask. I will need to get to grips with the new controls of course.

Thanks for filmic and the continued development.

One thing I noticed in this build, not obviously related to filmic, is that previously if I selected an image in lighttable and double-clicked a style, it would be applied immediately. Now it is not applied until I go into darktable. But it does remain applied when going back to lighttable.

4 Likes

You shouldn’t regard this specific branch (every forked repo for that matter) as having a stable or development (somewhat stable) status. It is a developer’s, in this case Aurélien’s, personal working grounds. Experimental would probably be a correct tag and that comes with all kinds of warnings and uncertainties in and of itself.

2 Likes

I thought the setup was a “unit testing” kind of environment, so I agree about stability, but I thought it still worthwhile mentioning the anomaly in case someone saw it who had been working in that area and said “oops that could be me…”.

OT:

Image preview is not updated in lighttable, if a style is applied. That is true for me in current git master as well. If lighttable contains several rows, scrolling up and down refreshes the preview for me. So here a redraw is missing to me.

@pk5dark hi Christian, I just double-checked in my older version, and it’s working as I said, that build is dt “3.0.1+dirty”. From 10th March I think.

I didn’t try anything with several rows though, just did import | image twice, same result both times, went from green UniWB to daylight as per my style.

_6D_10543.CR2 (25.7 MB)
_6D_10543.CR2.xmp (8.7 KB)

@anon41087856 , I’ve been having another play with V4 and would be interested in your comments. In particular, I’m asking about the new “reconstruct” controls, I wonder if I’m using them sensibly. So with the attached, which has a clipped area according to the raw toggle button, I’ve adjusted the Scene tab first, then onto Reconstruct.

I adjusted the clip threshold using the mask view so that the area selected was smaller than that at value zero. I did this because the clipped area according to the button at the bottom of the window was rather smaller, and I thought why would I need to reconstruct parts that don’t seem to be clipped anyway?

Then I put the transition slider over a bit to soften the mask limits. Though when I look at the effect of quite large movements here, I can’t really see any change in the actual image.

Then I tried structure/texture and was looking to see if the twigs in the clipped area might change, but again this slider didn’t seem to make a difference. Similarly bloom/reconstruct and grey/colorful.

These are not criticisms; I don’t properly understand the controls, and my image may not be suitable for showing the effect of some of the controls, e.g. there’s not a lot of colour around the clipped area.

Any comments and tips gratefully received.

The reconstructed area doesn’t need to be 1:1 the clipped area, sometimes it helps for smooth blending, to get a bit more from the surround.

The wavelets inside also helps to smooth transitions, it depends on your region.

The reason is your image doesn’t have any texture to reconstruct, it’s smooth highlights from the sun disc. The maximum you can do is to remove the magenta highlights and blend valid/clipped regions without sharp edges.

Generally, here is how it works:

  1. we split each RGB channel into a pyramid of blurry pictures (low-pass filters of increasing radii), and for each blurry scale, compute the difference between the higher scale and the current blur (high-pass filters of increasing radii). The stack of high-pass filters and the coarsest scale of blur is a wavelet decomposition.
  2. Then, at each pixel:
    • the texture term is the sum along all the scales of high-pass filters of the maximum over all RGB channels. This represents the most “sharpness” we can grab from non-clipped channels at this pixel.
    • the structure term is the sum, for each channel, along all the scales of high-pass filters, of the interpolated high-pass scales. This “fills” the voids we have in the high-pass scales and ensures smooth gradients, even if it is not as sharp as the texture. It has a chromatic variant (for each RGB channel) and an achromatic variant (as the max of all channels).
    • the reconstruction term is the sum of texture and structure terms (again with chromatic and achromatic variants), which represents the most high-frequencies we can restore.
    • the blooming term is the sum, for each channel, of all the scales of low-pass filters. It represents the gaussian blur at this pixel. Again, it has a chromatic variant (for each RGB channel) and an achromatic variant (as the min of all channels).

If we take the coarsest scale of blur (called the residual), and sum all the high-pass filters stack on top, it is a straight wavelet synthesis, and we get the original image back. So, in the same logic, we replace the residual by the blooming term (which avoids solid color backgrounds you sometimes get in color-reconstruction algos), and replace the high-pass stack by the reconstruction term, then sum them back altogether.

Then, as a user, you can weight every term in the final mix to favour a sharper or blurrier reconstruction.

TL; DR:

  • texture inpaints high frequencies with valid RGB channel if any (in 1D, along channels depth),
  • structure inpaints high frequencies by interpolation of the neighbouring pixels (in 2D, along the image plane),
  • blooming inpaints the lowest frequency with a pure gaussian blur (in 2D, along the image plane),
  • final reconstruction is a × (b × texture + c × structure) + blooming, where a, b, c are user weights (with b + c = 1 no matter what). If a = 0, then you get only blooming, if a = 1, you get full reconstruction.
  • each term is again split in two such that term = d × achromatic + e × chromatic (with d + e = 1 no matter what).

Finally, the high-quality reconstruction method runs an extra step of reconstruction but with RGB ratios, instead of RGB channels directly.

1 Like

See here an example for (small) areas color reconstruction:

2 Likes

Yes, I see the white streak becomes pink.

Many thanks for the comments and detailed explanation, I will be re-reading it several times I think! (And just looked up TL DR - not TL!)

Filmic v4 got merged in darktable master today, along with other changes.

We introduce “workflows” in place of the “auto-apply basecurve” setting:

By default, workflow is set to display-referred, which auto-applies the base curve.

Setting it to scene-referred will auto-apply filmic and exposure module altogether. Exposure will auto-apply +1 EV by default to prepare overall brightness for filmic, plus revert the camera exposure bias in case you exposed to the right with an in-camera exposure bias. Then, filmic v4 will auto-adjust its defaults depending on the exposure bias.

Alternatively, setting workflow to “none” will auto-apply nothing.

OpenCL is for now disabled for filmic v4, since the v4 kernels are not written. Please test it and report weird behaviour, and I will start on the OpenCL in a couple of days, to have it shipped in 3.2.

Please notice that filmic defaults will not fit every needs, and it is impossible to do so. Basically, we have only “classical” assumptions (statistically valid on a large sample of pictures) to work with, no precise information about the true value of the middle-grey for each picture. Filmic defaults aim at fitting most cases but don’t expect anything magical in there. They are only a starting point and you need to tweak them for your special cases. However, I’m confident that these defaults should match OOC JPEG roughly, therefore provide a good base for culling.

Noticeably, Fuji owners will need to add +0.7 EV systematically in exposure module.

27 Likes

You DON’T merge some crazy new shit to master when I had hard working day and badly need to rest!!! Now I ain’t gonna get any sleep because I gotta play with latitude. :weary:

BTW. V4 feels like when you finally get enough experience points and can unlock new skills to take down the big boss with ease.:upside_down_face:

9 Likes

Good :slight_smile:

Tutorial is out too :

23 Likes

Aurelien,

:bouquet: :bouquet: :bouquet:
:trumpet: :trumpet::trumpet:
:clap::clap::clap:

THANK YOU for all your work.

A particular :bouquet: the most significant feature to my mind is the descriptive tooltips you have placed throughout.

[One of the biggest hurdles I have found with most modules in darktable is lack of helpful documentation - a cryptic tooltip has often been duplicated (with grammar) in the official documentation, without explaining adequately what is done]

Your work with respect to filmic v4, the tweaked exposure module and the preferences is in complete distinction to this. This makes the power of the module ACCESSIBLE.

Once again, :clap::trumpet::bouquet:

6 Likes

Great! - thanks

Hello Martin,

darktable is an Open Source project, this means that the documentation is also Open Source. One way to contribute to an Open Source project is to improve the documentation!

For tooltips, you can open bugs and suggest an improved text. For the manual you can download the git tree and improve it directly.

2 Likes