Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Hardware & Software > Software players

Reply
 
Thread Tools Search this Thread Display Modes
Old 23rd December 2008, 17:38   #1  |  Link
clsid
Registered User
 
Join Date: Feb 2005
Posts: 4,669
FAQ: How to correct luminance levels

Wrong levels is a common playback problem. It is a subject that gets discussed over and over again. The purpose of this topic is to centralize the collective knowledge of the Doom9 community regarding this subject. Everyone please share you knowledge. I'll update the information below to include your wisdom.


What are luminance levels?

Digital video is typically encoded in a YUV format. YUV is a family of color spaces (YV12, YUY2, etc), that encode color information (chroma) separately from brightness information (luma).

There are two standards for the encoding of luma. For standard-definition TV the standard is BT.601. For high-definition TV the standard is BT.709.

Luma values fall in a range. Unfortunately this range is not always the same. There are two commonly used ranges: 0-255 (aka PC levels) and 16-235 (aka TV levels).

When converting a YUV colorspace to RGB, the correct standard (BT.601 or BT.709) must be used and the correct range (TV or PC levels) must be used.

The above is not always done correctly. It can go wrong with certain combinations of video renderers, video resolutions, and graphics driver settings.

How can I see if the level is wrong?

The video looks washed out and the colors are not vivid. Black is displayed as dark gray. White is displayed as light gray.

The opposite is also possible, but more rare. In that case dark colors are displayed too dark, and light colors are displayed too bright.

Which combinations give wrong levels?

Many factors play a role, so it is not possible to give a list of combinations that always gives wrong levels for everyone. In general, just trust your eyes.

Levels are usually wrong when using the VMR-9 or EVR CP renderers. For most people only when playing low resolution videos.

How can I correct the levels?

The methods below assume that you are outputting the video to a PC monitor or LCD TV, meaning a device that needs full range luminance (0-255). If you are using a CRT TV, then read the comments at methods 2 and 3.

Method #1: Adjusting graphics driver settings

NVIDIA

Since version 177.84, the NVIDIA drivers have an option for configuring the luma range.

You can find the option here:
NVIDIA Control Panel -> Video & Television -> Adjust video color settings -> Select "With the NVIDIA settings" -> Advanced tab -> Set Dynamic Range to "Full (0-255)".

screenshot

ATI

The ATI driver requires a Registry tweak. With the tweak applied, the driver will convert TV levels to PC levels for SD resolution video. It already does that by default for HD video.

Several ATI driver tweaks can be found here:
http://www.avsforum.com/avs-vb/showp...postcount=2011
Te UseBT601CSC setting is the one related to luminance levels.

Note: the tweak only works with driver version 9.1 and older. ATI removed it in 9.2 and newer.

Method #2: Convert to RGB32 with ffdshow

Forcing ffdshow to output RGB32 can help prevent luminance level issues. Downside of this method is that doing this conversion in software increases CPU usage.

To force RGB32 output in ffdshow, you should uncheck all colorspaces except RGB32 on the Output page in ffdshow configuration. It is also recommended to enable "High quality YV12 to RGB conversion".
There are additional options on the RGB conversion page. Recent versions of ffdshow will automatically use the correct settings, so you don't need to worry about them.

If you are outputting to a CRT TV or projector (or any other device that expects TV levels as input), then you need to adjust the setting under Output levels on the RGB conversion page. It is configured by default to output to a computer monitor. LCD TVs usually expect PC levels, just like a computer monitor. Some TVs have an option to choose between Full and Reduced range.

Tip: the Profiles/Presets feature in ffdshow can be used to create different sets of settings. You can even auto-load profiles based on conditions like resolution of video format. You could for example create a profile specifically for HD resolution video, and use the 'standard' profile for low resolution videos.

Method #3: Levels filter in ffdshow video decoder

ffdshow has a special filter for adjusting (luminance) levels. To correct wrong luminance levels for a PC monitor or LCD TV you usually need to convert to PC levels. To correct wrong levels for a CRT TV, you usually need to convert to TV levels.

To convert from TV levels to PC levels use 16-235 as input range and 0-255 as output range. To convert from PC levels to TV levels use 0-255 as input range and 16-235 as output range.

Method #4: Pixelshader in Media Player Classic

A pixelshader is a small program that runs on your graphics card and processes some graphic data. In this case each frame of your video.

Media Player Classic has a special pixelshader called "16-235 -> 0-255" for converting TV levels to PC levels. This shader only adjusts luma values.

There also is a shader called "BT.601 -> BT.709". That one adjusts chroma values.

Some requirements for the pixelshaders in MPC:
- You need to use a compatible video renderer: VMR-7 (renderless), VMR-9 (renderless), or EVR Custom Presenter.
- Surface setting must be set to "3D surfaces".
- It requires some DirectX components that are not included with a default Windows installation. Run the DirectX Web Installer to get the required DirectX updates.

Method #5: Use AviSynth script in ffdshow video decoder

Adjusting levels or conversion to RGB32 can also be done though an AviSynth script in ffdshow. This is for advanced users. Seach the AviSynth subforum if you want to learn more about writing AviSynth scripts.

Method #6: Monitor settings

Some monitors can be calibrated to assume a certain luminance level as input.

Method #7: Resize in software

If wrong levels occur only with SD video resolutions and not with high resolutions, then another solution would be to resize the video in software. For example ffdshow can be used for resizing the video.

Test files

Here are some nice test clips to test your setup:
Test clips
(thanks to littleD for making them)

Some more advanced test clips can be found here:
http://www.avsforum.com/avs-vb/showthread.php?t=948496
(get the MP4 ones)

Last edited by clsid; 6th July 2009 at 18:39.
clsid is offline   Reply With Quote
Old 24th December 2008, 00:06   #2  |  Link
kutjong
Registered User
 
kutjong's Avatar
 
Join Date: Nov 2007
Location: Helsinki, Finland
Posts: 112
You can't use MPC shaders with Haali Renderer, and you won't even need that for levels conversion since both colorspace and luma range settings are available in the renderer's properties.
HR also has auto setting for colorspace in which it assumes BT.601 for everything w<1280 & h<720 and BT.709 for the opposite.
kutjong is offline   Reply With Quote
Old 24th December 2008, 11:08   #3  |  Link
Anima123
Registered User
 
Join Date: Jun 2005
Posts: 401
Haali's renderer is also based on shaders, thus it will need the corresponding DirectX components to make it work right. I'd like to know how to get those components added with Windows Server 2008 64 bit.
Anima123 is offline   Reply With Quote
Old 24th December 2008, 14:11   #4  |  Link
clsid
Registered User
 
Join Date: Feb 2005
Posts: 4,669
Run the DirectX web installer.
clsid is offline   Reply With Quote
Old 24th December 2008, 19:28   #5  |  Link
Kado
Otaku
 
Kado's Avatar
 
Join Date: Sep 2006
Location: Portugal
Posts: 575
@kutjong
Not everybody (like me) uses Haali renderer. I use EVR CP because I prefer to use DXVA on supported videos, also seems like that with Haali renderer the subtitles resolution is limited to 1024x768 using MPC-HC. Nvidia has provided a way on the nvidia control panel to change the luma range so you don't have to use the shaders. Also that other shader for YV12 blockiness is not needed (at least for me) if I provide YV12 color space to the GPU.

This is a nice tutorial to elucidate the more novice people, thanks clsid.

And Merry Xmas everyone!
__________________
In the school, the three guys met. Their relation had been changed in the season, and turned into three love stories.
Kado is offline   Reply With Quote
Old 24th December 2008, 20:03   #6  |  Link
clsid
Registered User
 
Join Date: Feb 2005
Posts: 4,669
The tutorial is still a work in progress.

Kado, could you (or somebody else) with a NVIDIA card post some more details about that option? The name of the option, its location in the control panel, etc. Also which driver versions have that option (I remember reading that it was recently added). Then I will add that info to the tutorial.

With ATI cards and EVR CP, the levels are only wrong for SD video. So I am planning to add a second version of the levels shader to MPC, one that only processes SD video. Does anyone know what parameters the ATI driver uses to determine whether video is HD or not? Is it simply "height >= 720", or does it also check the width?
clsid is offline   Reply With Quote
Old 24th December 2008, 22:13   #7  |  Link
clsid
Registered User
 
Join Date: Feb 2005
Posts: 4,669
Quote:
Originally Posted by dukey View Post
it's just vrm7 and 9 that **** it up. Don't use those and problem solved.
Not true. EVR CP has problems as well.

It sometimes is not possible to use other renderers. For example DXVA requires using VMR/EVR renderers.

Last edited by Guest; 7th January 2009 at 15:42.
clsid is offline   Reply With Quote
Old 24th December 2008, 22:22   #8  |  Link
Mangix
Audiophile
 
Join Date: Oct 2006
Posts: 353
Quote:
Originally Posted by clsid View Post
Kado, could you (or somebody else) with a NVIDIA card post some more details about that option? The name of the option, its location in the control panel, etc. Also which driver versions have that option (I remember reading that it was recently added). Then I will add that info to the tutorial.
http://img254.imageshack.us/img254/5002/sshot1pr2.jpg

screenshot should explain itself. the option has an effect over VMR9 and EVR to my knowledge. haven't tested it with VMR7 or Overlay(colors are always wrong with overlay on my system).

also, i believe driver version 177.84 introduced this option. the version in the screenshot is 180.84.
Mangix is offline   Reply With Quote
Old 26th December 2008, 12:56   #9  |  Link
ACrowley
Registered User
 
Join Date: Apr 2006
Posts: 1,008
You can fix the TV-PC Levels on a ATI Card (Avivo capable GPUs=Radeon 2xxx,3xxx4xxx) constantly.

"The "UseBT601CSC"="1" driver expands SD levels, the same way as HD is expanded automatically by the drivers, giving you 0-255, aka PC levels."

Just use DXVAChecker. Goto Processor Device/Rightclick/Open Video Acceleration Settings /and enable "Use BT601"

Now you have always PC Levels

Or you can add the Registry Entry by yourslef in :
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Video\{F332569B-6A9D-4078-8CF4-7E76147F726B}\0001\UMD\DXVA

Just add
UseBT601CSC= 1

Last edited by ACrowley; 26th December 2008 at 13:02.
ACrowley is offline   Reply With Quote
Old 26th December 2008, 14:48   #10  |  Link
clsid
Registered User
 
Join Date: Feb 2005
Posts: 4,669
Doesn't the registry key differ on different computers?
clsid is offline   Reply With Quote
Old 26th December 2008, 16:59   #11  |  Link
cca
Anime Otaku
 
Join Date: Oct 2002
Location: Somewhere in Cyberspace...
Posts: 437
Quote:
Originally Posted by clsid View Post
Doesn't the registry key differ on different computers?
That is correct, a tool like DXVAchecker is a better option to change the registry setting than manually change the registry.
__________________
AMD FX8350 on Gigabyte GA-970A-D3 / 8192 MB DDR3-1600 SDRAM / AMD R9 285 with Catalyst 1.5.9.1/ Asus Xonar D2X / Windows 10 pro 64bit
cca is offline   Reply With Quote
Old 26th December 2008, 18:16   #12  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Just ran a quick test on vmr7/9/evr on windows xp + cat 8.12, only VMR7 windowed mode give me correct level without tweaking anything.
How about method 7, resize video? eg resize if video vertical resolution is smaller than 720 by using ffdshow.
Yong is offline   Reply With Quote
Old 26th December 2008, 20:40   #13  |  Link
clsid
Registered User
 
Join Date: Feb 2005
Posts: 4,669
Quote:
Originally Posted by Yong View Post
Just ran a quick test on vmr7/9/evr on windows xp + cat 8.12, only VMR7 windowed mode give me correct level without tweaking anything.
How about method 7, resize video? eg resize if video vertical resolution is smaller than 720 by using ffdshow.
Are the levels wrong for both SD and HD video?
clsid is offline   Reply With Quote
Old 27th December 2008, 11:20   #14  |  Link
littleD
Registered User
 
littleD's Avatar
 
Join Date: Aug 2008
Posts: 245
There is nothing advanced in Method #5: Use AviSynth script in ffdshow video decoder.
Just paste ConvertToRGB32(matrix="rec601") for SD or ConvertToRGB32(matrix="rec709") for HD in ffdshow's avisynth configuration. For switching between them, best option is to save all presets in one directory (thouse will be avs scripts).
Of course, avisyth must be installed.
littleD is offline   Reply With Quote
Old 27th December 2008, 16:07   #15  |  Link
Yong
Registered User
 
Join Date: Jun 2004
Posts: 577
Quote:
Originally Posted by clsid View Post
Are the levels wrong for both SD and HD video?
Nope, only SD, the renderers will show correct level as long as the output video width is bigger than 720.

Btw i think using DXVAchecker to enable "UseBT601CSC" really works for me, but user might have to re-enable it again if re/install newer version of catalyst.
Yong is offline   Reply With Quote
Old 27th December 2008, 16:58   #16  |  Link
cca
Anime Otaku
 
Join Date: Oct 2002
Location: Somewhere in Cyberspace...
Posts: 437
Quote:
Originally Posted by Yong View Post
Nope, only SD, the renderers will show correct level as long as the output video width is bigger than 720.

Btw i think using DXVAchecker to enable "UseBT601CSC" really works for me, but user might have to re-enable it again if re/install newer version of catalyst.
Regarding this, I enabled it one time and never again needed to re-enable it, but it may be different in other Windows version.
__________________
AMD FX8350 on Gigabyte GA-970A-D3 / 8192 MB DDR3-1600 SDRAM / AMD R9 285 with Catalyst 1.5.9.1/ Asus Xonar D2X / Windows 10 pro 64bit
cca is offline   Reply With Quote
Old 31st December 2008, 15:30   #17  |  Link
littleD
Registered User
 
littleD's Avatar
 
Join Date: Aug 2008
Posts: 245
I converted test videos from http://www.geocities.com/anothrosko/vtc.html to TV levels in both HD and SD resolution, so anyone can set correct config based on them. I hope you will enjoy it
Please confirm if they really have correct levels.
Attached Files
File Type: zip TV_LEVELS_TEST_CLIPS.zip (87.6 KB, 2783 views)
littleD is offline   Reply With Quote
Old 4th January 2009, 16:41   #18  |  Link
cbemoore
Registered User
 
Join Date: Aug 2007
Posts: 19
Quote:
Originally Posted by littleD View Post
I converted test videos from http://www.geocities.com/anothrosko/vtc.html to TV levels in both HD and SD resolution, so anyone can set correct config based on them. I hope you will enjoy it
Please confirm if they really have correct levels.
Now I'm really confused!

Using the original videos in the link you provided, my black levels are too dark (everything below 26 is BTB) and my white levels are perfect (everything above 235 is WTW).

But using your converted test videos, my black levels are pretty close (everything below 12 is BTB) and my white levels are too dark (I can see everything up to 255, so I have no WTW). I get identical results with both your HD and SD versions.

So which of the test patterns are correct? And how should I calibrate my screen?
cbemoore is offline   Reply With Quote
Old 4th January 2009, 21:28   #19  |  Link
littleD
Registered User
 
littleD's Avatar
 
Join Date: Aug 2008
Posts: 245
Please read again hints at clip videos on that site. They apply to my converted videos. The author just picked wrong level range - PC, i used common - TV.
In Ideal case u should see all bars on clips, except the maximum and minimum. If u cant see bars above 235 on white or hardly see any black bars, then u should change config.
And do not bother clips from site. Use my clips as reference.
littleD is offline   Reply With Quote
Old 4th January 2009, 21:35   #20  |  Link
littleD
Registered User
 
littleD's Avatar
 
Join Date: Aug 2008
Posts: 245
For calibrating the screen use gamma correction.
Gamma for crt is about 2.2 - 2.5

Last edited by littleD; 4th January 2009 at 21:44.
littleD is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:12.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2017, vBulletin Solutions Inc.