]> git.sesse.net Git - x264/commit
OpenCL lookahead
authorSteve Borho <steve@borho.org>
Thu, 21 Feb 2013 18:48:40 +0000 (12:48 -0600)
committerFiona Glaser <fiona@x264.com>
Tue, 23 Apr 2013 21:36:20 +0000 (14:36 -0700)
commitf49a1b2ef6d95d8f0f186df0fc3bfe38414e264f
treec69774b47589d349d3b68df645ffed63e6a910f9
parent2d0c47a50622ec59ade303cf150c21b8910a2bce
OpenCL lookahead

OpenCL support is compiled in by default, but must be enabled at runtime by an
--opencl command line flag. Compiling OpenCL support requires perl. To avoid
the perl requirement use: configure --disable-opencl.

When enabled, the lookahead thread is mostly off-loaded to an OpenCL capable GPU
device.  Lowres intra cost prediction, lowres motion search (including subpel)
and bidir cost predictions are all done on the GPU.  MB-tree and final slice
decisions are still done by the CPU.  Presets which do not use a threaded
lookahead will not use OpenCL at all (superfast, ultrafast).

Because of data dependencies, the GPU must use an iterative motion search which
performs more total work than the CPU would do, so this is not work efficient
or power efficient. But if there are spare GPU cycles to spare, it can often
speed up the encode. Output quality when OpenCL lookahead is enabled is often
very slightly worse in quality than the CPU quality (because of the same data
dependencies).

x264 must compile its OpenCL kernels for your device before running them, and in
order to avoid doing this every run it caches the compiled kernel binary in a
file named x264_lookahead.clbin (--opencl-clbin FNAME to override).  The cache
file will be ignored if the device, driver, or OpenCL source are changed.

x264 will use the first GPU device which supports the required cl_image
features required by its kernels. Most modern discrete GPUs and all AMD
integrated GPUs will work.  Intel integrated GPUs (up to IvyBridge) do not
support those necessary features. Use --opencl-device N to specify a number of
capable GPUs to skip during device detection.

Switchable graphics environments (e.g. AMD Enduro) are currently not supported,
as some have bugs in their OpenCL drivers that cause output to be silently
incorrect.

Developed by MulticoreWare with support from AMD and Telestream.
22 files changed:
.gitignore
Makefile
common/common.c
common/common.h
common/frame.c
common/frame.h
common/opencl.c [new file with mode: 0644]
common/opencl.h [new file with mode: 0644]
common/opencl/bidir.cl [new file with mode: 0644]
common/opencl/downscale.cl [new file with mode: 0644]
common/opencl/intra.cl [new file with mode: 0644]
common/opencl/motionsearch.cl [new file with mode: 0644]
common/opencl/subpel.cl [new file with mode: 0644]
common/opencl/weightp.cl [new file with mode: 0644]
common/opencl/x264-cl.h [new file with mode: 0644]
configure
encoder/encoder.c
encoder/slicetype-cl.c [new file with mode: 0644]
encoder/slicetype.c
tools/cltostr.pl [new file with mode: 0644]
x264.c
x264.h