Last edited 2 months 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
media bus
media-ctl
V4L2 pixel format
v4l2-ctl
GStreamer
gst-launch-1.0
32-bit color formats
ARGB32 32-bit single plane AR24 RGB888_1X24 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 RGB888_1X24 RGBP RGB16
YUV422 16 bits single plane YUYV YUV8_1X24 YUYV YUY2
12-bit color formats
YUV420 semi-planar 12 bits 2 planes NV12 YUV8_1X24 NV12 NV12
YUV420 full-planar 12 bits 3 planes YU12 YUV8_1X24 YU12 I420
RAW Bayer color formats
RAW Bayer 8-bit

SBGGR8_1X8
SGBRG8_1X8
SGRBG8_1X8
SRGGB8_1X8

BA81
GBRG
GRBG
RGGB

bggr
gbrg
grbg
rggb

RAW Bayer 10-bit

SBGGR10_1X10
SGBRG10_1X10
SGRBG10_1X10
SRGGB10_1X10

BG10
GB10
BA10
RG10

bggr10le
gbrg10le
grbg10le
rggb10le

RAW Bayer 12-bit

SBGGR12_1X12
SGBRG12_1X12
SGRBG12_1X12
SRGGB12_1X12

BG12
GB12
BA12
RG12

bggr12le
gbrg12le
grbg12le
rggb12le

RAW Bayer 14-bit

SBGGR14_1X14
SGBRG14_1X14
SGRBG14_1X14
SRGGB14_1X14

BG14
GB14
BA14
RG14

bggr14le
gbrg14le
grbg14le
rggb14le


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
mediatype-video-raw.html
bayer2rgb.html

GST_VIDEO_FORMAT_BGRA ("BGRA")
GST_VIDEO_FORMAT_NV12 ("NV12")
gst-inspect-1.0 waylandsink
gst-inspect-1.0 --no-colors v4l2jpegenc
gst-inspect-1.0 --no-colors bayer2rgb
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
Info white.png Information
The media bus pixel codes (also named mbus-code) describe image formats as flowing over physical buses (both between separate physical components and inside SoC devices). See userspace-api/media/v4l/subdev-formats.html and include/uapi/linux/media-bus-format.h for more details.

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]