libcamera::PixelFormatInfo Class Reference

Information about pixel formats. More...

## Public Types

enum | ColourEncoding { ColourEncodingRGB , ColourEncodingYUV , ColourEncodingRAW }
| The colour encoding type. More...

## Public Member Functions

bool | isValid () const
| Check if the pixel format info is valid. More...

## Static Public Member Functions

static const PixelFormatInfo & | info (const PixelFormat &format)
| Retrieve information about a pixel format. More...

## Public Attributes

const char * | name
| The format name as a human-readable string, used as the test representation of the PixelFormat.
PixelFormat | format
| The PixelFormat described by this instance.
V4L2PixelFormat | v4l2Format
| The V4L2 pixel format corresponding to the PixelFormat.
unsigned int | bitsPerPixel
| The average number of bits per pixel. More...
enum ColourEncoding | colourEncoding
| The colour encoding type.
bool | packed
| Tell if multiple pixels are packed in the same bytes. More...

## Detailed Description

Information about pixel formats.

The PixelFormatInfo class groups together information describing a pixel format. It facilitates handling of pixel formats by providing data commonly used in pipeline handlers.

## Member Enumeration Documentation

## ColourEncoding

enum libcamera::PixelFormatInfo::ColourEncoding

The colour encoding type.

Enumerator
ColourEncodingRGB | RGB colour encoding.
ColourEncodingYUV | YUV colour encoding.
ColourEncodingRAW | RAW colour encoding.

## Member Function Documentation

## info()

const PixelFormatInfo & libcamera::PixelFormatInfo::info | ( | const PixelFormat & | format | ) |

static

Retrieve information about a pixel format.

Parameters

  [in] | format | The pixel format

Returns
  The PixelFormatInfo describing the format if known, or an invalid PixelFormatInfo otherwise

## isValid()

bool libcamera::PixelFormatInfo::isValid | ( |  | ) | const

inline

Check if the pixel format info is valid.

Returns
  True if the pixel format info is valid, false otherwise

## Member Data Documentation

## bitsPerPixel

libcamera::PixelFormatInfo::bitsPerPixel

The average number of bits per pixel.

The number per pixel averages the total number of bits for all colour components over the whole image, excluding any padding bits or padding pixels.

For formats that store pixels with bit padding within words, only the effective bits are taken into account. For instance, 12-bit Bayer data stored in two bytes per pixel report 12, not 16, in this field.

Formats that don't have a fixed number of bits per pixel, such as compressed formats, report 0 in this field.

## packed

libcamera::PixelFormatInfo::packed

Tell if multiple pixels are packed in the same bytes.

Packed formats are defined as storing data from multiple pixels in the same bytes. For instance, 12-bit Bayer data with two pixels stored in three bytes is packed, while the same data stored with 4 bits of padding in two bytes per pixel is not packed.

The documentation for this class was generated from the following files:

- include/libcamera/internal/formats.h
- src/libcamera/formats.cpp