Page 1 of 1

YUV->RGB conversion with direct3d11 presenter

Posted: 14 Aug 2018 09:52
by Voodoo84
Hello all,

Image: http://i.imgur.com/yNIATdl.png

When I select full or limited color range for video in Nvidia control panel, it only affects EVR presenter (a.k.a. "direct3d9" vout module in VLC).

But it has no effect when "direct3d11" vout is active in VLC. "direct3d11" always uses full color range (it's easily distinguishable on my monitor, limited range is all washed out). While full range is pretty on the PC, I want to use BT.709 limited range (16-235) on my HDTV to avoid unnecessary color scaling and "black crush" effect (and the TV doesn't support full range anyway).

Can anyone explain how does "direct3d11" vout actually perform YUV conversion (if it does at all?), is it related to some other output setting, and how can I make it to keep BT.709 limited range instead of upscaling to 0-255?

VLC version is the latest 3.0.3 64-bit from the download page.

Re: YUV->RGB conversion with direct3d11 presenter

Posted: 14 Aug 2018 11:10
by unidan
Hi,

In modules/video_output/win32/d3d11_shaders.c line 508 there is a comment saying:

Code: Select all

range_adjust--; /* the YUV->RGB conversion already output full range */
However it seems that right after it should be doing range conversion as expected. If it doesnt work for you you might need to fill a bug. It even seems that other users can have it the other way: https://trac.videolan.org/vlc/ticket/20288

Re: YUV->RGB conversion with direct3d11 presenter

Posted: 14 Aug 2018 11:40
by Voodoo84
Thank you for pointing that out. The mention ticked is probably driver issue.

I see in the code that there are two different flags ("src_full_range" for input video and "display->colorspace->b_full_range" for output display). Nvidia driver also offers the choice of pixel format for HDMI output (full or limited RGB), so I might want to check that too.

I'm maybe interpreting the code wrong, but it seems that direct3d11 vout always does YUV->RGB conversion as limited to full, and then back to limited in case of limited range display. This is not good, and single-precision floating point math also doesn't help.

My message log shows:

direct3d11 debug: Using pixel format VA_NV12 for chroma DX11

so I hope the YUV conversion actually doesn't happen, or I shall stick to direct3d9 for intact video playback.

Re: YUV->RGB conversion with direct3d11 presenter

Posted: 14 Aug 2018 15:18
by robUx4
What OS version are you using ? Normally we ask the OS what the display can support and try to adapt to the source as much as possible. That's D3D11SetColorSpace() in the code. But if your OS is too old (no IDXGISwapChain3) it won't be used and we use the default for the old OS values (RGB full range).

Re: YUV->RGB conversion with direct3d11 presenter

Posted: 14 Aug 2018 18:56
by Voodoo84
OS is 64-bit Windows 8.1 (fully up to date), and the graphics card is GeForce GTX 1050-Ti.

Here are the logs when display is set to full RBG and limited RGB (over HDMI in both cases):
https://www.dropbox.com/s/7s7n6uy0k85z4 ... 1_logs.zip

But I don't see any significant initialization difference except direct3d11 context (0x0000000008e31310 vs 0x00000000089620b0)