ocl: fix warnings from GCC 4.8, update Haar
authorAlexander Alekhin <alexander.alekhin@itseez.com>
Fri, 11 Oct 2013 14:42:17 +0000 (18:42 +0400)
committerAlexander Alekhin <alexander.alekhin@itseez.com>
Fri, 11 Oct 2013 14:42:17 +0000 (18:42 +0400)
modules/imgproc/test/test_convhull.cpp
modules/ocl/src/haar.cpp

index 64fe7f6..e20b1a2 100644 (file)
@@ -1290,14 +1290,14 @@ void CV_FitLineTest::generate_point_set( void* pointsSet )
         t = (float)((cvtest::randReal(rng)-0.5)*low_high_range*2);
 
         for( k = 0; k < n; k++ )
+        {
             p[k] = (float)((cvtest::randReal(rng)-0.5)*max_noise*2 + t*line0[k] + line0[k+n]);
 
-        if( point_type == CV_32S )
-            for( k = 0; k < n; k++ )
+            if( point_type == CV_32S )
                 pi[k] = cvRound(p[k]);
-        else
-            for( k = 0; k < n; k++ )
+            else
                 pf[k] = p[k];
+        }
     }
 }
 
index 71777f1..40c1f2a 100644 (file)
@@ -625,37 +625,21 @@ static void gpuSetHaarClassifierCascade( CvHaarClassifierCascade *_cascade)
     cascade->p3 = equRect.width ;
     for( i = 0; i < _cascade->count; i++ )
     {
-        int j, k, l;
+        int j, l;
         for( j = 0; j < stage_classifier[i].count; j++ )
         {
             for( l = 0; l < stage_classifier[i].classifier[j].count; l++ )
             {
-                CvHaarFeature *feature =
+                const CvHaarFeature *feature =
                     &_cascade->stage_classifier[i].classifier[j].haar_feature[l];
                 GpuHidHaarTreeNode *hidnode = &stage_classifier[i].classifier[j].node[l];
-                CvRect r[3];
 
-
-                int nr;
-
-                /* align blocks */
-                for( k = 0; k < CV_HAAR_FEATURE_MAX; k++ )
+                for( int k = 0; k < CV_HAAR_FEATURE_MAX; k++ )
                 {
-                    if(!hidnode->p[k][0])
+                    const CvRect tr = feature->rect[k].r;
+                    if (tr.width == 0)
                         break;
-                    r[k] = feature->rect[k].r;
-               }
-
-                nr = k;
-                for( k = 0; k < nr; k++ )
-                {
-                    CvRect tr;
-                    double correction_ratio;
-                    tr.x = r[k].x;
-                    tr.width = r[k].width;
-                    tr.y = r[k].y ;
-                    tr.height = r[k].height;
-                    correction_ratio = weight_scale * (!feature->tilted ? 1 : 0.5);
+                    double correction_ratio = weight_scale * (!feature->tilted ? 1 : 0.5);
                     hidnode->p[k][0] = tr.x;
                     hidnode->p[k][1] = tr.y;
                     hidnode->p[k][2] = tr.width;