header.h 19.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603
#pragma once

#ifdef _MSC_VER
#include <windows.h>
#else

#include <cstddef>

#endif

#include "sy_common.h"
#include <map>
#include <vector>

#define DETECTTYPE 9
// #define MTASK_DEBUG_

enum class algorithm_type_t {
    PLACEHOLDER = -2,
    UNKNOWN = -1,
    VIDEO_SNAPSHOT = 100, // 220802byzsh 视频快照
    FACE_SNAPSHOT = 101,
    VIDEO_TIMING_SNAPSHOT = 102,  // 230220byzsh 视频定时抓拍
    HUMAN_SNAPSHOT = 201,

    PEDESTRIAN_FALL = 202,
    PEDESTRIAN_FIGHT = 203,
    HUMAN_GATHER = 204,
    SMOKING_DET = 206,
    CALL_PHONE_DET = 207,
    NO_REFLECTIVE_CLOTHING = 208,
    NO_SAFETY_HELMET = 209,
    PEDESTRIAN_RETROGRADE = 210,
    PEDESTRIAN_TRESPASS = 211,
    ROAD_WORK_DET = 212, // 221026byzsh施工占道

    VEHICLE_SNAPSHOT = 301,
    VEHICLE_RETROGRADE = 310,
    VEHICLE_TRESPASS = 311,

    NONMOTOR_VEHICLE_SNAPSHOT = 401,
    TAKEAWAY_MEMBER_CLASSIFICATION = 402,

    NONMOTOR_VEHICLE_NOHELMET = 501,// 电动/摩托车不戴头盔
    NONMOTOR_VEHICLE_OVERMAN = 502, // 电动/摩托车超员
    TRICYCLE_MANNED = 503,  // 三轮车载人
    TRUCK_MANNED = 504,     // 货车货箱载人
};


typedef algorithm_type_t algo_type;


static bool is_support_algorithm_type(int algor_type) {
    return (int) algorithm_type_t::FACE_SNAPSHOT <= algor_type &&
           (int) algorithm_type_t::TAKEAWAY_MEMBER_CLASSIFICATION >= algor_type;
};

static bool is_support_algorithm_type(algorithm_type_t algor_type) {
    return is_support_algorithm_type((int) algor_type);
};


//二次属性分析结果结构体
#ifndef __CLASSIFY_OBJ_RESULT__
#define __CLASSIFY_OBJ_RESULT__
typedef struct classify_obj_res         //分类结果结构体
{
    int res_index;                      //分类结果
    float res_prob;                     //分类结构体
    classify_obj_res() : res_index(0), res_prob(0) {};
} classify_obj_res;
#endif

//检测结果结构体
#ifndef __DETECTION_OBJ_RESULT__
#define __DETECTION_OBJ_RESULT__
typedef struct detection_obj_res         //分类结果结构体
{
    int res_index;
    float res_prob;
    int res_left;
    int res_top;
    int res_right;
    int res_bottom;

    detection_obj_res() : res_index(0), res_prob(0), res_left(0), res_top(0), res_right(0), res_bottom(0) {};

    void set_data(int _res_index, float _res_prob, int _res_left, int _res_top, int _res_right, int _res_bottom) {
        res_index = _res_index;
        res_prob = _res_prob;
        res_left = _res_left;
        res_top = _res_top;
        res_right = _res_right;
        res_bottom = _res_bottom;
    }
} detection_obj_res;
#endif


//行人二次属性分析结构 + 特征结果
#ifndef __HP_OBJ_RESULT__
#define __HP_OBJ_RESULT__
const int HP_FIR_INDEX_SIZE = 16;
const int HF_FEA_SIZE = 128;
typedef struct hp_res {
    classify_obj_res res_objs[HP_FIR_INDEX_SIZE]{};      //分类结果
} hp_res;

#ifndef __INT8__
#define __INT8__
typedef unsigned char int8;
#endif

typedef struct hp_result {
    hp_res res_objs{};                                  //分类结果
    int8 feature[HF_FEA_SIZE]{};                      //特征
} hp_result;
#endif

//行人打架/跌倒结果
#ifndef __HP_FALLFIGHT_RESULT__
#define __HP_FALLFIGHT_RESULT__
typedef struct hp_fallfight_result {
    float fall_score;        //跌倒得分
    float fight_score;        //打架得分
    float background_score; //背景得分
} hp_fallfight_result;
#endif


//人骑车二次属性分析结构 + 特征结果
#ifndef __HCP_OBJ_RESULT__
#define __HCP_OBJ_RESULT__
const int HCP_FIR_INDEX_SIZE = 14;
const int HCF_FEA_SIZE = 128;
typedef struct hcp_res {
    classify_obj_res res_objs[HCP_FIR_INDEX_SIZE]{};          //分类结果
} hcp_res;

typedef struct hcp_result                                //人骑车二次属性分析以及特征结果
{
    hcp_res res_objs{};                                  //分类结果
    int8 feature[HCF_FEA_SIZE]{};                        //特征
    classify_obj_res kuaidiyuan_res;                     //快递员识别结果
    classify_obj_res waimaiyuan_res;                     //外卖员识别结果
} hcp_result;

#endif


#define VEHICLE_FEA_SIZE  128
#define PLATENUM 8                        //车牌号码位数
#define MAX_PALTE_COUNT 10              //每张图片中最多检测出10个车牌

#define SINGLETYPE_BLUE 0                //单排蓝色
#define SINGLETYPE_YELLOW 1                //单排黄色
#define SINGLETYPE_WHITE 2                //单排白色
#define SINGLETYPE_BLACK 3                //单排黑色
#define DOUBLETYPE_YELLOW 4                //双排黄色
#define DOUBLETYPE_WHITE 5                //双排白色
#define NEWENERGYTYPE_YELLOWGREEN 6        //新能源黄绿色
#define NEWENERGYTYPE_WHITEGRA 7        //新能源白绿色

//车牌号码
#ifndef VPLATENUM_RESULT_
#define VPLATENUM_RESULT_
typedef struct vplate_num {
    char character[4];
    float maxprob;
} vplate_num;
#endif

#ifndef VP_RESULT_
#define VP_RESULT_
typedef struct vplate_result {
    sy_rect rect;
    float detect_score;
    vplate_num recg[PLATENUM];
    float num_score;
    int type;                             //车牌类型
} vplate_result;
#endif


#ifndef VR_RESULT_
#define VR_RESULT_
typedef struct vr_result                //结果
{
    char vehicle_brand[260];                //车辆品牌
    char vehicle_subbrand[260];             //车辆子品牌
    char vehicle_issue_year[260];           //车辆年款
    char vehicle_type[260];                 //车辆类型
    char freight_ton[260];                  //货车吨级
    float name_score;                   //识别置信度
} vr_result;
#endif

#ifndef VC_RESULT_
#define VC_RESULT_
typedef struct vc_result {
    int res_index;                              //车颜色结果index
    float res_prob;                             //识别置信度
    vc_result() : res_index(0), res_prob(0) {};
} vc_result;
#endif

//VEHICLE
#ifndef __VEHICLE_OBJ_RESULT__
#define __VEHICLE_OBJ_RESULT__
typedef struct vehicle_result                      //车二次属性分析结果
{
    vr_result vr_res;                           //车型识别结果
    vc_result vc_res;                           //车颜色识别结果
    vplate_result vp_res;                       //车牌检测结果
    int8 feature[VEHICLE_FEA_SIZE]{};               //车辆特征
} vehicle_result;
#endif

//返回的检测物体快照结果
#ifndef __VIDEO_OBJECT_SNAPSHOT__
#define __VIDEO_OBJECT_SNAPSHOT__
typedef struct video_object_snapshot {
    char task_id[128];                          //该物体属于的任务ID号
    int object_id;                        //该物体的ID号
    char video_image_path[256];           //该物体快照的视频截图保存路径
    char snapshot_image_path[256];        //该物体快照抠图保存路径

    detection_obj_res obj_info;
    void *analysisRes;                    //二次属性分析结果
    int nFinished;                      // 轨迹是否已经结束
} video_object_snapshot;
#endif

//返回的检测物体结果信息
#ifndef __VIDEO_OBJECT_INFO__
#define __VIDEO_OBJECT_INFO__
typedef struct video_object_info {
    char task_id[128];              //该物体属于的任务ID号
    int task_frame_count;     //该物体当前出现的帧号
    int object_id;            //该物体的ID号
    int left;                 //该物体位置的左坐标
    int top;                  //该物体位置的上坐标
    int right;                //该物体位置的右坐标
    int bottom;               //该物体位置的下坐标
    int index;                //该物体所属类别的编号
    double confidence;        //该物体的置信度
} video_object_info;
#endif


// 二轮车/三轮车/货车载人参数结构体
#ifndef ___MANNED_INCIDENT_ALGOR_CONFIG_PARAM__
#define ___MANNED_INCIDENT_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_manned_incident {
    int m, n;
    int hs_count_threshold; //报警个数阈值
    int obj_min_height, obj_min_width, obj_confidence_threshold;

    algor_config_param_manned_incident()
            :  m(10), n(8), hs_count_threshold(1), obj_min_height(0), obj_min_width(0),
              obj_confidence_threshold(0.0f) {}
} algor_config_param_manned_incident;
#endif  //  #ifndef ___MANNED_INCIDENT_ALGOR_CONFIG_PARAM__


// 人员聚集参数结构体
#ifndef ___HUMAN_GATHER_ALGOR_CONFIG_PARAM__
#define ___HUMAN_GATHER_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_human_gather {
    int frame_stride;           //人数推送间隔(实际间隔 = frame_stride * 内部跳帧数)
    int human_count_threshold;  //人数报警阈值
    algor_config_param_human_gather()
            : frame_stride(1), human_count_threshold(0) {}
} algor_config_param_human_gather;
#endif  // #ifndef ___HUMAN_GATHER_ALGOR_CONFIG_PARAM__



// 施工占道参数结构体 221026byzsh
#ifndef ___ROAD_WORK_ALGOR_CONFIG_PARAM__
#define ___ROAD_WORK_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_road_work {
    int frame_stride;           //推送间隔(实际间隔 = frame_stride * 内部跳帧数)
    int rblock_count_threshold;  //报警阈值
    algor_config_param_road_work()
            : frame_stride(1), rblock_count_threshold(3) {}
} algor_config_param_road_work;
#endif  // #ifndef ___ROAD_WORK_ALGOR_CONFIG_PARAM__


// 视频定时抓拍参数结构体 230220byzsh
#ifndef ___VIDEO_TIMING_SNAPSHOT_CONFIG_PARAM__
#define ___VIDEO_TIMING_SNAPSHOT_CONFIG_PARAM__
typedef struct algor_config_video_timing_snapshot {
    int frame_stride;           //推送间隔(实际间隔 = frame_stride * 内部跳帧数)
    algor_config_video_timing_snapshot()
            : frame_stride(150) {}
} algor_config_video_timing_snapshot;
#endif  // #ifndef ___VIDEO_TIMING_SNAPSHOT_CONFIG_PARAM__


// 人员跌倒参数结构体
#ifndef ___PEDESTRIAN_FALL_ALGOR_CONFIG_PARAM__
#define ___PEDESTRIAN_FALL_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_pedestrian_fall {
    float threshold;
    int pedestrian_min_height, pedestrian_min_width, pedestrian_confidence_threshold;

    algor_config_param_pedestrian_fall()
            : threshold(0.8), pedestrian_min_width(0), pedestrian_min_height(0),
              pedestrian_confidence_threshold(0.0f) {}
} algor_config_param_pedestrian_fall;
#endif  // #ifndef ___PEDESTRIAN_FALL_ALGOR_CONFIG_PARAM__


// 人员跌倒参数结构体
#ifndef ___PEDESTRIAN_FIGHT_ALGOR_CONFIG_PARAM__
#define ___PEDESTRIAN_FIGHT_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_pedestrian_fight {
    float threshold;
    float iou_threshold;
    int pedestrian_min_height, pedestrian_min_width, pedestrian_confidence_threshold;

    algor_config_param_pedestrian_fight()
            : threshold(0.8), iou_threshold(0.1), pedestrian_min_width(0), pedestrian_min_height(0),
              pedestrian_confidence_threshold(0.0f) {}
} algor_config_param_pedestrian_fight;
#endif  // #ifndef ___PEDESTRIAN_FIGHT_ALGOR_CONFIG_PARAM__



// 外卖员识别参数结构体
#ifndef ___TAKEAWAY_MEMBER_CLASSIFICATION_ALGOR_CONFIG_PARAM__
#define ___TAKEAWAY_MEMBER_CLASSIFICATION_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_takeaway_member_classification {
    int m, n;
    float threshold;
    int pedestrian_min_height, pedestrian_min_width, pedestrian_confidence_threshold;

    algor_config_param_takeaway_member_classification()
            : m(10), n(8), threshold(0.7), pedestrian_min_width(0), pedestrian_min_height(0),
              pedestrian_confidence_threshold(0.0f) {}
} algor_config_param_takeaway_member_classification;
#endif  //  #ifndef ___TAKEAWAY_MEMBER_CLASSIFICATION_ALGOR_CONFIG_PARAM__



// 行人安全检测参数
#ifndef ___PEDESTRIAN_SAFETY_DETECTOR_ALGOR_CONFIG_PARAM__
#define ___PEDESTRIAN_SAFETY_DETECTOR_ALGOR_CONFIG_PARAM__

typedef struct algor_config_param_pedestrian_safety_detector_basic {
    unsigned m, n;
    float conf_threshold;
    float pedestrian_confidence_threshold;
    unsigned pedestrian_min_height, pedestrian_min_width;

    algor_config_param_pedestrian_safety_detector_basic()
            : m(10), n(8), conf_threshold(0.0f), pedestrian_min_width(0), pedestrian_min_height(0),
              pedestrian_confidence_threshold(0.0f) {}
} algor_config_param_pedestrian_safety_detector_basic;


//! C style.
typedef algor_config_param_pedestrian_safety_detector_basic algor_config_param_smoking;
typedef algor_config_param_pedestrian_safety_detector_basic algor_config_param_call_phone;
typedef algor_config_param_pedestrian_safety_detector_basic algor_config_param_no_reflective_clothing;
typedef algor_config_param_pedestrian_safety_detector_basic algor_config_param_no_safety_helmet;

// using algor_config_param_no_safety_helmet = algor_config_param_pedestrian_safety_detector_basic;

#endif  //  #ifndef ___PEDESTRIAN_SAFETY_DETECTOR_ALGOR_CONFIG_PARAM__



// 行人安全检测参数
#ifndef ___RETROGRADE_ALGOR_CONFIG_PARAM__
#define ___RETROGRADE_ALGOR_CONFIG_PARAM__

typedef struct algor_config_param_retrograde_basic {
    int direction;
    float conf_threshold;
    unsigned px1, py1, px2, py2;
    unsigned minmum_height, minmum_width;

    algor_config_param_retrograde_basic()
            : direction(0), px1(0), py1(0), px2(0), py2(0), conf_threshold(0.0f), minmum_height(0), minmum_width(0) {

    }

} algor_config_param_retrograde_basic;


typedef algor_config_param_retrograde_basic algor_config_param_pedestrian_retrograde;
typedef algor_config_param_retrograde_basic algor_config_param_vehicle_retrograde;

#endif  // #ifndef ___RETROGRADE_ALGOR_CONFIG_PARAM__


// 行人安全检测参数
#ifndef ___TRESPASS_ALGOR_CONFIG_PARAM__
#define ___TRESPASS_ALGOR_CONFIG_PARAM__
#define TRESPASS_MAX_POINT 24

typedef struct algor_config_param_trespass_basic {
    float conf_threshold;
    unsigned minmum_height, minmum_width;
    sy_point points[TRESPASS_MAX_POINT];
    int points_count;

    algor_config_param_trespass_basic()
            : points_count(0), conf_threshold(0.0f), minmum_height(0), minmum_width(0) {
    }

} algor_config_param_trespass_basic;

typedef algor_config_param_trespass_basic algor_config_param_pedestrian_trespass;
typedef algor_config_param_trespass_basic algor_config_param_vehicle_trespass;

#endif  // #ifndef ___RETROGRADE_ALGOR_CONFIG_PARAM__


// 抓拍算法配置参数(所有抓拍算法共享该参数)
#ifndef __SNAPSHOT_ALGOR_CONFIG_PARAM__
#define __SNAPSHOT_ALGOR_CONFIG_PARAM__
typedef struct algor_config_param_snapshot {
    float threshold;
    int snap_frame_interval;
    algor_config_param_snapshot()
            : threshold(.6f) , snap_frame_interval(0){}
} algor_config_param_snapshot;
#endif



// 算法的初始化参数
#ifndef __ALGOR_CONFIG_PARAM__BASIC__
#define __ALGOR_CONFIG_PARAM__BASIC__
typedef struct algor_basic_config_param_t {
    sy_rect algor_valid_rect;
    char *result_folder_little;         //目标快照抠图保存地址
    char *result_folder;                //目标快照大图保存地址
    explicit algor_basic_config_param_t()
            : result_folder_little(nullptr), result_folder(nullptr) {}
} algor_basic_config_param_t;
#endif // #ifndef __ALGOR_CONFIG_PARAM__BASIC__




//算法的初始化参数
#ifndef __ALGOR_CONFIG_PARAM__
#define __ALGOR_CONFIG_PARAM__

typedef struct algor_init_config_param_t {
    void *algor_param;    //此处只传入针对该路的定制化参数
    algor_basic_config_param_t *basic_param;
} algor_init_config_param_t;

typedef struct algor_config_param {
    algo_type algor_type;      //算法类型()
    algor_init_config_param_t *algor_init_config_param;
} algor_config_param;
#endif


// TASK初始化参数
#ifndef __TASK_PARAM__
#define __TASK_PARAM__

typedef bool(*GB28181_REQUEST_STREAM_CALLBACK)(const char*);

typedef struct task_param {
    const char *ipc_url;                      //rtsp流地址
    const char *task_id;                      //外部传入任务id
    algor_config_param *algor_config_params;      //该路rtsp流配置的所有算法参数
    int algor_counts;                //该路rtsp流共配置几种算法

    int dec_type{0};                   // 0: ffmpeg    1: gb28181  2:dvpp
    int port;                       // gb28181时port为必填
    int protocal;                   // gb28181 数据接收协议  0 : udp    1: tcp
    GB28181_REQUEST_STREAM_CALLBACK gb28181_request_stream_callback;

    int result_output_interval{0};  // 同一目标保存结果的帧间隔
} task_param;
#endif

#ifndef __AI_LOG_LEVEL__
#define __AI_LOG_LEVEL__
enum ai_log_level {
    AI_LOG_LEVEL_CLOSE = -1,  // 关闭日志
    AI_LOG_LEVEL_TRACE = 0,   // 跟踪变量
    AI_LOG_LEVEL_DEBUG = 1,       // 调试日志
    AI_LOG_LEVEL_INFO = 2,        // 普通日志信息 (如:无关紧要的信息输出)
    AI_LOG_LEVEL_WARNING = 3,     // 警告日志通知,模块一切正常(如:重要流程通知)
    AI_LOG_LEVEL_ERROR = 4,       // 重要日志,如结果和严重错误
};
#endif


// #define POST_USE_RABBITMQ

#ifdef POST_USE_RABBITMQ
/**
 * @brief rabbit MQ params define here.
 */
#ifndef __TSL_AIPLATFORM_RABBITMQ_PARAM__
#define __TSL_AIPLATFORM_RABBITMQ_PARAM__


enum class mq_type_t {
    DEL_TASK_MQ = 0,
    GET_TASK_MQ = 1,
    HEART_BEAT_MQ = 2,
    ALARM_MQ = 3,
    SCREENSHORT_TASK_MQ = 4, // 220809 视频截图队列
    TIMING_SCREENSHORT_TASK_MQ = 5, // 230809 定时视频截图队列
    // DEL_TASK = 0,
    // GET_TASK = 1,
    // HEART_BEAT = 2,
    // GET_ALARM = 3,


};


#if 1
#define MQ_MAX_CHAR_SIZE 256
typedef struct rabbitmq_conn_params_t {
    int port;
    // char *ip[12+3+1];
    char ip[MQ_MAX_CHAR_SIZE];
    char uname[MQ_MAX_CHAR_SIZE];
    char passwd[MQ_MAX_CHAR_SIZE];
    char vhost[MQ_MAX_CHAR_SIZE];

    char exchange[MQ_MAX_CHAR_SIZE];
    char exchange_type[MQ_MAX_CHAR_SIZE];
    char queue[MQ_MAX_CHAR_SIZE];
    char routing_key[MQ_MAX_CHAR_SIZE];

    bool durable_exchange, durable_queue;
} rabbitmq_conn_params_t;
#else

typedef struct rabbitmq_conn_params_t
{
    int port;
    // char *ip[12+3+1];
    const char* ip;
    const char* uname;
    const char* passwd;
    const char* vhost;

    const char* exchange;
    const char* exchange_type;
    const char* queue;
    const char* routing_key;

    bool durable_exchange, durable_queue;
} rabbitmq_conn_params_t;

#endif


#endif  // #ifndef __TSL_AIPLATFORM_RABBITMQ_PARAM__
#endif //#ifdef POST_USE_RABBITMQ


//VPT初始化参数
#ifndef __TSL_AIPLATFORM_PARAM__
#define __TSL_AIPLATFORM_PARAM__
typedef struct tsl_aiplatform_param {
    int gpuid;                                                     //指定显卡id
    char *trt_serialize_file;                                      //缓存文件保存路径
    char *models_dir;              // 模型文件目录

    ai_log_level log_level;
    char *log_path;             //日志文件路径
    int log_days;               //日志保存周期
    double log_mem;                //每个日志最大大小
    float vpt_thred = 0.45;        //一级检测器阈值 221216add
    float rblock_thred = 0.4;      //安全锥检测阈值 221216add
    /********************************************************************/
} tsl_aiplatform_param;
#endif


#ifndef _MSC_VER

#include <sys/time.h>

#define MACRO_COUNT_TIME_START  struct timeval macro_tv_start;\
                            struct timeval macro_tv_end;\
                        gettimeofday(&macro_tv_start,NULL);

#define MACRO_COUNT_TIME_END(___total_count___) gettimeofday(&macro_tv_end,NULL);\
                            if(___total_count___<=0)\
                        printf("time cost: %.2f ms \n", ( (double)(macro_tv_end.tv_sec-macro_tv_start.tv_sec)*1000000+(double)(macro_tv_end.tv_usec-macro_tv_start.tv_usec)  )/1000);\
                                                else\
                        printf("time cost: %.2f ms \n", ( (double)(macro_tv_end.tv_sec-macro_tv_start.tv_sec)*1000000+(double)(macro_tv_end.tv_usec-macro_tv_start.tv_usec)  )/1000/___total_count___);
#endif