65inline uint32_t
SumSquareDifferencesNoCenterSSE::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)
67 static_assert(tChannels >= 1u,
"Invalid channel number!");
68 static_assert(tPatchSize >= 1u,
"Invalid patch size!");
70 ocean_assert(image0 !=
nullptr && image1 !=
nullptr);
72 ocean_assert(width0 >= tPatchSize);
73 ocean_assert(width1 >= tPatchSize);
75 constexpr unsigned int tPatchSize_2 = tPatchSize / 2u;
77 ocean_assert(centerX0 >= tPatchSize_2 && centerY0 >= tPatchSize_2);
78 ocean_assert(centerX1 >= tPatchSize_2 && centerY1 >= tPatchSize_2);
80 ocean_assert(centerX0 < width0 - tPatchSize_2);
81 ocean_assert(centerX1 < width1 - tPatchSize_2);
83 const unsigned int image0StrideElements = width0 * tChannels + image0PaddingElements;
84 const unsigned int image1StrideElements = width1 * tChannels + image1PaddingElements;
86 const uint8_t*
const patch0 = image0 + (centerY0 - tPatchSize_2) * image0StrideElements + (centerX0 - tPatchSize_2) * tChannels;
87 const uint8_t*
const patch1 = image1 + (centerY1 - tPatchSize_2) * image1StrideElements + (centerX1 - tPatchSize_2) * tChannels;
89 return SumSquareDifferencesSSE::patch8BitPerChannel<tChannels, tPatchSize>(patch0, patch1, image0StrideElements, image1StrideElements)
90 - SumSquareDifferences::buffer8BitPerChannel<tChannels, 1u>(patch0 + tPatchSize_2 * image0StrideElements + tPatchSize_2 * tChannels, patch1 + tPatchSize_2 * image1StrideElements + tPatchSize_2 * tChannels);
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 sum of square differences between two square patches while skipping the center pixel.
Definition SumSquareDifferencesNoCenterSSE.h:65