Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
048cb4ad
Commit
048cb4ad
authored
Jun 03, 2018
by
Davis King
Browse files
Options
Browse Files
Download
Plain Diff
merged
parents
908f5540
64822a06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
43 deletions
+55
-43
CMakeLists.txt
dlib/CMakeLists.txt
+3
-0
find_blas.cmake
dlib/cmake_utils/find_blas.cmake
+50
-32
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)
"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
...
...
dlib/cmake_utils/find_blas.cmake
View file @
048cb4ad
...
...
@@ -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
()
...
...
dlib/image_loader/image_loader.h
View file @
048cb4ad
...
...
@@ -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"
);
...
...
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