Ocean
Loading...
Searching...
No Matches
FrameConverterTestUtilities.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#ifndef META_OCEAN_TEST_TESTCV_FRAME_CONVERTER_TEST_UTILITIES_H
9#define META_OCEAN_TEST_TESTCV_FRAME_CONVERTER_TEST_UTILITIES_H
10
12
13#include "ocean/base/Frame.h"
15#include "ocean/base/Memory.h"
16#include "ocean/base/RandomI.h"
18#include "ocean/base/Worker.h"
19
22
23#include "ocean/math/Matrix.h"
24
25#include <functional>
26#include <numeric>
27
28namespace Ocean
29{
30
31namespace Test
32{
33
34namespace TestCV
35{
36
37/**
38 * This class implements frame converter test utilities.
39 * @ingroup testcv
40 */
41class OCEAN_TEST_CV_EXPORT FrameConverterTestUtilities : protected CV::FrameConverter
42{
43 public:
44
45 /**
46 * This class is a helper class simply offering random values which are constant during process execution.
47 */
48 class ValueProvider : public Singleton<ValueProvider>
49 {
50 friend class Singleton<ValueProvider>;
51
52 public:
53
54 /**
55 * Returns the random (but constant during process execution) alpha value.
56 * @return The alpha value, with range [0, infinity)
57 */
58 inline uint8_t alphaValue() const;
59
60 /**
61 * Returns the random (but constant during process execution) gamma value.
62 * @return The gamma value, with range [0.4, 1.0]
63 */
64 inline float gammaValue() const;
65
66 protected:
67
68 /**
69 * Protected constructor.
70 */
71 inline ValueProvider();
72
73 protected:
74
75 /// The alpha value.
76 uint8_t alphaValue_;
77
78 /// The gamma value.
80 };
81
82 /**
83 * This class is a wrapper for function pointers.
84 */
86 {
87 public:
88
89 /**
90 * Definition of individual types of conversion functions.
91 */
92 enum FunctionType : uint32_t
93 {
94 /// And invalid function type.
95 FT_INVALID = 0u,
96 /// 1-plane uint8 to 1-plane uint8 conversion function.
98 /// 1-plane uint8 to 1-plane uint16 conversion function.
100 /// 1-plane uint8 plus constant gamma to 1-plane uint8 conversion function.
102 /// 1-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
104 /// 1-plane uint8 to 1-plane uint8 plus constant black level, white balance, and gamma conversion function.
106 /// 1-plane uint16 to 1-plane uint8 conversion function.
108 /// 1-plane uint16 to 1-plane uint16 conversion function.
110 /// 1-plane uint32 to 1-plane uint8 conversion function.
112 /// 1-plane uint32 to 1-plane uint16 conversion function.
114 /// 1-plane uint8 to 2-plane uint8 conversion function.
116 /// 1-plane uint8 to 3-plane uint8 conversion function.
118 /// 2-plane uint8 to 1-plane uint8 conversion function.
120 /// 2-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
122 /// 2-plane uint8 to 2-plane uint8 conversion function.
124 /// 2-plane uint8 to 3-plane uint8 conversion function.
126 /// 3-plane uint8 to 1-plane uint8 conversion function.
128 /// 3-plane uint8 to 3-plane uint8 conversion function.
130 /// 3-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
131 FT_3_UINT8_TO_1_UINT8_ALPHA
132 };
133
134 /**
135 * Definition of a function pointer to a conversion function with one source plane and one target plane.
136 */
137 template <typename TSource, typename TTarget>
138 using OneSourceOneTargetConversionFunction = void(*)(const TSource* source, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker* worker);
139
140 /**
141 * Definition of a function pointer to a conversion function with one source plane and one target plane plus constant alpha.
142 */
143 template <typename TSource, typename TTarget>
144 using OneSourceGammaOneTargetConversionFunction = void(*)(const TSource* source, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker* worker);
145
146 /**
147 * Definition of a function pointer to a conversion function with one source plane and one target plane plus constant alpha.
148 */
149 template <typename TSource, typename TTarget>
150 using OneSourceOneTargetAlphaConversionFunction = void(*)(const TSource* source, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker* worker);
151
152 /**
153 * Definition of a function pointer to a conversion function with one source plane and one target plane plus constant black level, white balance, and gamma.
154 */
155 template <typename TSource, typename TTarget>
156 using OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction = void(*)(const TSource* source, TTarget* target, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const uint16_t blackLevel, const float* whiteBalance, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker* worker);
157
158 /**
159 * Definition of a function pointer to a conversion function with one source plane and two target planes.
160 */
161 template <typename TSource, typename TTarget>
162 using OneSourceTwoTargetsConversionFunction = void(*)(const TSource* source, TTarget* target0, TTarget* target1, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t target0PaddingElements, const uint32_t target1PaddingElements, Worker* worker);
163
164 /**
165 * Definition of a function pointer to a conversion function with one source plane and three target planes.
166 */
167 template <typename TSource, typename TTarget>
168 using OneSourceThreeTargetsConversionFunction = void(*)(const TSource* source, TTarget* target0, TTarget* target1, TTarget* target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t target0PaddingElements, const uint32_t target1PaddingElements, const uint32_t target2PaddingElements, Worker* worker);
169
170 /**
171 * Definition of a function pointer to a conversion function with two source planes and one target plane.
172 */
173 template <typename TSource, typename TTarget>
174 using TwoSourcesOneTargetConversionFunction = void(*)(const TSource* source0, const TSource* source1, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements, Worker* worker);
175
176 /**
177 * Definition of a function pointer to a conversion function with two source planes and three target planes.
178 */
179 template <typename TSource, typename TTarget>
180 using TwoSourcesThreeTargetConversionFunction = void(*)(const TSource* source0, const TSource* source1, TTarget* target0, TTarget* target1, TTarget* target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements0, const uint32_t targetPaddingElements1, const uint32_t targetPaddingElements2, Worker* worker);
181
182 /**
183 * Definition of a function pointer to a conversion function with two source planes and one target plane plus constant alpha.
184 */
185 template <typename TSource, typename TTarget>
186 using TwoSourcesOneTargetAlphaConversionFunction = void(*)(const TSource* source0, const TSource* source1, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker* worker);
187
188 /**
189 * Definition of a function pointer to a conversion function with two source planes and two target plane.
190 */
191 template <typename TSource, typename TTarget>
192 using TwoSourcesTwoTargetConversionFunction = void(*)(const TSource* source0, const TSource* source1, TTarget* target0, TTarget* target1, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t target0PaddingElements, const uint32_t targetPadding1Elements, Worker* worker);
193
194 /**
195 * Definition of a function pointer to a conversion function with three source planes and one target plane.
196 */
197 template <typename TSource, typename TTarget>
198 using ThreeSourcesOneTargetConversionFunction = void(*)(const TSource* source0, const TSource* source1, const TSource* source2, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements, Worker* worker);
199
200 /**
201 * Definition of a function pointer to a conversion function with three source planes and three target planes.
202 */
203 template <typename TSource, typename TTarget>
204 using ThreeSourcesThreeTargetConversionFunction = void(*)(const TSource* source0, const TSource* source1, const TSource* source2, TTarget* target0, TTarget* target1, TTarget* target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements0, const uint32_t targetPaddingElements1, const uint32_t targetPaddingElements2, Worker* worker);
205
206 /**
207 * Definition of a function pointer to a conversion function with three source planes and one target plane plus constant alpha.
208 */
209 template <typename TSource, typename TTarget>
210 using ThreeSourcesOneTargetAlphaConversionFunction = void(*)(const TSource* source0, const TSource* source1, const TSource* source2, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker* worker);
211
212 public:
213
214 /**
215 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8 function.
216 * @param function The pointer to the conversion function, must be valid
217 */
219
220 /**
221 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT16 function.
222 * @param function The pointer to the conversion function, must be valid
223 */
225
226 /**
227 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_GAMMA_TO_1_UINT8 function.
228 * @param function The pointer to the conversion function, must be valid
229 */
231
232 /**
233 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_ALPHA function.
234 * @param function The pointer to the conversion function, must be valid
235 */
237
238 /**
239 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHITEBALANCE_GAMMA function.
240 * @param function The pointer to the conversion function, must be valid
241 */
243
244 /**
245 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT8 function.
246 * @param function The pointer to the conversion function, must be valid
247 */
249
250 /**
251 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT16 function.
252 * @param function The pointer to the conversion function, must be valid
253 */
255
256 /**
257 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT8 function.
258 * @param function The pointer to the conversion function, must be valid
259 */
261
262 /**
263 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT16 function.
264 * @param function The pointer to the conversion function, must be valid
265 */
267
268 /**
269 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_2_UINT8 function.
270 * @param function The pointer to the conversion function, must be valid
271 */
273
274 /**
275 * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_3_UINT8 function.
276 * @param function The pointer to the conversion function, must be valid
277 */
279
280 /**
281 * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8 function.
282 * @param function The pointer to the conversion function, must be valid
283 */
285
286 /**
287 * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_3_UINT8 function.
288 * @param function The pointer to the conversion function, must be valid
289 */
291
292 /**
293 * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8_ALPHA function.
294 * @param function The pointer to the conversion function, must be valid
295 */
297
298 /**
299 * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_2_UINT8 function.
300 * @param function The pointer to the conversion function, must be valid
301 */
303
304 /**
305 * Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8 function.
306 * @param function The pointer to the conversion function, must be valid
307 */
309
310 /**
311 * Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_3_UINT8 function.
312 * @param function The pointer to the conversion function, must be valid
313 */
315
316 /**
317 * Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8_ALPHA function.
318 * @param function The pointer to the conversion function, must be valid
319 */
321
322 /**
323 * Calls the conversion function for a source and target frame.
324 * @param source The source frame, must be valid
325 * @param target The target frame, must be valid
326 * @param conversionFlag The conversion flag to be used
327 * @param options Optional parameters that can be provided to the wrapped conversion function, must be `nullptr` to be ignored or be valid and have the expected number of elements for that specific function
328 * @param worker Optional worker object to be used
329 * @return True, if succeeded
330 */
331 bool invoke(const Frame& source, Frame& target, const FrameConverter::ConversionFlag conversionFlag, const void* options, Worker* worker) const;
332
333 protected:
334
335 /// The function pointer of the conversion function.
336 const void* function_;
337
338 /// The type of the conversion function.
340 };
341
342 public:
343
344 /**
345 * Definition of a function pointer to a pixel extraction function.
346 * @param frame The frame from which the pixel will be extracted, must be valid
347 * @param x The horizontal pixel location within the frame, with range [0, width - 1]
348 * @param y The vertical pixel location within the frame, with range [0, height - 1]
349 * @param conversionFlag The conversion flag that will be applied, must be valid
350 * @return The pixel color values, a vector for a trivial case; a matrix in case each channel needs to be handled individually
351 */
352 using FunctionPixelValue = std::function<MatrixD(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)>;
353
354 public:
355
356 /**
357 * Tests the conversion of frames with one pixel format to another pixel format for functions supporting padding.
358 * @param sourcePixelFormat The pixel format of the source frame, must be valid
359 * @param targetPixelFormat The pixel format of the target frame, must be valid
360 * @param width The width of the original frame in pixel, with range [1, infinity)
361 * @param height The height of the original frame in pixel, with range [1, infinity)
362 * @param functionWrapper The wrapper around the conversion function to be tested, must be valid
363 * @param conversionFlag The conversion type to be used
364 * @param functionSourcePixelValue The function pointer which to extract one pixel from the source image, must be valid
365 * @param functionTargetPixelValue The function pointer which to extract one pixel from the target image, must be valid
366 * @param transformationMatrix The transformation matrix defining the conversion (an affine transformation)
367 * @param minimalGroundTruthValue The minimal ground truth value for value clamping, with range (-infinity, maximalGroundTruthValue)
368 * @param maximalGroundTruthValue The maximal ground truth value for value clamping, with range (minimalGroundTruthValue, infinity)
369 * @param testDuration Number of seconds for each test, with range (0, infinity)
370 * @param worker The worker object
371 * @param thresholdMaximalErrorToInteger The maximal allowed error between the ground truth integer and the resulting integer value, with range [0, infinity)
372 * @param options Optional parameters that will be provided to the function wrapper when it is invoked, must be `nullptr` to be ignored or be valid and have the expected number of elements for that specific function
373 * @return True, if succeeded
374 */
375 static bool testFrameConversion(const FrameType::PixelFormat& sourcePixelFormat, const FrameType::PixelFormat& targetPixelFormat, const unsigned int width, const unsigned int height, const FunctionWrapper& functionWrapper, const CV::FrameConverter::ConversionFlag conversionFlag, const FunctionPixelValue functionSourcePixelValue, const FunctionPixelValue functionTargetPixelValue, const MatrixD& transformationMatrix, const double minimalGroundTruthValue, const double maximalGroundTruthValue, const double testDuration, Worker& worker, const unsigned int thresholdMaximalErrorToInteger = 3u, const void* options = nullptr);
376
377 /**
378 * Validates the color space conversion from a source pixel format to a target pixel format.
379 * @param sourceFrame The source frame, must be valid
380 * @param targetFrame The target frame, must be valid
381 * @param functionSourcePixelValue The function pointer which to extract one pixel from the source image, must be valid
382 * @param functionTargetPixelValue The function pointer which to extract one pixel from the target image, must be valid
383 * @param transformationMatrix The transformation matrix defining the conversion (an affine transformation)
384 * @param conversionFlag The conversion flag that has been applied during conversion
385 * @param averageAbsErrorToFloat Resulting average absolute error between the converted result and the ground truth floating point result, with range [0, 256)
386 * @param averageAbsErrorToInteger Resulting average absolute error between the converted result and the ground truth integer result (rounded result), with range [0, 256)
387 * @param maximalAbsErrorToFloat maximal absolute error between the converted result and the ground truth floating point result, with range [0, 256)
388 * @param maximalAbsErrorToInteger Resulting maximal absolute error between the converted result and the ground truth integer result (rounded result), with range [0, 256)
389 * @param minimalGroundTruthValue The minimal ground truth value for value clamping, with range (-infinity, maximalGroundTruthValue)
390 * @param maximalGroundTruthValue The maximal ground truth value for value clamping, with range (minimalGroundTruthValue, infinity)
391 * @param skipPlausibilityCheck True, to skip the plausibility check ensuring that the resulting pixel values are in a plausible value range; False, to apply the plausibility check
392 * @return True, if succeeded
393 */
394 static bool validateConversion(const Frame& sourceFrame, const Frame& targetFrame, const FunctionPixelValue functionSourcePixelValue, const FunctionPixelValue functionTargetPixelValue, const MatrixD& transformationMatrix, const CV::FrameConverter::ConversionFlag conversionFlag, double* averageAbsErrorToFloat, double* averageAbsErrorToInteger, double* maximalAbsErrorToFloat, unsigned int* maximalAbsErrorToInteger, const double minimalGroundTruthValue, const double maximalGroundTruthValue, const bool skipPlausibilityCheck = false);
395
396 /**
397 * Extracts one pixel from a generic frame (e.g,. with pixel format BGR24, RGB24, YUV24, ...).
398 * @param frame The frame from which the pixel will be extracted, must be valid
399 * @param x The horizontal pixel location within the frame, with range [0, frame.width() - 1]
400 * @param y The vertical pixel location within the frame, with range [0, frame.height() - 1]
401 * @param conversionFlag The conversion flag that will be applied, must be valid
402 * @return The vector holding the frame's color value at the specified location
403 */
404 static MatrixD functionGenericPixel(const Frame& frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag);
405};
406
408 alphaValue_(uint8_t(RandomI::random(0u, 255u))),
409 gammaValue_(0.0f)
410{
411 const std::vector<float> gammaValues = {0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f};
412
413 gammaValue_ = RandomI::random(gammaValues);
414}
415
417{
418 return alphaValue_;
419}
420
422{
423 return gammaValue_;
424}
425
426} // namespace TestCV
427
428} // namespace Test
429
430} // namespace Ocean
431
432#endif // META_OCEAN_TEST_TESTCV_FRAME_CONVERTER_TEST_UTILITIES_H
This is the base class for all frame converter classes.
Definition FrameConverter.h:32
ConversionFlag
Definition of individual conversion flags.
Definition FrameConverter.h:39
This class implements Ocean's image class.
Definition Frame.h:1808
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition Frame.h:183
This class implements a matrix with arbitrary size.
Definition Matrix.h:63
This class provides base random functions and several random functions for integer data types.
Definition RandomI.h:29
static unsigned int random(const unsigned int maxValue)
Returns one random integer value with specified maximum value.
This template class is the base class for all singleton objects.
Definition Singleton.h:71
This class is a wrapper for function pointers.
Definition FrameConverterTestUtilities.h:86
const void * function_
The function pointer of the conversion function.
Definition FrameConverterTestUtilities.h:336
FunctionWrapper(const TwoSourcesOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8 function.
FunctionType
Definition of individual types of conversion functions.
Definition FrameConverterTestUtilities.h:93
@ FT_2_UINT8_TO_1_UINT8_ALPHA
2-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
Definition FrameConverterTestUtilities.h:121
@ FT_1_UINT8_TO_2_UINT8
1-plane uint8 to 2-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:115
@ FT_1_UINT16_TO_1_UINT16
1-plane uint16 to 1-plane uint16 conversion function.
Definition FrameConverterTestUtilities.h:109
@ FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHITEBALANCE_GAMMA
1-plane uint8 to 1-plane uint8 plus constant black level, white balance, and gamma conversion functio...
Definition FrameConverterTestUtilities.h:105
@ FT_1_UINT8_GAMMA_TO_1_UINT8
1-plane uint8 plus constant gamma to 1-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:101
@ FT_1_UINT8_TO_1_UINT16
1-plane uint8 to 1-plane uint16 conversion function.
Definition FrameConverterTestUtilities.h:99
@ FT_1_UINT8_TO_1_UINT8_ALPHA
1-plane uint8 to 1-plane plus constant alpha uint8 conversion function.
Definition FrameConverterTestUtilities.h:103
@ FT_1_UINT16_TO_1_UINT8
1-plane uint16 to 1-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:107
@ FT_1_UINT32_TO_1_UINT8
1-plane uint32 to 1-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:111
@ FT_1_UINT8_TO_1_UINT8
1-plane uint8 to 1-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:97
@ FT_3_UINT8_TO_1_UINT8
3-plane uint8 to 1-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:127
@ FT_2_UINT8_TO_1_UINT8
2-plane uint8 to 1-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:119
@ FT_2_UINT8_TO_3_UINT8
2-plane uint8 to 3-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:125
@ FT_1_UINT8_TO_3_UINT8
1-plane uint8 to 3-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:117
@ FT_1_UINT32_TO_1_UINT16
1-plane uint32 to 1-plane uint16 conversion function.
Definition FrameConverterTestUtilities.h:113
@ FT_3_UINT8_TO_3_UINT8
3-plane uint8 to 3-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:129
@ FT_2_UINT8_TO_2_UINT8
2-plane uint8 to 2-plane uint8 conversion function.
Definition FrameConverterTestUtilities.h:123
void(*)(const TSource *source0, const TSource *source1, const TSource *source2, TTarget *target0, TTarget *target1, TTarget *target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements0, const uint32_t targetPaddingElements1, const uint32_t targetPaddingElements2, Worker *worker) ThreeSourcesThreeTargetConversionFunction
Definition of a function pointer to a conversion function with three source planes and three target p...
Definition FrameConverterTestUtilities.h:204
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint32_t, uint16_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT16 function.
FunctionWrapper(const TwoSourcesThreeTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_3_UINT8 function.
FunctionWrapper(const ThreeSourcesThreeTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_3_UINT8 function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8 function.
FunctionWrapper(const TwoSourcesTwoTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_2_UINT8 function.
void(*)(const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const uint16_t blackLevel, const float *whiteBalance, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker *worker) OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition FrameConverterTestUtilities.h:156
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint16_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT8 function.
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker *worker) OneSourceOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition FrameConverterTestUtilities.h:150
void(*)(const TSource *source0, const TSource *source1, const TSource *source2, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker *worker) ThreeSourcesOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with three source planes and one target pla...
Definition FrameConverterTestUtilities.h:210
bool invoke(const Frame &source, Frame &target, const FrameConverter::ConversionFlag conversionFlag, const void *options, Worker *worker) const
Calls the conversion function for a source and target frame.
void(*)(const TSource *source, TTarget *target0, TTarget *target1, TTarget *target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t target0PaddingElements, const uint32_t target1PaddingElements, const uint32_t target2PaddingElements, Worker *worker) OneSourceThreeTargetsConversionFunction
Definition of a function pointer to a conversion function with one source plane and three target plan...
Definition FrameConverterTestUtilities.h:168
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker *worker) OneSourceOneTargetConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane.
Definition FrameConverterTestUtilities.h:138
const FunctionType functionType_
The type of the conversion function.
Definition FrameConverterTestUtilities.h:339
FunctionWrapper(const OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHIT...
void(*)(const TSource *source, TTarget *target0, TTarget *target1, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t sourcePaddingElements, const uint32_t target0PaddingElements, const uint32_t target1PaddingElements, Worker *worker) OneSourceTwoTargetsConversionFunction
Definition of a function pointer to a conversion function with one source plane and two target planes...
Definition FrameConverterTestUtilities.h:162
void(*)(const TSource *source0, const TSource *source1, TTarget *target0, TTarget *target1, TTarget *target2, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements0, const uint32_t targetPaddingElements1, const uint32_t targetPaddingElements2, Worker *worker) TwoSourcesThreeTargetConversionFunction
Definition of a function pointer to a conversion function with two source planes and three target pla...
Definition FrameConverterTestUtilities.h:180
void(*)(const TSource *source0, const TSource *source1, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements, const TTarget alpha, Worker *worker) TwoSourcesOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with two source planes and one target plane...
Definition FrameConverterTestUtilities.h:186
FunctionWrapper(const OneSourceOneTargetAlphaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_ALPHA function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint16_t, uint16_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT16 function.
FunctionWrapper(const ThreeSourcesOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8 function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint8_t, uint16_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT16 function.
FunctionWrapper(const OneSourceTwoTargetsConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_2_UINT8 function.
FunctionWrapper(const OneSourceThreeTargetsConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_3_UINT8 function.
FunctionWrapper(const OneSourceOneTargetConversionFunction< uint32_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT8 function.
void(*)(const TSource *source0, const TSource *source1, TTarget *target0, TTarget *target1, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t target0PaddingElements, const uint32_t targetPadding1Elements, Worker *worker) TwoSourcesTwoTargetConversionFunction
Definition of a function pointer to a conversion function with two source planes and two target plane...
Definition FrameConverterTestUtilities.h:192
FunctionWrapper(const TwoSourcesOneTargetAlphaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8_ALPHA function.
FunctionWrapper(const OneSourceGammaOneTargetConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_GAMMA_TO_1_UINT8 function.
void(*)(const TSource *source0, const TSource *source1, const TSource *source2, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t source2PaddingElements, const uint32_t targetPaddingElements, Worker *worker) ThreeSourcesOneTargetConversionFunction
Definition of a function pointer to a conversion function with three source planes and one target pla...
Definition FrameConverterTestUtilities.h:198
void(*)(const TSource *source0, const TSource *source1, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint32_t source0PaddingElements, const uint32_t source1PaddingElements, const uint32_t targetPaddingElements, Worker *worker) TwoSourcesOneTargetConversionFunction
Definition of a function pointer to a conversion function with two source planes and one target plane...
Definition FrameConverterTestUtilities.h:174
FunctionWrapper(const ThreeSourcesOneTargetAlphaConversionFunction< uint8_t, uint8_t > function)
Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8_ALPHA function.
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker *worker) OneSourceGammaOneTargetConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition FrameConverterTestUtilities.h:144
This class is a helper class simply offering random values which are constant during process executio...
Definition FrameConverterTestUtilities.h:49
ValueProvider()
Protected constructor.
Definition FrameConverterTestUtilities.h:407
uint8_t alphaValue() const
Returns the random (but constant during process execution) alpha value.
Definition FrameConverterTestUtilities.h:416
float gammaValue() const
Returns the random (but constant during process execution) gamma value.
Definition FrameConverterTestUtilities.h:421
float gammaValue_
The gamma value.
Definition FrameConverterTestUtilities.h:79
uint8_t alphaValue_
The alpha value.
Definition FrameConverterTestUtilities.h:76
This class implements frame converter test utilities.
Definition FrameConverterTestUtilities.h:42
std::function< MatrixD(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)> FunctionPixelValue
Definition of a function pointer to a pixel extraction function.
Definition FrameConverterTestUtilities.h:352
static MatrixD functionGenericPixel(const Frame &frame, const unsigned int x, const unsigned int y, const CV::FrameConverter::ConversionFlag conversionFlag)
Extracts one pixel from a generic frame (e.g,.
static bool testFrameConversion(const FrameType::PixelFormat &sourcePixelFormat, const FrameType::PixelFormat &targetPixelFormat, const unsigned int width, const unsigned int height, const FunctionWrapper &functionWrapper, const CV::FrameConverter::ConversionFlag conversionFlag, const FunctionPixelValue functionSourcePixelValue, const FunctionPixelValue functionTargetPixelValue, const MatrixD &transformationMatrix, const double minimalGroundTruthValue, const double maximalGroundTruthValue, const double testDuration, Worker &worker, const unsigned int thresholdMaximalErrorToInteger=3u, const void *options=nullptr)
Tests the conversion of frames with one pixel format to another pixel format for functions supporting...
static bool validateConversion(const Frame &sourceFrame, const Frame &targetFrame, const FunctionPixelValue functionSourcePixelValue, const FunctionPixelValue functionTargetPixelValue, const MatrixD &transformationMatrix, const CV::FrameConverter::ConversionFlag conversionFlag, double *averageAbsErrorToFloat, double *averageAbsErrorToInteger, double *maximalAbsErrorToFloat, unsigned int *maximalAbsErrorToInteger, const double minimalGroundTruthValue, const double maximalGroundTruthValue, const bool skipPlausibilityCheck=false)
Validates the color space conversion from a source pixel format to a target pixel format.
This class implements a worker able to distribute function calls over different threads.
Definition Worker.h:33
The namespace covering the entire Ocean framework.
Definition Accessor.h:15