-
-
Notifications
You must be signed in to change notification settings - Fork 72
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
Linear scaling for HDR content should not be disabled #281
Comments
This was repeatedly enabled and disabled again in the past, because of other issues with nasty ringing artifacts around bright edges when scaling HDR sources in linear light. Maybe you can take a look: |
Looking at those github issues the nasty ringing artifacts are there because lanczos resampling is used, which is known to introduce ringing/clipping artifacts! Using the incorrect colorspace for all resampling methods in order to work around an issue caused by a single method is of course not the way to go. What would be is to look at the problematic method lanczos separately. https://en.wikipedia.org/wiki/Lanczos_resampling#Limitations
So a solution to mitigate the ringing artifacts caused by the lancoz filter is to do the resampling in log-space just for lancoz. (This could be maybe be controlled by an option, say something like "lancoz-log-scaling", maybe enabled by default.) As this is basically similar to disabling linear scaling a quick fix would be to just in that case disable linear scaling. Then for all other resampling methods linear scaling does not have to be disabled, and we can have correctly scaled HDR video. |
What if we do every thing (deband, scale) in |
After 75b3947 there should be no downsides to re-enabling linear light downscaling on HDR content. |
The original user's issue (mpv-player/mpv#11036) with the dark halos on negative lobe filters is also very easily solvable nowadays since EWA antiringing has been implemented. If they wanted to keep using ewa_lanczos, they would just need to add this to their mpv config:
|
For correct results resampling should always be done in linear color space. Otherwise problems will be introduced: a too dark image, stair-stepping along edges, stars start to twinkle in panning shots, etc...
https://x.com/ID_AA_Carmack/status/1654528504724062217
https://petewarden.com/2008/08/02/why-fonts-need/
http://www.ericbrasseur.org/gamma.html
Unfortunately in libplacebo linear resampling is currently always disabled for HDR content. This leads to errors when downscaling.
See this example clip. It was created by taking screenshot of the output of mpv of HDR content rescaled from 2160p to 1080p. On the left with libplacebo as is, on the right libplacebo patched to allow linear scaling with HDR content.
(please view images in original size with 100% zoom on monitor with 1:1 pixel mapping)
Notice on the left the stair-stepping along the edges of the A and V. Also notice the wobbling between the T and the O and the T and wings of the logo (simular problem as twinkling stars described by Carmack). Compare to the correct linear resampling on the right.
Here another shot:
Again the stair-stepping / aliasing on the left, the text is also too slim. The linear resampling on the right looks way better.
Please do not disable linear scaling for HDR content so we can get correctly scaled video.
The text was updated successfully, but these errors were encountered: