[FFmpeg-devel] FFMPEG extension OpenCL

Reimar Döffinger Reimar.Doeffinger at gmx.de
Sun Dec 11 11:19:45 CET 2011


On Sun, Dec 11, 2011 at 11:08:06AM +0100, madshi wrote:
> 2011/12/11 Reimar Döffinger <Reimar.Doeffinger at gmx.de>
> > Huh? That would of course only help when you'd want
> > to display the thing at the end.
> > Yes, it would need a new "OpenGL texture" pixel format
> > or such otherwise we can't pass it through the filter chain.
> 
> Not sure what you mean. OpenCL can run on the CPU,
> but the real purpose of OpenCL (in my book) is to run
> stuff on the GPU. If you have a PCIe GPU then you can't
> expect the GPU/OpenCL do take over the work if the video
> data is still in System RAM. So copying the data over the
> PCIe bus can't be avoided.

Well, just compare
copy via PCIe, filter and scale up to 10x the size, display
to
filter and scale up to 10x the size, copy via PCIe, display
Is that clear enough?
While possibly a rare use case, OpenCL with OpenGL interop
in some cases could reduce needed PCIe bandwidth significantly.
At the very least it doesn't have to require two image copies
per filter a simple/naive approach would.

> > And then in principle a combined scale+sharpen will
> > certainly be able to do as well as separate ones, but it
> > really should be able to do better, since either the
> > sharpening has to deal with stuff introduced by scale
> > or vice versa.
> 
> I have my doubts about that. If you look at this from a
> scientific approach, during image *down*sampling you
> first low pass filter the image (the usual linear resamplers
> do that implicitly). Consequently, for upscaling you first
> interpolate, then you try to "undo"  the low pass filter.

Uh, I consider the information theoretical approach a bit more
simple. Scaling destroys information, so does sharpening
(most algorithms at least).
Doing them separately means at least one of them has less
information to work on.
This is even more extreme if you want to downscale by a factor
4 and do sharpening. Of course you could probably just call
this "using a proper downscaling algorithm".

> Practically, I don't know any algorithm out there which
> which does scaling + sharpening integrated in good quality.
> The best scaling and sharpening algorithms that I know of
> are all separate algorithms (see e.g. AviSynth NNEDI3 and
> LimitedSharpenFaster).

Since it is much easier to implement separately that's not
surprising.
Anyway I think this is way off-topic now, since coming up
with new algorithms would probably be too much to attempt
in addition to just making OpenCL work.


More information about the ffmpeg-devel mailing list