Ocean
FrameConverter.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_CV_FRAME_CONVERTER_H
9 #define META_OCEAN_CV_FRAME_CONVERTER_H
10 
11 #include "ocean/cv/CV.h"
12 #include "ocean/cv/CVUtilities.h"
13 
14 #include "ocean/base/Frame.h"
15 #include "ocean/base/Worker.h"
16 
17 #include "ocean/math/Matrix.h"
18 
19 namespace Ocean
20 {
21 
22 namespace CV
23 {
24 
25 OCEAN_DISABLE_DOCUMENTATION_DIAGNOSTIC // Clang has a bug and need to be disabled for FrameConverter
26 
27 /**
28  * This is the base class for all frame converter classes.
29  * @ingroup cv
30  */
31 class OCEAN_CV_EXPORT FrameConverter
32 {
33  public:
34 
35  /**
36  * Definition of individual conversion flags.
37  */
38  enum ConversionFlag : uint32_t
39  {
40  /**
41  * Normal conversion, neither flips nor mirrors the image.
42  * The following pattern shows the conversion for an image with resolution 2x2:
43  * <pre>
44  * Input: Output:
45  * | A B | | A B |
46  * | C D | | C D |
47  * </pre>
48  */
50 
51  /**
52  * Flipped conversion, exchanges top and bottom of the image (flipping around the x-axis).
53  * The following pattern shows the conversion for an image with resolution 2x2:
54  * <pre>
55  * Input: Output:
56  * | A B | | C D |
57  * | C D | | A B |
58  * </pre>
59  */
61 
62  /**
63  * Mirrored conversion, exchanges left and right of the image (like in a mirror, mirroring around the y-axis).
64  * The following pattern shows the conversion for an image with resolution 2x2:
65  * <pre>
66  * Input: Output:
67  * | A B | | B A |
68  * | C D | | D C |
69  * </pre>
70  */
72 
73  /**
74  * Rotated conversion, rotates the image by 180.0 degrees with anchor in the center of the image.
75  * The following pattern shows the conversion for an image with resolution 2x2:
76  * <pre>
77  * Input: Output:
78  * | A B | | D C |
79  * | C D | | B A |
80  * </pre>
81  */
82  CONVERT_FLIPPED_AND_MIRRORED
83  };
84 
85  /**
86  * Definition of a vector holding conversion flags.
87  */
88  using ConversionFlags = std::vector<ConversionFlag>;
89 
90  /**
91  * Definition of a boolean enum for copy preferences (to improve code readability).
92  */
93  enum CopyPreference : bool
94  {
95  /// Tries to avoid copying the frame data whenever possible.
96  CP_AVOID_COPY_IF_POSSIBLE = false,
97  /// Forces a copy of the frame data in any case.
98  CP_ALWAYS_COPY = true
99  };
100 
101  /**
102  * Definition of a class storing options for frame conversions.
103  */
104  class Options
105  {
106  public:
107 
108  /**
109  * Definition of individual types of options.
110  */
111  enum OptionsType : uint32_t
112  {
113  /// Default conversion.
114  OT_DEFAULT = 0u,
115  /// Conversion with explicit alpha channel target value.
116  OT_ALPHA_CHANNEL_TARGET_VALUE = 1u << 0u,
117  /// Conversion with gamma correction.
118  OT_GAMMA_CORRECTION = 1u << 1u,
119  /// Conversion with black level, white balance, and gamma encoding
120  OT_BLACKLEVEL_WHITEBALANCE_GAMMA = 1u << 2u,
121  /// Approximated conversion.
122  OT_APPROXIMATED = 1u << 2u,
123  };
124 
125  public:
126 
127  /**
128  * Default constructor.
129  * @param allowApproximation True, to allow an approximated conversion if available
130  */
131  explicit inline Options(const bool allowApproximation = false);
132 
133  /**
134  * Creates options for source image without alpha channel but a target image with alpha channel.
135  * @param alphaChannelTargetValue The uint8_t alpha channel value for the target image if the source image does not contain an alpha channel; ignored if the source image contains an alpha channel, with range [0, 255]
136  * @param allowApproximation True, to allow an approximated conversion if available
137  */
138  explicit inline Options(const uint8_t alphaChannelTargetValue, const bool allowApproximation = false);
139 
140  /**
141  * Creates options for a conversion applying gamma correction.
142  * @param gamma The gamma value to be applied, with range (0, 2)
143  * @param allowApproximation True, to allow an approximated conversion if available
144  */
145  explicit inline Options(const float gamma, const bool allowApproximation = false);
146 
147  /**
148  * Creates options for a conversion applying black level subtraction, white balance, and gamma encoding.
149  * @param blackLevel The black level value that is subtracted from each element of the raw image before any other operation, with range [0, 1024)
150  * @param whiteBalanceRed The white balancing scalar of the red channel, with range [0, infinity)
151  * @param whiteBalanceGreen The white balancing scalar of the green channel, with range [0, infinity)
152  * @param whiteBalanceBlue The white balancing scalar of the blue channel, with range [0, infinity)
153  * @param gamma The gamma value to be applied, with range (0, infinity)
154  * @param allowApproximation True, to allow an allowApproximation conversion if available
155  * @sa FrameConverterRGGB10_Packed::convertRGGB10_PackedToRGB24BlacklevelWhiteBalanceGammaLUT()
156  */
157  explicit inline Options(const uint16_t blackLevel, const float whiteBalanceRed, const float whiteBalanceGreen, const float whiteBalanceBlue, const float gamma, const bool allowApproximation = false);
158 
159  /**
160  * Returns the options type.
161  * @return The options' type
162  */
163  inline OptionsType optionsType() const;
164 
165  /**
166  * Returns the uint8_t alpha channel value for the target image if the source image does not contain an alpha channel; ignored if the source image contains an alpha channel.
167  * @return The alpha value for the target channel, with range [0, 255]
168  */
169  inline uint8_t alphaChannelTargetValue() const;
170 
171  /**
172  * Returns the gamma value for a conversion with gamma correction/encoding.
173  * @return The gamma value, with range (0, 2) (OT_GAMMA_CORRECTION) or [0, infinity) (OT_BLACKLEVEL_WHITEBALANCE_GAMMA)
174  */
175  inline float gamma() const;
176 
177  /**
178  * Returns the black level value for a conversion with black level correction.
179  * @return The black level value, with range [0, 1024)
180  */
181  inline uint16_t blackLevel() const;
182 
183  /**
184  * Returns the white balance values for a conversion with white balance correction.
185  * @return The white balance values for the red, green, and blue channels, with range [0, infinity)
186  */
187  inline const float* whiteBalance() const;
188 
189  /**
190  * Returns whether the conversion can be approximated.
191  * @return True, if so
192  */
193  inline bool allowApproximation() const;
194 
195  protected:
196 
197  /// The options type.
198  OptionsType optionsType_ = OT_DEFAULT;
199 
200  /// The alpha channel value for the target image if the source image does not contain an alpha channel, with range [0, 255]
201  uint8_t alphaChannelTargetValue_ = 0xFFu;
202 
203  /// The gamma value for a conversion with gamma correction/encoding, with range (0, 2) (OT_GAMMA_CORRECTION) or [0, infinity) (OT_BLACKLEVEL_WHITEBALANCE_GAMMA)
204  float gamma_ = 1.0f;
205 
206  /// The black level value that is subtracted from each element of the raw image before any other operation, with range [0, 1024)
207  uint16_t blackLevel_ = 0u;
208 
209  /// The white balancing scalars of the red, green, and blue channels (in that order), with range [0, infinity)
210  float whiteBalance_[3] = { 1.0f, 1.0f, 1.0f };
211  };
212 
213  protected:
214 
215  /**
216  * This class implements a singleton-based map for function pointers of conversion functions.
217  */
218  class OCEAN_CV_EXPORT ConversionFunctionMap : public Singleton<ConversionFunctionMap>
219  {
220  friend class Singleton<ConversionFunctionMap>;
221 
222  public:
223 
224  /**
225  * Definition of individual types of conversion functions.
226  */
227  enum FunctionType : uint32_t
228  {
229  /// And invalid function type.
230  FT_INVALID = 0u,
231  /// 1-plane uint8 to 1-plane uint8 conversion function.
233  /// 1-plane uint8 with constant gamma correction to 1-plane uint8 conversion function.
235  /// 1-plane uint8 to 1-plane uint8 with constant alpha channel conversion function.
237  /// 1-plane uint8 to 1-plane uint8 conversion function with constant black level, white balance, and gamma values.
239  /// 1-plane uint8 to 1-plane uint16 conversion function.
241  /// 1-plane uint16 to 1-plane uint8 conversion function.
243  /// 1-plane uint16 to 1-plane uint16 conversion function.
245  /// 1-plane uint32 to 1-plane uint8 conversion function.
247  /// 1-plane uint32 to 1-plane uint16 conversion function.
249  /// 1-plane uint8 to 2-plane uint8 conversion function.
251  /// 1-plane uint8 to 3-plane uint8 conversion function.
253  /// 2-plane uint8 to 1-plane uint8 conversion function.
255  /// 2-plane uint8 to 1-plane uint8 with constant alpha channel conversion function.
257  /// 2-plane uint8 to 3-plane uint8 conversion function.
259  /// 3-plane uint8 to 1-plane uint8 conversion function.
261  /// 3-plane uint8 to 1-plane uint8 with constant alpha channel conversion function.
263  /// 3-plane uint8 to 3-plane uint8 conversion function.
264  FT_3_UINT8_TO_3_UINT8
265  };
266 
267  /**
268  * Definition of a function pointer to a conversion function with one source plane and one target plane.
269  */
270  template <typename TSource, typename TTarget>
271  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);
272 
273  /**
274  * Definition of a function pointer to a conversion function with one source plane with gamma correction and one target plane.
275  */
276  template <typename TSource, typename TTarget>
277  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);
278 
279  /**
280  * Definition of a function pointer to a conversion function with one source plane and one target plane with constant alpha value.
281  */
282  template <typename TSource, typename TTarget>
283  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 uint8_t alphaValue, Worker* worker);
284 
285  /**
286  * Definition of a function pointer to a conversion function with one source plane and one target plane with constant values for black level, white balance (red, green, blue), and gamma.
287  */
288  template <typename TSource, typename TTarget>
289  using OneSourceOneTargetBlackLevelWhiteBalanceGammaConversionFunction = void(*)(const TSource* source, TTarget* target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint16_t blackLevelValue, const float* whiteBalanceValues, const float gamma, const uint32_t sourcePaddingElements, const uint32_t targetPaddingElements, Worker* worker);
290 
291  /**
292  * Definition of a function pointer to a conversion function with one source plane and two target planes.
293  */
294  template <typename TSource, typename TTarget>
295  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);
296 
297  /**
298  * Definition of a function pointer to a conversion function with one source plane and three target planes.
299  */
300  template <typename TSource, typename TTarget>
301  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);
302 
303  /**
304  * Definition of a function pointer to a conversion function with two source planes and one target plane.
305  */
306  template <typename TSource, typename TTarget>
307  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);
308 
309  /**
310  * Definition of a function pointer to a conversion function with two source planes and one target plane with constant alpha.
311  */
312  template <typename TSource, typename TTarget>
313  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 uint8_t alphaValue, Worker* worker);
314 
315  /**
316  * Definition of a function pointer to a conversion function with two source planes and three target planes.
317  */
318  template <typename TSource, typename TTarget>
319  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);
320 
321  /**
322  * Definition of a function pointer to a conversion function with three source planes and one target plane.
323  */
324  template <typename TSource, typename TTarget>
325  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);
326 
327  /**
328  * Definition of a function pointer to a conversion function with three source planes and one target plane with constant alpha value.
329  */
330  template <typename TSource, typename TTarget>
331  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 uint8_t alphaValue, Worker* worker);
332 
333  /**
334  * Definition of a function pointer to a conversion function with three source planes and three target planes.
335  */
336  template <typename TSource, typename TTarget>
337  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);
338 
339  protected:
340 
341  /**
342  * This class combines source pixel format, target pixel format, and options types.
343  */
345  {
346  public:
347 
348  /**
349  * Helper class for a hash function.
350  * The separate struct is necessary for compilers like GCC.
351  */
352  struct Hash
353  {
354  /**
355  * Hash function.
356  * @param conversionTriple The conversion triple for which the hash will be determined
357  * @return The hash value
358  */
359  inline size_t operator()(const ConversionTriple& conversionTriple) const;
360  };
361 
362  public:
363 
364  /**
365  * Default constructor.
366  */
367  ConversionTriple() = default;
368 
369  /**
370  * Creates a new object.
371  * @param sourcePixelFormat The pixel format of the source frame, must be valid
372  * @param targetPixelFormat The pixel format of the target frame, must be valid
373  * @param optionsType The type of the options for which the conversion is defined
374  */
375  inline ConversionTriple(const FrameType::PixelFormat& sourcePixelFormat, const FrameType::PixelFormat& targetPixelFormat, const Options::OptionsType optionsType = Options::OT_DEFAULT);
376 
377  /**
378  * Returns whether two objects are identical.
379  * @param conversionTriple The second object
380  * @return True, if so
381  */
382  inline bool operator==(const ConversionTriple& conversionTriple) const;
383 
384  public:
385 
386  /// The pixel format of the source frame, must be valid
388 
389  /// The pixel format of the target frame, must be valid
391 
392  /// The type of the options for which the conversion is defined
393  Options::OptionsType optionsType_ = Options::OT_DEFAULT;
394  };
395 
396  /**
397  * This class is a wrapper for function pointers.
398  */
400  {
401  friend class ConversionFunctionMap;
402 
403  public:
404 
405  /**
406  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8 function.
407  * @param function The pointer to the conversion function, must be valid
408  */
410 
411  /**
412  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_GAMMA_TO_1_UINT8 function.
413  * @param function The pointer to the conversion function, must be valid
414  */
416 
417  /**
418  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_ALPHA function.
419  * @param function The pointer to the conversion function, must be valid
420  */
422 
423  /**
424  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHITEBALANCE_GAMMA function.
425  * @param function The pointer to the conversion function, must be valid
426  */
428 
429  /**
430  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_1_UINT16 function.
431  * @param function The pointer to the conversion function, must be valid
432  */
434 
435  /**
436  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT8 function.
437  * @param function The pointer to the conversion function, must be valid
438  */
440 
441  /**
442  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT16_TO_1_UINT16 function.
443  * @param function The pointer to the conversion function, must be valid
444  */
446 
447  /**
448  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT8 function.
449  * @param function The pointer to the conversion function, must be valid
450  */
452 
453  /**
454  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT32_TO_1_UINT16 function.
455  * @param function The pointer to the conversion function, must be valid
456  */
458 
459  /**
460  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_2_UINT8 function.
461  * @param function The pointer to the conversion function, must be valid
462  */
464 
465  /**
466  * Creates a new wrapper object and stores a function pointer to a FT_1_UINT8_TO_3_UINT8 function.
467  * @param function The pointer to the conversion function, must be valid
468  */
470 
471  /**
472  * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8 function.
473  * @param function The pointer to the conversion function, must be valid
474  */
476 
477  /**
478  * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_1_UINT8_ALPHA function.
479  * @param function The pointer to the conversion function, must be valid
480  */
482 
483  /**
484  * Creates a new wrapper object and stores a function pointer to a FT_2_UINT8_TO_3_UINT8 function.
485  * @param function The pointer to the conversion function, must be valid
486  */
488 
489  /**
490  * Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8 function.
491  * @param function The pointer to the conversion function, must be valid
492  */
494 
495  /**
496  * Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_1_UINT8_ALPHA function.
497  * @param function The pointer to the conversion function, must be valid
498  */
500 
501  /**
502  * Creates a new wrapper object and stores a function pointer to a FT_3_UINT8_TO_3_UINT8 function.
503  * @param function The pointer to the conversion function, must be valid
504  */
506 
507  protected:
508 
509  /// The function pointer of the conversion function.
510  const void* function_;
511 
512  /// The type of the conversion function.
514  };
515 
516  /**
517  * Definition of a map mapping pairs or pixel formats to function pointers.
518  */
519  typedef std::unordered_map<ConversionTriple, FunctionWrapper, ConversionTriple::Hash> FormatPair2FunctionWrapperMap;
520 
521  public:
522 
523  /**
524  * Returns the function pointer for a source and target pixel format.
525  * @param sourcePixelFormat The pixel format of the source frame, must be valid
526  * @param targetPixelFormat The pixel format of the target frame, must be valid
527  * @param functionType The resulting type of the conversion function
528  * @param options The options for the conversion
529  * @return The function pointer, nullptr if the combination of source and target pixel format is not supported
530  */
531  const void* function(const FrameType::PixelFormat& sourcePixelFormat, const FrameType::PixelFormat& targetPixelFormat, FunctionType& functionType, const Options& options) const;
532 
533  protected:
534 
535  /**
536  * Creates a new map object and initializes all function pointers.
537  */
539 
540  protected:
541 
542  /// The map mapping pairs or pixel formats to function pointers.
544  };
545 
546  protected:
547 
548  /**
549  * Definition of a function pointer to a function able to convert one image row from one generic pixel format to another generic pixel format.
550  * @param sourceRow The row in the source frame, must be valid
551  * @param targetRow The row in the target frame, must be valid
552  * @param width The number of pixels to convert, with range [1, infinity)
553  * @param options Optional options which are necessary for the conversion, otherwise nullptr
554  * @tparam TSource The data type of each source pixel channel, e.g., 'uint8_t' or 'float'
555  * @tparam TTarget The data type of each target pixel channel, e.g., 'uint8_t' or 'float'
556  */
557  template <typename TSource, typename TTarget>
558  using RowConversionFunction = void (*)(const TSource* sourceRow, TTarget* targetRow, const size_t width, const void* options);
559 
560  /**
561  * Definition of a function pointer to a function able to convert multiple image row from an arbitrary pixel format to another arbitrary pixel format.
562  * @param sources The memory pointers defining the source rows, must be valid
563  * @param targets The memory pointers defining the target rows, must be valid
564  * @param multipleRowIndex The index of the rows to be converted, with range [0, height / multipleRowsPerIteration - 1]
565  * @param width The width of the frame in pixel, with range [1, infinity)
566  * @param height The height of the frame in pixel, with range [1, infinity)
567  * @param conversionFlag The conversion to be applied
568  * @param options Optional options which are necessary for the conversion, otherwise nullptr
569  */
570  using MultipleRowsConversionFunction = void (*)(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
571 
572  /**
573  * Definition of a function pointer to a function able to reverse the order of pixels in an image row with a generic pixel format.
574  * @param inputRow The row to reverse, must be valid
575  * @param targetRow The row receiving the reversed pixels, must be different from 'inputRow', must be valid
576  * @param width The number of pixels to reverse, with range [1, infinity)
577  * @tparam T The data type of each pixel channel, e.g., 'uint8_t' or 'float'
578  */
579  template <typename T>
580  using RowReversePixelOrderFunction = void (*)(const T* inputRow, T* targetRow, const size_t width);
581 
582  /**
583  * Definition of a function pointer to a function able to reverse the order of pixels in an image row with a generic pixel format in-place.
584  * @param row The row to reverse, must be valid
585  * @param width The number of pixels to reverse, with range [1, infinity)
586  * @tparam T The data type of each pixel channel, e.g., 'uint8_t' or 'float'
587  */
588  template <typename T>
589  using RowReversePixelOrderInPlaceFunction = void (*)(T* row, const size_t width);
590 
591  /**
592  * Definition of the parameters used by the function for row-wise conversion of RGGB14_PACKED to RGB24/BGR24
593  */
595  {
596  /// The black level that needs to be subtracted from the unpacked pixel values, with range [0, 1024)
597  uint16_t blackLevel = 0u;
598 
599  /// The white balance factors for the red, green, and blue channel as 7 bit fixed-point numbers; the order of the channels is the same as in the target frame
600  unsigned int whiteBalance7[3] = { 128u, 128u, 128u };
601 
602  /// Pointer to the gamma lookup-table, cf. `FrameConverterY10_Packed::LookupTableManager`
603  const uint8_t* gammaLookupValues = nullptr;
604 
605  /// The number of padding elements of the source frame
606  unsigned int sourcePaddingElements = 0u;
607 
608  /// The number of padding elements of the target frame
609  unsigned int targetPaddingElements = 0u;
610  };
611 
612  public:
613 
614  /**
615  * The following comfort class provides comfortable functions simplifying prototyping applications but also increasing binary size of the resulting applications.
616  * Best practice is to avoid using these functions if binary size matters,<br>
617  * as for every comfort function a corresponding function exists with specialized functionality not increasing binary size significantly.<br>
618  */
619  class OCEAN_CV_EXPORT Comfort
620  {
621  public:
622 
623  /**
624  * Returns whether the convert function of this class supports the conversion of a frame with one pixel format to a new frame with other pixel format.
625  * @param sourceType The frame type of the source frame, must be valid
626  * @param targetPixelFormat The pixel format of the target frame, must be valid
627  * @param options The options to be used for conversion
628  * @return True, if so
629  * @see convert().
630  */
631  static bool isSupported(const FrameType& sourceType, const FrameType::PixelFormat targetPixelFormat, const Options& options = Options());
632 
633  /**
634  * Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension, but different pixel format or pixel origin.
635  * @param source The source frame to convert, must be valid
636  * @param targetPixelFormat The pixel format of the target frame, must be valid
637  * @param targetPixelOrigin The pixel origin of the target frame, must be valid
638  * @param target The resulting target frame, the frame will be modified if the frame type is not compatible, or if the target frame is not owner of the frame data, or if the target frame is a read-only frame, can be invalid
639  * @param forceCopy True, if the resulting target image is expected to be the owner of the image data, otherwise the source frame will be the owner of the image data if possible
640  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
641  * @param options The options to be used for conversion
642  * @return True, if the frame type conversion is supported and succeeded
643  *
644  * Here is an example showing how to use this function:
645  * @code
646  * bool function(const Frame& anyFrame)
647  * {
648  * // we do not know which pixel format (and pixel origin) the given frame has
649  * // however, we know that we need e.g., a grayscale frame with 8 bit and pixel origin in the upper left corner of the target frame
650  *
651  * Frame yFrame;
652  * if (!FrameConverter::Comfort::convert(anyFrame, FrameType::FORMAT_Y8, FrameType::ORIGIN_UPPER_LEFT, yFrame, FrameConverter::CP_AVOID_COPY_IF_POSSIBLE)) // we try to avoid a copy if possible
653  * {
654  * // the given frame could not be converted into a Y8 frame, so we stop here
655  * return false;
656  * }
657  *
658  * // from now on we have access to a Y8 frame, it may be
659  * // - a frame not owning the frame data but referencing the memory only (in case 'anyFrame' provided a plain Y8 block)
660  * // - a frame owning the frame data if the given image was converted to a Y8 frame
661  *
662  * // we can use the memory as long as anyFrame exists
663  * const uint8_t* data = yFrame.constdata<uint8_t>();
664  *
665  * // do something here
666  *
667  * return true;
668  * }
669  * @endcode
670  * @see isSupported(), convertAndCopy().
671  */
672  static bool convert(const Frame& source, const FrameType::PixelFormat targetPixelFormat, const FrameType::PixelOrigin targetPixelOrigin, Frame& target, const bool forceCopy = true, Worker* worker = nullptr, const Options& options = Options());
673 
674  /**
675  * Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension and pixel origin, but different pixel format.
676  * @param source The source frame to convert, must be valid
677  * @param targetPixelFormat The pixel format of the target frame, must be valid
678  * @param target The resulting target frame, the frame will be modified if the frame type is not compatible, or if the target frame is not owner of the frame data, or if the target frame is a read-only frame, can be invalid
679  * @param forceCopy True, if the resulting target image is expected to be the owner of the image data, otherwise the source frame will be the owner of the image data if possible
680  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
681  * @param options The options to be used for conversion
682  * @return True, if the frame type conversion is supported and succeeded
683  *
684  * Here is an example showing how to use this function:
685  * @code
686  * bool function(const Frame& anyFrame)
687  * {
688  * // we do not know which pixel format (and pixel origin) the given frame has
689  * // however, we know that we need e.g., a grayscale frame with 8 bit with any pixel origin
690  *
691  * Frame yFrame;
692  * if (!FrameConverter::Comfort::convert(anyFrame, FrameType::FORMAT_Y8, yFrame, FrameConverter::CP_AVOID_COPY_IF_POSSIBLE)) // we try to avoid a copy if possible
693  * {
694  * // the given frame could not be converted into a Y8 frame, so we stop here
695  * return false;
696  * }
697  *
698  * // from now on we have access to a Y8 frame, it may be
699  * // - a frame not owning the frame data but referencing the memory only (in case 'anyFrame' provided a plain Y8 block)
700  * // - a frame owning the frame data if the given image was converted to a Y8 frame
701  *
702  * // we can use the memory as long as anyFrame exists
703  * const uint8_t* data = yFrame.constdata<uint8_t>();
704  *
705  * // do something here
706  *
707  * return true;
708  * }
709  * @endcode
710  * @see isSupported(), convertAndCopy().
711  */
712  static inline bool convert(const Frame& source, const FrameType::PixelFormat targetPixelFormat, Frame& target, const bool forceCopy = true, Worker* worker = nullptr, const Options& options = Options());
713 
714  /**
715  * Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension and pixel format, but different pixel origin.
716  * @param source The source frame to convert, must be valid
717  * @param targetPixelOrigin The pixel origin of the target frame, must be valid
718  * @param target The resulting target frame, the frame will be modified if the frame type is not compatible, or if the target frame is not owner of the frame data, or if the target frame is a read-only frame, can be invalid
719  * @param forceCopy True, if the resulting target image is expected to be the owner of the image data, otherwise the source frame will be the owner of the image data if possible
720  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
721  * @param options The options to be used for conversion
722  * @return True, if the frame type conversion is supported and succeeded
723  * @see isSupported(), convertAndCopy().
724  */
725  static inline bool convert(const Frame& source, const FrameType::PixelOrigin targetPixelOrigin, Frame& target, const bool forceCopy = true, Worker* worker = nullptr, const Options& options = Options());
726 
727  /**
728  * Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension but different pixel format or pixel origin.
729  * This function does always copy the memory to the already existing memory of the target frame.
730  * @param source The source frame to convert, must be valid
731  * @param target The target frame which will receive the converted source image information, must contain writable memory, must be valid
732  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
733  * @param options The options to be used for conversion
734  * @return True, if the frame type conversion is supported and succeeded
735  *
736  * Here is an example showing how to use this function:
737  * @code
738  * bool function(const Frame& anySourceFrame)
739  * {
740  * uint8_t* targetMemoryRGB24 = ...;
741  * const unsigned int targetMemoryPaddingElements = ...;
742  *
743  * const FrameType targetFrameType(anySourceFrame.width(), anySourceFrame.height(), FrameType::FORMAT_RGB24, FrameType::ORIGIN_UPPER_LEFT);
744  *
745  * Frame targetFrame(targetFrameType, targetMemoryRGB24, Frame::CM_USE_KEEP_LAYOUT, targetMemoryPaddingElements);
746  *
747  * if (!FrameConverter::Comfort::convertAndCopy(anySourceFrame, targetFrame))
748  * {
749  * // there is no converter from the source pixel format to the target pixel format, so we stop here
750  * return false;
751  * }
752  *
753  * // do something here with the RGB memory in `targetMemoryRGB24`
754  *
755  * return true;
756  * }
757  * @endcode
758  * @see isSupported(), convert().
759  */
760  static bool convertAndCopy(const Frame& source, Frame& target, Worker* worker = nullptr, const Options& options = Options());
761 
762  /**
763  * Converts / changes a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension but different pixel format or pixel origin.
764  * @param frame The frame to convert, must be valid
765  * @param targetPixelFormat The pixel format of the target frame, must be valid
766  * @param targetPixelOrigin The pixel origin of the target frame, must be valid
767  * @param forceCopy True, if the resulting target image is expected to are the owner of the image data, otherwise the source frame will be the owner of the image data if possible
768  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
769  * @param options The options to be used for conversion
770  * @return True, if the frame type conversion is supported and succeeded
771  */
772  static inline bool change(Frame& frame, const FrameType::PixelFormat targetPixelFormat, const FrameType::PixelOrigin targetPixelOrigin, const bool forceCopy = true, Worker* worker = nullptr, const Options& options = Options());
773 
774  /**
775  * Converts / changes a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension and same pixel origin but different pixel format.
776  * @param frame The frame to convert, must be valid
777  * @param targetPixelFormat The pixel format of the target frame, must be valid
778  * @param forceCopy True, if the resulting target image is expected to are the owner of the image data, otherwise the source frame will be the owner of the image data if possible
779  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
780  * @param options The options to be used for conversion
781  * @return True, if the frame type conversion is supported and succeeded
782  */
783  static inline bool change(Frame& frame, const FrameType::PixelFormat targetPixelFormat, const bool forceCopy = true, Worker* worker = nullptr, const Options& options = Options());
784 
785  /**
786  * Converts / changes a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same dimension and same pixel format but different pixel origin.
787  * @param frame The frame to convert, must be valid
788  * @param targetPixelOrigin The pixel origin of the target frame, must be valid
789  * @param forceCopy True, if the resulting target image is expected to are the owner of the image data, otherwise the source frame will be the owner of the image data if possible
790  * @param worker Optional worker object to distribute the conversion computation to different CPU cores
791  * @param options The options to be used for conversion
792  * @return True, if the frame type conversion is supported and succeeded
793  */
794  static inline bool change(Frame& frame, const FrameType::PixelOrigin targetPixelOrigin, const bool forceCopy = true, Worker* worker = nullptr, const Options& options = Options());
795  };
796 
797  /**
798  * Casts the pixel values from one frame type to another frame type.
799  * The source frame must be a zipped frame e.g., FrameType::FORMAT_Y8, FrameType::FORMAT_RGB24, ...<br>
800  * Beware: This function does not handle any out of range issues and does not apply rounding.<br>
801  * This function mainly does the following:
802  * @code
803  * for each pixel and channel:
804  * targetValue = TTarget(sourceValue)
805  * @endcode
806  * @param source The source frame to be casted, must be valid
807  * @param target The target frame receiving the casted pixel values, must be valid (and not overlap the source frame)
808  * @param width The width of the source (and target frame) in pixel, with range [1, infinity)
809  * @param height The height of the source (and target frame) in pixel, with range [1, infinity)
810  * @param channels The number of channels the source frame (and target frame) has, with range [1, infinity)
811  * @param sourcePaddingElements The number of padding elements at the end of each source row, in elements, with range [0, infinity)
812  * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
813  * @tparam TSource The data type of each pixel channel of the source frame, e.g., 'uint8_t', 'int', 'float', ...
814  * @tparam TTarget The data type of each pixel channel of the target frame, e.g., 'uint8_t', 'int', 'float', ...
815  *
816  * Here is an example how to use this function:
817  * @code
818  * void function()
819  * {
820  * // we have a source frame e.g., with pixel format RGB 24 bit, 'uint8_t' for each pixel channel
821  * Frame sourceFrame(FrameType(1920u, 1080u, FrameType::FORMAT_RGB24, FrameType::ORIGIN_UPPER_LEFT));
822  *
823  * // set the pixel values of sourceFrame here ...
824  *
825  * // we want to cast this frame to a frame with 32 bit floating point values
826  * // we use the frame type of the source as pattern and change the pixel format only
827  * Frame targetFrame(FrameType(sourceFrame, FrameType::genericPixelFormat(FrameType::DT_SIGNED_FLOAT_32, 3u)));
828  *
829  * // now we simply cast the values from the source frame to the target frame
830  * FrameConverter::cast<uint8_t, float>(sourceFrame.constdata<uint8_t>(), targetFrame.data<float>(), sourceFrame.width(), sourceFrame.height(), sourceFrame.channels());
831  *
832  * // now we can access the floating point pixel values of target
833  * const float* floatRGBValues = targetFrame.constdata<float>();
834  * }
835  * @endcode
836  * @see normalizedCast().
837  */
838  template <typename TSource, typename TTarget>
839  static void cast(const TSource* __restrict source, TTarget* __restrict target, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements);
840 
841  /**
842  * Casts the pixel values from one frame type to another frame type but also normalizes the casted source values before assigning them (by scaling and offsetting).
843  * The source frame must be a zipped frame e.g., FrameType::FORMAT_Y8, FrameType::FORMAT_RGB24, ...<br>
844  * Beware: This function does not handle any out of range issues and does not apply rounding.<br>
845  * This function mainly does the following:
846  * @code
847  * for each pixel and channel:
848  * targetValue = TTarget(sourceValue) * multiplicationFactor + offset
849  * @endcode
850  * @param source The source frame to be casted, must be valid
851  * @param target The target frame receiving the casted pixel values, must be valid (and not overlap the source frame)
852  * @param width The width of the source (and target frame) in pixel, with range [1, infinity)
853  * @param height The height of the source (and target frame) in pixel, with range [1, infinity)
854  * @param channels The number of channels the source frame (and target frame) has, with range [1, infinity)
855  * @param multiplicationFactor The multiplication factor (with data type TTarget) which will be multiplied with each source values before the value is assigned, should not be zero
856  * @param offset The offset (with data type TTarget) that is added to each value after the conversion
857  * @param sourcePaddingElements The number of padding elements at the end of each source row, in elements, with range [0, infinity)
858  * @param targetPaddingElements The number of padding elements at the end of each target row, in elements, with range [0, infinity)
859  * @tparam TSource The data type of each pixel channel of the source frame, e.g., 'uint8_t', 'int', 'float', ...
860  * @tparam TTarget The data type of each pixel channel of the target frame, e.g., 'uint8_t', 'int', 'float', ...
861  *
862  * Here is an example how to use this function:
863  * @code
864  * void function()
865  * {
866  * // we have a source frame e.g., with pixel format RGB 24 bit, 'uint8_t' for each pixel channel
867  * Frame sourceFrame(FrameType(1920u, 1080u, FrameType::FORMAT_RGB24, FrameType::ORIGIN_UPPER_LEFT));
868  *
869  * // set the pixel values of sourceFrame here ...
870  *
871  * // we want to cast this frame to a frame with 32 bit floating point values
872  * // we use the frame type of the source as pattern and change the pixel format only
873  * Frame targetFrame(FrameType(sourceFrame, FrameType::genericPixelFormat(FrameType::DT_SIGNED_FLOAT_32, 3u)));
874  *
875  * // now we normalize the source values by 1/255 and assign the values - so that we get floating point values with range [0, 1]
876  * FrameConverter::normalizedCast<uint8_t, float>(sourceFrame.constdata<uint8_t>(), targetFrame.data<float>(), sourceFrame.width(), sourceFrame.height(), sourceFrame.channels(), 1.0f / 255.0f, 0);
877  *
878  * // now we can access the normalized floating point pixel values of target
879  * const float* floatRGBValues = targetFrame.constdata<float>();
880  * }
881  * @endcode
882  * @see cast().
883  */
884  template <typename TSource, typename TTarget>
885  static void normalizedCast(const TSource* __restrict source, TTarget* __restrict target, const unsigned int width, const unsigned int height, const unsigned int channels, const TTarget multiplicationFactor, const TTarget offset, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements);
886 
887  /**
888  * Copies a sub-frame of a given frame into a second frame while both frames might have an individual number of padding elements at the end of each row.
889  * The dimension of the sub-frame must fit into the source and target frame.
890  * @param source The source frame from which the sub-frame will be copied, must be valid
891  * @param target The target frame to which the sub-frame will be copied, must be valid
892  * @param sourceWidth Width of the entire source frame in pixels, with range [1, infinity)
893  * @param sourceHeight Height of the entire source frame in pixels, with range [1, infinity)
894  * @param targetWidth Width of the entire target frame in pixels, with range [1, infinity)
895  * @param targetHeight Height of the entire target frame in pixels, with range [1, infinity)
896  * @param channels Number of data channels of the given source (and target) frame, with range [1, infinity)
897  * @param sourceLeft Horizontal start position of the sub-frame inside the source frame in pixels, with range [0, sourceWidth - 1]
898  * @param sourceTop Vertical start position of the sub-frame inside the source frame in pixels, with range [0, sourceHeight - 1]
899  * @param targetLeft Horizontal start position of the sub-frame inside the target frame in pixels, with range [0, targetWidth -1]
900  * @param targetTop Vertical start position of the sub-frame inside the target frame in pixels, with range [0, targetHeight - 1]
901  * @param width The width of the sub-frame in pixel, with range [1, min(sourceWidth - sourceLeft, targetWidth - targetLeft)]
902  * @param height The height of the sub-frame in pixel, with range [1, min(sourceHeight - sourceTop, targetHeight - targetTop)]
903  * @param sourcePaddingElements Optional number of padding elements at the end of each source row, with range [0, infinity)
904  * @param targetPaddingElements Optional number of padding elements at the end of each target row, with range [0, infinity)
905  * @return True, if succeeded
906  * @tparam T The data type of each element
907  */
908  template <typename T>
909  static bool subFrame(const T* source, T* target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int channels, const unsigned int sourceLeft, const unsigned int sourceTop, const unsigned int targetLeft, const unsigned int targetTop, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements);
910 
911  /**
912  * Copies pixels from one sub-frame to another if the pixels are part of a mask; input may use padding.
913  * The behavior of this function can be described as:
914  * <pre>
915  * target[i] = mask[i] == maskValue ? source[i] : target[i]
916  * </pre>
917  * The dimension of the sub-frame must fit into the source and target frame. The mask must have the same size as the sub-frame.
918  * @param sourceFrame The source frame from which the sub-frame will be copied, must be valid
919  * @param targetFrame The target frame to which the sub-frame will be copied, must be valid
920  * @param maskFrame The binary mask that is used to indicate which source pixels to copy to the target frame, must be valid, have one channel, and have the same size of the region that is copied (`subFrameWidth` x `subFrameHeight`)
921  * @param sourceLeft Horizontal start position of the sub-frame inside the source frame in pixels, with range [0, sourceWidth - 1]
922  * @param sourceTop Vertical start position of the sub-frame inside the source frame in pixels, with range [0, sourceHeight - 1]
923  * @param targetLeft Horizontal start position of the sub-frame inside the target frame in pixels, with range [0, targetWidth -1]
924  * @param targetTop Vertical start position of the sub-frame inside the target frame in pixels, with range [0, targetHeight - 1]
925  * @param subFrameWidth Width of the sub-frame in pixel, with range [0, min(sourceWidth - sourceLeft, targetWidth - targetLeft)]
926  * @param subFrameHeight Height of the sub-frame in pixel, with range [1, min(sourceHeight - sourceTop, targetHeight - targetTop)]
927  * @param maskValue Optional value which indicates which pixel value should be interpreted as the foreground (and copied)
928  * @return True, if succeeded
929  * @tparam T The data type of the elements of the source and target frames
930  */
931  template <typename T>
932  static bool subFrameMask(const Frame& sourceFrame, Frame& targetFrame, const Frame& maskFrame, const uint32_t sourceLeft, const uint32_t sourceTop, const uint32_t targetLeft, const uint32_t targetTop, const uint32_t subFrameWidth, const uint32_t subFrameHeight, const uint8_t maskValue = 0u);
933 
934  /**
935  * Copies pixels from one sub-frame to another if the pixels are part of a mask; input may use padding.
936  * The behavior of this function can be described as:
937  * <pre>
938  * target[i] = mask[i] == maskValue ? source[i] : target[i]
939  * </pre>
940  * The dimension of the sub-frame must fit into the source and target frame. The mask must have the same size as the sub-frame.
941  * @param source The source frame from which the sub-frame will be copied, must be valid
942  * @param target The target frame to which the sub-frame will be copied, must be valid
943  * @param mask The binary mask that is used to indicate which source pixels to copy to the target frame, must be valid, have one channel, and have the same size of the region that is copied (`subFrameWidth` x `subFrameHeight`)
944  * @param sourceWidth Width of the entire source frame in pixels, with range [1, infinity)
945  * @param sourceHeight Height of the entire source frame in pixels, with range [1, infinity)
946  * @param targetWidth Width of the entire target frame in pixels, with range [1, infinity)
947  * @param targetHeight Height of the entire target frame in pixels, with range [1, infinity)
948  * @param channels Number of data channels of the given source (and target) frame, with range [1, infinity)
949  * @param sourceLeft Horizontal start position of the sub-frame inside the source frame in pixels, with range [0, sourceWidth - 1]
950  * @param sourceTop Vertical start position of the sub-frame inside the source frame in pixels, with range [0, sourceHeight - 1]
951  * @param targetLeft Horizontal start position of the sub-frame inside the target frame in pixels, with range [0, targetWidth -1]
952  * @param targetTop Vertical start position of the sub-frame inside the target frame in pixels, with range [0, targetHeight - 1]
953  * @param subFrameWidth Width of the sub-frame in pixel, with range [1, min(sourceWidth - sourceLeft, targetWidth - targetLeft)]
954  * @param subFrameHeight Height of the sub-frame in pixel, with range [1, min(sourceHeight - sourceTop, targetHeight - targetTop)]
955  * @param sourcePaddingElements Optional number of padding elements at the end of each source row, with range [0, infinity)
956  * @param targetPaddingElements Optional number of padding elements at the end of each target row, with range [0, infinity)
957  * @param maskPaddingElements Optional number of padding elements at the end of each source row, with range [0, infinity)
958  * @param maskValue Optional value which indicates which pixel value should be interpreted as the foreground (and copied)
959  * @return True, if succeeded
960  * @tparam T The data type of the elements of the source and target frames
961  */
962  template <typename T>
963  static bool subFrameMask(const T* source, T* target, const uint8_t* mask, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int channels, const unsigned int sourceLeft, const unsigned int sourceTop, const unsigned int targetLeft, const unsigned int targetTop, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int maskPaddingElements, const uint8_t maskValue = 0u);
964 
965  /**
966  * Copies a small patch area of a given frame into a buffer holding only the entire patch.
967  * @param source The source frame from which the patch will be copied, must be valid
968  * @param buffer The target buffer to which the frame content will be copied, must be valid
969  * @param width The width of the source frame in pixels, with range [patchSize, infinity)
970  * @param channels Number of data channels of the given source frame, with range [1, infinity)
971  * @param x Horizontal center position of the patch to be copied in pixel, with range [patchSize/2, width - patchSize/2 - 1]
972  * @param y Vertical center position of the patch to be copied in pixel, with range [patchSize/2, height - patchSize/2 - 1]
973  * @param patchSize The side length of the patch to be copied in pixel, with range [1, infinity), must be odd
974  * @param sourcePaddingElements The number of padding elements at the end of each source row, in elements, with range [0, infinity)
975  * @param bufferPaddingElements The number of padding elements at the end of each buffer row, in elements, with range [0, infinity)
976  * @tparam T The data type of the elements of the source frame and the target buffer, e.g., 'uint8_t', or 'float'
977  */
978  template <typename T>
979  static inline void patchFrame(const T* source, T* buffer, const unsigned int width, const unsigned int channels, const unsigned int x, const unsigned int y, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int bufferPaddingElements);
980 
981  /**
982  * Copies a small patch area of a frame into a buffer holding only the entire patch.
983  * Pixels in the patch mapping to positions outside the frame are mirrored into the frame.<br>
984  * @param source The source frame from which the patch will be copied, must be valid
985  * @param buffer The target buffer to which the frame content will be copied, must be valid
986  * @param width The width of the source frame in pixels, with range [patchSize/2+1, infinity)
987  * @param height The height of the source frame in pixels, with range [patchSize/2+1, infinity)
988  * @param x Horizontal center position of the patch to be copied in pixel, with range [0, width - 1]
989  * @param y Vertical center position of the patch to be copied in pixel, with range [0, height - 1]
990  * @param patchSize The side length of the patch to be copied in pixel, with range [1, infinity), must be odd
991  * @param sourcePaddingElements The number of padding elements at the end of each source row, in elements, with range [0, infinity)
992  * @param bufferPaddingElements The number of padding elements at the end of each buffer row, in elements, with range [0, infinity)
993  * @tparam T The data type of the elements of the source frame and the target buffer, e.g., 'uint8_t', or 'float'
994  * @tparam tChannels Number of data channels of the given source frame, with range [1, infinity)
995  */
996  template <typename T, unsigned int tChannels>
997  static void patchFrameMirroredBorder(const T* source, T* buffer, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int bufferPaddingElements);
998 
999  /**
1000  * Returns the 3x4 color space transformation matrix from full range RGB24 to full range YUV24 using BT.601, analog RGB to (analog) YPbPr.
1001  * Below the precise transformation matrices are given:
1002  * <pre>
1003  * RGB input value range: [0, 255]x[0, 255]x[0, 255]
1004  * YUV output value range: [0, 255]x[0, 255]x[0, 255]
1005  *
1006  * | Y | | 0.299 0.587 0.114 0 | | R |
1007  * | U | = | -0.168736 -0.331264 0.5 128 | * | G |
1008  * | V | | 0.5 -0.418688 -0.081312 128 | | B |
1009  * | 1 |
1010  * Approximation with 7 bit precision:
1011  * | Y | | 38 75 15 0 128 | | R |
1012  * 128 * | U | = | -22 -42 64 128 * 128 | * | G |
1013  * | V | | 64 -54 -10 128 * 128 | | B |
1014  * | 1 |
1015  * </pre>
1016  * @return The 3x4 transformation matrix
1017  * @see transformationMatrix_FullRangeRGB24_To_FullRangeYVU24_BT601().
1018  */
1020 
1021  /**
1022  * Returns the 3x4 color space transformation matrix from full range RGB24 to full range YVU24 using BT.601, analog RGB to (analog) YPbPr.
1023  * @return The 3x4 transformation matrix
1024  * @see transformationMatrix_FullRangeRGB24_To_FullRangeYUV24_BT601().
1025  */
1027 
1028  /**
1029  * Returns the 3x4 color space transformation matrix from full range RGB24 to limited range YUV24 using BT.601, analog RGB to (digital) YCbCr.
1030  * Below the precise transformation matrices are given:
1031  * <pre>
1032  * RGB input value range: [0, 255]x[0, 255]x[0, 255]
1033  * YUV output value range: [16, 235]x[16, 240]x[16, 240]
1034  *
1035  * | Y | | 0.2578125 0.5039063 0.09765625 16.0 | | R |
1036  * | U | = | -0.1484375 -0.2890625 0.4375 128.0 | * | G |
1037  * | V | | 0.4375 -0.3671875 -0.0703125 128.0 | | B |
1038  * | 1 |
1039  * Approximation with 7 bit precision:
1040  * | Y | | 33 64 13 16 * 128 | | R |
1041  * 128 * | U | = | -19 -37 56 128 * 128 | * | G |
1042  * | V | | 56 -47 -9 128 * 128 | | B |
1043  * | 1 |
1044  * </pre>
1045  * @return The 3x4 transformation matrix
1046  * @see transformationMatrix_FullRangeRGB24_To_LimitedRangeYVU24_BT601().
1047  */
1049 
1050  /**
1051  * Returns the 3x4 color space transformation matrix from full range RGB24 to limited range YVU24 using BT.601, analog RGB to (digital) YCbCr.
1052  * @return The 3x4 transformation matrix
1053  * @see transformationMatrix_FullRangeRGB24_To_LimitedRangeYUV24_BT601().
1054  */
1056 
1057  /**
1058  * Returns the color space transformation matrix from full range YUV24 to full range BGR24 using BT.601, (analog) YPbPr to analog BGR.
1059  * Below the precise transformation matrices are given:
1060  * <pre>
1061  * YUV input value range: [0, 255]x[0, 255]x[0, 255]
1062  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1063  *
1064  * | B | | 1.0 1.772 0.0 -226.816 | | Y |
1065  * | G | = | 1.0 -0.34414 -0.71414 135.45984 | * | U |
1066  * | R | | 1.0 0.0 1.402 -179.456 | | V |
1067  * | 1 |
1068  *
1069  * Approximation with 6 bit precision:
1070  * | B | | 64 113 0 | | Y |
1071  * 64 * | G | = | 64 -22 -46 | * | U - 128 |
1072  * | R | | 64 0 90 | | V - 128 |
1073  * </pre>
1074  * @return The 3x4 transformation matrix
1075  * @see transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_Android().
1076  */
1078 
1079  /**
1080  * Returns the color space transformation matrix from full range YUV24 to full range RGB24 using BT.601, (analog) YPbPr to analog RGB.
1081  * Below the precise transformation matrices are given:
1082  * <pre>
1083  * YUV input value range: [0, 255]x[0, 255]x[0, 255s]
1084  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1085  *
1086  * | R | | 1.0 0.0 1.402 -179.456 | | Y |
1087  * | G | = | 1.0 -0.34414 -0.71414 135.45984 | * | U |
1088  * | B | | 1.0 1.772 0.0 -226.816 | | V |
1089  * | 1 |
1090  *
1091  * Approximation with 6 bit precision:
1092  * | R | | 64 0 90 | | Y |
1093  * 64 * | G | = | 64 -22 -46 | * | U - 128 |
1094  * | B | | 64 113 0 | | V - 128 |
1095  * </pre>
1096  * @return The 3x4 transformation matrix
1097  * @see transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_Android().
1098  */
1100 
1101  /**
1102  * Returns the color space transformation matrix from full range YUV24 to full range BGR24 similar to BT.601, (analog) YPbPr to analog BGR.
1103  * This transformation matrix is close to the official BT.601 standard and used on Android for conversion from Y'UV420sp (NV21).<br>
1104  * @see transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_Android().
1105  * @return The 3x4 transformation matrix
1106  */
1108 
1109  /**
1110  * Returns the color space transformation matrix from full range YUV24 to full range RGB24 similar to BT.601, (analog) YPbPr to analog RGB.
1111  * This transformation matrix is close to the official BT.601 standard and used on Android for conversion from Y'UV420sp (NV21).<br>
1112  * The conversion can be found in Android's source code: /media/libstagefright/yuv/YUVImage.cpp<br>
1113  * Below the precise transformation matrices are given:
1114  * <pre>
1115  * YUV input value range: [0, 255]x[0, 255]x[0, 255s]
1116  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1117  *
1118  * | R | | 1.0 0.0 1.370705 | | Y | | 1.0 0.0 1.370705 -175.45024 | | Y |
1119  * | G | = | 1.0 -0.337633 -0.698001 | * | U - 128 | = | 1.0 -0.337633 -0.698001 132.561152 | * | U |
1120  * | B | | 1.0 1.732446 0.0 | | V - 128 | | 1.0 1.732446 0.0 -221.753088 | | V |
1121  * | 1 |
1122  *
1123  * Approximation with 6 bit precision:
1124  * | R | | 64 0 88 | | Y |
1125  * 64 * | G | = | 64 -22 -45 | * | U - 128 |
1126  * | B | | 64 111 0 | | V - 128 |
1127  * </pre>
1128  * @see transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_BT601(), transformationMatrix_FullRangeYUV24_To_FullRangeBGR24_Android().
1129  * @return The 3x4 transformation matrix
1130  */
1132 
1133  /**
1134  * Returns the color space transformation matrix from full range YVU24 to full range BGR24 similar to BT.601, (analog) YPbPr to analog BGR.
1135  * This transformation matrix is close to the official BT.601 standard and used on Android for conversion from Y'UV420sp (NV21).<br>
1136  * @see transformationMatrix_FullRangeYVU24_To_FullRangeRGB24_Android().
1137  * @return The 3x4 transformation matrix
1138  */
1140 
1141  /**
1142  * Returns the color space transformation matrix from full range YVU24 to full range RGB24 similar to BT.601, (analog) YPbPr to analog RGB.
1143  * This transformation matrix is close to the official BT.601 standard and used on Android for conversion from Y'UV420sp (NV21).<br>
1144  * The conversion can be found in Android's source code: /media/libstagefright/yuv/YUVImage.cpp<br>
1145  * Below the precise transformation matrices are given:
1146  * <pre>
1147  * YUV input value range: [0, 255]x[0, 255]x[0, 255s]
1148  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1149  *
1150  * | R | | 1.0 1.370705 0.0 | | Y | | 1.0 1.370705 0.0 -175.45024 | | Y |
1151  * | G | = | 1.0 -0.698001 -0.337633 | * | V - 128 | = | 1.0 -0.698001 -0.337633 132.561152 | * | V |
1152  * | B | | 1.0 0.0 1.732446 | | U - 128 | | 1.0 0.0 1.732446 -221.753088 | | U |
1153  * | 1 |
1154  *
1155  * Approximation with 6 bit precision:
1156  * | R | | 64 88 0 | | Y |
1157  * 64 * | G | = | 64 -45 -22 | * | V - 128 |
1158  * | B | | 64 0 111 | | U - 128 |
1159  * </pre>
1160  * @return The 3x4 transformation matrix
1161  */
1163 
1164  /**
1165  * Returns the color space transformation matrix from limited range YUV24 to full range RGB24 using BT.601, (digital) YCbCr to analog RGB.
1166  * Below the precise transformation matrices are given:
1167  * <pre>
1168  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
1169  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1170  *
1171  * | R | | 1.1639404296875 0.0 1.595947265625 -222.904296875 | | Y |
1172  * | G | = | 1.1639404296875 -0.3909912109375 -0.81298828125 135.486328125 | * | U |
1173  * | B | | 1.1639404296875 2.0179443359375 0.0 -276.919921875 | | V |
1174  * | 1 |
1175  *
1176  * Approximation with 13 bit precision:
1177  * | R | | 9535 0 13074 | | Y - 16 |
1178  * 8192 * | G | = | 9535 -3203 -6660 | * | U - 128 |
1179  * | B | | 9535 16531 0 | | V - 128 |
1180  *
1181  * Approximation with 10 bit precision:
1182  * | R | | 1192 0 1634 -223 * 1024 | | Y |
1183  * 1024 * | G | = | 1192 -400 -833 135 * 1024 | * | U |
1184  * | B | | 1192 2066 0 -277 * 1024 | | V |
1185  * | 1 |
1186  *
1187  * Approximation with 8 bit precision:
1188  * | R | | 298 0 409 | | Y - 16 |
1189  * 256 * | G | = | 298 -409 -208 | * | U - 128 |
1190  * | B | | 298 516 0 | | V - 128 |
1191  *
1192  * Approximation with 6 bit precision:
1193  * | R | | 75 0 102 | | Y - 16 |
1194  * 64 * | G | = | 75 -25 -52 | * | U - 128 |
1195  * | B | | 75 128 0 | | V - 128 |
1196  * </pre>
1197  * @return The 3x4 transformation matrix
1198  */
1200 
1201  /**
1202  * Returns the color space transformation matrix from full range BGR24 to limited range YUV24 using BT.601, analog RGB to (digital) YCbCr.
1203  * <pre>
1204  * BGR input value range: [0, 255]x[0, 255]x[0, 255]
1205  * YUV output value range: [16, 235]x[16, 240]x[16, 240]
1206  * </pre>
1207  * @return The 3x4 transformation matrix
1208  * @see transformationMatrixFullRangeRGB24ToLimitedRangeYUV24_BT601().
1209  */
1211 
1212  /**
1213  * Returns the 3x4 color space transformation matrix from full range BGR24 to full range YUV24 using BT.601, analog BGR to (analog) YPbPr.
1214  * Below the precise transformation matrices are given:
1215  * <pre>
1216  * BGR input value range: [0, 255]x[0, 255]x[0, 255]
1217  * YUV output value range: [0, 255]x[0, 255]x[0, 255]
1218  *
1219  * | Y | | 0.114 0.587 0.299 0 | | B |
1220  * | U | = | 0.5 -0.331264 -0.168736 128 | * | G |
1221  * | V | | -0.081312 -0.418688 0.5 128 | | R |
1222  * | 1 |
1223  * Approximation with 7 bit precision:
1224  * | Y | | 15 75 38 0 128 | | B |
1225  * 128 * | U | = | 64 -42 -22 128 * 128 | * | G |
1226  * | V | | -10 -54 64 128 * 128 | | R |
1227  * | 1 |
1228  * </pre>
1229  * @return The 3x4 transformation matrix
1230  * @see transformationMatrix_FullRangeRGB24_To_FullRangeYUV24_BT601().
1231  */
1233 
1234  /**
1235  * Returns the 3x4 color space transformation matrix from full range BGR24 to full range YVU24 using BT.601, analog BGR to (analog) YPbPr.
1236  * Below the precise transformation matrices are given:
1237  * <pre>
1238  * BGR input value range: [0, 255]x[0, 255]x[0, 255]
1239  * YVU output value range: [0, 255]x[0, 255]x[0, 255]
1240  * </pre>
1241  * @return The 3x4 transformation matrix
1242  * @see transformationMatrix_FullRangeBGR24_To_FullRangeYUV24_BT601().
1243  */
1245 
1246  /**
1247  * Returns the color space transformation matrix from limited range YUV24 to full range BGR24 using BT.601, (digital) YCbCr to analog BGR.
1248  * <pre>
1249  * YUV input value range: [16, 235]x[16, 240]x[16, 240]
1250  * BGR output value range: [0, 255]x[0, 255]x[0, 255]
1251  * </pre>
1252  * @return The 3x4 transformation matrix
1253  * @see transformationMatrixLimitedRangeYUV24ToFullRangeRGB24_BT601().
1254  */
1256 
1257  /**
1258  * Returns the color space transformation matrix from limited range YVU24 to full range BGR24 using BT.601, (digital) YCrCb to analog BGR.
1259  * <pre>
1260  * YVU input value range: [16, 235]x[16, 240]x[16, 240]
1261  * BGR output value range: [0, 255]x[0, 255]x[0, 255]
1262  * </pre>
1263  * @return The 3x4 transformation matrix
1264  * @see transformationMatrixLimitedRangeYUV24ToFullRangeRGB24_BT601().
1265  */
1267 
1268  /**
1269  * Returns the color space transformation matrix from limited range YVU24 to full range RGB24 using BT.601, (digital) YCrCb to analog RGB.
1270  * <pre>
1271  * YVU input value range: [16, 235]x[16, 240]x[16, 240]
1272  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1273  * </pre>
1274  * @return The 3x4 transformation matrix
1275  * @see transformationMatrixLimitedRangeYUV24ToFullRangeRGB24_BT601().
1276  */
1278 
1279  /**
1280  * Returns the color space transformation matrix from full range YVU24 to full range RGB24 using BT.601, (digital) YCrCb to analog RGB.
1281  * <pre>
1282  * YVU input value range: [0, 255]x[0, 255]x[0, 255]
1283  * RGB output value range: [0, 255]x[0, 255]x[0, 255]
1284  * </pre>
1285  * @return The 3x4 transformation matrix
1286  * @see transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_BT601().
1287  */
1289 
1290  /**
1291  * Returns the color space transformation matrix from full range YVU24 to full range BGR24 using BT.601, (digital) YCrCb to analog BGR.
1292  * <pre>
1293  * YVU input value range: [0, 255]x[0, 255]x[0, 255]
1294  * BGR output value range: [0, 255]x[0, 255]x[0, 255]
1295  * </pre>
1296  * @return The 3x4 transformation matrix
1297  * @see transformationMatrix_FullRangeYUV24_To_FullRangeBGR24_BT601().
1298  */
1300 
1301  /**
1302  * Returns a vector holding all possible conversion flags.
1303  * @return The vector with conversion flags, will be four.
1304  */
1306 
1307  /**
1308  * Translates a given conversion flag to a string.
1309  * @param conversionFlag The conversion flag to be translated
1310  * @return The resulting string containing the flag
1311  */
1312  static std::string translateConversionFlag(const ConversionFlag conversionFlag);
1313 
1314  protected:
1315 
1316  /**
1317  * Casts 16 successive elements from one data type to another data type.
1318  * @param source The 16 source elements that will be casted, must be valid
1319  * @param target The 16 target elements receiving the casted pixel values, must be valid
1320  * @tparam TSource The data type of each pixel channel of the source frame, e.g., 'uint8_t', 'int', 'float', ...
1321  * @tparam TTarget The data type of each pixel channel of the target frame, e.g., 'uint8_t', 'int', 'float', ...
1322  */
1323  template <typename TSource, typename TTarget>
1324  static inline void cast16Elements(const TSource* const source, TTarget* const target);
1325 
1326  /**
1327  * Converts a frame with generic pixel format (e.g., RGBA32, BGR24, YUV24, ...) to a frame with generic pixel format (e.g., RGB24, Y8).
1328  * This function needs a function pointer that is able to convert one row, and to reverse the order of pixels in one row in the target frame.
1329  * @param source The source frame with generic pixel format, must be valid
1330  * @param target The target frame with generic pixel format, must be valid
1331  * @param width The width of the frame, with range [1, infinity)
1332  * @param height The height of the frame, with range [1, infinity)
1333  * @param sourceStrideElements Number of horizontal elements between the start of two source rows, in elements, with range [width * elementsPerSourcePixel, infinity)
1334  * @param targetStrideElements Number of horizontal elements between the start of two target rows, in elements, with range [width * elementsPerTargetPixel, infinity)
1335  * @param flag Determining the type of conversion
1336  * @param rowConversionFunction The function able to convert one row, must be valid
1337  * @param targetReversePixelOrderInPlaceFunction The function able to reverse the pixel order in one target row, must be valid if 'flag == CONVERT_MIRRORED || CONVERT_FLIPPED_AND_MIRRORED', can be nullptr otherwise
1338  * @param areContinuous True, if source and target frame have continuous memory (without padding); False, otherwise
1339  * @param options Optional options which are necessary in the row conversion function, otherwise nullptr
1340  * @param worker Optional worker to distribute the computation to several CPU cores
1341  * @tparam TSource The data type of each source pixel element, e.g., 'uint8_t' or 'float'
1342  * @tparam TTarget The data type of each target pixel element, e.g., 'uint8_t' or 'float'
1343  */
1344  template <typename TSource, typename TTarget>
1345  static inline void convertGenericPixelFormat(const TSource* source, TTarget* target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideElements, const unsigned int targetStrideElements, const ConversionFlag flag, const RowConversionFunction<TSource, TTarget> rowConversionFunction, const RowReversePixelOrderInPlaceFunction<TTarget> targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void* options, Worker* worker);
1346 
1347  /**
1348  * Converts a frame with arbitrary pixel format (e.g., Y_UV12, Y_VU12, YUYV16, ...) to a frame with arbitrary pixel format.
1349  * This function needs a function pointer that is able to convert multiple rows.
1350  * @param sources The memory pointers defining the source frame, e.g., several individual points to individual blocks in memory, must be valid
1351  * @param targets The memory pointers defining the target frame, e.g., several individual points to individual blocks in memory, must be valid
1352  * @param width The width of the frame, with range [1, infinity)
1353  * @param height The height of the frame, with range [multipleRowsPerIteration, infinity), must be a multiple of 'multipleRowsPerIteration'
1354  * @param flag The conversion type to be applied
1355  * @param multipleRowsPerIteration The number of rows, the specified rows-conversion-functions 'multipleRowsConversionFunction' can handle within one iteration, with range [1, infinity)
1356  * @param multipleRowsConversionFunction The function able to convert several row, must be valid
1357  * @param options Optional options which are necessary in the rows conversion function, otherwise nullptr
1358  * @param worker Optional worker to distribute the computation to several CPU cores
1359  */
1360  static inline void convertArbitraryPixelFormat(const void** sources, void** targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void* options, Worker* worker);
1361 
1362  /**
1363  * Converts a subset of a frame with generic pixel format (e.g., RGBA32, BGR24, YUV24, ...) to a frame with generic pixel format (e.g., Y8).
1364  * This function needs a function pointer that is able to convert one row, and to reverse the order of pixels in one row in the target frame.
1365  * @param source The source frame with generic pixel format, must be valid
1366  * @param target The target frame with generic pixel format, must be valid
1367  * @param width The width of the frame, with range [1, infinity)
1368  * @param height The height of the frame, with range [1, infinity)
1369  * @param sourceStrideBytes Number of bytes between the start of two source rows, in bytes, with range [width * elementsPerSourcePixel * sizeof(channelElement), infinity)
1370  * @param targetStrideBytes Number of bytes between the start of two target rows, in bytes, with range [width * elementsPerTargetPixel * sizeof(channelElement), infinity)
1371  * @param flag Determining the type of conversion
1372  * @param rowConversionFunction The function able to convert one row, must be valid
1373  * @param targetReversePixelOrderInPlaceFunction The function able to reverse the pixel order in one target row, must be valid
1374  * @param areContinuous True, if source and target frame have continuous memory (without padding); False, otherwise
1375  * @param options Optional options which are necessary in the row conversion function, otherwise nullptr
1376  * @param firstRow The first row to be handled, with range [0, height - 1]
1377  * @param numberRows The number of rows to be handled, with range [1, height - firstRow]
1378  * @see convertGenericPixelFormat<T>().
1379  */
1380  static void convertGenericPixelFormatSubset(const uint8_t* source, uint8_t* target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideBytes, const unsigned int targetStrideBytes, const ConversionFlag flag, const RowConversionFunction<uint8_t, uint8_t> rowConversionFunction, const RowReversePixelOrderInPlaceFunction<uint8_t> targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void* options, const unsigned int firstRow, const unsigned int numberRows);
1381 
1382  /**
1383  * Converts a subset of a frame with arbitrary pixel format (e.g., Y_UV12, Y_VU12, YUYV16, ...) to a frame with arbitrary pixel format.
1384  * @param sources The memory pointers defining the source frame, e.g., several individual points to individual blocks in memory, must be valid
1385  * @param targets The memory pointers defining the target frame, e.g., several individual points to individual blocks in memory, must be valid
1386  * @param width The width of the frame, with range [1, infinity)
1387  * @param height The height of the frame, with range [multipleRowsPerIteration, infinity), must be a multiple of 'multipleRowsPerIteration'
1388  * @param flag The conversion type to be applied
1389  * @param multipleRowsPerIteration The number of rows, the specified rows-conversion-functions 'multipleRowsConversionFunction' can handle within one iteration, with range [1, infinity)
1390  * @param multipleRowsConversionFunction The function able to convert several row, must be valid
1391  * @param options Optional options which are necessary in the rows conversion function, otherwise nullptr
1392  * @param firstMultipleRow The first multiple-row to be handled, with range [0, height / multipleRowsPerIteration - 1]
1393  * @param numberMultipleRows The number of multiple-rows to be handled, with range [1, height / multipleRowsPerIteration]
1394  * @see convertArbitraryPixelFormat().
1395  */
1396  static void convertArbitraryPixelFormatSubset(const void** sources, void** targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void* options, const unsigned int firstMultipleRow, const unsigned int numberMultipleRows);
1397 
1398  /**
1399  * This function is not used anymore due to the corresponding 2-row function.
1400  *
1401  * Converts one row of an image with e.g., a Y_UV12 pixel format to one row of an image with e.g., RGB24 pixel format with 6 bit precision.
1402  * This function needs one plane with the first channel and another plane/block of 2x2 sub-sampled pixels containing the second and third channels.<br>
1403  * The layout of the source image of e.g., an Y_UV12 image looks like this:
1404  * <pre>
1405  * source0: source1:
1406  * --------- ---------
1407  * | Y Y Y Y | | U V U V |
1408  * | Y Y Y Y | | U V U V |
1409  * | Y Y Y Y | ---------
1410  * | Y Y Y Y |
1411  * ---------
1412  * </pre>
1413  *
1414  * The layout of the target image of e.g., a RGB24 image looks like this:
1415  * <pre>
1416  * target:
1417  * ----------------------------
1418  * | R G B R G B R G B R G B |
1419  * | R G B R G B R G B R G B |
1420  * | R G B R G B R G B R G B |
1421  * | R G B R G B R G B R G B |
1422  * ----------------------------
1423  * </pre>
1424  *
1425  * The layout of the options parameters is as follows:
1426  * <pre>
1427  * options[ 0] uint32_t: sourcePlane0PaddingElements
1428  * options[ 1] uint32_t: sourcePlane1PaddingElements
1429  * options[ 2] uint32_t: targetPlanePaddingElements
1430  *
1431  * options[ 3] int32_t: f00
1432  * options[ 4] int32_t: f10
1433  * options[ 5] int32_t: f20
1434  * options[ 6] int32_t: f01
1435  * options[ ] ...
1436  * options[11] int32_t: f22
1437  *
1438  * options[12] int32_t: b0
1439  * options[13] int32_t: b1
1440  * options[14] int32_t: b2
1441  *
1442  * with transformation:
1443  * t0 = clamp(0, f00 * (s0 - b0) + f01 * (s1 - b1) + f02 * (s2 - b2), 255)
1444  * t1 = clamp(0, f10 * (s0 - b0) + f11 * (s1 - b1) + f12 * (s2 - b2), 255)
1445  * t2 = clamp(0, f20 * (s0 - b0) + f21 * (s1 - b1) + f22 * (s2 - b2), 255)
1446  * </pre>
1447  * @param sources The pointer to the first and second memory block of the source image, must be valid
1448  * @param targets The one pointer to the target image, must be valid
1449  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height 1]
1450  * @param width The width of the frame in pixel, with range [1, infinity), must be even
1451  * @param height The height of the frame in pixel, with range [1, infinity), must be even
1452  * @param conversionFlag The conversion to be applied
1453  * @param options The 15 options parameters: 3 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1454  * @see convertOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit().
1455  */
1456  static void convertOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1457 
1458  /**
1459  * This function is not used anymore due to the corresponding 2-row function.
1460  *
1461  * Converts one row of an image with e.g., a Y_UV12 pixel format to one row of an image with e.g., RGB24 pixel format with 10 bit precision.
1462  * This function needs one plane with the first channel and another plane/block of 2x2 sub-sampled pixels containing the second and third channels.<br>
1463  * The layout of the source image of e.g., an Y_UV12 image looks like this:
1464  * <pre>
1465  * source0: source1:
1466  * --------- ---------
1467  * | Y Y Y Y | | U V U V |
1468  * | Y Y Y Y | | U V U V |
1469  * | Y Y Y Y | ---------
1470  * | Y Y Y Y |
1471  * ---------
1472  * </pre>
1473  *
1474  * The layout of the target image of e.g., a RGB24 image looks like this:
1475  * <pre>
1476  * target:
1477  * ----------------------------
1478  * | R G B R G B R G B R G B |
1479  * | R G B R G B R G B R G B |
1480  * | R G B R G B R G B R G B |
1481  * | R G B R G B R G B R G B |
1482  * ----------------------------
1483  * </pre>
1484  *
1485  * The layout of the options parameters is as follows:
1486  * <pre>
1487  * options[ 0] uint32_t: sourcePlane0PaddingElements
1488  * options[ 1] uint32_t: sourcePlane1PaddingElements
1489  * options[ 2] uint32_t: targetPlanePaddingElements
1490  *
1491  * options[ 3] int32_t: f00
1492  * options[ 4] int32_t: f10
1493  * options[ 5] int32_t: f20
1494  * options[ 6] int32_t: f01
1495  * options[ ] ...
1496  * options[11] int32_t: f22
1497  *
1498  * options[12] int32_t: b0
1499  * options[13] int32_t: b1
1500  * options[14] int32_t: b2
1501  *
1502  * with transformation:
1503  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
1504  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
1505  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
1506  * </pre>
1507  * @param sources The pointer to the first and second memory block of the source image, must be valid
1508  * @param targets The one pointer to the target image, must be valid
1509  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height 1]
1510  * @param width The width of the frame in pixel, with range [1, infinity), must be even
1511  * @param height The height of the frame in pixel, with range [1, infinity), must be even
1512  * @param conversionFlag The conversion to be applied
1513  * @param options The 15 options parameters: 3 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1514  * @see convertOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit().
1515  */
1516  static void convertOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1517 
1518  /**
1519  * Converts two rows of an image with e.g., a Y_UV12 pixel format to two rows of an image with e.g., an RGB24 pixel format with 6 bit precision.
1520  * This function needs one plane with the first channel and another plane/block of 2x2 sub-sampled pixels containing the second and third channels.<br>
1521  * The layout of the source image of e.g., an Y_UV12 image looks like this:
1522  * <pre>
1523  * source0: source1:
1524  * --------- ---------
1525  * | Y Y Y Y | | U V U V |
1526  * | Y Y Y Y | | U V U V |
1527  * | Y Y Y Y | ---------
1528  * | Y Y Y Y |
1529  * ---------
1530  * </pre>
1531  *
1532  * The layout of the target image of e.g., a RGB24 image looks like this:
1533  * <pre>
1534  * target:
1535  * ----------------------------
1536  * | R G B R G B R G B R G B |
1537  * | R G B R G B R G B R G B |
1538  * | R G B R G B R G B R G B |
1539  * | R G B R G B R G B R G B |
1540  * ----------------------------
1541  * </pre>
1542  *
1543  * The layout of the options parameters is as follows:
1544  * <pre>
1545  * options[ 0] uint32_t: sourcePlane0PaddingElements
1546  * options[ 1] uint32_t: sourcePlane1PaddingElements
1547  * options[ 2] uint32_t: targetPlanePaddingElements
1548  *
1549  * options[ 3] int32_t: f00
1550  * options[ 4] int32_t: f10
1551  * options[ 5] int32_t: f20
1552  * options[ 6] int32_t: f01
1553  * options[ ] ...
1554  * options[11] int32_t: f22
1555  *
1556  * options[12] int32_t: b0
1557  * options[13] int32_t: b1
1558  * options[14] int32_t: b2
1559  *
1560  * with transformation:
1561  * t0 = clamp(0, f00 * (s0 - b0) + f01 * (s1 - b1) + f02 * (s2 - b2), 255)
1562  * t1 = clamp(0, f10 * (s0 - b0) + f11 * (s1 - b1) + f12 * (s2 - b2), 255)
1563  * t2 = clamp(0, f20 * (s0 - b0) + f21 * (s1 - b1) + f22 * (s2 - b2), 255)
1564  * </pre>
1565  * @param sources The pointer to the first and second memory block of the source image, must be valid
1566  * @param targets The one pointer to the target image, must be valid
1567  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
1568  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1569  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1570  * @param conversionFlag The conversion to be applied
1571  * @param options The 15 options parameters: 3 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1572  */
1573  static void convertTwoRows_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1574 
1575  /**
1576  * Converts two rows of an image with e.g., a Y_UV12 pixel format to two rows of an image with e.g., an RGB24 pixel format with 10 bit precision.
1577  * This function needs one plane with the first channel and another plane/block of 2x2 sub-sampled pixels containing the second and third channels.<br>
1578  * The layout of the source image of e.g., an Y_UV12 image looks like this:
1579  * <pre>
1580  * source0: source1:
1581  * --------- ---------
1582  * | Y Y Y Y | | U V U V |
1583  * | Y Y Y Y | | U V U V |
1584  * | Y Y Y Y | ---------
1585  * | Y Y Y Y |
1586  * ---------
1587  * </pre>
1588  *
1589  * The layout of the target image of e.g., a RGB24 image looks like this:
1590  * <pre>
1591  * target:
1592  * ----------------------------
1593  * | R G B R G B R G B R G B |
1594  * | R G B R G B R G B R G B |
1595  * | R G B R G B R G B R G B |
1596  * | R G B R G B R G B R G B |
1597  * ----------------------------
1598  * </pre>
1599  *
1600  * The layout of the options parameters is as follows:
1601  * <pre>
1602  * options[ 0] uint32_t: sourcePlane0PaddingElements
1603  * options[ 1] uint32_t: sourcePlane1PaddingElements
1604  * options[ 2] uint32_t: targetPlanePaddingElements
1605  *
1606  * options[ 3] int32_t: f00
1607  * options[ 4] int32_t: f10
1608  * options[ 5] int32_t: f20
1609  * options[ 6] int32_t: f01
1610  * options[ ] ...
1611  * options[11] int32_t: f22
1612  *
1613  * options[12] int32_t: b0
1614  * options[13] int32_t: b1
1615  * options[14] int32_t: b2
1616  *
1617  * with transformation:
1618  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
1619  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
1620  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
1621  * </pre>
1622  * @param sources The pointer to the first and second memory block of the source image, must be valid
1623  * @param targets The one pointer to the target image, must be valid
1624  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
1625  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1626  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1627  * @param conversionFlag The conversion to be applied
1628  * @param options The 15 options parameters: 3 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1629  */
1630  static void convertTwoRows_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1631 
1632  /**
1633  * Converts two rows of an image with e.g., a RGB pixel format to two rows of an image with e.g., an Y_UV12 pixel format with 7 bit precision.
1634  * This function needs a source image with one plane and a target image with two planes.
1635  * The layout of the source image of e.g., a RGB24 image looks like this:
1636  * <pre>
1637  * source:
1638  * ----------------------------
1639  * | R G B R G B R G B R G B |
1640  * | R G B R G B R G B R G B |
1641  * | R G B R G B R G B R G B |
1642  * | R G B R G B R G B R G B |
1643  * ----------------------------
1644  * </pre>
1645  *
1646  * The layout of the target image of e.g., an Y_UV12 image looks like this:
1647  * <pre>
1648  * target0: target1:
1649  * --------- ---------
1650  * | Y Y Y Y | | U V U V |
1651  * | Y Y Y Y | | U V U V |
1652  * | Y Y Y Y | ---------
1653  * | Y Y Y Y |
1654  * ---------
1655  * </pre>
1656  *
1657  * The layout of the options parameters is as follows:
1658  * <pre>
1659  * options[ 0] uint32_t: sourcePlanePaddingElements
1660  * options[ 1] uint32_t: targetPlane0PaddingElements
1661  * options[ 2] uint32_t: targetPlane1PaddingElements
1662  *
1663  * options[ 3] int32_t: f00
1664  * options[ 4] int32_t: f10
1665  * options[ 5] int32_t: f20
1666  * options[ 6] int32_t: f01
1667  * options[ ] ...
1668  * options[11] int32_t: f22
1669  *
1670  * options[12] int32_t: b0
1671  * options[13] int32_t: b1
1672  * options[14] int32_t: b2
1673  *
1674  * with transformation:
1675  * t0 = clamp(0, f00 * s0 + f01 * s1 + f02 * s2 + b0, 255)
1676  * t1 = clamp(0, f10 * s0 + f11 * s1 + f12 * s2 + b1, 255)
1677  * t2 = clamp(0, f20 * s0 + f21 * s1 + f22 * s2 + b2, 255)
1678  * </pre>
1679  * @param sources The pointer to the source plane, must be valid
1680  * @param targets The pointers to the first and second target plane, must be valid
1681  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
1682  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1683  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1684  * @param conversionFlag The conversion to be applied
1685  * @param options The 15 options parameters: 3 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1686  */
1687  static void convertTwoRows_1Plane3Channels_To_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_8BitPerChannel_Precision7Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1688 
1689  /**
1690  * Converts two rows of an image with e.g., a RGB pixel format to two rows of an image with e.g., an Y_U_V12 pixel format with 7 bit precision.
1691  * This function needs a source image with one plane and a target image with three planes.
1692  * The layout of the source image of e.g., a RGB24 image looks like this:
1693  * <pre>
1694  * source:
1695  * ----------------------------
1696  * | R G B R G B R G B R G B |
1697  * | R G B R G B R G B R G B |
1698  * | R G B R G B R G B R G B |
1699  * | R G B R G B R G B R G B |
1700  * ----------------------------
1701  * </pre>
1702  *
1703  * The layout of the target image of e.g., an Y_U_V12 image looks like this:
1704  * <pre>
1705  * target0: target1: target2:
1706  * --------- ----- -----
1707  * | Y Y Y Y | | U U | | V V |
1708  * | Y Y Y Y | | U U | | V V |
1709  * | Y Y Y Y | ----- -----
1710  * | Y Y Y Y |
1711  * ---------
1712  * </pre>
1713  *
1714  * The layout of the options parameters is as follows:
1715  * <pre>
1716  * options[ 0] uint32_t: sourcePlanePaddingElements
1717  * options[ 1] uint32_t: targetPlane0PaddingElements
1718  * options[ 2] uint32_t: targetPlane1PaddingElements
1719  * options[ 3] uint32_t: targetPlane2PaddingElements
1720  *
1721  * options[ 4] int32_t: f00
1722  * options[ 5] int32_t: f10
1723  * options[ 6] int32_t: f20
1724  * options[ 7] int32_t: f01
1725  * options[ ] ...
1726  * options[12] int32_t: f22
1727  *
1728  * options[13] int32_t: b0
1729  * options[14] int32_t: b1
1730  * options[15] int32_t: b2
1731  *
1732  * with transformation:
1733  * t0 = clamp(0, f00 * s0 + f01 * s1 + f02 * s2 + b0, 255)
1734  * t1 = clamp(0, f10 * s0 + f11 * s1 + f12 * s2 + b1, 255)
1735  * t2 = clamp(0, f20 * s0 + f21 * s1 + f22 * s2 + b2, 255)
1736  * </pre>
1737  * @param sources The pointer to the source plane, must be valid
1738  * @param targets The pointers to the first, second, and third target planes, must be valid
1739  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
1740  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1741  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1742  * @param conversionFlag The conversion to be applied
1743  * @param options The 16 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1744  */
1745  static void convertTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelsDownsampled2x2_8BitPerChannel_Precision7Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1746 
1747  /**
1748  * Converts (maps) one row of an image with e.g., a Y_U_V24 pixel format to one row of an image with e.g., an YUV24 or YVU24 pixel format.
1749  * This function needs three source planes each holding one channel.<br>
1750  * The layout of the source image of e.g., an Y_U_V24 image looks like this:
1751  * <pre>
1752  * source0: source1: source2:
1753  * --------- --------- ---------
1754  * | Y Y Y Y | | U U U U | | V V V V |
1755  * | Y Y Y Y | | U U U U | | V V V V |
1756  * | Y Y Y Y | | U U U U | | V V V V |
1757  * | Y Y Y Y | | U U U U | | V V V V |
1758  * --------- --------- ---------
1759  * </pre>
1760  *
1761  * The layout of the target image of e.g., an YUV24 image looks like this:
1762  * <pre>
1763  * target:
1764  * ----------------------------
1765  * | Y U V Y U V Y U V Y U V |
1766  * | Y U V Y U V Y U V Y U V |
1767  * | Y U V Y U V Y U V Y U V |
1768  * | Y U V Y U V Y U V Y U V |
1769  * ----------------------------
1770  * </pre>
1771  *
1772  * The layout of the options parameters is as follows:
1773  * <pre>
1774  * options[0] uint32_t: sourcePlane0PaddingElements
1775  * options[1] uint32_t: sourcePlane1PaddingElements
1776  * options[2] uint32_t: sourcePlane2PaddingElements
1777  * options[2] uint32_t: targetPlanePaddingElements
1778  *
1779  * with transformation:
1780  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
1781  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
1782  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
1783  * </pre>
1784  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
1785  * @param targets The one pointer to the target image, must be valid
1786  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
1787  * @param width The width of the frame in pixel, with range [1, infinity)
1788  * @param height The height of the frame in pixel, with range [1, infinity)
1789  * @param conversionFlag The conversion to be applied
1790  * @param options The 4 options parameters: 4 padding parameters, with ranges [0, infinity), must be valid
1791  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, 2]
1792  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, 2]
1793  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, 2]
1794  */
1795  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
1796  static void mapOneRow_3Plane1Channel_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1797 
1798  /**
1799  * Converts (matches) one row of an image with e.g., a Y_UV12 pixel format to one row of an image with e.g., an YUV24 or YVU24 pixel format.
1800  * This function needs one plane with the first channel and another plane/block of 2x2 sub-sampled pixels containing the second and third channels.<br>
1801  * The layout of the source image of e.g., an Y_UV12 image looks like this:
1802  * <pre>
1803  * source0: source1:
1804  * --------- ---------
1805  * | Y Y Y Y | | U V U V |
1806  * | Y Y Y Y | | U V U V |
1807  * | Y Y Y Y | ---------
1808  * | Y Y Y Y |
1809  * ---------
1810  * </pre>
1811  *
1812  * The layout of the target image of e.g., an YUV24 image looks like this:
1813  * <pre>
1814  * target:
1815  * ----------------------------
1816  * | Y U V Y U V Y U V Y U V |
1817  * | Y U V Y U V Y U V Y U V |
1818  * | Y U V Y U V Y U V Y U V |
1819  * | Y U V Y U V Y U V Y U V |
1820  * ----------------------------
1821  * </pre>
1822  *
1823  * The layout of the options parameters is as follows:
1824  * <pre>
1825  * options[0] uint32_t: sourcePlane0PaddingElements
1826  * options[1] uint32_t: sourcePlane1PaddingElements
1827  * options[2] uint32_t: targetPlanePaddingElements
1828  *
1829  * with transformation:
1830  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
1831  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
1832  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
1833  * </pre>
1834  * @param sources The pointer to the first and second memory block of the source image, must be valid
1835  * @param targets The one pointer to the target image, must be valid
1836  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
1837  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1838  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1839  * @param conversionFlag The conversion to be applied
1840  * @param options The 3 options parameters: 3 padding parameters, with ranges [0, infinity), must be valid
1841  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, 2]
1842  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, 2]
1843  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, 2]
1844  */
1845  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
1846  static void mapOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1847 
1848  /**
1849  * Converts (matches) two rows of an image with e.g., a Y_UV12 pixel format to two rows of an image with e.g., an YUV24 or YVU24 pixel format.
1850  * This function needs one plane with the first channel and another plane/block of 2x2 sub-sampled pixels containing the second and third channels.<br>
1851  * The layout of the source image of e.g., an Y_UV12 image looks like this:
1852  * <pre>
1853  * source0: source1:
1854  * --------- ---------
1855  * | Y Y Y Y | | U V U V |
1856  * | Y Y Y Y | | U V U V |
1857  * | Y Y Y Y | ---------
1858  * | Y Y Y Y |
1859  * ---------
1860  * </pre>
1861  *
1862  * The layout of the options parameters is as follows:
1863  * <pre>
1864  * options[0] uint32_t: sourcePlanePaddingElements
1865  * options[1] uint32_t: sourceZippedPaddingElements
1866  * options[2] uint32_t: targetZippedPaddingElements
1867  *
1868  * with transformation:
1869  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
1870  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
1871  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
1872  * </pre>
1873  * @param sources The pointer to the first and second memory block of the source image, must be valid
1874  * @param targets The one pointer to the target image, must be valid
1875  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
1876  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1877  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1878  * @param conversionFlag The conversion to be applied
1879  * @param options The 3 options parameters: 3 padding parameters, with ranges [0, infinity), must be valid
1880  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, 2]
1881  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, 2]
1882  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, 2]
1883  */
1884  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
1885  static void mapTwoRows_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1886 
1887  /**
1888  * Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e.g., an RGB24 pixel format with 10 bit precision.
1889  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
1890  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
1891  * <pre>
1892  * source0: source1: source2:
1893  * --------- ----- -----
1894  * | Y Y Y Y | | U U | | V V |
1895  * | Y Y Y Y | | U U | | V V |
1896  * | Y Y Y Y | ----- -----
1897  * | Y Y Y Y |
1898  * ---------
1899  * </pre>
1900  *
1901  * The layout of the options parameters is as follows:
1902  * <pre>
1903  * options[ 0] uint32_t: sourcePlane0PaddingElements
1904  * options[ 1] uint32_t: sourcePlane1PaddingElements
1905  * options[ 2] uint32_t: sourcePlane2PaddingElements
1906  * options[ 3] uint32_t: targetZippedPaddingElements
1907  *
1908  * options[ 4] int32_t: f00
1909  * options[ 5] int32_t: f10
1910  * options[ 6] int32_t: f20
1911  * options[ 7] int32_t: f01
1912  * options[ ] ...
1913  * options[12] int32_t: f22
1914  *
1915  * options[13] int32_t: b0
1916  * options[14] int32_t: b1
1917  * options[15] int32_t: b2
1918  *
1919  * with transformation:
1920  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
1921  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
1922  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
1923  * </pre>
1924  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
1925  * @param targets The one pointer to the target image, must be valid
1926  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
1927  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1928  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1929  * @param conversionFlag The conversion to be applied
1930  * @param options The 16 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1931  */
1932  static void convertOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1933 
1934  /**
1935  * Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e.g., an RGB24 pixel format with 10 bit precision.
1936  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
1937  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
1938  * <pre>
1939  * source0: source1: source2:
1940  * --------- ----- -----
1941  * | Y Y Y Y | | U U | | V V |
1942  * | Y Y Y Y | | U U | | V V |
1943  * | Y Y Y Y | ----- -----
1944  * | Y Y Y Y |
1945  * ---------
1946  * </pre>
1947  *
1948  * The layout of the options parameters is as follows:
1949  * <pre>
1950  * options[ 0] uint32_t: sourcePlane0PaddingElements
1951  * options[ 1] uint32_t: sourcePlane1PaddingElements
1952  * options[ 2] uint32_t: sourcePlane2PaddingElements
1953  * options[ 3] uint32_t: targetZippedPaddingElements
1954  *
1955  * options[ 4] int32_t: f00
1956  * options[ 5] int32_t: f10
1957  * options[ 6] int32_t: f20
1958  * options[ 7] int32_t: f01
1959  * options[ ] ...
1960  * options[12] int32_t: f22
1961  *
1962  * options[13] int32_t: b0
1963  * options[14] int32_t: b1
1964  * options[15] int32_t: b2
1965  *
1966  * with transformation:
1967  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
1968  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
1969  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
1970  * </pre>
1971  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
1972  * @param targets The one pointer to the target image, must be valid
1973  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
1974  * @param width The width of the frame in pixel, with range [2, infinity), must be even
1975  * @param height The height of the frame in pixel, with range [2, infinity), must be even
1976  * @param conversionFlag The conversion to be applied
1977  * @param options The 16 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
1978  */
1979  static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
1980 
1981  /**
1982  * Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e.g., an YUV24 or YVU24 pixel format.
1983  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
1984  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
1985  * <pre>
1986  * source0: source1: source2:
1987  * --------- ----- -----
1988  * | Y Y Y Y | | U U | | V V |
1989  * | Y Y Y Y | | U U | | V V |
1990  * | Y Y Y Y | ----- -----
1991  * | Y Y Y Y |
1992  * ---------
1993  * </pre>
1994  *
1995  * The layout of the options parameters is as follows:
1996  * <pre>
1997  * options[0] uint32_t: sourcePlane0PaddingElements
1998  * options[1] uint32_t: sourcePlane1PaddingElements
1999  * options[2] uint32_t: sourcePlane2PaddingElements
2000  * options[3] uint32_t: targetZippedPaddingElements
2001  *
2002  * with transformation:
2003  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
2004  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
2005  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
2006  * </pre>
2007  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2008  * @param targets The one pointer to the target image, must be valid
2009  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2010  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2011  * @param height The height of the frame in pixel, with range [2, infinity), must be even
2012  * @param conversionFlag The conversion to be applied
2013  * @param options The 4 options parameters: 4 padding parameters, must be valid
2014  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, infinity)
2015  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, infinity)
2016  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, infinity)
2017  * @see mapTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_8BitPerChannel().
2018  */
2019  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
2020  static void mapOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2021 
2022  /**
2023  * Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e.g., an YUV24 or YVU24 pixel format.
2024  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
2025  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
2026  * <pre>
2027  * source0: source1: source2:
2028  * --------- ----- -----
2029  * | Y Y Y Y | | U U | | V V |
2030  * | Y Y Y Y | | U U | | V V |
2031  * | Y Y Y Y | ----- -----
2032  * | Y Y Y Y |
2033  * ---------
2034  * </pre>
2035  *
2036  * The layout of the options parameters is as follows:
2037  * <pre>
2038  * options[0] uint32_t: sourcePlane0PaddingElements
2039  * options[1] uint32_t: sourcePlane1PaddingElements
2040  * options[2] uint32_t: sourcePlane2PaddingElements
2041  * options[3] uint32_t: targetZippedPaddingElements
2042  *
2043  * with transformation:
2044  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
2045  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
2046  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
2047  * </pre>
2048  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2049  * @param targets The one pointer to the target image, must be valid
2050  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
2051  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2052  * @param height The height of the frame in pixel, with range [2, infinity), must be even
2053  * @param conversionFlag The conversion to be applied
2054  * @param options The 4 options parameters: 4 padding parameters, must be valid
2055  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, infinity)
2056  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, infinity)
2057  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, infinity)
2058  * @see mapTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_8BitPerChannel().
2059  */
2060  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
2061  static void mapTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2062 
2063  /**
2064  * Converts two rows of an image with e.g., a YUV24 pixel format to two rows of an image with e.g., an Y_U_V12 or Y_V_U12 pixel format.
2065  * This function is mainly the reverse conversion function of mapTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel().<br>
2066  * The layout of the options parameters is as follows:
2067  * <pre>
2068  * options[0] uint32_t: sourceZippedPaddingElements
2069  * options[1] uint32_t: targetPlane0PaddingElements
2070  * options[2] uint32_t: targetPlane1PaddingElements
2071  * options[3] uint32_t: targetPlane2PaddingElements
2072  *
2073  * with transformation:
2074  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
2075  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
2076  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
2077  * </pre>
2078  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2079  * @param targets The one pointer to the target image, must be valid
2080  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height / 2 - 1]
2081  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2082  * @param height The height of the frame in pixel, with range [2, infinity), must be even
2083  * @param conversionFlag The conversion to be applied
2084  * @param options The 4 options parameters: 4 padding parameters, must be valid
2085  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, infinity)
2086  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, infinity)
2087  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, infinity)
2088  * @see mapTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel().
2089  */
2090  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
2091  static void mapTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2092 
2093  /**
2094  * Converts one row of an image with e.g., a Y_U_V24 pixel format to one rows of an image with e.g., an RGB24 pixel format.
2095  * This function needs three source planes/blocks with three individual channels.
2096  * The layout of the options parameters is as follows:
2097  * <pre>
2098  * options[ 0] uint32_t: sourcePlane0PaddingElements
2099  * options[ 1] uint32_t: sourcePlane1PaddingElements
2100  * options[ 2] uint32_t: sourcePlane2PaddingElements
2101  * options[ 3] uint32_t: targetZippedPaddingElements
2102  *
2103  * options[ 4] int32_t: f00
2104  * options[ 5] int32_t: f10
2105  * options[ 6] int32_t: f20
2106  * options[ 7] int32_t: f01
2107  * options[ ] ...
2108  * options[12] int32_t: f22
2109  *
2110  * options[13] int32_t: b0
2111  * options[14] int32_t: b1
2112  * options[15] int32_t: b2
2113  *
2114  * with transformation:
2115  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2116  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2117  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2118  * </pre>
2119  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2120  * @param targets The one pointer to the target image, must be valid
2121  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2122  * @param width The width of the frame in pixel, with range [1, infinity)
2123  * @param height The height of the frame in pixel, with range [1, infinity)
2124  * @param conversionFlag The conversion to be applied
2125  * @param options The 16 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
2126  */
2127  static void convertOneRow_3Planes1Channel_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2128 
2129  /**
2130  * Converts one row of an image with e.g., a Y_U_V24 pixel format to one rows of an image with e.g., an RGBA32 pixel format.
2131  * This function needs three source planes/blocks with three individual channels.
2132  * The layout of the options parameters is as follows:
2133  * <pre>
2134  * options[ 0] uint32_t: sourcePlane0PaddingElements
2135  * options[ 1] uint32_t: sourcePlane1PaddingElements
2136  * options[ 2] uint32_t: sourcePlane2PaddingElements
2137  * options[ 3] uint32_t: targetZippedPaddingElements
2138  *
2139  * options[ 4] int32_t: f00
2140  * options[ 5] int32_t: f10
2141  * options[ 6] int32_t: f20
2142  * options[ 7] int32_t: f01
2143  * options[ ] ...
2144  * options[12] int32_t: f22
2145  *
2146  * options[13] int32_t: b0
2147  * options[14] int32_t: b1
2148  * options[15] int32_t: b2
2149  *
2150  * options[16] uint32_t: channelValue3
2151  *
2152  * with transformation:
2153  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2154  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2155  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2156  * t3 = channelValue3
2157  * </pre>
2158  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2159  * @param targets The one pointer to the target image, must be valid
2160  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2161  * @param width The width of the frame in pixel, with range [1, infinity)
2162  * @param height The height of the frame in pixel, with range [1, infinity)
2163  * @param conversionFlag The conversion to be applied
2164  * @param options The 17 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, one constant channel value, must be valid
2165  */
2166  static void convertOneRow_3Planes1Channel_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2167 
2168  /**
2169  * Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e.g., an RGBA32 pixel format.
2170  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
2171  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
2172  * <pre>
2173  * source0: source1: source2:
2174  * --------- ----- -----
2175  * | Y Y Y Y | | U U | | V V |
2176  * | Y Y Y Y | | U U | | V V |
2177  * | Y Y Y Y | ----- -----
2178  * | Y Y Y Y |
2179  * ---------
2180  * </pre>
2181  * The layout of the options parameters is as follows:
2182  * <pre>
2183  * options[ 0] uint32_t: sourcePlane0PaddingElements
2184  * options[ 1] uint32_t: sourcePlane1PaddingElements
2185  * options[ 2] uint32_t: sourcePlane2PaddingElements
2186  * options[ 3] uint32_t: targetZippedPaddingElements
2187  *
2188  * options[ 4] int32_t: f00
2189  * options[ 5] int32_t: f10
2190  * options[ 6] int32_t: f20
2191  * options[ 7] int32_t: f01
2192  * options[ ] ...
2193  * options[12] int32_t: f22
2194  *
2195  * options[13] int32_t: b0
2196  * options[14] int32_t: b1
2197  * options[15] int32_t: b2
2198  *
2199  * options[16] int32_t: channelValue3
2200  *
2201  * with transformation:
2202  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2203  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2204  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2205  * t3 = channelValue3
2206  * </pre>
2207  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2208  * @param targets The one pointer to the target image, must be valid
2209  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2210  * @param width The width of the frame in pixel, with range [1, infinity)
2211  * @param height The height of the frame in pixel, with range [1, infinity)
2212  * @param conversionFlag The conversion to be applied
2213  * @param options The 17 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, one constant channel value, must be valid
2214  */
2215  static void convertOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2216 
2217  /**
2218  * Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e.g., an RGB24 pixel format.
2219  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
2220  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
2221  * <pre>
2222  * source0: source1: source2:
2223  * --------- ----- -----
2224  * | Y Y Y Y | | U U | | V V |
2225  * | Y Y Y Y | | U U | | V V |
2226  * | Y Y Y Y | ----- -----
2227  * | Y Y Y Y |
2228  * ---------
2229  *
2230  * The layout of the target image of e.g., a RGB24 image looks like this:
2231  * <pre>
2232  * target:
2233  * ----------------------------
2234  * | R G B R G B R G B R G B |
2235  * | R G B R G B R G B R G B |
2236  * | R G B R G B R G B R G B |
2237  * | R G B R G B R G B R G B |
2238  * ----------------------------
2239  * </pre>
2240  *
2241  * </pre>
2242  * The layout of the options parameters is as follows:
2243  * <pre>
2244  * options[ 0] uint32_t: sourcePlane0PaddingElements
2245  * options[ 1] uint32_t: sourcePlane1PaddingElements
2246  * options[ 2] uint32_t: sourcePlane2PaddingElements
2247  * options[ 3] uint32_t: targetPlanePaddingElements
2248  *
2249  * options[ 4] int32_t: f00
2250  * options[ 5] int32_t: f10
2251  * options[ 6] int32_t: f20
2252  * options[ 7] int32_t: f01
2253  * options[ ] ...
2254  * options[12] int32_t: f22
2255  *
2256  * options[13] int32_t: b0
2257  * options[14] int32_t: b1
2258  * options[15] int32_t: b2
2259  *
2260  * with transformation:
2261  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2262  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2263  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2264  * t3 = channelValue3
2265  * </pre>
2266  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2267  * @param targets The one pointer to the target image, must be valid
2268  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height/2 - 1]
2269  * @param width The width of the frame in pixel, with range [1, infinity)
2270  * @param height The height of the frame in pixel, with range [2, infinity)
2271  * @param conversionFlag The conversion to be applied
2272  * @param options The 16 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
2273  */
2274  static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2275 
2276  /**
2277  * Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e.g., an RGBA32 pixel format.
2278  * This function needs one plane with the first channel, and two additional planes with 2x2 sub-sampled pixels containing the second and third channels.<br>
2279  * The layout of the source image of e.g., an Y_U_V12 image looks like this:
2280  * <pre>
2281  * source0: source1: source2:
2282  * --------- ----- -----
2283  * | Y Y Y Y | | U U | | V V |
2284  * | Y Y Y Y | | U U | | V V |
2285  * | Y Y Y Y | ----- -----
2286  * | Y Y Y Y |
2287  * ---------
2288  *
2289  * The layout of the target image of e.g., a RGBA24 image looks like this:
2290  * <pre>
2291  * target:
2292  * ------------------------------------
2293  * | R G B A R G B A R G B A R G B A |
2294  * | R G B A R G B A R G B A R G B A |
2295  * | R G B A R G B A R G B A R G B A |
2296  * | R G B A R G B A R G B A R G B A |
2297  * ------------------------------------
2298  * </pre>
2299  *
2300  * </pre>
2301  * The layout of the options parameters is as follows:
2302  * <pre>
2303  * options[ 0] uint32_t: sourcePlane0PaddingElements
2304  * options[ 1] uint32_t: sourcePlane1PaddingElements
2305  * options[ 2] uint32_t: sourcePlane2PaddingElements
2306  * options[ 3] uint32_t: targetPlanePaddingElements
2307  *
2308  * options[ 4] int32_t: f00
2309  * options[ 5] int32_t: f10
2310  * options[ 6] int32_t: f20
2311  * options[ 7] int32_t: f01
2312  * options[ ] ...
2313  * options[12] int32_t: f22
2314  *
2315  * options[13] int32_t: b0
2316  * options[14] int32_t: b1
2317  * options[15] int32_t: b2
2318  *
2319  * options[16] uint32_t: channelValue3
2320  *
2321  * with transformation:
2322  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2323  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2324  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2325  * t3 = channelValue3
2326  * </pre>
2327  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2328  * @param targets The one pointer to the target image, must be valid
2329  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height/2 - 1]
2330  * @param width The width of the frame in pixel, with range [1, infinity)
2331  * @param height The height of the frame in pixel, with range [2, infinity)
2332  * @param conversionFlag The conversion to be applied
2333  * @param options The 17 options parameters: 4 padding parameters, 9 multiplication parameters, and 3 bias parameters, one constant channel value, must be valid
2334  */
2335  static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2336 
2337  /**
2338  * Converts one row of an image with e.g., a YUYV16 pixel format to one row of an image with e.g., an RGB24 or BGR2424 pixel format.
2339  * The layout of the options parameters is as follows:
2340  * <pre>
2341  * options[ 0] uint32_t: sourcePaddingElements
2342  * options[ 1] uint32_t: targetPaddingElements
2343  *
2344  * options[ 2] int32_t: f00
2345  * options[ 3] int32_t: f10
2346  * options[ 4] int32_t: f20
2347  * options[ 5] int32_t: f01
2348  * options[ ] ...
2349  * options[10] int32_t: f22
2350  *
2351  * options[11] int32_t: b0
2352  * options[12] int32_t: b1
2353  * options[13] int32_t: b2
2354  *
2355  * with transformation:
2356  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2357  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2358  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2359  * </pre>
2360  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2361  * @param targets The one pointer to the target image, must be valid
2362  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2363  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2364  * @param height The height of the frame in pixel, with range [1, infinity), must be even
2365  * @param conversionFlag The conversion to be applied
2366  * @param options The 14 options parameters: 2 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
2367  */
2368  static void convertOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1BackIsDownsampled_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2369 
2370  /**
2371  * Converts one row of an image with e.g., a UYVY16 pixel format to one row of an image with e.g., an RGB24 or BGR2424 pixel format.
2372  * The layout of the options parameters is as follows:
2373  * <pre>
2374  * options[ 0] uint32_t: sourcePaddingElements
2375  * options[ 1] uint32_t: targetPaddingElements
2376  *
2377  * options[ 2] int32_t: f00
2378  * options[ 3] int32_t: f10
2379  * options[ 4] int32_t: f20
2380  * options[ 5] int32_t: f01
2381  * options[ ] ...
2382  * options[10] int32_t: f22
2383  *
2384  * options[11] int32_t: b0
2385  * options[12] int32_t: b1
2386  * options[13] int32_t: b2
2387  *
2388  * with transformation:
2389  * t0 = f00 * s0 + f01 * s1 + f02 * s2 + b0
2390  * t1 = f10 * s0 + f11 * s1 + f12 * s2 + b1
2391  * t2 = f20 * s0 + f21 * s1 + f22 * s2 + b2
2392  * </pre>
2393  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2394  * @param targets The one pointer to the target image, must be valid
2395  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2396  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2397  * @param height The height of the frame in pixel, with range [1, infinity), must be even
2398  * @param conversionFlag The conversion to be applied
2399  * @param options The 14 options parameters: 2 padding parameters, 9 multiplication parameters, and 3 bias parameters, must be valid
2400  */
2401  static void convertOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1FrontIsDownsampled_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2402 
2403  /**
2404  * Converts one row of an image with e.g., a YUYV16 pixel format to one row of an image with e.g., an YUV24 or YVU24 pixel format.
2405  * The layout of the options parameters is as follows:
2406  * <pre>
2407  * options[0] uint32_t: sourcePaddingElements
2408  * options[1] uint32_t: targetPaddingElements
2409  *
2410  * with transformation:
2411  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
2412  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
2413  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
2414  * </pre>
2415  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2416  * @param targets The one pointer to the target image, must be valid
2417  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2418  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2419  * @param height The height of the frame in pixel, with range [1, infinity)
2420  * @param conversionFlag The conversion to be applied
2421  * @param options The 2 options parameters: 2 padding parameters, must be valid
2422  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, infinity)
2423  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, infinity)
2424  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, infinity)
2425  * @see mapTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_8BitPerChannel().
2426  */
2427  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
2428  static void mapOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1BackIsDownsampled_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2429 
2430  /**
2431  * Converts one row of an image with e.g., a UYVY16 pixel format to one row of an image with e.g., an YUV24 or YVU24 pixel format.
2432  * The layout of the options parameters is as follows:
2433  * <pre>
2434  * options[0] uint32_t: sourcePaddingElements
2435  * options[1] uint32_t: targetPaddingElements
2436  *
2437  * with transformation:
2438  * t0 = tSourceChannelIndex0 == 0 ? s0, or tSourceChannelIndex0 == 1 ? s1, or tSourceChannelIndex0 == 2 ? s2
2439  * t1 = tSourceChannelIndex1 == 0 ? s0, or tSourceChannelIndex1 == 1 ? s1, or tSourceChannelIndex1 == 2 ? s2
2440  * t2 = tSourceChannelIndex2 == 0 ? s0, or tSourceChannelIndex2 == 1 ? s1, or tSourceChannelIndex2 == 2 ? s2
2441  * </pre>
2442  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2443  * @param targets The one pointer to the target image, must be valid
2444  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2445  * @param width The width of the frame in pixel, with range [2, infinity), must be even
2446  * @param height The height of the frame in pixel, with range [1, infinity)
2447  * @param conversionFlag The conversion to be applied
2448  * @param options The 2 options parameters: 2 padding parameters, must be valid
2449  * @tparam tSourceChannelIndex0 The index of the source channels which will be mapped to the first target channel, with range [0, infinity)
2450  * @tparam tSourceChannelIndex1 The index of the source channels which will be mapped to the second target channel, with range [0, infinity)
2451  * @tparam tSourceChannelIndex2 The index of the source channels which will be mapped to the third target channel, with range [0, infinity)
2452  */
2453  template <unsigned int tSourceChannelIndex0, unsigned int tSourceChannelIndex1, unsigned int tSourceChannelIndex2>
2454  static void mapOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1FrontIsDownsampled_To_1Plane3Channels_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2455 
2456  /**
2457  * Converts two rows of an image with 3-channel Bayer mosaic pixel format with packed 10-bit pixel values to an image with 3-channel un-packed 8-bit pixel format.
2458  * The layout of the options parameters is as follows:
2459  * <pre>
2460  * options[0] uint32_t: sourcePaddingElements
2461  * options[1] uint32_t: targetPaddingElements
2462  * </pre>
2463  * @param sources The one pointer to the source image with Bayer mosaic, must be valid
2464  * @param targets The one pointer to the target image, must be valid
2465  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height/2 - 1]
2466  * @param width The width of the frame in pixel, with range [4, infinity), must be a multiple of 4
2467  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
2468  * @param conversionFlag The conversion to be applied
2469  * @param options The 2 options parameters: 2 padding parameters
2470  * @tparam tIndexRed The index of red channel in the target image, with range [0, 2]
2471  * @tparam tIndexGreen The index of green channel in the target image, with range [0, 2]
2472  * @tparam tIndexBlue The index of blue channel in the target image, with range [0, 2]
2473  */
2474  template <unsigned int tIndexRed, unsigned int tIndexGreen, unsigned int tIndexBlue>
2475  static void convertTwoRows_1PlaneMosaicPacked10Bit_To_1PlaneUnpacked3Channels8Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2476 
2477  /**
2478  * Converts two rows of an image with 3-channel Bayer mosaic pixel format with packed 10-bit pixel values to an image with 3-channel un-packed 16-bit pixel format.
2479  * The layout of the options parameters is as follows:
2480  * <pre>
2481  * options[0] uint32_t: sourcePaddingElements
2482  * options[1] uint32_t: targetPaddingElements
2483  * </pre>
2484  * @param sources The one pointer to the source image with Bayer mosaic, must be valid
2485  * @param targets The one pointer to the target image, must be valid
2486  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height/2 - 1]
2487  * @param width The width of the frame in pixel, with range [4, infinity), must be a multiple of 4
2488  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
2489  * @param conversionFlag The conversion to be applied
2490  * @param options The 2 options parameters: 2 padding parameters
2491  * @tparam tIndexRed The index of red channel in the target image, with range [0, 2]
2492  * @tparam tIndexGreen The index of green channel in the target image, with range [0, 2]
2493  * @tparam tIndexBlue The index of blue channel in the target image, with range [0, 2]
2494  */
2495  template <unsigned int tIndexRed, unsigned int tIndexGreen, unsigned int tIndexBlue>
2496  static void convertTwoRows_1PlaneMosaicPacked10Bit_To_1PlaneUnpacked3Channels16Bit(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2497 
2498  /**
2499  * Converts two rows of an image with 3-channel Bayer mosaic pixel format with packed 10-bit pixel values to an image with 3-channel un-packed 8-bit pixel format and applies black level subtraction, white balance, and gamma encoding
2500  * The layout of the parameters, `options`, is defined in the struct `RGGB10ToRGB24AdvancedOptions`.
2501  * @param sources The pointer to the first, second, and third memory block of the source image, must be valid
2502  * @param targets The one pointer to the target image, must be valid
2503  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height/2 - 1]
2504  * @param width The width of the frame in pixel, with range [4, infinity), must be a multiple of 4
2505  * @param height The height of the frame in pixel, with range [2, infinity), must be a multiple of 2
2506  * @param conversionFlag The conversion to be applied
2507  * @param options The 2 options parameters: 2 padding parameters
2508  * @tparam tIndexRed The index of red channel in the target image, with range [0, 2]
2509  * @tparam tIndexGreen The index of green channel in the target image, with range [0, 2]
2510  * @tparam tIndexBlue The index of blue channel in the target image, with range [0, 2]
2511  */
2512  template <unsigned int tIndexRed, unsigned int tIndexGreen, unsigned int tIndexBlue>
2513  static void convertTwoRows_1PlaneMosaicPacked10Bit_To_1PlaneUnpacked3Channels8BitAdvanced(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2514 
2515  /**
2516  * Maps one row of a 1-plane, 2-channel image to two planes with 1 channels.
2517  * @param sources The pointer to the plane of the source image, must be valid
2518  * @param targets The pointer to the first and second plane of the target image, must be valid
2519  * @param multipleRowIndex The index of the multiple-row to be handled, with range [0, height - 1]
2520  * @param width The width of the frame in pixel, with range [1, infinity)
2521  * @param height The height of the frame in pixel, with range [1, infinity)
2522  * @param conversionFlag The conversion to be applied
2523  * @param options The 3 options parameters: 3 padding parameters
2524  */
2525  static void mapOneRow_1Plane2Channels_To_2Planes1Channel_8BitPerChannel(const void** sources, void** targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void* options);
2526 
2527  /**
2528  * Unpacks 5 elements from a row in a packed Bayer mosaic to 4 pixels values
2529  * The required memory layout of the input: `A B C D X ...`
2530  * Bytes marked as `X` store two bits for each of the previous four elements: `X = AABB CCDD`.
2531  * The memory layout of the output will be: `A B C D` (16 bits per element but only the lowest 10 bits are used)
2532  * This function is compatible with pixel formats like `FrameType::FORMAT_RGGB10_PACKED` or `FrameType::FORMAT_Y10_PACKED`.
2533  * @param packed The packed 5 elements, must be valid
2534  * @param unpacked The resulting 4 unpacked elements, must be valid
2535  */
2536  static OCEAN_FORCE_INLINE void unpack5ElementsBayerMosaicPacked10Bit(const uint8_t* const packed, uint16_t* unpacked);
2537 
2538 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
2539 
2540  /**
2541  * Unpacks 15 elements from a row in a packed Bayer mosaic to 12 pixels values
2542  * The required memory layout of the input: `A B C D X A B C D X A B C D X A ...`
2543  * Bytes marked as `X` store two bits for each of the previous four elements: `X = AABB CCDD`.
2544  * The memory layout of the output will be: `A B C D A B C D A B C D` (16 bits per element but only the lowest 10 bits are used)
2545  * This function is compatible with pixel formats like `FrameType::FORMAT_RGGB10_PACKED` or `FrameType::FORMAT_Y10_PACKED`.
2546  * @param packed The packed 15 elements, must be valid
2547  * @param unpackedAB_u_16x8 The resulting first 8 uint16_t values
2548  * @param unpackedC_u_16x4 The resulting last 4 uint16_t values
2549  * @tparam tAllowLastOverlappingElement True, to allow reading 16 elements from `packed` (if the memory is large enough); False, to force reading only 15 elements
2550  */
2551  template <bool tAllowLastOverlappingElement>
2552  static OCEAN_FORCE_INLINE void unpack15ElementsBayerMosaicPacked10BitNEON(const uint8_t* const packed, uint16x8_t& unpackedAB_u_16x8, uint16x4_t& unpackedC_u_16x4);
2553 
2554 #endif // OCEAN_HARDWARE_NEON_VERSION
2555 };
2556 
2557 inline FrameConverter::Options::Options(const bool allowApproximation)
2558 {
2559  if (allowApproximation)
2560  {
2562  }
2563 }
2564 
2565 inline FrameConverter::Options::Options(const uint8_t alphaChannelTargetValue, const bool allowApproximation) :
2566  optionsType_(OT_ALPHA_CHANNEL_TARGET_VALUE),
2567  alphaChannelTargetValue_(alphaChannelTargetValue)
2568 {
2569  if (allowApproximation)
2570  {
2572  }
2573 }
2574 
2575 inline FrameConverter::Options::Options(const float gamma, const bool allowApproximation) :
2576  optionsType_(OT_GAMMA_CORRECTION),
2577  gamma_(gamma)
2578 {
2579  ocean_assert(gamma_ >= 0.0f && gamma_ <= 2.0f);
2580 
2581  if (allowApproximation)
2582  {
2584  }
2585 }
2586 
2587 inline FrameConverter::Options::Options(const uint16_t blackLevel, const float whiteBalanceRed, const float whiteBalanceGreen, const float whiteBalanceBlue, const float gamma, const bool allowApproximation) :
2588  optionsType_(OT_BLACKLEVEL_WHITEBALANCE_GAMMA),
2589  gamma_(gamma),
2590  blackLevel_(blackLevel)
2591 {
2592  ocean_assert(blackLevel_ < 1024u);
2593  ocean_assert(whiteBalanceRed >= 0.0f && whiteBalanceGreen >= 0.0f && whiteBalanceBlue >= 0.0f);
2594  ocean_assert(gamma_ >= 0.0f);
2595 
2596  whiteBalance_[0] = whiteBalanceRed;
2597  whiteBalance_[1] = whiteBalanceGreen;
2598  whiteBalance_[2] = whiteBalanceBlue;
2599 
2600  if (allowApproximation)
2601  {
2603  }
2604 }
2605 
2607 {
2608  return optionsType_;
2609 }
2610 
2612 {
2613  ocean_assert(optionsType_ & OT_ALPHA_CHANNEL_TARGET_VALUE);
2614  return alphaChannelTargetValue_;
2615 }
2616 
2618 {
2619  ocean_assert((optionsType_ & OT_GAMMA_CORRECTION) || (optionsType_ & OT_BLACKLEVEL_WHITEBALANCE_GAMMA));
2620  return gamma_;
2621 }
2622 
2624 {
2625  ocean_assert(optionsType_ & OT_BLACKLEVEL_WHITEBALANCE_GAMMA);
2626  return blackLevel_;
2627 }
2628 
2629 inline const float* FrameConverter::Options::whiteBalance() const
2630 {
2631  ocean_assert(optionsType_ & OT_BLACKLEVEL_WHITEBALANCE_GAMMA);
2632  return whiteBalance_;
2633 }
2634 
2636 {
2637  return (optionsType_ & OT_APPROXIMATED) == OT_APPROXIMATED;
2638 }
2639 
2641 {
2642  return size_t(conversionTriple.sourcePixelFormat_ ^ (conversionTriple.targetPixelFormat_ << uint64_t(1u)) ^ (uint64_t(conversionTriple.optionsType_) << uint64_t(2u)));
2643 }
2644 
2646  sourcePixelFormat_(sourcePixelFormat),
2647  targetPixelFormat_(targetPixelFormat),
2648  optionsType_(optionsType)
2649 {
2650  // nothing to do here
2651 }
2652 
2654 {
2655  return sourcePixelFormat_ == conversionTriple.sourcePixelFormat_ && targetPixelFormat_ == conversionTriple.targetPixelFormat_ && optionsType_ == conversionTriple.optionsType_;
2656 }
2657 
2658 inline bool FrameConverter::Comfort::convert(const Frame& source, const FrameType::PixelFormat targetPixelFormat, Frame& target, const bool forceCopy, Worker* worker, const Options& options)
2659 {
2660  return convert(source, targetPixelFormat, source.pixelOrigin(), target, forceCopy, worker, options);
2661 }
2662 
2663 inline bool FrameConverter::Comfort::convert(const Frame& source, const FrameType::PixelOrigin targetPixelOrigin, Frame& target, const bool forceCopy, Worker* worker, const Options& options)
2664 {
2665  return convert(source, source.pixelFormat(), targetPixelOrigin, target, forceCopy, worker, options);
2666 }
2667 
2668 inline bool FrameConverter::Comfort::change(Frame& frame, const FrameType::PixelFormat targetPixelFormat, const FrameType::PixelOrigin targetPixelOrigin, const bool forceCopy, Worker* worker, const Options& options)
2669 {
2670  ocean_assert(frame.isValid());
2671  ocean_assert(targetPixelFormat != FrameType::FORMAT_UNDEFINED && targetPixelOrigin != FrameType::ORIGIN_INVALID);
2672 
2673  if (!frame.isValid())
2674  {
2675  return false;
2676  }
2677 
2678  if (frame.pixelFormat() == targetPixelFormat && frame.pixelOrigin() == targetPixelOrigin)
2679  {
2680  return true;
2681  }
2682 
2683  Frame tmpFrame;
2684  if (!convert(frame, targetPixelFormat, targetPixelOrigin, tmpFrame, forceCopy, worker, options))
2685  {
2686  return false;
2687  }
2688 
2689  // if the intermediate frame could be created without copying the frame data we have to copy the frame data instead
2690  if (frame.isOwner() && !tmpFrame.isOwner())
2691  {
2692  frame.copy(tmpFrame);
2693  }
2694  else
2695  {
2696  frame = std::move(tmpFrame);
2697  }
2698 
2699  return true;
2700 }
2701 
2702 inline bool FrameConverter::Comfort::change(Frame& frame, const FrameType::PixelFormat targetPixelFormat, const bool forceCopy, Worker* worker, const Options& options)
2703 {
2704  return change(frame, targetPixelFormat, frame.pixelOrigin(), forceCopy, worker, options);
2705 }
2706 
2707 inline bool FrameConverter::Comfort::change(Frame& frame, const FrameType::PixelOrigin targetPixelOrigin, const bool forceCopy, Worker* worker, const Options& options)
2708 {
2709  return change(frame, frame.pixelFormat(), targetPixelOrigin, forceCopy, worker, options);
2710 }
2711 
2712 OCEAN_RE_ENABLE_DOCUMENTATION_DIAGNOSTIC
2713 
2714 template <typename TSource, typename TTarget>
2715 void FrameConverter::cast(const TSource* __restrict source, TTarget* __restrict target, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
2716 {
2717  ocean_assert(source != nullptr && target != nullptr);
2718  ocean_assert(width != 0u && height != 0u);
2719  ocean_assert(channels != 0u);
2720 
2721  // we will have a small performance benefit when applying as less as possible non-16-block iterations
2722  // thus, we distinguish between an execution with and without padding values
2723 
2724  if (sourcePaddingElements == 0u && targetPaddingElements == 0u)
2725  {
2726  if (std::is_same<TSource, TTarget>::value)
2727  {
2728  memcpy(target, source, size_t(width * height * channels) * sizeof(TSource));
2729  }
2730  else
2731  {
2732  const unsigned int elementsPerFrame = width * height * channels;
2733  const unsigned int blocksPerFrame_16 = elementsPerFrame / 16u;
2734 
2735  const unsigned int remainingElementsPerFrame = elementsPerFrame - blocksPerFrame_16 * 16u;
2736 
2737  for (unsigned int n = 0u; n < blocksPerFrame_16; ++n)
2738  {
2739  cast16Elements<TSource, TTarget>(source, target);
2740 
2741  source += 16;
2742  target += 16;
2743  }
2744 
2745  for (unsigned int i = 0u; i < remainingElementsPerFrame; ++i)
2746  {
2747  target[i] = TTarget(source[i]);
2748  }
2749  }
2750  }
2751  else
2752  {
2753  if (std::is_same<TSource, TTarget>::value)
2754  {
2755  const unsigned int sourceStrideElements = width * channels + sourcePaddingElements;
2756  const unsigned int targetStrideElements = width * channels + targetPaddingElements;
2757 
2758  const size_t bytesPerRowToCopy = size_t(width * channels) * sizeof(TSource);
2759 
2760  for (unsigned int y = 0u; y < height; ++y)
2761  {
2762  memcpy(target, source, bytesPerRowToCopy);
2763 
2764  source += sourceStrideElements;
2765  target += targetStrideElements;
2766  }
2767  }
2768  else
2769  {
2770  const unsigned int elementsPerRow = width * channels;
2771  const unsigned int blocksPerRow_16 = elementsPerRow / 16u;
2772 
2773  const unsigned int remainingElementsPerRow = elementsPerRow - blocksPerRow_16 * 16u;
2774 
2775  for (unsigned int y = 0u; y < height; ++y)
2776  {
2777  for (unsigned int x = 0u; x < blocksPerRow_16; ++x)
2778  {
2779  cast16Elements<TSource, TTarget>(source, target);
2780 
2781  source += 16;
2782  target += 16;
2783  }
2784 
2785  for (unsigned int i = 0u; i < remainingElementsPerRow; ++i)
2786  {
2787  target[i] = TTarget(source[i]);
2788  }
2789 
2790  source += remainingElementsPerRow + sourcePaddingElements;
2791  target += remainingElementsPerRow + targetPaddingElements;
2792  }
2793  }
2794  }
2795 }
2796 
2797 template <typename TSource, typename TTarget>
2798 void FrameConverter::normalizedCast(const TSource* __restrict source, TTarget* __restrict target, const unsigned int width, const unsigned int height, const unsigned int channels, const TTarget multiplicationFactor, const TTarget offset, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
2799 {
2800  ocean_assert(source != nullptr && target != nullptr);
2801  ocean_assert(width != 0u && height != 0u);
2802  ocean_assert(channels != 0u);
2803 
2804  // we will have a small performance benefit when applying as little as possible non-16-block iterations
2805  // thus, we distinguish between an execution with and without padding values
2806 
2807  if (sourcePaddingElements == 0u && targetPaddingElements == 0u)
2808  {
2809  const unsigned int elementsPerFrame = width * height * channels;
2810  const unsigned int blocksPerFrame_16 = elementsPerFrame / 16u;
2811 
2812  const unsigned int remainingElementsPerFrame = elementsPerFrame - blocksPerFrame_16 * 16u;
2813 
2814  for (unsigned int n = 0u; n < blocksPerFrame_16; ++n)
2815  {
2816  for (unsigned int i = 0u; i < 16u; ++i)
2817  {
2818  target[i] = TTarget(source[i]) * multiplicationFactor + offset;
2819  }
2820 
2821  source += 16;
2822  target += 16;
2823  }
2824 
2825  for (unsigned int i = 0u; i < remainingElementsPerFrame; ++i)
2826  {
2827  target[i] = TTarget(source[i]) * multiplicationFactor + offset;
2828  }
2829  }
2830  else
2831  {
2832  const unsigned int elementsPerRow = width * channels;
2833  const unsigned int blocksPerRow_16 = elementsPerRow / 16u;
2834 
2835  const unsigned int remainingElementsPerRow = elementsPerRow - blocksPerRow_16 * 16u;
2836 
2837  for (unsigned int y = 0u; y < height; ++y)
2838  {
2839  for (unsigned int n = 0u; n < blocksPerRow_16; ++n)
2840  {
2841  for (unsigned int i = 0u; i < 16u; ++i)
2842  {
2843  target[i] = TTarget(source[i]) * multiplicationFactor + offset;
2844  }
2845 
2846  source += 16;
2847  target += 16;
2848  }
2849 
2850  for (unsigned int i = 0u; i < remainingElementsPerRow; ++i)
2851  {
2852  target[i] = TTarget(source[i]) * multiplicationFactor + offset;
2853  }
2854 
2855  source += remainingElementsPerRow + sourcePaddingElements;
2856  target += remainingElementsPerRow + targetPaddingElements;
2857  }
2858  }
2859 }
2860 
2861 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
2862 
2863 template <>
2864 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements<uint8_t, float>(const uint8_t* const source, float* const target)
2865 {
2866  const uint8x16_t source_8x16 = vld1q_u8(source);
2867 
2868  const uint16x8_t source_16x8_0 = vmovl_u8(vget_low_u8(source_8x16));
2869  const uint16x8_t source_16x8_1 = vmovl_u8(vget_high_u8(source_8x16));
2870 
2871  const uint32x4_t source_32x4_0 = vmovl_u16(vget_low_u16(source_16x8_0));
2872  const uint32x4_t source_32x4_1 = vmovl_u16(vget_high_u16(source_16x8_0));
2873  const uint32x4_t source_32x4_2 = vmovl_u16(vget_low_u16(source_16x8_1));
2874  const uint32x4_t source_32x4_3 = vmovl_u16(vget_high_u16(source_16x8_1));
2875 
2876  const float32x4_t target_32x4_0 = vcvtq_f32_u32(source_32x4_0);
2877  const float32x4_t target_32x4_1 = vcvtq_f32_u32(source_32x4_1);
2878  const float32x4_t target_32x4_2 = vcvtq_f32_u32(source_32x4_2);
2879  const float32x4_t target_32x4_3 = vcvtq_f32_u32(source_32x4_3);
2880 
2881  vst1q_f32(target + 0, target_32x4_0);
2882  vst1q_f32(target + 4, target_32x4_1);
2883  vst1q_f32(target + 8, target_32x4_2);
2884  vst1q_f32(target + 12, target_32x4_3);
2885 }
2886 
2887 template <>
2888 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements<uint8_t, uint16_t>(const uint8_t* const source, uint16_t* const target)
2889 {
2890  const uint8x16_t source_8x16 = vld1q_u8(source);
2891 
2892  const uint16x8_t source_16x8_0 = vmovl_u8(vget_low_u8(source_8x16));
2893  const uint16x8_t source_16x8_1 = vmovl_u8(vget_high_u8(source_8x16));
2894 
2895  vst1q_u16(target + 0, source_16x8_0);
2896  vst1q_u16(target + 8, source_16x8_1);
2897 }
2898 
2899 template <>
2900 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements<uint8_t, int16_t>(const uint8_t* const source, int16_t* const target)
2901 {
2902  const uint8x16_t source_8x16 = vld1q_u8(source);
2903 
2904  const uint16x8_t source_16x8_0 = vmovl_u8(vget_low_u8(source_8x16));
2905  const uint16x8_t source_16x8_1 = vmovl_u8(vget_high_u8(source_8x16));
2906 
2907  vst1q_s16(target + 0, vreinterpretq_s16_u16(source_16x8_0));
2908  vst1q_s16(target + 8, vreinterpretq_s16_u16(source_16x8_1));
2909 }
2910 
2911 template <>
2912 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements<uint8_t, uint32_t>(const uint8_t* const source, uint32_t* const target)
2913 {
2914  const uint8x16_t source_8x16 = vld1q_u8(source);
2915 
2916  const uint16x8_t source_16x8_0 = vmovl_u8(vget_low_u8(source_8x16));
2917  const uint16x8_t source_16x8_1 = vmovl_u8(vget_high_u8(source_8x16));
2918 
2919  const uint32x4_t source_32x4_0 = vmovl_u16(vget_low_u16(source_16x8_0));
2920  const uint32x4_t source_32x4_1 = vmovl_u16(vget_high_u16(source_16x8_0));
2921  const uint32x4_t source_32x4_2 = vmovl_u16(vget_low_u16(source_16x8_1));
2922  const uint32x4_t source_32x4_3 = vmovl_u16(vget_high_u16(source_16x8_1));
2923 
2924  vst1q_u32(target + 0, source_32x4_0);
2925  vst1q_u32(target + 4, source_32x4_1);
2926  vst1q_u32(target + 8, source_32x4_2);
2927  vst1q_u32(target + 12, source_32x4_3);
2928 }
2929 
2930 template <>
2931 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements<uint8_t, int32_t>(const uint8_t* const source, int32_t* const target)
2932 {
2933  const uint8x16_t source_8x16 = vld1q_u8(source);
2934 
2935  const uint16x8_t source_16x8_0 = vmovl_u8(vget_low_u8(source_8x16));
2936  const uint16x8_t source_16x8_1 = vmovl_u8(vget_high_u8(source_8x16));
2937 
2938  const uint32x4_t source_32x4_0 = vmovl_u16(vget_low_u16(source_16x8_0));
2939  const uint32x4_t source_32x4_1 = vmovl_u16(vget_high_u16(source_16x8_0));
2940  const uint32x4_t source_32x4_2 = vmovl_u16(vget_low_u16(source_16x8_1));
2941  const uint32x4_t source_32x4_3 = vmovl_u16(vget_high_u16(source_16x8_1));
2942 
2943  vst1q_s32(target + 0, vreinterpretq_s32_u32(source_32x4_0));
2944  vst1q_s32(target + 4, vreinterpretq_s32_u32(source_32x4_1));
2945  vst1q_s32(target + 8, vreinterpretq_s32_u32(source_32x4_2));
2946  vst1q_s32(target + 12, vreinterpretq_s32_u32(source_32x4_3));
2947 }
2948 
2949 template <>
2950 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements<float, uint8_t>(const float* const source, uint8_t* const target)
2951 {
2952  const float32x4_t source_32x4_0 = vld1q_f32(source + 0);
2953  const float32x4_t source_32x4_1 = vld1q_f32(source + 4);
2954  const float32x4_t source_32x4_2 = vld1q_f32(source + 8);
2955  const float32x4_t source_32x4_3 = vld1q_f32(source + 12);
2956 
2957  const uint32x4_t target_32x4_0 = vcvtq_u32_f32(source_32x4_0);
2958  const uint32x4_t target_32x4_1 = vcvtq_u32_f32(source_32x4_1);
2959  const uint32x4_t target_32x4_2 = vcvtq_u32_f32(source_32x4_2);
2960  const uint32x4_t target_32x4_3 = vcvtq_u32_f32(source_32x4_3);
2961 
2962  const uint16x8_t target_16x8_0 = vcombine_u16(vmovn_u32(target_32x4_0), vmovn_u32(target_32x4_1));
2963  const uint16x8_t target_16x8_1 = vcombine_u16(vmovn_u32(target_32x4_2), vmovn_u32(target_32x4_3));
2964 
2965  const uint8x16_t target_8x16 = vcombine_u8(vmovn_u16(target_16x8_0), vmovn_u16(target_16x8_1));
2966 
2967  vst1q_u8(target, target_8x16);
2968 }
2969 
2970 #endif // #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
2971 
2972 template <typename TSource, typename TTarget>
2973 OCEAN_FORCE_INLINE void FrameConverter::cast16Elements(const TSource* const source, TTarget* const target)
2974 {
2975  for (unsigned int i = 0u; i < 16u; ++i)
2976  {
2977  target[i] = TTarget(source[i]);
2978  }
2979 }
2980 
2981 template <typename T>
2982 bool FrameConverter::subFrame(const T* source, T* target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int channels, const unsigned int sourceLeft, const unsigned int sourceTop, const unsigned int targetLeft, const unsigned int targetTop, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
2983 {
2984  ocean_assert(source != nullptr && target != nullptr);
2985 
2986  if (sourceLeft + width > sourceWidth || sourceTop + height > sourceHeight || targetLeft + width > targetWidth || targetTop + height > targetHeight)
2987  {
2988  return false;
2989  }
2990 
2991  const unsigned int sourceStrideElements = sourceWidth * channels + sourcePaddingElements;
2992  const unsigned int targetStrideElements = targetWidth * channels + targetPaddingElements;
2993 
2994  const T* subSource = source + sourceStrideElements * sourceTop + sourceLeft * channels;
2995  T* subTarget = target + targetStrideElements * targetTop + targetLeft * channels;
2996 
2997  if (sourcePaddingElements == 0u && targetPaddingElements == 0u && width == sourceWidth && sourceWidth == targetWidth)
2998  {
2999  memcpy(subTarget, subSource, height * width * channels * sizeof(T));
3000  }
3001  else
3002  {
3003  for (unsigned int y = 0u; y < height; ++y)
3004  {
3005  memcpy(subTarget, subSource, width * channels * sizeof(T));
3006 
3007  subTarget += targetStrideElements;
3008  subSource += sourceStrideElements;
3009  }
3010  }
3011 
3012  return true;
3013 }
3014 
3015 template <typename T>
3016 bool FrameConverter::subFrameMask(const Frame& sourceFrame, Frame& targetFrame, const Frame& maskFrame, const uint32_t sourceLeft, const uint32_t sourceTop, const uint32_t targetLeft, const uint32_t targetTop, const uint32_t subFrameWidth, const uint32_t subFrameHeight, const uint8_t maskValue)
3017 {
3018  if (subFrameWidth == 0u || subFrameHeight == 0u)
3019  {
3020  return true;
3021  }
3022 
3023  if (!sourceFrame.isValid() || !targetFrame.isValid() || !maskFrame.isValid() || sourceFrame.numberPlanes() != 1u || targetFrame.numberPlanes() != 1u || maskFrame.numberPlanes() != 1u || FrameType::dataType<T>() != sourceFrame.dataType() || FrameType::dataType<T>() != targetFrame.dataType() || maskFrame.dataType() != FrameType::dataType<uint8_t>() || sourceFrame.channels() != targetFrame.channels() || maskFrame.width() != subFrameWidth || maskFrame.height() != subFrameHeight)
3024  {
3025  ocean_assert(false && "Invalid input");
3026  return false;
3027  }
3028 
3029  return subFrameMask<T>(sourceFrame.constdata<T>(), targetFrame.data<T>(), maskFrame.constdata<uint8_t>(), sourceFrame.width(), sourceFrame.height(), targetFrame.width(), targetFrame.height(), sourceFrame.channels(), sourceLeft, sourceTop, targetLeft, targetTop, subFrameWidth, subFrameHeight, sourceFrame.paddingElements(), targetFrame.paddingElements(), maskFrame.paddingElements(), maskValue);
3030 }
3031 
3032 template <typename T>
3033 bool FrameConverter::subFrameMask(const T* source, T* target, const uint8_t* mask, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int channels, const unsigned int sourceLeft, const unsigned int sourceTop, const unsigned int targetLeft, const unsigned int targetTop, const unsigned int subFrameWidth, const unsigned int subFrameHeight, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements, const unsigned int maskPaddingElements, const uint8_t maskValue)
3034 {
3035  ocean_assert(source != nullptr && target != nullptr && mask != nullptr);
3036 
3037  if (sourceLeft + subFrameWidth > sourceWidth || sourceTop + subFrameHeight > sourceHeight || targetLeft + subFrameWidth > targetWidth || targetTop + subFrameHeight > targetHeight)
3038  {
3039  ocean_assert(false && "Invalid input");
3040  return false;
3041  }
3042 
3043  const unsigned int maskStrideElements = subFrameWidth + maskPaddingElements;
3044 
3045  const unsigned int sourceStrideElements = sourceWidth * channels + sourcePaddingElements;
3046  const unsigned int targetStrideElements = targetWidth * channels + targetPaddingElements;
3047 
3048  for (unsigned int y = 0u; y < subFrameHeight; ++y)
3049  {
3050  const uint8_t* maskRow = mask + maskStrideElements * y;
3051 
3052  const T* subSource = source + sourceStrideElements * (sourceTop + y) + sourceLeft * channels;
3053  T* subTarget = target + targetStrideElements * (targetTop + y) + targetLeft * channels;
3054 
3055  for (unsigned int x = 0u; x < subFrameWidth; ++x)
3056  {
3057  if (*maskRow == maskValue)
3058  {
3059  for (unsigned int c = 0u; c < channels; ++c)
3060  {
3061  subTarget[c] = subSource[c];
3062  }
3063  }
3064 
3065  maskRow++;
3066 
3067  subSource += channels;
3068  subTarget += channels;
3069  }
3070  }
3071 
3072  return true;
3073 }
3074 
3075 template <typename T>
3076 void FrameConverter::patchFrame(const T* source, T* buffer, const unsigned int width, const unsigned int channels, const unsigned int x, const unsigned int y, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int bufferPaddingElements)
3077 {
3078  ocean_assert(source != nullptr && buffer != nullptr);
3079  ocean_assert(width >= patchSize && channels >= 1u);
3080 
3081  ocean_assert(patchSize >= 1u && patchSize % 2u == 1u);
3082  const unsigned int patchSize_2 = patchSize / 2u;
3083 
3084  ocean_assert(x >= patchSize_2 && y >= patchSize_2);
3085  ocean_assert(x + patchSize_2 < width);
3086 
3087  const unsigned int sourceStrideElements = width * channels + sourcePaddingElements;
3088  const unsigned int bufferStrideElements = patchSize * channels + bufferPaddingElements;
3089 
3090  const unsigned int sourceLeft = x - patchSize_2;
3091  const unsigned int sourceTop = y - patchSize_2;
3092 
3093  source += sourceTop * sourceStrideElements + sourceLeft * channels;
3094 
3095  for (unsigned int row = 0u; row < patchSize; ++row)
3096  {
3097  memcpy(buffer, source, channels * patchSize * sizeof(T));
3098 
3099  source += sourceStrideElements;
3100  buffer += bufferStrideElements;
3101  }
3102 }
3103 
3104 template <typename T, unsigned int tChannels>
3105 void FrameConverter::patchFrameMirroredBorder(const T* source, T* buffer, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int bufferPaddingElements)
3106 {
3107  static_assert(tChannels >= 1u, "Invalid number of color channels!");
3108 
3109  ocean_assert(source != nullptr && buffer != nullptr);
3110 
3111  ocean_assert(patchSize >= 1u && patchSize % 2u == 1u);
3112  const unsigned int patchSize_2 = patchSize / 2u;
3113 
3114  const unsigned int widthPatchSize1 = width - (patchSize - 1u);
3115  ocean_assert(widthPatchSize1 == width - patchSize_2 * 2u);
3116 
3117  ocean_assert(width >= patchSize_2 + 1u && height >= patchSize_2 + 1u);
3118 
3119  ocean_assert(x < width && y < height);
3120 
3121  const unsigned int sourceStrideElements = width * tChannels + sourcePaddingElements;
3122 
3123  for (int top = int(y - patchSize_2); top <= int(y + patchSize_2); ++top)
3124  {
3125  const T* sourceRow = source + CVUtilities::mirrorIndex(top, height) * int(sourceStrideElements);
3126 
3127  for (int left = int(x - patchSize_2); left <= int(x + patchSize_2); ++left)
3128  {
3129  if ((unsigned int)(left) - patchSize_2 < widthPatchSize1)
3130  {
3131  ocean_assert(left >= int(patchSize_2) && left < int(width - patchSize_2));
3132 
3133  const T* sourcePixel = sourceRow + left * tChannels;
3134 
3135  for (unsigned int n = 0u; n < tChannels; ++n)
3136  {
3137  buffer[n] = sourcePixel[n];
3138  }
3139  }
3140  else
3141  {
3142  ocean_assert((unsigned int)(left) <= patchSize_2 || (unsigned int)(left) >= width - patchSize_2);
3143 
3144  const T* sourcePixel = sourceRow + CVUtilities::mirrorIndex(left, width) * tChannels;
3145 
3146  for (unsigned int n = 0u; n < tChannels; ++n)
3147  {
3148  buffer[n] = sourcePixel[n];
3149  }
3150  }
3151 
3152  buffer += tChannels;
3153  }
3154 
3155  buffer += bufferPaddingElements;
3156  }
3157 }
3158 
3159 template <typename TSource, typename TTarget>
3160 inline void FrameConverter::convertGenericPixelFormat(const TSource* source, TTarget* target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideElements, const unsigned int targetStrideElements, const ConversionFlag flag, const RowConversionFunction<TSource, TTarget> rowConversionFunction, const RowReversePixelOrderInPlaceFunction<TTarget> targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void* options, Worker* worker)
3161 {
3162  ocean_assert(source != nullptr && target != nullptr);
3163  ocean_assert(width >= 1u && height >= 1u);
3164  ocean_assert(sourceStrideElements >= width && targetStrideElements >= width);
3165  ocean_assert(rowConversionFunction != nullptr);
3166  ocean_assert(flag == CONVERT_NORMAL || flag == CONVERT_FLIPPED || targetReversePixelOrderInPlaceFunction != nullptr);
3167 
3168  // the internal subset conversion function needs bytes instead of elements
3169 
3170  const unsigned int sourceStrideBytes = sourceStrideElements * sizeof(TSource);
3171  const unsigned int targetStrideBytes = targetStrideElements * sizeof(TTarget);
3172 
3173  if (worker && height >= 200u)
3174  {
3175  worker->executeFunction(Worker::Function::createStatic(&FrameConverter::convertGenericPixelFormatSubset, (const uint8_t*)(source), (uint8_t*)(target), width, height, sourceStrideBytes, targetStrideBytes, flag, (const RowConversionFunction<uint8_t, uint8_t>)rowConversionFunction, (const RowReversePixelOrderInPlaceFunction<uint8_t>)targetReversePixelOrderInPlaceFunction, areContinuous, options, 0u, 0u), 0u, height, 11u, 12u, 20u);
3176  }
3177  else
3178  {
3179  convertGenericPixelFormatSubset((const uint8_t*)(source), (uint8_t*)(target), width, height, sourceStrideBytes, targetStrideBytes, flag, (const RowConversionFunction<uint8_t, uint8_t>)rowConversionFunction, (const RowReversePixelOrderInPlaceFunction<uint8_t>)targetReversePixelOrderInPlaceFunction, areContinuous, options, 0u, height);
3180  }
3181 }
3182 
3183 inline void FrameConverter::convertArbitraryPixelFormat(const void** sources, void** targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void* options, Worker* worker)
3184 {
3185  ocean_assert(multipleRowsPerIteration != 0u && height % multipleRowsPerIteration == 0u);
3186 
3187  const unsigned int rowIterations = height / multipleRowsPerIteration;
3188 
3189  if (worker && rowIterations >= 200u)
3190  {
3191  worker->executeFunction(Worker::Function::createStatic(&FrameConverter::convertArbitraryPixelFormatSubset, sources, targets, width, height, flag, multipleRowsPerIteration, multipleRowsConversionFunction, options, 0u, 0u), 0u, rowIterations, 8u, 9u, 20u);
3192  }
3193  else
3194  {
3195  convertArbitraryPixelFormatSubset(sources, targets, width, height, flag, multipleRowsPerIteration, multipleRowsConversionFunction, options, 0u, rowIterations);
3196  }
3197 }
3198 
3199 OCEAN_FORCE_INLINE void FrameConverter::unpack5ElementsBayerMosaicPacked10Bit(const uint8_t* const packed, uint16_t* unpacked)
3200 {
3201  ocean_assert(packed != nullptr);
3202  ocean_assert(unpacked != nullptr);
3203 
3204  unpacked[0] = uint16_t(uint16_t(packed[0]) << uint16_t(2) | (uint16_t(packed[4]) & uint16_t(0b00000011)));
3205  unpacked[1] = uint16_t(uint16_t(packed[1]) << uint16_t(2) | ((uint16_t(packed[4]) & uint16_t(0b00001100)) >> uint16_t(2)));
3206  unpacked[2] = uint16_t(uint16_t(packed[2]) << uint16_t(2) | ((uint16_t(packed[4]) & uint16_t(0b00110000)) >> uint16_t(4)));
3207  unpacked[3] = uint16_t(uint16_t(packed[3]) << uint16_t(2) | (uint16_t(packed[4]) >> uint16_t(6)));
3208 }
3209 
3210 #if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
3211 
3212 template <bool tAllowLastOverlappingElement>
3213 OCEAN_FORCE_INLINE void FrameConverter::unpack15ElementsBayerMosaicPacked10BitNEON(const uint8_t* const packed, uint16x8_t& unpackedAB_u_16x8, uint16x4_t& unpackedC_u_16x4)
3214 {
3215  constexpr uint8x8_t shuffleC_u_8x8 = {6u, 2u, 6u, 3u, 6u, 4u, 6u, 5u};
3216 
3217  constexpr int8x16_t leftShifts_s_8x16 = {6, 0, 4, 0, 2, 0, 0, 0, 6, 0, 4, 0, 2, 0, 0, 0};
3218  constexpr int16x8_t rightShifts_s_16x8 = {-6, -6, -6, -6, -6, -6, -6, -6};
3219 
3220  const uint8x16_t packed_u_8x16 = tAllowLastOverlappingElement ? vld1q_u8(packed) : vcombine_u8(vld1_u8(packed), vext_u8(vld1_u8(packed + 7), shuffleC_u_8x8, 1)); // shuffleC_u_8x8 is just a dummy value
3221 
3222  // F E D C B A 9 8 7 6 5 4 3 2 1 0
3223  // 8 9 7 9 6 9 5 9 3 4 2 4 1 4 0 4
3224 
3225 #ifdef __aarch64__
3226  constexpr uint8x16_t shuffle_u_8x16 = {4u, 0u, 4u, 1u, 4u, 2u, 4u, 3u, 9u, 5u, 9u, 6u, 9u, 7u, 9u, 8u};
3227  const uint8x16_t intermediateAB_u_8x16 = vqtbl1q_u8(packed_u_8x16, shuffle_u_8x16);
3228 #else
3229  const uint8x8_t packedA_u_8x8 = vget_low_u8(packed_u_8x16);
3230  const uint8x8_t packedB_u_8x8 = vget_low_u8(vextq_u8(packed_u_8x16, packed_u_8x16, 5));
3231 
3232  constexpr uint8x8_t shuffleAB_u_8x8 = {4u, 0u, 4u, 1u, 4u, 2u, 4u, 3u};
3233  const uint8x16_t intermediateAB_u_8x16 = vcombine_u8(vtbl1_u8(packedA_u_8x8, shuffleAB_u_8x8), vtbl1_u8(packedB_u_8x8, shuffleAB_u_8x8));
3234 #endif // __aarch64__
3235 
3236 
3237  // 7 6 5 4 3 2 1 0
3238  // 5 6 4 6 3 6 2 6
3239  const uint8x8_t intermediateC_u_8x8 = vtbl1_u8(vget_high_u8(packed_u_8x16), shuffleC_u_8x8);
3240 
3241 
3242  // ... XXXXXX99 33333333 44XXXXXX 22222222 XX44XXXX 11111111 XXXX44XX 00000000 XXXXXX44
3243  // ... 99------ 33333333 44------ 22222222 44------ 11111111 44------ 00000000 44------
3244  const uint16x8_t intermediateAB_u_16x8 = vreinterpretq_u16_u8(vshlq_u8(intermediateAB_u_8x16, leftShifts_s_8x16));
3245 
3246  const uint16x4_t intermediateC_u_16x4 = vreinterpret_u16_u8(vshl_u8(intermediateC_u_8x8, vget_low_u8(leftShifts_s_8x16)));
3247 
3248 
3249  // ... 99------ 33333333 44------ 22222222 44------ 11111111 44------ 00000000 44------
3250  // ... 55555599 ------33 33333344 ------22 22222244 ------11 11111144 ------00 00000044
3251  unpackedAB_u_16x8 = vshlq_u16(intermediateAB_u_16x8, rightShifts_s_16x8);
3252 
3253  unpackedC_u_16x4 = vshl_u16(intermediateC_u_16x4, vget_low_u8(rightShifts_s_16x8));
3254 }
3255 
3256 #endif // OCEAN_HARDWARE_NEON_VERSION
3257 
3258 }
3259 
3260 }
3261 
3262 #endif // META_OCEAN_CV_FRAME_CONVERTER_H
static OCEAN_FORCE_INLINE unsigned int mirrorIndex(const int index, const unsigned int elements)
Returns the mirrored index for a given index.
Definition: CVUtilities.h:456
The following comfort class provides comfortable functions simplifying prototyping applications but a...
Definition: FrameConverter.h:620
static bool convert(const Frame &source, const FrameType::PixelFormat targetPixelFormat, const FrameType::PixelOrigin targetPixelOrigin, Frame &target, const bool forceCopy=true, Worker *worker=nullptr, const Options &options=Options())
Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same d...
static bool convertAndCopy(const Frame &source, Frame &target, Worker *worker=nullptr, const Options &options=Options())
Converts a frame with arbitrary dimension, pixel format and pixel origin into a frame with the same d...
static bool change(Frame &frame, const FrameType::PixelFormat targetPixelFormat, const FrameType::PixelOrigin targetPixelOrigin, const bool forceCopy=true, Worker *worker=nullptr, const Options &options=Options())
Converts / changes a frame with arbitrary dimension, pixel format and pixel origin into a frame with ...
Definition: FrameConverter.h:2668
static bool isSupported(const FrameType &sourceType, const FrameType::PixelFormat targetPixelFormat, const Options &options=Options())
Returns whether the convert function of this class supports the conversion of a frame with one pixel ...
This class combines source pixel format, target pixel format, and options types.
Definition: FrameConverter.h:345
bool operator==(const ConversionTriple &conversionTriple) const
Returns whether two objects are identical.
Definition: FrameConverter.h:2653
FrameType::PixelFormat sourcePixelFormat_
The pixel format of the source frame, must be valid.
Definition: FrameConverter.h:387
Options::OptionsType optionsType_
The type of the options for which the conversion is defined.
Definition: FrameConverter.h:393
FrameType::PixelFormat targetPixelFormat_
The pixel format of the target frame, must be valid.
Definition: FrameConverter.h:390
This class is a wrapper for function pointers.
Definition: FrameConverter.h:400
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.
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.
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...
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 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.
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 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.
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.
const FunctionType functionType_
The type of the conversion function.
Definition: FrameConverter.h:513
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 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.
const void * function_
The function pointer of the conversion function.
Definition: FrameConverter.h:510
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 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< 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 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 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.
This class implements a singleton-based map for function pointers of conversion functions.
Definition: FrameConverter.h:219
std::unordered_map< ConversionTriple, FunctionWrapper, ConversionTriple::Hash > FormatPair2FunctionWrapperMap
Definition of a map mapping pairs or pixel formats to function pointers.
Definition: FrameConverter.h:519
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 uint8_t alphaValue, Worker *worker) OneSourceOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with one source plane and one target plane ...
Definition: FrameConverter.h:283
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 uint8_t alphaValue, Worker *worker) ThreeSourcesOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with three source planes and one target pla...
Definition: FrameConverter.h:331
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: FrameConverter.h:301
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: FrameConverter.h:319
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: FrameConverter.h:307
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: FrameConverter.h:337
FormatPair2FunctionWrapperMap formatPair2FunctionWrapperMap_
The map mapping pairs or pixel formats to function pointers.
Definition: FrameConverter.h:543
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 with gamma correction...
Definition: FrameConverter.h:277
void(*)(const TSource *source, TTarget *target, const uint32_t width, const uint32_t height, const ConversionFlag conversionFlag, const uint16_t blackLevelValue, const float *whiteBalanceValues, 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: FrameConverter.h:289
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: FrameConverter.h:271
FunctionType
Definition of individual types of conversion functions.
Definition: FrameConverter.h:228
@ FT_2_UINT8_TO_1_UINT8_ALPHA
2-plane uint8 to 1-plane uint8 with constant alpha channel conversion function.
Definition: FrameConverter.h:256
@ FT_1_UINT8_TO_1_UINT8_ALPHA
1-plane uint8 to 1-plane uint8 with constant alpha channel conversion function.
Definition: FrameConverter.h:236
@ FT_1_UINT8_TO_2_UINT8
1-plane uint8 to 2-plane uint8 conversion function.
Definition: FrameConverter.h:250
@ FT_1_UINT32_TO_1_UINT16
1-plane uint32 to 1-plane uint16 conversion function.
Definition: FrameConverter.h:248
@ FT_3_UINT8_TO_1_UINT8
3-plane uint8 to 1-plane uint8 conversion function.
Definition: FrameConverter.h:260
@ FT_3_UINT8_TO_1_UINT8_ALPHA
3-plane uint8 to 1-plane uint8 with constant alpha channel conversion function.
Definition: FrameConverter.h:262
@ FT_1_UINT8_TO_1_UINT8_BLACKLEVEL_WHITEBALANCE_GAMMA
1-plane uint8 to 1-plane uint8 conversion function with constant black level, white balance,...
Definition: FrameConverter.h:238
@ FT_2_UINT8_TO_1_UINT8
2-plane uint8 to 1-plane uint8 conversion function.
Definition: FrameConverter.h:254
@ FT_1_UINT16_TO_1_UINT16
1-plane uint16 to 1-plane uint16 conversion function.
Definition: FrameConverter.h:244
@ FT_1_UINT8_GAMMA_TO_1_UINT8
1-plane uint8 with constant gamma correction to 1-plane uint8 conversion function.
Definition: FrameConverter.h:234
@ FT_1_UINT16_TO_1_UINT8
1-plane uint16 to 1-plane uint8 conversion function.
Definition: FrameConverter.h:242
@ FT_1_UINT8_TO_1_UINT16
1-plane uint8 to 1-plane uint16 conversion function.
Definition: FrameConverter.h:240
@ FT_1_UINT8_TO_3_UINT8
1-plane uint8 to 3-plane uint8 conversion function.
Definition: FrameConverter.h:252
@ FT_2_UINT8_TO_3_UINT8
2-plane uint8 to 3-plane uint8 conversion function.
Definition: FrameConverter.h:258
@ FT_1_UINT32_TO_1_UINT8
1-plane uint32 to 1-plane uint8 conversion function.
Definition: FrameConverter.h:246
@ FT_1_UINT8_TO_1_UINT8
1-plane uint8 to 1-plane uint8 conversion function.
Definition: FrameConverter.h:232
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 uint8_t alphaValue, Worker *worker) TwoSourcesOneTargetAlphaConversionFunction
Definition of a function pointer to a conversion function with two source planes and one target plane...
Definition: FrameConverter.h:313
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: FrameConverter.h:325
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: FrameConverter.h:295
ConversionFunctionMap()
Creates a new map object and initializes all function pointers.
Definition of a class storing options for frame conversions.
Definition: FrameConverter.h:105
float gamma() const
Returns the gamma value for a conversion with gamma correction/encoding.
Definition: FrameConverter.h:2617
OptionsType optionsType_
The options type.
Definition: FrameConverter.h:198
OptionsType
Definition of individual types of options.
Definition: FrameConverter.h:112
@ OT_APPROXIMATED
Approximated conversion.
Definition: FrameConverter.h:122
OptionsType optionsType() const
Returns the options type.
Definition: FrameConverter.h:2606
uint8_t alphaChannelTargetValue() const
Returns the uint8_t alpha channel value for the target image if the source image does not contain an ...
Definition: FrameConverter.h:2611
uint16_t blackLevel_
The black level value that is subtracted from each element of the raw image before any other operatio...
Definition: FrameConverter.h:207
float gamma_
The gamma value for a conversion with gamma correction/encoding, with range (0, 2) (OT_GAMMA_CORRECTI...
Definition: FrameConverter.h:204
Options(const bool allowApproximation=false)
Default constructor.
Definition: FrameConverter.h:2557
float whiteBalance_[3]
The white balancing scalars of the red, green, and blue channels (in that order), with range [0,...
Definition: FrameConverter.h:210
uint16_t blackLevel() const
Returns the black level value for a conversion with black level correction.
Definition: FrameConverter.h:2623
const float * whiteBalance() const
Returns the white balance values for a conversion with white balance correction.
Definition: FrameConverter.h:2629
bool allowApproximation() const
Returns whether the conversion can be approximated.
Definition: FrameConverter.h:2635
This is the base class for all frame converter classes.
Definition: FrameConverter.h:32
static MatrixD transformationMatrix_FullRangeRGB24_To_LimitedRangeYUV24_BT601()
Returns the 3x4 color space transformation matrix from full range RGB24 to limited range YUV24 using ...
static void convertOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
This function is not used anymore due to the corresponding 2-row function.
ConversionFlag
Definition of individual conversion flags.
Definition: FrameConverter.h:39
@ CONVERT_NORMAL
Normal conversion, neither flips nor mirrors the image.
Definition: FrameConverter.h:49
@ CONVERT_MIRRORED
Mirrored conversion, exchanges left and right of the image (like in a mirror, mirroring around the y-...
Definition: FrameConverter.h:71
@ CONVERT_FLIPPED
Flipped conversion, exchanges top and bottom of the image (flipping around the x-axis).
Definition: FrameConverter.h:60
std::vector< ConversionFlag > ConversionFlags
Definition of a vector holding conversion flags.
Definition: FrameConverter.h:88
static void mapOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e....
static void convertTwoRows_1PlaneMosaicPacked10Bit_To_1PlaneUnpacked3Channels8BitAdvanced(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with 3-channel Bayer mosaic pixel format with packed 10-bit pixel value...
static MatrixD transformationMatrix_FullRangeYUV24_To_FullRangeBGR24_BT601()
Returns the color space transformation matrix from full range YUV24 to full range BGR24 using BT....
static void convertOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e....
static OCEAN_FORCE_INLINE void unpack5ElementsBayerMosaicPacked10Bit(const uint8_t *const packed, uint16_t *unpacked)
Unpacks 5 elements from a row in a packed Bayer mosaic to 4 pixels values The required memory layout ...
Definition: FrameConverter.h:3199
static void mapOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1BackIsDownsampled_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a YUYV16 pixel format to one row of an image with e....
void(*)(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options) MultipleRowsConversionFunction
Definition of a function pointer to a function able to convert multiple image row from an arbitrary p...
Definition: FrameConverter.h:570
void(*)(const TSource *sourceRow, TTarget *targetRow, const size_t width, const void *options) RowConversionFunction
Definition of a function pointer to a function able to convert one image row from one generic pixel f...
Definition: FrameConverter.h:558
static void normalizedCast(const TSource *__restrict source, TTarget *__restrict target, const unsigned int width, const unsigned int height, const unsigned int channels, const TTarget multiplicationFactor, const TTarget offset, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Casts the pixel values from one frame type to another frame type but also normalizes the casted sourc...
Definition: FrameConverter.h:2798
static MatrixD transformationMatrix_FullRangeYUV24_To_FullRangeBGR24_Android()
Returns the color space transformation matrix from full range YUV24 to full range BGR24 similar to BT...
static MatrixD transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_BT601()
Returns the color space transformation matrix from full range YUV24 to full range RGB24 using BT....
static void convertTwoRows_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_UV12 pixel format to two rows of an image with e....
static void patchFrame(const T *source, T *buffer, const unsigned int width, const unsigned int channels, const unsigned int x, const unsigned int y, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int bufferPaddingElements)
Copies a small patch area of a given frame into a buffer holding only the entire patch.
Definition: FrameConverter.h:3076
static MatrixD transformationMatrix_FullRangeYUV24_To_FullRangeRGB24_Android()
Returns the color space transformation matrix from full range YUV24 to full range RGB24 similar to BT...
static bool subFrameMask(const Frame &sourceFrame, Frame &targetFrame, const Frame &maskFrame, const uint32_t sourceLeft, const uint32_t sourceTop, const uint32_t targetLeft, const uint32_t targetTop, const uint32_t subFrameWidth, const uint32_t subFrameHeight, const uint8_t maskValue=0u)
Copies pixels from one sub-frame to another if the pixels are part of a mask; input may use padding.
Definition: FrameConverter.h:3016
static void convertOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
This function is not used anymore due to the corresponding 2-row function.
static void mapOneRow_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts (matches) one row of an image with e.g., a Y_UV12 pixel format to one row of an image with e...
static MatrixD transformationMatrix_FullRangeYVU24_To_FullRangeRGB24_BT601()
Returns the color space transformation matrix from full range YVU24 to full range RGB24 using BT....
static void mapOneRow_3Plane1Channel_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts (maps) one row of an image with e.g., a Y_U_V24 pixel format to one row of an image with e....
static void convertOneRow_3Planes1Channel_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a Y_U_V24 pixel format to one rows of an image with e....
static void convertOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1FrontIsDownsampled_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a UYVY16 pixel format to one row of an image with e....
static void convertOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1BackIsDownsampled_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a YUYV16 pixel format to one row of an image with e....
static void mapOneRow_1Plane2Channels_To_2Planes1Channel_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Maps one row of a 1-plane, 2-channel image to two planes with 1 channels.
static std::string translateConversionFlag(const ConversionFlag conversionFlag)
Translates a given conversion flag to a string.
static MatrixD transformationMatrix_FullRangeBGR24_To_FullRangeYVU24_BT601()
Returns the 3x4 color space transformation matrix from full range BGR24 to full range YVU24 using BT....
static void convertArbitraryPixelFormatSubset(const void **sources, void **targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void *options, const unsigned int firstMultipleRow, const unsigned int numberMultipleRows)
Converts a subset of a frame with arbitrary pixel format (e.g., Y_UV12, Y_VU12, YUYV16,...
static void convertGenericPixelFormat(const TSource *source, TTarget *target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideElements, const unsigned int targetStrideElements, const ConversionFlag flag, const RowConversionFunction< TSource, TTarget > rowConversionFunction, const RowReversePixelOrderInPlaceFunction< TTarget > targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void *options, Worker *worker)
Converts a frame with generic pixel format (e.g., RGBA32, BGR24, YUV24, ...) to a frame with generic ...
Definition: FrameConverter.h:3160
static void convertOneRow_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a Y_U_V12 pixel format to one row of an image with e....
static MatrixD transformationMatrix_FullRangeRGB24_To_FullRangeYVU24_BT601()
Returns the 3x4 color space transformation matrix from full range RGB24 to full range YVU24 using BT....
void(*)(T *row, const size_t width) RowReversePixelOrderInPlaceFunction
Definition of a function pointer to a function able to reverse the order of pixels in an image row wi...
Definition: FrameConverter.h:589
static const ConversionFlags & conversionFlags()
Returns a vector holding all possible conversion flags.
static MatrixD transformationMatrix_FullRangeRGB24_To_FullRangeYUV24_BT601()
Returns the 3x4 color space transformation matrix from full range RGB24 to full range YUV24 using BT....
static MatrixD transformationMatrix_FullRangeYVU24_To_FullRangeBGR24_Android()
Returns the color space transformation matrix from full range YVU24 to full range BGR24 similar to BT...
static OCEAN_FORCE_INLINE void unpack15ElementsBayerMosaicPacked10BitNEON(const uint8_t *const packed, uint16x8_t &unpackedAB_u_16x8, uint16x4_t &unpackedC_u_16x4)
Unpacks 15 elements from a row in a packed Bayer mosaic to 12 pixels values The required memory layou...
Definition: FrameConverter.h:3213
static void cast(const TSource *__restrict source, TTarget *__restrict target, const unsigned int width, const unsigned int height, const unsigned int channels, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Casts the pixel values from one frame type to another frame type.
static void convertTwoRows_1PlaneMosaicPacked10Bit_To_1PlaneUnpacked3Channels16Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with 3-channel Bayer mosaic pixel format with packed 10-bit pixel value...
static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e....
static void cast16Elements(const TSource *const source, TTarget *const target)
Casts 16 successive elements from one data type to another data type.
static void mapTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e....
CopyPreference
Definition of a boolean enum for copy preferences (to improve code readability).
Definition: FrameConverter.h:94
static MatrixD transformationMatrix_FullRangeYVU24_To_FullRangeRGB24_Android()
Returns the color space transformation matrix from full range YVU24 to full range RGB24 similar to BT...
static bool subFrame(const T *source, T *target, const unsigned int sourceWidth, const unsigned int sourceHeight, const unsigned int targetWidth, const unsigned int targetHeight, const unsigned int channels, const unsigned int sourceLeft, const unsigned int sourceTop, const unsigned int targetLeft, const unsigned int targetTop, const unsigned int width, const unsigned int height, const unsigned int sourcePaddingElements, const unsigned int targetPaddingElements)
Copies a sub-frame of a given frame into a second frame while both frames might have an individual nu...
Definition: FrameConverter.h:2982
static void convertGenericPixelFormatSubset(const uint8_t *source, uint8_t *target, const unsigned int width, const unsigned int height, const unsigned int sourceStrideBytes, const unsigned int targetStrideBytes, const ConversionFlag flag, const RowConversionFunction< uint8_t, uint8_t > rowConversionFunction, const RowReversePixelOrderInPlaceFunction< uint8_t > targetReversePixelOrderInPlaceFunction, const bool areContinuous, const void *options, const unsigned int firstRow, const unsigned int numberRows)
Converts a subset of a frame with generic pixel format (e.g., RGBA32, BGR24, YUV24,...
static MatrixD transformationMatrix_FullRangeRGB24_To_LimitedRangeYVU24_BT601()
Returns the 3x4 color space transformation matrix from full range RGB24 to limited range YVU24 using ...
static void convertOneRow_3Planes1Channel_To_1Plane4Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a Y_U_V24 pixel format to one rows of an image with e....
static MatrixD transformationMatrix_LimitedRangeYVU24_To_FullRangeBGR24_BT601()
Returns the color space transformation matrix from limited range YVU24 to full range BGR24 using BT....
static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e....
static MatrixD transformationMatrix_FullRangeYVU24_To_FullRangeBGR24_BT601()
Returns the color space transformation matrix from full range YVU24 to full range BGR24 using BT....
static void patchFrameMirroredBorder(const T *source, T *buffer, const unsigned int width, const unsigned int height, const unsigned int x, const unsigned int y, const unsigned int patchSize, const unsigned int sourcePaddingElements, const unsigned int bufferPaddingElements)
Copies a small patch area of a frame into a buffer holding only the entire patch.
Definition: FrameConverter.h:3105
void(*)(const T *inputRow, T *targetRow, const size_t width) RowReversePixelOrderFunction
Definition of a function pointer to a function able to reverse the order of pixels in an image row wi...
Definition: FrameConverter.h:580
static void convertTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelsDownsampled2x2_8BitPerChannel_Precision7Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a RGB pixel format to two rows of an image with e....
static void mapTwoRows_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts (matches) two rows of an image with e.g., a Y_UV12 pixel format to two rows of an image with...
static void convertTwoRows_1Plane3Channels_To_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_8BitPerChannel_Precision7Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a RGB pixel format to two rows of an image with e....
static MatrixD transformationMatrix_LimitedRangeYVU24_To_FullRangeRGB24_BT601()
Returns the color space transformation matrix from limited range YVU24 to full range RGB24 using BT....
static void mapTwoRows_1Plane3Channels_To_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a YUV24 pixel format to two rows of an image with e....
static void mapOneRow_1Plane3ChannelsWith2ChannelsDownsampled2x1FrontIsDownsampled_To_1Plane3Channels_8BitPerChannel(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts one row of an image with e.g., a UYVY16 pixel format to one row of an image with e....
static void convertTwoRows_1Plane1ChannelAnd1Plane2ChannelsDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision10Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_UV12 pixel format to two rows of an image with e....
static MatrixD transformationMatrix_LimitedRangeYUV24_To_FullRangeBGR24_BT601()
Returns the color space transformation matrix from limited range YUV24 to full range BGR24 using BT....
static void convertArbitraryPixelFormat(const void **sources, void **targets, const unsigned int width, const unsigned int height, const ConversionFlag flag, const unsigned int multipleRowsPerIteration, const MultipleRowsConversionFunction multipleRowsConversionFunction, const void *options, Worker *worker)
Converts a frame with arbitrary pixel format (e.g., Y_UV12, Y_VU12, YUYV16, ...) to a frame with arbi...
Definition: FrameConverter.h:3183
static void convertTwoRows_1Plane1ChannelAnd2Planes1ChannelDownsampled2x2_To_1Plane3Channels_8BitPerChannel_Precision6Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with e.g., a Y_U_V12 pixel format to two rows of an image with e....
static MatrixD transformationMatrix_FullRangeBGR24_To_LimitedRangeYUV24_BT601()
Returns the color space transformation matrix from full range BGR24 to limited range YUV24 using BT....
static void convertTwoRows_1PlaneMosaicPacked10Bit_To_1PlaneUnpacked3Channels8Bit(const void **sources, void **targets, const unsigned int multipleRowIndex, const unsigned int width, const unsigned int height, const ConversionFlag conversionFlag, const void *options)
Converts two rows of an image with 3-channel Bayer mosaic pixel format with packed 10-bit pixel value...
static MatrixD transformationMatrix_LimitedRangeYUV24_To_FullRangeRGB24_BT601()
Returns the color space transformation matrix from limited range YUV24 to full range RGB24 using BT....
static MatrixD transformationMatrix_FullRangeBGR24_To_FullRangeYUV24_BT601()
Returns the 3x4 color space transformation matrix from full range BGR24 to full range YUV24 using BT....
static Caller< void > createStatic(typename StaticFunctionPointerMaker< void, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass, NullClass >::Type function)
Creates a new caller container for a static function with no function parameter.
Definition: Caller.h:2876
This class implements Ocean's image class.
Definition: Frame.h:1760
const T * constdata(const unsigned int planeIndex=0u) const
Returns a pointer to the read-only pixel data of a specific plane.
Definition: Frame.h:4136
T * data(const unsigned int planeIndex=0u)
Returns a pointer to the pixel data of a specific plane.
Definition: Frame.h:4127
bool isValid() const
Returns whether this frame is valid.
Definition: Frame.h:4416
bool copy(const Frame &source, const bool copyTimestamp=true)
Deprecated.
bool isOwner() const
Returns whether the frame is the owner of the internal frame data.
Definition: Frame.h:4259
unsigned int paddingElements(const unsigned int planeIndex=0u) const
Returns the optional number of padding elements at the end of each row for a specific plane.
Definition: Frame.h:4010
Definition of a frame type composed by the frame dimension, pixel format and pixel origin.
Definition: Frame.h:30
PixelFormat
Definition of all pixel formats available in the Ocean framework.
Definition: Frame.h:183
@ FORMAT_UNDEFINED
Undefined pixel format.
Definition: Frame.h:187
unsigned int width() const
Returns the width of the frame format in pixel.
Definition: Frame.h:3111
PixelOrigin pixelOrigin() const
Returns the pixel origin of the frame.
Definition: Frame.h:3156
uint32_t numberPlanes() const
Returns the number of planes of the pixel format of this frame.
Definition: Frame.h:3151
PixelFormat pixelFormat() const
Returns the pixel format of the frame.
Definition: Frame.h:3121
PixelOrigin
Defines different types of frame origin positions.
Definition: Frame.h:1014
@ ORIGIN_INVALID
Invalid origin type.
Definition: Frame.h:1016
unsigned int height() const
Returns the height of the frame in pixel.
Definition: Frame.h:3116
unsigned int channels() const
Returns the number of individual channels the frame has.
Definition: Frame.h:3141
DataType dataType() const
Returns the data type of the pixel format of this frame.
Definition: Frame.h:3131
This class implements a matrix with arbitrary size.
Definition: Matrix.h:63
This template class is the base class for all singleton objects.
Definition: Singleton.h:71
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
bool executeFunction(const Function &function, const unsigned int first, const unsigned int size, const unsigned int firstIndex=(unsigned int)(-1), const unsigned int sizeIndex=(unsigned int)(-1), const unsigned int minimalIterations=1u, const unsigned int threadIndex=(unsigned int)(-1))
Executes a callback function separable by two function parameters.
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15
Helper class for a hash function.
Definition: FrameConverter.h:353
size_t operator()(const ConversionTriple &conversionTriple) const
Hash function.
Definition: FrameConverter.h:2640
Definition of the parameters used by the function for row-wise conversion of RGGB14_PACKED to RGB24/B...
Definition: FrameConverter.h:595