Main MRPT website > C++ reference for MRPT 1.9.9
faster_corner_utilities.h
Go to the documentation of this file.
1 /* +------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2017, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +------------------------------------------------------------------------+ */
9 
10 // ---------------------------------------------------------------------------
11 // LICENSING: This file is a slightly-modified version of part of libcvd,
12 // released under LGPL 2.1 by Edward Rosten
13 // ---------------------------------------------------------------------------
14 
15 #ifndef MRPT_CVD_INTERNAL_INC_FAST_CORNER_UTILITIES_H
16 #define MRPT_CVD_INTERNAL_INC_FAST_CORNER_UTILITIES_H
17 
18 #include <mrpt/utils/SSE_types.h>
19 
20 namespace mrpt
21 {
22 struct Less
23 {
24  template <class T1, class T2>
25  static bool eval(const T1 a, const T2 b)
26  {
27  return a < b;
28  }
29  static int prep_t(int pixel_val, int barrier)
30  {
31  return pixel_val - barrier;
32  }
33 };
34 struct Greater
35 {
36  template <class T1, class T2>
37  static bool eval(const T1 a, const T2 b)
38  {
39  return a > b;
40  }
41  static int prep_t(int pixel_val, int barrier)
42  {
43  return pixel_val + barrier;
44  }
45 };
46 
47 #if MRPT_HAS_SSE2
48 
49 #define CHECK_BARRIER(lo, hi, other, flags) \
50  { \
51  __m128i diff = _mm_subs_epu8(lo, other); \
52  __m128i diff2 = _mm_subs_epu8(other, hi); \
53  __m128i z = _mm_setzero_si128(); \
54  diff = _mm_cmpeq_epi8(diff, z); \
55  diff2 = _mm_cmpeq_epi8(diff2, z); \
56  flags = ~(_mm_movemask_epi8(diff) | (_mm_movemask_epi8(diff2) << 16)); \
57  }
58 
59 template <bool Aligned>
60 inline __m128i load_si128(const void* addr)
61 {
62  return _mm_loadu_si128((const __m128i*)addr);
63 }
64 template <>
65 inline __m128i load_si128<true>(const void* addr)
66 {
67  return _mm_load_si128((const __m128i*)addr);
68 }
69 
70 #endif
71 }
72 #endif
__m128i load_si128(const void *addr)
static bool eval(const T1 a, const T2 b)
static int prep_t(int pixel_val, int barrier)
__m128i load_si128< true >(const void *addr)
static bool eval(const T1 a, const T2 b)
GLubyte GLubyte b
Definition: glext.h:6279
static int prep_t(int pixel_val, int barrier)
GLenum const GLvoid * addr
Definition: glext.h:7284
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
GLubyte GLubyte GLubyte a
Definition: glext.h:6279



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019