Colorspace YUV/RGB problem / GPU's RGB Full range setup?

Hello,
CoreELEC 8.95.7, Odroid C2.

I accidentally found, when testing with projector, that C2 sends output HDMI as YUV (projector cant determine correct limited/full range automatically, and shows dark too deep without details).
I used Rpi2 before

# 2 - RGB full ( 0-255)
hdmi_pixel_encoding=2

And projector correctly shows RGB, and also TV correctly reacts, when trying limited/full range from TV menu.

Dmesg with default output:

[   19.782743@0] hdmitx: video: VIC: 32 (32) 1920x1080p24hz
[   19.782783@0] hdmitx: video: Bit depth: 8-bit, Colour range RGB: limited, YCC: limited, Colourspace: YUV444
[   19.782809@0] hdmitx: video: Colorimetry: bt709

When I tried
echo "rgb,8bit" > /sys/class/amhdmitx/amhdmitx0/attr or echo "rgb,10bit" > /sys/class/amhdmitx/amhdmitx0/attr and refresh resolution, projector shows RGB and colors are fine, and also correctly determined by Automatic function of projector (which wasnt the case for YUV).

CoreELEC:~ # dmesg | grep RGB
[   20.385404@2] hdmitx: video: Bit depth: 8-bit, Colour range RGB: limited, YCC: limited, Colourspace: RGB
[   20.925393@3] hdmitx: video: Bit depth: 10-bit, Colour range RGB: limited, YCC: limited, Colourspace: RGB

I am not sure, if correct settings is 8b or 10b, but I would definitivelly want to Full RGB output. Could this be fixed? Or, even better, maybe setuped from CoreELEC settings (if Full RGB isnt optimal/default value nowadays)?

Could you please try to set “disable auto colour depth switching” in “settings > system > CoreELEC”?

Seems that disable auto colour depth switching doesnt have any influence, on both (YUV/RGB, Automatic range (video/pc signal) function on projector). Projector and TV are acting the same. I dont know how to show YUV/RGB mark on TV.

  1. Default Odroid C2 / Odroid C2 with both enabled/disabled auto colour depth switching

Projector:
YUV
Automatically choose wrong limit range of video: Video signal -> darkens blacks too much, without detail. When I manually switch to PC signal @projector, picture seems to be better/OK.

Panasonic TV:
Choosing between Full and Limited range on TV doesnt make any difference, picture has not darkened black or goes significantly grey.

  1. Odroid C2 + echo “rgb,8bit” / echo "rgb,10bit"
    hdmitx shows Colour range RGB: limited, devices confirms this

Projector:
RGB
Automatically choose Video signal -> Picture is fine. When I manually switch to PC signal, image is “too gray/washed out”.

Panasonic TV:
Automatically choose Limited Range and picture is fine. When choosing Full Range, image is “too gray/washed out”.

  1. Odroid C2 + echo “full,rgb,8bit” / echo "full,rgb,10bit"
    hdmitx shows Colour range RGB: full, device detects Full, but picture is like Limited (3.):

Projector:
RGB
Automatically choose PC Signal signal -> Picture is “too gray/washed out”. When I manually switch to Video signal, image is fine.

Panasonic TV:
Automatically choose Full Range and picture is “too bright/gray”. When choosing Limited Range, image is OK.

  1. Rpi with GPU at Limited range (hdmi_pixel_encoding=1):

Projector:
RGB
Automatically choose Video Signal -> Picture is fine. When I manually switch to PC signal, image is “too gray/washed out”.

Panasonic TV:
Automatically choose Limited Range and picture is fine. When choosing Full Range, image is"too gray/washed out".

  1. Rpi with GPU at full range (hdmi_pixel_encoding=2):

Projector:
RGB
Automatically choose PC Signal -> Picture is fine. When I manually switch to Video signal, image is too dark.

Panasonic TV:
Automatically choose Full Range and picture is fine. When choosing Limited Range, image is too dark.


From the observation I think on projector has
PC Signal = Full Range
Video Signal = Limited Range

and Odroid C2

  • disable auto colour depth switching - no change
  • RGB/YUV switching - works
  • full/limited switching - seems to doesnt works, both output are in Limited range
  • didnt find difference between rgb,8bit and rgb,10bit on the first look/test

After reading https://kodi.wiki/view/Video_levels_and_color_space, maybe Limited on TV/projector side isnt bad (in case TV supports infoframe informations). I understand, I must differentiate Kodi output, and Odroid output.

When I tested black clipping from AVS, I didnt see anything under 16… Which doesnt mean necessary problem, and would be result also for F-F-F or F-L-L chain.

If you used the Limited -> Full -> Limited combination (and disabled hardware decoding) you can verify everything is working by playing the Black Clipping Pattern and verifying that you can get levels below 16 to flash when you raise your TV’s brightness setting.

But this could be slightly different thing, because I didnt see them also on Rpi, so I dont want to mix things together - this could be related to the Kodi output (range) itself.

So I would like to first solve Odroid’s GPU output

  • YUV / RGB output (could be setuped through autostart.sh)
  • where I can actually set Full or Limited RGB (as with hdmi_pixel_encoding on Rpi, correctly recognized by Panasonic TV). To be more precise, how can I demand Full instead Limited RGB on Odroid C2’s GPU, like
    . hdmi_pixel_encoding on Pi platform
    . xrandr --set "Broadcast RGB" "Full" on linux

Thats output after rgb comands was issued

CoreELEC:~ # dmesg | grep RGB
[   20.925393@3] hdmitx: video: Bit depth: 10-bit, Colour range RGB: limited, YCC: limited, Colourspace: RGB

Side note

After this I could think about “next chapter”, Kodi output (Full/Limited), to get best outcome L-F-L for optimal results without scaling.

But if I wouldnt have option to choose F/L on Kodi side (and so far, my tests results seems that Kodi in CoreELEC goes Full, without option to change), I would definitivelly prefer F-F-F (as before with Rpi setuped to Full RGB, single scaling) before F-L-L as I assume I have now with Odroid + echo rgb,10 (Double scaling - possible banding). For the Rpi, it looks like the Kodi option is gone, but I would like to know, how its in the case of Amlogic/Odroid.

I read this discussion, where stated “range of RGB isnt setuped by HK Linux”, but I think this could be misunderstanding when talking about Player(Kodi) and platform (HK Linux). Kodi @Rpi doesnt have this option, but Rpi platform actually could be setuped the range via parameter. And also linux has xandr option to setup RGB range.

So I hardly believe, that at Odroid Kodi doesnt have option to choose, and also platform is only “automatic”…

  • Kodi Linux mentions VAAPI, where (from the Kodi 18 + Ubuntu 18.04) should be possible choosing Limit / Full, instead going always Full (ie, until 18 Kodi option to change range doesnt Apply).
  • Rpi doesnt use VAAPI, but popcornmix stated “it is take care off” (?)
  • Have no further details how its on Amlogic.
  • Kodi can be set to use limited video levels through the settings menu.

**NOTE: There is a limitation of the VAAPI Hardware Decoder where it converts to Full video levels despite setting Kodi to use limited. To get limited video content to output from Kodi, you must disable hardware decoding in Video Settings for the time being. This will be fixed in Kodi 17

  • Your GPU can (and should) be set to output FULL video levels by running the > command: xrandr --output HDMI1 --set "Broadcast RGB" "Full".

https://kodi.wiki/view/Video_levels_and_color_space#Pulling_it_All_Together_with_Calibration

Hi Jimmy,

That is a lot of information to sort through.

Let’s see if I got the important parts of what it is you are trying to say here.

Your problem is that colours are too dark when you use the C2 with your projector?

Manually changing the C2 to RGB output or changing the projectors display mode to PC, will improve the picture?

If I have misunderstood, please correct me.

Hello,
yes, I tried to explanatory as much as posible :slight_smile:

Important parts are:

  • By default, Odroid C2 seems to use YUV444 Colourspace (by design?). The projector automatically doesnt recognize correct Color range (limit/full). I can set up correct level manually, just the Automatic option on projector choose wrong range. TV shows picture “fine” (not dark, not washed), but for some reason TV settings Full/Limited video range doesnt make any difference. I would like to use RGB - RGB video range is correctly detected both Projector and TV, and I can see TV settings Full/Limited makes actually changes, when switched, as it should.

  • When talking about calibration of colours, there is always question of correctly setup of video range in chain Kodi - GPU - Display. I am not sure, if I can affect anyhow Kodi range (its for another discussion), and I think its Full on Odroid C2 CoreELEC ( color space transformation from Y’CbCr to RGB and the video levels are expanded from 16-235 to 0-255 – WtW & BtB are clipped in the process)

I am trying to setup best possible outcome. And from the 3 correct levels options, regarding GPU, the best should be use Full range.

Kodi-GPU-Display

  1. Full-Full-Full – Both Desktop & Video Content 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 video content 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

So far, I can see that Odroid GPU shows limited color range whatever colorspace, if I understand this correctly

[ 4721.323102@0] hdmitx: video: Bit depth: 8-bit, Colour range RGB: limited, YCC: limited, Colourspace: YUV444
[ 4812.197755@3] hdmitx: video: Bit depth: 10-bit, Colour range RGB: limited, YCC: limited, Colourspace: RGB

And I try to find the way, how I could change it.
I cant test xrandr --set "Broadcast RGB" "Full" (linux way) as this is not present in CoreELEC.

Interesting. I have just started looking into a banding issue I was having when this thread pops up.

Using an Odroid C2 attached to a Panasonic Plasma. I also tried “disable auto colour depth switching” with no effect. Previously had an Intel system with LibreElec attached to the Plasma, with little banding noticed.

I have not tried switching output between YUV and RGB, but the video range discussion caught my eye.

Based on my understanding of the Amlogic HDMI driver, the dmesg echo (hdmitx) is showing the colour range that the HDMI connection is at (ie. transmit). GPU processing supposedly is “Auto”, but I never found a reference for that info. If the display negotiates as LIMITED, it outputs as Limited. Now, supposedly in the HK 3.14 kernel this is controllable, https://forum.odroid.com/viewtopic.php?f=135&t=26003 but broken (?). However in the CoreElec 3.14-Nougat Kernel, that routine is rewritten https://github.com/CoreELEC/linux-amlogic/blob/amlogic-3.14-nougat/drivers/amlogic/hdmi/hdmi_tx_20/hw/hdmi_tx_hw.c so I’m not sure if HDMITX_DWC_FC_AVICONF3 is controllable.

As for controlling the colour range within Kodi, the option was removed as it apparently didn’t work.
https://discourse.coreelec.org/t/rbg-full-and-limited-range-selection/2001/3. Would need to look back as to when this was reverted versus when the Kernel was switched to Nougat, as I suspect the HK Kernel bug is why the switch didn’t work.

There is nothing wrong, you can enable full range by doing the following.

echo full > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

I don’t see this helping you in any way though, full range is for PC monitors and x86 predominately.

Source and output have to match, it doesn’t matter if you run in full mode as 99.9% of content is encoded with limited colour range, even the content on 4kmedia.org which is some of the highest bitrate samples available is encoded with limited range.

Just a few quick notes.

You can add the full and 8bit rgb together if you want to.

echo "full,rgb,8bit" > /sys/devices/virtual/amhdmitx/amhdmitx0/attr

If there is an avr connected between your device and the TV, check the settings on your avr to make sure it’s not the cause of your problems.

adamg - I know this could be maybe nitpicking here (if we take out projector inability to automatic setup YUV color range), but I just try to set up video levels… I agree that most importantly is correct video level, it just there are different methods, how to get it (colorspace transformations, no scaling/one scaling/two scaling), and for possible best results it would be good to have this process controled (on Rpi for example, no controll level on Kodi, but at least GPU can be controlled). Or at least, if its automated somehow, would be good to have ability to check, which option we using.

Thanks for the full tip.
I could see
[150857.907303@0] hdmitx: video: Bit depth: 10-bit, Colour range RGB: full, YCC: full, Colourspace: RGB

However, when I do quickly test (just on Kodi home screen), TV recognized Full, but the picture results are actually as the signal was Limited :thinking:. To confirm this, I tried switch TV to Limited, and colors goes from “washed out” to normal. So the same acting the TV gets limited signal, and the same result as with
[113373.481351@0] hdmitx: video: Bit depth: 10-bit, Colour range RGB: limited, YCC: limited, Colourspace: RGB

So, I am not sure how much I can trust actual hdmitx information (and what really means). I know, the same TV detects Rpi Full/Limited accordingly (switching TV to not-corresponding range with Rpi hdmi pixel settins results washed out colours or darkens black).

Therefore I think, there is something strange on Amlogic platform, as smf007 mentions and I am not sure, if this relies more on source (kodi) side, od GPU (amlogic driver) side.

I thought about option, that hdmitx value shows actual GPU output, and in fact Kodi doesnt send signal converted to Full, but Limited. But then, when hdmitx shows Limited, and TV shows limited (my previous test without full,rgb), result should be:

Limited, Limited, Limited – Video Level WRONG : Washed Out Colors, Present colours blacker than black (0-15) as reference black and whites whiter than white accordingly.

and I dont feel that way actually (at least on the first sight, I didnt do proper full test with greyscale patterns etc. which I will do when I got back from work).

And this concludes, if we trust hdmitx value actually shows actual GPU output, then

"full,rgb,8bit" would be Full, Full, Limited – Video Level WRONG : Crushed Blacks
"rgb,8bit" would be Full, Limited, Limited – Video Level CORRECT : WtW & BtW Clipped, Double scaling

and again, I dont see crushed blacks on first case. Contrary, I see washed out colour when I try switching to hyphotetical Full, Full, Full.

smf007 - good finding, thanks for information. It kinda concurs with my observations.

Long story short:
I believe video range which goes to the TV is limited, whatever color range hdmitx shows. The YUV / RGB hdmitx switch works correctly. Until now I am not 100%, what combination we get on Amlogic

1. Full, Full, Limited -- Video Level WRONG : Crushed Blacks
2. Full, Limited, Limited -- Video Level CORRECT : WtW & BtW Clipped, Double scaling
3. Limited, Full, Limited -- Video Level CORRECT : WtW & BtB preserved, Zero scaling
4. Limited, Limited, Limited -- Video Level WRONG : Washed Out Colors

but from tests I did so far, i am thinking that its 2., and color range hdmitx switch doesnt actually switch GPU output range (will test more thoroughly later), on the other hand its not obvious, what part of signal chain this option affects (if any).

P.S.: I updated my previous post to contain all otions, which could be affected by user and their outcomes.

I did some more test with Greyscale patterns.

First, one correction. When is Odroid setuped to the RGB Full, TV in Automatic detects it as Full Range, but the image is “greyed/washed” - acts as Limited signal range. After switching TV to Limited range picture looks OK.

Second. I didnt see BtB/WtW in any settings on Odroid and Rpi. That would mean, that Kodi player sends the signal always converted as Full on these platforms.

That, with previous results would concludes with Odroid we get

3. Full, Limited, Limited -- Video Level CORRECT : WtW & BtW Clipped, Double scaling (possible banding).

when on Rpi we could use hdmi_pixel_encoding parameter to choose between

Full, Full, Full -- Video Level CORRECT : WtW & BtW Clipped, Single scaling
Full, Limited, Limited -- Video Level CORRECT : WtW & BtW Clipped, Double scaling (possible banding).

On the other hand, when I did horizontal banding test on greyscale ramp, results from Odroid C2 seems better than Rpi (RGB full) to me. I can see banding in both cases, but in Odroid case its more detailed (not so big steps as in Rpi).
I didnt see difference between RGB and YUV in banding test on Odroid.

Also, I did test with / without AVR in path. Results are the same, for the record edids was

Rx Brand Name: PIO
Rx Product Name: VSX-930
Manufacture Week: 0
Manufacture Year: 2014
Physical size(cm): 96 x 54
EDID Version: 1.3
EDID block number: 0x1
blk0 chksum: 0x8b
Source Physical Address[a.b.c.d]: 2.1.0.0
YCC support 0x03, VIC (native 5):
ColorDeepSupport 0x80 10/12/16/Y444 0/0/0/0
5 4 3 15 14 7 6 20 19 18 30 29 22 21 11 10 26 25 35 36 37 38 16 31 32 1
Audio {format, channel, freq, cce}
{1, 1, 0x7f, 0x07}
{1, 7, 0x7f, 0x07}
{2, 5, 0x07, 0x00}
{7, 6, 0x1e, 0x00}
{9, 5, 0x02, 0x00}
{10, 7, 0x06, 0x01}
{11, 7, 0x7e, 0x01}
{12, 7, 0x7e, 0x01}
Speaker Allocation: 0x4f
Vendor: 0xc03
MaxTMDSClock1 150 MHz
SCDC: 0
RR_Cap: 0
LTE_340M_Scramble: 0

checkvalue: 0x8bb40000


Rx Brand Name: MEI
Rx Product Name: Panasonic-TV
Manufacture Week: 0
Manufacture Year: 2014
Physical size(cm): 128 x 72
EDID Version: 1.3
EDID block number: 0x1
blk0 chksum: 0x5a
Source Physical Address[a.b.c.d]: 3.0.0.0
YCC support 0x03, VIC (native 16):
ColorDeepSupport 0xb8 10/12/16/Y444 1/1/0/1
31 16 20 5 32 33 34 19 4 18 3 22 7
Audio {format, channel, freq, cce}
{1, 1, 0x07, 0x01}
Speaker Allocation: 0x00
Vendor: 0xc03
MaxTMDSClock1 190 MHz
ColorMetry: 0x1c
SCDC: 0
RR_Cap: 0
LTE_340M_Scramble: 0
  DeepColor
checkvalue: 0x5a8f0000

For now, I would make final statement this that way:

  • YUV444 is default, and some Displays could have trouble to automatically choose correct video range. Could be fixed by their settings.
  • RGB is automatically detected without problems
  • CoreELECs Kodi outputs Full. No idea if this will be changeable in future (as on Win/Linux). (L-F-L without scaling would be great although.)
  • There is something fishy between (/in) Kodi<->GPU<-> code, which doesnt allow Full range output for GPU. We can change hdmitx parameter, but it doesnt have actual influence on picture (just to some information send along to the TV/projector with signal I guess). This seems to be thing for Amlogic (I saw also similiar discussions @Vero forum etc.), and its not YUV/RGB specific.
  • Although video levels and colour specs arent best case, basic test seems to have quite nice outcome.

Correct me if I am wrong, or we can discuss this topic further. Regarding GPU output, I really dont know, where could be a catch and if someone could do something with that :slight_smile: