Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hdr tonemapping: selecting trc=srgb instead of pq breaks the image in dark scenes #304

Open
geextahslex opened this issue Nov 21, 2024 · 7 comments

Comments

@geextahslex
Copy link

geextahslex commented Nov 21, 2024

Hi, I have this issue with hdr tonemapping tone-mapping=st2094-10 in dark scenes. Bright scenes look fine but very dark scenes get more and more desaturated which looks weird. Have someone found a fix for this?
The only thing the fixes this is vf=format=sig-peak=4.926 but this also disables any dynamic of brightening and darkening the image accordingly to the nits information hdr-compute-peak=yes
From my understanding this patch is causing this https://code.videolan.org/videolan/libplacebo/-/merge_requests/477/diffs

My suggestion would be to add an percantage option to this function, so you can turn it on, off or fine-tune it to your liking.

Thanks for any help :)

The image should look like this
normal

but it looks like this, almost black and white
broken

normal
normal3

washed out
washed out

@haasn
Copy link
Owner

haasn commented Nov 21, 2024

Does --target-contrast=inf help at all?

@geextahslex
Copy link
Author

geextahslex commented Nov 21, 2024

With target-contrast=inf it looks even worse. You get more color but it messes up the contrast/black levels, it looks complete flat.
target inf

@geextahslex
Copy link
Author

geextahslex commented Nov 22, 2024

Hey sorry for bothering you. Thanks for the patch that you have made, I have tested it and at this point I am a bit confused. After further testing there are scenes (very dark) that indeed profit from this desaturation function, but there are also scenes (like mentioned here above) that are desaturated unnecessarily. I'm not sure if the curve, threshold or the values would have to be finetuned.
Let me know what you think about it. I would like to help with testing etc.

So affecting a dark scene like this would be good

without desaturation, the red on his face and the blacks overall is not so nice
sat banks

with desaturation
sat banks good

and leaving a brighter scene like this unaffected
broken

@geextahslex
Copy link
Author

geextahslex commented Nov 23, 2024

I don't know which values are used internally but from an srgb perspective I would say put the threshold at 5/255srgb. This would desaturate the first scene and leave the 2nd scene saturated/normal
I use target-peak=100 so I don't know how this srgb value would scale but you get the idea.

srgb threshold 5/255
srgb low2

srgb high

srgb low23

@haasn
Copy link
Owner

haasn commented Nov 24, 2024

Internally we work in IPT intensity units (I), so there's unfortunately very little correlation with sRGB values.

@geextahslex
Copy link
Author

geextahslex commented Nov 24, 2024

Okay I understand, so for now please cancel the patch that you have made and you could look at the Feature Request that I have made. This could be a solution until there is a better way to handle this brightening issue. I would just like to disable the upward/brightening part of this function because downward/darkening looks fine.

@geextahslex geextahslex changed the title hdr tonemapping: auto desaturation patch breaks the image in dark scenes (scale down saturation when raising brightness) hdr tonemapping: selecting trc=srgb instead of pq breaks the image in dark scenes Nov 27, 2024
@geextahslex geextahslex reopened this Nov 27, 2024
@geextahslex
Copy link
Author

geextahslex commented Nov 27, 2024

So after further testing I noticed that this behaviour only occurs when you set the target-trc to srgb/bt.1886 instead of the default pq and pq gives you crushed blacks/artifacting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants