haasn / libplacebo

Official mirror of libplacebo
http://libplacebo.org/
GNU Lesser General Public License v2.1
547 stars 69 forks source link

Feature Request: Dynamic Target Nits (DTN) #177

Closed nicko88 closed 1 year ago

nicko88 commented 1 year ago

This is just a request for a feature that I think people would find useful. Of course it's up to you whether you think this is something you want to tackle.

In madVR, most seem to like using a feature that dynamically sets the target nits which seems to help make better use of a larger dynamic range by compressing scenes more or less depending on a couple factors. It seems to help a lot on especially low target nit ranges.

The option is a number (DTN), and the formula to calculate the target nits is as follows:

target = log10(DPL)xDTN/50xFALL

Most people seem to use DTN=50, or are mostly in the 50-100 but it's said to raise it for a more "HDR" look, and lower it for an overall brighter look.

Perhaps the formula and adjustable number doesn't need to be this exact formula, since it contains a /50, and DTN=50 is the default, so really this is a 1. Maybe the default when turning the DTN on is 1, and it can be set between like 0.02 (1/50) and 20 (1000/50), though I am not sure anyone uses more than DTN=200 or so, and once you get to 300-400 DTN it seems to not make a noticeable difference anymore in madVR. The exact implementation and variables I leave up to your discretion.

Then there is also an option toggle that adds to that result the DPL number. Some like to use that, like for low nit projector setups, but others don't like to use it, like for brighter flat panel displays.

So like a true/false field for "add peak nits" to the DTN.

Overall I feel this should be not too difficult to do. However, the wrinkle is this last part, and that is the smoothing of the adjustment to the target nits over time. You can't just adjust the target nits every frame, as that would create wild fluctuations in the image brightness. madVR does some sort of smoothing, but I don't really know the exact method. Could probably dig up more info on it if needed back when it was first implemented.

The controls for the smoothing look like this though which might give a hint.

image

I'm not really sure how these numbers translate into the exact speed, but these are the defaults and I use them, and I have seen that some people use numbers about 4x larger than these here.

It's a speed value used when the diff in target is a certain %. Now the goal for this was to find a suitable singular set of smoothing speed factors and use that for everyone, so I would not make these all exposed options. It should be tuned to be fast enough to get the target nits where they should be asap, but not too fast where brightness fluctuations are noticeable and distracting. Hopefully that's not too hard to find.

I think at most a single number exposed as an overall brightness speed adjustment multiplier might make sense (as people may be more or less sensitive to the brightness changes), and internally use that multiplier with a few speeds depending on how far the adjustment % is needing to change.

Anyways, thank you for your consideration.

pbiancardi commented 1 year ago

This is also a useful when adjusting for projector brightness. I could use DTN of 65 or so on MadVR with my 150+ nit projectors.

haasn commented 1 year ago

New knee point selection logic raises adaptation strength for very bright/dark scenes, which should be roughly analogous to whatever madVR is doing.