Updated: April 19, 2023

A frame descriptor for a YCbCr 4:2:2 packed frame type


#include <camera/camera_api.h>
typedef struct {
    uint64_t bufsize;
    uint32_t height;
    uint32_t width;
    uint32_t stride;
    uint32_t packing;
    uint32_t bpp;
    bool le;
} camera_frame_cbycry_t;


uint64_t bufsize
The size of the buffer as a 64-bit integer.
uint32_t height
The height of the image, in pixels.
uint32_t width
The width of the image, in pixels.
uint32_t stride
The number of bytes, in memory, between the first pixel of the first row and the first pixel of the second row.

Stride is often called pitch.

uint32_t packing
The inter-pixel distance, in bits.
uint32_t bpp
The number of bits used to encode a pixel value.
bool le
Whether little-endian is used to pack the frame.

When le is true, the bytes are packed in little-endian; when le is false, the bytes are packed in big-endian.




Use this frame descriptor when CAMERA_FRAMETYPE_CBYCRY is reported as the camera_frametype_t.

Each set of two pixel values in the CbYCrY frame makes up a macro-pixel. Each pixel consists of a chroma (Cb or Cr) component and a luma (Y) component, and contains bpp bits of component data that's stored in packing bits. The endian order le indicates if the bit packing was done in little-endian or big-endian order.

Each macro-pixel is therefore made up of four components in the following order: a Cb (blue-difference chroma) component, a Y (luma) component, a Cr (red-difference chroma) component, and a Y (luma) component. Each macro-pixel is stored contiguously on the same line.

For example, le = true, bpp = 16, and packing = 16 describes a macro-pixel stored as follows:
 Bit:        0 1 2 3 4 5 6 7  01234567 0 1 2 3 4 5 6 7  01234567
 Scanline n: CbCbCbCbCbCbCbCb YYYYYYYY CrCrCrCrCrCrCrCr YYYYYYYY = 32 bits