Closed Bug 872375 Opened 6 years ago Closed 6 years ago

Visual artifacts on H.264 video with DXVA enabled

Categories

(Core :: Audio/Video, defect)

x86_64
Windows 8
defect
Not set

Tracking

()

RESOLVED FIXED
mozilla24
Tracking Status
firefox22 --- unaffected
firefox23 --- verified
firefox24 --- verified

People

(Reporter: cpearce, Assigned: cpearce)

References

Details

Attachments

(4 files)

STR:
1. Get a recent Windows nightly build.
2. Open http://ie.microsoft.com/testdrive/Graphics/VideoFormatSupport/big_buck_bunny_trailer_480p_baseline.mp4
3. Seek to 7s.
4. Note the blurring at the right hand side of the video.
5. Toggle pref "media.windows-media-foundation.use-dxva", reload video, seek to 7s, note no blurring.

Expected result: No blurring.
Are you using an AMD GPU? Perhaps demo mode is enabled in the video settings of Catalyst Control Manager?
This error occurs on my both PC and notebook.
On my PC (Nvidia GeForce GTS450) the colors are pale and there are a lot of artifacts, although Firefox don't use DXVA (VPU: 0%) (media.windows-media-foundation.use-dxva enabled)
On my notebook (with both Intel HD4000 and GeForce GTX660M) the video looks exactly like in the screenshot from Chris Pearce.
I took the screenshot on an laptop with Optimus, Firefox was using the Intel HD4000 GPU, which is why you (Marcin) are seeing the same thing on your laptop with Optimus.

Marcin: I'm particularly interested in your desktop machine, since the results are different to my machine, can you post the Graphics section of about:support from your desktop machine here please? Thanks!
Summary: Blurring at RHS of H.264 video frame with DXVA enabled → Visual artifacts on H.264 video with DXVA enabled
Of course, you're welcome:
Adapter Description	NVIDIA GeForce GTS 450
Adapter Drivers	nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter RAM	1024
Device ID	0x1245
Direct2D Enabled	true
DirectWrite Enabled	true (7.0.6002.18592)
Driver Date	2-29-2012
Driver Version	8.17.12.9610
GPU #2 Active	false
GPU Accelerated Windows	1/1 Direct3D 10
Vendor ID	0x10de
WebGL Renderer	Google Inc. -- ANGLE (NVIDIA GeForce GTS 450 Direct3D9Ex vs_3_0 ps_3_0)
AzureCanvasBackend	direct2d
AzureContentBackend	direct2d
AzureFallbackCanvasBackend	cairo
Attached patch Patch v1Splinter Review
The problem is that I was assuming that the size of the picture in the DXVA frame is the frame size, but it can actually be less than that. So pass in a rectangle that is the frame size to D3DSurfaceImage. This fixes the rendering artifacts.
Attachment #751562 - Flags: review?(paul)
Attachment #751562 - Flags: review?(paul) → review+
We'll need this fix on Aurora too. I'll request uplift after this fix has been on Nightly for a few days.

https://hg.mozilla.org/integration/mozilla-inbound/rev/2ba61101fe94
https://hg.mozilla.org/mozilla-central/rev/2ba61101fe94
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla24
Comment on attachment 751562 [details] [diff] [review]
Patch v1

[Approval Request Comment]
Bug caused by (feature/regressing bug #): GPU accelerated H.264 decoding on Windows, bug 847267
User impact if declined: Some H.264 videos will have visual artifacts on Windows.
Testing completed (on m-c, etc.): This as been on m-c for a week.
Risk to taking this patch (and alternatives if risky): Low.
String or IDL/UUID changes made by this patch: None.
Attachment #751562 - Flags: approval-mozilla-aurora?
On my laptop the bug is repaired: Video is decoded properly using DxVA on both Intel and Nvidia cards BUT I noticed that Nvidia is probably using incorrect color space for YCbCR -> RGB conversion (black color is gray). On Intel everything is OK.

On my PC this bug still occurs: there are a lot of artifacts and pale colors (no changes from previous unpatched version) AND Firefox isn't using DxVA.
Thanks for your continued feedback Marcin. 

I've found that GeForce cards YCbCr->RGB conversion can be off by 1 or 2 shades in each channel when using DXVA, but I wasn't aware that it was bad enough to be noticeable to the human eye.

It's hard to see how bad the colour-conversion is on your GeForce card from that screenshot, could you post a screenshot where it's more obvious?

And how are you determining that DXVA isn't being used on your desktop? DXVA should always be used whenever about:support's GFX section reports "GPU Accelerated Windows 1/1".
Attachment #751562 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
It is bad enough and it's especially visible when watching dark scenes because of black color which is unfortunately gray. It's possible for GeForce to use a proper YCbCr->RGB conversion but not on Optimus (Nvidia deleted video options from Nvidia Control Panel probably in 285.62 drivers).
I've made 2 video comparisons but I think the biggest difference is visible in my second attachment with almost black scene. It was really hard to make screenshots, because Firefox was constantly crashing after few seconds using Nvidia GPU (but I think it's something connected with Intel GPU, because Windows were reporting that Intel display driver has stopped working but has recovered). Strangely, the latest nightly is stable when using Intel GPU only.
Here are the links:
http://screenshotcomparison.com/comparison/25780 (look at the rabbit hole)
http://screenshotcomparison.com/comparison/25783 (look at the tree - shadow is too gray and colors are a little bit pale)

On my desktop I am using a sidebar gadget called GPU Observer which measures VPU Load. I tested it with many video players and it's working correctly (shows VPU Load). When I am watching any H264 video using Firefox on my desktop it shows VPU Load 0% so I am determining that DXVA isn't being used.
(In reply to Marcin Starzyk from comment #11)
> I've made 2 video comparisons but I think the biggest difference is visible
> in my second attachment with almost black scene. 

Thanks, for making those comparisons, the difference is quite obvious.

> It was really hard to make
> screenshots, because Firefox was constantly crashing after few seconds using
> Nvidia GPU 

That's quite serious, we don't want to be crashing! Can you post the links to crash reports in the bug here please? You find them if you enter about:crashes in the URL bar.



> On my desktop I am using a sidebar gadget called GPU Observer which measures
> VPU Load. I tested it with many video players and it's working correctly
> (shows VPU Load). When I am watching any H264 video using Firefox on my
> desktop it shows VPU Load 0% so I am determining that DXVA isn't being used.

If you toggle the pref "media.windows-media-foundation.use-dxva" to false in about:config we don't try to use DXVA. Can you try toggling that pref to false and check if you crash while playing video and whether the colour conversion is still broken? You need to reload the video (press F5) after toggling the pref for the change to take effect. Thanks!
Also, I'm thinking of getting a NVIDIA GeForce GTS 450 card to test this myself, but it looks like there are lots of variants by different vendors:

http://pricespy.co.nz/search.php?query=NVIDIA+GeForce+GTS+450#rparams=ss=GeForce%20GTS%20450

Do you know what make is your card? i.e. Galaxy GeForce GTS 450, Asus, Gigabyte, etc?
You're welcome!
It's weird because when Nightly is using Intel GPU only it's stable but when I run it with "High performance Nvidia GPU" it's crashing.

Here are some crashes (I tried to play the trailer, you've linked in the first post, as well as play Minesweeper on Microsoft Testdrive):
https://crash-stats.mozilla.com/report/index/bp-bdf2baaa-a5f2-4f45-86f2-5168d2130529
https://crash-stats.mozilla.com/report/index/bp-ef02a1f1-2678-4b82-b5cb-6262a2130529
https://crash-stats.mozilla.com/report/index/bp-3b28a71b-ca8b-4182-9668-04e512130529
https://crash-stats.mozilla.com/report/index/bp-45c95080-49ca-4e02-9d0a-895142130529

I have NVIDIA GeForce GTS450 manufactured by Palit, with 1024MB VRAM DDR3 and use drivers 296.10 (because any newer version is bugged on this card).
Without DxVA, crashes still occur when I use "High performance Nvidia GPU" on my laptop, here is a fresh crash:
https://crash-stats.mozilla.com/report/index/bp-9cf689e3-bdae-40ea-8a0d-fb2202130529

And Windows info about one crash of Firefox:
  Nazwa zdarzenia problemu:	APPCRASH
  Nazwa aplikacji:	firefox.exe
  Wersja aplikacji:	24.0.0.4896
  Sygnatura czasowa aplikacji:	51a4a975
  Nazwa modułu z błędem:	StackHash_dee7
  Wersja modułu z błędem:	6.1.7601.17725
  Sygnatura czasowa modułu z błędem:	4ec49b8f
  Kod wyjątku:	c0000374
  Przesunięcie wyjątku:	000ce6c3
  Wersja systemu operacyjnego:	6.1.7601.2.1.0.768.3
  Identyfikator ustawień regionalnych:	1045
  Dodatkowe informacje 1:	dee7
  Dodatkowe informacje 2:	dee783dcb2df3a474a9ae93d8937b6d6
  Dodatkowe informacje 3:	2797
  Dodatkowe informacje 4:	27974731bfd0cc1f41d69178f4726cb5

If you need translation of this, please tell me.
Moreover, Windows informed me again that the Intel desktop driver has stopped working.

BUT the color conversion is OK on Nvidia without DxVA.
Marcin: I filed bug 879099 to track the washed out colours problem on nvidia hardware. Thankfully (perhaps!) I can reproduce this bug on my desktop which has an nvidia graphics card. Thanks for pointing this out.

Re: the crashes you see when running Firefox under the nvidia gpu, we're still in the process of stabilizing our support on machines with Optimus, so in the meantime I recommend just running Firefox without specifying a graphics processor to use. You'll probably end up using the Intel GPU then.
Verified fixed with Firefox 23 beta 7, build ID: 20130718163513, graphics: NVIDIA GeForce GT 610.

The video seems to have the same colours, with the pref both set to "true" and "false".
QA Contact: manuela.muntean
Verified fixed with Firefox 24 beta 2, build ID: 20130812173056, graphics: NVIDIA GeForce GT 610.

The video seems to have the same colours, with the pref both set to "true" and "false".
(In reply to Chris Pearce (:cpearce) from comment #13)
> (In reply to Marcin Starzyk from comment #11)
> That's quite serious, we don't want to be crashing! Can you post the links
> to crash reports in the bug here please? You find them if you enter
> about:crashes in the URL bar.

I think it's very likely that the crashes have a totally different cause. For whatever reason the graphics driver is restarting, and when it does firefox crashes.
But apparently it's normal functioning: bug 866168
You need to log in before you can comment on or make changes to this bug.