What is hardware acceleration?

ZephyrXT 发布于 阅读:41

What is hardware acceleration?
Normally your processor (CPU) does all the work when decoding video. When using hardware acceleration, most of that work is moved to the graphics processor (GPU). This significantly reduces the usage of CPU resources, which can be particularly useful if you have a relatively slow CPU. Graphics chips have dedicated circuitry for decoding video and thus can do it very efficiently.
When should I use hardware acceleration?
Our recommendation is to use it only when really needed. That means use it only if you have a slow computer that gives very high CPU usage when playing videos.
Hardware acceleration only helps to reduce CPU usage. It does not give better video quality.
Usage of hardware acceleration increases the chance of playback problems. Usually caused by graphics driver bugs. So if you decide to use hardware acceleration, it is important to use up-to-date drivers.
What is the difference between CUVID, QuickSync, and DXVA?
DXVA is a generic interface for hardware acceleration that was created by Microsoft. It works with all brands of graphics cards.
CUVID is an interface created by NVIDIA and it only works with graphics cards from NVIDIA.
QuickSync is an interface created by Intel and is supported only by the integrated GPUs of Intel Sandy Bridge and Ivy Bridge processors. A monitor needs to be connected to the GPU in order to use QuickSync functionality.
The advantage of CUVID and QuickSync is that the decoded video is copied back from GPU memory to CPU memory. This allows the video to be processed further after it has been decoded. They basically act the same as a normal software decoder.
Most DXVA implementations keep the decoded video in GPU memory until it has been displayed. No additional processing can be done on the video. This is explained in more detail below.
DXVA "native" versus DXVA "copy-back"
DXVA implementations come in two variants: native and copy-back. Almost all implementations are of the native type. The LAV video decoder that is included in the pack offers both variants. The internal DXVA decoders in MPC-HC are native implementations, and ffdshow also offers a native implementation.
With the native type, the decoded video stays in GPU memory until it has been displayed. This brings some limitations with regard to playback. The DXVA decoder must be connected directly to the video renderer. There can be no processing filters in between. The video renderer must also support DXVA, which gives you a bit less freedom wth regard to the choice of renderers.
The reason for keeping the decoded video inside GPU memory is efficiency. Many (older) graphics chips haven't been optimized for copying data from GPU memory back to CPU memory. They can only copy data fast in the other direction. These chips are too slow to perform DXVA copy-back and will not give smooth playback when using it. This is the case for most older AMD/ATI and Intel chips.
DXVA implementations of the copy-back type will, as the name already suggests, copy the decoded video from GPU memory back to CPU memory. Such implementations don't have the limitations mentioned above and act similar to a normal software decoder.
DXVA copy-back only works properly if the GPU can copy the data fast enough. Otherwise it will give stuttering video playback. GPUs that should be fast enough are:
NVIDIA: all models from the past few years
Intel: Intel HD Graphics 2000 and newer
AMD/ATI: Radeon HD 6xxx and newer
Copying the data results in a bit of CPU usage. This means that copy-back is a little less efficient than native.
DXVA1 versus DXVA2
DXVA1 is used on Windows XP. DXVA2 is used on Vista and newer. Any other differences between the two versions are not important to know about.
The DXVA implementations in LAV Video decoder support DXVA2 only. The implementations in MPC-HC and ffdshow support both DXVA1 and DXVA2.
How to get subtitles with DXVA?
NVIDIA CUVID, Intel QuickSync, and DXVA copy-back all have no special requirements with regards to subtitles. They act similar to normal software decoders.
Native implementations of DXVA have the limitation that they need to be connected directly to the video renderer. This means that it is not possible to use a subtitle filter such as DirectVobSub (a.k.a. VSFilter).
The ffdshow DXVA decoder supports subtitles, even though it is a native DXVA implementation. It uses a special trick to merge the subtitles with the decoded video inside GPU memory. A downside of this trick is that it can result in bit a pixelation around the subtitles, because some video frames are re-used as reference frames in the decoding of subsequent frames. Nevertheless, the subtitle functionality of ffdshow is useful if no other alternative is available.
If you want to use DXVA in Windows Media Player or Media Center, then you either need to use LAV DXVA2 copy-back, or use ffdshow DXVA decoder with its internal subtitle functionality.
If you are using Media Player Classic, then you should use its internal DXVA decoder in combination with its internal subtitle renderer (ISR).
Which video renderers in MPC are compatible with DXVA native?
Below you can see which renderers support DXVA. You will notice that the lists depend on your version of Windows. The renderers that are marked with "not compatible with ISR" are not compatible with the internal subtitle renderer of Media Player Classic. It is thus not recommended to use these if you want to see subtitles.
Windows Vista/7/8:
EVR Custom Presenter    [recommended]
EVR Sync
EVR    [not compatible with ISR]
Windows XP:
VMR-9 (renderless)    [recommended]
VMR-7 (windowed)    [not compatible with ISR]
Overlay Mixer    [not compatible with ISR]
Why does the installer show less options than mentioned in this help?
It hides options that are not supported by your hardware. 
For example, CUVID requires a NVIDIA graphics card. QuickSync only works with specific Intel iGPUs. DXVA2 requires Windows Vista or newer.
Which form of hardware acceleration should I choose?
Here are some rules of thumb to help you decide which option to choose. They are listed in order or importance.
You have a fast CPU
In this case, you don't need hardware acceleration. Our recommendation is to select the "Use software decoding" option.
You should only use hardware acceleration if you need more CPU resources for some other purpose, such as doing heavy post-processing.
QuickSync is available
Intel QuickSync is a good hardware decoder. It is fast and power-efficient. However, some files might have playback issues due to driver bugs. It is highly recommended to keep your Intel graphics driver up-to-date. Intel is working hard on improving the driver. It is important to download the driver from the Intel website, as the drivers on WindowsUpdate may not include all required QuickSync components.
You have a NVIDIA graphics card
Use either CUVID or LAV DXVA2 (when available).
NVIDIA CUVID is currently the most robust hardware decoder. It is highly recommended.
DXVA2 may use a little less electricity than CUVID, specially on high-end cards. So if power usage is important to you, DXVA2 is a good alternative for CUVID. Use DXVA2 copy-back if you need to do video processing after decoding (such as adding subtitles in WMP with DirectVobSub). Use DXVA2 native otherwise.
You use Media Player Classic Home Cinema
Use the internal DXVA decoder.
You have an AMD 6xxx or 7xxx model graphics card
Use LAV DXVA2 copy-back when available.
You use an advanced player such as KMPlayer, GOM, PotPlayer
These players have an internal DXVA decoder similar to the one Media Player Classic has.
In this case, it is recommended to leave the setting in the codec pack at the default of "Use software decoding". Enable the internal DXVA decoder in the options of your player.
You use a basic player such as Windows Media Player
If you need subtitles then use ffdshow DXVA.
If you do not need subtitles then use LAV DXVA native (when available).
Does hardware acceleration reduce electrical power consumption?
If you have a slow and inefficient CPU and a low-end GPU, then it might give a small reduction in power consumption. Laptops often have a low-end GPU.
If you have a fast CPU or a high-end GPU, then power usage might actually be higher with hardware acceleration enabled.
NVIDIA cards can go in high performance mode when using hardware acceleration (both CUVID and DXVA). A tool called NVIDIA Inspector can be used to tweak this behavior and reduce power consumption. Detailed instructions for that will be added here later. Meanwhile you should be able to find it using a Google search.
What should I do in case of problems?
Problems with hardware accelerated video decoding are often driver related. So the first thing you should try is to update your graphics driver. You should download the driver directly from the website of the manufacturer of the graphics chip (AMD, NVIDIA, or Intel). Do not get drivers from WindowsUpdate, because those driver are usually older and often do not contain all components required for hardware acceleration (in case of CUVID and QuickSync).
You should also switch to normal software decoding to confirm if the problem is related to hardware acceleration.