You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit ef1ba32
Browse filesBrowse the repository at this point in the historyBrowse files
feat: decode VP9 on the GPU with Media Foundation on Windows (#319)
HardwareVideoDecoderFactory now decodes VP9 profile 0 on Windows, through
the VP9 decoder Media Foundation has on Direct3D 11, the way it does H.264
and AV1. The factory offers VP9 where the GPU has the DXVA decoder profile
(D3D11_DECODER_PROFILE_VP9_VLD_PROFILE0, with NV12 output) and Windows has
a VP9 decoder that uses Direct3D 11: the VP9 Video Extensions of the
Microsoft Store. Without either, VP9 stays with libvpx, and negotiation
does not change.
MFVideoDecoder takes VP9 as a third codec. Two things are particular to it:
- A frame with spatial layers goes to libvpx. Its layers reach a decoder
back to back without a superframe index; VideoToolbox does not decode
that, and a Media Foundation decoder is not known to.
- A VP9 stream states its size in the key frames only, so the decoder may
have no output type to offer before it has seen one. That is no longer a
failure to configure; the output type is set when the transform asks for
it, as it is for a change of size.
The VP9 tests of the decoder test class run on Windows too, not on macOS
only. A VP9 decoder is required with -Dwebrtc.test.hardwareVp9Decoder=true
on Windows, as an AV1 decoder is with its own property; on macOS the
existing property applies.
On an AMD Radeon RX 9070 XT with the VP9 Video Extensions, the decoder
tests pass with the hardware decoders required, VP9 decoded by
MediaFoundation (VP9VideoExtensionDecoder).
| Windows | H.264and AV1, on GPUs that decode them, through the Media Foundation decoders of Windows on Direct3D 11 (DXVA) |
54
+
| Windows | H.264, AV1 and VP9 (profile 0), on GPUs that decode them, through the Media Foundation decoders of Windows on Direct3D 11 (DXVA) |
55
55
| Linux | Not yet; decoding is in software |
56
56
| macOS | H.264 through VideoToolbox, as with `DefaultVideoDecoderFactory`, and VP9 (profile 0) through VideoToolbox's VP9 decoder, on Macs that have one |
57
57
58
-
AV1 on Windows needs the *AV1 Video Extension*, which Windows 11 includes. Decoded frames are copied from GPU memory back to system memory, where WebRTC's frames are, so hardware decoding pays off mostly at high resolutions and with many streams; at low resolutions WebRTC's software decoders are about as cheap. A hardware decoder that fails, or turns out to decode in software, is replaced by the software decoder, which starts with the next key frame.
58
+
AV1 on Windows needs the *AV1 Video Extension*, which Windows 11 includes, and VP9 the *VP9 Video Extensions*, a free component of the Microsoft Store that a system may not have; without it, VP9 is decoded in software. Streams with spatial layers (SVC) are decoded in software too, since their layers reach a decoder without the index that says where each ends. Decoded frames are copied from GPU memory back to system memory, where WebRTC's frames are, so hardware decoding pays off mostly at high resolutions and with many streams; at low resolutions WebRTC's software decoders are about as cheap. A hardware decoder that fails, or turns out to decode in software, is replaced by the software decoder, which starts with the next key frame.
59
59
60
60
On macOS, VP9 decoding in hardware saves CPU: in a measurement on an Apple M2 it took a fraction of the processor time libvpx needs, but multi-threaded libvpx was about as fast on the clock. VideoToolbox decodes VP9 in hardware only where the Mac has a decoder for it, which Apple silicon does; a Mac without one decodes VP9 with libvpx as before. Profile 2 (10 bit), sizes below 64x64 or above 4096x4096, and streams with spatial layers (SVC) are decoded with libvpx too.
0 commit comments