Screen pixel format types

Updated: April 19, 2023

Types of supported pixel formats

Synopsis:

#include <screen/screen.h>
enum {
    SCREEN_FORMAT_BYTE = 1,
    SCREEN_FORMAT_RGBA4444 = 2,
    SCREEN_FORMAT_RGBX4444 = 3,
    SCREEN_FORMAT_RGBA5551 = 4,
    SCREEN_FORMAT_RGBX5551 = 5,
    SCREEN_FORMAT_RGB565 = 6,
    SCREEN_FORMAT_RGB888 = 7,
    SCREEN_FORMAT_RGBA8888 = 8,
    SCREEN_FORMAT_RGBX8888 = 9,
    SCREEN_FORMAT_YVU9 = 10,
    SCREEN_FORMAT_YUV420 = 11,
    SCREEN_FORMAT_NV12 = 12,
    SCREEN_FORMAT_YV12 = 13,
    SCREEN_FORMAT_UYVY = 14,
    SCREEN_FORMAT_YUY2 = 15,
    SCREEN_FORMAT_YVYU = 16,
    SCREEN_FORMAT_V422 = 17,
    SCREEN_FORMAT_AYUV = 18,
    SCREEN_FORMAT_NV16 = 19,
    SCREEN_FORMAT_P010 = 20,
    SCREEN_FORMAT_BGRA8888 = 21,
    SCREEN_FORMAT_BGRX8888 = 22,
    SCREEN_FORMAT_RGBA1010102 = 23,
    SCREEN_FORMAT_RGBX1010102 = 24,
    SCREEN_FORMAT_BGRA1010102 = 25,
    SCREEN_FORMAT_BGRX1010102 = 26,
    SCREEN_FORMAT_NFORMATS
};

Data:

SCREEN_FORMAT_BYTE
This is a multipurpose byte-based array of data.

It does not represent any actual pixel format.

SCREEN_FORMAT_RGBA4444
16 bits per pixel (4 bits per channel) RGB with alpha channel
SCREEN_FORMAT_RGBX4444
16 bits per pixel (4 bits per channel) RGB with alpha channel disregarded
SCREEN_FORMAT_RGBA5551
16 bits per pixel, 2 bytes containing R, G, and B values (5 bits per channel with single-bit alpha channel)
SCREEN_FORMAT_RGBX5551
16 bits per pixel, 2 bytes containing R, G, and B values (5 bits per channel with single-bit alpha channel disregarded)
SCREEN_FORMAT_RGB565
16 bits per pixel; uses five bits for red, six bits for green and five bits for blue.

This pixel format represents each pixel in the following order (high byte to low byte): RRRR RGGG GGGB BBBB

SCREEN_FORMAT_RGB888
24 bits per pixel (8 bits per channel) RGB
SCREEN_FORMAT_RGBA8888
32 bits per pixel (8 bits per channel) RGB with alpha channel
SCREEN_FORMAT_RGBX8888
32 bits per pixel (8 bits per channel) RGB with alpha channel disregarded
SCREEN_FORMAT_YVU9
9 bits per pixel planar YUV format.

8-bit Y plane and 8-bit 4x4 subsampled U and V planes. Registered by Intel.

SCREEN_FORMAT_YUV420
Standard NTSC TV transmission format.
SCREEN_FORMAT_NV12
12 bits per pixel planar YUV format.

8-bit Y plane and 2x2 subsampled, interleaved U and V planes.

SCREEN_FORMAT_YV12
12 bits per pixel planar YUV format.

8-bit Y plane and 8-bit 2x2 subsampled U and V planes.

SCREEN_FORMAT_UYVY
16 bits per pixel packed YUV format.

YUV 4:2:2 - Y sampled at every pixel, U and V sampled at every second pixel horizontally on each line. A macropixel contains 2 pixels in 1 uint32.

SCREEN_FORMAT_YUY2
16 bits per pixel packed YUV format.

YUV 4:2:2 - as in UYVY, but with different component ordering within the uint32 macropixel.

SCREEN_FORMAT_YVYU
16 bits per pixel packed YUV format.

YUV 4:2:2 - as in UYVY, but with different component ordering within the uint32 macropixel.

SCREEN_FORMAT_V422
Packed YUV format.

Inverted version of UYVY.

SCREEN_FORMAT_AYUV
Packed YUV format.

Combined YUV and alpha

SCREEN_FORMAT_NV16
8-bit Y plane; 2x1-subsampled, interleaved U and V planes (Like NV12 but with chroma for each row); this format is associated with the preprocessor definition SCREEN_FORMAT_NV16.
SCREEN_FORMAT_P010
24 bits per macro pixel planar YUV 4:2:0 format.

16-bit Y plane with effective 10 most significant bits and 2x2 subsampled. Interleaved 16-bit with effective 10 most significant bits U and V planes. It's fully identical to NV12, but every component occupies 16 bits instead of 8 bits.

SCREEN_FORMAT_BGRA8888
32 bits per pixel (8 bits per channel) BGR with alpha channel.
SCREEN_FORMAT_BGRX8888
32 bits per pixel (8 bits per channel) BGR with alpha channel disregarded.
SCREEN_FORMAT_RGBA1010102
A four-component, 32-bit unsigned integer format that supports 10 bits for each color and 2 bits for alpha.

The alpha channel is located at bits position 30-31, the red channel is defined in the most significant bits (bits position 20-29).

SCREEN_FORMAT_RGBX1010102
A four-component, 32-bit unsigned integer format that supports 10 bits for each color and 2 unused MSB bits.

The red channel is defined in the most significant bits (bits position 20-29).

SCREEN_FORMAT_BGRA1010102
A four-component, 32-bit unsigned integer format that supports 10 bits for each color and 2 bits for alpha.

The alpha channel is located at bits position 30-31, the red channel is defined in the least significant bits (bits position 0-9).

SCREEN_FORMAT_BGRX1010102
A four-component, 32-bit unsigned integer format that supports 10 bits for each color and 2 unused MSB bits.

The red channel is defined in the least significant bits (bits position 0-9).

SCREEN_FORMAT_NFORMATS
Number of pixel formats plus 1 (0 is not a valid format).

Library:

libscreen

Description:

Formats with an alpha channel will have source alpha enabled automatically. Applications that want the Screen API to disregard the alpha channel can choose a pixel format with an X.