Open Bug 879099 Opened 8 years ago Updated 3 years ago

YUV->RGB conversion using D3D9Ex on some Nvidia hardware produces washed out colours

Categories

(Core :: Graphics: Layers, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

People

(Reporter: cpearce, Unassigned)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

When we're decoding video using DXVA2 we use D3D9Ex to convert decoded frames from NV12 to RGB. We have to copy the video frame because the surface we get out of DXVA isn't sharable, and we convert when we copy.

Unfortunately, some nvidia hardware doesn't do this colour conversion properly.

I've observed this on my desktop with a NVIDIA GeForce GTS 240 (latest driver, version 314.22), and Marcin (CC'd) has observed this on his desktop with GTS 450, and also on his laptop with Optimus when running Firefox using the nvidia GTX660M).

I'll attach screenshots.
Screen shot of Firefox 21 playing big buck bunny trailer, t=12.6s.

This colour conversion matches the software decoder.
Screen shot of Firefox 24 playing big buck bunny trailer, t=12.6s.

This colour conversion *does not* match the software decoder, the colours appear washed out.
See also the discussion in bug 872375 where this bug was first reported in comments.
Not sure how we can fix this, other than writing our own shader to do NV12 to RGB conversion? That's currently outside of my area of expertise.
Assignee: cpearce → nobody
According to this link:
https://forums.geforce.com/default/topic/369364/geforce-drivers/color-correction-on-videos-brightness-contrast-color-accuracy/post/2647259/#2647259

this behaviour is a feature, not a bug. Apparently Microsoft specified somewhere that YUV -> RGB conversion should be in TV-scale colour levels, where the Y is in the range [16,235], UV [16,240]. Nvidia and apparently ATI followed this specification, whereas presumably Intel didn't with their drivers.

Moral of the story, if we use the D3D supplied yuv->rgb conversion, we'll get this problem on Nvidia and ATI cards.

Recent versions of the nvidia drivers provides a way to set video colour to PC-scale rather than PC scale, fixing the problem. In nvidia control panel > video > adjust colour settings, set "how do you make color adjustements" to "With NVIDIA settings", and on the "Advanced" tab set "Dynamic range" to "Full (0,255)".
Congratulations for Microsoft... Unfortunately on newer Optimus drivers there isn't video tab in Nvidia Control Panel.
A little correction: I observed washed out colors on my laptop with Nvidia GeForce GTX 660M. On my PC with Geforce GTS 450 there are practically no colors and artifacts occur on the whole video, not only at the right side.
Seems to be doing it on my GTX 650 under Windows 8 too.
(In reply to Marcin Starzyk from comment #6)
> On my PC with Geforce GTS 450 there are practically no
> colors and artifacts occur on the whole video, not only at the right side.

This sounds like a different bug, does this still happen in Nightly builds? If so, can you file a new bug, CC me, and attach screen shots please? Thanks! It's important that we get these issues fixed.
Duplicate of this bug: 925449
This a workaround works for Firefox's HTML5 player too: https://wiki.videolan.org/VSG:Video:Color_nVidia

(As does disabling media.windows-media-foundation.use-dxva and thus HW acceleration)
Oh, it's been posted already. Sorry for the spam.
You need to log in before you can comment on or make changes to this bug.