Kodi Community Forum

Full Version: Black Crush (low brightness) Workaround for XBMC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Greets everyone,
First, let me give you the specific scenario I was experiencing so you can determine whether this is something impacting you or not. I have an ION platform (zotac) running an updated (r22278) XBMC Live install to HDD and the latest NVIDIA drivers through HDMI. I've searched at-length to try to find out why I was experiencing so much black crush, and it appears that my platform is using the expanded colorspace for PC outputs instead of TV. To make matters worse, the brightness/contrast settings of XBMC don't appear to work anymore except for VDPAU material, and a significant portion of my movies are standard DVD rips which are not VDPAU accelerated. There is a ticket open to allow selection of PC/TV colorspace, but since a permanent fix hasn't arrived yet I thought I'd do a quick write-up about my temporary fix. I have to warn you, XBMC Live is my first dip into Linux so I apologize if this is already well-known or dumb in any way. Now, onto the good stuff!

********************
1) Use another device such as a DVD player to get your TV settings calibrated to a known good source. We'll use those calibration settings to know the correct black level of your TV and try to get XBMC to match as closely as possible. You shouldn't touch your TV's brightness controls from here on.

2) Boot into a standard XBMC session, *not* safe mode

3) hit ctrl + alt + F2 to bring up a command line session, and login as your user account (alternatively, use SSH to login while keeping your XBMC session active if you have easy access to check your TV from your PC)

4) type "export DISPLAY=:0.0" <-- this links this session with your display to allow changes to be made

5) type "xgamma -gamma x.x" where x.x is a number from 0.0 to 10.0 (1 is the default, and small changes here have a big impact. Numbers higher than 1 increase the brightness level. For reference, I found that 1.4 is excellent for my TV. You can actually take this as granular as x.xxx if you desire, but I didn't feel the need to get that detailed)

6) hit ctrl + alt + F1 to go back to your XBMC session, and check the effect of your changes. This will effect EVERYTHING in XBMC, so if you've made any brightness changes in VDPAU it's best to set them back to defaults if you're going to use HD media to test.

7) cycle with ctrl + alt + F2 or F1 back and forth between these sessions, making small tweaks to the <x.x> numbers until you find a brightness setting you're happy with

8) edit /etc/X11/xorg.conf using whatever means you're comfortable with (I typically sftp as root to alter this file) and add these gamma settings under the "Monitor" section as "gamma x.x x.x x.x" <-- you need to put the number in three times because it sets your gamma individually for Red Green Blue. Here's mine for reference:

Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Unknown"
HorizSync 28.0 - 33.0
VertRefresh 43.0 - 72.0
Option "DPMS"
gamma 1.4 1.4 1.4

9) Save xorg.conf and reboot, and your changes should have remained

******************

I know this is a quick and dirty write-up, but I wanted to get this out to my fellow XBMCers since I searched ad nauseum and couldn't find a workaround like this. For reference, here is the website that helped me get the ball rolling:

http://www.novell.com/support/search.do?...DT_TID_1_1

I hope this helps,

DJ A1ien
That looks good. Thanks for posting what you found. I wasn't aware of that command and probably most aren't either.

Additionally you can connect to the system using SSH and remotely make the changes in the same way. The benefit of doing this is that the XBMC Screen can stay on the TV while you make changes so you don't have to switch back and forth.
Maxim Wrote:That looks good. Thanks for posting what you found. I wasn't aware of that command and probably most aren't either.

Additionally you can connect to the system using SSH and remotely make the changes in the same way. The benefit of doing this is that the XBMC Screen can stay on the TV while you make changes so you don't have to switch back and forth.

Wow, I spent so much time trying SSH with my failed attempts at using nvidia-settings that I completely forgot to try it with xgamma. That definately saves a lot of time. I updated the instructions to reflect this option.
Looking forward to try this workaround. What I like about VDPAU brightness control is that it doesn't introduce any color banding whatsoever, which is the usual case if you change brightness/gamma/contrast within drivers.

And btw there were brightness/contrast controls added before few days to svn for Advanced/Basic Shaders renderers and it definitely works in Windows, should work in Linux too, but there is no new working PPA with it, so I can't confirm if it's really working on Linux yet.

Good thing about your workaround is that it should fix black crash even in xbmc itself not just videos, am I right?
ezechiel1917 Wrote:Looking forward to try this workaround. What I like about VDPAU brightness control is that it doesn't introduce any color banding whatsoever, which is the usual case if you change brightness/gamma/contrast within drivers.

And btw there were brightness/contrast controls added before few days to svn for Advanced/Basic Shaders renderers and it definitely works in Windows, should work in Linux too, but there is no new working PPA with it, so I can't confirm if it's really working on Linux yet.

Good thing about your workaround is that it should fix black crash even in xbmc itself not just videos, am I right?

That's correct, this impacts the entire screen gamma and is not specific to videos. Of course there would be a fix that's *just* become available in SVN after I finally figured this out! I'm excited to try the next PPA and hopefully have a better solution. This still doesn't necessarily fix the issue with XBMC passing blacker than black, which would require a change of the colorspace I believe (with brightness raised some black appears dark blue).
dja1ien Wrote:Of course there would be a fix that's *just* become available in SVN after I finally figured this out!
Don't feel bad, this has happened to me NUMEROUS times while working with Free and Open Source Software, the community and the software is always evolving, regardless thank for your own contribution to the community.
Tried this out but when i raise the gamma the movies gets very noisy in the dark areas.
Someone more with this problem?

I'll stick with the 55 Brightness.
Thanks for posting this, I thought that videos appearing darker was just in my imagination. Increasing the gamma definitely makes them look a lot better.

For those of us who don't know (i.e. me), how is it that the colorspace is set "wrongly" on the ion box? Is it a hardware, driver or XBMC thing?
Am no mathematician, so if someone wants to figure out a custom studio level CSC matrix, then i'll happily implement it as an option.

http://http.download.nvidia.com/XFree86/...e5f0f40de6
http://en.wikipedia.org/wiki/YCbCr


motd
screamer Wrote:Tried this out but when i raise the gamma the movies gets very noisy in the dark areas.
Someone more with this problem?

I'll stick with the 55 Brightness.

QFT, 1.40 is way too high, it introduced lot of color banding and very noisy/blocky picture overall. Value around 1.20 was somewhat better but it had some shadow detail lost.

VDPAU Brightness implementation is on the other hand without any flaws, but still isn't 100% equivalent to TV levels color space.
motd2k is on the right way, finding a matrix for optional TV levels is best what could be achieved (until nvidia get some overall fix for it in linux drivers)
Unfortunately I have no idea how this works, but hopefully someone will.
Yes, as mentioned this is really only a workaround for me since I have a lot of SD material which is not VDPAU accelerated, and thus (in my svn revision at least) the embedded XBMC brightness controls don't adjust the picture at all. adjusting the gamma in this way doesn't really address the issue of BTB being passed and could cause banding, etc, but it at least makes dark movies like Batman watchable for the timebeing. For me, having the shadow detail is most important.

There's tracs open for brightness settings not working on non-VDPAU material:
http://trac.xbmc.org/ticket/6791

and creating selectable color range (PC/TV):
http://trac.xbmc.org/ticket/5019

I'm sure this workaround isn't for everyone but I wanted to give people the chance to try it, especially if they might not realize the shadow detail they've been missing.

motd2k Wrote:Am no mathematician, so if someone wants to figure out a custom studio level CSC matrix, then i'll happily implement it as an option.
motd

Motd2k,
Can you check Elupus's reply to the color range trac? There are some notes in there that are above my head about adjustments to the RGB shader; I'm not sure if that would be helpful to you in moving forward with this. Specifically:

******

The renderers always output in 0-255.. But they accept input in both ranges. I'm not sure what it is you are trying to accomplish.


Do you want to render in the limited range to allow the output device to still get WTW and BTW values? To do that you'd only need to fixup:


shaderf +=
"rgb = yuvmat * yuv;\n"
"rgb.a = 1.0;\n"
"gl_FragColor = rgb;\n"
"}";
in YUV2RGBProgressiveShader::YUV2RGBProgressiveShader


And recalculate the rgb variable in a similar (but opposite) way that the yuv input value is corrected above. The input side should still be the same way it is now.

*************

EDIT: I'm not sure if this proposal would only impact video itself and not have have the GPU using the limited range for everything. The custom CSC matrix would certainly be better if so. Whew, my brain is full.
not sure if this could help, but there are some RGB - YCbCr equations for SDTV/HDTV 16-235 ranges

http://compression.ru/download/articles/...e/ch03.pdf
ezechiel1917 Wrote:not sure if this could help, but there are some RGB - YCbCr equations for SDTV/HDTV 16-235 ranges

http://compression.ru/download/articles/...e/ch03.pdf

Great find! The equations on pg 18. certainly appear to allow conversion between the two color spaces.
motd2k Wrote:Am no mathematician, so if someone wants to figure out a custom studio level CSC matrix, then i'll happily implement it as an option.

http://http.download.nvidia.com/XFree86/...e5f0f40de6
http://en.wikipedia.org/wiki/YCbCr


motd

Is this matrix specific to VDPAU? If so, I assume this wouldn't carry over to the software renderers. mpeg-2 video like DVDs is not accelerated, right?
get latest svn (abit risky it's in a big flux at the moment) or check svn log for my changes to renderer. non vdpau stuff have working brightness/contrast now.
Pages: 1 2 3 4