[FFmpeg-devel] [PATCH]opencl: automatically select the fastest opencl device

Stefano Sabatini stefasab at gmail.com
Fri Dec 6 11:57:36 CET 2013


On date Friday 2013-12-06 03:00:09 -0600, Lenny Wang encoded:
> >
> > please move the opencl code from cmdutils.c into a seperate file
> > its up to you and wei if you want the benchmarking and or listing
> > code available from the ffmpeg tool or in a seperate tool. but
> > opencl code should not be put in random files under ifdef, put it
> > in seperate opencl specific files. build and link them only when
> > opencl is available
> >
> 
> Sorry about the late reply.  Please review attached patch modified
> based on Michael's suggestion, thanks.

> From: Lenny Wang <lwanghpc at gmail.com>
> Date: Fri, 6 Dec 2013 02:40:00 -0600
> Subject: [PATCH] cmdutils & opencl: add -opencl_bench option to test and show available OpenCL devices
> 
> ---
>  Makefile                     |   1 +
>  cmdutils.c                   |  54 +++++++++++-
>  cmdutils.h                   |   6 ++
>  cmdutils_common_opts.h       |   1 +
>  doc/APIchanges               |   2 +
>  doc/fftools-common-opts.texi |   4 +
>  doc/utils.texi               |   4 +-
>  libavutil/opencl.c           |  42 ++++++++++
>  libavutil/opencl.h           |  16 ++++
>  libavutil/version.h          |   2 +-
>  tools/opencl_bench.c         | 194 +++++++++++++++++++++++++++++++++++++++++++
>  tools/opencl_bench.h         |  37 +++++++++
>  12 files changed, 359 insertions(+), 4 deletions(-)

Uh, not yet.

So, Michael suggested to move all cmdutils OpenCL code to a separate
file. The tools directory is meant for self-contained tools, you
should not depend on ff*/cmdutils code or even worse make ff*/cmdutils
code depend on it.

So I suggest this: you move all cmdutils OpenCL code to
cmdutils_opencl.c/h. cmdutils_opencl.o will be linked only if OpenCL
is detected. The opencl_options code should go in the same file as
well (in the same or maybe in a separate follow-up patch).

Function prototypes can go to a dedicated cmdutils_opencl.h file or
stay in cmdutils.h, under #ifdef, as Michael prefers.
-- 
FFmpeg = Furious and Fast Maxi Purposeless Erratic Gangster


More information about the ffmpeg-devel mailing list