Skip to content

Hardware Accelerated Decoding

WangBin edited this page Oct 10, 2015 · 19 revisions

User

VA-API

Install vainfo libva-dev, libva-intel-vaapi-driver(intel gpu), xvba-va-driver(ATI), vdpau-va-driver(NVIDIA)

If vainfo works, then QtAV should work with VA-API

CUDA

Linux

nvidia-331 works. I don't know how to enable CUDA for other drivers. Tell me if you know.

Windows

Install latest nvidia driver.

DXVA

Developer

Build

Code

CUDA:

QVaraiantHash cuda_opt;
cuda_opt["surfaces"] = 0; //key is property name, case sensitive
cuda_opt["copyMode"] = "ZeroCopy"; // default is "GenericCopy"
QVariantHash opt;
opt["CUDA"] = cuda_opt; //key is decoder name, case sensitive
player.setOptionsForVideoCodec(opt);

Since QtAV1.8, CUDA decoder supports ZeroCopy. Run your program with NVIDIA GPU if you have multiple GPUs.

VA-API:

QVaraiantHash va_opt;
va_opt["display"] = "X11"; //"GLX", "X11", "DRM"
va_opt["copyMode"] = "ZeroCopy"; // "ZeroCopy", "OptimizedCopy", "GenericCopy". Default is "ZeroCopy" if possible
QVariantHash opt;
opt["VAAPI"] = va_opt; //key is decoder name, case sensitive
player.setOptionsForVideoCodec(opt);

Copy Mode

Copy mode for GPU decoders was introduced since 1.5.0. Copy mode can be ZeroCopy, LazyCopy, OptimizedCopy and GenericCopy.

  • ZeroCopy: No data read back from GPU. Directly render the decoded data on GPU. It's the most efficient way. Now it's supported by
    • CUDA
    • VA-API with libva-x11 and libva-glx. It may not work for vdpau backend.
    • VDA(OSX), VideoToolbox(OSX, iOS>=8)
    • DXVA with ANGLE. (Desktop OpenGL is not stable now)
  • LazyCopy: Used in VDA and VideoToolBox
  • OptimizedCopy: Use SSE4.1 for x86 used by DXVA and VA-API(VDA crashes), and NEON for CedarV. SSE4.1 does not work for some GPUs, e.g. NVIDIA GS8400
  • GenericCopy: Use memcpy

Status

[] D3D11 [x] DXVA+ANGLE [] DXVA+NVGL (WIP) [x] CUDA+GL [x] CUDA+EGL (WIP) [] VAAPI+EGL (WIP) [x] VDA+GL [x] VideoToolbox OSX [x] VideoToolbox iOS [] VDPAU [] OMX

Clone this wiki locally