43#include <robin_hood.h>
53static const std::array<std::vector<std::array<int, 3>>, 9> adjacentPointsSearch = {{
55 {{1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1}},
70 {{1, 1, 1}, {1, 1, -1}, {1, -1, 1}, {1, -1, -1}, {-1, 1, 1}, {-1, 1, -1}, {-1, -1, 1}, {-1, -1, -1}},
72 {{2, 0, 0}, {-2, 0, 0}, {0, 2, 0}, {0, -2, 0}, {0, 0, 2}, {0, 0, -2}},
74 {{2, 1, 0}, {2, -1, 0}, {1, 2, 0}, {1, -2, 0}, {-1, 2, 0}, {-1, -2, 0}, {-2, 1, 0}, {-2, -1, 0},
75 {0, 2, 1}, {0, 2, -1}, {0, 1, 2}, {0, 1, -2}, {0, -1, 2}, {0, -1, -2}, {0, -2, 1}, {0, -2, -1},
76 {1, 0, 2}, {-1, 0, 2}, {2, 0, 1}, {-2, 0, 1}, {2, 0, -1}, {-2, 0, -1}, {1, 0, -2}, {-1, 0, -2}},
78 {{2, 1, 1}, {2, 1, -1}, {2, -1, 1}, {2, -1, -1}, {1, 2, 1}, {1, 2, -1}, {1, 1, 2}, {1, 1, -2},
79 {1, -1, 2}, {1, -1, -2}, {1, -2, 1}, {1, -2, -1}, {-1, 2, 1}, {-1, 2, -1}, {-1, 1, 2}, {-1, 1, -2},
80 {-1, -1, 2}, {-1, -1, -2}, {-1, -2, 1}, {-1, -2, -1}, {-2, 1, 1}, {-2, 1, -1}, {-2, -1, 1}, {-2, -1, -1}},
97 {{3, 0, 0}, {-3, 0, 0}, {0, 3, 0}, {0, -3, 0}, {0, 0, 3}, {0, 0, -3}, {2, 2, 1}, {2, 2, -1}, {2, 1, 2}, {2, 1, -2},
98 {2, -1, 2}, {2, -1, -2}, {2, -2, 1}, {2, -2, -1}, {1, 2, 2}, {1, 2, -2}, {1, -2, 2}, {1, -2, -2}, {-1, 2, 2}, {-1, 2, -2},
99 {-1, -2, 2}, {-1, -2, -2}, {-2, 2, 1}, {-2, 2, -1}, {-2, 1, 2}, {-2, 1, -2}, {-2, -1, 2}, {-2, -1, -2}, {-2, -2, 1}, {-2, -2, -1}},
104static constexpr std::array<std::array<int, 3>, 122> adjacentPointsSearchFlat = {{
106 {1, 0, 0}, {-1, 0, 0}, {0, 1, 0}, {0, -1, 0}, {0, 0, 1}, {0, 0, -1},
109 {1, 1, 0}, {1, -1, 0}, {-1, 1, 0}, {-1, -1, 0}, {0, 1, 1}, {0, 1, -1},
110 {0, -1, 1}, {0, -1, -1}, {1, 0, 1}, {-1, 0, 1}, {1, 0, -1}, {-1, 0, -1},
113 {1, 1, 1}, {1, 1, -1}, {1, -1, 1}, {1, -1, -1},
114 {-1, 1, 1}, {-1, 1, -1}, {-1, -1, 1}, {-1, -1, -1},
117 {2, 0, 0}, {-2, 0, 0}, {0, 2, 0}, {0, -2, 0}, {0, 0, 2}, {0, 0, -2},
120 {2, 1, 0}, {2, -1, 0}, {1, 2, 0}, {1, -2, 0}, {-1, 2, 0}, {-1, -2, 0}, {-2, 1, 0}, {-2, -1, 0},
121 {0, 2, 1}, {0, 2, -1}, {0, 1, 2}, {0, 1, -2}, {0, -1, 2}, {0, -1, -2}, {0, -2, 1}, {0, -2, -1},
122 {1, 0, 2}, {-1, 0, 2}, {2, 0, 1}, {-2, 0, 1}, {2, 0, -1}, {-2, 0, -1}, {1, 0, -2}, {-1, 0, -2},
125 {2, 1, 1}, {2, 1, -1}, {2, -1, 1}, {2, -1, -1}, {1, 2, 1}, {1, 2, -1}, {1, 1, 2}, {1, 1, -2},
126 {1, -1, 2}, {1, -1, -2}, {1, -2, 1}, {1, -2, -1}, {-1, 2, 1}, {-1, 2, -1}, {-1, 1, 2}, {-1, 1, -2},
127 {-1, -1, 2}, {-1, -1, -2}, {-1, -2, 1}, {-1, -2, -1}, {-2, 1, 1}, {-2, 1, -1}, {-2, -1, 1}, {-2, -1, -1},
132 {2, 2, 0}, {2, -2, 0}, {-2, 2, 0}, {-2, -2, 0}, {0, 2, 2}, {0, 2, -2},
133 {0, -2, 2}, {0, -2, -2}, {2, 0, 2}, {-2, 0, 2}, {2, 0, -2}, {-2, 0, -2},
136 {3, 0, 0}, {-3, 0, 0}, {0, 3, 0}, {0, -3, 0}, {0, 0, 3}, {0, 0, -3}, {2, 2, 1}, {2, 2, -1}, {2, 1, 2}, {2, 1, -2},
137 {2, -1, 2}, {2, -1, -2}, {2, -2, 1}, {2, -2, -1}, {1, 2, 2}, {1, 2, -2}, {1, -2, 2}, {1, -2, -2}, {-1, 2, 2}, {-1, 2, -2},
138 {-1, -2, 2}, {-1, -2, -2}, {-2, 2, 1}, {-2, 2, -1}, {-2, 1, 2}, {-2, 1, -2}, {-2, -1, 2}, {-2, -1, -2}, {-2, -2, 1}, {-2, -2, -1}
141static constexpr std::array<size_t, 9> adjacentPointsSearchFlatOffsets = {
154const std::array<uvgutils::VectorN<uint8_t, 3>, 114>
patchColors = {{
156 {139, 0, 0}, {165, 42, 42}, {178, 34, 34}, {220, 20, 60}, {255, 99, 71}, {255, 127, 80}, {205, 92, 92}, {240, 128, 128},
157 {233, 150, 122}, {250, 128, 114}, {255, 160, 122}, {255, 69, 0}, {255, 140, 0}, {255, 165, 0}, {255, 215, 0}, {184, 134, 11},
158 {218, 165, 32}, {238, 232, 170}, {189, 183, 107}, {240, 230, 140}, {255, 255, 0}, {32, 178, 170}, {0, 128, 128}, {0, 139, 139},
159 {0, 255, 255}, {0, 255, 255}, {224, 255, 255}, {0, 206, 209}, {72, 209, 204}, {175, 238, 238}, {176, 224, 230}, {95, 158, 160},
160 {70, 130, 180}, {100, 149, 237}, {0, 191, 255}, {30, 144, 255}, {173, 216, 230}, {135, 206, 235}, {135, 206, 250}, {25, 25, 112},
161 {0, 0, 128}, {0, 0, 139}, {0, 0, 205}, {0, 0, 255}, {65, 105, 225}, {138, 43, 226}, {75, 0, 130}, {72, 61, 139},
162 {106, 90, 205}, {123, 104, 238}, {147, 112, 219}, {139, 0, 139}, {148, 0, 211}, {153, 50, 204}, {186, 85, 211}, {128, 0, 128},
163 {216, 191, 216}, {221, 160, 221}, {238, 130, 238}, {255, 0, 255}, {218, 112, 214}, {199, 21, 133}, {219, 112, 147}, {255, 20, 147},
164 {255, 105, 180}, {255, 182, 193}, {255, 192, 203}, {250, 235, 215}, {245, 245, 220}, {255, 228, 196}, {255, 235, 205}, {245, 222, 179},
165 {255, 248, 220}, {255, 250, 205}, {250, 250, 210}, {255, 255, 224}, {139, 69, 19}, {160, 82, 45}, {210, 105, 30}, {205, 133, 63},
166 {244, 164, 96}, {222, 184, 135}, {210, 180, 140}, {188, 143, 143}, {255, 228, 181}, {255, 222, 173}, {255, 218, 185}, {255, 228, 225},
167 {255, 240, 245}, {250, 240, 230}, {253, 245, 230}, {255, 239, 213}, {255, 245, 238}, {245, 255, 250}, {112, 128, 144}, {119, 136, 153},
168 {176, 196, 222}, {230, 230, 250}, {255, 250, 240}, {240, 248, 255}, {248, 248, 255}, {240, 255, 240}, {255, 255, 240}, {240, 255, 255},
169 {255, 250, 250}, {0, 0, 0}, {105, 105, 105}, {128, 128, 128}, {169, 169, 169}, {192, 192, 192}, {211, 211, 211}, {220, 220, 220},
170 {245, 245, 245}, {255, 255, 255},
175static const std::array<std::array<int8_t,6>, 6> normalsDotProducts = {{
192template <
typename T,
typename TT>
193inline double dotProduct(
const std::array<T, 3>& arr1,
const std::array<TT, 3>& arr2) {
194 return arr1[0] * arr2[0] + arr1[1] * arr2[1] + arr1[2] * arr2[2];
203 for (
const auto& elem : vector) {
205 hash ^= hasher(elem) + 0x9e3779b9 + (hash << 6U) + (hash >> 2U);
232template <
typename keyType>
234 return static_cast<keyType
>(x) + (
static_cast<keyType
>(y) << gdb) + (
static_cast<keyType
>(z) << gdb2);
237template <
typename keyType>
239 return location1DFromCoordinates<keyType>(point[0],point[1],point[2],gdb,gdb2);
283 std::vector<size_t>& pointsIdToVoxelId,
284 const size_t inputBitResolution,
285 const size_t outputBitResolution
288 uvgutils::Logger::log<uvgutils::LogLevel::TRACE>(
"PATCH GENERATION",
"Voxelization from " + std::to_string(inputBitResolution) +
" to " +
289 std::to_string(outputBitResolution) +
" bits of resolution.\n");
290 pointsIdToVoxelId.resize(inputPointsGeometry.size());
292 const size_t voxelizationShift = inputBitResolution - outputBitResolution;
295 const size_t approximateVoxelCount = 1U << (outputBitResolution * 2U);
296 voxelizedPointsGeometry.reserve(approximateVoxelCount);
299 voxelCoordToVoxelIndex.reserve(approximateVoxelCount);
300 size_t voxelIndex = 0;
301 for (
size_t inputPointIndex = 0; inputPointIndex < inputPointsGeometry.size(); ++inputPointIndex) {
308 auto [it, inserted] = voxelCoordToVoxelIndex.try_emplace(voxCoord, voxelIndex);
310 voxelizedPointsGeometry.emplace_back(voxCoord);
313 pointsIdToVoxelId[inputPointIndex] = voxelCoordToVoxelIndex[voxCoord];
Definition uvgvpccenc.hpp:49
uint16_t typeGeometryInput
Definition constants.hpp:49
Definition utilsPatchGeneration.hpp:219
bool updateFlag_
Definition utilsPatchGeneration.hpp:220
std::array< size_t, 6 > voxScore_
Definition utilsPatchGeneration.hpp:223
size_t voxPPI_
Definition utilsPatchGeneration.hpp:222
VoxelAttribute()
Definition utilsPatchGeneration.hpp:226
VoxClass voxClass_
Definition utilsPatchGeneration.hpp:221
Definition utilsPatchGeneration.hpp:199
size_t operator()(const uvgutils::VectorN< T, 3 > &vector) const
Definition utilsPatchGeneration.hpp:200
VoxClass
Definition utilsPatchGeneration.hpp:212
keyType location1DFromCoordinates(const int x, const int y, const int z, const size_t gdb, const size_t gdb2)
Definition utilsPatchGeneration.hpp:233
double dotProduct(const std::array< T, 3 > &arr1, const std::array< TT, 3 > &arr2)
Definition utilsPatchGeneration.hpp:193
const std::array< uvgutils::VectorN< uint8_t, 3 >, 114 > patchColors
Definition utilsPatchGeneration.hpp:154
keyType location1DFromPoint(const uvgutils::VectorN< typeGeometryInput, 3 > &point, const size_t gdb, const size_t gdb2)
Definition utilsPatchGeneration.hpp:238
void voxelization(const std::vector< uvgutils::VectorN< typeGeometryInput, 3 > > &inputPointsGeometry, std::vector< uvgutils::VectorN< typeGeometryInput, 3 > > &voxelizedPointsGeometry, std::vector< size_t > &pointsIdToVoxelId, const size_t inputBitResolution, const size_t outputBitResolution)
Definition utilsPatchGeneration.hpp:280