上传文件至 /
parent
47147b4005
commit
c03ad9d799
|
@ -0,0 +1,39 @@
|
|||
#ifndef __DRM_FUNC_H__
|
||||
#define __DRM_FUNC_H__
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <sys/fcntl.h>// open function
|
||||
#include <unistd.h> // close function
|
||||
#include <errno.h>
|
||||
#include <sys/mman.h>
|
||||
|
||||
|
||||
#include <linux/input.h>
|
||||
#include "libdrm/drm_fourcc.h"
|
||||
#include "xf86drm.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int (* FUNC_DRM_IOCTL)(int fd, unsigned long request, void *arg);
|
||||
|
||||
typedef struct _drm_context{
|
||||
void *drm_handle;
|
||||
FUNC_DRM_IOCTL io_func;
|
||||
} drm_context;
|
||||
|
||||
int drm_init(drm_context *drm_ctx);
|
||||
|
||||
void* drm_buf_alloc(drm_context *drm_ctx,int drm_fd, int TexWidth, int TexHeight,int bpp,int *fd,unsigned int *handle,size_t *actual_size);
|
||||
|
||||
int drm_buf_destroy(drm_context *drm_ctx,int drm_fd,int buf_fd, int handle,void *drm_buf,size_t size);
|
||||
|
||||
void drm_deinit(drm_context *drm_ctx, int drm_fd);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /*__DRM_FUNC_H__*/
|
|
@ -0,0 +1,34 @@
|
|||
#ifndef __RGA_FUNC_H__
|
||||
#define __RGA_FUNC_H__
|
||||
|
||||
#include <dlfcn.h>
|
||||
#include "RgaApi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef int(* FUNC_RGA_INIT)();
|
||||
typedef void(* FUNC_RGA_DEINIT)();
|
||||
typedef int(* FUNC_RGA_BLIT)(rga_info_t *, rga_info_t *, rga_info_t *);
|
||||
|
||||
typedef struct _rga_context{
|
||||
void *rga_handle;
|
||||
FUNC_RGA_INIT init_func;
|
||||
FUNC_RGA_DEINIT deinit_func;
|
||||
FUNC_RGA_BLIT blit_func;
|
||||
} rga_context;
|
||||
|
||||
int RGA_init(rga_context* rga_ctx);
|
||||
|
||||
void img_resize_fast(rga_context *rga_ctx, int src_fd, int src_w, int src_h, uint64_t dst_phys, int dst_w, int dst_h);
|
||||
|
||||
void img_resize_slow(rga_context *rga_ctx, void *src_virt, int src_w, int src_h, void *dst_virt, int dst_w, int dst_h, int w_offset,
|
||||
int h_offset, RgaSURF_FORMAT color, bool add_extra_sz_w, bool add_extra_sz_h);
|
||||
|
||||
int RGA_deinit(rga_context* rga_ctx);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif/*__RGA_FUNC_H__*/
|
|
@ -0,0 +1,47 @@
|
|||
#ifndef _YOLOV5_DETECT_H_
|
||||
#define _YOLOV5_DETECT_H_
|
||||
|
||||
#include "yolov5_detect_postprocess.h"
|
||||
#include "rknn_api.h"
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
|
||||
// 标准库中的base64编码器
|
||||
static const std::string base64_chars =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz"
|
||||
"0123456789+/";
|
||||
|
||||
std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len);
|
||||
|
||||
static inline bool is_base64(unsigned char c) ;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* yolov5检测初始化函数
|
||||
* ctx:输入参数,rknn_context句柄
|
||||
* path:输入参数,算法模型路径
|
||||
*/
|
||||
int yolov5_detect_init(rknn_context *ctx, const char * path);
|
||||
|
||||
|
||||
/*
|
||||
* yolov5检测执行函数
|
||||
* ctx:输入参数,rknn_context句柄
|
||||
* input_image:输入参数,图像数据输入(cv::Mat是Opencv的类型)
|
||||
* output_dets:输出参数,目标检测框输出
|
||||
*/
|
||||
int yolov5_detect_run(rknn_context ctx, cv::Mat input_image, yolov5_detect_result_group_t *detect_result_group);
|
||||
|
||||
|
||||
/*
|
||||
* yolov5检测释放函数
|
||||
* ctx:输入参数,rknn_context句柄
|
||||
*/
|
||||
int yolov5_detect_release(rknn_context ctx);
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,43 @@
|
|||
#ifndef _YOLOV5_DETECT_POSTPROCESS_H_
|
||||
#define _YOLOV5_DETECT_POSTPROCESS_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define YOLOV5_NAME_MAX_SIZE 16
|
||||
#define YOLOV5_NUMB_MAX_SIZE 200
|
||||
#define YOLOV5_CLASS_NUM 2
|
||||
#define YOLOV5_PROP_BOX_SIZE (5+YOLOV5_CLASS_NUM)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int left;
|
||||
int right;
|
||||
int top;
|
||||
int bottom;
|
||||
} YOLOV5_BOX_RECT;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
char name[YOLOV5_NAME_MAX_SIZE];
|
||||
int class_index;
|
||||
YOLOV5_BOX_RECT box;
|
||||
float prop;
|
||||
} yolov5_detect_result_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int id;
|
||||
int count;
|
||||
yolov5_detect_result_t results[YOLOV5_NUMB_MAX_SIZE];
|
||||
} yolov5_detect_result_group_t;
|
||||
|
||||
int yolov5_post_process_u8(uint8_t *input0, uint8_t *input1, uint8_t *input2, int model_in_h, int model_in_w,
|
||||
float conf_threshold, float nms_threshold,
|
||||
std::vector<uint8_t> &qnt_zps, std::vector<float> &qnt_scales,
|
||||
yolov5_detect_result_group_t *group);
|
||||
|
||||
int yolov5_post_process_fp(float *input0, float *input1, float *input2, int model_in_h, int model_in_w,
|
||||
float conf_threshold, float nms_threshold,
|
||||
yolov5_detect_result_group_t *group);
|
||||
|
||||
#endif //_RKNN_ZERO_COPY_DEMO_POSTPROCESS_H_
|
Loading…
Reference in New Issue