uvgVPCCenc 1.1.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// Configuration of the encoder, only const variable //
46// Value here are default values non defined in presets. It is strongly NON-recommended to modify the values here. Use 'setParameter' or
47// 'setParameters' function in the application instead.
48struct Parameters {
49 // ___ General parameters __ //
50 size_t geoBitDepthInput; // (inputGeometryBitDepth3D?) geometry3dCoordinatesBitdepth // TODO(lf)rename in resolution or something more
51 // catchy ?
52 std::string presetName;
53 size_t sizeGOF;
54 size_t nbThreadPCPart = 0; // 0 means the actual number of detected threads
55 size_t maxConcurrentFrames = 0; // 0 means the actual value is set to 4 times sizeGOF
56 bool doubleLayer = true;
57 std::string logLevel = "INFO";
58 bool errorsAreFatal = true;
59
60 // ___ Debug parameters ___ //
64 bool timerLog = false; // TODO(lf): remove and activate it if loglevel is profiling
65
66 // ___ Activate or not some features ___ //
67 bool lowDelayBitstream = false;
68
69 // ___ Voxelization ___ // (grid-based segmentation)
70 size_t geoBitDepthVoxelized; // voxelizedGeometryBitDepth3D // grid-based segmentation
71
72 // ___ KdTree ___ //
73 size_t kdTreeMaxLeafSize = 10; // TODO(lf)deprecated no ? (as there are other parameterrs for it, for each kdtree case)
74
75 // Normal computation //
78
79 // Normal orientation //
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 // ___ PPI smoothing ___ // (fast grid-based refine segmentation)
88 size_t geoBitDepthRefineSegmentation; // refineSegmentationGeometryBitDepth3D
89 // TODO(lf)verify that all scale set by user are compatible
90 size_t refineSegmentationMaxNNVoxelDistanceLUT; // lf note : 9**2 = 81 ~ 192/2
94 // TODO(lf)check the config if all concerned parameters are poqwer of two
95
96 // ___ Patch generation ___ // (patch segmentation)
97 size_t maxAllowedDist2RawPointsDetection = 5; // TODO(lf): add verification to avoid segfault because index out of bound
100 // lf : for reworked function only. If the value is 4, the euclidian distance is 16. // TODO(lf): the default value should be 2 I
101 // guess // Nop, it should be 1 // TODO(lf): make sure to use <= instead of < in the for loop so to avoid this confusion.
103 // TODO(lf)there is a mix with occupancyPrecision // TODO(lf)rename it as blocSizeOccupancyMap or something like this
104 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
105 // related to the different avaliable position of the projection plan of each path
108 size_t quantizerSizeX = static_cast<size_t>(1) << log2QuantizerSizeX; // TODO(lf): investigate
109 size_t quantizerSizeY = static_cast<size_t>(1) << log2QuantizerSizeY;
111 size_t distanceFiltering = 32; // tmp_a in TMC2 // TODO(lf) check impact on quality
112
113 // ___ Patch packing ___ //
114 size_t mapWidth; // TODO(lf)check if it is a multipl of occupancy resolution
116 // TODO(lf): lf : As Joose explain to me, in theory, it would be the height which is constant and equals to 64*nbThreads
119 float gpaTresholdIoU = 0.3; // global patch allocation treshold for the intersection over union process
120
121 // ___ Map generation ___ //
125
126 // ___ 2D encoding parameters ___ //
128 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
129 // uvgVPCCenc, the value is indirectly set by 8 or 16, depending on the size of the 2D encoding GOP)
130 bool encoderInfoSEI = false;
131
132 // Occupancy map
133 std::string occupancyEncoderName = "Kvazaar";
136 std::string occupancyEncodingFormat = "YUV420";
138 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
139 size_t occupancyMapDSResolution; // 'Rate' or 'qp' for the occupancy map
143
144 // Geometry map
145 std::string geometryEncoderName = "Kvazaar";
148 std::string geometryEncodingFormat = "YUV420";
150 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
153
154 // Attribute map
155 std::string attributeEncoderName = "Kvazaar";
158 std::string attributeEncodingFormat = "YUV420";
160 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
163
164 // ___ Miscellaneous ___ //
165 // bool useEncoderCommand = false; // lf : All mention of this parameter has been commented. This might be usefull to support command line
166 // 2D encoder in the futur.
167};
168
170
173 std::string possibleValues;
175 bool inPreset = false;
176
177 ParameterInfo(const ParameterType& type, const std::string& possibleValues, bool* parameterPtr)
179 if (type != BOOL) {
180 throw std::runtime_error(
181 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
182 "parameterType is: '" +
183 std::to_string(type) +
184 "' while the type of the parameter variable is BOOL (0). The corresponding variable name is not known, but here are its "
185 "possible values :'" +
186 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
187 }
188 }
191 if (type != INT) {
192 throw std::runtime_error(
193 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
194 "parameterType is: '" +
195 std::to_string(type) +
196 "' while the type of the parameter variable is INT (1). The corresponding variable name is not known, but here are its "
197 "possible values :'" +
198 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
199 }
200 }
201 ParameterInfo(const ParameterType& type, const std::string& possibleValues, size_t* parameterPtr)
203 if (type != UINT) {
204 throw std::runtime_error(
205 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
206 "parameterType is: '" +
207 std::to_string(type) +
208 "' while the type of the parameter variable is UINT (2). The corresponding variable name is not known, but here are its "
209 "possible values :'" +
210 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
211 }
212 }
213 ParameterInfo(const ParameterType& type, const std::string& possibleValues, std::string* parameterPtr)
215 if (type != STRING) {
216 throw std::runtime_error(
217 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
218 "parameterType is: '" +
219 std::to_string(type) +
220 "' while the type of the parameter variable is STRING (3). The corresponding variable name is not known, but here are its "
221 "possible values :'" +
222 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
223 }
224 }
225 ParameterInfo(const ParameterType& type, const std::string& possibleValues, float* parameterPtr)
227 if (type != FLOAT) {
228 throw std::runtime_error(
229 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
230 "parameterType is: '" +
231 std::to_string(type) +
232 "' while the type of the parameter variable is FLOAT (4). The corresponding variable name is not known, but here are its "
233 "possible values :'" +
234 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
235 }
236 }
237 ParameterInfo(const ParameterType& type, const std::string& possibleValues, double* parameterPtr)
239 if (type != DOUBLE) {
240 throw std::runtime_error(
241 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
242 "parameterType is: '" +
243 std::to_string(type) +
244 "' while the type of the parameter variable is DOUBLE (5). The corresponding variable name is not known, but here are its "
245 "possible values :'" +
246 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
247 }
248 }
249};
250
251extern const Parameters* p_; // Const pointer to a non-const Parameter struct instance in parameters.cpp
252
253void initializeParameterMap(Parameters& param);
254void setParameterValue(const std::string& parameterName, const std::string& parameterValue, const bool& fromPreset);
255
256} // namespace uvgvpcc_enc
Definition log.hpp:48
ParameterType
Definition parameters.hpp:169
@ DOUBLE
Definition parameters.hpp:169
@ BOOL
Definition parameters.hpp:169
@ UINT
Definition parameters.hpp:169
@ INT
Definition parameters.hpp:169
@ FLOAT
Definition parameters.hpp:169
@ STRING
Definition parameters.hpp:169
void setParameterValue(const std::string &parameterName, const std::string &parameterValue, const bool &fromPreset)
Definition parameters.cpp:292
void initializeParameterMap(Parameters &param)
Definition parameters.cpp:142
const Parameters * p_
Definition uvgvpcc.cpp:452
Definition parameters.hpp:171
ParameterInfo(const ParameterType &type, const std::string &possibleValues, float *parameterPtr)
Definition parameters.hpp:225
ParameterInfo(const ParameterType &type, const std::string &possibleValues, bool *parameterPtr)
Definition parameters.hpp:177
bool inPreset
Definition parameters.hpp:175
ParameterInfo(const ParameterType &type, const std::string &possibleValues, int *parameterPtr)
Definition parameters.hpp:189
ParameterInfo(const ParameterType &type, const std::string &possibleValues, std::string *parameterPtr)
Definition parameters.hpp:213
ParameterInfo(const ParameterType &type, const std::string &possibleValues, double *parameterPtr)
Definition parameters.hpp:237
ParameterType type
Definition parameters.hpp:172
std::string possibleValues
Definition parameters.hpp:173
ParameterInfo(const ParameterType &type, const std::string &possibleValues, size_t *parameterPtr)
Definition parameters.hpp:201
void * parameterPtr
Definition parameters.hpp:174
Definition parameters.hpp:48
bool encoderInfoSEI
Definition parameters.hpp:130
std::string logLevel
Definition parameters.hpp:57
size_t refineSegmentationMaxNNVoxelDistanceLUT
Definition parameters.hpp:90
std::string occupancyEncoderName
Definition parameters.hpp:133
size_t mapGenerationBackgroundValueAttribute
Definition parameters.hpp:123
size_t distanceFiltering
Definition parameters.hpp:111
size_t mapWidth
Definition parameters.hpp:114
size_t normalComputationMaxDiagonalStep
Definition parameters.hpp:77
std::string occupancyEncodingPreset
Definition parameters.hpp:140
size_t kdTreeMaxLeafSize
Definition parameters.hpp:73
bool mapGenerationFillEmptyBlock
Definition parameters.hpp:122
size_t geometryEncodingNbThread
Definition parameters.hpp:149
size_t quantizerSizeX
Definition parameters.hpp:108
size_t log2QuantizerSizeX
Definition parameters.hpp:106
std::string occupancyEncodingFormat
Definition parameters.hpp:136
size_t omRefinementTreshold4
Definition parameters.hpp:142
size_t maxAllowedDist2RawPointsDetection
Definition parameters.hpp:97
std::string geometryEncodingPreset
Definition parameters.hpp:152
size_t log2QuantizerSizeY
Definition parameters.hpp:107
size_t surfaceThickness
Definition parameters.hpp:110
double refineSegmentationLambda
Definition parameters.hpp:92
size_t mapGenerationBackgroundValueGeometry
Definition parameters.hpp:124
std::string attributeEncoderName
Definition parameters.hpp:155
size_t minLevel
Definition parameters.hpp:104
size_t maxConcurrentFrames
Definition parameters.hpp:55
size_t omRefinementTreshold2
Definition parameters.hpp:141
std::string attributeEncodingMode
Definition parameters.hpp:157
std::string intermediateFilesDir
Definition parameters.hpp:63
bool geometryEncodingIsLossless
Definition parameters.hpp:146
size_t sizeGOP2DEncoding
Definition parameters.hpp:127
bool enablePatchSplitting
Definition parameters.hpp:102
size_t geometryEncodingQp
Definition parameters.hpp:151
bool attributeEncodingIsLossless
Definition parameters.hpp:156
bool errorsAreFatal
Definition parameters.hpp:58
size_t quantizerSizeY
Definition parameters.hpp:109
bool timerLog
Definition parameters.hpp:64
size_t intraFramePeriod
Definition parameters.hpp:128
bool exportIntermediateFiles
Definition parameters.hpp:61
size_t refineSegmentationMaxNNTotalPointCount
Definition parameters.hpp:91
size_t attributeEncodingNbThread
Definition parameters.hpp:159
size_t minimumMapHeight
Definition parameters.hpp:115
const size_t projectionPlaneCount
Definition parameters.hpp:85
std::string geometryEncoderName
Definition parameters.hpp:145
size_t patchSegmentationMaxPropagationDistance
Definition parameters.hpp:99
size_t geoBitDepthVoxelized
Definition parameters.hpp:70
bool intermediateFilesDirTimeStamp
Definition parameters.hpp:62
size_t normalComputationKnnCount
Definition parameters.hpp:76
bool occupancyEncodingIsLossless
Definition parameters.hpp:134
float gpaTresholdIoU
Definition parameters.hpp:119
size_t refineSegmentationIterationCount
Definition parameters.hpp:93
bool doubleLayer
Definition parameters.hpp:56
size_t sizeGOF
Definition parameters.hpp:53
std::string geometryEncodingMode
Definition parameters.hpp:147
const std::vector< Vector3< double > > projectionPlaneOrientations
Definition parameters.hpp:83
size_t spacePatchPacking
Definition parameters.hpp:117
size_t minPointCountPerCC
Definition parameters.hpp:98
std::string geometryEncodingFormat
Definition parameters.hpp:148
std::string attributeEncodingFormat
Definition parameters.hpp:158
std::string presetName
Definition parameters.hpp:52
size_t geoBitDepthInput
Definition parameters.hpp:50
std::string attributeEncodingPreset
Definition parameters.hpp:162
bool lowDelayBitstream
Definition parameters.hpp:67
size_t occupancyEncodingNbThread
Definition parameters.hpp:137
size_t occupancyMapDSResolution
Definition parameters.hpp:139
size_t nbThreadPCPart
Definition parameters.hpp:54
bool interPatchPacking
Definition parameters.hpp:118
size_t normalOrientationKnnCount
Definition parameters.hpp:80
std::string occupancyEncodingMode
Definition parameters.hpp:135
size_t attributeEncodingQp
Definition parameters.hpp:161
size_t geoBitDepthRefineSegmentation
Definition parameters.hpp:88