uvgVPCCenc 1.1.0
uvgVPCCenc is an open-source real-time V-PCC encoder library written in C++ from scratch.
Loading...
Searching...
No Matches
slicingPpiSegmenter.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 * This file is part of uvgVPCCenc V-PCC encoder.
3 *
4 * Copyright (c) 2024-present, Tampere University, ITU/ISO/IEC, project contributors
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
9 *
10 * * Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 * * Redistributions in binary form must reproduce the above copyright notice, this
14 * list of conditions and the following disclaimer in the documentation and/or
15 * other materials provided with the distribution.
16 *
17 * * Neither the name of the Tampere University or ITU/ISO/IEC nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
25 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26 * INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND ON
28 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 * INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
31 ****************************************************************************/
32
34
35#pragma once
36
37#include <cstdint>
38#include <vector>
40#include "utils/constants.hpp"
41#include "uvgutils/utils.hpp"
42#include "uvgvpcc/uvgvpcc.hpp"
43
44using namespace uvgvpcc_enc;
45
46
47enum class VoxClass_NewRS : uint8_t {
48 NO_EDGE = 0x00, // one ppi-vaue in a voxel
49 INDIRECT_EDGE = 0x01, // adjcent voxels of M_DIRECT_EDGE, S_DIRECT_EDGE
50 M_DIRECT_EDGE = 0x10, // multiple points && more than two ppi-values in a voxel TODO(lf)verify if typo -> (more than one instead no ?)
51 S_DIRECT_EDGE = 0x11 // single-point in a voxel, considered as a direct edge-voxel
52};
53
54// struct RefineParameters {
55// typeGeometryInput gridMaxAxisValue_;
56// size_t bitMask;
57// size_t distanceSearch;
58// };
59
60
61// TODO(lf): why to distinguish M and S direct edge ?
62// TODO(lf): Are S DIRECT EGDE always considered as direct edge ? Even if they share the same PPI as their neighbor ? Does this mean each
63// iteration focus on all single direct edge voxel ?
64
66 bool updateFlag_; // Va peut-être disparaître
68 size_t voxPPI_;
69 std::array<size_t,6> voxScore_; // TODO(lf): should be an array ?
70 // Voxel score is a PPI histogram : how many points inside the voxel is associated with each projection planes //
71
72 explicit VoxelAttribute_NewRS(const size_t projectionPlaneCount_);
73};
74
76 public:
77 PPISegmenter_NewRS(const std::vector<uvgutils::VectorN<typeGeometryInput, 3>>& pointsGeometry,
78 const std::vector<bool>& normalExists);
79
80 template<typename keyType>
81 void refineSegmentation_NewRS(const std::shared_ptr<uvgvpcc_enc::Frame>& frame,std::vector<size_t>& pointsPPIs, const size_t& frameId);
82
83 private:
84
85 template<typename keyType>
86 static void voxelizationWithBitArray_NewRS(const std::vector<uvgutils::VectorN<typeGeometryInput, 3>>& inputPointsGeometry,
87 std::vector<bool>& occFlagArray, robin_hood::unordered_map<keyType, size_t>& voxelIdxMap,
88 std::vector<keyType>& filledVoxels, std::vector<std::vector<size_t>>& pointListInVoxels);
89
90 static void computeExtendedScore_NewRS(std::array<size_t,6>& voxExtendedScore,
91 const std::vector<VoxelAttribute_NewRS>& voxAttributeList,
92 const std::vector<size_t>& ADJ_ListNew);
93
94 static void updateAdjacentVoxelsClass_NewRS(std::vector<VoxelAttribute_NewRS>& voxAttributeList,
95 const std::array<size_t,6>& voxExtendedScore,
96 const std::vector<size_t>& IDEV_List);
97
98 static inline bool checkNEV_NewRS(const VoxClass_NewRS voxClass, const size_t voxPPI,
99 const std::array<size_t,6>& voxExtendedScore);
100
101 inline void refinePointsPPIs_NewRS(std::vector<size_t>& pointsPPIs, const std::vector<size_t>& pointsPPIs_origin, const std::vector<size_t>& pointsIndices,
102 const std::array<size_t,6>& voxExtendedScore, const size_t nnPointCount) const;
103
104
105 static inline void updateVoxelAttribute_NewRS(VoxelAttribute_NewRS& voxAttribute, const std::vector<size_t>& voxPoints,
106 const std::vector<size_t>& pointsPPIs);
107
108 const std::vector<bool>& normalExists_;
109 const std::vector<uvgutils::VectorN<typeGeometryInput, 3>>& pointsGeometry_;
110 const typeGeometryInput geoMax_;
111 const typeGeometryInput geoRange_;
112};
Definition slicingPpiSegmenter.hpp:75
void refineSegmentation_NewRS(const std::shared_ptr< uvgvpcc_enc::Frame > &frame, std::vector< size_t > &pointsPPIs, const size_t &frameId)
Definition slicingPpiSegmenter.cpp:272
Definition robin_hood.h:921
Definition utils.hpp:49
Definition uvgvpcc.hpp:56
uint16_t typeGeometryInput
Definition constants.hpp:48
VoxClass_NewRS
Definition slicingPpiSegmenter.hpp:47
Definition slicingPpiSegmenter.hpp:65
VoxClass_NewRS voxClass_
Definition slicingPpiSegmenter.hpp:67
size_t voxPPI_
Definition slicingPpiSegmenter.hpp:68
std::array< size_t, 6 > voxScore_
Definition slicingPpiSegmenter.hpp:69
bool updateFlag_
Definition slicingPpiSegmenter.hpp:66