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