[FFmpeg-devel] adding RGBA and BGRA to nvenc.c

Timo Rothenpieler timo at rothenpieler.org
Wed Sep 7 16:33:38 EEST 2016


Am 07.09.2016 um 15:26 schrieb Sven C. Dack:
> On 07/09/16 12:40, Timo Rothenpieler wrote:
>> libavutil/pixfmt.h defines AV_PIX_FMT_RGB0 and the other ones like this:
>>
>> packed RGB 8:8:8, 32bpp, XRGBXRGB...   X=unused/undefined
>>
>> So I would expect the Alpha-Channel to be anything, and converting from
>> RGBA to RGB0 to be a no-op "conversion".
> 
> It is not an issue. x11grab produces BGR0 and nvenc can handle it with
> the patch. It's giving me 100fp/s (up from 47fp/s) with a 1920x1080
> monitor. I'd imagine people with 4K displays will be happy, too,
> although they will have to live with lower speeds of perhaps 30 fp/s.
> Would be interesting to know how it performs on 4K though.
> 
> If there is really an RGBA/BGRA input then it needs to be convert to
> RGB0/BGR0. Until then is it a theoretical issue. Might be the module
> producing RGBA/BGRA can produce RGB0/BGR0, too.

0RGB/0BGR does not mean the alpha bits are zeroed.
It means they are undefined, so you convert from ARGB to 0RGB by doing
nothing. There is no performance to gain by supporting a format that
falsely advertises support for an alpha channel.

Also, the correct formats to use are AV_PIX_FMT_0RGB32, which
corresponds to NV_ENC_BUFFER_FORMAT_ARGB, and AV_PIX_FMT_0BGR32 for ABGR.

Will apply with those.

For the future, please use git format-patch, and ideally also git
send-email for your patches.
Attaching the patches is just fine though, preferably only one per mail
for patchwork to pick it up cleanly.


More information about the ffmpeg-devel mailing list