#ifndef __EXTEND_INTERFACE_H__ #define __EXTEND_INTERFACE_H__ /****************************************************** This is the IPC interface to support extended features without NPU involvement. Such as: IE operation, auxiliary computation, etc. ******************************************************/ #ifdef __cplusplus extern "C" { #endif #include "stdint.h" #ifndef BOOLEAN_DEFINED #ifndef boolean typedef char boolean; #endif #define BOOLEAN_DEFINED #endif #define MAX_INT_FOR_ALIGN 0x10000000 /************************************************************************* IE interfaces **************************************************************************/ #define CFG_IE_MESH_POINTS_ONLINE (DISABLE) typedef enum { OPERATION_FAILED = -1, /* Failure in doing operation */ OPERATION_SUCCESS = 1, /* Operation Succeded */ OPERATION_INVALID_PARM, /* Inavlid parameter provided */ OPERATION_NOT_SUPPORTED, /* Parameter/operation not supported */ OPERATION_ALIGN_32 = MAX_INT_FOR_ALIGN } ext_oper_sts_t; typedef enum { IE_OPS_MODE_ROTATION = 0x1, IE_OPS_MODE_DEWARP = 0x2, IE_OPS_MODE_AFFINE = 0x4, IE_OPS_MODE_ALIGN_32 = MAX_INT_FOR_ALIGN } ie_ops_mode_t; typedef enum { IE_ANGLE_OF_ROTATION_0 = 0, IE_ANGLE_OF_ROTATION_90 = 1, IE_ANGLE_OF_ROTATION_180 = 2, IE_ANGLE_OF_ROTATION_270 = 3, IE_ANGEL_OF_ROTATE_ALIGN_32 = MAX_INT_FOR_ALIGN } ie_angle_of_rotation_t; struct ie_control_points_info { uint8_t x; uint8_t y; }; struct ie_control_points { uint8_t cols; uint8_t rows; struct ie_control_points_info infos[64]; }; struct ie_affine_matrix { float val[2][3]; }; typedef struct ie_input_img_cfg { uint32_t imgfmt; uint32_t pad_mode; int width; int height; int stride; /* Crop parameters or other purposes */ int crop_top; int crop_bottom; int crop_left; int crop_right; /* Pad parameters or other purposes */ int pad_top; int pad_bottom; int pad_left; int pad_right; int flip_face; } ie_input_img_cfg_t; typedef struct ie_output_img_cfg { uint32_t imgfmt; int width; int height; int stride; } ie_output_img_cfg_t; typedef struct ie_ops_params { ie_ops_mode_t ops_mode __attribute__((aligned (4))); union { ie_angle_of_rotation_t angle_of_rotation __attribute__((aligned (4))); struct ie_affine_matrix affine; #if CFG_IE_MESH_POINTS_ONLINE == ENABLE struct ie_control_points ctrlps; #endif } u; } ie_ops_params_t; typedef struct ie_config { ie_ops_params_t ops_params; ie_input_img_cfg_t input_cfg; ie_output_img_cfg_t output_cfg; } ie_config_t; typedef struct { int frame_seq; ie_config_t ie_cfg; uint32_t in_buf_addr; uint32_t in_buf_len; uint32_t out_buf_addr; uint32_t out_buf_len; } ie_oper_params_t; typedef struct { int rslt_type; ext_oper_sts_t sts; /* output buf */ uint32_t out_buf_addr; uint32_t out_filled_len; int32_t seq_num; } ie_oper_result_t; /************************************************************************* Auxilary Computation Interfaces **************************************************************************/ typedef struct aux_compute_s { int compute_type; } aux_compute_config_t; typedef struct { int frame_seq; aux_compute_config_t aux_compute_cfg; uint32_t in_buf_addr; uint32_t in_buf_len; uint32_t out_buf_addr; uint32_t out_buf_len; } aux_compute_params_t; typedef struct { int rslt_type; ext_oper_sts_t sts; /* output buf */ uint32_t out_buf_addr; uint32_t out_filled_len; int32_t seq_num; } aux_compute_result_t; #endif