mpv-player / mpv

🎥 Command line video player
https://mpv.io
Other
28.14k stars 2.89k forks source link

levels conversion and chroma upscaling #3771

Closed age88 closed 1 year ago

age88 commented 7 years ago

When I use vo=opengl it seems to my eyes that mpv does chroma upscaling before the tv to pc range conversion. If so is it possible to fix this?

haasn commented 7 years ago

TV->PC range conversion is part of the YUV->RGB conversion process. Of course chroma upscaling needs to happen before you can convert to RGB

age88 commented 7 years ago

In my opinion for a high quality video output the process should be TVtoPC range->chroma upscaling->YUVtoRGB..... like madvr or the internal resizers in vapoursynth. It would be nice to have this operations chain if it's not hard to achieve :-)

haasn commented 7 years ago

Well I don't really care about your opinion.

age88 commented 7 years ago

Sorry I don't mean mpv has not yet a very good quality output

paulguy commented 7 years ago

I think he just means that if you can't prove that it makes a difference, then it's not a problem. basically, I think they want some firm numbers for your claims.

age88 commented 7 years ago

The limited range is compressed compared to full range and a resizer can do some rounding error , when a resizer is used for a full range picture it is the more precise it can be. Another reason is that if a limited range picture is upscaled some values could go outside the legal range and after the tv->pc conversion that values will be clipped, the effect is more visible artifacts

http://i.imgur.com/MOMTC1M.jpg http://i.imgur.com/Ng8EXUW.jpg This example is in rgb just for semplicty

At the end it isn't a high boost quality but it give more smooth and precise results

wiiaboo commented 7 years ago

Why don't you give actual screenshots of what you think is wrong? Those two shots and your explanation still make no sense.

Hrxn commented 7 years ago

Okay, I think what you're trying to say is that mpv does this, allegedly:

Chroma Upscaling -> Limited (TV) Levels to Full (PC) Levels -> YUV to RGB Conversion

While it should be doing this instead, because it would be "better":

Limited (TV) Levels to Full (PC) Levels -> Chroma Upscaling -> YUV to RGB Conversion

Maybe you should make some screenshots that actually illustrate this? Because I don't really get how your examples apply here either..

Edit:

you = OP

wiiaboo commented 7 years ago

There's no reason to allege. There's a diagram with every step of way from decoded frame to displayed frame: https://github.com/mpv-player/mpv/wiki/Video-output---shader-stage-diagram

age88 commented 7 years ago

Look at the hsb color picker, I've used bicubic for the chroma upscaling and no additional processing.

Chroma upscaling->levels->rgb conversion : less satured chroma_level1

levels->chroma upscaling->rgb conversion : more vivid level_chroma1

Hrxn commented 7 years ago

Interesting... The deviation in saturation is always the same, i.e. slightly higher?

age88 commented 7 years ago

Yes from my quick test the saturation is always slightly higher but not on the whole image,even in the two last picture that I've posted the color picker return me the exact value on some different part of that frame

zc62 commented 5 years ago

like madvr or the internal resizers in vapoursynth

Do you have links to show they are actually doing so? (madVR isn't open-source, is it?)

The limited range is compressed compared to full range and a resizer can do some rounding error, when a resizer is used for a full range picture it is the more precise it can be.

The precision difference is insignificant as long as you are not using an integer fbo-format.

Another reason is that if a limited range picture is upscaled some values could go outside the legal range and after the tv->pc conversion that values will be clipped.

If you stretch YUV early, similar things can still happen: values can go below zero or beyong 255 (if 8 bit). Hence this is not a good argument.

I see some people writing format conversion functions like this: https://github.com/HomeOfVapourSynthEvolution/mvsfunc/blob/413e23f6cae7e4dfbd539e04d9ef79405d5bdec2/mvsfunc.py#L453-L468 If I understood correctly, the operation order is chroma upscaling -> matrix conversion (YUV->RGB) -> depth conversion, which is the way that mpv is doing.