Commit 048cb4ad authored by Davis King's avatar Davis King

merged

parents 908f5540 64822a06
......@@ -140,6 +140,8 @@ if (NOT TARGET dlib)
"Disable this if you don't want to use a LAPACK library" )
set (DLIB_USE_CUDA_STR
"Disable this if you don't want to use NVIDIA CUDA" )
set (DLIB_USE_MKL_SEQUENTIAL_STR
"Enable this if you have MKL installed and want to use the sequential version" )
set (DLIB_PNG_SUPPORT_STR
"Disable this if you don't want to link against libpng" )
set (DLIB_GIF_SUPPORT_STR
......@@ -162,6 +164,7 @@ if (NOT TARGET dlib)
toggle_preprocessor_switch(DLIB_NO_GUI_SUPPORT)
option(DLIB_ENABLE_STACK_TRACE ${DLIB_ENABLE_STACK_TRACE_STR} OFF)
toggle_preprocessor_switch(DLIB_ENABLE_STACK_TRACE)
option(DLIB_USE_MKL_SEQUENTIAL ${DLIB_USE_MKL_SEQUENTIAL_STR} OFF)
if(DLIB_ENABLE_ASSERTS)
# Set these variables so they are set in the config.h.in file when dlib
......
......@@ -110,36 +110,48 @@ if (UNIX OR MINGW)
find_path(mkl_include_dir mkl_version.h ${mkl_include_search_path})
mark_as_advanced(mkl_include_dir)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path})
find_library(openmp_libraries iomp5 ${mkl_search_path})
mark_as_advanced( mkl_rt openmp_libraries )
# if we found the MKL
if ( mkl_rt)
set(mkl_libraries ${mkl_rt} )
set(blas_libraries ${mkl_rt} )
set(lapack_libraries ${mkl_rt} )
set(blas_found 1)
set(lapack_found 1)
set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
if(NOT DLIB_USE_MKL_SEQUENTIAL)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
# file first since this way avoids linking bugs in some cases.
find_library(mkl_rt mkl_rt ${mkl_search_path})
find_library(openmp_libraries iomp5 ${mkl_search_path})
mark_as_advanced(mkl_rt openmp_libraries)
# if we found the MKL
if (mkl_rt)
set(mkl_libraries ${mkl_rt} )
set(blas_libraries ${mkl_rt} )
set(lapack_libraries ${mkl_rt} )
set(blas_found 1)
set(lapack_found 1)
set(found_intel_mkl 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
endif()
endif()
if (NOT found_intel_mkl)
# Search for the needed libraries from the MKL. This time try looking for a different
# set of MKL files and try to link against those.
find_library(mkl_core mkl_core ${mkl_search_path})
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
find_library(mkl_iomp iomp5 ${mkl_search_path})
find_library(mkl_pthread pthread ${mkl_search_path})
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread)
set(mkl_libs ${mkl_intel} ${mkl_core})
mark_as_advanced(mkl_libs mkl_intel mkl_core)
if (DLIB_USE_MKL_SEQUENTIAL)
find_library(mkl_sequential mkl_sequential ${mkl_search_path})
mark_as_advanced(mkl_sequential)
list(APPEND mkl_libs ${mkl_sequential})
else()
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
find_library(mkl_iomp iomp5 ${mkl_search_path})
find_library(mkl_pthread pthread ${mkl_search_path})
mark_as_advanced(mkl_thread mkl_iomp mkl_pthread)
list(APPEND mkl_libs ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
endif()
# If we found the MKL
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread)
set(mkl_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} ${mkl_pthread})
if (mkl_intel AND mkl_core AND ((mkl_thread AND mkl_iomp AND mkl_pthread) OR mkl_sequential))
set(mkl_libraries ${mkl_libs})
set(blas_libraries ${mkl_libs})
set(lapack_libraries ${mkl_libs})
set(blas_found 1)
set(lapack_found 1)
set(found_intel_mkl 1)
......@@ -302,14 +314,23 @@ elseif(WIN32 AND NOT MINGW)
# Search for the needed libraries from the MKL.
find_library(mkl_core mkl_core ${mkl_search_path})
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
find_library(mkl_iomp libiomp5md ${mkl_search_path})
set(mkl_libs ${mkl_intel} ${mkl_core})
mark_as_advanced(mkl_libs mkl_intel mkl_core)
if (DLIB_USE_MKL_SEQUENTIAL)
find_library(mkl_sequential mkl_sequential ${mkl_search_path})
mark_as_advanced(mkl_sequential)
list(APPEND mkl_libs ${mkl_sequential})
else()
find_library(mkl_thread mkl_intel_thread ${mkl_search_path})
find_library(mkl_iomp libiomp5md ${mkl_search_path})
mark_as_advanced(mkl_thread mkl_iomp)
list(APPEND mkl_libs ${mkl_thread} ${mkl_iomp})
endif()
mark_as_advanced( mkl_intel mkl_core mkl_thread mkl_iomp)
# If we found the MKL
if (mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp )
set(blas_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} )
set(lapack_libraries ${mkl_intel} ${mkl_core} ${mkl_thread} ${mkl_iomp} )
if (mkl_intel AND mkl_core AND ((mkl_thread AND mkl_iomp) OR mkl_sequential))
set(blas_libraries ${mkl_libs})
set(lapack_libraries ${mkl_libs})
set(blas_found 1)
set(lapack_found 1)
message(STATUS "Found Intel MKL BLAS/LAPACK library")
......@@ -324,10 +345,7 @@ elseif(WIN32 AND NOT MINGW)
set(blas_found 0)
set(lapack_found 0)
endif()
endif()
endif()
......
......@@ -41,10 +41,9 @@ namespace dlib
unsigned long bytes_read_so_far = 0;
unsigned long bfSize;
unsigned long bfOffBits;
unsigned long bfReserved;
unsigned long biSize;
unsigned long biWidth;
long biHeight;
int32 biHeight;
unsigned short biBitCount;
unsigned long biCompression;
/*
......@@ -79,20 +78,12 @@ namespace dlib
a = buf[i]; b = buf[i+1]; c = buf[i+2]; d = buf[i+3];
bfSize = a | (b<<8) | (c<<16) | (d<<24);
i = 4;
a = buf[i]; b = buf[i+1]; c = buf[i+2]; d = buf[i+3];
bfReserved = a | (b<<8) | (c<<16) | (d<<24);
// Ignore the next 4 bytes (Reserved Area)
i = 8;
a = buf[i]; b = buf[i+1]; c = buf[i+2]; d = buf[i+3];
bfOffBits = a | (b<<8) | (c<<16) | (d<<24);
// if this value isn't zero then there is something wrong
// with this bitmap.
if (bfReserved != 0)
throw image_load_error("bmp load error 4: reserved area not zero");
// load the BITMAPINFOHEADER
if (in.sgetn(reinterpret_cast<char*>(buf),40) != 40)
throw image_load_error("bmp load error 5: file too short");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment