Kodi Community Forum
Video Level Scaling/Clipping Questions - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Discussions (https://forum.kodi.tv/forumdisplay.php?fid=222)
+--- Forum: Hardware (https://forum.kodi.tv/forumdisplay.php?fid=112)
+--- Thread: Video Level Scaling/Clipping Questions (/showthread.php?tid=250496)

Pages: 1 2


Video Level Scaling/Clipping Questions - GrammatonKlerik - 2015-12-02

There seems to be much confusion on just what changing video levels do throughout the video chain from Kodi -> GPU -> TV and although the answers are available, they are buried deep in threads and spread throughout the forums. Since I'm very interested in this topic and have done quite a bit of research I plan to create a visual FAQ on just what happens when you change the video levels in your chain to either Limited or Full to hopefully provide a single place for people to really grok what is happening.

In this visual FAQ, I plan to show the intermediate changes in the chain from Kodi --> GPU --> TV for each combination of Limited & Full.

Before I create these pictures I wanted to clarify things first. Here is what I think happens, please correct me where I'm wrong:

  1. Setting Kodi to 'Full' will expand YUV Lvl 16 to RGB Lvl 0 and expand YUV Lvl 234 to RGB Lvl 255 -- WtW and BtB will be clipped in this process
  2. Setting Kodi to 'Limited' will map YUV Lvl 16 to RGB Lvl 16 and map YUV Lvl 234 to RGB Lvl 234 -- BtB will be maintained at RGB levels 0-15 and WtW will be maintained at RGB levels 235-255; this is still a lossy conversion
  3. Setting GPU to 'Full' will pass through the video untouched as it comes from Kodi
  4. Setting GPU to 'Limited' will compress RGB Lvl 0 to RGB Lvl 16 and compress RGB Lvl 255 to RGB Lvl 234 -- What fills in RGB levels 0-15 & 235-255?

I think I have the above just about right but I'm a bit fuzzy on what happens when you set your TV to either Limited or Full. Since the TV must convert to RGB Full at some point before displaying, what happens in the following scenarios?

  1. GPU Reports RGB Limited in infoframes and TV set to Limited -- Does the TV map RGB Lvl 16/235 to RGB Lvl 0/255 and clip whatever was at Lvls 0-15 & 235-255?
  2. GPU Reports RGB Limited in infoframes but TV is set to Full -- What happens here?
  3. GPU Reports RGB Full in infoframes and TV is set to Full -- I'm fairly certain the TV doesn't do any remapping in this case and all is good
  4. GPU Reports RGB Full in infoframes and TV ignores it or is set to Limited -- What happens here?

Does setting Limited vs Full on your TV just tell the TV where it should expect Reference Black (and White) to be and set its pixel luminance accordingly?

That is to say:
  • If TV is set to 'Limited', incoming content that contains RGB Levels 0-16 will cause those pixels to be fully off.
  • If the TV is set to 'Full' then only incoming content that contains RGB Level 0 will cause those pixels to be fully off and anything above 0 will have those pixels be driven.

Thank you for your help


RE: Video Level Scaling/Clipping Questions - Bahndit - 2015-12-03

GrammatonKlerik,

Thanks for compiling all of this info. I have some of the same questions as you but have not done a great job of tracking all of the different discussions on the issue as you are attempting to do here. I look forward to your visual FAQ and hope that your compilation of information can perhaps find its way into the wiki or something.

-Bahndit


RE: Video Level Scaling/Clipping Questions - noggin - 2015-12-03

(2015-12-02, 21:17)GrammatonKlerik Wrote: Does setting Limited vs Full on your TV just tell the TV where it should expect Reference Black (and White) to be and set its pixel luminance accordingly?

That is to say:
  • If TV is set to 'Limited', incoming content that contains RGB Levels 0-16 will cause those pixels to be fully off.
  • If the TV is set to 'Full' then only incoming content that contains RGB Level 0 will cause those pixels to be fully off and anything above 0 will have those pixels be driven.

Thank you for your help

Assuming the TV is correctly calibrated and the brightness, contrast and backlight controls are correctly set then yes.

For a TV set to Limited, 16 is black (and all values below will be displayed as black).
For a TV set to Full, 0 is black (and there are no values below).

This is true for both Y (in YCbCr) and RGB.

One advantage of Limited range is that you can accurately set black level using PLUGE, which has values just above 16 and just below 16 centred on a bar of exactly 16. You adjust your TV so you can see the value above 16 appear different to 16, but the level below 16 just appear to be the same as 16. If you can see all three bars then you have a 'lifted' picture, and your black level is raised, so you reduce your black level (usually brightness, though backlight interacts with this).


RE: Video Level Scaling/Clipping Questions - GrammatonKlerik - 2015-12-03

(2015-12-03, 04:28)noggin Wrote: Assuming the TV is correctly calibrated and the brightness, contrast and backlight controls are correctly set then yes.

For a TV set to Limited, 16 is black (and all values below will be displayed as black).
For a TV set to Full, 0 is black (and there are no values below).

This is true for both Y (in YCbCr) and RGB.

One advantage of Limited range is that you can accurately set black level using PLUGE, which has values just above 16 and just below 16 centred on a bar of exactly 16. You adjust your TV so you can see the value above 16 appear different to 16, but the level below 16 just appear to be the same as 16. If you can see all three bars then you have a 'lifted' picture, and your black level is raised, so you reduce your black level (usually brightness, though backlight interacts with this).

Excellent, thanks for confirming this.

As to your last point, I was actually planning on setting Kodi to Limited, GPU to Full and TV to limited so that WtW & BtB is preserved and then use the white level and black level clipping patterns from the AVCHD709 disk to set the brightness & contrast of the TV correctly. Once I get that all straightened out I plan on putting the entire chain to Full such that there is only single conversion & scaling from YCbCr to RGB Full in the chain. Apparently the conversion from YCbCr to RGB Full is more accurate than YCbCr to RGB Limited although I don't fully understand why and it seems a bit counter-intuitive TBH.


RE: Video Level Scaling/Clipping Questions - noggin - 2015-12-03

(2015-12-03, 08:04)GrammatonKlerik Wrote:
(2015-12-03, 04:28)noggin Wrote: Assuming the TV is correctly calibrated and the brightness, contrast and backlight controls are correctly set then yes.

For a TV set to Limited, 16 is black (and all values below will be displayed as black).
For a TV set to Full, 0 is black (and there are no values below).

This is true for both Y (in YCbCr) and RGB.

One advantage of Limited range is that you can accurately set black level using PLUGE, which has values just above 16 and just below 16 centred on a bar of exactly 16. You adjust your TV so you can see the value above 16 appear different to 16, but the level below 16 just appear to be the same as 16. If you can see all three bars then you have a 'lifted' picture, and your black level is raised, so you reduce your black level (usually brightness, though backlight interacts with this).

Excellent, thanks for confirming this.

As to your last point, I was actually planning on setting Kodi to Limited, GPU to Full and TV to limited so that WtW & BtB is preserved and then use the white level and black level clipping patterns from the AVCHD709 disk to set the brightness & contrast of the TV correctly. Once I get that all straightened out I plan on putting the entire chain to Full such that there is only single conversion & scaling from YCbCr to RGB Full in the chain. Apparently the conversion from YCbCr to RGB Full is more accurate than YCbCr to RGB Limited although I don't fully understand why and it seems a bit counter-intuitive TBH.

You could argue that there will be slightly less truncation/rounding on a YCbCr Limited to RGB Full conversion (assuming no RGB Limited interim) I guess. However I route my Kodi boxes through an amp which also has other Limited sources routed through it, so keep everything Limited (though InfoFrames may mean I no longer need to do this I see no real reason not too) Of course whether this is a real benefit will depend on what the TV does as well.

One thing I did discover is that my main TV properly interprets InfoFrames on HDMI (unlike many which don't) which means that the Intel EGL 'hack' which tells the GPU to output Full range, but pre-processes the video so that it is Limited by the time it has been output in this mode, in the expectation that the TV will be expecting Limited, doesn't work out of the box, because the TV detects the InfoFrame that flags it as Full (and switches to Full mode) It may be possible to force the TV into Limited mode (I haven't tried yet)

An older TV I have happily ignores InfoFrames, and thus works very well with the 'hack'


RE: Video Level Scaling/Clipping Questions - Soli - 2015-12-04

(2015-12-02, 21:17)GrammatonKlerik Wrote: There seems to be much confusion on just what changing video levels do throughout the video chain from Kodi -> GPU -> TV and although the answers are available, they are buried deep in threads and spread throughout the forums. Since I'm very interested in this topic and have done quite a bit of research I plan to create a visual FAQ on just what happens when you change the video levels in your chain to either Limited or Full to hopefully provide a single place for people to really grok what is happening.

In this visual FAQ, I plan to show the intermediate changes in the chain from Kodi --> GPU --> TV for each combination of Limited & Full.

Before I create these pictures I wanted to clarify things first. Here is what I think happens, please correct me where I'm wrong:

  1. Setting Kodi to 'Full' will expand YUV Lvl 16 to RGB Lvl 0 and expand YUV Lvl 234 to RGB Lvl 255 -- WtW and BtB will be clipped in this process
  2. Setting Kodi to 'Limited' will map YUV Lvl 16 to RGB Lvl 16 and map YUV Lvl 234 to RGB Lvl 234 -- BtB will be maintained at RGB levels 0-15 and WtW will be maintained at RGB levels 235-255; this is still a lossy conversion
  3. Setting GPU to 'Full' will pass through the video untouched as it comes from Kodi
  4. Setting GPU to 'Limited' will compress RGB Lvl 0 to RGB Lvl 16 and compress RGB Lvl 255 to RGB Lvl 234 -- What fills in RGB levels 0-15 & 235-255?
1. right except it's level 235
2. same. it's "lossy", but that's besides the point. The levels are the samme.
3. right
4. right. levels 0-15=16 level 236-256=235

Quote:
  1. GPU Reports RGB Limited in infoframes and TV set to Limited -- Does the TV map RGB Lvl 16/235 to RGB Lvl 0/255 and clip whatever was at Lvls 0-15 & 235-255?
  2. GPU Reports RGB Limited in infoframes but TV is set to Full -- What happens here?
  3. GPU Reports RGB Full in infoframes and TV is set to Full -- I'm fairly certain the TV doesn't do any remapping in this case and all is good
  4. GPU Reports RGB Full in infoframes and TV ignores it or is set to Limited -- What happens here?
1. yes, but again you got the whitelevel wrong: it clips level 236-255.
2. wrong colors, washed out picture, wrong picture etc
3. As Noggin said, some TVs respect the infoframes and will adjust accordingly. if it doesn't: see 2. (which could be remedied by setting Kodi itself to limited, but does not work with Vaapi until EGL is mainline. Don't know how it is with vdpau.
4. Same as 3. except: If it doesnt: picture will be too dark instead of washed out.

Quote:Does setting Limited vs Full on your TV just tell the TV where it should expect Reference Black (and White) to be and set its pixel luminance accordingly?

That is to say:
  • If TV is set to 'Limited', incoming content that contains RGB Levels 0-16 will cause those pixels to be fully off.
  • If the TV is set to 'Full' then only incoming content that contains RGB Level 0 will cause those pixels to be fully off and anything above 0 will have those pixels be driven.
1. Only if you have adjusted the brightness right. And sometimes BTB will come through, even though it shouldn't. If your TV has poor blacklevels, you might have to do some sort of tradeoff, to get a subjectively more punchier picture and/or to lessen the washed out look.
2. That's right.


As Noggin said, BTB is good for adjusting brightness with the pluge pattern. But in reality it's not that big of a deal: Just adjust brightness until level 16 dissapears, then increase it until 17 is visible. BUT (and this is a big but) level 17 is supposed to be the very very nearly invisible bridge between total blackness and a little brightness. You should barely decipher level 17 with your eyes an inch from the screen. At viewing distance you should be just barely able to discern level 18 if your in in a cave. It's not until level 19 that you should be able to discern "easily". Now if you did this right, level 15 is guaranteed to invisible, so therefore you will have the correct brightness, even if you used a pluge pattern.where level 0-15 is clipped. This is where most people go wrong. They think level 17 should be clearly discernible. If it is, you will have poor blacklevels.

I would recommend using GPU full if you are using VAAPI and your TV supports full levels. That gives the least amount of banding with Kodi 15.2 (and 16.x) (while using VAAPI). You'll be missing out on WTW but that's not a big deal. Kodi 17 with EGL mainlined and Ubuntu 16.04 LTS isn't that far away.

If you have a powerful enough cpu, you can also just use software decoding and mimic EGL with Kodi 15.x and 16.x.


RE: Video Level Scaling/Clipping Questions - GrammatonKlerik - 2015-12-06

Thank you so much for the detailed reply.

One follow-up question:

When GPU is set to limited you said the result is "levels 0-15=16 level 236-256=235".

So my question is if the levels between 16 and 235 are left untouched or are they compressed inwards?

Said more concretely does setting GPU to limited either do:
  1. Input Levels 0-16 get remapped up to output Levels 16-32, Input Levels 235-255 remapped down to 215-235 and intermediate levels get compressed inwards
  2. Input Levels 0-15 are rewritten to say Level 16 and Input Levels 235-255 are rewritten to say Level 235 and intermediate levels are unchanged

Thanks


RE: Video Level Scaling/Clipping Questions - Soli - 2015-12-06

What I meant is that there are no levels 0-15 and 236-255.

None of your options are the right.
For the GUI
1. Input levels 0-255 are compressed to 16-235, leaving levels 0-15 and level 236-255 not in use.

When playing videos:
2. levels 16-235 first gets expanded to 0-255, and levels 0-15 and 236-255 are discarded. Then 1.


RE: Video Level Scaling/Clipping Questions - GrammatonKlerik - 2015-12-06

Based on all the info I've gathered, both here and elsewhere, here is the first go at my "visual FAQ."

I would appreciate any criticism on how I can make it more digestible and of course any errors it may have. Note: the smiley face is there so you can better see the scaling that happens.

Also, here is a result table which I've derived from the images. The order is Media Player --> GPU --> TV
  • Full, Full, Full -- Video Level CORRECT : WtW & BtW Clipped, Single scaling
  • Full, Full, Limited -- Video Level WRONG : Crushed Blacks
  • Full, Limited, Full -- Video Level WRONG : Washed Out Colors
  • Full, Limited, Limited -- Video Level CORRECT : WtW & BtW Clipped, Double scaling
  • Limited, Full, Full -- Video Level WRONG : Washed Out Colors
  • Limited, Full, Limited -- Video Level CORRECT : WtW & BtB preserved, Zero scaling
  • Limited, Limited, Full -- Video Level WRONG : Extreme Washed Out Colors
  • Limited, Limited, Limited -- Video Level WRONG : Washed Out Colors

Out of the eight combinations, only three have correct video levels by the time they reach the TV:
  1. Full,Full,Full -- Desktop will look correct but video content is also scaled during the Y'CbCr --> RGB color space transformation. BtB & WtW are clipped so calibration will be more difficult
  2. Full, Limited, Limited -- This should be avoided since there are two levels of scaling which will likely cause unnecessary banding.
  3. Limited, Full, Limited -- Best option for embedded video player as there is zero scaling during the Y'CbCr --> RGB color space transformation. BtB & WtW are preserved to make calibration easier. If using a Desktop it will look overly dark

Image

Image

Image

Image

Image

Image

Image

Image


RE: Video Level Scaling/Clipping Questions - Bahndit - 2015-12-08

So sounds like the best way is Limited, Full, Limited. How is the best way to achieve this?
The way I understand this is to select limited in the settings in Kodi and then make sure the the GPU is output full but then I will have to force my display into limited since the infoframes will be reporting that the source is full. Is that correct?


RE: Video Level Scaling/Clipping Questions - noggin - 2015-12-08

(2015-12-08, 03:28)Bahndit Wrote: So sounds like the best way is Limited, Full, Limited. How is the best way to achieve this?
The way I understand this is to select limited in the settings in Kodi and then make sure the the GPU is output full but then I will have to force my display into limited since the infoframes will be reporting that the source is full. Is that correct?

Only if your TV detects Infoframes. Lots don't. I have two Sonys. My UHD set detects them, my c.2008 Full HD set ignores them.


RE: Video Level Scaling/Clipping Questions - GrammatonKlerik - 2015-12-08

(2015-12-08, 07:57)noggin Wrote:
(2015-12-08, 03:28)Bahndit Wrote: So sounds like the best way is Limited, Full, Limited. How is the best way to achieve this?
The way I understand this is to select limited in the settings in Kodi and then make sure the the GPU is output full but then I will have to force my display into limited since the infoframes will be reporting that the source is full. Is that correct?

Only if your TV detects Infoframes. Lots don't. I have two Sonys. My UHD set detects them, my c.2008 Full HD set ignores them.

Right, my Panasonic VT30 plasma does not as well but my 4K Samsung HU8550 does. Kodi 17 will have a hybrid-full of sorts for the GPU where it passes through the video as if you set it to Full but it reports limited in the infoframes for TVs that honor it so you don't have to manually change it


RE: Video Level Scaling/Clipping Questions - TScott - 2016-11-11

Is there any good reason why Kodi would not give me the option "use limited color range 16-235"?
Latest stable version of Kodi (ver 16.1) in Windows 7. ATI Radeon graphics.
I have expert mode on and I do not see this option under the Video Output settings.

Same thing on my HTPC. No option to change color range.


RE: Video Level Scaling/Clipping Questions - noggin - 2016-11-11

(2016-11-11, 21:50)TScott Wrote: Is there any good reason why Kodi would not give me the option "use limited color range 16-235"?
Latest stable version of Kodi (ver 16.1) in Windows 7. ATI Radeon graphics.
I have expert mode on and I do not see this option under the Video Output settings.

Same thing on my HTPC. No option to change color range.

May be wrong - but in Windows I think it may be a driver rather than Kodi option?


RE: Video Level Scaling/Clipping Questions - TScott - 2016-11-11

(2016-11-11, 23:01)noggin Wrote:
(2016-11-11, 21:50)TScott Wrote: Is there any good reason why Kodi would not give me the option "use limited color range 16-235"?
Latest stable version of Kodi (ver 16.1) in Windows 7. ATI Radeon graphics.
I have expert mode on and I do not see this option under the Video Output settings.

Same thing on my HTPC. No option to change color range.

May be wrong - but in Windows I think it may be a driver rather than Kodi option?

My HTPC uses ATI graphics, my desktop has an NVIDIA graphics card. Both have the option to use either 0-255 (full) or 16-235 (limited). I have flipped these settings back and forth on both computers and do not see any effect on the options displayed in Kodi.