message: [move sift.cpp] Use TLS instead of mutex in SIFT
  original commit:
diff: @@ -550,8 +550,7 @@ public:
  double _sigma,
  const std::vector<Mat>& _gauss_pyr,
  const std::vector<Mat>& _dog_pyr,
  - std::vector<KeyPoint>& _keypoints,
  - Mutex &_mutex)
  + TLSData<std::vector<KeyPoint> > &_tls_kpts_struct)
  : o(_o),
  i(_i),
  @@ -565,8 +564,7 @@ public:
  sigma(_sigma),
  gauss_pyr(_gauss_pyr),
  dog_pyr(_dog_pyr),
  - keypoints(_keypoints),
  - mutex(_mutex) { }
  + tls_kpts_struct(_tls_kpts_struct) { }
  void operator()( const cv::Range& range ) const
  {
  const int begin = range.start;
  @@ -579,6 +577,8 @@ public:
  const Mat& prev = dog_pyr[idx-1];
  const Mat& next = dog_pyr[idx+1];
  + std::vector<KeyPoint> *tls_kpts = tls_kpts_struct.get();
  +
  KeyPoint kpt;
  for( int r = begin; r < end; r++)
  {
  @@ -636,8 +636,7 @@ public:
  if(std::abs(kpt.angle - 360.f) < FLT_EPSILON)
  kpt.angle = 0.f;
  {
  - AutoLock autoLock(mutex);
  - keypoints.push_back(kpt);
  + tls_kpts->push_back(kpt);
  }
  }
  }
  @@ -655,8 +654,7 @@ private:
  double sigma;
  const std::vector<Mat>& gauss_pyr;
  const std::vector<Mat>& dog_pyr;
  - std::vector<KeyPoint>& keypoints;
  - Mutex &mutex;
  + TLSData<std::vector<KeyPoint> > &tls_kpts_struct;
  };
  //
  @@ -669,7 +667,7 @@ void SIFT_Impl::findScaleSpaceExtrema( const std::vector<Mat>& gauss_pyr, const
  const int threshold = cvFloor(0.5 * contrastThreshold / nOctaveLayers * 255 * SIFT_FIXPT_SCALE);
  keypoints.clear();
  - Mutex mutex;
  + TLSData<std::vector<KeyPoint> > tls_kpts_struct;
  for( int o = 0; o < nOctaves; o++ )
  for( int i = 1; i <= nOctaveLayers; i++ )
  @@ -686,7 +684,13 @@ void SIFT_Impl::findScaleSpaceExtrema( const std::vector<Mat>& gauss_pyr, const
  contrastThreshold,
  edgeThreshold,
  sigma,
  - gauss_pyr, dog_pyr, keypoints, mutex));
  + gauss_pyr, dog_pyr, tls_kpts_struct));
  + }
  +
  + std::vector<std::vector<KeyPoint>*> kpt_vecs;
  + tls_kpts_struct.gather(kpt_vecs);
  + for (size_t i = 0; i < kpt_vecs.size(); ++i) {
  + keypoints.insert(keypoints.end(), kpt_vecs[i]->begin(), kpt_vecs[i]->end());
  }
  }
  