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
131 // Occupancy map
132 std::string occupancyEncoderName = "Kvazaar";
135 std::string occupancyEncodingFormat = "YUV420";
137 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
138 size_t occupancyMapDSResolution; // 'Rate' or 'qp' for the occupancy map
142
143 // Geometry map
144 std::string geometryEncoderName = "Kvazaar";
147 std::string geometryEncodingFormat = "YUV420";
149 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
152
153 // Attribute map
154 std::string attributeEncoderName = "Kvazaar";
157 std::string attributeEncodingFormat = "YUV420";
159 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
162
163 // ___ Miscellaneous ___ //
164 // bool useEncoderCommand = false; // lf : All mention of this parameter has been commented. This might be usefull to support command line
165 // 2D encoder in the futur.
166};
167
169
172 std::string possibleValues;
174 bool inPreset = false;
175
176 ParameterInfo(const ParameterType& type, const std::string& possibleValues, bool* parameterPtr)
178 if (type != BOOL) {
179 throw std::runtime_error(
180 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
181 "parameterType is: '" +
182 std::to_string(type) +
183 "' while the type of the parameter variable is BOOL (0). The corresponding variable name is not known, but here are its "
184 "possible values :'" +
185 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
186 }
187 }
190 if (type != INT) {
191 throw std::runtime_error(
192 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
193 "parameterType is: '" +
194 std::to_string(type) +
195 "' while the type of the parameter variable is INT (1). The corresponding variable name is not known, but here are its "
196 "possible values :'" +
197 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
198 }
199 }
200 ParameterInfo(const ParameterType& type, const std::string& possibleValues, size_t* parameterPtr)
202 if (type != UINT) {
203 throw std::runtime_error(
204 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
205 "parameterType is: '" +
206 std::to_string(type) +
207 "' while the type of the parameter variable is UINT (2). The corresponding variable name is not known, but here are its "
208 "possible values :'" +
209 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
210 }
211 }
212 ParameterInfo(const ParameterType& type, const std::string& possibleValues, std::string* parameterPtr)
214 if (type != STRING) {
215 throw std::runtime_error(
216 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
217 "parameterType is: '" +
218 std::to_string(type) +
219 "' while the type of the parameter variable is STRING (3). The corresponding variable name is not known, but here are its "
220 "possible values :'" +
221 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
222 }
223 }
224 ParameterInfo(const ParameterType& type, const std::string& possibleValues, float* parameterPtr)
226 if (type != FLOAT) {
227 throw std::runtime_error(
228 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
229 "parameterType is: '" +
230 std::to_string(type) +
231 "' while the type of the parameter variable is FLOAT (4). The corresponding variable name is not known, but here are its "
232 "possible values :'" +
233 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
234 }
235 }
236 ParameterInfo(const ParameterType& type, const std::string& possibleValues, double* parameterPtr)
238 if (type != DOUBLE) {
239 throw std::runtime_error(
240 "During the initialization of the library parameter maps, a type mismatch has been found. Apparently, the given "
241 "parameterType is: '" +
242 std::to_string(type) +
243 "' while the type of the parameter variable is DOUBLE (5). The corresponding variable name is not known, but here are its "
244 "possible values :'" +
245 possibleValues + "'. If you recently added a new parameter in the parameter map, the given type is probably wrong.");
246 }
247 }
248};
249
250extern const Parameters* p_; // Const pointer to a non-const Parameter struct instance in parameters.cpp
251
252void initializeParameterMap(Parameters& param);
253void setParameterValue(const std::string& parameterName, const std::string& parameterValue, const bool& fromPreset);
254
255} // namespace uvgvpcc_enc
Definition log.hpp:48
ParameterType
Definition parameters.hpp:168
@ DOUBLE
Definition parameters.hpp:168
@ BOOL
Definition parameters.hpp:168
@ UINT
Definition parameters.hpp:168
@ INT
Definition parameters.hpp:168
@ FLOAT
Definition parameters.hpp:168
@ STRING
Definition parameters.hpp:168
void setParameterValue(const std::string &parameterName, const std::string &parameterValue, const bool &fromPreset)
Definition parameters.cpp:291
void initializeParameterMap(Parameters &param)
Definition parameters.cpp:142
const Parameters * p_
Definition uvgvpcc.cpp:452
Definition parameters.hpp:170
ParameterInfo(const ParameterType &type, const std::string &possibleValues, float *parameterPtr)
Definition parameters.hpp:224
ParameterInfo(const ParameterType &type, const std::string &possibleValues, bool *parameterPtr)
Definition parameters.hpp:176
bool inPreset
Definition parameters.hpp:174
ParameterInfo(const ParameterType &type, const std::string &possibleValues, int *parameterPtr)
Definition parameters.hpp:188
ParameterInfo(const ParameterType &type, const std::string &possibleValues, std::string *parameterPtr)
Definition parameters.hpp:212
ParameterInfo(const ParameterType &type, const std::string &possibleValues, double *parameterPtr)
Definition parameters.hpp:236
ParameterType type
Definition parameters.hpp:171
std::string possibleValues
Definition parameters.hpp:172
ParameterInfo(const ParameterType &type, const std::string &possibleValues, size_t *parameterPtr)
Definition parameters.hpp:200
void * parameterPtr
Definition parameters.hpp:173
Definition parameters.hpp:48
std::string logLevel
Definition parameters.hpp:57
size_t refineSegmentationMaxNNVoxelDistanceLUT
Definition parameters.hpp:90
std::string occupancyEncoderName
Definition parameters.hpp:132
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:139
size_t kdTreeMaxLeafSize
Definition parameters.hpp:73
bool mapGenerationFillEmptyBlock
Definition parameters.hpp:122
size_t geometryEncodingNbThread
Definition parameters.hpp:148
size_t quantizerSizeX
Definition parameters.hpp:108
size_t log2QuantizerSizeX
Definition parameters.hpp:106
std::string occupancyEncodingFormat
Definition parameters.hpp:135
size_t omRefinementTreshold4
Definition parameters.hpp:141
size_t maxAllowedDist2RawPointsDetection
Definition parameters.hpp:97
std::string geometryEncodingPreset
Definition parameters.hpp:151
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:154
size_t minLevel
Definition parameters.hpp:104
size_t maxConcurrentFrames
Definition parameters.hpp:55
size_t omRefinementTreshold2
Definition parameters.hpp:140
std::string attributeEncodingMode
Definition parameters.hpp:156
std::string intermediateFilesDir
Definition parameters.hpp:63
bool geometryEncodingIsLossless
Definition parameters.hpp:145
size_t sizeGOP2DEncoding
Definition parameters.hpp:127
bool enablePatchSplitting
Definition parameters.hpp:102
size_t geometryEncodingQp
Definition parameters.hpp:150
bool attributeEncodingIsLossless
Definition parameters.hpp:155
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:158
size_t minimumMapHeight
Definition parameters.hpp:115
const size_t projectionPlaneCount
Definition parameters.hpp:85
std::string geometryEncoderName
Definition parameters.hpp:144
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:133
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:146
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:147
std::string attributeEncodingFormat
Definition parameters.hpp:157
std::string presetName
Definition parameters.hpp:52
size_t geoBitDepthInput
Definition parameters.hpp:50
std::string attributeEncodingPreset
Definition parameters.hpp:161
bool lowDelayBitstream
Definition parameters.hpp:67
size_t occupancyEncodingNbThread
Definition parameters.hpp:136
size_t occupancyMapDSResolution
Definition parameters.hpp:138
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:134
size_t attributeEncodingQp
Definition parameters.hpp:160
size_t geoBitDepthRefineSegmentation
Definition parameters.hpp:88