Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
dlib
Commits
048cb4ad
Commit
048cb4ad
authored
Jun 03, 2018
by
Davis King
Browse files
merged
parents
908f5540
64822a06
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
43 deletions
+55
-43
dlib/CMakeLists.txt
dlib/CMakeLists.txt
+3
-0
dlib/cmake_utils/find_blas.cmake
dlib/cmake_utils/find_blas.cmake
+50
-32
dlib/image_loader/image_loader.h
dlib/image_loader/image_loader.h
+2
-11
No files found.
dlib/CMakeLists.txt
View file @
048cb4ad
...
@@ -140,6 +140,8 @@ if (NOT TARGET dlib)
...
@@ -140,6 +140,8 @@ if (NOT TARGET dlib)
"Disable this if you don't want to use a LAPACK library"
)
"Disable this if you don't want to use a LAPACK library"
)
set
(
DLIB_USE_CUDA_STR
set
(
DLIB_USE_CUDA_STR
"Disable this if you don't want to use NVIDIA CUDA"
)
"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
set
(
DLIB_PNG_SUPPORT_STR
"Disable this if you don't want to link against libpng"
)
"Disable this if you don't want to link against libpng"
)
set
(
DLIB_GIF_SUPPORT_STR
set
(
DLIB_GIF_SUPPORT_STR
...
@@ -162,6 +164,7 @@ if (NOT TARGET dlib)
...
@@ -162,6 +164,7 @@ if (NOT TARGET dlib)
toggle_preprocessor_switch
(
DLIB_NO_GUI_SUPPORT
)
toggle_preprocessor_switch
(
DLIB_NO_GUI_SUPPORT
)
option
(
DLIB_ENABLE_STACK_TRACE
${
DLIB_ENABLE_STACK_TRACE_STR
}
OFF
)
option
(
DLIB_ENABLE_STACK_TRACE
${
DLIB_ENABLE_STACK_TRACE_STR
}
OFF
)
toggle_preprocessor_switch
(
DLIB_ENABLE_STACK_TRACE
)
toggle_preprocessor_switch
(
DLIB_ENABLE_STACK_TRACE
)
option
(
DLIB_USE_MKL_SEQUENTIAL
${
DLIB_USE_MKL_SEQUENTIAL_STR
}
OFF
)
if
(
DLIB_ENABLE_ASSERTS
)
if
(
DLIB_ENABLE_ASSERTS
)
# Set these variables so they are set in the config.h.in file when dlib
# Set these variables so they are set in the config.h.in file when dlib
...
...
dlib/cmake_utils/find_blas.cmake
View file @
048cb4ad
...
@@ -110,36 +110,48 @@ if (UNIX OR MINGW)
...
@@ -110,36 +110,48 @@ if (UNIX OR MINGW)
find_path
(
mkl_include_dir mkl_version.h
${
mkl_include_search_path
}
)
find_path
(
mkl_include_dir mkl_version.h
${
mkl_include_search_path
}
)
mark_as_advanced
(
mkl_include_dir
)
mark_as_advanced
(
mkl_include_dir
)
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
if
(
NOT DLIB_USE_MKL_SEQUENTIAL
)
# file first since this way avoids linking bugs in some cases.
# Search for the needed libraries from the MKL. We will try to link against the mkl_rt
find_library
(
mkl_rt mkl_rt
${
mkl_search_path
}
)
# file first since this way avoids linking bugs in some cases.
find_library
(
openmp_libraries iomp5
${
mkl_search_path
}
)
find_library
(
mkl_rt mkl_rt
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_rt openmp_libraries
)
find_library
(
openmp_libraries iomp5
${
mkl_search_path
}
)
# if we found the MKL
mark_as_advanced
(
mkl_rt openmp_libraries
)
if
(
mkl_rt
)
# if we found the MKL
set
(
mkl_libraries
${
mkl_rt
}
)
if
(
mkl_rt
)
set
(
blas_libraries
${
mkl_rt
}
)
set
(
mkl_libraries
${
mkl_rt
}
)
set
(
lapack_libraries
${
mkl_rt
}
)
set
(
blas_libraries
${
mkl_rt
}
)
set
(
blas_found 1
)
set
(
lapack_libraries
${
mkl_rt
}
)
set
(
lapack_found 1
)
set
(
blas_found 1
)
set
(
found_intel_mkl 1
)
set
(
lapack_found 1
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
set
(
found_intel_mkl 1
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
endif
()
endif
()
endif
()
if
(
NOT found_intel_mkl
)
if
(
NOT found_intel_mkl
)
# Search for the needed libraries from the MKL. This time try looking for a different
# 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.
# set of MKL files and try to link against those.
find_library
(
mkl_core mkl_core
${
mkl_search_path
}
)
find_library
(
mkl_core mkl_core
${
mkl_search_path
}
)
find_library
(
mkl_thread mkl_intel_thread
${
mkl_search_path
}
)
set
(
mkl_libs
${
mkl_intel
}
${
mkl_core
}
)
find_library
(
mkl_iomp iomp5
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_libs mkl_intel mkl_core
)
find_library
(
mkl_pthread pthread
${
mkl_search_path
}
)
if
(
DLIB_USE_MKL_SEQUENTIAL
)
find_library
(
mkl_sequential mkl_sequential
${
mkl_search_path
}
)
mark_as_advanced
(
mkl_intel mkl_core mkl_thread mkl_iomp mkl_pthread
)
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 we found the MKL
if
(
mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp AND mkl_pthread
)
if
(
mkl_intel AND mkl_core
AND
((
mkl_thread AND mkl_iomp AND mkl_pthread
)
OR mkl_sequential
))
set
(
mkl_libraries
${
mkl_
intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
${
mkl_pthread
}
)
set
(
mkl_libraries
${
mkl_
libs
}
)
set
(
blas_libraries
${
mkl_
intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
${
mkl_pthread
}
)
set
(
blas_libraries
${
mkl_
libs
}
)
set
(
lapack_libraries
${
mkl_
intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
${
mkl_pthread
}
)
set
(
lapack_libraries
${
mkl_
libs
}
)
set
(
blas_found 1
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
set
(
lapack_found 1
)
set
(
found_intel_mkl 1
)
set
(
found_intel_mkl 1
)
...
@@ -302,14 +314,23 @@ elseif(WIN32 AND NOT MINGW)
...
@@ -302,14 +314,23 @@ elseif(WIN32 AND NOT MINGW)
# Search for the needed libraries from the MKL.
# Search for the needed libraries from the MKL.
find_library
(
mkl_core mkl_core
${
mkl_search_path
}
)
find_library
(
mkl_core mkl_core
${
mkl_search_path
}
)
find_library
(
mkl_thread mkl_intel_thread
${
mkl_search_path
}
)
set
(
mkl_libs
${
mkl_intel
}
${
mkl_core
}
)
find_library
(
mkl_iomp libiomp5md
${
mkl_search_path
}
)
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 we found the MKL
if
(
mkl_intel AND mkl_core AND mkl_thread AND mkl_iomp
)
if
(
mkl_intel AND mkl_core
AND
((
mkl_thread AND mkl_iomp
)
OR mkl_sequential
)
)
set
(
blas_libraries
${
mkl_
intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
)
set
(
blas_libraries
${
mkl_
libs
}
)
set
(
lapack_libraries
${
mkl_
intel
}
${
mkl_core
}
${
mkl_thread
}
${
mkl_iomp
}
)
set
(
lapack_libraries
${
mkl_
libs
}
)
set
(
blas_found 1
)
set
(
blas_found 1
)
set
(
lapack_found 1
)
set
(
lapack_found 1
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
message
(
STATUS
"Found Intel MKL BLAS/LAPACK library"
)
...
@@ -324,10 +345,7 @@ elseif(WIN32 AND NOT MINGW)
...
@@ -324,10 +345,7 @@ elseif(WIN32 AND NOT MINGW)
set
(
blas_found 0
)
set
(
blas_found 0
)
set
(
lapack_found 0
)
set
(
lapack_found 0
)
endif
()
endif
()
endif
()
endif
()
endif
()
endif
()
...
...
dlib/image_loader/image_loader.h
View file @
048cb4ad
...
@@ -41,10 +41,9 @@ namespace dlib
...
@@ -41,10 +41,9 @@ namespace dlib
unsigned
long
bytes_read_so_far
=
0
;
unsigned
long
bytes_read_so_far
=
0
;
unsigned
long
bfSize
;
unsigned
long
bfSize
;
unsigned
long
bfOffBits
;
unsigned
long
bfOffBits
;
unsigned
long
bfReserved
;
unsigned
long
biSize
;
unsigned
long
biSize
;
unsigned
long
biWidth
;
unsigned
long
biWidth
;
long
biHeight
;
int32
biHeight
;
unsigned
short
biBitCount
;
unsigned
short
biBitCount
;
unsigned
long
biCompression
;
unsigned
long
biCompression
;
/*
/*
...
@@ -79,20 +78,12 @@ namespace dlib
...
@@ -79,20 +78,12 @@ namespace dlib
a
=
buf
[
i
];
b
=
buf
[
i
+
1
];
c
=
buf
[
i
+
2
];
d
=
buf
[
i
+
3
];
a
=
buf
[
i
];
b
=
buf
[
i
+
1
];
c
=
buf
[
i
+
2
];
d
=
buf
[
i
+
3
];
bfSize
=
a
|
(
b
<<
8
)
|
(
c
<<
16
)
|
(
d
<<
24
);
bfSize
=
a
|
(
b
<<
8
)
|
(
c
<<
16
)
|
(
d
<<
24
);
i
=
4
;
// Ignore the next 4 bytes (Reserved Area)
a
=
buf
[
i
];
b
=
buf
[
i
+
1
];
c
=
buf
[
i
+
2
];
d
=
buf
[
i
+
3
];
bfReserved
=
a
|
(
b
<<
8
)
|
(
c
<<
16
)
|
(
d
<<
24
);
i
=
8
;
i
=
8
;
a
=
buf
[
i
];
b
=
buf
[
i
+
1
];
c
=
buf
[
i
+
2
];
d
=
buf
[
i
+
3
];
a
=
buf
[
i
];
b
=
buf
[
i
+
1
];
c
=
buf
[
i
+
2
];
d
=
buf
[
i
+
3
];
bfOffBits
=
a
|
(
b
<<
8
)
|
(
c
<<
16
)
|
(
d
<<
24
);
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
// load the BITMAPINFOHEADER
if
(
in
.
sgetn
(
reinterpret_cast
<
char
*>
(
buf
),
40
)
!=
40
)
if
(
in
.
sgetn
(
reinterpret_cast
<
char
*>
(
buf
),
40
)
!=
40
)
throw
image_load_error
(
"bmp load error 5: file too short"
);
throw
image_load_error
(
"bmp load error 5: file too short"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment