mpv icon indicating copy to clipboard operation
mpv copied to clipboard

Raised blacks with Inverse tone mapping bt.2446a

Open carycary246 opened this issue 3 years ago • 12 comments

Wondering if this is the intended behavior with the inverse tone map. Tested this config on an LG C1 oled and noticed that with inverse tone mapping enabled, the blacks were not true black compared to just playing it normally in SDR. The blacks look slightly lifted, similar to how an IPS panel looks which ruins the contrast of the image.

vo=gpu-next profile=gpu-hq gpu-api=d3d11 gpu-context=d3d11 d3d11-output-format=rgb10_a2 d3d11-output-csp=pq tone-mapping=bt.2446a inverse-tone-mapping=yes dither-depth=10 target-trc=pq target-prim=bt.2020 target-peak=800

carycary246 avatar Apr 18 '22 21:04 carycary246

You're confusing metadata passthrough and tone-mapping. Tone-mapping doesn't use pq transfer. The d3d11-output should be negated, both lines. And target-trc. Windows is gonna get all kinds of confused.

Doofussy2 avatar Apr 18 '22 22:04 Doofussy2

From what I tried with your suggestion, negating the d3d11-output lines has no effect on raised blacks and target-trc is necessary for the colors to display properly. If the issue is with metadata, then is there a function that allows it to passthrough without raising black floor?

carycary246 avatar Apr 19 '22 02:04 carycary246

You need to choose between letting your TV use the metadata and mpv tone mapping. I'd suggest letting your TV do the work.

Are you running Windows in HDR?

If in HDR, just use:

vo=gpu
profile=gpu-hq
gpu-api=d3d11
gpu-context=d3d11
d3d11-output-format=rgb10_a2
d3d11-output-csp=pq
target-trc=pq
target-prim=bt.2020

If you want tone-mapping, try:

vo=gpu-next
profile=gpu-hq
gpu-api=d3d11
d3d11-output-csp=srgb
tone-mapping=bt.2446a
inverse-tone-mapping=yes
dither-depth=10
target-prim=bt.2020
target-peak=800

You can't mix them. The Windows swapchain will make a mess. Tone-mapping is always to SDR. And the target peak will be subjective.

I really don't understand why you want to tone-map, if you have an HDR TV and run Windows in HDR. Tone-mapping is necessary when metadata passthrough isn't possible. Your LG OLED TV will do the best job at applying the metadata, correctly.

Doofussy2 avatar Apr 19 '22 03:04 Doofussy2

Thanks for the clarification. HDR is on in Windows but the idea with the inverse tone mapping is to expand the SDR to make greater use of the HDR range, similar to the effect of Window's auto HDR in games to achieve more impactful highlights.

I tested both outputs with your suggested config but seems both result in lifted blacks. In the second config with tone mapping, colors are washed out and not correct.

carycary246 avatar Apr 19 '22 06:04 carycary246

So this is about SDR to HDR?

Doofussy2 avatar Apr 19 '22 14:04 Doofussy2

That is my intended use case, but there may be another issue if all those different configs still have raised blacks over the default SDR output. I did some more testing and playing a native HDR video also results in raised blacks on the configs.

With my original settings, everything looks great except for the raised black.

carycary246 avatar Apr 19 '22 16:04 carycary246

I'm not sure hassn has adjusted the black point for that use case.

Doofussy2 avatar Apr 19 '22 23:04 Doofussy2

I see, so no way to correct this unless the black point is adjusted. Hopefully hassn will be able to take a quick look at this as from my understanding, it would just need to match the black point of the original metadata to prevent the raised black floor.

carycary246 avatar Apr 20 '22 16:04 carycary246

Since you say this happens in regular HDR (passthrough?), it's possible the default black point is simply defaulted to something non-zero. IIRC, it might default to 0.005 nits for output in PQ. At least that's the behaviour in plplay.

quietvoid avatar Apr 20 '22 21:04 quietvoid

, it might default to 0.005 nits for output in PQ. At least that's the behaviour in plplay.

That is horrible. BT.709 is scene refferred, so no black point defined, it is just blackest black so 0.0001 nits in PQ, 0.005 is Dolby Pulsar, that is too bright for LG C9 and later. With Adobe RGB and sRGB that are display referred there is a black pont defined, for Adobe RGB 0.5557 cd/m2 should be the black point.

Tone-mapping doesn't use pq transfer.

Actually it is supposed to. Only PQ. SDR convertion is just that: convertion to SDR.

Why are you using inverse tonemapping anyway??

expand the SDR to make greater use of the HDR range

That is not happening.

ValZapod avatar Apr 22 '22 16:04 ValZapod

I'm curious if you managed to get anywhere with this?

I also noted this option in the documentation:

--inverse-tone-mapping If set, allows inverse tone mapping (expanding SDR to HDR). Not supported by all tone mapping curves. Use with caution. (--vo=gpu-next only)

But I've got no luck with getting any SDR content to look right in HDR mode. Not sure how this flag is supposed to work here.

hengyu95 avatar Jul 18 '22 15:07 hengyu95

@carycary246

just add

target-colorspace-hint=yes

to your config you will get true black and a working SDR to HDR Conversation

However the picture will look very dark. I think this looks better

profile=gpu-hq
vo=gpu-next
hwdec=auto-copy
target-colorspace-hint=yes
hdr-compute-peak=no
target-trc=pq 
target-prim=bt.2020
target-peak=800
inverse-tone-mapping=yes

You can also play with the target-peak value. If you set it to something like 300 or 400 the HDR effect will be less strong. I like values around 400 but I don't have a LG CX I have a Sony XH9505 with 1500 nits peak brightness

mnisius avatar Jul 19 '22 21:07 mnisius

The output levels are now correctly tagged on the swapchain, the same as happens for native HDR video.

haasn avatar Aug 23 '22 00:08 haasn

After more discussing it seems as this may not be enough, because some monitors do not correctly tone-map the black point down as intended. I will fix it in a different way.

haasn avatar Aug 27 '22 12:08 haasn