Ocean
MappingI2.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_SYNTHESIS_MAPPING_I_2_H
9 #define META_OCEAN_CV_SYNTHESIS_MAPPING_I_2_H
10 
13 
14 #include "ocean/base/Worker.h"
15 
16 #include "ocean/cv/PixelPosition.h"
17 
18 namespace Ocean
19 {
20 
21 namespace CV
22 {
23 
24 namespace Synthesis
25 {
26 
27 /**
28  * This class implements the pixel mapping between source and target frames.
29  * @ingroup cvsynthesis
30  */
31 class OCEAN_CV_SYNTHESIS_EXPORT MappingI2 : public MappingI
32 {
33  public:
34 
35  /**
36  * Creates an empty mapping object.
37  */
39 
40  /**
41  * Copies a mapping from a given mapping object.
42  * @param pixelMapping Pixel mapping to be copied
43  */
44  MappingI2(const MappingI2& pixelMapping);
45 
46  /**
47  * Move constructor.
48  * @param mapping The mapping to be moved
49  */
50  MappingI2(MappingI2&& mapping) noexcept;
51 
52  /**
53  * Creates a new mapping object with defined dimension.
54  * An initial mapping is not provided.<br>
55  * @param width The width of the mapping object in pixel, with range [1, infinity)
56  * @param height The height of the mapping object in pixel, with range [1, infinity)
57  */
58  MappingI2(const unsigned int width, const unsigned int height);
59 
60  /**
61  * Applies the current mapping for two given frames, a target frame receiving the mapping and a source frame providing the visual information.<br>
62  * All target pixels will be updates.
63  * @param target The target frame representing the entire target area, must be valid
64  * @param source The source frame defining the entire source area, must be valid
65  * @param sourceWidth Width of the source frame in pixel, width range [1, infinity)
66  * @param worker Optional worker object to distribute the computation
67  * @tparam tChannels The number of data channel the frames have, with range [1, infinity)
68  */
69  template <unsigned int tChannels>
70  void applyTwoFrameMapping8BitPerChannel(uint8_t* const target, const uint8_t* const source, const unsigned int sourceWidth, Worker* worker = nullptr) const;
71 
72  /**
73  * Assigns another pixel mapping object to this one.
74  * @param pixelMapping Pixel mapping object to be copied
75  * @return Reference to this object
76  */
77  inline MappingI2& operator=(const MappingI2& pixelMapping);
78 
79  /**
80  * Move operator
81  * @param pixelMapping Right mapping to assign
82  * @return Reference to this mapping
83  */
84  inline MappingI2& operator=(MappingI2&& pixelMapping) noexcept;
85 
86  private:
87 
88  /**
89  * Applies the current mapping to a subset of for two given frames, a target frame receiving the mapping and a source frame providing the visual information.<br>
90  * All subset target pixels will be updates.
91  * @param target The target frame representing the entire target area, must be valid
92  * @param source The source frame defining the entire source area, must be valid
93  * @param sourceWidth Width of the source frame in pixel, with range [1, infinity)
94  * @param firstRow First row to be updated, with range [0, height)
95  * @param numberRows Number of rows to be handled, with range [1, height]
96  * @tparam tChannels The number of data channel the frames have, with range [1, infinity)
97  */
98  template <unsigned int tChannels>
99  void applyTwoFrameMapping8BitPerChannelSubset(uint8_t* const target, const uint8_t* const source, const unsigned int sourceWidth, const unsigned int firstRow, const unsigned int numberRows) const;
100 };
101 
102 inline MappingI2& MappingI2::operator=(const MappingI2& pixelMapping)
103 {
104  Mapping::operator=(pixelMapping);
105  return *this;
106 }
107 
108 inline MappingI2& MappingI2::operator=(MappingI2&& pixelMapping) noexcept
109 {
110  Mapping::operator=(std::move(pixelMapping));
111  return *this;
112 }
113 
114 }
115 
116 }
117 
118 }
119 
120 #endif // META_OCEAN_CV_SYNTHESIS_MAPPING_I_2_H
Mapping & operator=(const Mapping &mapping)
Assign operator.
Definition: Mapping.h:407
This class implements the pixel mapping between source and target frames.
Definition: MappingI2.h:32
MappingI2()
Creates an empty mapping object.
MappingI2(MappingI2 &&mapping) noexcept
Move constructor.
void applyTwoFrameMapping8BitPerChannelSubset(uint8_t *const target, const uint8_t *const source, const unsigned int sourceWidth, const unsigned int firstRow, const unsigned int numberRows) const
Applies the current mapping to a subset of for two given frames, a target frame receiving the mapping...
MappingI2 & operator=(const MappingI2 &pixelMapping)
Assigns another pixel mapping object to this one.
Definition: MappingI2.h:102
MappingI2(const MappingI2 &pixelMapping)
Copies a mapping from a given mapping object.
MappingI2(const unsigned int width, const unsigned int height)
Creates a new mapping object with defined dimension.
void applyTwoFrameMapping8BitPerChannel(uint8_t *const target, const uint8_t *const source, const unsigned int sourceWidth, Worker *worker=nullptr) const
Applies the current mapping for two given frames, a target frame receiving the mapping and a source f...
This class implements a mapping with integer accuracy.
Definition: MappingI.h:30
This class implements a worker able to distribute function calls over different threads.
Definition: Worker.h:33
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15