diff options
| author | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-13 15:01:23 +0200 | 
|---|---|---|
| committer | Stanislaw Halik <sthalik@misaki.pl> | 2017-10-13 15:01:23 +0200 | 
| commit | 887dd41c5d67c30bd1e9631920d8fc1c3dd1a3f0 (patch) | |
| tree | e5962fa5ef14b85b49c3d92752829e4645547efb | |
| parent | 13f01510132abd3cf08e5a913721d0702c20664f (diff) | |
compat/macros: fix "restrict" name clash
| -rw-r--r-- | compat/macros.hpp | 12 | ||||
| -rw-r--r-- | pose-widget/pose-widget.cpp | 6 | ||||
| -rw-r--r-- | tracker-pt/point_extractor.cpp | 4 | 
3 files changed, 12 insertions, 10 deletions
| diff --git a/compat/macros.hpp b/compat/macros.hpp index 84d6bd03..fcb4fea3 100644 --- a/compat/macros.hpp +++ b/compat/macros.hpp @@ -8,16 +8,18 @@  #   define never_inline  #endif -#if defined _MSC_VER || defined __GNUG__ -#   define restrict __restrict +#if defined __GNUG__ +#   define restrict_ptr __restrict +#elif defined _MSC_VER +#   define restrict_ptr __restrict  #else -#   define restrict +#   define restrict_ptr  #endif  #if defined _MSC_VER -#   define restrict_ref restrict +#   define restrict_ref restrict_ptr  #elif defined __GNUG__ -#   define restrict_ref restrict +#   define restrict_ref restrict_ptr  #else  #   define restrict_ref  #endif diff --git a/pose-widget/pose-widget.cpp b/pose-widget/pose-widget.cpp index 3424095d..3e5f4ec3 100644 --- a/pose-widget/pose-widget.cpp +++ b/pose-widget/pose-widget.cpp @@ -267,7 +267,7 @@ void pose_transform::project_quad_texture()      }      // rotation of (0, 90, 0) makes it numerically unstable -    if (std::fabs(dir) < 1e-3) +    if (std::fabs(dir) < 1e-3f)      {          lock_guard l(mtx2);          image.swap(image2); @@ -282,8 +282,8 @@ void pose_transform::project_quad_texture()      const unsigned orig_pitch = tex.bytesPerLine();      const unsigned dest_pitch = image.bytesPerLine(); -    const unsigned char* restrict orig = tex.constBits(); -    unsigned char* restrict dest = image.bits(); +    const unsigned char* restrict_ptr orig = tex.constBits(); +    unsigned char* restrict_ptr dest = image.bits();      const int orig_depth = tex.depth() / 8;      const int dest_depth = image.depth() / 8; diff --git a/tracker-pt/point_extractor.cpp b/tracker-pt/point_extractor.cpp index cd8b8ce3..9030b520 100644 --- a/tracker-pt/point_extractor.cpp +++ b/tracker-pt/point_extractor.cpp @@ -49,7 +49,7 @@ static cv::Vec2d MeanShiftIteration(const cv::Mat &frame_gray, const cv::Vec2d &      cv::Vec2d com(0.0, 0.0);      for (int i = 0; i < frame_gray.rows; i++)      { -        auto frame_ptr = (uint8_t const * restrict)frame_gray.ptr(i); +        auto frame_ptr = (uint8_t const* restrict_ptr)frame_gray.ptr(i);          for (int j = 0; j < frame_gray.cols; j++)          {              double val = frame_ptr[j]; @@ -192,7 +192,7 @@ void PointExtractor::extract_points(const cv::Mat& frame, cv::Mat& preview_frame          const double max_radius = 15 * cy;          const double radius = fmax(0., (max_radius-min_radius) * s.threshold / 255 + min_radius); -        float const* restrict ptr = reinterpret_cast<float const* restrict>(hist.ptr(0)); +        float const* restrict_ptr ptr = reinterpret_cast<float const* restrict_ptr>(hist.ptr(0));          const unsigned area = uround(3 * M_PI * radius*radius);          const unsigned sz = unsigned(hist.cols * hist.rows);          unsigned thres = 32; | 
