53 lines
1.7 KiB
C
53 lines
1.7 KiB
C
#ifndef VMF_NNM_INFERENCE_APP_H
|
|
#define VMF_NNM_INFERENCE_APP_H
|
|
|
|
#include <stdint.h>
|
|
#include "kp_struct.h"
|
|
#include "ncpu_gen_struct.h"
|
|
|
|
/* VMF alignment macros - used across VMF headers */
|
|
#ifndef VMF_ALIGN
|
|
#define VMF_ALIGN(x, n) (((x) + (n) - 1) & ~((n) - 1))
|
|
#define VMF_32_ALIGN(x) VMF_ALIGN(x, 32)
|
|
#define VMF_16_ALIGN(x) VMF_ALIGN(x, 16)
|
|
#define VMF_8_ALIGN(x) VMF_ALIGN(x, 8)
|
|
#define VMF_4_ALIGN(x) VMF_ALIGN(x, 4)
|
|
#endif
|
|
|
|
/* Image config for one input node */
|
|
typedef struct {
|
|
void *image_buf;
|
|
uint32_t image_width;
|
|
uint32_t image_height;
|
|
uint32_t image_channel;
|
|
kp_image_format_t image_format;
|
|
kp_normalize_mode_t image_norm;
|
|
kp_resize_mode_t image_resize;
|
|
kp_padding_mode_t image_padding;
|
|
uint32_t enable_crop; /* bool padded to 4 bytes */
|
|
struct {
|
|
uint32_t crop_number;
|
|
uint32_t x1;
|
|
uint32_t y1;
|
|
uint32_t width;
|
|
uint32_t height;
|
|
} crop_area;
|
|
} VMF_NNM_IMAGE_CONFIG_T;
|
|
|
|
/* Main inference config passed to VMF_NNM_Inference_App_Execute */
|
|
typedef struct {
|
|
int num_image;
|
|
VMF_NNM_IMAGE_CONFIG_T image_list[MAX_INPUT_NODE_COUNT];
|
|
uint32_t model_id;
|
|
int (*post_proc_func)(int model_id, struct kdp_image_s *image_p);
|
|
void *user_define_data;
|
|
void *ncpu_result_buf;
|
|
} VMF_NNM_INFERENCE_APP_CONFIG_T;
|
|
|
|
/* API */
|
|
void VMF_NNM_Inference_App_Init(void (*app_func)(int num_input_buf, void **inf_input_buf_list));
|
|
int VMF_NNM_Inference_App_Execute(VMF_NNM_INFERENCE_APP_CONFIG_T *inf_config);
|
|
void VMF_NNM_Inference_App_Destroy(void);
|
|
|
|
#endif /* VMF_NNM_INFERENCE_APP_H */
|