camera_frame_ycbcr420p_t

Updated: April 19, 2023

A frame descriptor used for a YCbCr 4:2:0 planar frame type

Synopsis:

#include <camera/camera_api.h>
typedef struct {
    uint32_t height;
    uint32_t width;
    uint32_t y_stride;
    int32_t cb_offset;
    int32_t cb_stride;
    int32_t cr_offset;
    int32_t cr_stride;
} camera_frame_ycbcr420p_t;

Data:

uint32_t height
The height of the frame in pixels.
uint32_t width
The width of the frame in pixels.
uint32_t y_stride
The number of bytes, in memory, between the first pixel of a given row and the first pixel of the next row of the luminance (Y) plane.

Stride is often called pitch.

int32_t cb_offset
The number of bytes, in memory, between the first pixel of the Y plane and the first pixel of the Cb plane.
int32_t cb_stride
The number of bytes, in memory, between the first pixel of a given row and the first pixel of the next row of the Cb plane.
int32_t cr_offset
The number of bytes, in memory, between the first pixel of the Y plane and the first pixel of the Cr plane.
int32_t cr_stride
The number of bytes, in memory, between the first pixel of a given row and the first pixel of the next row of the Cr plane.

Library:

libcamapi

Description:

Use this frame descriptor when CAMERA_FRAMETYPE_YCBCR420P is reported as the camera_frametype_t. The data is organized in memory as follows:
  • Y plane (luminance data) containing height lines of width luminance values, each line separated by y_stride bytes.
  • Cb plane (blue chrominance data) that is located cb_offset bytes after the start of the Y plane. It contains height/2 lines of width/2 chroma values, each line separated by cb_stride bytes.
  • Cr plane (red chrominance data) that is located cr_offset bytes after the start of the Y plane. It contains height/2 lines of width/2 chroma values, each line separated by cr_stride bytes.
  • each value (luminance and chrominance) consumes eight bits