-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
aliasing problem with HDR and certain settings #4631
Comments
Can you try adding |
Also your log seems to identify that as BT.709 for some reason. Sounds like a bug, but I don't get it when using swdec so I assume your hwdec might be corrupting the metadata? |
It doesn't occur with --profile=opengl-hq because it uses mitchell for dscale and like bicubic, it doesn't provoke the behavior. |
That's just the default, you can override it |
Yes, the issue also occurs with a config which consists of just |
Can you take a screenshot of the issue? |
sigmoid on (note the aliasing corruption among the leaves in the background): sigmoid off (looks normal): It's really obtrusive in motion and using gamma light instead of sigmoid comes with nasty drawbacks for other algorithms like smooth motion. |
Ah, yes. I see it. Hmm, we could probably avoid it by doing tone mapping before downscaling when using linear light downscaling. |
(Or maybe you could just use mitchell downscaling like opengl-hq recommends) |
Mitchell is way too soft to my eyes. :( |
Random thought but does this help? diff --git a/video/out/opengl/video_shaders.c b/video/out/opengl/video_shaders.c
index e83973b4b8..07b3e2bcf6 100644
--- a/video/out/opengl/video_shaders.c
+++ b/video/out/opengl/video_shaders.c
@@ -528,7 +528,7 @@ static void pass_tone_map(struct gl_shader_cache *sc, float ref_peak,
GLSLF("// HDR tone mapping\n");
// To prevent discoloration, we tone map on the luminance only
- GLSL(float luma = dot(src_luma, color.rgb);)
+ GLSL(float luma = max(0, dot(src_luma, color.rgb));)
GLSL(float luma_orig = luma;)
// Desaturate the color using a coefficient dependent on the brightness |
Sry, I'm quite noob with such stuff. |
|
Actually thinking about it I don't think that patch will help. Negative coefficients are virtually guaranteed to be clipped by this point anyway. The real problem stems from the interaction between super-bright values and negative coefficients, I think. Basically if you have a filter kernel that uses negative lobes, any edges between very bright and very dark regions will receive extreme negative coefficients - enough to drop it all the way down to black, which results in the black pixels. So basically it's an extreme form of ringing. Standard anti-ringing techniques could get rid of it ( I might try that if it's a big problem for you. |
dscale-clamp=0.8 mitigates the issue, but I'd still consider the result "broken" in motion. madVR's SDR conversion can also show a nasty sharpness for fine detail with high contrast, but even with all of the postprocessing turned off to mitigate that, it doesn't suffer that "temporal aliasing". It doesn't look to me like dscale=bicubic was simply "hiding" the issue because it's blurrier. Looks more like the issue doesn't exist with it entirely. |
Well this particular issue seems like an extreme case of ringing, which is why all of the non-ringing scalers don't seem to trigger it. Anyway, we could still try and limit the amount of ringing being done with HDR sources. |
Beware, clumsy layman theory: Or is it just not "correct" to do LL/sigmoid scaling with HDR? Wouldn't it be a simple workaround to add an option to do all scaling in gamma light with HDR content, except of smooth motion interpolation? |
It also still has issues like not preserving brightness correctly etc. |
According to manpage, sigmoid implies linear light, and that also does apply to downscaling if I got it right. Maybe I should be more clear: When I don't use linear light downscaling, that weird aliasing issue with HDR is gone by 100%. It looks totally fine then. But I got another issue with not using linear light, independent of HDR video: I think a minor brightness degradation for a still image when using scaling in gamma light for HDR is still several times better than the aliasing issue with linear light. Thus my suggestion for an option which lets cscale, scale and dscale always happen in gamma light for HDR only, but tscale would still be linear/sigmoid light (if that's possible). |
Ah, yes, that is 100% the case. So maybe we should always do interpolation in linear light. |
FWIW I sort of have a refactor planned in the back of my head that would allow us to keep track of the “current” image parameters a bit better. That refactor would definitely help here, since it would allow us to very easy insert the necessary linearization commands. But for now, I could do this as a sort of work-around: |
Actually what we could also do is enable sigmoidization for HDR downscaling as well, which also lessens the effect of ringing (for the same reason as it does for upscaling). |
Seems like it makes a noticeable difference even for e.g. mitchell, it's just less pronounced than for lanczos. I've merged the fix. |
Thanks a lot, works as expected. If there now was just a way to play HDR video fluidly on Linux and Nvidia without that broken cuda crap (or using slow Intel IGP). :( |
This logic regressed sometime in the move from mpv vo_gpu to libplacebo. Fixes: mpv-player/mpv#11036 See-Also: mpv-player/mpv#4631
This logic regressed sometime in the move from mpv vo_gpu to libplacebo. Fixes: mpv-player/mpv#11036 See-Also: mpv-player/mpv#4631
mpv version and platform
0.26.0 Windows and Linux
Reproduction steps
Set up these settings:
sigmoid-upscaling=yes
cscale=lanczos
dscale=lanczos
Expected behavior
Downscaled HDR video shouldn't look aliased in motion.
Actual behavior
With some structures like e.g. fine leaves, some very extinct aliasing becomes apparent in motion.
This is a problem between HDR video (dunno if Rec2020 related), sigmoid-upscaling and certain chroma and image scalers used at the same time.
The problem does not occur when setting sigmoid-upscaling=no or using bicubic for dscale.
Log file
http://sprunge.us/BWOH
Sample files
https://mega.nz/#!5vQRhT5Y!uRnFr5f0JtGc9KPeVqqMf5DCPkKtfn9v31FIBMZwrnQ
The text was updated successfully, but these errors were encountered: