improve compatibility with c++ compilers, prepare for CMake

This commit is contained in:
Stefano Sinigardi
2019-02-14 17:28:23 +01:00
parent 3d9c8530a0
commit b3579380dc
128 changed files with 1871 additions and 2258 deletions

View File

@ -26,6 +26,38 @@
#endif
#endif
#ifdef _WIN32
#define PORT unsigned long
#define ADDRPOINTER int*
#else
#define PORT unsigned short
#define SOCKET int
#define HOSTENT struct hostent
#define SOCKADDR struct sockaddr
#define SOCKADDR_IN struct sockaddr_in
#define ADDRPOINTER unsigned int*
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#endif
#define FULL_MASK 0xffffffff
#define WARP_SIZE 32
#define BLOCK 512
#define NUMCHARS 37
#define NFRAMES 3
#define BLOCK_TRANSPOSE32 256
#define DOABS 1
#define SECRET_NUM -1234
#define C_SHARP_MAX_OBJECTS 1000
#define TILE_M 4 // 4 ops
#define TILE_N 16 // AVX2 = 2 ops * 8 floats
#define TILE_K 16 // loop
#ifndef __COMPAR_FN_T
#define __COMPAR_FN_T
typedef int (*__compar_fn_t)(const void*, const void*);
#ifdef __USE_GNU
typedef __compar_fn_t comparison_fn_t;
#endif
#endif
#ifdef GPU
#define BLOCK 512

View File

@ -1,17 +1,7 @@
#pragma once
#ifdef LIB_EXPORTS
#if defined(_MSC_VER)
#define LIB_API __declspec(dllexport)
#else
#define LIB_API __attribute__((visibility("default")))
#endif
#else
#if defined(_MSC_VER)
#define LIB_API
#else
#define LIB_API
#endif
#endif
#ifndef YOLO_V2_CLASS_HPP
#define YOLO_V2_CLASS_HPP
#include "darknet.h"
struct bbox_t {
unsigned int x, y, w, h; // (x,y) - top-left corner, (w, h) - width & height of bounded box
@ -28,7 +18,6 @@ struct image_t {
float *data; // pointer to the image data
};
#define C_SHARP_MAX_OBJECTS 1000
struct bbox_t_container {
bbox_t candidates[C_SHARP_MAX_OBJECTS];
};
@ -41,8 +30,8 @@ struct bbox_t_container {
#ifdef OPENCV
#include <opencv2/opencv.hpp> // C++
#include "opencv2/highgui/highgui_c.h" // C
#include "opencv2/imgproc/imgproc_c.h" // C
#include <opencv2/highgui/highgui_c.h> // C
#include <opencv2/imgproc/imgproc_c.h> // C
#endif // OPENCV
extern "C" LIB_API int init(const char *configurationFilename, const char *weightsFilename, int gpu);
@ -658,3 +647,4 @@ void free_img(image_t m) {
#endif // __cplusplus
*/
#endif