ss928_framework/libapi/ive/libapi_common_ive.h
2024-12-16 13:31:45 +08:00

181 lines
5.2 KiB
C
Executable File

/*
Copyright (c), 2001-2022, Shenshu Tech. Co., Ltd.
*/
#ifndef LIBAPI_COMMON_IVE_H
#define LIBAPI_COMMON_IVE_H
#include "ot_common_svp.h"
#include "ot_common_ive.h"
#include "ss_mpi_ive.h"
#include "sample_comm.h"
#include "libapi_common_svp.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#define OT_VIDEO_WIDTH 352
#define OT_VIDEO_HEIGHT 288
#define OT_IVE_ALIGN 16
#define OT_IVE_CHAR_CALW 8
#define OT_IVE_CHAR_CALH 8
#define OT_IVE_CHAR_NUM (OT_IVE_CHAR_CALW * OT_IVE_CHAR_CALH)
#define OT_IVE_FILE_NAME_LEN 256
#define OT_VPSS_CHN_NUM 2
#define OT_MAX_LOOP_IMG_H 3
#define OT_MACRO_IVE_IMAGE_CHN_ONE 1
#define OT_MACRO_IVE_IMAGE_CHN_TWO 2
#define OT_MACRO_IVE_IMAGE_CHN_THREE 3
#define OT_MACRO_IVE_IMAGE_CHN_FOUR 4
#define OT_MACRO_IVE_MAX_CCL_REGION_NUM 254
#define OT_MACRO_IVE_DIV_TWO 2
#define OT_MACRO_POINT_IDX_ZERO 0
#define OT_MACRO_POINT_IDX_ONE 1
#define OT_MACRO_POINT_IDX_TWO 2
#define OT_MACRO_POINT_IDX_THREE 3
#define OT_MACRO_ADDR_IDX_ZERO 0
#define OT_MACRO_ADDR_IDX_ONE 1
#define OT_MACRO_ADDR_IDX_TWO 2
#define OT_MACRO_IVE_MAX_POOL_CNT 128
#define OT_MACRO_IVE_DRAW_THICK 2
#define OT_MACRO_IVE_PIPE_IDX_ZERO 0
#define OT_MACRO_IVE_PIPE_IDX_ONE 1
#define OT_MACRO_IVE_PIPE_IDX_TWO 2
#define OT_MACRO_IVE_PIPE_IDX_THREE 3
#define OT_MACRO_IVE_1080P_WIDTH 1920
#define OT_MACRO_IVE_1080P_HEIGHT 1080
#define OT_MACRO_IVE_MASK_NUM 25
#define OT_MACRO_IDX_ZERO 0
#define OT_MACRO_IDX_ONE 1
#define OT_MACRO_IDX_TWO 2
#define OT_MACRO_IDX_THREE 3
#define OT_MACRO_IDX_FOUR 4
#define OT_MACRO_IDX_FIVE 5
#define OT_MACRO_NUM_ZERO 0
#define OT_MACRO_NUM_ONE 1
#define OT_MACRO_NUM_TWO 2
#define OT_MACRO_NUM_THREE 3
#define OT_MACRO_NUM_FOUR 4
#define OT_MACRO_NUM_FIVE 5
#define OT_MACRO_NUM_SEVEN 7
#define OT_MACRO_QUARTER_OF_1M 256
#define OT_MACRO_1M 1024
#define OT_MACRO_4M (4 * 1024)
#define OT_MACRO_MAX_SRC_FRAME_RATE 30
#define OT_MACRO_MAX_DST_FRAME_RATE 30
#define ot_macro_align_back(x, a) ((a) * (((x) / (a))))
#define ot_macro_ive_max(a, b) (((a) > (b)) ? (a) : (b))
#define ot_macro_ive_min(a, b) (((a) < (b)) ? (a) : (b))
typedef struct {
td_s32 linear_num;
td_s32 thresh_num;
ot_point *linear_point;
} ot_struct_ive_linear_data;
typedef struct {
td_u32 ele_size; /* element size */
td_u32 loop_c; /* loop times of c dimension */
td_u32 loop_h[OT_SVP_IMG_ADDR_NUM]; /* loop times of h dimension */
} ot_struct_rw_image_loop_info;
typedef struct {
ot_size src;
ot_size dst;
} ot_struct_src_dst_size;
/*
* function : Mpi check init
*/
td_s32 libapi_common_ive_check_mpi_init(td_void);
/*
* function : Mpi init
*/
td_s32 libapi_common_ive_mpi_init(td_void);
/*
* function : Mpi exit
*/
td_void libapi_common_ive_mpi_exit(td_void);
/*
* function :Read file
*/
td_s32 libapi_common_ive_read_file(ot_svp_img *img, FILE *fp);
/*
* function :Write file
*/
td_s32 libapi_common_ive_write_file(ot_svp_img *img, FILE *fp);
/*
* function :Read os_mem
*/
td_s32 libapi_common_ive_read_os_mem(ot_svp_img *img, td_void *src, td_u32 whidh, td_u32 height, td_u32 img_type);
/*
* function :Write os_mem
*/
td_s32 libapi_common_ive_write_os_mem(ot_svp_img *img, td_void *tar);
/*
* function :Calc stride
*/
td_u32 libapi_common_ive_calc_stride(td_u32 width, td_u8 align);
/*
* function : Copy blob to rect
*/
td_s32 libapi_common_ive_blob_to_rect(ot_ive_ccblob *blob, ot_struct_svp_rect_info *rect,
td_u16 rect_max_num, td_u16 area_thr_step, ot_struct_src_dst_size src_dst_size);
/*
* function : Create ive image
*/
td_s32 libapi_common_ive_create_image(ot_svp_img *img, ot_svp_img_type type,
td_u32 width, td_u32 height);
/*
* function : Destroy ive image
*/
td_s32 libapi_common_ive_destroy_image(ot_svp_img *img);
/*
* function : Create memory info
*/
td_s32 libapi_common_ive_create_mem_info(ot_svp_mem_info *mem_info, td_u32 size);
/*
* function : Destroy memory info
*/
td_s32 libapi_common_ive_destroy_mem_info(ot_svp_mem_info *mem_info);
/*
* function : Create ive image by cached
*/
td_s32 libapi_common_ive_create_image_by_cached(ot_svp_img *img,
ot_svp_img_type type, td_u32 width, td_u32 height);
/*
* function : Dma frame info to ive image
*/
td_s32 libapi_common_ive_dma_image(ot_video_frame_info *frame_info, ot_svp_dst_img *dst,
td_bool is_instant);
#endif