Skip to content

Commit 877dde9

Browse files
committed
Merge branch 'master' of https://github.com/prittt/YACCLAB into master
# Conflicts: # README.md
2 parents 805b678 + 484398e commit 877dde9

File tree

67 files changed

+35841
-156
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+35841
-156
lines changed

.all-contributorsrc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@
8989
"contributions": [
9090
"bug"
9191
]
92+
},
93+
{
94+
"login": "fengweichangzi",
95+
"name": "WalnutVision",
96+
"avatar_url": "https://avatars.githubusercontent.com/u/87119815?v=4",
97+
"profile": "https://github.com/fengweichangzi",
98+
"contributions": [
99+
"bug"
100+
]
92101
}
93102
]
94103
}

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ set(YACCLAB_OUTPUT_RESULTS_PATH "${CMAKE_INSTALL_PREFIX}/output" CACHE PATH "'ou
3232
set(YACCLAB_OS "${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_VERSION}" CACHE INTERNAL STRING)
3333
set(YACCLAB_CI_CPU2D OFF CACHE INTERNAL "This variable is used to handle travis-ci parameters, do not change its value")
3434
set(YACCLAB_IS_JENKINS OFF CACHE INTERNAL "This variable is used to handle jenkins parameters, do not change its value")
35+
#set(YACCLAB_CXX_STANDARD 14 CACHE STRING "Version of the C++ standard (must be >= 14)")
36+
#set_property(CACHE YACCLAB_CXX_STANDARD PROPERTY STRINGS 14 17 20 23)
3537

3638
if(MSVC)
3739
set(CMAKE_USE_RELATIVE_PATHS ON CACHE INTERNAL "" FORCE)
@@ -82,6 +84,10 @@ set(CMAKE_CXX_EXTENSIONS NO)
8284
# message(STATUS "We are not able to check if ${CMAKE_CXX_COMPILER} compiler has C++14 support. YACCLAB may not work properly.")
8385
#endif()
8486

87+
# To be able to use __cplusplus macro to check C++ version
88+
if(MSVC)
89+
add_compile_options("/Zc:__cplusplus")
90+
endif()
8591

8692
# ----------------------------------------------------------------------------
8793
# Check for CUDA support

README.md

Lines changed: 156 additions & 65 deletions
Large diffs are not rendered by default.

doc/config_2d.yaml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,18 @@ CPU 2D 8-way connectivity:
5353
# - DRAG_TTA
5454
- DRAG_UFPC
5555
# - DRAG_UF
56+
# - PREDpp_RemSP
57+
# - PREDpp_TTA
58+
# - PREDpp_UFPC
59+
# - PREDpp_UF
5660
# - Spaghetti_RemSP
5761
# - Spaghetti_TTA
5862
- Spaghetti_UFPC
5963
# - Spaghetti_UF
60-
# - RBTS_RemSP
61-
# - RBTS_TTA
62-
- RBTS_UFPC
63-
# - RBTS_UF
64+
# - Tagliatelle_RemSP
65+
# - Tagliatelle_TTA
66+
# - Tagliatelle_UFPC
67+
# - Tagliatelle_UF
6468
# - LSL_STD_TTA
6569
# - LSL_STD_UF
6670
# - LSL_STDZ_TTA
@@ -69,6 +73,18 @@ CPU 2D 8-way connectivity:
6973
# - LSL_RLE_UF
7074
# - LSL_RLEZ_TTA
7175
# - LSL_RLEZ_UF
76+
# - BRTS_RemSP
77+
# - BRTS_TTA
78+
# - BRTS_UFPC
79+
# - BRTS_UF
80+
# - BMRS_RemSP
81+
# - BMRS_TTA
82+
# - BMRS_UFPC
83+
# - BMRS_UF
84+
# - RBTS_RemSP
85+
# - RBTS_TTA
86+
# - RBTS_UFPC
87+
# - RBTS_UF
7288
# - DiStefano
7389
# - CT
7490
# - SBLA

doc/config_3d.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ CPU 3D 26-way connectivity:
4141
# - RBTS_3D_UFPC
4242
- RBTS_3D_TTA
4343
# - RBTS_3D_RemSP
44+
# - SAUF_3D_UF
45+
- SAUF_3D_UFPC
46+
# - SAUF_3D_TTA
47+
# - SAUF_3D_RemSP
48+
# - SAUFpp_3D_UF
49+
- SAUFpp_3D_UFPC
50+
# - SAUFpp_3D_TTA
51+
# - SAUFpp_3D_RemSP
52+
# - PRED_3D_UF
53+
- PRED_3D_UFPC
54+
# - PRED_3D_TTA
55+
# - PRED_3D_RemSP
56+
# - PREDpp_3D_UF
57+
- PREDpp_3D_UFPC
58+
# - PREDpp_3D_TTA
59+
# - PREDpp_3D_RemSP
4460
${YACCLAB_CONFIG_EPDT_ALGORITHMS}
4561

4662
# Datasets to use for each test

include/CMakeLists.txt

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ target_sources(YACCLAB
88
labeling_bolelli_2018_drag.inc.h
99
labeling_bolelli_2019.h
1010
labeling_bolelli_2019_forest.inc.h
11-
labeling_bolelli_2019_forest_firstline.inc.h
12-
labeling_bolelli_2019_forest_lastline.inc.h
13-
labeling_bolelli_2019_forest_singleline.inc.h
11+
labeling_bolelli_2019_forest_fl.inc.h
12+
labeling_bolelli_2019_forest_ll.inc.h
13+
labeling_bolelli_2019_forest_sl.inc.h
1414
labeling_distefano_1999.h
1515
labeling_fchang_2003.h
1616
labeling_grana_2010.h
@@ -43,6 +43,19 @@ target_sources(YACCLAB
4343
yacclab_tensor.h
4444
labeling_sauf_4c.h
4545
labeling_sauf_background.h
46+
labeling_lee_2021_brts.h
47+
labeling_lee_2021_brts_no_zeroinit.h
48+
labeling_lee_2021_bmrs.h
49+
labeling_lee_2021_bmrs_no_zeroinit.h
50+
bit_scan_forward.h
51+
labeling_PREDpp_2021.h
52+
labeling_PREDpp_2021_fl_forest.inc.h
53+
labeling_PREDpp_2021_cl_forest.inc.h
54+
labeling_tagliatelle_2021.h
55+
labeling_tagliatelle_2021_cl_forest.inc.h
56+
labeling_tagliatelle_2021_fl_forest.inc.h
57+
labeling_tagliatelle_2021_ll_forest.inc.h
58+
labeling_tagliatelle_2021_sl_forest.inc.h
4659
)
4760

4861

@@ -58,33 +71,46 @@ if(YACCLAB_ENABLE_3D)
5871
target_sources(YACCLAB PRIVATE
5972
labeling3D_naive.h
6073
labeling3D_he_2011.h
61-
labeling3D_he_2011_run.h
74+
labeling3D_SAUF_2021.h
75+
labeling3D_SAUF_2021_tree.inc.h
76+
labeling3D_SAUFpp_2021.h
77+
labeling3D_SAUFpp_2021_tree.inc.h
78+
labeling3D_PRED_2021.h
79+
labeling3D_PRED_2021_cl_forest.inc.h
80+
labeling3D_PRED_2021_fl_forest.inc.h
81+
labeling3D_PRED_2021_ll_forest.inc.h
82+
labeling3D_PRED_2021_sl_forest.inc.h
83+
labeling3D_PREDpp_2021.h
84+
labeling3D_PREDpp_2021_cl_forest.inc.h
85+
labeling3D_PREDpp_2021_fl_forest.inc.h
86+
labeling3D_PREDpp_2021_ll_forest.inc.h
87+
labeling3D_PREDpp_2021_sl_forest.inc.h
6288
)
6389
if(YACCLAB_ENABLE_EPDT_19C)
6490
target_sources(YACCLAB PRIVATE
6591
labeling3D_EPDT_19c.h
66-
labeling3D_EPDT_19c_action_definition.inc.h
67-
labeling3D_EPDT_19c_action_definition_memory.inc.h
92+
labeling3D_EPDT_19c_action_def.inc.h
93+
labeling3D_EPDT_19c_action_def_memory.inc.h
6894
labeling3D_EPDT_19c_tree.inc.h
69-
labeling3D_EPDT_2829_action_undefinition.inc.h
70-
)
95+
labeling3D_EPDT_2829_action_undef.inc.h
96+
)
7197
endif()
7298
if(YACCLAB_ENABLE_EPDT_22C)
7399
target_sources(YACCLAB PRIVATE
74100
labeling3D_EPDT_22c.h
75-
labeling3D_EPDT_22c_action_definition.inc.h
76-
labeling3D_EPDT_22c_action_definition_memory.inc.h
101+
labeling3D_EPDT_22c_action_def.inc.h
102+
labeling3D_EPDT_22c_action_def_memory.inc.h
77103
labeling3D_EPDT_22c_tree.inc.h
78-
labeling3D_EPDT_2829_action_undefinition.inc.h
104+
labeling3D_EPDT_2829_action_undef.inc.h
79105
)
80106
endif()
81107
if(YACCLAB_ENABLE_EPDT_26C)
82108
target_sources(YACCLAB PRIVATE
83109
labeling3D_EPDT_26c.h
84-
labeling3D_EPDT_26c_action_definition.inc.h
85-
labeling3D_EPDT_26c_action_definition_memory.inc.h
110+
labeling3D_EPDT_26c_action_def.inc.h
111+
labeling3D_EPDT_26c_action_def_memory.inc.h
86112
labeling3D_EPDT_26c_tree.inc.h
87-
labeling3D_EPDT_2829_action_undefinition.inc.h
113+
labeling3D_EPDT_2829_action_undef.inc.h
88114
)
89115
endif()
90116
endif()

include/bit_scan_forward.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// Copyright (c) 2021, the YACCLAB contributors, as
2+
// shown by the AUTHORS file. All rights reserved.
3+
//
4+
// Use of this source code is governed by a BSD-style
5+
// license that can be found in the LICENSE file.
6+
7+
#ifndef YACCLAB_BIT_SCAN_FORWARD_H_
8+
#define YACCLAB_BIT_SCAN_FORWARD_H_
9+
10+
#if __cplusplus > 201703L
11+
#include <version>
12+
#endif
13+
14+
#if defined _MSC_VER
15+
#include <intrin.h>
16+
#define YacclabBitScanForward64 _BitScanForward64
17+
18+
#elif defined MY_PLATFORM_MACRO
19+
// Define YacclabBitScanForward64 using the proper compiler intrinsic for your platform.
20+
// Don't forget to open a pull request! :)
21+
22+
#elif defined __GNUC__ && (__GNUC__ > 3 || (__GNUC__ == 3 && (__GNUC_MINOR__ > 4 || (__GNUC_MINOR__ == 4 && __GNUC_PATCHLEVEL__ > 0))))
23+
#include <cstdint>
24+
inline unsigned char YacclabBitScanForward64(unsigned long* Index, uint64_t Mask) {
25+
if (!Mask) return 0;
26+
27+
*Index = static_cast<unsigned long>(__builtin_ctzll(Mask));
28+
return 1;
29+
}
30+
31+
#elif defined __clang__ && (__clang_major__ >= 5)
32+
#include <cstdint>
33+
inline unsigned char YacclabBitScanForward64(unsigned long* Index, uint64_t Mask) {
34+
if (!Mask) return 0;
35+
36+
*Index = static_cast<unsigned long>(__builtin_ctzll(Mask));
37+
return 1;
38+
}
39+
40+
#elif defined __cpp_lib_bitops
41+
#include <bit>
42+
#include <cstdint>
43+
inline unsigned char YacclabBitScanForward64(unsigned long* Index, uint64_t Mask) {
44+
if (!Mask) return 0;
45+
46+
*Index = static_cast<unsigned long>(std::countr_zero(Mask));
47+
return 1;
48+
}
49+
50+
#else
51+
#include <stdexcept>
52+
#include <cstdint>
53+
inline unsigned char YacclabBitScanForward64(unsigned long* Index, uint64_t Mask) {
54+
throw std::runtime_error("YacclabBitScanForward64 undefined."
55+
" Define it for your platform in \"bit_scan_forward.h\","
56+
" or enable C++20 for the generic version.");
57+
}
58+
#endif
59+
60+
#endif // !YACCLAB_BIT_SCAN_FORWARD_H_

include/config_data.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
#include "system_info.h"
1717
#include "utilities.h"
1818

19-
using namespace filesystem;
20-
2119
bool ReadBool(const cv::FileNode& node_list);
2220

2321
struct ModeConfig {
@@ -72,7 +70,7 @@ struct ModeConfig {
7270
std::array<int, 3> blocksize_y; // Actual parameters for blocksize grid search in y dimension
7371
std::array<int, 3> blocksize_z; // Actual parameters for blocksize grid search in z dimension
7472

75-
path mode_output_path;
73+
::filesystem::path mode_output_path;
7674

7775
ModeConfig(std::string _mode, const cv::FileNode& fn);
7876
};
@@ -95,8 +93,8 @@ struct GlobalConfig {
9593
std::string granularity_folder; // Folder which will store granularity results
9694
std::string memory_folder; // Folder which will store memory results
9795

98-
path glob_output_path; // Path on which results are stored
99-
path input_path; // Path on which input datasets are stored
96+
::filesystem::path glob_output_path; // Path on which results are stored
97+
::filesystem::path input_path; // Path on which input datasets are stored
10098

10199
std::string yacclab_os; // Name of the current OS
102100

@@ -107,7 +105,7 @@ struct GlobalConfig {
107105
bool write_n_labels; // If true, the number of components generated by the algorithms will be stored in the output file
108106

109107
// da decidere dove e in che forma infilare
110-
path latex_path; // Path on which latex report will be stored
108+
::filesystem::path latex_path; // Path on which latex report will be stored
111109

112110
GlobalConfig(const cv::FileStorage& fs);
113111
};

include/labeling3D_EPDT_19c.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "labels_solver.h"
2020
#include "memory_tester.h"
2121

22-
#include "labeling3D_EPDT_19c_action_definition.inc.h"
22+
#include "labeling3D_EPDT_19c_action_def.inc.h"
2323

2424
//Conditions:
2525
#define CONDITION_KB c > 0 && r > 0 && s > 0 && img_slice11_row11[c - 1] > 0
@@ -483,7 +483,7 @@ class EPDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26> {
483483
#undef CONDITION_XA
484484
#undef CONDITION_XB
485485

486-
#include "labeling3D_EPDT_2829_action_undefinition.inc.h"
486+
#include "labeling3D_EPDT_2829_action_undef.inc.h"
487487

488488
//Conditions:
489489
#define CONDITION_KB c > 0 && r > 0 && s > 0 && img(s - 1, r - 1, c - 1) > 0
@@ -506,7 +506,7 @@ class EPDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26> {
506506
#define CONDITION_XA img(s, r, c) > 0
507507
#define CONDITION_XB c < w - 1 && img(s, r, c + 1) > 0
508508

509-
#include "labeling3D_EPDT_19c_action_definition_memory.inc.h"
509+
#include "labeling3D_EPDT_19c_action_def_mem.inc.h"
510510
}
511511

512512
LabelsSolver::MemAlloc(UPPER_BOUND_26_CONNECTIVITY); // Equivalence solver
@@ -611,7 +611,7 @@ class EPDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26> {
611611
#undef CONDITION_XA
612612
#undef CONDITION_XB
613613

614-
#include "labeling3D_EPDT_2829_action_undefinition.inc.h"
614+
#include "labeling3D_EPDT_2829_action_undef.inc.h"
615615

616616
//Conditions:
617617
#define CONDITION_KB c > 0 && r > 0 && s > 0 && img_slice11_row11[c - 1] > 0
@@ -635,7 +635,7 @@ class EPDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26> {
635635
#define CONDITION_XB c < w - 1 && img_slice00_row00[c + 1] > 0
636636

637637
//Actions:
638-
#include "labeling3D_EPDT_19c_action_definition.inc.h"
638+
#include "labeling3D_EPDT_19c_action_def.inc.h"
639639
}
640640
}
641641

@@ -782,6 +782,6 @@ class EPDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26> {
782782
#undef CONDITION_XA
783783
#undef CONDITION_XB
784784

785-
#include "labeling3D_EPDT_2829_action_undefinition.inc.h"
785+
#include "labeling3D_EPDT_2829_action_undef.inc.h"
786786

787787
#endif // YACCLAB_LABELING3D_EPDT_19c_H_

include/labeling3D_EPDT_19c_211b.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "labels_solver.h"
2020
#include "memory_tester.h"
2121

22-
#include "labeling3D_BBDT_19c_action_definition.inc.h"
22+
#include "labeling3D_BBDT_19c_action_def.inc.h"
2323

2424
//Conditions:
2525
#define CONDITION_KB c > 0 && r > 0 && s > 0 && img_slice11_row11[c - 1] > 0
@@ -483,7 +483,7 @@ class BBDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26>
483483
#undef CONDITION_XA
484484
#undef CONDITION_XB
485485

486-
#include "labeling3D_BBDT_2829_action_undefinition.inc.h"
486+
#include "labeling3D_BBDT_2829_action_undef.inc.h"
487487

488488
//Conditions:
489489
#define CONDITION_KB c > 0 && r > 0 && s > 0 && img(s - 1, r - 1, c - 1) > 0
@@ -506,7 +506,7 @@ class BBDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26>
506506
#define CONDITION_XA img(s, r, c) > 0
507507
#define CONDITION_XB c < w - 1 && img(s, r, c + 1) > 0
508508

509-
#include "labeling3D_BBDT_19c_action_definition_memory.inc.h"
509+
#include "labeling3D_BBDT_19c_action_def_mem.inc.h"
510510
}
511511

512512
LabelsSolver::MemAlloc(UPPER_BOUND_26_CONNECTIVITY); // Equivalence solver
@@ -611,7 +611,7 @@ class BBDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26>
611611
#undef CONDITION_XA
612612
#undef CONDITION_XB
613613

614-
#include "labeling3D_BBDT_2829_action_undefinition.inc.h"
614+
#include "labeling3D_BBDT_2829_action_undef.inc.h"
615615

616616
//Conditions:
617617
#define CONDITION_KB c > 0 && r > 0 && s > 0 && img_slice11_row11[c - 1] > 0
@@ -635,7 +635,7 @@ class BBDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26>
635635
#define CONDITION_XB c < w - 1 && img_slice00_row00[c + 1] > 0
636636

637637
//Actions:
638-
#include "labeling3D_BBDT_19c_action_definition.inc.h"
638+
#include "labeling3D_BBDT_19c_action_def.inc.h"
639639
}
640640
}
641641

@@ -782,6 +782,6 @@ class BBDT_3D_19c : public Labeling3D<Connectivity3D::CONN_26>
782782
#undef CONDITION_XA
783783
#undef CONDITION_XB
784784

785-
#include "labeling3D_BBDT_2829_action_undefinition.inc.h"
785+
#include "labeling3D_BBDT_2829_action_undef.inc.h"
786786

787787
#endif // YACCLAB_LABELING3D_BBDT_19c_H_

0 commit comments

Comments
 (0)