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 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;
60
61 // ___ Debug parameters ___ //
64 bool timerLog = false;
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
80 // Normal orientation //
82
83
84 // PPI segmentation //
85 const std::vector<Vector3<double>> projectionPlaneOrientations = {
86 {{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}}};
87 const size_t projectionPlaneCount = 6; // TODO(lf): move out from parameters ?
88
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
99
100 // ___ Patch generation ___ // (patch segmentation)
101 size_t maxAllowedDist2RawPointsDetection = 5; // TODO(lf): add verification to avoid segfault because index out of bound
103 size_t maxPatchSize; // TODO(lf): debug when maxPatchSize = 200
104 size_t maxNNCountPatchSegmentation = 5; // TODO(lf)check max all NN
106 // lf : for reworked function only. If the value is 4, the euclidian distance is 16. // TODO(lf): the default value should be 2 I
107 // guess // Nop, it should be 1 // TODO(lf): make sure to use <= instead of < in the for loop so to avoid this confusion.
109 // TODO(lf)there is a mix with occupancyPrecision // TODO(lf)rename it as blocSizeOccupancyMap or something like this
110 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
111 // related to the different avaliable position of the projection plan of each path
114 size_t quantizerSizeX = static_cast<size_t>(1) << log2QuantizerSizeX; // TODO(lf): investigate
115 size_t quantizerSizeY = static_cast<size_t>(1) << log2QuantizerSizeY;
117
118
119 // ___ Patch packing ___ //
120 size_t mapWidth; // TODO(lf)check if it is a multipl of occupancy resolution
122 // TODO(lf): lf : As Joose explain to me, in theory, it would be the height which is constant and equals to 64*nbThreads
125 float gpaTresholdIoU = 0.3; // global patch allocation treshold for the intersection over union process
126
127
128 // ___ Map generation ___ //
132
133
134 // ___ 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 uvgVPCCenc, the value is indirectly set by 8 or 16, depending on the size of the 2D encoding GOP)
141
142 // Occupancy map
143 std::string occupancyEncoderName = "Kvazaar";
146 std::string occupancyEncodingFormat = "YUV420";
147 size_t occupancyEncodingNbThread = 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
148 size_t occupancyMapDSResolution; // 'Rate' or 'qp' for the occupancy map
152
153 // Geometry map
154 std::string geometryEncoderName = "Kvazaar";
157 std::string geometryEncodingFormat = "YUV420";
158 size_t geometryEncodingNbThread = 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
161
162 // Attribute map
163 std::string attributeEncoderName = "Kvazaar";
166 std::string attributeEncodingFormat = "YUV420";
167 size_t attributeEncodingNbThread = 0; // 0 by default means that this variable will have for value during execution the actual number of detected threads
170
171
172 // ___ Miscellaneous ___ //
173 // 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.
174};
175
176
178
181 std::string possibleValues;
183 bool inPreset = false;
184
186 if(type != BOOL) {
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 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.");
188 }
189 }
191 if(type != INT) {
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 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.");
193 }
194 }
196 if(type != UINT) {
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 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.");
198 }
199 }
201 if(type != STRING) {
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 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.");
203 }
204 }
206 if(type != FLOAT) {
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 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.");
208 }
209 }
211 if(type != DOUBLE) {
212 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.");
213 }
214 }
215
216};
217
218
219void initializeParameterMap(Parameters& param);
220void setParameterValue(const std::string& parameterName,const std::string& parameterValue, const bool& fromPreset);
221
222
223
224} // uvgvpcc_enc namespace
Definition log.hpp:43
ParameterType
Definition parameters.hpp:177
@ DOUBLE
Definition parameters.hpp:177
@ BOOL
Definition parameters.hpp:177
@ UINT
Definition parameters.hpp:177
@ INT
Definition parameters.hpp:177
@ FLOAT
Definition parameters.hpp:177
@ STRING
Definition parameters.hpp:177
void setParameterValue(const std::string &parameterName, const std::string &parameterValue, const bool &fromPreset)
Definition parameters.cpp:299
void initializeParameterMap(Parameters &param)
Definition parameters.cpp:148
Definition parameters.hpp:179
ParameterInfo(const ParameterType &type, const std::string &possibleValues, float *parameterPtr)
Definition parameters.hpp:205
ParameterInfo(const ParameterType &type, const std::string &possibleValues, bool *parameterPtr)
Definition parameters.hpp:185
bool inPreset
Definition parameters.hpp:183
ParameterInfo(const ParameterType &type, const std::string &possibleValues, int *parameterPtr)
Definition parameters.hpp:190
ParameterInfo(const ParameterType &type, const std::string &possibleValues, std::string *parameterPtr)
Definition parameters.hpp:200
ParameterInfo(const ParameterType &type, const std::string &possibleValues, double *parameterPtr)
Definition parameters.hpp:210
ParameterType type
Definition parameters.hpp:180
std::string possibleValues
Definition parameters.hpp:181
ParameterInfo(const ParameterType &type, const std::string &possibleValues, size_t *parameterPtr)
Definition parameters.hpp:195
void * parameterPtr
Definition parameters.hpp:182
Definition parameters.hpp:48
std::string logLevel
Definition parameters.hpp:57
size_t refineSegmentationMaxNNVoxelDistanceLUT
Definition parameters.hpp:93
std::string occupancyEncoderName
Definition parameters.hpp:143
size_t mapGenerationBackgroundValueAttribute
Definition parameters.hpp:130
std::string basenameGeometryFiles
Definition parameters.hpp:137
size_t mapWidth
Definition parameters.hpp:120
size_t normalComputationMaxDiagonalStep
Definition parameters.hpp:77
std::string occupancyEncodingPreset
Definition parameters.hpp:149
size_t kdTreeMaxLeafSize
Definition parameters.hpp:73
bool mapGenerationFillEmptyBlock
Definition parameters.hpp:129
size_t geometryEncodingNbThread
Definition parameters.hpp:158
size_t quantizerSizeX
Definition parameters.hpp:114
size_t log2QuantizerSizeX
Definition parameters.hpp:112
std::string occupancyEncodingFormat
Definition parameters.hpp:146
size_t omRefinementTreshold4
Definition parameters.hpp:151
size_t maxAllowedDist2RawPointsDetection
Definition parameters.hpp:101
std::string geometryEncodingPreset
Definition parameters.hpp:160
size_t log2QuantizerSizeY
Definition parameters.hpp:113
size_t surfaceThickness
Definition parameters.hpp:116
double refineSegmentationLambda
Definition parameters.hpp:95
size_t mapGenerationBackgroundValueGeometry
Definition parameters.hpp:131
std::string attributeEncoderName
Definition parameters.hpp:163
size_t minLevel
Definition parameters.hpp:110
size_t maxConcurrentFrames
Definition parameters.hpp:55
size_t omRefinementTreshold2
Definition parameters.hpp:150
bool exportIntermediatePointClouds
Definition parameters.hpp:63
std::string attributeEncodingMode
Definition parameters.hpp:165
std::string intermediateFilesDir
Definition parameters.hpp:59
bool geometryEncodingIsLossless
Definition parameters.hpp:155
size_t sizeGOP2DEncoding
Definition parameters.hpp:139
bool enablePatchSplitting
Definition parameters.hpp:108
size_t geometryEncodingQp
Definition parameters.hpp:159
bool attributeEncodingIsLossless
Definition parameters.hpp:164
bool exportIntermediateMaps
Definition parameters.hpp:62
std::string basenameOccupancyDSFiles
Definition parameters.hpp:136
bool errorsAreFatal
Definition parameters.hpp:58
size_t quantizerSizeY
Definition parameters.hpp:115
bool timerLog
Definition parameters.hpp:64
size_t intraFramePeriod
Definition parameters.hpp:140
size_t refineSegmentationMaxNNTotalPointCount
Definition parameters.hpp:94
size_t attributeEncodingNbThread
Definition parameters.hpp:167
size_t minimumMapHeight
Definition parameters.hpp:121
const size_t projectionPlaneCount
Definition parameters.hpp:87
std::string geometryEncoderName
Definition parameters.hpp:154
size_t patchSegmentationMaxPropagationDistance
Definition parameters.hpp:105
size_t geoBitDepthVoxelized
Definition parameters.hpp:70
size_t normalComputationKnnCount
Definition parameters.hpp:76
bool occupancyEncodingIsLossless
Definition parameters.hpp:144
float gpaTresholdIoU
Definition parameters.hpp:125
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:156
size_t maxNNCountPatchSegmentation
Definition parameters.hpp:104
const std::vector< Vector3< double > > projectionPlaneOrientations
Definition parameters.hpp:85
size_t spacePatchPacking
Definition parameters.hpp:123
size_t minPointCountPerCC
Definition parameters.hpp:102
std::string geometryEncodingFormat
Definition parameters.hpp:157
std::string attributeEncodingFormat
Definition parameters.hpp:166
std::string presetName
Definition parameters.hpp:52
size_t geoBitDepthInput
Definition parameters.hpp:51
std::string attributeEncodingPreset
Definition parameters.hpp:169
bool lowDelayBitstream
Definition parameters.hpp:67
size_t occupancyEncodingNbThread
Definition parameters.hpp:147
size_t maxPatchSize
Definition parameters.hpp:103
size_t occupancyMapDSResolution
Definition parameters.hpp:148
size_t nbThreadPCPart
Definition parameters.hpp:54
std::string basenameAttributeFiles
Definition parameters.hpp:138
std::string basenameOccupancyFiles
Definition parameters.hpp:135
bool interPatchPacking
Definition parameters.hpp:124
size_t normalOrientationKnnCount
Definition parameters.hpp:81
std::string occupancyEncodingMode
Definition parameters.hpp:145
size_t attributeEncodingQp
Definition parameters.hpp:168
size_t geoBitDepthRefineSegmentation
Definition parameters.hpp:91