[FFmpeg-devel] [PATCH 2/2] lavf: Add coreimage filter for GPU based image filtering on OSX.

Clément Bœsch u at pkh.me
Mon Mar 14 13:56:22 CET 2016


On Mon, Mar 14, 2016 at 01:46:52PM +0100, Thilo Borgmann wrote:
> Am 14.03.16 um 11:22 schrieb Clément Bœsch:
> > [...]
> >> +./ffmpeg -f lavfi -i nullsrc=s=100x100,coreimage=filter=CIQRCodeGenerator@@inputMessage=https\\\\\://FFmpeg.org/@@inputCorrectionLevel=H -frames:v 1 QRCode.png
> > 
> > remove ./
> > 
> > also, it's probably better to have 2 filters: one for usage as a source,
> > and another one for filtering (coreimagesrc vs coreimage).
> 
> I want to extend it later to allow the user to define an output size avoiding
> the need to have it defined by input iamge size. Then it could be used as an
> image source, too. However, I'll have to think about many more cases for that to
> work good. Thus I really want to do it as further work.
> 
> Also, if we split out the generator category into coreimagesrc, the following
> would not work anymore without GPU-HOST transfer:
> 
> coreimage=filter=boxblur at default#qrcode at whatever@somewhere
> 
> Instead the user would have to use a complex filter:
> 
> coreimagesrc=filter=qrcode at whatever [qr],
> [v:0] coreimage=filter=boxblur at default [blur],
> [blur][qr]overlay=somewhere [output]
> 
> To do it without transfer then would require to allow coreimage to do generators
> like coreimagesrc - which would void the argument for a seperated src because
> complete feature duplication, don't you think?
> 

If you can hold the picture into a CVPixelBuffer, you could use
AV_PIX_FMT_VIDEOTOOLBOX, which make it possible to create one single
apple filter per coreimage instance in the filtergraph.

It's probably a cleaner design. You'll probably need a
AV_PIX_FMT_VIDEOTOOLBOX to AV_PIX_FMT_RGBA (or whatever) convert filter
(transparently in vf scale, or maybe simply a coreimage=torgba)

> 
> >> +#define SafeCFRelease(ptr) { \
> >> +    if (ptr) {               \
> >> +        CFRelease(ptr);      \
> >> +        ptr = NULL;          \
> >> +    }                        \
> >> +}
> > 
> > please use do while(0) form
> 
> I don't understand how do while(0) form could be applied here, please explain.
> 

#define SafeCFRelease(ptr) do { \
    if (ptr) {                  \
        CFRelease(ptr);         \
        ptr = NULL;             \
    }                           \
} while (0)

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160314/7d26007e/attachment.sig>


More information about the ffmpeg-devel mailing list