diff --git a/.gitignore b/.gitignore index c4c443b0..874eb239 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ /Debug /Linux_Workspace.vpwhistu /x64 +/Projects/Cortex_test/x64/Debug +/Projects/Cortex_test/x64/Release/cortex_test_2019.tlog +/Projects/Cortex_test/x64/Release diff --git a/Projects/Cortex_test/SDL.dll b/Projects/Cortex_test/SDL.dll new file mode 100644 index 00000000..dee47e81 Binary files /dev/null and b/Projects/Cortex_test/SDL.dll differ diff --git a/Projects/Cortex_test/SDL2.dll b/Projects/Cortex_test/SDL2.dll new file mode 100644 index 00000000..a65b22ce Binary files /dev/null and b/Projects/Cortex_test/SDL2.dll differ diff --git a/Projects/Cortex_test/SDL2_image.dll b/Projects/Cortex_test/SDL2_image.dll new file mode 100644 index 00000000..9b276994 Binary files /dev/null and b/Projects/Cortex_test/SDL2_image.dll differ diff --git a/Projects/Cortex_test/SDL2_mixer.dll b/Projects/Cortex_test/SDL2_mixer.dll new file mode 100644 index 00000000..1c5e39bf Binary files /dev/null and b/Projects/Cortex_test/SDL2_mixer.dll differ diff --git a/Projects/Cortex_test/SDL2_net.dll b/Projects/Cortex_test/SDL2_net.dll new file mode 100644 index 00000000..b465e6af Binary files /dev/null and b/Projects/Cortex_test/SDL2_net.dll differ diff --git a/Projects/Cortex_test/SDL2_ttf.dll b/Projects/Cortex_test/SDL2_ttf.dll new file mode 100644 index 00000000..25f535cd Binary files /dev/null and b/Projects/Cortex_test/SDL2_ttf.dll differ diff --git a/Projects/Cortex_test/cortex_test.cpp b/Projects/Cortex_test/cortex_test.cpp index ef4d324e..20bcb3b7 100644 --- a/Projects/Cortex_test/cortex_test.cpp +++ b/Projects/Cortex_test/cortex_test.cpp @@ -12,13 +12,14 @@ int _tmain(int argc, _TCHAR* argv[]){ sdlLog * mLog; basicLogCollection::getInstance()->addHandler(&CL); mGUI = classGUI_SDL::getInstance(); + mLog = new sdlLog( 10,300,600,200); basicLogCollection::getInstance()->addHandler(mLog); mFACTORY = cortexLayersFactory::getInstance(); mPBar = new sdlProgressBar(120, 120, 500, 40); mPBar->attachStatusProvider(mFACTORY); - mFACTORY->setGpuUsageMode(false); + mFACTORY->setGpuUsageMode(true); mFACTORY->setPushPullMode(true); float detectionThreshold = 0.5f; basicCortex * Net; @@ -58,7 +59,7 @@ int _tmain(int argc, _TCHAR* argv[]){ cortexImage image(&r_img); Net->predict(image.data); RL->get_region_boxes(1, 1, detectionThreshold, probs, boxes, 0, 0 ); - + basicLogCollection::getInstance()->Log("Main", NULL, "Riched Finish!"); }; mGUI->waitThreadEnd(); delete(Net); diff --git a/Projects/Cortex_test/cortex_test_2019.vcxproj b/Projects/Cortex_test/cortex_test_2019.vcxproj index ecc8f0b7..1021ed98 100644 --- a/Projects/Cortex_test/cortex_test_2019.vcxproj +++ b/Projects/Cortex_test/cortex_test_2019.vcxproj @@ -1,85 +1,96 @@  - + Debug - Win32 + x64 - + Release - Win32 + x64 {CB0601AE-A104-40CF-83D1-DA66736E8322} Win32Proj cortex_test + 10.0 - + Application true - v120 + v142 + x64 - + Application false - true - Unicode - v120 + + + + + v142 - + - + - + - + true - c:\boost_1_68_0;c:\FruchtSystems\W32LIBS\include;c:\FruchtSystems\W32LIBS\CUDAToolkit_x86_6.5\include;c:\SDL\include;$(IncludePath) - c:\boost_1_68_0\lib32-msvc-12.0;c:\FruchtSystems\W32LIBS\lib;c:\FruchtSystems\W32LIBS\CUDAToolkit_x86_6.5\lib\Win32;c:\SDL\lib\x86;$(LibraryPath) + C:\MS_LIBS\boost_1_71_0;C:\LIBS\pthreads\include;C:\LIBS\libconfig-1.5\include;C:\MS_LIBS\cv3\include;C:\MS_LIBS\SDL\include\SDL2;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;$(IncludePath) + C:\MS_LIBS\boost_1_71_0\lib64-msvc-14.2;C:\MS_LIBS\cv3\x64\vc12\lib;C:\MS_LIBS\SDL\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64;C:\LIBS\pthreads\lib\x64;C:\LIBS\libconfig-1.5\lib\x64;$(LibraryPath) - + false - c:\boost_1_68_0;c:\FruchtSystems\W32LIBS\include;c:\FruchtSystems\W32LIBS\CUDAToolkit_x86_6.5\include;$(IncludePath) - c:\boost_1_68_0\lib32-msvc-12.0;c:\FruchtSystems\W32LIBS\lib;c:\FruchtSystems\W32LIBS\CUDAToolkit_x86_6.5\lib\Win32;$(LibraryPath) + C:\MS_LIBS\boost_1_71_0;C:\LIBS\pthreads\include;C:\LIBS\libconfig-1.5\include;C:\MS_LIBS\cv3\include;C:\MS_LIBS\SDL\include\SDL2;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include;$(IncludePath) + C:\MS_LIBS\boost_1_71_0\lib64-msvc-14.2;C:\MS_LIBS\cv3\x64\vc12\lib;C:\MS_LIBS\SDL\lib\x64;C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\lib\x64;C:\LIBS\pthreads\lib\x64;C:\LIBS\libconfig-1.5\lib\x64;$(LibraryPath) - + NotUsing Level3 Disabled - WIN32;GPU;_DEBUG;DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;PTW32_STATIC_LIB;_TIMESPEC_DEFINED;GPU;_DEBUG;DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) -Zm121 %(AdditionalOptions) Console true - C:\MS_LIBS\cv2\x86\vc10\lib;%(AdditionalLibraryDirectories) - cublas.lib;cublas_device.lib;cuda.lib;cudadevrt.lib;cudart.lib;cudart_static.lib;cufft.lib;cufftw.lib;curand.lib;cusparse.lib;nppc.lib;nppi.lib;npps.lib;nvcuvid.lib;OpenCL.lib;opencv_calib3d249d.lib;opencv_contrib249d.lib;opencv_core249d.lib;opencv_features2d249d.lib;opencv_flann249d.lib;opencv_gpu249d.lib;opencv_highgui249d.lib;opencv_imgproc249d.lib;opencv_legacy249d.lib;opencv_ml249d.lib;opencv_nonfree249d.lib;opencv_objdetect249d.lib;opencv_ocl249d.lib;opencv_photo249d.lib;opencv_stitching249d.lib;opencv_superres249d.lib;opencv_ts249d.lib;opencv_video249d.lib;opencv_videostab249d.lib;SDL2.lib;SDL2_image.lib;SDL2_mixer.lib;SDL2_net.lib;SDL2_ttf.lib;SDL2main.lib;%(AdditionalDependencies) + + + cublas.lib;cublasLt.lib;cuda.lib;cudadevrt.lib;cudart.lib;cudart_static.lib;cudnn.lib;cufft.lib;cufftw.lib;curand.lib;cusolver.lib;cusolverMg.lib;cusparse.lib;nppc.lib;nppial.lib;nppicc.lib;nppicom.lib;nppidei.lib;nppif.lib;nppig.lib;nppim.lib;nppist.lib;nppisu.lib;nppitc.lib;npps.lib;nvblas.lib;nvcuvid.lib;nvencodeapi.lib;nvgraph.lib;nvjpeg.lib;nvml.lib;nvrtc.lib;OpenCL.lib;opencv_ts300d.lib;opencv_world300d.lib;SDL.lib;SDL2.lib;SDL2_image.lib;SDL2_mixer.lib;SDL2_net.lib;SDL2_ttf.lib;SDLmain.lib;SDL2main.lib;pthreadVC2.lib;libconfigd.lib;%(AdditionalDependencies) + + 64 + - + Level3 NotUsing MaxSpeed true true - WIN32;NDEBUG;_CONSOLE;GPU;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + WIN32;PTW32_STATIC_LIB;_TIMESPEC_DEFINED;GPU;NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) Console true true true - cublas.lib;cublas_device.lib;cuda.lib;cudadevrt.lib;cudart.lib;cudart_static.lib;cufft.lib;cufftw.lib;curand.lib;cusparse.lib;nppc.lib;nppi.lib;npps.lib;nvcuvid.lib;OpenCL.lib;opencv_calib3d249.lib;opencv_calib3d249d.lib;opencv_contrib249.lib;opencv_contrib249d.lib;opencv_core249.lib;opencv_core249d.lib;opencv_features2d249.lib;opencv_features2d249d.lib;opencv_flann249.lib;opencv_flann249d.lib;opencv_gpu249.lib;opencv_gpu249d.lib;opencv_highgui249.lib;opencv_highgui249d.lib;opencv_imgproc249.lib;opencv_imgproc249d.lib;opencv_legacy249.lib;opencv_legacy249d.lib;opencv_ml249.lib;opencv_ml249d.lib;opencv_nonfree249.lib;opencv_nonfree249d.lib;opencv_objdetect249.lib;opencv_objdetect249d.lib;opencv_ocl249.lib;opencv_ocl249d.lib;opencv_photo249.lib;opencv_photo249d.lib;opencv_stitching249.lib;opencv_stitching249d.lib;opencv_superres249.lib;opencv_superres249d.lib;opencv_ts249.lib;opencv_ts249d.lib;opencv_video249.lib;opencv_video249d.lib;opencv_videostab249.lib;opencv_videostab249d.lib;%(AdditionalDependencies) + cublas.lib;cublasLt.lib;cuda.lib;cudadevrt.lib;cudart.lib;cudart_static.lib;cudnn.lib;cufft.lib;cufftw.lib;curand.lib;cusolver.lib;cusolverMg.lib;cusparse.lib;nppc.lib;nppial.lib;nppicc.lib;nppicom.lib;nppidei.lib;nppif.lib;nppig.lib;nppim.lib;nppist.lib;nppisu.lib;nppitc.lib;npps.lib;nvblas.lib;nvcuvid.lib;nvencodeapi.lib;nvgraph.lib;nvjpeg.lib;nvml.lib;nvrtc.lib;OpenCL.lib;opencv_ts300.lib;opencv_world300.lib;SDL.lib;SDL2.lib;SDL2_image.lib;SDL2_mixer.lib;SDL2_net.lib;SDL2_ttf.lib;SDLmain.lib;SDL2main.lib;pthreadVC2.lib;libconfig.lib;%(AdditionalDependencies) + + 64 + @@ -159,10 +170,14 @@ + + + + @@ -229,19 +244,22 @@ + + + - Create - Create + Create + Create - + \ No newline at end of file diff --git a/Projects/Cortex_test/cortex_test_2019.vcxproj.filters b/Projects/Cortex_test/cortex_test_2019.vcxproj.filters index f798e0eb..0ea2a677 100644 --- a/Projects/Cortex_test/cortex_test_2019.vcxproj.filters +++ b/Projects/Cortex_test/cortex_test_2019.vcxproj.filters @@ -267,6 +267,27 @@ Sources\Base + + Sources\Base + + + Sources\Base + + + Sources\Base + + + Sources\Base + + + Sources\SDL + + + Sources\SDL + + + Sources\SDL + diff --git a/Projects/Cortex_test/cortex_test_2019.vcxproj.user b/Projects/Cortex_test/cortex_test_2019.vcxproj.user new file mode 100644 index 00000000..88a55094 --- /dev/null +++ b/Projects/Cortex_test/cortex_test_2019.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Projects/Cortex_test/default.conf b/Projects/Cortex_test/default.conf new file mode 100644 index 00000000..c716b298 --- /dev/null +++ b/Projects/Cortex_test/default.conf @@ -0,0 +1,9 @@ +GUI : +{ + FULL_SCREEN_MODE = 0; + WIDTH = 800; + HEIGHT = 600; + BACKGROUND_MODE = 0; + BACKGROUND_SOLID_COLOR = 3441582; + BACKGROUND_ALT_SOLID_COLOR = 3441582; +}; diff --git a/Projects/Cortex_test/libFLAC-8.dll b/Projects/Cortex_test/libFLAC-8.dll new file mode 100644 index 00000000..fa85de73 Binary files /dev/null and b/Projects/Cortex_test/libFLAC-8.dll differ diff --git a/Projects/Cortex_test/libconfig.dll b/Projects/Cortex_test/libconfig.dll new file mode 100644 index 00000000..059db574 Binary files /dev/null and b/Projects/Cortex_test/libconfig.dll differ diff --git a/Projects/Cortex_test/libconfig_d.dll b/Projects/Cortex_test/libconfig_d.dll new file mode 100644 index 00000000..1ee78e61 Binary files /dev/null and b/Projects/Cortex_test/libconfig_d.dll differ diff --git a/Projects/Cortex_test/libfreetype-6.dll b/Projects/Cortex_test/libfreetype-6.dll new file mode 100644 index 00000000..065a052f Binary files /dev/null and b/Projects/Cortex_test/libfreetype-6.dll differ diff --git a/Projects/Cortex_test/libjpeg-9.dll b/Projects/Cortex_test/libjpeg-9.dll new file mode 100644 index 00000000..5d1489cb Binary files /dev/null and b/Projects/Cortex_test/libjpeg-9.dll differ diff --git a/Projects/Cortex_test/libmikmod-2.dll b/Projects/Cortex_test/libmikmod-2.dll new file mode 100644 index 00000000..e00a2217 Binary files /dev/null and b/Projects/Cortex_test/libmikmod-2.dll differ diff --git a/Projects/Cortex_test/libmodplug-1.dll b/Projects/Cortex_test/libmodplug-1.dll new file mode 100644 index 00000000..785ce410 Binary files /dev/null and b/Projects/Cortex_test/libmodplug-1.dll differ diff --git a/Projects/Cortex_test/libogg-0.dll b/Projects/Cortex_test/libogg-0.dll new file mode 100644 index 00000000..f6e02a13 Binary files /dev/null and b/Projects/Cortex_test/libogg-0.dll differ diff --git a/Projects/Cortex_test/libpng16-16.dll b/Projects/Cortex_test/libpng16-16.dll new file mode 100644 index 00000000..a8f0ecc8 Binary files /dev/null and b/Projects/Cortex_test/libpng16-16.dll differ diff --git a/Projects/Cortex_test/libtiff-5.dll b/Projects/Cortex_test/libtiff-5.dll new file mode 100644 index 00000000..71b12fda Binary files /dev/null and b/Projects/Cortex_test/libtiff-5.dll differ diff --git a/Projects/Cortex_test/libvorbis-0.dll b/Projects/Cortex_test/libvorbis-0.dll new file mode 100644 index 00000000..73cc0ae9 Binary files /dev/null and b/Projects/Cortex_test/libvorbis-0.dll differ diff --git a/Projects/Cortex_test/libvorbisfile-3.dll b/Projects/Cortex_test/libvorbisfile-3.dll new file mode 100644 index 00000000..1744f8c6 Binary files /dev/null and b/Projects/Cortex_test/libvorbisfile-3.dll differ diff --git a/Projects/Cortex_test/libwebp-4.dll b/Projects/Cortex_test/libwebp-4.dll new file mode 100644 index 00000000..90a7989c Binary files /dev/null and b/Projects/Cortex_test/libwebp-4.dll differ diff --git a/Projects/Cortex_test/msvcp120d.dll b/Projects/Cortex_test/msvcp120d.dll new file mode 100644 index 00000000..db33cac8 Binary files /dev/null and b/Projects/Cortex_test/msvcp120d.dll differ diff --git a/Projects/Cortex_test/msvcr120d.dll b/Projects/Cortex_test/msvcr120d.dll new file mode 100644 index 00000000..e744909f Binary files /dev/null and b/Projects/Cortex_test/msvcr120d.dll differ diff --git a/Projects/Cortex_test/opencv_ffmpeg300.dll b/Projects/Cortex_test/opencv_ffmpeg300.dll new file mode 100644 index 00000000..b1e70df6 Binary files /dev/null and b/Projects/Cortex_test/opencv_ffmpeg300.dll differ diff --git a/Projects/Cortex_test/opencv_ffmpeg300_64.dll b/Projects/Cortex_test/opencv_ffmpeg300_64.dll new file mode 100644 index 00000000..37236e54 Binary files /dev/null and b/Projects/Cortex_test/opencv_ffmpeg300_64.dll differ diff --git a/Projects/Cortex_test/opencv_world300.dll b/Projects/Cortex_test/opencv_world300.dll new file mode 100644 index 00000000..ffddb13b Binary files /dev/null and b/Projects/Cortex_test/opencv_world300.dll differ diff --git a/Projects/Cortex_test/opencv_world300d.dll b/Projects/Cortex_test/opencv_world300d.dll new file mode 100644 index 00000000..aed977b8 Binary files /dev/null and b/Projects/Cortex_test/opencv_world300d.dll differ diff --git a/Projects/Cortex_test/pthreadVC2.dll b/Projects/Cortex_test/pthreadVC2.dll new file mode 100644 index 00000000..165b4d26 Binary files /dev/null and b/Projects/Cortex_test/pthreadVC2.dll differ diff --git a/Projects/Cortex_test/smpeg2.dll b/Projects/Cortex_test/smpeg2.dll new file mode 100644 index 00000000..1e7df3d7 Binary files /dev/null and b/Projects/Cortex_test/smpeg2.dll differ diff --git a/Projects/Cortex_test/zlib1.dll b/Projects/Cortex_test/zlib1.dll new file mode 100644 index 00000000..140b63c2 Binary files /dev/null and b/Projects/Cortex_test/zlib1.dll differ diff --git a/Windows_Workspace_2019 - Home.sln b/Windows_Workspace_2019 - Home.sln index de7177c1..b18dcd30 100644 --- a/Windows_Workspace_2019 - Home.sln +++ b/Windows_Workspace_2019 - Home.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.29418.71 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cortex_test", "Projects\Cortex_test\cortex_test_2019.vcxproj", "{CB0601AE-A104-40CF-83D1-DA66736E8322}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cortex_test_2019", "Projects\Cortex_test\cortex_test_2019.vcxproj", "{CB0601AE-A104-40CF-83D1-DA66736E8322}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Win32-QT-gui-application_2019", "Projects\QT-Gui-App\Win32-QT-gui-application_2019.vcxproj", "{5F60E152-44A4-44FF-8B0E-5CECE9454C2F}" EndProject @@ -17,20 +17,21 @@ Global Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x64.ActiveCfg = Debug|Win32 - {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x86.ActiveCfg = Debug|Win32 - {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x86.Build.0 = Debug|Win32 - {CB0601AE-A104-40CF-83D1-DA66736E8322}.Release|x64.ActiveCfg = Release|Win32 - {CB0601AE-A104-40CF-83D1-DA66736E8322}.Release|x86.ActiveCfg = Release|Win32 - {CB0601AE-A104-40CF-83D1-DA66736E8322}.Release|x86.Build.0 = Release|Win32 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x64.ActiveCfg = Release|x64 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x64.Build.0 = Release|x64 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x86.ActiveCfg = Debug|x64 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Debug|x86.Build.0 = Debug|x64 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Release|x64.ActiveCfg = Release|x64 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Release|x64.Build.0 = Release|x64 + {CB0601AE-A104-40CF-83D1-DA66736E8322}.Release|x86.ActiveCfg = Release|x64 {5F60E152-44A4-44FF-8B0E-5CECE9454C2F}.Debug|x64.ActiveCfg = Debug|Win32 {5F60E152-44A4-44FF-8B0E-5CECE9454C2F}.Debug|x86.ActiveCfg = Debug|Win32 {5F60E152-44A4-44FF-8B0E-5CECE9454C2F}.Debug|x86.Build.0 = Debug|Win32 {5F60E152-44A4-44FF-8B0E-5CECE9454C2F}.Release|x64.ActiveCfg = Release|Win32 {5F60E152-44A4-44FF-8B0E-5CECE9454C2F}.Release|x86.ActiveCfg = Release|Win32 {5F60E152-44A4-44FF-8B0E-5CECE9454C2F}.Release|x86.Build.0 = Release|Win32 - {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Debug|x64.ActiveCfg = Debug|x64 - {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Debug|x64.Build.0 = Debug|x64 + {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Debug|x64.ActiveCfg = Debug|Win32 + {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Debug|x64.Build.0 = Debug|Win32 {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Debug|x86.ActiveCfg = Debug|Win32 {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Debug|x86.Build.0 = Debug|Win32 {FB5FF731-FE00-436C-AEF0-014ACE08D10C}.Release|x64.ActiveCfg = Release|x64 diff --git a/lib/data/cortex/base/basicProcessingUnit.cpp b/lib/data/cortex/base/basicProcessingUnit.cpp index 4fd04f66..57cf24fe 100644 --- a/lib/data/cortex/base/basicProcessingUnit.cpp +++ b/lib/data/cortex/base/basicProcessingUnit.cpp @@ -123,8 +123,8 @@ void cortexProcessingUnit::load_data_blocking(cortexTHREAD_ARGS *args){ }; }; -void cortexProcessingUnit::print_letters(float *pred, size_t n){ - for ( size_t i = 0; i < n; ++i ){ +void cortexProcessingUnit::print_letters(float *pred, uint32_t n){ + for ( uint32_t i = 0; i < n; ++i ){ int index = 0;// max_index(pred + i*NUMCHARS, NUMCHARS); printf("%c", int_to_alphanum(index)); } @@ -172,7 +172,7 @@ cortexMATRIX cortexProcessingUnit::concat_matrix(cortexMATRIX m1, cortexMATRIX m return m; }; //cortexDATA load_data_captcha( cortexList *paths, int m, int k, int w, int h) -cortexDATA *cortexProcessingUnit::load_data_captcha(cortexList *paths, size_t n, size_t m, size_t k, size_t w, size_t h){ +cortexDATA *cortexProcessingUnit::load_data_captcha(cortexList *paths, uint32_t n, uint32_t m, uint32_t k, uint32_t w, uint32_t h){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -196,7 +196,7 @@ cortexDATA *cortexProcessingUnit::load_data_captcha(cortexList *paths, size_t n, }; //cortexDATA load_data_captcha_encode(cortexList *paths, int m, int w, int h) -cortexDATA *cortexProcessingUnit::load_data_captcha_encode(cortexList *paths, size_t n, size_t m, size_t w, size_t h){ +cortexDATA *cortexProcessingUnit::load_data_captcha_encode(cortexList *paths, uint32_t n, uint32_t m, uint32_t w, uint32_t h){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -215,7 +215,7 @@ cortexDATA *cortexProcessingUnit::load_data_captcha_encode(cortexList *paths, si }; //cortexDATA *load_data_detection(cortexList *paths, int m, int w, int h, int boxes, int classes, float jitter, float hue, float saturation, float exposure) -cortexDATA *cortexProcessingUnit::load_data_detection(cortexList *paths, size_t n, size_t m, size_t w, size_t h, size_t boxes, size_t classes, float jitter, float hue, float saturation, float exposure){ +cortexDATA *cortexProcessingUnit::load_data_detection(cortexList *paths, uint32_t n, uint32_t m, uint32_t w, uint32_t h, uint32_t boxes, uint32_t classes, float jitter, float hue, float saturation, float exposure){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -278,7 +278,7 @@ cortexDATA *cortexProcessingUnit::load_data_detection(cortexList *paths, size_t }; //cortexDATA *load_data_old(cortexList *paths, int m, cortexList *labels, int w, int h) -cortexDATA *cortexProcessingUnit::load_data_old(cortexList *paths, cortexList *labels, size_t w, size_t h){ +cortexDATA *cortexProcessingUnit::load_data_old(cortexList *paths, cortexList *labels, uint32_t w, uint32_t h){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -295,7 +295,7 @@ cortexDATA *cortexProcessingUnit::load_data_old(cortexList *paths, cortexList *l return d; }; -cortexDATA *cortexProcessingUnit::load_data_tag(cortexList *paths, size_t k, size_t min, size_t max, size_t size, float angle, float aspect, float hue, float saturation, float exposure){ +cortexDATA *cortexProcessingUnit::load_data_tag(cortexList *paths, uint32_t k, uint32_t min, uint32_t max, uint32_t size, float angle, float aspect, float hue, float saturation, float exposure){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -317,7 +317,7 @@ cortexDATA *cortexProcessingUnit::load_data_tag(cortexList *paths, size_t k, siz return d; }; -cortexMATRIX *cortexProcessingUnit::load_image_augment_paths(cortexList *paths, size_t min, size_t max, size_t size, float angle, float aspect, float hue, float saturation, float exposure, size_t center){ +cortexMATRIX *cortexProcessingUnit::load_image_augment_paths(cortexList *paths, uint32_t min, uint32_t max, uint32_t size, float angle, float aspect, float hue, float saturation, float exposure, uint32_t center){ cortexMATRIX *X; int i; X = (cortexMATRIX*)malloc(sizeof(cortexMATRIX)); @@ -351,7 +351,7 @@ cortexMATRIX *cortexProcessingUnit::load_image_augment_paths(cortexList *paths, return X; }; -cortexDATA *cortexProcessingUnit::load_data_super(cortexList *paths, size_t w, size_t h, size_t scale){ +cortexDATA *cortexProcessingUnit::load_data_super(cortexList *paths, uint32_t w, uint32_t h, uint32_t scale){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -397,7 +397,7 @@ cortexDATA *cortexProcessingUnit::load_data_super(cortexList *paths, size_t w, s return d; }; -cortexDATA *cortexProcessingUnit::load_data_augment(cortexList *paths, cortexList *labels, cortexTREE *hierarchy, size_t min, size_t max, size_t size, float angle, float aspect, float hue, float saturation, float exposure, size_t center){ +cortexDATA *cortexProcessingUnit::load_data_augment(cortexList *paths, cortexList *labels, cortexTREE *hierarchy, uint32_t min, uint32_t max, uint32_t size, float angle, float aspect, float hue, float saturation, float exposure, uint32_t center){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -417,7 +417,7 @@ cortexDATA *cortexProcessingUnit::load_data_augment(cortexList *paths, cortexLis return d; }; -cortexDATA *cortexProcessingUnit::load_data_regression(cortexList *paths, size_t min, size_t max, size_t size, float angle, float aspect, float hue, float saturation, float exposure){ +cortexDATA *cortexProcessingUnit::load_data_regression(cortexList *paths, uint32_t min, uint32_t max, uint32_t size, float angle, float aspect, float hue, float saturation, float exposure){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -489,7 +489,7 @@ cortexDATA *cortexProcessingUnit::load_go(char *filename){ fclose(fp); return d; }; -cortexDATA *cortexProcessingUnit::load_data_writing(cortexList *paths, size_t w, size_t h, size_t out_w, size_t out_h){ +cortexDATA *cortexProcessingUnit::load_data_writing(cortexList *paths, uint32_t w, uint32_t h, uint32_t out_w, uint32_t out_h){ cortexList *random_paths = get_random_paths( paths ); cortexList *replace_paths = find_replace_paths(random_paths, ".png", "-label.png"); cortexDATA *d = (cortexDATA *)malloc(sizeof(cortexDATA)); @@ -503,7 +503,7 @@ cortexDATA *cortexProcessingUnit::load_data_writing(cortexList *paths, size_t w, return d; }; -void cortexProcessingUnit::get_random_batch(cortexDATA *d, size_t n, float *X, float *Y){ +void cortexProcessingUnit::get_random_batch(cortexDATA *d, uint32_t n, float *X, float *Y){ for (uint32_t j = 0; j < n; ++j){ int index = rand() % d->X.rows; memcpy(X + j*d->X.cols, d->X.values[index], d->X.cols*sizeof(float)); @@ -511,7 +511,7 @@ void cortexProcessingUnit::get_random_batch(cortexDATA *d, size_t n, float *X, f }; }; -cortexDATA *cortexProcessingUnit::get_data_part(cortexDATA *d, size_t part, size_t total){ +cortexDATA *cortexProcessingUnit::get_data_part(cortexDATA *d, uint32_t part, uint32_t total){ cortexDATA *p = (cortexDATA *)malloc(sizeof(cortexDATA)); if( p!= NULL ){ memset(p, 0, sizeof(cortexDATA)); @@ -525,7 +525,7 @@ cortexDATA *cortexProcessingUnit::get_data_part(cortexDATA *d, size_t part, size }; return p; }; -cortexDATA *cortexProcessingUnit::get_random_data(cortexDATA *d, size_t num){ +cortexDATA *cortexProcessingUnit::get_random_data(cortexDATA *d, uint32_t num){ cortexDATA *r = (cortexDATA *)malloc(sizeof(cortexDATA)); if( r!=NULL ){ memset(r, 0, sizeof(cortexDATA)); @@ -549,7 +549,7 @@ cortexDATA *cortexProcessingUnit::get_random_data(cortexDATA *d, size_t num){ return r; }; -cortexDATA *cortexProcessingUnit::load_categorical_data_csv(char *filename, size_t target, size_t k){ +cortexDATA *cortexProcessingUnit::load_categorical_data_csv(char *filename, uint32_t target, uint32_t k){ cortexDATA *d; d = (cortexDATA *)malloc(sizeof(cortexDATA)); if( d!= NULL ){ @@ -577,7 +577,7 @@ void cortexProcessingUnit::translate_data_rows(cortexDATA *d, float s){ }; void cortexProcessingUnit::randomize_data(cortexDATA *d){ }; -cortexDATA **cortexProcessingUnit::split_data(cortexDATA *d, size_t part, size_t total){ +cortexDATA **cortexProcessingUnit::split_data(cortexDATA *d, uint32_t part, uint32_t total){ cortexDATA **split = (cortexDATA **)calloc(2, sizeof(cortexDATA*)); if( split != NULL ){ cortexDATA *train = (cortexDATA *)malloc(sizeof(cortexDATA)); @@ -594,8 +594,8 @@ cortexDATA **cortexProcessingUnit::split_data(cortexDATA *d, size_t part, size_t memset(train, 0, sizeof(cortexDATA)); memset(test, 0, sizeof(cortexDATA)); - size_t start = part*d->X.rows / total; - size_t end = (part + 1)*d->X.rows / total; + uint32_t start = part*d->X.rows / total; + uint32_t end = (part + 1)*d->X.rows / total; train->bShallow = test->bShallow = true; @@ -640,7 +640,7 @@ cortexDATA *cortexProcessingUnit::concat_data(cortexDATA *d1, cortexDATA *d2){ return out; }; -cortexDATA *cortexProcessingUnit::concat_datas(cortexDATA *d, size_t n){ +cortexDATA *cortexProcessingUnit::concat_datas(cortexDATA *d, uint32_t n){ cortexDATA *out; out = (cortexDATA *)malloc(sizeof(cortexDATA)); if( out!=NULL ){ @@ -673,13 +673,13 @@ void cortexProcessingUnit::fill_truth(char *path, cortexList *labels, /*size_t k #endif }; -cortexList *cortexProcessingUnit::get_random_paths(cortexList *paths, size_t limit){ +cortexList *cortexProcessingUnit::get_random_paths(cortexList *paths, uint32_t limit){ cortexList *mList; mList = new cortexList(); if (mList != NULL){ //MUTEX_LOCK(mutex); //mList->assign(paths->size(), NULL); - if (limit == 0 || limit > paths->size()) limit = paths->size(); + if (limit == 0 || limit > (uint32_t)paths->size()) limit = (uint32_t)paths->size(); for (cortexList::iterator index = paths->begin(); index < paths->end(); index++) mList->push_back( *index ); std::random_shuffle(mList->begin(), mList->end()); //MUTEX_UNLOCK(&mutex); @@ -700,7 +700,7 @@ cortexList *cortexProcessingUnit::find_replace_paths(cortexList *paths, char *fi return mList; }; -cortexDATA *cortexProcessingUnit::load_data_compare(cortexList *paths, size_t classes, size_t w, size_t h, size_t limit){ +cortexDATA *cortexProcessingUnit::load_data_compare(cortexList *paths, uint32_t classes, uint32_t w, uint32_t h, uint32_t limit){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths, 2 * limit); // get_random_paths(paths, 2 * n, m); @@ -710,16 +710,16 @@ cortexDATA *cortexProcessingUnit::load_data_compare(cortexList *paths, size_t cl }; d = (cortexDATA *)malloc(sizeof(cortexDATA)); if (d != NULL){ - size_t i, j; - size_t n; - n = random_paths->size() >> 1; + uint32_t i, j; + uint32_t n; + n = ((uint32_t)random_paths->size()) >> 1; memset(d, 0, sizeof(cortexDATA)); d->bShallow = false; d->X.rows = n; d->X.values = (float**)calloc(d->X.rows, sizeof(float*)); d->X.cols = h*w * 6; - int k = 2 * (classes); + uint32_t k = 2 * (classes); d->Y = make_matrix(n, k); for (i = 0; i < n; ++i){ cortexImage im1; @@ -774,7 +774,7 @@ cortexDATA *cortexProcessingUnit::load_data_compare(cortexList *paths, size_t cl return d; }; -cortexDATA *cortexProcessingUnit::load_data_seg(cortexList *paths, size_t w, size_t h, size_t classes, size_t min, size_t max, float angle, float aspect, float hue, float saturation, float exposure, bool div){ +cortexDATA *cortexProcessingUnit::load_data_seg(cortexList *paths, uint32_t w, uint32_t h, uint32_t classes, uint32_t min, uint32_t max, float angle, float aspect, float hue, float saturation, float exposure, bool div){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -791,7 +791,7 @@ cortexDATA *cortexProcessingUnit::load_data_seg(cortexList *paths, size_t w, siz return d; }; -cortexDATA *cortexProcessingUnit::load_data_iseg(cortexList *paths, size_t w, size_t h, size_t classes, size_t boxes, size_t coords, size_t min, size_t max, float angle, float aspect, float hue, float saturation, float exposure){ +cortexDATA *cortexProcessingUnit::load_data_iseg(cortexList *paths, uint32_t w, uint32_t h, uint32_t classes, uint32_t boxes, uint32_t coords, uint32_t min, uint32_t max, float angle, float aspect, float hue, float saturation, float exposure){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -808,7 +808,7 @@ cortexDATA *cortexProcessingUnit::load_data_iseg(cortexList *paths, size_t w, si return d; }; -cortexDATA *cortexProcessingUnit::load_data_region(cortexList *paths, size_t w, size_t h, size_t size, size_t classes, float jitter, float hue, float saturation, float exposure){ +cortexDATA *cortexProcessingUnit::load_data_region(cortexList *paths, uint32_t w, uint32_t h, uint32_t size, uint32_t classes, float jitter, float hue, float saturation, float exposure){ cortexList *random_paths; cortexDATA *d; random_paths = get_random_paths(paths); @@ -824,7 +824,7 @@ cortexDATA *cortexProcessingUnit::load_data_region(cortexList *paths, size_t w, free_cortexList(paths); return d; }; -cortexDATA *cortexProcessingUnit::load_data_swag(cortexList *paths, size_t classes, float jitter){ +cortexDATA *cortexProcessingUnit::load_data_swag(cortexList *paths, uint32_t classes, float jitter){ cortexDATA *d; d = (cortexDATA *)malloc(sizeof(cortexDATA)); if (d != NULL){ @@ -916,7 +916,7 @@ cortexMATRIX cortexProcessingUnit::load_labels_paths(cortexList *paths, cortexLi return y; }; -cortexMATRIX cortexProcessingUnit::load_tags_paths(cortexList *paths, size_t k){ +cortexMATRIX cortexProcessingUnit::load_tags_paths(cortexList *paths, uint32_t k){ cortexMATRIX y = make_matrix((uint32_t)paths->size(), k); int i; int count = 0; @@ -932,7 +932,7 @@ cortexMATRIX cortexProcessingUnit::load_tags_paths(cortexList *paths, size_t k){ if (!file) continue; } ++count; - size_t tag; + uint32_t tag; while (fscanf(file, "%d", &tag) == 1){ if (tag < k){ y.values[i][tag] = 1; @@ -940,11 +940,11 @@ cortexMATRIX cortexProcessingUnit::load_tags_paths(cortexList *paths, size_t k){ }; fclose(file); }; - printf("%d/%d\n", count, paths->size()); + printf( "%d/%d\n", count, (uint32_t) paths->size()); return y; }; -void cortexProcessingUnit::fill_truth_swag(char *path, float *truth, size_t classes, float dx, float dy, float sx, float sy, bool flip){ +void cortexProcessingUnit::fill_truth_swag(char *path, float *truth, uint32_t classes, float dx, float dy, float sx, float sy, bool flip){ char labelpath[4096]; find_replace(path, "images", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath); @@ -952,12 +952,12 @@ void cortexProcessingUnit::fill_truth_swag(char *path, float *truth, size_t clas find_replace(labelpath, ".JPG", ".txt", labelpath); find_replace(labelpath, ".JPEG", ".txt", labelpath); - size_t count = 0; + uint32_t count = 0; cortexBOXLABEL *boxes = read_boxes(labelpath, &count); randomize_boxes(boxes, count); correct_boxes(boxes, count, dx, dy, sx, sy, flip); float x, y, w, h; - size_t i, id; + uint32_t i, id; for (i = 0; i < count && i < 30; ++i) { x = boxes[i].x; @@ -980,7 +980,7 @@ void cortexProcessingUnit::fill_truth_swag(char *path, float *truth, size_t clas free(boxes); }; -void cortexProcessingUnit::fill_hierarchy(float *truth, size_t k, cortexTREE *hierarchy){ +void cortexProcessingUnit::fill_hierarchy(float *truth, uint32_t k, cortexTREE *hierarchy){ for (size_t j = 0; j < k; ++j){ if (truth[j]){ uint32_t parent = hierarchy->parent[j]; @@ -1008,7 +1008,7 @@ void cortexProcessingUnit::fill_hierarchy(float *truth, size_t k, cortexTREE *hi count += hierarchy->group_size[j]; }; }; -void cortexProcessingUnit::fill_truth_captcha(char *path, size_t n, float *truth){ +void cortexProcessingUnit::fill_truth_captcha(char *path, uint32_t n, float *truth){ char *begin = strrchr(path, '/'); ++begin; size_t i; @@ -1021,7 +1021,7 @@ void cortexProcessingUnit::fill_truth_captcha(char *path, size_t n, float *truth truth[i*NUMCHARS + NUMCHARS - 1] = 1; }; }; -void cortexProcessingUnit::fill_truth_detection(char *path, size_t num_boxes, float *truth, size_t classes, bool flip, float dx, float dy, float sx, float sy){ +void cortexProcessingUnit::fill_truth_detection(char *path, uint32_t num_boxes, float *truth, uint32_t classes, bool flip, float dx, float dy, float sx, float sy){ char labelpath[4096]; find_replace(path, "images", "labels", labelpath); find_replace(labelpath, "JPEGImages", "labels", labelpath); @@ -1031,7 +1031,7 @@ void cortexProcessingUnit::fill_truth_detection(char *path, size_t num_boxes, fl find_replace(labelpath, ".png", ".txt", labelpath); find_replace(labelpath, ".JPG", ".txt", labelpath); find_replace(labelpath, ".JPEG", ".txt", labelpath); - size_t count = 0; + uint32_t count = 0; cortexBOXLABEL *boxes = read_boxes(labelpath, &count); randomize_boxes(boxes, count); correct_boxes(boxes, count, dx, dy, sx, sy, flip); @@ -1057,9 +1057,9 @@ void cortexProcessingUnit::fill_truth_detection(char *path, size_t num_boxes, fl free(boxes); }; -cortexMATRIX cortexProcessingUnit::load_image_paths_gray(cortexList *paths, size_t w, size_t h){ +cortexMATRIX cortexProcessingUnit::load_image_paths_gray(cortexList *paths, uint32_t w, uint32_t h){ cortexMATRIX X; - int i; + uint32_t i; X.rows = (uint32_t)paths->size(); X.values = (float**)calloc(X.rows, sizeof(float*)); X.cols = 0; @@ -1076,9 +1076,9 @@ cortexMATRIX cortexProcessingUnit::load_image_paths_gray(cortexList *paths, size return X; }; -cortexMATRIX cortexProcessingUnit::load_image_paths(cortexList *paths, size_t w, size_t h){ +cortexMATRIX cortexProcessingUnit::load_image_paths(cortexList *paths, uint32_t w, uint32_t h){ cortexMATRIX X; - int i; + uint32_t i; X.rows = (uint32_t)paths->size(); X.values = (float**)calloc(X.rows, sizeof(float*)); X.cols = 0; @@ -1094,13 +1094,13 @@ cortexMATRIX cortexProcessingUnit::load_image_paths(cortexList *paths, size_t w, return X; }; -cortexBOXLABEL *cortexProcessingUnit::read_boxes(char *filename, size_t *n){ +cortexBOXLABEL *cortexProcessingUnit::read_boxes(char *filename, uint32_t *n){ cortexBOXLABEL *boxes = (cortexBOXLABEL*)calloc(1, sizeof(cortexBOXLABEL)); FILE *file = fopen(filename, "r"); if (!file) return NULL; float x, y, h, w; - int id; - int count = 0; + uint32_t id; + uint32_t count = 0; while (fscanf(file, "%d %f %f %f %f", &id, &x, &y, &w, &h) == 5){ boxes = (cortexBOXLABEL*)realloc(boxes, (count + 1)*sizeof(cortexBOXLABEL)); boxes[count].id = id; @@ -1119,8 +1119,8 @@ cortexBOXLABEL *cortexProcessingUnit::read_boxes(char *filename, size_t *n){ return boxes; }; -void cortexProcessingUnit::randomize_boxes(cortexBOXLABEL *b, size_t n){ - for (size_t i = 0; i < n; ++i){ +void cortexProcessingUnit::randomize_boxes(cortexBOXLABEL *b, uint32_t n){ + for (uint32_t i = 0; i < n; ++i){ cortexBOXLABEL swap = b[i]; int index = rand() % n; b[i] = b[index]; @@ -1128,8 +1128,8 @@ void cortexProcessingUnit::randomize_boxes(cortexBOXLABEL *b, size_t n){ }; }; -void cortexProcessingUnit::correct_boxes(cortexBOXLABEL *boxes, size_t n, float dx, float dy, float sx, float sy, bool flip){ - for (size_t i = 0; i < n; ++i){ +void cortexProcessingUnit::correct_boxes(cortexBOXLABEL *boxes, uint32_t n, float dx, float dy, float sx, float sy, bool flip){ + for (uint32_t i = 0; i < n; ++i){ if (boxes[i].x == 0 && boxes[i].y == 0) { boxes[i].x = 999999; boxes[i].y = 999999; diff --git a/lib/data/cortex/base/basicTree.cpp b/lib/data/cortex/base/basicTree.cpp index 302bc434..c8768b7f 100644 --- a/lib/data/cortex/base/basicTree.cpp +++ b/lib/data/cortex/base/basicTree.cpp @@ -5,7 +5,7 @@ void change_leaves(cortexTREE *t, char *leaf_list){ cortexList *llist = get_paths(leaf_list); //char **leaves = (char **)list_to_array(llist); - uint32_t n = llist->size(); + uint32_t n = (uint32_t) llist->size(); uint32_t found = 0; for (uint32_t i = 0; i < t->n; ++i){ t->leaf[i] = 0; diff --git a/lib/data/cortex/cpu/cpuCalcs.cpp b/lib/data/cortex/cpu/cpuCalcs.cpp index b3745efb..9a19bb10 100644 --- a/lib/data/cortex/cpu/cpuCalcs.cpp +++ b/lib/data/cortex/cpu/cpuCalcs.cpp @@ -72,23 +72,23 @@ bool cpuHOST::makeVarianceDelta(float *x, float *delta, float *mean, float *vari }; -bool cpuHOST::calcMul(size_t N, float *X, size_t INCX, float *Y, size_t INCY){ - for (size_t i = 0; i < N; ++i) Y[i*INCY] *= X[i*INCX]; +bool cpuHOST::calcMul(uint32_t N, float *X, uint32_t INCX, float *Y, uint32_t INCY){ + for (uint32_t i = 0; i < N; ++i) Y[i*INCY] *= X[i*INCX]; return true; }; -bool cpuHOST::calcPow(size_t N, float ALPHA, float *X, size_t INCX, float *Y, size_t INCY){ - for (size_t i = 0; i < N; ++i) Y[i*INCY] = (float)pow(X[i*INCX], ALPHA); +bool cpuHOST::calcPow(uint32_t N, float ALPHA, float *X, uint32_t INCX, float *Y, uint32_t INCY){ + for (uint32_t i = 0; i < N; ++i) Y[i*INCY] = (float)pow(X[i*INCX], ALPHA); return true; }; -bool cpuHOST::calcAxpy(size_t N, float ALPHA, float *X, size_t INCX, float *Y, size_t INCY){ - for (size_t i = 0; i < N; ++i) Y[i*INCY] += ALPHA*X[i*INCX]; +bool cpuHOST::calcAxpy(uint32_t N, float ALPHA, float *X, uint32_t INCX, float *Y, uint32_t INCY){ + for (uint32_t i = 0; i < N; ++i) Y[i*INCY] += ALPHA*X[i*INCX]; return true; }; -bool cpuHOST::calcScal(size_t N, float ALPHA, float *X, size_t INCX){ - for (size_t i = 0; i < N; ++i) X[i*INCX] *= ALPHA; +bool cpuHOST::calcScal(uint32_t N, float ALPHA, float *X, uint32_t INCX){ + for (uint32_t i = 0; i < N; ++i) X[i*INCX] *= ALPHA; return true; }; diff --git a/lib/data/cortex/cuda/cuda.cpp b/lib/data/cortex/cuda/cuda.cpp index 479f6aef..57bd72b8 100644 --- a/lib/data/cortex/cuda/cuda.cpp +++ b/lib/data/cortex/cuda/cuda.cpp @@ -175,9 +175,9 @@ cublasHandle_t gpuCUDA::getBlasHandle(void){ return m_aCublasHandle[i]; }; -float *gpuCUDA::makeFloatArray( size_t n, float *hostMem ){ +float *gpuCUDA::makeFloatArray(uint32_t n, float *hostMem ){ float *x_gpu = NULL; - size_t size = sizeof(float) * n; + uint32_t size = sizeof(float) * n; m_sStatus = cudaMalloc((void **)&x_gpu, size); if( !checkError() || x_gpu == NULL ){ LOG_ERROR("cudaMalloc FAILED!"); @@ -194,7 +194,7 @@ float *gpuCUDA::makeFloatArray( size_t n, float *hostMem ){ return x_gpu; }; -bool gpuCUDA::makeRandom(float *gpuMem, size_t n){ +bool gpuCUDA::makeRandom(float *gpuMem, uint32_t n){ if (gpuMem == NULL) return false; int i = getDevice(); if (i < 0) return false; @@ -208,10 +208,10 @@ bool gpuCUDA::makeRandom(float *gpuMem, size_t n){ return checkError(); }; -float gpuCUDA::compare(float *gpuMem, float *x, size_t n, char *s){ +float gpuCUDA::compare(float *gpuMem, float *x, uint32_t n, char *s){ float *tmp = (float*)calloc(n, sizeof(float)); pullFloatArray( gpuMem, tmp, n ); - size_t i; + uint32_t i; for( i = 0; i < n; ++i ) printf("%f %f\n", tmp[i], x[i]); axpy_cpu((int)n, -1, x, 1, tmp, 1); float err = dot_cpu((int)n, tmp, 1, tmp, 1); @@ -244,26 +244,26 @@ bool gpuCUDA::freeMem(void *gpuMem){ return checkError(); }; -bool gpuCUDA::pushFloatArray(float *gpuMem, float *hostMem, size_t n){ - size_t size = (unsigned int)sizeof(float)*n; +bool gpuCUDA::pushFloatArray(float *gpuMem, float *hostMem, uint32_t n){ + uint32_t size = (uint32_t)sizeof(float)*n; m_sStatus = cudaMemcpy(gpuMem, hostMem, size, cudaMemcpyHostToDevice); return checkError(); }; -bool gpuCUDA::pullFloatArray(float *gpuMem, float *hostMem, size_t n){ - size_t size = (unsigned int) sizeof(float)*n; +bool gpuCUDA::pullFloatArray(float *gpuMem, float *hostMem, uint32_t n){ + uint32_t size = (uint32_t) sizeof(float)*n; m_sStatus = cudaMemcpy(hostMem, gpuMem, size, cudaMemcpyDeviceToHost); return checkError(); }; -bool gpuCUDA::pushIntArray(uint32_t *gpuMem, uint32_t *hostMem, size_t n){ - size_t size = (unsigned int)sizeof(int)*n; +bool gpuCUDA::pushIntArray(uint32_t *gpuMem, uint32_t *hostMem, uint32_t n){ + uint32_t size = (uint32_t)sizeof(int)*n; m_sStatus = cudaMemcpy(gpuMem, hostMem, size, cudaMemcpyHostToDevice); return checkError(); }; -bool gpuCUDA::pullIntArray(uint32_t *gpuMem, uint32_t *hostMem, size_t n){ - size_t size = (unsigned int) sizeof(int)*n; +bool gpuCUDA::pullIntArray(uint32_t *gpuMem, uint32_t *hostMem, uint32_t n){ + uint32_t size = (uint32_t) sizeof(int)*n; m_sStatus = cudaMemcpy(hostMem, gpuMem, size, cudaMemcpyDeviceToHost); return checkError(); }; diff --git a/lib/data/cortex/cuda/cudaMakers.cu b/lib/data/cortex/cuda/cudaMakers.cu index 07aa3966..68e541ff 100644 --- a/lib/data/cortex/cuda/cudaMakers.cu +++ b/lib/data/cortex/cuda/cudaMakers.cu @@ -436,7 +436,7 @@ bool gpuCUDA::makeVariance(float *x, float *mean, uint32_t batch, uint32_t filte }; //extern "C" void copy_ongpu(int N, float * X, int INCX, float * Y, int INCY) -bool gpuCUDA::makeCopy(size_t N, float * X, size_t INCX, float * Y, size_t INCY){ +bool gpuCUDA::makeCopy(uint32_t N, float * X, uint32_t INCX, float * Y, uint32_t INCY){ return makeCopyOffset(N, X, 0, INCX, Y, 0, INCY); }; diff --git a/lib/sdl/core/coreLabel.cpp b/lib/sdl/core/coreLabel.cpp index 19db255c..fdc4b0cc 100644 --- a/lib/sdl/core/coreLabel.cpp +++ b/lib/sdl/core/coreLabel.cpp @@ -81,6 +81,7 @@ void sdlLabel::setColor(SDL_Color *tC){ }; m_bUpdateReq = true; }; + void sdlLabel::setColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha){ if (m_sColor.a != alpha) { m_sColor.a = alpha; diff --git a/lib/sdl/core/coreWidget.cpp b/lib/sdl/core/coreWidget.cpp index 0538bb62..ed4e0c30 100644 --- a/lib/sdl/core/coreWidget.cpp +++ b/lib/sdl/core/coreWidget.cpp @@ -9,7 +9,7 @@ sdlCoreWidget::sdlCoreWidget(int x, int y, int width, int height, bool decor, sd m_bInitComplete = false; m_pEnabled = true; m_pDecoration = sdlDecoration::getInstance(); - m_pSubNodeProtector = SDL_CreateMutex(); + m_pSubNodeProtector = new basicMutex(); memset(&m_sBgColor, 0, sizeof(SDL_Color)); if( m_pParent != NULL )m_pParent->addWidget(this); }; @@ -18,7 +18,7 @@ sdlCoreWidget::~sdlCoreWidget(){ if (m_pParent != NULL) m_pParent->removeWidget(this); if (m_pTexItem != NULL) DestroyTextureHeapItem(m_pTexItem); if (m_pContentTexture != NULL) DestroyTextureHeapItem(m_pContentTexture); - if (m_pSubNodeProtector != NULL) SDL_DestroyMutex(m_pSubNodeProtector); + if (m_pSubNodeProtector != NULL) delete(m_pSubNodeProtector); }; bool sdlCoreWidget::create(void) { // Runs in SDL_MAIN context @@ -64,7 +64,7 @@ void sdlCoreWidget::render(SDL_Renderer *pRenderer){ }; }; drawBefore(pRenderer); - SDL_LockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->lock(); if (m_vWidgets.size()) { for (pWidgetVector::iterator index = m_vWidgets.begin(); index < m_vWidgets.end(); index++) { if ((*index)->m_bInitComplete) { @@ -74,7 +74,7 @@ void sdlCoreWidget::render(SDL_Renderer *pRenderer){ }; }; }; - SDL_UnlockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->unlock(); drawAfter(pRenderer); if (!m_bNoDecoration) { if (m_pContentTexture != NULL) { @@ -94,15 +94,15 @@ void sdlCoreWidget::setColorStyle(sdlColorStyle style){ void sdlCoreWidget::addWidget(sdlCoreWidget* tPtr) { if (tPtr == NULL) return; - SDL_LockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->lock(); m_vWidgets.push_back(tPtr); - SDL_UnlockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->unlock(); m_bUpdateReq = true; }; void sdlCoreWidget::removeWidget(sdlCoreWidget* tPtr) { if (tPtr == NULL) return; - SDL_LockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->lock(); if (m_vWidgets.size()) { for (pWidgetVector::iterator index = m_vWidgets.begin(); index < m_vWidgets.end(); index++) { if ((*index) == tPtr) { @@ -111,7 +111,7 @@ void sdlCoreWidget::removeWidget(sdlCoreWidget* tPtr) { }; }; }; - SDL_UnlockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->unlock(); }; void sdlCoreWidget::requerstUpdate(void) { @@ -132,20 +132,20 @@ void sdlCoreWidget::setBgColor(uint8_t r, uint8_t g, uint8_t b, uint8_t a ) { }; void sdlCoreWidget::setEnabled(void) { - SDL_LockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->lock(); if (m_vWidgets.size()) { for (pWidgetVector::iterator index = m_vWidgets.begin(); index < m_vWidgets.end(); index++)(*index)->setEnabled(); }; - SDL_UnlockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->unlock(); m_pEnabled = true; }; void sdlCoreWidget::setDisabled(void) { - SDL_LockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->lock(); if (m_vWidgets.size()) { for (pWidgetVector::iterator index = m_vWidgets.begin(); index < m_vWidgets.end(); index++)(*index)->setDisabled(); }; - SDL_UnlockMutex(m_pSubNodeProtector); + m_pSubNodeProtector->unlock(); m_pEnabled = false; }; diff --git a/lib/sdl/core/coreWidget.h b/lib/sdl/core/coreWidget.h index e2ff23e7..468473b0 100644 --- a/lib/sdl/core/coreWidget.h +++ b/lib/sdl/core/coreWidget.h @@ -20,7 +20,7 @@ class sdlCoreWidget: public sdlGraphicElement { TEXTURE_HEAP_ITEM * m_pTexItem; TEXTURE_HEAP_ITEM * m_pContentTexture; sdlDecoration * m_pDecoration; - SDL_mutex * m_pSubNodeProtector; + basicMutex * m_pSubNodeProtector; bool m_bNoDecoration; virtual void drawBefore(SDL_Renderer* pRenderer) {}; virtual void drawAfter(SDL_Renderer* pRenderer) {}; diff --git a/lib/sdl/gui_sdl.cpp b/lib/sdl/gui_sdl.cpp index 5e672ed1..1776e88e 100644 --- a/lib/sdl/gui_sdl.cpp +++ b/lib/sdl/gui_sdl.cpp @@ -11,6 +11,14 @@ //https://www.parallelrealities.co.uk/tutorials/ +extern "C" { + + FILE* __cdecl __iob_func(void) { + FILE _iob[] = { *stdin, *stdout, *stderr }; + return _iob; + } + +} static void SDL_LoadWindowIcon(SDL_Window* window){ //https://gist.github.com/noct/9884320 @@ -89,7 +97,7 @@ classGUI_SDL::classGUI_SDL(): basicThread(){ m_bInitOk = false; m_bUseAltBackground = false; m_pMainLayout = NULL; - m_pProtector = SDL_CreateMutex(); + m_pProtector = NULL; m_pSettings = basicSettingsProvider::getInstance()->getSubNode(NULL, (CSTR)"GUI"); m_pBackgroundTexture = NULL; m_nBackgroundTextureWidth = 0; @@ -318,9 +326,9 @@ classGUI_SDL::classGUI_SDL(): basicThread(){ classGUI_SDL::~classGUI_SDL(){ m_bWindowSystemOk = false; m_bInitOk = false; - if (m_pJoystickWraper != NULL)delete(m_pJoystickWraper); - SDL_DestroyMutex( m_pProtector ); - if (m_pRenderer!=NULL){ + if( m_pJoystickWraper != NULL)delete(m_pJoystickWraper); + if( m_pProtector != NULL)delete(m_pProtector); + if( m_pRenderer!=NULL){ SDL_DestroyRenderer(m_pRenderer); }; //if (m_pScreenSurface != NULL){ @@ -353,6 +361,7 @@ https ://www.facebook.com/recover 3. Each friend will give you a code.Enter them below : */ void classGUI_SDL::m_fThreadProc(void){ + if (m_pProtector == NULL) m_pProtector = new basicMutex(); if (m_pProtector == NULL) { SDL_Log("No Mutex Created! SDL Error: %s", SDL_GetError()); m_bInitOk = false; @@ -368,16 +377,16 @@ void classGUI_SDL::m_fThreadProc(void){ int display_count = 0, display_index = 0, mode_index = 0; SDL_DisplayMode mode = { SDL_PIXELFORMAT_UNKNOWN, 0, 0, 0, 0 }; if ((display_count = SDL_GetNumVideoDisplays()) < 1) { - SDL_Log("SDL_GetNumVideoDisplays returned: %i", display_count); + SDL_Log("SDL_GetNumVideoDisplays returned: %i, %s", display_count, SDL_GetError()); }; SDL_Log("SDL_GetNumVideoDisplays returned: %i", display_count); - if (SDL_GetDisplayMode(display_index, mode_index, &mode) != 0) { - SDL_Log("SDL_GetDisplayMode failed: %s", SDL_GetError()); - m_bInitOk = false; - m_bThreadStatus = TH_ENDED; - return; - }; - SDL_Log("SDL_GetDisplayMode(0, 0, &mode):\t\t%i bpp\t%i x %i", SDL_BITSPERPIXEL(mode.format), mode.w, mode.h); + //if (SDL_GetDisplayMode(display_index, mode_index, &mode) != 0) { + // SDL_Log("SDL_GetDisplayMode failed: %s", SDL_GetError()); + // m_bInitOk = false; + // m_bThreadStatus = TH_ENDED; + // return; + //}; + //SDL_Log("SDL_GetDisplayMode(0, 0, &mode):\t\t%i bpp\t%i x %i", SDL_BITSPERPIXEL(mode.format), mode.w, mode.h); if ((IMG_Init(IMG_INIT_PNG | IMG_INIT_JPG | IMG_INIT_TIF) & (IMG_INIT_PNG | IMG_INIT_JPG | IMG_INIT_TIF))!= (IMG_INIT_PNG | IMG_INIT_JPG | IMG_INIT_TIF)){ SDL_Log("SDL_image could not initialize! SDL_image Error: %s", IMG_GetError()); @@ -500,11 +509,11 @@ void classGUI_SDL::m_fThreadProc(void){ SDL_Event mEvent; //Handle events on queue if( SDL_PollEvent(&mEvent) != 0 ){ - SDL_LockMutex(m_pProtector); + m_pProtector->lock(); if (m_vGraphicElements.size()){ for (vectorGEL::iterator index = m_vGraphicElements.begin(); index < m_vGraphicElements.end(); index++) (*index)->dispatch(&mEvent); }; - SDL_UnlockMutex(m_pProtector); + m_pProtector->unlock(); // Global Window Event handler switch (mEvent.type) { case SDL_QUIT: @@ -530,7 +539,9 @@ void classGUI_SDL::m_fThreadProc(void){ break; }; }; - if (SDL_LockMutex(m_pProtector) == 0) { + //if (SDL_LockMutex(m_pProtector) == 0) + { + m_pProtector->lock(); switch (m_nBackgroundMode) { case 0: { // Solid Color if (m_bUseAltBackground) { @@ -638,11 +649,9 @@ void classGUI_SDL::m_fThreadProc(void){ }; }; SDL_RenderPresent(m_pRenderer); - SDL_UnlockMutex(m_pProtector); + m_pProtector->unlock(); SLEEP(2); - } else { - SDL_Log("Failure to lock Mutex! SDL_Error: %s", SDL_GetError()); - }; + };// else SDL_Log("Failure to lock Mutex! SDL_Error: %s", SDL_GetError()); }; }; //FOXCONN PVB120G12H-P01 @@ -651,15 +660,15 @@ void classGUI_SDL::m_fThreadProc(void){ void classGUI_SDL::registerGEL(sdlGraphicElement * tPtr){ while( !m_bWindowSystemOk ) SLEEP(1); if( tPtr != NULL ){ - SDL_LockMutex(m_pProtector); + m_pProtector->lock(); m_vGraphicElements.push_back(tPtr); - SDL_UnlockMutex(m_pProtector); + m_pProtector->unlock(); }; }; void classGUI_SDL::removeGEL(sdlGraphicElement* tPtr){ if (tPtr != NULL){ - SDL_LockMutex(m_pProtector); + m_pProtector->lock(); for (vectorGEL::iterator index = m_vGraphicElements.begin(); index < m_vGraphicElements.end(); index++){ if ((*index) == tPtr){ (*index)->setVisibility(false); @@ -667,7 +676,7 @@ void classGUI_SDL::removeGEL(sdlGraphicElement* tPtr){ break; }; }; - SDL_UnlockMutex(m_pProtector); + m_pProtector->unlock(); }; }; diff --git a/lib/sdl/gui_sdl.h b/lib/sdl/gui_sdl.h index ea074e1b..c7a597c9 100644 --- a/lib/sdl/gui_sdl.h +++ b/lib/sdl/gui_sdl.h @@ -13,6 +13,9 @@ #include "core/coreElement.h" #include "core/coreLayout.h" +extern "C" { + FILE* __cdecl __iob_func(void); +} class sdlJoystickWrapper; @@ -70,7 +73,7 @@ class classGUI_SDL: public basicThread{ int m_nHeight; int m_iCursorPosX; int m_iCursorPosY; - SDL_mutex * m_pProtector; + basicMutex * m_pProtector; vectorGEL m_vGraphicElements; TEXTURE_HEAP m_vTextureHeap; //App app; diff --git a/lib/sdl/widgets/progressBar.cpp b/lib/sdl/widgets/progressBar.cpp index 80b7664f..78203e79 100644 --- a/lib/sdl/widgets/progressBar.cpp +++ b/lib/sdl/widgets/progressBar.cpp @@ -19,9 +19,9 @@ void sdlProgressBar::draw(SDL_Renderer *pRenderer){ if (bStatus > 0){ SDL_SetRenderDrawColor(pRenderer, m_sColorStyle.activeSelector.r, m_sColorStyle.activeSelector.g, m_sColorStyle.activeSelector.b, m_sColorStyle.activeSelector.a); if (bStatus < 100){ - r.x = 1; r.y = 1; r.w = ( m_sRect.w * bStatus ) / 100 -2; r.h = m_sRect.h - 2; + r.x = 1; r.y = 1; r.w = (m_sGeometry.w * bStatus ) / 100 -2; r.h = m_sGeometry.h - 2; } else { - r.x = 1; r.y = 1; r.w = m_sRect.w - 2; r.h = m_sRect.h - 2; + r.x = 1; r.y = 1; r.w = m_sGeometry.w - 2; r.h = m_sGeometry.h - 2; }; //SDL_RenderDrawRect(pRenderer, &r); SDL_RenderFillRect(pRenderer, &r); @@ -51,9 +51,9 @@ void sdlProgressBar::attachStatusProvider(basicStatusProvider *tPtr){ void sdlProgressBar::setText(CSTR tPtr){ if (m_pLabel == NULL){ - m_pLabel = new sdlLabel( 1, 1, m_sRect.w - 2, m_sRect.h - 2, this, 12 ); - }; - if (m_pLabel != NULL){ - m_pLabel->setText(tPtr); + m_pLabel = new sdlLabel(tPtr, 1, 1, m_sGeometry.w - 2, m_sGeometry.h - 2, this, 12 ); }; + //if (m_pLabel != NULL){ + // m_pLabel->setText(tPtr); + //}; }; \ No newline at end of file