uvgVPCCenc 1.0.0
uvgVPCCenc is an open-source real-time V-PCC encoder library written in C++ from scratch.
Loading...
Searching...
No Matches
parameters.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 * This file is part of uvgVPCCenc V-PCC encoder.
3 *
4 * Copyright (c) 2024, 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 <stdexcept>
38#include <string>
39#include <vector>
40
41#include "utils.hpp"
42
43namespace uvgvpcc_enc {
44
45
46// Configuration of the encoder, only const variable //
47// Value here are default values non defined in presets. It is strongly NON-recommended to modify the values here. Use 'setParameter' or 'setParameters' function in the application instead.
48struct Parameters {
49
50 // ___ General parameters __ //
51 size_t geoBitDepthInput; // (inputGeometryBitDepth3D?) geometry3dCoordinatesBitdepth // TODO(lf)rename in resolution or something more catchy ?
52 std::string presetName;
53 size_t sizeGOF;
54 size_t nbThreadPCPart = 0; // 0 means the actual number of detected threads
55 bool doubleLayer = true;
56 std::string logLevel = "INFO";
57 bool errorsAreFatal = true;
59
60 // ___ Debug parameters ___ //
63
64 // ___ Activate or not some features ___ //
65 bool lowDelayBitstream = false;
66
67 // ___ Voxelization ___ // (grid-based segmentation)
68 size_t geoBitDepthVoxelized; // voxelizedGeometryBitDepth3D // grid-based segmentation
69
70 // ___ KdTree ___ //
71 size_t kdTreeMaxLeafSize = 10; // TODO(lf)deprecated no ? (as there are other parameterrs for it, for each kdtree case)
72
73 // Normal computation //
76
77
78 // Normal orientation //
80
81
82 // PPI segmentation //
83 const std::vector<Vector3<double>> projectionPlaneOrientations = {
84 {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}, {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, -1.0}}};
85 const size_t projectionPlaneCount = 6; // TODO(lf): move out from parameters ?
86
87
88 // ___ PPI smoothing ___ // (fast grid-based refine segmentation)
89 size_t geoBitDepthRefineSegmentation; // refineSegmentationGeometryBitDepth3D
90 // TODO(lf)verify that all scale set by user are compatible
91 size_t refineSegmentationMaxNNVoxelDistanceLUT; // lf note : 9**2 = 81 ~ 192/2
95 // TODO(lf)check the config if all concerned parameters are poqwer of two
96
97
98 // ___ Patch generation ___ // (patch segmentation)
99 size_t maxAllowedDist2RawPointsDetection = 5; // TODO(lf): add verification to avoid segfault because index out of bound
101 size_t maxPatchSize; // TODO(lf): debug when maxPatchSize = 200
102 size_t maxNNCountPatchSegmentation = 5; // TODO(lf)check max all NN
104 // lf : for reworked function only. If the value is 4, the euclidian distance is 16. // TODO(lf): the default value should be 2 I
105 // guess // Nop, it should be 1 // TODO(lf): make sure to use <= instead of < in the for loop so to avoid this confusion.
107 // TODO(lf)there is a mix with occupancyPrecision // TODO(lf)rename it as blocSizeOccupancyMap or something like this
108 size_t minLevel = 64; // TODO(lf): must be a power of 2 ? So give the power of two and do only shifting, no division // might be
109 // related to the different avaliable position of the projection plan of each path
112 size_t quantizerSizeX = static_cast<size_t>(1) << log2QuantizerSizeX; // TODO(lf): investigate
113 size_t quantizerSizeY = static_cast<size_t>(1) << log2QuantizerSizeY;
115
116
117 // ___ Patch packing ___ //
118 size_t mapWidth; // TODO(lf)check if it is a multipl of occupancy resolution
120 // TODO(lf): lf : As Joose explain to me, in theory, it would be the height which is constant and equals to 64*nbThreads
123 float gpaTresholdIoU = 0.3; // global patch allocation treshold for the intersection over union process
124
125
126 // ___ Map generation ___ //
130
131
132 // ___ 2D encoding parameters ___ //
137 size_t intraFramePeriod = 64; // TODO(lf): Not useful yet as a new 2D encoder is created for each GOF. (64 is default Kvazaar value. In uvgVPCCenc, the value is indirectly set by 8 or 16, depending on the size of the 2D encoding GOP)
138
139 // Occupancy map
140 std::string occupancyEncoderName = "Kvazaar";
143 std::string occupancyEncodingFormat = "YUV420";
144 size_t occupancyEncodingNbThread = 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
145 size_t occupancyMapResolution; // 'Rate' or 'qp' for the occupancy map
147
148 // Geometry map
149 std::string geometryEncoderName = "Kvazaar";
152 std::string geometryEncodingFormat = "YUV420";
153 size_t geometryEncodingNbThread = 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
156
157 // Attribute map
158 std::string attributeEncoderName = "Kvazaar";
161 std::string attributeEncodingFormat = "YUV420";
162 size_t attributeEncodingNbThread = 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
165
166
167 // ___ Miscellaneous ___ //
168 // bool useEncoderCommand = false; // lf : All mention of this parameter has been commented. This might be usefull to support command line 2D encoder in the futur.
169};
170
171
173
176 std::string possibleValues;
178 bool inPreset = false;
179
181 if(type != BOOL) {
182 throw std::runtime_error("During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given parameterType is: '" + std::to_string(type) + "' while the type of the parameter variable is BOOL (0). The corresponding variable name is not known, but here are its possible values :'" + possibleValues +"'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
183 }
184 }
186 if(type != INT) {
187 throw std::runtime_error("During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given parameterType is: '" + std::to_string(type) + "' while the type of the parameter variable is INT (1). The corresponding variable name is not known, but here are its possible values :'" + possibleValues +"'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
188 }
189 }
191 if(type != UINT) {
192 throw std::runtime_error("During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given parameterType is: '" + std::to_string(type) + "' while the type of the parameter variable is UINT (2). The corresponding variable name is not known, but here are its possible values :'" + possibleValues +"'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
193 }
194 }
196 if(type != STRING) {
197 throw std::runtime_error("During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given parameterType is: '" + std::to_string(type) + "' while the type of the parameter variable is STRING (3). The corresponding variable name is not known, but here are its possible values :'" + possibleValues +"'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
198 }
199 }
201 if(type != FLOAT) {
202 throw std::runtime_error("During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given parameterType is: '" + std::to_string(type) + "' while the type of the parameter variable is FLOAT (4). The corresponding variable name is not known, but here are its possible values :'" + possibleValues +"'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
203 }
204 }
206 if(type != DOUBLE) {
207 throw std::runtime_error("During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given parameterType is: '" + std::to_string(type) + "' while the type of the parameter variable is DOUBLE (5). The corresponding variable name is not known, but here are its possible values :'" + possibleValues +"'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
208 }
209 }
210
211};
212
213
214void initializeParameterMap(Parameters& param);
215void setParameterValue(const std::string& parameterName,const std::string& parameterValue, const bool& fromPreset);
216
217
218
219} // uvgvpcc_enc namespace
Definition log.hpp:43
ParameterType
Definition parameters.hpp:172
@ DOUBLE
Definition parameters.hpp:172
@ BOOL
Definition parameters.hpp:172
@ UINT
Definition parameters.hpp:172
@ INT
Definition parameters.hpp:172
@ FLOAT
Definition parameters.hpp:172
@ STRING
Definition parameters.hpp:172
void setParameterValue(const std::string &parameterName, const std::string &parameterValue, const bool &fromPreset)
Definition parameters.cpp:294
void initializeParameterMap(Parameters &param)
Definition parameters.cpp:148
Definition parameters.hpp:174
ParameterInfo(const ParameterType &type, const std::string &possibleValues, float *parameterPtr)
Definition parameters.hpp:200
ParameterInfo(const ParameterType &type, const std::string &possibleValues, bool *parameterPtr)
Definition parameters.hpp:180
bool inPreset
Definition parameters.hpp:178
ParameterInfo(const ParameterType &type, const std::string &possibleValues, int *parameterPtr)
Definition parameters.hpp:185
ParameterInfo(const ParameterType &type, const std::string &possibleValues, std::string *parameterPtr)
Definition parameters.hpp:195
ParameterInfo(const ParameterType &type, const std::string &possibleValues, double *parameterPtr)
Definition parameters.hpp:205
ParameterType type
Definition parameters.hpp:175
std::string possibleValues
Definition parameters.hpp:176
ParameterInfo(const ParameterType &type, const std::string &possibleValues, size_t *parameterPtr)
Definition parameters.hpp:190
void * parameterPtr
Definition parameters.hpp:177
Definition parameters.hpp:48
std::string logLevel
Definition parameters.hpp:56
size_t refineSegmentationMaxNNVoxelDistanceLUT
Definition parameters.hpp:91
std::string occupancyEncoderName
Definition parameters.hpp:140
size_t mapGenerationBackgroundValueAttribute
Definition parameters.hpp:128
std::string basenameGeometryFiles
Definition parameters.hpp:134
size_t mapWidth
Definition parameters.hpp:118
size_t normalComputationMaxDiagonalStep
Definition parameters.hpp:75
std::string occupancyEncodingPreset
Definition parameters.hpp:146
size_t kdTreeMaxLeafSize
Definition parameters.hpp:71
bool mapGenerationFillEmptyBlock
Definition parameters.hpp:127
size_t geometryEncodingNbThread
Definition parameters.hpp:153
size_t quantizerSizeX
Definition parameters.hpp:112
size_t log2QuantizerSizeX
Definition parameters.hpp:110
std::string occupancyEncodingFormat
Definition parameters.hpp:143
size_t maxAllowedDist2RawPointsDetection
Definition parameters.hpp:99
std::string geometryEncodingPreset
Definition parameters.hpp:155
size_t log2QuantizerSizeY
Definition parameters.hpp:111
size_t surfaceThickness
Definition parameters.hpp:114
double refineSegmentationLambda
Definition parameters.hpp:93
size_t mapGenerationBackgroundValueGeometry
Definition parameters.hpp:129
std::string attributeEncoderName
Definition parameters.hpp:158
size_t minLevel
Definition parameters.hpp:108
bool exportIntermediatePointClouds
Definition parameters.hpp:62
std::string attributeEncodingMode
Definition parameters.hpp:160
std::string intermediateFilesDir
Definition parameters.hpp:58
bool geometryEncodingIsLossless
Definition parameters.hpp:150
size_t sizeGOP2DEncoding
Definition parameters.hpp:136
bool enablePatchSplitting
Definition parameters.hpp:106
size_t geometryEncodingQp
Definition parameters.hpp:154
bool attributeEncodingIsLossless
Definition parameters.hpp:159
bool exportIntermediateMaps
Definition parameters.hpp:61
bool errorsAreFatal
Definition parameters.hpp:57
size_t quantizerSizeY
Definition parameters.hpp:113
size_t intraFramePeriod
Definition parameters.hpp:137
size_t refineSegmentationMaxNNTotalPointCount
Definition parameters.hpp:92
size_t attributeEncodingNbThread
Definition parameters.hpp:162
size_t minimumMapHeight
Definition parameters.hpp:119
const size_t projectionPlaneCount
Definition parameters.hpp:85
std::string geometryEncoderName
Definition parameters.hpp:149
size_t patchSegmentationMaxPropagationDistance
Definition parameters.hpp:103
size_t geoBitDepthVoxelized
Definition parameters.hpp:68
size_t normalComputationKnnCount
Definition parameters.hpp:74
bool occupancyEncodingIsLossless
Definition parameters.hpp:141
float gpaTresholdIoU
Definition parameters.hpp:123
size_t refineSegmentationIterationCount
Definition parameters.hpp:94
bool doubleLayer
Definition parameters.hpp:55
size_t sizeGOF
Definition parameters.hpp:53
std::string geometryEncodingMode
Definition parameters.hpp:151
size_t maxNNCountPatchSegmentation
Definition parameters.hpp:102
const std::vector< Vector3< double > > projectionPlaneOrientations
Definition parameters.hpp:83
size_t spacePatchPacking
Definition parameters.hpp:121
size_t minPointCountPerCC
Definition parameters.hpp:100
std::string geometryEncodingFormat
Definition parameters.hpp:152
std::string attributeEncodingFormat
Definition parameters.hpp:161
size_t occupancyMapResolution
Definition parameters.hpp:145
std::string presetName
Definition parameters.hpp:52
size_t geoBitDepthInput
Definition parameters.hpp:51
std::string attributeEncodingPreset
Definition parameters.hpp:164
bool lowDelayBitstream
Definition parameters.hpp:65
size_t occupancyEncodingNbThread
Definition parameters.hpp:144
size_t maxPatchSize
Definition parameters.hpp:101
size_t nbThreadPCPart
Definition parameters.hpp:54
std::string basenameAttributeFiles
Definition parameters.hpp:135
std::string basenameOccupancyFiles
Definition parameters.hpp:133
bool interPatchPacking
Definition parameters.hpp:122
size_t normalOrientationKnnCount
Definition parameters.hpp:79
std::string occupancyEncodingMode
Definition parameters.hpp:142
size_t attributeEncodingQp
Definition parameters.hpp:163
size_t geoBitDepthRefineSegmentation
Definition parameters.hpp:89