[FFmpeg-devel] [PATCH 1/3] Add clew.c & clew.h to libavutil

Gupta, Maneesh Maneesh.Gupta at amd.com
Tue Feb 10 13:08:19 CET 2015

> -----Original Message-----
> From: ffmpeg-devel-bounces at ffmpeg.org [mailto:ffmpeg-devel-
> bounces at ffmpeg.org] On Behalf Of Dominik 'Rathann' Mierzejewski
> Sent: Monday, February 09, 2015 5:22 PM
> To: ffmpeg-devel at ffmpeg.org
> Subject: Re: [FFmpeg-devel] [PATCH 1/3] Add clew.c & clew.h to libavutil
> FWIW I didn't have to pass ANY --extra-cflags and --extra-ldflags to build
> FFmpeg with OpenCL on Fedora 21. I only had to install opencl-headers and
> ocl-icd-devel packages.
[Gupta, Maneesh]
Unfortunately I am in the Windows part of the world where the OS does not ship with any OpenCL headers.

As regards linking against ICD, it does come with a drawback. If the application contains both an OpenCL path as well as a CPU fallback path, and you try running an application that is linked against ICD on a system that does not have any OpenCL runtime, you cannot use the CPU fallback path. That is why solutions such as clew or wrappers-with-clew-like-intention exist. There are sufficient examples of both clew as well as similar wrappers used by several open source projects. Clew for example is used in
1) LibreOffice (http://cgit.freedesktop.org/libreoffice/core/tree/clew/source) and
2) Blender (https://git.blender.org/gitweb/gitweb.cgi/blender.git/tree/HEAD:/extern/clew).
Similarly there are instances of wrappers-with-clew-like-intention developed and maintained by several open source projects as well.
1) See x264 (http://git.videolan.org/?p=x264.git;a=blob;f=common/opencl.c;hb=HEAD) and
2) OpenCV (https://github.com/Itseez/opencv/blob/master/modules/core/src/ocl.cpp).

The purpose of these wrappers is simple. Allow static linking to OpenCL ICD in a manner that works across multiple platforms and that is hardware vendor agnostic.

> Also, I still haven't seen you respond to my question about the library itself.
> It's not packaged for any major distro and I'm still not sure who is its
> upstream. I found a GoogleCode project and a SourceForge project, both by
> different authors (one seems to be independent, the other is the author of
> clcc, from which clew seems to be derived from).

[Gupta, Maneesh]
As I mentioned in another thread previously, the current  upstream maintainers of clew are Sergey and Martijn. They maintain clew, cuew (CUDA equivalent to clew) for Blender. The maintained fork of the clew project is @ https://github.com/OpenCLWrangler/clew. I can talk to Martijn and check if he is fine with being added to this mail thread for any discussion/concerns regarding clew.

> I'm not sure using a library with uncertain status is such a good idea.

[Gupta, Maneesh] 
My intention is only to simplify the user experience of compiling OpenCL enabled ffmpeg. Since this experience seems to be fine on Linux (where all you need to do is install opencl-headers and ocl-icd), an alternative approach is to improve the wiki documentation for the build environment on Windows to specify how to ensure ffmpeg finds the OpenCL related bits in a seamless fashion as seems to be the case on Linux. I can take a stab at this if this finds better acceptance with the ffmpeg community.


More information about the ffmpeg-devel mailing list