diff --git a/modules/contrib/src/stereovar.cpp b/modules/contrib/src/stereovar.cpp index 88640d86b2..1b542bbf52 100755 --- a/modules/contrib/src/stereovar.cpp +++ b/modules/contrib/src/stereovar.cpp @@ -67,11 +67,12 @@ StereoVar::~StereoVar() static Mat diffX(Mat &src) { - register int x, y, cols = src.cols - 1; + int cols = src.cols - 1; Mat dst(src.size(), src.type()); - for(y = 0; y < src.rows; y++){ + for(int y = 0; y < src.rows; y++){ const float* pSrc = src.ptr(y); float* pDst = dst.ptr(y); + int x = 0; #if CV_SSE2 for (x = 0; x <= cols - 8; x += 8) { __m128 a0 = _mm_loadu_ps(pSrc + x); diff --git a/modules/features2d/src/fast.cpp b/modules/features2d/src/fast.cpp index f496de3d51..fe496762ed 100644 --- a/modules/features2d/src/fast.cpp +++ b/modules/features2d/src/fast.cpp @@ -9,16 +9,16 @@ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - *Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. + *Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. - *Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. + *Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. - *Neither the name of the University of Cambridge nor the names of - its contributors may be used to endorse or promote products derived - from this software without specific prior written permission. + *Neither the name of the University of Cambridge nor the names of + its contributors may be used to endorse or promote products derived + from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT @@ -350,7 +350,7 @@ int cornerScore<8>(const uchar* ptr, const int pixel[], int threshold) } int b0 = -a0; - for( k = 0; k < 12; k += 2 ) + for( k = 0; k < 8; k += 2 ) { int b = std::max((int)d[k+1], (int)d[k+2]); b = std::max(b, (int)d[k+3]); @@ -375,7 +375,10 @@ template void FAST_t(InputArray _img, std::vector& keypoints, int threshold, bool nonmax_suppression) { Mat img = _img.getMat(); - const int K = patternSize/2, N = patternSize + K + 1, quarterPatternSize = patternSize/4; + const int K = patternSize/2, N = patternSize + K + 1; +#if CV_SSE2 + const int quarterPatternSize = patternSize/4; +#endif int i, j, k, pixel[25]; makeOffsets(pixel, (int)img.step, patternSize); for(k = patternSize; k < 25; k++) @@ -585,7 +588,7 @@ FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppressio FastFeatureDetector::FastFeatureDetector( int _threshold, bool _nonmaxSuppression, int _type ) : threshold(_threshold), nonmaxSuppression(_nonmaxSuppression), type(_type) {} - + void FastFeatureDetector::detectImpl( const Mat& image, vector& keypoints, const Mat& mask ) const { Mat grayImage = image; diff --git a/modules/imgproc/src/smooth.cpp b/modules/imgproc/src/smooth.cpp index 2165673c84..91a004a866 100644 --- a/modules/imgproc/src/smooth.cpp +++ b/modules/imgproc/src/smooth.cpp @@ -1298,17 +1298,17 @@ public: maxk(_maxk), space_ofs(_space_ofs), space_weight(_space_weight), color_weight(_color_weight) { } - + virtual void operator() (const Range& range) const { int i, j, cn = dest->channels(), k; Size size = dest->size(); - + for( i = range.start; i < range.end; i++ ) { const uchar* sptr = temp->ptr(i+radius) + radius*cn; uchar* dptr = dest->ptr(i); - + if( cn == 1 ) { for( j = 0; j < size.width; j++ ) @@ -1351,10 +1351,10 @@ public: } } } - + private: - const Mat *temp; Mat *dest; + const Mat *temp; int radius, maxk, *space_ofs; float *space_weight, *color_weight; }; @@ -1367,40 +1367,40 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d, int cn = src.channels(); int i, j, maxk, radius; Size size = src.size(); - + CV_Assert( (src.type() == CV_8UC1 || src.type() == CV_8UC3) && src.type() == dst.type() && src.size() == dst.size() && src.data != dst.data ); - + if( sigma_color <= 0 ) sigma_color = 1; if( sigma_space <= 0 ) sigma_space = 1; - + double gauss_color_coeff = -0.5/(sigma_color*sigma_color); double gauss_space_coeff = -0.5/(sigma_space*sigma_space); - + if( d <= 0 ) radius = cvRound(sigma_space*1.5); else radius = d/2; radius = MAX(radius, 1); d = radius*2 + 1; - + Mat temp; copyMakeBorder( src, temp, radius, radius, radius, radius, borderType ); - + vector _color_weight(cn*256); vector _space_weight(d*d); vector _space_ofs(d*d); float* color_weight = &_color_weight[0]; float* space_weight = &_space_weight[0]; int* space_ofs = &_space_ofs[0]; - + // initialize color-related bilateral filter coefficients for( i = 0; i < 256*cn; i++ ) color_weight[i] = (float)std::exp(i*i*gauss_color_coeff); - + // initialize space-related bilateral filter coefficients for( i = -radius, maxk = 0; i <= radius; i++ ) for( j = -radius; j <= radius; j++ ) @@ -1411,7 +1411,7 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d, space_weight[maxk] = (float)std::exp(r*r*gauss_space_coeff); space_ofs[maxk++] = (int)(i*temp.step + j*cn); } - + BilateralFilter_8u_Invoker body(dst, temp, radius, maxk, space_ofs, space_weight, color_weight); parallel_for_(Range(0, size.height), body); } diff --git a/modules/video/src/bgfg_gmg.cpp b/modules/video/src/bgfg_gmg.cpp index 163445a45b..b4e9824d69 100644 --- a/modules/video/src/bgfg_gmg.cpp +++ b/modules/video/src/bgfg_gmg.cpp @@ -440,8 +440,7 @@ bool BackgroundSubtractorGMG::HistogramFeatureGMG::operator ==(HistogramFeatureG std::vector::iterator color_a; std::vector::iterator color_b; std::vector::iterator color_a_end = this->color.end(); - std::vector::iterator color_b_end = rhs.color.end(); - for (color_a = color.begin(),color_b =rhs.color.begin();color_a!=color_a_end;++color_a,++color_b) + for (color_a = color.begin(), color_b = rhs.color.begin(); color_a != color_a_end; ++color_a, ++color_b) { if (*color_a != *color_b) {