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