Kodi Community Forum
Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Linux (https://forum.kodi.tv/forumdisplay.php?fid=52)
+---- Thread: Intel VAAPI howto with Leia v18 nightly based on Ubuntu 18.04 server (/showthread.php?tid=231955)



RE: New Era: VAAPI with EGL interoperation - Sunflux - 2015-09-29

I've done more A/B screenshots of color movies... there is literally no perceptible difference between dithering ON or OFF. After doing a difference comparison of screenshots of the identical frame there is, however, an imperceptible difference: a scattering of pixels throughout the image that are all slightly changed in color. And by slight, I mean something like an invisible change from RGB 69-91-130 to 69-90-129. There's no rhyme or reason to the changes, however.

Here's a difference map of the Disney logo:

Image


RE: New Era: VAAPI with EGL interoperation - Hufvudet - 2015-09-29

Interesting. So something is happening. Again, thanks for digging into this.


RE: New Era: VAAPI with EGL interoperation - Sunflux - 2015-09-29

(2015-09-28, 12:31)Roby77 Wrote: Panasonic Plasma 50 and 60 series can do full and limited rgb and i confirm that auto mode doesn't work very well

If i try to play 16-235 content it's expanded to 0-255 so i must manually select limited (also in tv setting)

BUT for strange reason i must set +2 for contrast in kodi cause white 235 is little grey while in dither mode it's perfect

On my Sony, I had to set brightness to 51 (normally 50) in order to see the darkest shade of grey before black with Kodi.

Incidentally, on a properly calibrated system you should never see any shades of grey below black 16, however it is perfectly normal for white 235 to be a very light shade of grey, and for you to be able to see "super white" content above that.


RE: New Era: VAAPI with EGL interoperation - cyrano - 2015-09-29

(2015-09-29, 12:34)Sunflux Wrote: I've done more A/B screenshots of color movies... there is literally no perceptible difference between dithering ON or OFF. After doing a difference comparison of screenshots of the identical frame there is, however, an imperceptible difference: a scattering of pixels throughout the image that are all slightly changed in color. And by slight, I mean something like an invisible change from RGB 69-91-130 to 69-90-129. There's no rhyme or reason to the changes, however.

Single-step changes at seemingly random places is exactly what dithering should look like AFAIK.


RE: New Era: VAAPI with EGL interoperation - Sunflux - 2015-09-29

(2015-09-29, 16:33)cyrano Wrote: Single-step changes at seemingly random places is exactly what dithering should look like AFAIK.

This isn't dithering. There's far too little of it, and it's mostly around object edges / sharp areas of contrast, but not in any meaningful way. To the naked eye there is no improvement or worsening of the image, it's more like a rounding error.


RE: New Era: VAAPI with EGL interoperation - BigL-New - 2015-09-29

(2015-09-28, 23:31)Roby77 Wrote: Better, too many option= more confusion ....(like more money more problems Wink )

See me Big Grin

Edit:check better there is at page 153

http://service.us.panasonic.com/OPERMANPDF/E-HELP_ST60.PDF
Thanks for your help. It's really appreciated. Sadly:

1. I've ST50 series (your manual is for ST60 - 1 year newer model)
2. This is manual for US version of this TV - I've European version (many differences in functionality in Panasonic TV products)

So for me correct manual is here: https://dlc.panasonic-europe-service.com/EUDocs/GetDoc.aspx?did=205055&fmt=PDF&lang=en&src=3&model=TXP55ST50E

As you can see on page 60 in European models in advanced picture settings there is no HDMI range setting :-(


RE: New Era: VAAPI with EGL interoperation - Oshan Ruiz - 2015-09-29

(2015-09-29, 14:48)Sunflux Wrote:
(2015-09-28, 12:31)Roby77 Wrote: Panasonic Plasma 50 and 60 series can do full and limited rgb and i confirm that auto mode doesn't work very well

If i try to play 16-235 content it's expanded to 0-255 so i must manually select limited (also in tv setting)

BUT for strange reason i must set +2 for contrast in kodi cause white 235 is little grey while in dither mode it's perfect

On my Sony, I had to set brightness to 51 (normally 50) in order to see the darkest shade of grey before black with Kodi.

Incidentally, on a properly calibrated system you should never see any shades of grey below black 16, however it is perfectly normal for white 235 to be a very light shade of grey, and for you to be able to see "super white" content above that.

I'm never able to get above white 233/234 with Kodi but it could be my adjustments to contrast to avoid color clipping.
Not a big concern to me.


RE: New Era: VAAPI with EGL interoperation - Roby77 - 2015-09-29

No we were talking about greyscale not white clipping

For white clipping i'ts ok 230-234, if you get more it's not bad btw (for what i understood)


RE: New Era: VAAPI with EGL interoperation - lmyllari - 2015-09-29

(2015-09-29, 16:33)cyrano Wrote:
(2015-09-29, 12:34)Sunflux Wrote: I've done more A/B screenshots of color movies... there is literally no perceptible difference between dithering ON or OFF. After doing a difference comparison of screenshots of the identical frame there is, however, an imperceptible difference: a scattering of pixels throughout the image that are all slightly changed in color. And by slight, I mean something like an invisible change from RGB 69-91-130 to 69-90-129. There's no rhyme or reason to the changes, however.

Single-step changes at seemingly random places is exactly what dithering should look like AFAIK.
Correct. It is not meant to fix any issues in the input but to avoid issues from limited precision output.

Short version: set the GPU (with xrandr) to full range so it doesn't mess with the output and enable dithering with 8bit depth. This will add a small amount of noise when needed (for limited range setting in Kodi it may not be needed). If you need to use limited range GPU setting, try dithering with 7 or even 6 bit depth.

Longer version:

Consider the following input values (say in a greyscale ramp)
Code:
Y       Cb      Cr
16      128     128
17      128     128
18      128     128
19      128     128
20      128     128

Convert to limited range RGB and we get this
Code:
R       G       B
16      16      16
17      17      17
18      18      18
19      19      19
20      20      20

Convert to full range RGB
Code:
R       G       B
0       0       0
1.164   1.164   1.164
2.329   2.329   2.329
3.493   3.493   3.493
4.658   4.658   4.658

8bit output is integers between 0-255. If we take the full range RGB values and simply round them, we get a sequence of 0, 1, 2, 3, 5 - this is how the banding is created.

Dithering solves this by adding noise (output = input + x, 0 <= x < 1) and rounding down the output. This leaves the limited range values above untouched, since the noise added is always less than 1 and the ouput is rounded down. The full range values are sometimes shifted up by 1. Sunflux posted a picture that demonstrates this nicely.


Here are the possible steps the video frame goes through:
  1. decoder output (YCbCr)
  2. colorspace conversion to RGB
  3. output to an 8bit texture for advanced scaling
  4. scaling and filtering
  5. expansion to full range RGB
  6. dithering
  7. output to an 8bit framebuffer
  8. conversion to limited range RGB by the GPU

This is the worst case (Kodi is set to full range, advanced scaling is used and GPU is set to limited range output).

At step 3, RGB values are rounded to 8bit. I changed the colorspace conversion to always output limited range to avoid banding at this step.

Step 7 does rounding to 8bit again, and at this point dithering is required to avoid banding from step 5. With dithering applied, the input values are already 8bit integers (with even fewer values if dither depth < 8).

Step 8 is a problem. The GPU just takes the values 0-255 and scales them to 16-235.
Code:
full    limited range   rounded
0       16              16
1       16.8588235294   17
2       17.7176470588   18
3       18.5764705882   19
4       19.4352941176   19
5       20.2941176471   20
6       21.1529411765   21
7       22.0117647059   22
8       22.8705882353   23
9       23.7294117647   24
10      24.5882352941   25
Notice how both output values 3 and 4 map to 19.

Dithering to lower output depth may help with this since there are fewer output values from dithering. I'm not sure how exactly the GPU scaling does rounding so I can not provide detailed guidance. I don't recommend the limited range GPU setting since it will always lead to loss of quality.


RE: New Era: VAAPI with EGL interoperation - john.cord - 2015-09-29

(2015-09-29, 17:42)BigL-New Wrote:
(2015-09-28, 23:31)Roby77 Wrote: Better, too many option= more confusion ....(like more money more problems Wink )

See me Big Grin

Edit:check better there is at page 153

http://service.us.panasonic.com/OPERMANPDF/E-HELP_ST60.PDF
Thanks for your help. It's really appreciated. Sadly:

1. I've ST50 series (your manual is for ST60 - 1 year newer model)
2. This is manual for US version of this TV - I've European version (many differences in functionality in Panasonic TV products)

So for me correct manual is here: https://dlc.panasonic-europe-service.com/EUDocs/GetDoc.aspx?did=205055&fmt=PDF&lang=en&src=3&model=TXP55ST50E

As you can see on page 60 in European models in advanced picture settings there is no HDMI range setting :-(

Today i tried to find the HDMI Black Level Setting in my TX-P50GT30 (European) and i did not find it too... good to know that it does not exist. In my oppinion the European Model is fixed to Limited Colorspace.


RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-09-29

(2015-09-29, 19:37)lmyllari Wrote:
(2015-09-29, 16:33)cyrano Wrote:
(2015-09-29, 12:34)Sunflux Wrote: I've done more A/B screenshots of color movies... there is literally no perceptible difference between dithering ON or OFF. After doing a difference comparison of screenshots of the identical frame there is, however, an imperceptible difference: a scattering of pixels throughout the image that are all slightly changed in color. And by slight, I mean something like an invisible change from RGB 69-91-130 to 69-90-129. There's no rhyme or reason to the changes, however.

Single-step changes at seemingly random places is exactly what dithering should look like AFAIK.
Correct. It is not meant to fix any issues in the input but to avoid issues from limited precision output.

Short version: set the GPU (with xrandr) to full range so it doesn't mess with the output and enable dithering with 8bit depth. This will add a small amount of noise when needed (for limited range setting in Kodi it may not be needed). If you need to use limited range GPU setting, try dithering with 7 or even 6 bit depth.

Longer version:

Consider the following input values (say in a greyscale ramp)
Code:
Y       Cb      Cr
16      128     128
17      128     128
18      128     128
19      128     128
20      128     128

Convert to limited range RGB and we get this
Code:
R       G       B
16      16      16
17      17      17
18      18      18
19      19      19
20      20      20

Convert to full range RGB
Code:
R       G       B
0       0       0
1.164   1.164   1.164
2.329   2.329   2.329
3.493   3.493   3.493
4.658   4.658   4.658

8bit output is integers between 0-255. If we take the full range RGB values and simply round them, we get a sequence of 0, 1, 2, 3, 5 - this is how the banding is created.

Dithering solves this by adding noise (output = input + x, 0 <= x < 1) and rounding down the output. This leaves the limited range values above untouched, since the noise added is always less than 1 and the ouput is rounded down. The full range values are sometimes shifted up by 1. Sunflux posted a picture that demonstrates this nicely.


Here are the possible steps the video frame goes through:
  1. decoder output (YCbCr)
  2. colorspace conversion to RGB
  3. output to an 8bit texture for advanced scaling
  4. scaling and filtering
  5. expansion to full range RGB
  6. dithering
  7. output to an 8bit framebuffer
  8. conversion to limited range RGB by the GPU

This is the worst case (Kodi is set to full range, advanced scaling is used and GPU is set to limited range output).

At step 3, RGB values are rounded to 8bit. I changed the colorspace conversion to always output limited range to avoid banding at this step.

Step 7 does rounding to 8bit again, and at this point dithering is required to avoid banding from step 5. With dithering applied, the input values are already 8bit integers (with even fewer values if dither depth < 8).

Step 8 is a problem. The GPU just takes the values 0-255 and scales them to 16-235.
Code:
full    limited range   rounded
0       16              16
1       16.8588235294   17
2       17.7176470588   18
3       18.5764705882   19
4       19.4352941176   19
5       20.2941176471   20
6       21.1529411765   21
7       22.0117647059   22
8       22.8705882353   23
9       23.7294117647   24
10      24.5882352941   25
Notice how both output values 3 and 4 map to 19.

Dithering to lower output depth may help with this since there are fewer output values from dithering. I'm not sure how exactly the GPU scaling does rounding so I can not provide detailed guidance. I don't recommend the limited range GPU setting since it will always lead to loss of quality.


Thank you very much for your time and for explaining this in such great detail!


RE: New Era: VAAPI with EGL interoperation - BigL-New - 2015-09-29

(2015-09-29, 19:52)john.cord Wrote: Today i tried to find the HDMI Black Level Setting in my TX-P50GT30 (European) and i did not find it too... good to know that it does not exist. In my oppinion the European Model is fixed to Limited Colorspace.
At least not on my TV - you can youse xrandr to check what's available for yours. On mine it reports:

Code:
Broadcast RGB: Full
    supported: Automatic, Full, Limited 16:235

So you can clearly see that both are accepted (at least at input level). Right now HDMI negotiation of Full is forced by autostart (see post #1). But Kodi itself sends Full or Limited - it depends on settings. At least on my TV i can clearly see difference - with Limited colors are washed out. But with Full movies are very dark. Yo can check which settings are best on post nr 1360.

But (IMHO only) best settings are with Kodi set to Full, no dithering, but on TV level setting forced to Limited (usung xrandr). So on my setup autostart looks like this:

Code:
OUTPUT=`xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
xrandr -display :0 --output $OUTPUT --set "Broadcast RGB" "Limited 16:235"
/usr/bin/kodi --standalone



RE: New Era: VAAPI with EGL interoperation - BigL-New - 2015-09-29

(2015-09-29, 06:44)Sunflux Wrote: VALID FOR THE NEW KODI EGL VERSION IN THIS THREAD:
[code]Driver 0-255 -> Kodi Full -> Dithering On -> TV Auto* -> CORRECT (**GOOD** Heavily Processed)
Nice summary Sunflux. Could you explain what means Driver level? Kodi and Dithering are clear since they are settings in Kodi. But what do you mean by Driver and what by TV? Which one is xrandr setting from autostart?


RE: New Era: VAAPI with EGL interoperation - fritsch - 2015-09-29

Driver Level: xrandr


RE: New Era: VAAPI with EGL interoperation - john.cord - 2015-09-29

(2015-09-29, 20:46)BigL-New Wrote: But (IMHO only) best settings are with Kodi set to Full, no dithering, but on TV level setting forced to Limited (usung xrandr). So on my setup autostart looks like this:

Code:
OUTPUT=`xrandr -display :0 -q | sed '/ connected/!d;s/ .*//;q'`
xrandr -display :0 --output $OUTPUT --set "Broadcast RGB" "Limited 16:235"
/usr/bin/kodi --standalone

Ok but this whole thread is about to set the system via xrandr to full and Kodi to Limited via the "use limited colorspace" Setting because the colorspace conversion thing... Btw, my Setup is:

Chromebox (RGB Full, Kodi Set to limited) --> AVR --> HDMI Splitter --> TV/Beamer

I checked the settings of my TV via a PS3 set to Limited RGB. Both Systems produce the Same Picture of the AVSHD Black Level test Pattern so in my case i assume that the Plasma is reading the Signal as Limited Colorspace and the beamer has a trigger for Colorspace and is set to Limited RGB.