[FFmpeg-devel] Added - HW accelerated H.264 and HEVC encoding for AMD GPUs based on AMF SDK

Mironov, Mikhail Mikhail.Mironov at amd.com
Sun Oct 29 16:54:07 EET 2017

> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf
> Of Carl Eugen Hoyos
> Sent: October 28, 2017 3:19 PM
> To: FFmpeg development discussions and patches <ffmpeg-
> devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] Added - HW accelerated H.264 and HEVC
> encoding for AMD GPUs based on AMF SDK
> 2017-10-27 20:09 GMT+02:00 mmironov <mikhail.mironov at amd.com>:
> > +const enum AVPixelFormat ff_amf_pix_fmts[] = {
> > +    AV_PIX_FMT_NV12,
> > +    AV_PIX_FMT_BGRA,
> > +    AV_PIX_FMT_ARGB,
> > +    AV_PIX_FMT_RGBA,
> This is wrong, your encoders do not convert transparency information, there
> are 32 rgb formats without alpha channel.
> > +    { AV_PIX_FMT_NV12,       AMF_SURFACE_NV12 },
> > +    { AV_PIX_FMT_D3D11,      AMF_SURFACE_NV12 },
> Just curious: Can you explain this in simple words?
> I will try not to comment on the headers you sent, Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Sure: the native format for the encoder is NV12. It can work via D3D11 and accept DXGI_FORMAT_NV12 texture or via D3D9  accepting (D3DFORMAT)MAKEFOURCC('N', 'V', '1', '2') surface. AMF surfaces are wrappers around these objects and converters from system memory. In addition, the encoder has built-in shader-based color converter. It can accept BGRA and RGBA formats and convert them into NV12 dropping alpha channel. This is why I added these entries. Granted, the conversion lacks parameters and to support more options AMF has a separate color space component, also shader-based. Once encoder is integrated I planned to ask FFmpeg team opinion if it is needed or not. 
I made the FFmpeg encoder accepting DX objects from other FFmpeg components if available.

More information about the ffmpeg-devel mailing list