feat(ppa): add PPA driver support for ESP32P4
Add fill operation Split ppa_do_operation, pre-process some trans config
This commit is contained in:
@@ -32,8 +32,6 @@ typedef struct ppa_invoker_t *ppa_invoker_handle_t;
|
||||
* @brief A collection of configuration items that used for registering a PPA invoker
|
||||
*/
|
||||
typedef struct {
|
||||
// ppa_engine_handle_t sr_engine;
|
||||
// ppa_engine_handle_t blend_engine;
|
||||
uint32_t engine_flag; /*!< Bitwise OR of `PPA_ENGINE_FLAG_*` flags indicating the required engines for the invoker */
|
||||
// done_cb
|
||||
// user_data
|
||||
@@ -69,49 +67,51 @@ typedef enum {
|
||||
PPA_TRANS_MODE_NON_BLOCKING, /*!< `ppa_do_xxx` function will return immediately after the PPA operation is pushed to the internal queue */
|
||||
} ppa_trans_mode_t;
|
||||
|
||||
#define PPA_SR_TRANS_CONFIG struct { \
|
||||
void *in_buffer; /*!< TODO: could be a buffer list, link descriptors together, process a batch
|
||||
uint32_t batch_num; However, is it necessary? psram can not store too many pictures */ \
|
||||
uint32_t in_pic_w; \
|
||||
uint32_t in_pic_h; \
|
||||
uint32_t in_block_w; \
|
||||
uint32_t in_block_h; \
|
||||
uint32_t in_block_offset_x; \
|
||||
uint32_t in_block_offset_y; \
|
||||
\
|
||||
void *out_buffer; /*!< TODO: alignment restriction */ \
|
||||
uint32_t out_pic_w; \
|
||||
uint32_t out_pic_h; \
|
||||
uint32_t out_block_offset_x; \
|
||||
uint32_t out_block_offset_y; \
|
||||
\
|
||||
ppa_sr_rotation_angle_t rotation_angle; \
|
||||
float scale_x; \
|
||||
float scale_y; \
|
||||
bool mirror_x; \
|
||||
bool mirror_y; \
|
||||
\
|
||||
struct { \
|
||||
ppa_sr_color_mode_t mode; \
|
||||
color_range_t yuv_range; \
|
||||
color_conv_std_rgb_yuv_t yuv_std; \
|
||||
bool rgb_swap; \
|
||||
bool byte_swap; \
|
||||
ppa_alpha_mode_t alpha_mode; \
|
||||
uint32_t alpha_value; /*!< When PPA_ALPHA_FIX_VALUE mode is selected, alpha_value is the alpha value to be replaced with (output_alpha = alpha_value)
|
||||
When PPA_ALPHA_SCALE mode is selected, alpha_value/256 is the multiplier to the input alpha value (output_alpha = input_alpha * alpha_value / 256)
|
||||
When other alpha modes are selected, this field is not used */ \
|
||||
} in_color; \
|
||||
\
|
||||
struct { \
|
||||
ppa_sr_color_mode_t mode; \
|
||||
color_range_t yuv_range; \
|
||||
color_conv_std_rgb_yuv_t yuv_std; \
|
||||
} out_color; \
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief A collection of configuration items to perform a PPA SR operation
|
||||
*/
|
||||
typedef struct {
|
||||
void *in_buffer; // TODO: could be a buffer list, link descriptors together, process a batch
|
||||
// uint32_t batch_num; // However, is it necessary? psram can not store too many pictures
|
||||
uint32_t in_pic_w;
|
||||
uint32_t in_pic_h;
|
||||
uint32_t in_block_w;
|
||||
uint32_t in_block_h;
|
||||
uint32_t in_block_offset_x;
|
||||
uint32_t in_block_offset_y;
|
||||
|
||||
void *out_buffer; // TODO: alignment restriction
|
||||
uint32_t out_pic_w;
|
||||
uint32_t out_pic_h;
|
||||
uint32_t out_block_offset_x;
|
||||
uint32_t out_block_offset_y;
|
||||
|
||||
ppa_sr_rotation_angle_t rotation_angle;
|
||||
float scale_x;
|
||||
float scale_y;
|
||||
bool mirror_x;
|
||||
bool mirror_y;
|
||||
|
||||
struct {
|
||||
ppa_sr_color_mode_t mode;
|
||||
color_range_t yuv_range;
|
||||
color_conv_std_rgb_yuv_t yuv_std;
|
||||
bool rgb_swap;
|
||||
bool byte_swap;
|
||||
ppa_alpha_mode_t alpha_mode;
|
||||
uint32_t alpha_value; /*!< When PPA_ALPHA_FIX_VALUE mode is selected, alpha_value is the alpha value to be replaced with (output_alpha = alpha_value)
|
||||
When PPA_ALPHA_SCALE mode is selected, alpha_value/256 is the multiplier to the input alpha value (output_alpha = input_alpha * alpha_value / 256)
|
||||
When other alpha modes are selected, this field is not used */
|
||||
} in_color;
|
||||
|
||||
struct {
|
||||
ppa_sr_color_mode_t mode;
|
||||
color_range_t yuv_range;
|
||||
color_conv_std_rgb_yuv_t yuv_std;
|
||||
} out_color;
|
||||
} ppa_sr_trans_config_t;
|
||||
typedef PPA_SR_TRANS_CONFIG ppa_sr_trans_config_t;
|
||||
|
||||
/**
|
||||
* @brief Perform a scaling-and-rotating (SR) operation to a picture
|
||||
@@ -191,9 +191,22 @@ typedef struct {
|
||||
*/
|
||||
esp_err_t ppa_do_blend(ppa_invoker_handle_t ppa_invoker, const ppa_blend_trans_config_t *config, ppa_trans_mode_t mode);
|
||||
|
||||
// TODO: FILL
|
||||
typedef struct {
|
||||
uint32_t fill_block_w;
|
||||
uint32_t fill_block_h;
|
||||
uint32_t fill_argb_color; /*!< The color to be filled, in ARGB8888 format ((A[31:24], R[23:16], G[15: 8], B[7:0])) */
|
||||
|
||||
void *out_buffer;
|
||||
uint32_t out_pic_w;
|
||||
uint32_t out_pic_h;
|
||||
uint32_t out_block_offset_x;
|
||||
uint32_t out_block_offset_y;
|
||||
|
||||
struct {
|
||||
ppa_blend_color_mode_t mode;
|
||||
} out_color;
|
||||
|
||||
// colorkey???
|
||||
} ppa_fill_trans_config_t;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user