Zephyr Project API 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
Video pixel formats

The | characters separate the pixels, and spaces separate the bytes. More...

Macros

#define VIDEO_FOURCC(a, b, c, d)    ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))
 Four-character-code uniquely identifying the pixel format.
 
#define VIDEO_FOURCC_FROM_STR(str)   VIDEO_FOURCC((str)[0], (str)[1], (str)[2], (str)[3])
 Convert a four-character-string to a four-character-code.
 

Functions

static unsigned int video_bits_per_pixel (uint32_t pixfmt)
 Get number of bits per pixel of a pixel format.
 

Bayer formats (R, G, B channels).

The full color information is spread over multiple pixels.

#define VIDEO_PIX_FMT_BGGR8   VIDEO_FOURCC('B', 'A', '8', '1')
 
#define VIDEO_PIX_FMT_GBRG8   VIDEO_FOURCC('G', 'B', 'R', 'G')
 
#define VIDEO_PIX_FMT_GRBG8   VIDEO_FOURCC('G', 'R', 'B', 'G')
 
#define VIDEO_PIX_FMT_RGGB8   VIDEO_FOURCC('R', 'G', 'G', 'B')
 

RGB formats

Per-color (R, G, B) channels.

#define VIDEO_PIX_FMT_RGB565X   VIDEO_FOURCC('R', 'G', 'B', 'R')
 5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].
 
#define VIDEO_PIX_FMT_RGB565   VIDEO_FOURCC('R', 'G', 'B', 'P')
 5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].
 
#define VIDEO_PIX_FMT_XRGB32   VIDEO_FOURCC('B', 'X', '2', '4')
 The first byte is empty (X) for each pixel.
 

YUV formats

Luminance (Y) and chrominance (U, V) channels.

#define VIDEO_PIX_FMT_YUYV   VIDEO_FOURCC('Y', 'U', 'Y', 'V')
 There is either a missing channel per pixel, U or V.
 
#define VIDEO_PIX_FMT_XYUV32   VIDEO_FOURCC('X', 'Y', 'U', 'V')
 The first byte is empty (X) for each pixel.
 

Compressed formats

#define VIDEO_PIX_FMT_JPEG   VIDEO_FOURCC('J', 'P', 'E', 'G')
 Both JPEG (single frame) and Motion-JPEG (MJPEG, multiple JPEG frames concatenated)
 

Detailed Description

The | characters separate the pixels, and spaces separate the bytes.

The uppercase letter represents the most significant bit. The lowercase letters represent the rest of the bits.

Macro Definition Documentation

◆ VIDEO_FOURCC

#define VIDEO_FOURCC (   a,
  b,
  c,
  d 
)     ((uint32_t)(a) | ((uint32_t)(b) << 8) | ((uint32_t)(c) << 16) | ((uint32_t)(d) << 24))

#include <include/zephyr/drivers/video.h>

Four-character-code uniquely identifying the pixel format.

◆ VIDEO_FOURCC_FROM_STR

#define VIDEO_FOURCC_FROM_STR (   str)    VIDEO_FOURCC((str)[0], (str)[1], (str)[2], (str)[3])

#include <include/zephyr/drivers/video.h>

Convert a four-character-string to a four-character-code.

Convert a string literal or variable into a four-character-code as defined by VIDEO_FOURCC.

Parameters
strString to be converted
Returns
Four-character-code.

◆ VIDEO_PIX_FMT_BGGR8

#define VIDEO_PIX_FMT_BGGR8   VIDEO_FOURCC('B', 'A', '8', '1')

#include <include/zephyr/drivers/video.h>

* | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | ...
* | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | ...
* 

◆ VIDEO_PIX_FMT_GBRG8

#define VIDEO_PIX_FMT_GBRG8   VIDEO_FOURCC('G', 'B', 'R', 'G')

#include <include/zephyr/drivers/video.h>

* | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | ...
* | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | ...
* 

◆ VIDEO_PIX_FMT_GRBG8

#define VIDEO_PIX_FMT_GRBG8   VIDEO_FOURCC('G', 'R', 'B', 'G')

#include <include/zephyr/drivers/video.h>

* | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | ...
* | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | ...
* 

◆ VIDEO_PIX_FMT_JPEG

#define VIDEO_PIX_FMT_JPEG   VIDEO_FOURCC('J', 'P', 'E', 'G')

#include <include/zephyr/drivers/video.h>

Both JPEG (single frame) and Motion-JPEG (MJPEG, multiple JPEG frames concatenated)

◆ VIDEO_PIX_FMT_RGB565

#define VIDEO_PIX_FMT_RGB565   VIDEO_FOURCC('R', 'G', 'B', 'P')

#include <include/zephyr/drivers/video.h>

5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].

This 16-bit integer is then packed in little endian format over two bytes:

*   7......0 15.....8
* | gggBbbbb RrrrrGgg | ...
* 

◆ VIDEO_PIX_FMT_RGB565X

#define VIDEO_PIX_FMT_RGB565X   VIDEO_FOURCC('R', 'G', 'B', 'R')

#include <include/zephyr/drivers/video.h>

5 red bits [15:11], 6 green bits [10:5], 5 blue bits [4:0].

This 16-bit integer is then packed in big endian format over two bytes:

*   15.....8 7......0
* | RrrrrGgg gggBbbbb | ...
* 

◆ VIDEO_PIX_FMT_RGGB8

#define VIDEO_PIX_FMT_RGGB8   VIDEO_FOURCC('R', 'G', 'G', 'B')

#include <include/zephyr/drivers/video.h>

* | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | Rrrrrrrr | Gggggggg | ...
* | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | Gggggggg | Bbbbbbbb | ...
* 

◆ VIDEO_PIX_FMT_XRGB32

#define VIDEO_PIX_FMT_XRGB32   VIDEO_FOURCC('B', 'X', '2', '4')

#include <include/zephyr/drivers/video.h>

The first byte is empty (X) for each pixel.

* | Xxxxxxxx Rrrrrrrr Gggggggg Bbbbbbbb | ...
* 

◆ VIDEO_PIX_FMT_XYUV32

#define VIDEO_PIX_FMT_XYUV32   VIDEO_FOURCC('X', 'Y', 'U', 'V')

#include <include/zephyr/drivers/video.h>

The first byte is empty (X) for each pixel.

* | Xxxxxxxx Yyyyyyyy Uuuuuuuu Vvvvvvvv | ...
* 

◆ VIDEO_PIX_FMT_YUYV

#define VIDEO_PIX_FMT_YUYV   VIDEO_FOURCC('Y', 'U', 'Y', 'V')

#include <include/zephyr/drivers/video.h>

There is either a missing channel per pixel, U or V.

The value is to be averaged over 2 pixels to get the value of individual pixel.

* | Yyyyyyyy Uuuuuuuu | Yyyyyyyy Vvvvvvvv | ...
* 

Function Documentation

◆ video_bits_per_pixel()

static unsigned int video_bits_per_pixel ( uint32_t  pixfmt)
inlinestatic

#include <include/zephyr/drivers/video.h>

Get number of bits per pixel of a pixel format.

Parameters
pixfmtFourCC pixel format value (Video pixel formats).
Return values
0if the format is unhandled or if it is variable number of bits
bitsize of one pixel for this format