[FFmpeg-devel] [PATCH] lavd/v4l2: Add ARGB and XRGB packed pixel formats

Антон Леонтьев aleontiev at elvees.com
Thu May 10 11:42:15 EEST 2018


> 2018-05-08 15:11 GMT+02:00, Anton Leontiev <aleontiev at elvees.com>:
>> Formats ARGB32, XRGB32, ABGR32, and XBGR32 were added to
>> V4L2 instead of ill-defined deprecated RGB32/BGR32 pixel formats.
>
> Just curious because I am quite sure I tested them:
> Why / how are they ill-defined?

According to [1-2]:

  The meaning of their alpha bits (a) are ill-defined and interpreted as in
  either the corresponding ARGB or XRGB format, depending on the driver.

[1] https://git.kernel.org/torvalds/c/977ff0e4fb3460d
[2] https://www.kernel.org/doc/html/latest/media/uapi/v4l/pixfmt-packed-rgb.html

>> diff --git a/libavdevice/v4l2-common.c b/libavdevice/v4l2-common.c
>> index 196c09b7fc..d48ae2efa1 100644
>> --- a/libavdevice/v4l2-common.c
>> +++ b/libavdevice/v4l2-common.c
>> @@ -34,6 +34,10 @@ const struct fmt_map ff_fmt_conversion_table[] = {
>>      { AV_PIX_FMT_RGB565BE,AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB565X },
>>      { AV_PIX_FMT_BGR24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_BGR24   },
>>      { AV_PIX_FMT_RGB24,   AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_RGB24   },
>> +    { AV_PIX_FMT_BGR0,    AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_XBGR32  },
>> +    { AV_PIX_FMT_0RGB,    AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_XRGB32  },
>> +    { AV_PIX_FMT_BGRA,    AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_ABGR32  },
>> +    { AV_PIX_FMT_ARGB,    AV_CODEC_ID_RAWVIDEO, V4L2_PIX_FMT_ARGB32  },
>
> Needs an "#ifdef" guard like below.

Will add in the next version. Thank you for review.

Best regards,

-- 
Anton Leontiev


More information about the ffmpeg-devel mailing list