39 #include <visp3/core/vpCPUFeatures.h> 40 #include <visp3/core/vpImageTools.h> 42 #if defined __SSE2__ || defined _M_X64 || (defined _M_IX86_FP && _M_IX86_FP >= 2) 43 #include <emmintrin.h> 44 #define VISP_HAVE_SSE2 1 104 unsigned char B_star)
113 double factor = (double)(B_star - A_star) / (double)(B - A);
115 for (
unsigned int i = 0; i < I.
getHeight(); i++)
116 for (
unsigned int j = 0; j < I.
getWidth(); j++) {
124 I[i][j] = (
unsigned char)(A_star + factor * (v - A));
151 for (
unsigned int b = 0; b < n; b++) {
174 "Cannot compute image difference. The two images " 175 "(%ux%u) and (%ux%u) have not the same size",
183 for (
unsigned int b = 0; b < n; b++) {
216 for (
unsigned int b = 0; b < n; b++) {
245 for (
unsigned int b = 0; b < n; b++) {
278 unsigned char *ptr_I1 = I1.
bitmap;
279 unsigned char *ptr_I2 = I2.
bitmap;
280 unsigned char *ptr_Ires = Ires.
bitmap;
281 unsigned int cpt = 0;
285 for (; cpt <= Ires.
getSize() - 16; cpt += 16, ptr_I1 += 16, ptr_I2 += 16, ptr_Ires += 16) {
286 const __m128i v1 = _mm_loadu_si128((
const __m128i *)ptr_I1);
287 const __m128i v2 = _mm_loadu_si128((
const __m128i *)ptr_I2);
288 const __m128i vres = saturate ? _mm_adds_epu8(v1, v2) : _mm_add_epi8(v1, v2);
290 _mm_storeu_si128((__m128i *)ptr_Ires, vres);
295 for (; cpt < Ires.
getSize(); cpt++, ++ptr_I1, ++ptr_I2, ++ptr_Ires) {
296 *ptr_Ires = saturate ? vpMath::saturate<unsigned char>((
short int)*ptr_I1 + (
short int)*ptr_I2) : *ptr_I1 + *ptr_I2;
320 unsigned char *ptr_I1 = I1.
bitmap;
321 unsigned char *ptr_I2 = I2.
bitmap;
322 unsigned char *ptr_Ires = Ires.
bitmap;
323 unsigned int cpt = 0;
327 for (; cpt <= Ires.
getSize() - 16; cpt += 16, ptr_I1 += 16, ptr_I2 += 16, ptr_Ires += 16) {
328 const __m128i v1 = _mm_loadu_si128((
const __m128i *)ptr_I1);
329 const __m128i v2 = _mm_loadu_si128((
const __m128i *)ptr_I2);
330 const __m128i vres = saturate ? _mm_subs_epu8(v1, v2) : _mm_sub_epi8(v1, v2);
332 _mm_storeu_si128((__m128i *)ptr_Ires, vres);
337 for (; cpt < Ires.
getSize(); cpt++, ++ptr_I1, ++ptr_I2, ++ptr_Ires) {
338 *ptr_Ires = saturate ? vpMath::saturate<unsigned char>((
short int)*ptr_I1 - (
short int)*ptr_I2) : *ptr_I1 - *ptr_I2;
349 float vpImageTools::cubicHermite(
const float A,
const float B,
const float C,
const float D,
const float t)
351 float a = (-A + 3.0f * B - 3.0f * C + D) / 2.0f;
352 float b = A + 2.0f * C - (5.0f * B + D) / 2.0f;
353 float c = (-A + C) / 2.0f;
356 return a * t * t * t + b * t * t + c * t + d;
359 float vpImageTools::lerp(
const float A,
const float B,
const float t) {
return A * (1.0f - t) + B * t; }
unsigned char B
Blue component.
Type * bitmap
points toward the bitmap
error that can be emited by ViSP classes.
Error that can be emited by the vpImage class and its derivates.
unsigned char G
Green component.
static Type maximum(const Type &a, const Type &b)
VISP_EXPORT bool checkSSE2()
unsigned char A
Additionnal component.
void resize(const unsigned int h, const unsigned int w)
resize the image : Image initialization
static Type minimum(const Type &a, const Type &b)
unsigned int getHeight() const
unsigned int getSize() const
unsigned char R
Red component.
unsigned int getWidth() const