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

wm4 nfxjfg at googlemail.com
Mon Feb 9 12:37:46 CET 2015


On Mon, 9 Feb 2015 09:42:30 +0000
"Gupta, Maneesh" <Maneesh.Gupta at amd.com> wrote:

> 
> 
> > -----Original Message-----
> > From: ffmpeg-devel-bounces at ffmpeg.org [mailto:ffmpeg-devel-
> > bounces at ffmpeg.org] On Behalf Of wm4
> > Sent: Friday, February 06, 2015 4:58 PM
> > To: ffmpeg-devel at ffmpeg.org
> > Subject: Re: [FFmpeg-devel] [PATCH 1/3] Add clew.c & clew.h to libavutil
> > 
> > On Fri, 6 Feb 2015 11:06:28 +0000
> > "Gupta, Maneesh" <Maneesh.Gupta at amd.com> wrote:
> > 
> > >
> > >
> > > > -----Original Message-----
> > > > From: ffmpeg-devel-bounces at ffmpeg.org [mailto:ffmpeg-devel-
> > > > bounces at ffmpeg.org] On Behalf Of wm4
> > > > Sent: Friday, February 06, 2015 4:31 PM
> > > > To: ffmpeg-devel at ffmpeg.org
> > > > Subject: Re: [FFmpeg-devel] [PATCH 1/3] Add clew.c & clew.h to
> > > > libavutil
> > > >
> > > > On Fri, 6 Feb 2015 11:14:21 +0100
> > > > Hendrik Leppkes <h.leppkes at gmail.com> wrote:
> > > >
> > > > > On Fri, Feb 6, 2015 at 11:09 AM, Gupta, Maneesh
> > > > <Maneesh.Gupta at amd.com> wrote:
> > > > > > Hi All,
> > > > > >
> > > > > > There are several issues with the way ffmpeg compilation works
> > > > > > when
> > > > OpenCL is enabled using --enable-opencl. Chief among them are:
> > > > > > 1. One needs to also use --extra-cflags, --extra-ldflags &
> > > > > > -extra-libs to
> > > > specify the path to the OpenCL header and library files. Otherwise
> > > > configure fails.
> > > > > > 2. ffmpeg currently requires OpenCL 1.2, but the build system
> > > > > > may have
> > > > another version installed (such as the newer OpenCL 2.0 which has
> > > > deprecated some 1.2 APIs).
> > > > > >
> > > > > > There are a couple of ways to address this.
> > > > > >
> > > > > > * One way is the x264 approach which is to bundle cl.h,
> > > > > > cl_platform.h and
> > > > a wrapper c file which relies on dynamically loading OpenCL rather
> > > > than using static linking. This requires modifications to the entire
> > > > OpenCL based code since we cannot use the OpenCL APIs directly.
> > > > > > * Another approach taken by LibreOffice and Blender for example
> > > > > > is to
> > > > use clew (i.e. The OpenCL Extension Wrangler Library). This has the
> > > > advantage of letting us use the OpenCL APIs directly yet at the same
> > > > time relying on dynamically loading OpenCL. The clew project is
> > > > hosted at https://github.com/OpenCLWrangler/clew. This is maintained
> > > > by two people (Sergey and Martijn).
> > > > > > Usage of clew in Libreoffice can be seen @
> > > > http://cgit.freedesktop.org/libreoffice/core/tree/clew/source and in
> > > > Blender @
> > > > https://git.blender.org/gitweb/gitweb.cgi/blender.git/tree/HEAD:/ext
> > > > ern/cl
> > > > ew.
> > > > > >
> > > > > > This patch is for adding clew to the ffmpeg tree. The subsequent
> > > > > > patches
> > > > switch the OpenCL code in ffmpeg from using cl.h to using clew.
> > > > > >
> > > > >
> > > > >
> > > > > Using such a library is fine, if its deemed the best solution
> > > > > available, but flat-out importing its code into avutil is not.
> > > >
> > > > +1
> > > >
> > > > Also look at all these awful "portability" hacks in the added code.
> > > > It's not a good idea to agree to maintaining this terrible mess.
> > >
> > > Alright. Can you suggest an alternate way of building ffmpeg using clew?
> > Clew has lot of advantages and essentially consists of a single source and
> > header file. I will modify and resubmit the patch accordingly.
> > 
> > Convince upstream to package it as real library.
> 
> Clew can already be built as a static library. It ships with a  cmake file. However I am a little confused here. My intention for using clew was to remove the pain of having to specify multiple parameters to enable the OpenCL feature. If clew is used as a library, instead of having use --extra-cflags, --extra-ldflags to specific the path to standard OpenCL bits I would have to still use them to point ffmpeg to the path to clew. Or am I missing something here?

Yes: we don't copy foreign library sources into the ffmpeg tree just
because some people think it's convenient. (In fact, the result is way
less convenient for people who know how to use package managers.)


More information about the ffmpeg-devel mailing list