8#ifndef META_OCEAN_CV_ZERO_MEAN_SUM_SQUARE_DIFFERENCES_H
9#define META_OCEAN_CV_ZERO_MEAN_SUM_SQUARE_DIFFERENCES_H
46 template <
unsigned int tChannels,
unsigned int tPatchSize>
47 static inline uint32_t
patch8BitPerChannel(
const uint8_t*
const image0,
const uint8_t*
const image1,
const unsigned int width0,
const unsigned int width1,
const unsigned int centerX0,
const unsigned int centerY0,
const unsigned int centerX1,
const unsigned int centerY1,
const unsigned int image0PaddingElements,
const unsigned int image1PaddingElements);
61 template <
unsigned int tChannels,
unsigned int tPatchSize>
62 static inline unsigned int patchBuffer8BitPerChannel(
const uint8_t*
const image0,
const unsigned int width0,
const unsigned int centerX0,
const unsigned int centerY0,
const unsigned int image0PaddingElements,
const uint8_t*
const buffer1);
72 template <
unsigned int tChannels,
unsigned int tPixels>
73 static inline uint32_t
buffer8BitPerChannel(
const uint8_t*
const buffer0,
const uint8_t*
const buffer1);
93 template <
unsigned int tChannels,
unsigned int tPatchSize>
94 static uint32_t
patchMirroredBorder8BitPerChannel(
const uint8_t* image0,
const uint8_t* image1,
const unsigned int width0,
const unsigned int height0,
const unsigned int width1,
const unsigned int height1,
const unsigned int centerX0,
const unsigned int centerY0,
const unsigned int centerX1,
const unsigned int centerY1,
const unsigned int image0PaddingElements,
const unsigned int image1PaddingElements);
97template <
unsigned int tChannels,
unsigned int tPatchSize>
98inline uint32_t
ZeroMeanSumSquareDifferences::patch8BitPerChannel(
const uint8_t*
const image0,
const uint8_t*
const image1,
const unsigned int width0,
const unsigned int width1,
const unsigned int centerX0,
const unsigned int centerY0,
const unsigned int centerX1,
const unsigned int centerY1,
const unsigned int image0PaddingElements,
const unsigned int image1PaddingElements)
100 static_assert(tChannels >= 1u,
"Invalid channel number!");
101 static_assert(tPatchSize >= 1u,
"Invalid patch size!");
103 ocean_assert(image0 !=
nullptr && image1 !=
nullptr);
105 ocean_assert(width0 >= tPatchSize);
106 ocean_assert(width1 >= tPatchSize);
108 constexpr unsigned int tPatchSize_2 = tPatchSize / 2u;
110 ocean_assert(centerX0 >= tPatchSize_2 && centerY0 >= tPatchSize_2);
111 ocean_assert(centerX1 >= tPatchSize_2 && centerY1 >= tPatchSize_2);
113 ocean_assert(centerX0 < width0 - tPatchSize_2);
114 ocean_assert(centerX1 < width1 - tPatchSize_2);
116 const unsigned int image0StrideElements = width0 * tChannels + image0PaddingElements;
117 const unsigned int image1StrideElements = width1 * tChannels + image1PaddingElements;
119 const uint8_t*
const patch0 = image0 + (centerY0 - tPatchSize_2) * image0StrideElements + (centerX0 - tPatchSize_2) * tChannels;
120 const uint8_t*
const patch1 = image1 + (centerY1 - tPatchSize_2) * image1StrideElements + (centerX1 - tPatchSize_2) * tChannels;
122#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41
124 if constexpr ((tChannels == 1u || tChannels == 3u) && tPatchSize >= 5u)
129#elif defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
131 if constexpr ((tChannels == 1u || tChannels == 3u) && tPatchSize >= 5u)
141template <
unsigned int tChannels,
unsigned int tPatchSize>
144 static_assert(tChannels >= 1u,
"Invalid channel number!");
145 static_assert(tPatchSize % 2u == 1u,
"Invalid patch size!");
147 ocean_assert(image0 !=
nullptr && buffer1 !=
nullptr);
149 ocean_assert(width0 >= tPatchSize);
151 constexpr unsigned int tPatchSize_2 = tPatchSize / 2u;
153 ocean_assert(centerX0 >= tPatchSize_2 && centerY0 >= tPatchSize_2);
155 ocean_assert(centerX0 < width0 - tPatchSize_2);
157 const unsigned int image0StrideElements = width0 * tChannels + image0PaddingElements;
159 const uint8_t*
const patch0 = image0 + (centerY0 - tPatchSize_2) * image0StrideElements + (centerX0 - tPatchSize_2) * tChannels;
161#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41
163 if constexpr ((tChannels == 1u || tChannels == 3u) && tPatchSize >= 5u)
168#elif defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
170 if constexpr ((tChannels == 1u || tChannels == 3u) && tPatchSize >= 5u)
180template <
unsigned int tChannels,
unsigned int tPixels>
183 static_assert(tChannels >= 1u,
"Invalid channel number!");
184 static_assert(tPixels >= 1u,
"Invalid pixel number!");
186#if defined(OCEAN_HARDWARE_SSE_VERSION) && OCEAN_HARDWARE_SSE_VERSION >= 41
188 if constexpr ((tChannels == 1u || tChannels == 3u) && tPixels >= 8u)
193#elif defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
195 if constexpr ((tChannels == 1u || tChannels == 3u) && tPixels >= 8u)
205template <
unsigned int tChannels,
unsigned int tPatchSize>
206uint32_t
ZeroMeanSumSquareDifferences::patchMirroredBorder8BitPerChannel(
const uint8_t* image0,
const uint8_t* image1,
const unsigned int width0,
const unsigned int height0,
const unsigned int width1,
const unsigned int height1,
const unsigned int centerX0,
const unsigned int centerY0,
const unsigned int centerX1,
const unsigned int centerY1,
const unsigned int image0PaddingElements,
const unsigned int image1PaddingElements)
208 static_assert(tChannels >= 1u,
"Invalid channel number!");
209 static_assert(tPatchSize % 2u == 1u,
"Invalid patch size!");
211#if defined(OCEAN_HARDWARE_NEON_VERSION) && OCEAN_HARDWARE_NEON_VERSION >= 10
213 if constexpr (tChannels == 1u && tPatchSize >= 5u)
215 return ZeroMeanSumSquareDifferencesNEON::patchMirroredBorder8BitPerChannel<tChannels, tPatchSize>(image0, image1, width0, height0, width1, height1, centerX0, centerY0, centerX1, centerY1, image0PaddingElements, image1PaddingElements);
220 return ZeroMeanSumSquareDifferencesBase::patchMirroredBorder8BitPerChannel<tChannels>(image0, image1, tPatchSize, width0, height0, width1, height1, centerX0, centerY0, centerX1, centerY1, image0PaddingElements, image1PaddingElements);
This class implements several zero-mean sum square differences functions based e.g....
Definition ZeroMeanSumSquareDifferencesBase.h:25
static uint32_t patchMirroredBorder8BitPerChannel(const uint8_t *image0, const uint8_t *image1, const unsigned int patchSize, const unsigned int width0, const unsigned int height0, const unsigned int width1, const unsigned int height1, const unsigned int centerX0, const unsigned int centerY0, const unsigned int centerX1, const unsigned int centerY1, const unsigned int image0PaddingElements, const unsigned int image1PaddingElements)
Returns the zero-mean sum of square differences between two patches within an image,...
Definition ZeroMeanSumSquareDifferencesBase.h:528
static uint32_t buffer8BitPerChannelTemplate(const uint8_t *buffer0, const uint8_t *buffer1)
Returns the zero-mean sum of square differences between two memory buffers.
Definition ZeroMeanSumSquareDifferencesBase.h:306
static OCEAN_FORCE_INLINE uint32_t patchBuffer8BitPerChannelTemplate(const uint8_t *image0, const unsigned int width0, const unsigned int centerX0, const unsigned int centerY0, const unsigned int image0PaddingElements, const uint8_t *buffer1)
Returns the zero-mean sum of square differences between a square image patch and a buffer.
Definition ZeroMeanSumSquareDifferencesBase.h:281
static OCEAN_FORCE_INLINE uint32_t patch8BitPerChannelTemplate(const uint8_t *const image0, const uint8_t *const image1, const unsigned int width0, const unsigned int width1, const unsigned int centerX0, const unsigned int centerY0, const unsigned int centerX1, const unsigned int centerY1, const unsigned int image0PaddingElements, const unsigned int image1PaddingElements)
Returns the zero-mean sum of square differences between two square patches.
This class implements functions calculating the zero-mean sum of square differences.
Definition ZeroMeanSumSquareDifferences.h:27
static uint32_t patch8BitPerChannel(const uint8_t *const image0, const uint8_t *const image1, const unsigned int width0, const unsigned int width1, const unsigned int centerX0, const unsigned int centerY0, const unsigned int centerX1, const unsigned int centerY1, const unsigned int image0PaddingElements, const unsigned int image1PaddingElements)
Returns the zero-mean sum of square differences between two square image patches.
Definition ZeroMeanSumSquareDifferences.h:98
static uint32_t buffer8BitPerChannel(const uint8_t *const buffer0, const uint8_t *const buffer1)
Returns the zero-mean sum of square differences between two memory buffers.
Definition ZeroMeanSumSquareDifferences.h:181
static uint32_t patchMirroredBorder8BitPerChannel(const uint8_t *image0, const uint8_t *image1, const unsigned int width0, const unsigned int height0, const unsigned int width1, const unsigned int height1, const unsigned int centerX0, const unsigned int centerY0, const unsigned int centerX1, const unsigned int centerY1, const unsigned int image0PaddingElements, const unsigned int image1PaddingElements)
Returns the zero-mean sum of square differences between two patches within an image,...
Definition ZeroMeanSumSquareDifferences.h:206
static unsigned int patchBuffer8BitPerChannel(const uint8_t *const image0, const unsigned int width0, const unsigned int centerX0, const unsigned int centerY0, const unsigned int image0PaddingElements, const uint8_t *const buffer1)
Returns the zero-mean sum of square differences between an image patch and a memory buffer.
Definition ZeroMeanSumSquareDifferences.h:142
static uint32_t patchMirroredBorder8BitPerChannel(const uint8_t *const image0, const uint8_t *const image1, const unsigned int width0, const unsigned int height0, const unsigned int width1, const unsigned int height1, const unsigned int centerX0, const unsigned int centerY0, const unsigned int centerX1, const unsigned int centerY1, const unsigned int image0PaddingElements, const unsigned int image1PaddingElements)
Returns the zero-mean sum of square differences between two patches within an image,...
Definition ZeroMeanSumSquareDifferencesNEON.h:2152
static uint32_t patch8BitPerChannel(const uint8_t *const patch0, const uint8_t *const patch1, const unsigned int patch0StrideElements, const unsigned int patch1StrideElements)
Returns the zero-mean sum of square differences between two patches within an image.
Definition ZeroMeanSumSquareDifferencesNEON.h:2111
static uint32_t buffer8BitPerChannel(const uint8_t *const buffer0, const uint8_t *const buffer1)
Returns the zero-mean sum of square differences between two memory buffers.
Definition ZeroMeanSumSquareDifferencesNEON.h:2094
static uint32_t patchBuffer8BitPerChannel(const uint8_t *patch0, const uint8_t *buffer1, const unsigned int patch0StrideElements)
Returns the zero-mean sum of square differences between an image patch and a buffer.
Definition ZeroMeanSumSquareDifferencesNEON.h:2131
static uint32_t patchBuffer8BitPerChannel(const uint8_t *const patch0, const uint8_t *const buffer1, const unsigned int patch0StrideElements)
Returns the zero-mean sum of square differences between an image patch and a buffer.
Definition ZeroMeanSumSquareDifferencesSSE.h:1597
static uint32_t buffer8BitPerChannel(const uint8_t *const buffer0, const uint8_t *const buffer1)
Returns the zero-mean sum of square differences between two memory buffers.
Definition ZeroMeanSumSquareDifferencesSSE.h:1560
static uint32_t patch8BitPerChannel(const uint8_t *const patch0, const uint8_t *const patch1, const unsigned int patch0StrideElements, const unsigned int patch1StrideElements)
Returns the zero-mean sum of square differences between two patches within an image.
Definition ZeroMeanSumSquareDifferencesSSE.h:1577
Namespace of the CV library.
Definition Advanced.h:17
The namespace covering the entire Ocean framework.
Definition Accessor.h:15