Closed gaitas13 closed 10 months ago
Chroma is not downscaled at any point during mpv's rendering unless you're using some kind of weird custom shader setup (Ex: a luma downscaler that goes below chroma resolution), so being able to choose a chroma downscaler doesn't make too much sense.
See: https://github.com/mpv-player/mpv/wiki/Video-output---shader-stage-diagram
Chroma is not downscaled at any point during mpv's rendering, so being able to choose a chroma downscaler doesn't make sense.
See: https://github.com/mpv-player/mpv/wiki/Video-output---shader-stage-diagram
I really don't get what happens when you play a video with a resolution >2x larger than output... It seems bugged to me... It says that's it's upscaling chroma even in that scenario:
but even if you use a shader to increase Chroma res to 2x output it will still say it's upscaling chroma using built-in but really it shouldn't it be downscaling to match luma res?
It says that's it's upscaling chroma even in that scenario:
If the video is 4:2:0 then it still needs to upscale chroma...
Oh whoops, my bad, I didn't play a frame, it updates to say downscaling in the OSD if you play:
Turns out it uses the set downscaler, not the cscale.
If the video is 4:2:0 then it still needs to upscale chroma...
Ah right.
I never heard about any video playera would downscale the chroma.
I never heard about any video playera would downscale the chroma.
It's not like there's many players that do Chroma scaling without also scaling Luma though? EDIT: I meant scaling Chroma > video res.
I think you don't understand chroma downscale, right? I do not know why luma scaling is mentioned here.
I think you don't understand chroma downscale, right? I do not know why luma scaling is mentioned here.
Not really, chroma confuses the hell out of me. I think I get it now, for some reason I was thinking that if the output window was < half the source res, chroma could be downscaled first to match luma's output res.
chroma plane's size is always smaller than luma for common videos. Two planes need to be align first. There is no steps to downscale the chroma.
As I stated in my edit, this is possible with luma-only user shaders, as these can downscale the luma plane early in the rendering stages. If you're downscaling the luma to a resolution that is below the chroma plane, then the chroma plane has to be downscaled to align with the new reference plane resolution before it can be merged. So yes, it's technically possible to trigger a chroma downscale.
If you want a reliable way of triggering it (credit to a random kind stranger)
And you'll notice that chroma is being downscaled. Is there any actual use case for doing this on yuv444 videos? Not really. But yes, it's technically possible.
Without user shaders, mpv will always upscale the chroma plane to match the luma plane (assuming that the chroma is subsampled), merge them, then covert them to a single RGB plane. After this, the RGB image will be scaled to a target resolution. There's no way to scale the luma and chroma planes independently to meet a target resolution (and there's no reason to outside of performance reasons, as this will result in a quality reduction).
chroma plane's size is always smaller than luma for common videos. Two planes need to be align first. There is no steps to downscale the chroma.
Then what is going on here when I specifically scale the chroma to 2x output? https://github.com/mpv-player/mpv/issues/13313#issuecomment-1899313804
I do not see any chroma steps. The first line is merging planes
. Then everything works on RGB plane.
I do not see any chroma steps. The first line is
merging planes
. Then everything works on RGB plane.
Don't you see 2 lots of downscaling steps? The usershader was meant to scale main but I specifically changed it to hook and save chroma only.
I have no idea what you actually did in the shader.
I have no idea what you actually did in the shader.
It's just the RGB version of the Ravu-Zoom-AR shader but with this:
//!DESC RAVU-Zoom-AR (rgb, r3)
//!HOOK CHROMA
//!BIND HOOKED
//!BIND ravu_zoom_lut3
//!BIND ravu_zoom_lut3_ar
//!WIDTH OUTPUT.w 2 *
//!HEIGHT OUTPUT.h 2 *
//!OFFSET ALIGN
I am not the expert of shader but I am sure you just mess up the hook... You'd better to check ravu chroma variant to know how to properly handle chroma plane.
I am not the expert of shader but I am sure you just mess up the hook...
You don't need to be an expert to copy and paste and try it yourself... I can assure you it works, though scaling 2x output is a lot worse than just scaling to output. PSNR, DSSIM, MAE (test image from: https://github.com/Artoriuz/artoriuz.github.io/tree/main/blog/images/mpv_upscaling/chroma)
As I said, check those real chroma shaders to learn the proper codes to handle chroma plane.
You just mess up the chroma plane and tell me it became worse. Of course, how could it be better? You didn't know what chroma is hours ago...
You just mess up the chroma plane and tell me it became worse. Of course, how could it be better? You didn't know what chroma is hours ago...
Check the 1x OUTPUT, it's not worse, 2x is obviously worse than scaling just to output, it was a test to demonstrate that chroma downscaling is real and yet it still seems to be slightly better than ewaLanczosSharp imo.
It's not 1x 2x chroma... Jesus, you do not even know what you were doing.
So that is why I am saying "you do not even know what you were doing."
You didn't even add any codes to handle the pixels out of range. Jesus, I cannot believe why you are so convident on the field you do not understand.
You didn't even add any codes to handle the pixels out of range. Jesus, I cannot believe why you are so convident on the field you do not understand.
I figured the AR clamping was enough and even adding that code to it doesn't seem to improve results much and I couldn't spot any major visual changes. I'm not confident that it's correct but I am confident that it is at least improving the result, I'm not blind (the automated tests also seem to agree).
Besides, you are completely missing the point, I'm not trying to get a perfect chroma shader, it's just to test scaling chroma > luma to show that chroma downscaling is happening.
Besides, you are completely missing the point, I'm not trying to get a perfect chroma shader
The key of this issue should be: Is there any pratical and valueable use case for mpv to add an option dcsale
?
I do not see any useful msg from the comments before.
My only input to this is that the behaviour of vo=gpu
and vo=gpu-next
are different. I'm typing this from memory and it could be entirely wrong, but I think vo=gpu-next
uses your dscale
filter to downscale chroma while vo=gpu
uses what you have set in cscale
.
As @dokur0chan mentioned this is only ever possible if you use a custom shader to downscale luma below chroma resolution, so in any case I don't think it matters.
Like everyone else has said I don't think there's any practical use for this, but I'm fairly certain you could specify the filter used for chroma downscaling with --libplacebo-opts-append=plane_downscaler=
Like everyone else has said I don't think there's any practical use for this, but I'm fairly certain you could specify the filter used for chroma downscaling with
--libplacebo-opts-append=plane_downscaler=
Oh wow, the option already existed. I can confirm it works:
Closing since said option does actually exist.
The same way that for luma you can chose the upscaler (scale) and the downscale (dscale) , it would be nice if we got an argument to downscale chroma (cdscale) and cscale is keep for choosing the chroma upscaler
Expected behavior of the wanted feature
The chroma downscaler works as intended
Alternative behavior of the wanted feature
N/A
Log file
N/A