Last edited 6 days ago

How to find the description of a color format and check its support

Applicable for STM32MP13x lines, STM32MP15x lines, STM32MP21x lines, STM32MP23x lines, STM32MP25x lines


1. Most common pixel color formats[edit | edit source]

DRM/KMS (modetest) V4L2 pixel format (v4l2-ctl) GStreamer (gst-launch-1.0)
32-bit color formats
ARGB32 32-bit single plane AR24 AR24 BGRA
ARGB32 32-bit single plane AB24 AB24 RGBA
ARGB32 32-bit single plane BA24 ARGB
ARGB32 32-bit single plane XB24 RGBx
ARGB32 32-bit single plane RX24 xBGR
ARGB32 32-bit single plane BX24 / RGB4 xRGB
ARGB32 32-bit single plane XR24 / BGR4 BGRx
24-bit color formats
RGB 24-bit single plane RG24 RGB3 RGB
BGR 24-bit single plane BG24 BGR3 BGR
16-bit color formats
RGB565 16-bit single plane RG16 RGBP RGB16
YUV422 16 bits single plane YUYV YUYV YUY2
12-bit color formats
YUV420 semi-planar 12 bits 2 planes NV12 NV12 NV12
YUV420 full-planar 12 bits 3 planes YU12 YU12 I420

2. Color formats in software components[edit | edit source]

Depending on the software component, a color format name and definition may slightly differ. The table below references the main information relating to the different color formats.

Software frameworks Include links & Examples Support checks
Linux® kernel

DRM KMS framework

include/uapi/drm/drm_fourcc.h

DRM_FORMAT_ARGB8888 (AR24)
DRM_FORMAT_NV12 (NV12)
modetest
Linux® kernel

V4L2 camera or V4L2 video
frameworks

include/uapi/linux/videodev2.h

V4L2_PIX_FMT_ARGB32 ("BA24")
V4L2_PIX_FMT_NV12 ("NV12")

include/uapi/linux/media-bus-format.h

MEDIA_BUS_FMT_ARGB8888_1X32 - ?
MEDIA_BUS_FMT_UYVY12_2X12 - ?

Command examples for cameras:

v4l2-ctl -d /dev/video3 -D
media-ctl -d platform:dcmipp -p

Command examples for V4L2 video codecs:

v4l2-ctl --list-formats-out-ext
v4l2-ctl -d /dev/video0 --list-formats-ext
GStreamer framework

video-format.html and
mediatype-video-raw.html

GST_VIDEO_FORMAT_BGRA ("BGRA")
GST_VIDEO_FORMAT_NV12 ("NV12")
gst-inspect-1.0 waylandsink
gst-inspect-1.0 --no-colors v4l2jpegenc
U-Boot video framework include/video.h
VIDEO_RGBA8888
OpenGL framework https://www.khronos.org/opengl/wiki/Image_Format
Vulkan framework https://docs.vulkan.org/spec/latest/chapters/formats.html
VK_FORMAT_R8G8B8A8_UINT
VK_FORMAT_R8_UNORM


3. Extra information[edit | edit source]

3.1. YUV packed, semi-planar and full planar color formats[edit | edit source]

The "YUV" color format (also named YCbCr) memory buffers can be organized in 3 ways:

  • packed (or co-planar) with 1 buffer: for instance "YUY2" for some camera outputs
  • semi-planar (or half-planar) with 2 buffers: for instance "NV12" for some video hardware decoders
  • full-planar with 3 buffers: for instance "I420" and "YV12" for some software video decoders

3.2. Colorimetry[edit | edit source]

In some particular use cases, it may be important to consider:

  • ITU-R BT.601 (SDTV analog) Vs. BT.709 (HDTV digital) ​
  • Limited (16-235, for video) Vs. full range (for JPEG)

3.3. RAW Bayer color formats[edit | edit source]

https://docs.kernel.org/userspace-api/media/v4l/pixfmt-bayer.html

3.4. Related topics[edit | edit source]