#ifndef NS_API_NSCONFIG_H_ #define NS_API_NSCONFIG_H_ #pragma once #ifndef NULL # define NULL 0 #endif #ifndef TRUE # define TRUE 1 #endif #ifndef FALSE # define FALSE 0 #endif #undef NS_WIN32 #if defined(WIN32) || defined(_WIN32) # define NS_WIN32 #endif #ifdef NS_WIN32 # ifdef BUILDING_WMAI_LIB # ifdef __GNUC__ # define WMAI_EXPORT __attribute__ ((dllexport)) # else # define WMAI_EXPORT __declspec(dllexport) # endif # elif defined(USE_WMAI_LIB) # ifdef __GNUC__ # define WMAI_EXPORT __attribute__ ((dllimport)) # else # define WMAI_EXPORT __declspec(dllimport) # endif # else # define WMAI_EXPORT # define WMAI_LOCAL # endif #else # if __GNUC__ >= 4 # define WMAI_EXPORT __attribute__ ((visibility ("default"))) # define WMAI_LOCAL __attribute__ ((visibility ("hidden"))) # else # define WMAI_EXPORT # define WMAI_LOCAL # endif #endif #ifdef NS_WIN32 # ifdef __GNUC__ # define WMAI_API # else # define WMAI_API _cdecl # endif #else # define WMAI_API #endif #if defined(_MSC_VER) && _MSC_VER < 1300 # pragma warning(disable : 4250 4786) #endif /* ����ȫ������ */ typedef unsigned char uchar; typedef unsigned long ulong; typedef unsigned int uint; /// VC��֧��C99��snprintf���� //#if _MSC_VER //# define snprintf _snprintf //# define vsnprintf _vsnprintf //# define popen _popen //# define pclose _pclose //#endif // linux��ʹ��strcasecmp #ifndef NS_WIN32 # define stricmp strcasecmp #endif // ���VC6.0�������ڲ��� #if defined(_MSC_VER) && _MSC_VER < 1300 # define NS_USE_MSVC6 // ʹ��VC6������ # define __FUNCTION__ "" // vc6��֧��__FUNCTION__ // Thread.h use TryEnterCriticalSection that // requires _WIN32_WINNT >= 0x400(win95) # ifndef _WIN32_WINNT # define _WIN32_WINNT 0x500 # endif #endif /** * @def SINGLETON(TYPE) * * ��ʵ��һ����: ���ع��캯������ֹ�������캯�������������"=" */ #ifdef NS_USE_MSVC6 #define SINGLETON(TYPE) TYPE(); \ TYPE(const TYPE&); \ TYPE& operator=(const TYPE&); \ public: \ virtual ~TYPE() #else #define SINGLETON(TYPE) TYPE(); \ TYPE(const TYPE&); \ TYPE& operator=(const TYPE&); \ virtual ~TYPE() #endif /** * @def PACKED * * ȡ��������Ĭ���ڴ���뷽ʽ��ֻ��GCC��Ч */ #if defined(__GNUC__) # ifndef PACKED # define PACKED __attribute__ ((packed)) # endif #else # define PACKED #endif #endif /* NS_API_NSCONFIG_H_ */ #include <stdio.h> #include <algorithm> #include <vector> #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> #include <iostream> #include <ncnn/benchmark.h> #include <ncnn/platform.h> #include <ncnn/net.h> // #undef NCNN_VULKAN #if NCNN_VULKAN #include <ncnn/gpu.h> #endif // NCNN_VULKAN