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




6 years ago
2 months ago


(Reporter: cpearce, Unassigned)


(Blocks: 1 bug)

Windows 7
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)



(2 attachments)



6 years ago
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.


6 years ago
Blocks: 847267

Comment 1

6 years ago
Created attachment 757743 [details]
bbb screenshot, Firefox 21

Screen shot of Firefox 21 playing big buck bunny trailer, t=12.6s.

This colour conversion matches the software decoder.

Comment 2

6 years ago
Created attachment 757745 [details]
bbb screenshot, Firefox 24 - colours washed out

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.

Comment 3

6 years ago
See also the discussion in bug 872375 where this bug was first reported in comments.

Comment 4

6 years ago
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.


6 years ago
Assignee: cpearce → nobody

Comment 5

6 years ago
According to this link:

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)".

Comment 6

6 years ago
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.

Comment 7

6 years ago
Seems to be doing it on my GTX 650 under Windows 8 too.

Comment 8

6 years ago
(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.


5 years ago
Duplicate of this bug: 925449

Comment 10

5 years ago
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)

Comment 11

5 years ago
Oh, it's been posted already. Sorry for the spam.
Blocks: 1494381
You need to log in before you can comment on or make changes to this bug.