# 像素处理加速器 (PPA)

## 简介

ESP32-P4 含有像素处理加速器 (PPA) 模块，用于实现图像旋转、缩放、镜像和叠加等图像算法的硬件加速。

## 术语表

与 PPA 驱动程序相关的术语可参见下表及下图。

术语 | 定义
--- | ---
图片 (pic) | 存储在系统内存中的完整图像。
块 | 从图片中裁剪出的一部分，其最大尺寸等于整个图片。
像素 | 在 PPA 环境中使用的单位。
PPA 操作 | 图像算法加速的类型，包括缩放-旋转-镜像 (SRM)、叠加和填充。
PPA 客户端 | 执行 PPA 操作的主体。通常，每个 PPA 客户端由特定任务持有。
PPA 事务 | 来自 PPA 客户端的一次 PPA 操作请求即为一次 PPA 事务。

PPA 图片/块术语

## 功能概述

以下部分详细介绍了 PPA 驱动程序的设计：

- 注册 PPA 客户端 - 涵盖如何注册 PPA 客户端来执行一切 PPA 操作。

- 注册 PPA 事件回调函数 - 涵盖如何将用户特定代码挂接到 PPA 驱动程序事件回调函数。

- 执行 PPA 操作 - 涵盖如何执行 PPA 操作。

- 线程安全- 涵盖在线程安全方面使用 PPA 操作 API 的情况。

- 性能概述 - 涵盖 PPA 操作的性能。

### 注册 PPA 客户端

执行 PPA 操作的请求由 PPA 客户端发出。因此，在进行 PPA 操作之前应先注册 PPA 客户端。调用 `ppa_register_client()` 函数注册一个新客户端。使用 `ppa_client_config_t` 结构体来指定客户端的属性。

- `ppa_client_config_t::oper_type` - 每种 PPA 操作类型对应一个 PPA 客户端类型，已注册的 PPA 客户端只能请求一种特定类型的 PPA 操作。

- `ppa_client_config_t::max_pending_trans_num` - 决定客户端可以持有的最大 PPA 事务挂起数量。

建议为每个任务注册一个独立的 PPA 客户端。例如，一个应用程序包含两个任务：任务 A 需要使用 PPA SRM 和 PPA 填充功能，则应在该任务中注册一个 PPA SRM 客户端和一个 PPA 填充客户端；而任务 B 也需要使用 PPA SRM 功能，那么在任务 B 中应再注册一个 PPA SRM 客户端。

如果任务不再需要执行 PPA 操作，可以调用 `ppa_unregister_client()` 函数注销相应的 PPA 客户端。

### 注册 PPA 事件回调函数

当某个事件发生时（例如，完成一个 PPA 事务时），CPU 会通过中断接收到该事件的通知。如果需要在特定事件发生时调用某些特定函数，可以通过调用 `ppa_client_register_event_callbacks()` 为该事件注册回调函数。这在选择 `PPA_TRANS_MODE_NON_BLOCKING` 模式来执行 PPA 操作时特别有用。需要注意的是，虽然事件回调函数与 PPA 客户端绑定，但用户上下文是在调用 PPA 操作 API 时按事务提供的，这使事件回调函数能被更灵活得运用。

已注册的回调函数在中断上下文中被调用，因此，要遵循中断服务程序 (ISR) 的一般规则。

### 执行 PPA 操作

注册好 PPA 客户端，就可以用返回的 `ppa_client_handle_t` 来请求执行 PPA 操作。

PPA 操作包括：

#### 缩放、旋转、镜像 (SRM)

调用 `ppa_do_scale_rotate_mirror()` 对图片内部的目标块执行缩放、旋转、镜像中的一个或多个操作。

注意以下几点事项，避免在配置 `ppa_srm_oper_config_t` 时产生混淆：

- 执行 SRM 操作时，`ppa_in_pic_blk_config_t::buffer` 和 `ppa_out_pic_blk_config_t::buffer` 必须是指向不同图片 buffer 的指针。

- `ppa_srm_oper_config_t::scale_x` 和 `ppa_srm_oper_config_t::scale_y` 的精度将被截断为 1/16 的步长。

- 输出块的宽度/高度完全由输入块的宽度/高度、缩放因子和旋转角度决定，因此无需配置输出块的宽度/高度。但请确保输出块可以适应输出图片中的偏移位置。

- 如果输入或输出图片的色彩模式为 `PPA_SRM_COLOR_MODE_YUV420`，那么其 `pic_w`、`pic_h`、`block_w`、`block_h`、`block_offset_x` 以及 `block_offset_y` 字段必须为偶数。

#### 叠加

调用 `ppa_do_blend()` 将前景 (FG) 和背景 (BG) 图片的两个目标块进行叠加。

叠加遵循一般的 Alpha Blending 公式：

\(A_{out} = A_b + A_f - A_b \times A_f\)

\(C_{out} = (C_b \times A_b \times (1 - A_f) + C_f \times A_f) / (A_b + A_f - A_b \times A_f)\)

其中 \(A_b\) 是背景层的 Alpha 通道，\(A_f\) 是前景层的 Alpha 通道，\(C_b\) 对应背景层的 R、G、B 分量，\(C_f\) 对应前景层的 R、G、B 分量。

注意，此公式对 FG 和 BG 的处理是不对称的。当 \(A_f = 1\) 时， \(C_{out} = C_f\)，\(A_{out} = 1\)，这意味着如果 FG 图片的色彩模式为 `PPA_BLEND_COLOR_MODE_RGB565` 或 `PPA_BLEND_COLOR_MODE_RGB888`，PPA 硬件会填充 Alpha 值为 255（即 \(A_f = 1\)），叠加结果将与 FG 块相同。

如果将 `ppa_blend_oper_config_t::bg_ck_en` 或 `ppa_blend_oper_config_t::fg_ck_en` 设置为 `true`，则色键（color-key，也叫 Chroma-key）范围内的像素不会按照正常 Alpha Blending 流程输出。请查看 ESP32-P4 技术参考手册 > 像素处理加速器 (PPA) > 功能描述 > 图层叠加 (BLEND) [PDF] 了解详细规则。

注意以下几点事项，避免在配置 `ppa_blend_oper_config_t` 时产生混淆：

- 执行叠加操作时，`ppa_out_pic_blk_config_t::buffer` 与输入的 `ppa_in_pic_blk_config_t::buffer` 之一可以是指向相同图片 buffer 的指针。

- FG 和 BG 的块宽度/高度应相同，输出块的宽度/高度值应与之一致。

- 如果输入图片的色彩模式为 `PPA_BLEND_COLOR_MODE_A4`，那么其 `block_w` 和 `block_offset_x` 字段必须为偶数。

#### 填充

调用 `ppa_do_fill()` 填充图片内部的目标块。

`ppa_trans_mode_t` 为可配置字段，适用于所有 PPA 操作 API。可以配置该字段，在调用 PPA 操作 API 时等待操作完成后再返回，或者在事务推送到内部队列后立即返回。

### 线程安全

在以下情境中调用 PPA 操作 API，PPA 驱动程序可确保线程安全：

- 同一任务中不同类型的客户端之间

- 不同任务中同一类型的客户端之间

- 不同任务中不同类型的客户端之间

### 性能概述

PPA 操作作用于输入图片的目标块。因此，完成一次 PPA 事务所需的时间与块中的数据量成正比。整个图片的大小对性能没有影响。更重要的是，如果图片位于 PSRAM，则 PPA 的性能高度依赖于 PSRAM 的带宽。若有多个外设同时读写 PSRAM，则 PPA 操作的性能将大大降低。

### 应用示例

- peripherals/ppa/ppa_dsi - 使用 DSI 显示屏的 PPA 示例。首先，该示例所使用的图像会被放大、逆时针旋转后复原、镜像后复原、缩小。其次，该图像将与一个透明度较低的全红图像叠加，ESP32 字样将被色键移除。最后，会在 ESP32 周围填充一个框。

## API 参考

### Header File

- components/esp_driver_ppa/include/driver/ppa.h

- This header file can be included with:

  >     #include "driver/ppa.h"

- This header file is a part of the API provided by the `esp_driver_ppa` component. To declare that your component depends on `esp_driver_ppa`, add the following to your CMakeLists.txt:

  >     REQUIRES esp_driver_ppa

  > or

  >     PRIV_REQUIRES esp_driver_ppa

### Functions

esp_err_t ppa_register_client(const ppa_client_config_t *config, ppa_client_handle_t *ret_client)

  Register a PPA client to do a specific PPA operation.

  参数:

    - config -- [in] Pointer to a collection of configurations for the client

    - ret_client -- [out] Returned client handle

  返回:

    - ESP_OK: Register the PPA client successfully

    - ESP_ERR_INVALID_ARG: Register the PPA client failed because of invalid argument

    - ESP_ERR_NO_MEM: Register the PPA client failed because out of memory

    - ESP_FAIL: Register the PPA client failed because of other error

esp_err_t ppa_unregister_client(ppa_client_handle_t ppa_client)

  Unregister a PPA client.

  备注

  This will also free the resources occupied by the client

  参数:

    ppa_client -- [in] PPA client handle, allocated by `ppa_register_client`

  返回:

    - ESP_OK: Unregister the PPA client successfully

    - ESP_ERR_INVALID_ARG: Unregister the PPA client failed because of invalid argument

    - ESP_ERR_INVALID_STATE: Unregister the PPA client failed because there are unfinished transactions

esp_err_t ppa_client_register_event_callbacks(ppa_client_handle_t ppa_client, const ppa_event_callbacks_t *cbs)

  Register event callbacks for a PPA client.

  备注

  Any user private data that wants to be passed directly to callback's user_data is provided per PPA transaction. Please check the `user_data` field in `ppa_xxx_oper_config_t` structure.

  参数:

    - ppa_client -- [in] PPA client handle

    - cbs -- [in] Structure with all PPA callbacks

  返回:

    - ESP_OK: Register event callbacks for the PPA client successfully

    - ESP_ERR_INVALID_ARG: Register event callbacks for the PPA client failed because of invalid argument

esp_err_t ppa_do_scale_rotate_mirror(ppa_client_handle_t ppa_client, const ppa_srm_oper_config_t *config)

  Perform a scaling-rotating-mirroring (SRM) operation to a picture.

  参数:

    - ppa_client -- [in] PPA client handle that has been registered to do SRM operations

    - config -- [in] Pointer to a collection of configurations for the SRM operation transaction, ppa_srm_oper_config_t

  返回:

    - ESP_OK: Perform a SRM operation successfully

    - ESP_ERR_INVALID_ARG: Perform a SRM operation failed because of invalid argument

    - ESP_FAIL: Perform a SRM operation failed because the client's pending transactions has reached its maximum capacity

esp_err_t ppa_do_blend(ppa_client_handle_t ppa_client, const ppa_blend_oper_config_t *config)

  Perform a blending operation to a picture.

  参数:

    - ppa_client -- [in] PPA client handle that has been registered to do blend operations

    - config -- [in] Pointer to a collection of configurations for the blend operation transaction, ppa_blend_oper_config_t

  返回:

    - ESP_OK: Perform a blend operation successfully

    - ESP_ERR_INVALID_ARG: Perform a blend operation failed because of invalid argument

    - ESP_FAIL: Perform a blend operation failed because the client's pending transactions has reached its maximum capacity

esp_err_t ppa_do_fill(ppa_client_handle_t ppa_client, const ppa_fill_oper_config_t *config)

  Perform a filling operation to a picture.

  参数:

    - ppa_client -- [in] PPA client handle that has been registered to do fill operations

    - config -- [in] Pointer to a collection of configurations for the fill operation transaction, ppa_fill_oper_config_t

  返回:

    - ESP_OK: Perform a fill operation successfully

    - ESP_ERR_INVALID_ARG: Perform a fill operation failed because of invalid argument

    - ESP_FAIL: Perform a fill operation failed because the client's pending transactions has reached its maximum capacity

### Structures

struct ppa_client_config_t

  A collection of configuration items that used for registering a PPA client.

  Public Members

  ppa_operation_t oper_type

    The desired PPA operation for the client

  uint32_t max_pending_trans_num

    The maximum number of pending transactions for the client. By default, it will be 1, which is sufficient if all transactions are performed with `PPA_TRANS_MODE_BLOCKING`

  ppa_data_burst_length_t data_burst_length

    The desired data burst length for all the transactions of the client. Use a small burst length will decrease PPA performance, but can save burst bandwidth for other peripheral usages. By default, it will be at the maximum burst length, `PPA_DATA_BURST_LENGTH_128`

struct ppa_event_data_t

  Type of PPA event data.

struct ppa_event_callbacks_t

  Group of supported PPA callbacks.

  Public Members

  ppa_event_callback_t on_trans_done

    Invoked when a PPA transaction finishes

struct ppa_in_pic_blk_config_t

  A collection of configuration items for an input picture and the target block inside the picture.

  Public Members

  const void *buffer

    Pointer to the input picture buffer

  uint32_t pic_w

    Input picture width (unit: pixel)

  uint32_t pic_h

    Input picture height (unit: pixel)

  uint32_t block_w

    Target block width (unit: pixel)

  uint32_t block_h

    Target block height (unit: pixel)

  uint32_t block_offset_x

    Target block offset in x direction in the picture (unit: pixel)

  uint32_t block_offset_y

    Target block offset in y direction in the picture (unit: pixel)

  ppa_srm_color_mode_t srm_cm

    Color mode of the picture in a PPA SRM operation. Supported color mode in `ppa_srm_color_mode_t`

  ppa_blend_color_mode_t blend_cm

    Color mode of the picture in a PPA blend operation. Supported color mode in `ppa_blend_color_mode_t`

  ppa_fill_color_mode_t fill_cm

    Color mode of the picture in a PPA fill operation. Supported color mode in `ppa_fill_color_mode_t`

  ppa_color_range_t yuv_range

    When the color mode is any YUV color space, this field is to describe its color range

  ppa_color_conv_std_rgb_yuv_t yuv_std

    When the color mode is any YUV color space, this field is to describe its YUV<->RGB conversion standard

struct ppa_out_pic_blk_config_t

  A collection of configuration items for an output picture and the target block inside the picture.

  Public Members

  void *buffer

    Pointer to the output picture buffer (requires alignment: internal memory needs align to L1 cache line size, external memory needs align to L1 and L2 cache line size)

  uint32_t buffer_size

    Size of the output picture buffer (requires alignment: internal memory needs align to L1 cache line size, external memory needs align to L1 and L2 cache line size)

  uint32_t pic_w

    Output picture width (unit: pixel)

  uint32_t pic_h

    Output picture height (unit: pixel)

  uint32_t block_offset_x

    Target block offset in x direction in the picture (unit: pixel)

  uint32_t block_offset_y

    Target block offset in y direction in the picture (unit: pixel)

  ppa_srm_color_mode_t srm_cm

    Color mode of the picture in a PPA SRM operation. Supported color mode in `ppa_srm_color_mode_t`

  ppa_blend_color_mode_t blend_cm

    Color mode of the picture in a PPA blend operation. Supported color mode in `ppa_blend_color_mode_t`

  ppa_fill_color_mode_t fill_cm

    Color mode of the picture in a PPA fill operation. Supported color mode in `ppa_fill_color_mode_t`

  ppa_color_range_t yuv_range

    When the color mode is any YUV color space, this field is to describe its color range

  ppa_color_conv_std_rgb_yuv_t yuv_std

    When the color mode is any YUV color space, this field is to describe its YUV<->RGB conversion standard

struct ppa_srm_oper_config_t

  A collection of configuration items to do a PPA SRM operation transaction.

  Public Members

  ppa_in_pic_blk_config_t in

    Information of the input picture and the target block

  ppa_out_pic_blk_config_t out

    Information of the output picture and the target block

  ppa_srm_rotation_angle_t rotation_angle

    Rotation (counter-clockwise) to the target block, select from `ppa_srm_rotation_angle_t`

  float scale_x

    Scaling factor to the target block in the x direction

  float scale_y

    Scaling factor to the target block in the y direction

  bool mirror_x

    Whether to mirror the target block in the x direction

  bool mirror_y

    Whether to mirror the target block in the y direction

  bool rgb_swap

    Whether to swap the input data in RGB (e.g. ARGB becomes BGRA, RGB becomes BGR)

  bool byte_swap

    Whether to swap the input data in byte. Only available feature if input picture color mode is ARGB8888 or RGB565

  ppa_alpha_update_mode_t alpha_update_mode

    Select whether the alpha channel of the input picture needs update

  uint32_t alpha_fix_val

    Range: [0, 255] When PPA_ALPHA_FIX_VALUE mode is selected, alpha_fix_val is the new alpha value to replace the input alpha value (output_alpha = alpha_fix_val)

  float alpha_scale_ratio

    Range: (0, 1) When PPA_ALPHA_SCALE mode is selected, alpha_scale_ratio is the multiplier to the input alpha value (output_alpha = alpha_scale_ratio * input_alpha) Ratio resolution is 1/256

  ppa_trans_mode_t mode

    Determines whether to block inside the operation functions, see `ppa_trans_mode_t`

  void *user_data

    User registered data to be passed into `done_cb` callback function

struct ppa_blend_oper_config_t

  A collection of configuration items to do a PPA blend operation transaction.

  Public Members

  ppa_in_pic_blk_config_t in_bg

    Information of the input background picture and the target block

  ppa_in_pic_blk_config_t in_fg

    Information of the input foreground picture and the target block

  ppa_out_pic_blk_config_t out

    Information of the output picture and the target block

  bool bg_rgb_swap

    Whether to swap the background input data in RGB (e.g. ARGB becomes BGRA, RGB becomes BGR)

  bool bg_byte_swap

    Whether to swap the background input data in byte. Only available feature if input BG picture color mode is ARGB8888 or RGB565

  ppa_alpha_update_mode_t bg_alpha_update_mode

    Select whether the alpha channel of the input background picture needs update

  uint32_t bg_alpha_fix_val

    Range: [0, 255] When PPA_ALPHA_FIX_VALUE mode is selected, alpha_fix_val is the new alpha value to replace the input alpha value (output_alpha = alpha_fix_val)

  float bg_alpha_scale_ratio

    Range: (0, 1) When PPA_ALPHA_SCALE mode is selected, alpha_scale_ratio is the multiplier to the input alpha value (output_alpha = alpha_scale_ratio * input_alpha) Ratio resolution is 1/256

  bool fg_rgb_swap

    Whether to swap the foreground input data in RGB (e.g. ARGB becomes BGRA, RGB becomes BGR)

  bool fg_byte_swap

    Whether to swap the foreground input data in byte. Only available feature if input FG picture color mode is ARGB8888 or RGB565

  ppa_alpha_update_mode_t fg_alpha_update_mode

    Select whether the alpha channel of the input foreground picture needs update

  uint32_t fg_alpha_fix_val

    Range: [0, 255] When PPA_ALPHA_FIX_VALUE mode is selected, alpha_fix_val is the new alpha value to replace the input alpha value (output_alpha = alpha_fix_val)

  float fg_alpha_scale_ratio

    Range: (0, 1) When PPA_ALPHA_SCALE mode is selected, alpha_scale_ratio is the multiplier to the input alpha value (output_alpha = alpha_scale_ratio * input_alpha) Ratio resolution is 1/256

  color_pixel_rgb888_data_t fg_fix_rgb_val

    When in_fg.blend_cm is PPA_BLEND_COLOR_MODE_A8/4, this field can be used to set a fixed color for the foreground, in RGB888 format

  bool bg_ck_en

    Whether to enable color keying for background If not enabled, all background pixels are considered as out of the color-keying range

  color_pixel_rgb888_data_t bg_ck_rgb_low_thres

    The lower threshold of the color-keying range for the background, in RGB888 format

  color_pixel_rgb888_data_t bg_ck_rgb_high_thres

    The higher threshold of the color-keying range for the background, in RGB888 format

  bool fg_ck_en

    Whether to enable color keying for foreground If not enabled, all foreground pixels are considered as out of the color-keying range

  color_pixel_rgb888_data_t fg_ck_rgb_low_thres

    The lower threshold of the color-keying range for the foreground, in RGB888 format

  color_pixel_rgb888_data_t fg_ck_rgb_high_thres

    The higher threshold of the color-keying range for the foreground, in RGB888 format

  color_pixel_rgb888_data_t ck_rgb_default_val

    The color to overwrite when a pixel, where its background element and foreground element are both within their color-keying ranges, in RGB888 format

  bool ck_reverse_bg2fg

    If this bit is set, in color-keying, for the pixel, where its background element is in the color range, but its foreground element is not in the color range, it will output the foreground element instead of the background element

  ppa_trans_mode_t mode

    Determines whether to block inside the operation functions, see `ppa_trans_mode_t`

  void *user_data

    User registered data to be passed into `done_cb` callback function

struct ppa_fill_oper_config_t

  A collection of configuration items to do a PPA fill operation transaction.

  Public Members

  ppa_out_pic_blk_config_t out

    Information of the output picture and the target block

  uint32_t fill_block_w

    The width of the block to be filled (unit: pixel)

  uint32_t fill_block_h

    The height of the block to be filled (unit: pixel)

  color_pixel_argb8888_data_t fill_argb_color

    The color to be filled, in ARGB8888 format

  ppa_trans_mode_t mode

    Determines whether to block inside the operation functions, see `ppa_trans_mode_t`

  void *user_data

    User registered data to be passed into `done_cb` callback function

### Type Definitions

typedef struct ppa_client_t *ppa_client_handle_t

  Type of PPA client handle.

typedef bool (*ppa_event_callback_t)(ppa_client_handle_t ppa_client, ppa_event_data_t *event_data, void *user_data)

  Type of PPA event callback.

  Param ppa_client:

    [in] PPA client handle

  Param event_data:

    [in] PPA event data

  Param user_data:

    [in] User registered data from calling `ppa_do_xxx` to perform an operation

  Return:

    Whether a task switch is needed after the callback function returns, this is usually due to the callback wakes up some high priority task.

### Enumerations

enum ppa_operation_t

  Enumeration of all PPA available operations.

  Values:

  enumerator PPA_OPERATION_SRM

    Do scale-rotate-mirror operation

  enumerator PPA_OPERATION_BLEND

    Do blend operation

  enumerator PPA_OPERATION_FILL

    Do fill operation, use one constant pixel to fill a target window

  enumerator PPA_OPERATION_INVALID

    Invalid PPA operations, indicates the quantity of available PPA operations

enum ppa_trans_mode_t

  Modes to perform the PPA operations.

  Values:

  enumerator PPA_TRANS_MODE_BLOCKING

    `ppa_do_xxx` function will block until the PPA operation is finished

  enumerator PPA_TRANS_MODE_NON_BLOCKING

    `ppa_do_xxx` function will return immediately after the PPA operation is pushed to the internal queue

### Header File

- components/hal/include/hal/ppa_types.h

- This header file can be included with:

  >     #include "hal/ppa_types.h"

### Enumerations

enum ppa_engine_type_t

  Enumeration of engines in PPA modules.

  Values:

  enumerator PPA_ENGINE_TYPE_SRM

    PPA Scaling-Rotating-Mirroring (SRM) engine, used to perform scale, rotate, mirror

  enumerator PPA_ENGINE_TYPE_BLEND

    PPA Blending engine, used to perform blend or fill

enum ppa_srm_rotation_angle_t

  Enumeration of PPA Scaling-Rotating-Mirroring available rotation angle (in the counterclockwise direction)

  Values:

  enumerator PPA_SRM_ROTATION_ANGLE_0

    Picture does no rotation

  enumerator PPA_SRM_ROTATION_ANGLE_90

    Picture rotates 90 degrees CCW

  enumerator PPA_SRM_ROTATION_ANGLE_180

    Picture rotates 180 degrees CCW

  enumerator PPA_SRM_ROTATION_ANGLE_270

    Picture rotates 270 degrees CCW

enum ppa_srm_color_mode_t

  Enumeration of PPA Scaling-Rotating-Mirroring available color mode.

  Values:

  enumerator PPA_SRM_COLOR_MODE_ARGB8888

    PPA SRM color mode: ARGB8888

  enumerator PPA_SRM_COLOR_MODE_RGB888

    PPA SRM color mode: RGB888

  enumerator PPA_SRM_COLOR_MODE_RGB565

    PPA SRM color mode: RGB565

  enumerator PPA_SRM_COLOR_MODE_YUV420

    PPA SRM color mode: YUV420

  enumerator PPA_SRM_COLOR_MODE_YUV444

    PPA SRM color mode: YUV444 (limited range only)

enum ppa_blend_color_mode_t

  Enumeration of PPA blend available color mode.

  Values:

  enumerator PPA_BLEND_COLOR_MODE_ARGB8888

    PPA blend color mode: ARGB8888

  enumerator PPA_BLEND_COLOR_MODE_RGB888

    PPA blend color mode: RGB888

  enumerator PPA_BLEND_COLOR_MODE_RGB565

    PPA blend color mode: RGB565

  enumerator PPA_BLEND_COLOR_MODE_A8

    PPA blend color mode: A8, only available on blend foreground input

  enumerator PPA_BLEND_COLOR_MODE_A4

    PPA blend color mode: A4, only available on blend foreground input

enum ppa_fill_color_mode_t

  Enumeration of PPA fill available color mode.

  Values:

  enumerator PPA_FILL_COLOR_MODE_ARGB8888

    PPA fill color mode: ARGB8888

  enumerator PPA_FILL_COLOR_MODE_RGB888

    PPA fill color mode: RGB888

  enumerator PPA_FILL_COLOR_MODE_RGB565

    PPA fill color mode: RGB565

enum ppa_alpha_update_mode_t

  Enumeration of PPA alpha compositing update mode.

  Values:

  enumerator PPA_ALPHA_NO_CHANGE

    Do not replace alpha value (A' = A). If input format does not contain alpha info, alpha value 255 will be used.

  enumerator PPA_ALPHA_FIX_VALUE

    Replace the alpha value in received pixel with a new, fixed alpha value (A' = val)

  enumerator PPA_ALPHA_SCALE

    Scale the alpha value in received pixel to be a new alpha value (A' = (A * val) >> 8). If input format does not contain alpha info, A' = (255 * val) >> 8.

  enumerator PPA_ALPHA_INVERT

    Invert the alpha value in received pixel (A' = 255 - A). If input format does not contain alpha info, A' = 0, i.e. a layer with 0% opacity.

enum ppa_color_conv_std_rgb_yuv_t

  Enumeration of PPA supported color conversion standard between RGB and YUV (determines the YUV<->RGB conversion equation)

  Values:

  enumerator PPA_COLOR_CONV_STD_RGB_YUV_BT601

    YUV<->RGB conversion standard: BT.601

  enumerator PPA_COLOR_CONV_STD_RGB_YUV_BT709

    YUV<->RGB conversion standard: BT.709

enum ppa_color_range_t

  Enumeration of PPA supported color range (determines the YUV<->RGB conversion equation)

  Values:

  enumerator PPA_COLOR_RANGE_LIMIT

    Limited color range, 16 is the darkest black and 235 is the brightest white

  enumerator PPA_COLOR_RANGE_FULL

    Full color range, 0 is the darkest black and 255 is the brightest white

enum ppa_data_burst_length_t

  Enumeration of PPA supported data burst length.

  Values:

  enumerator PPA_DATA_BURST_LENGTH_8

    Data burst length: 8 bytes

  enumerator PPA_DATA_BURST_LENGTH_16

    Data burst length: 16 bytes

  enumerator PPA_DATA_BURST_LENGTH_32

    Data burst length: 32 bytes

  enumerator PPA_DATA_BURST_LENGTH_64

    Data burst length: 64 bytes

  enumerator PPA_DATA_BURST_LENGTH_128

    Data burst length: 128 bytes

此文档对您有帮助吗？

- 反馈已收到，谢谢！
- 如果您有其他意见，欢迎填写乐鑫文档反馈表。

- 我们重视您的反馈。
- 您可以填写乐鑫文档反馈表告诉我们如何改进该文档。