]> git.sesse.net Git - kdenlive/commitdiff
small cleanup
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 29 May 2011 17:41:00 +0000 (17:41 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 29 May 2011 17:41:00 +0000 (17:41 +0000)
svn path=/trunk/kdenlive/; revision=5618

src/kthumb.cpp
thumbnailer/westleypreview.cpp

index 6af26e4f820d55fad17cfc29b669f2ed8444066a..1a953d5a1e903caf025a228844191252496532b3 100644 (file)
@@ -203,7 +203,7 @@ uint KThumb::imageVariance(QImage image )
     uint bytes = image.numBytes();
     uint STEPS = bytes/2;
     QVarLengthArray<uchar> pivot(STEPS);
-    uchar *bits=image.bits();
+    const uchar *bits=image.bits();
     // First pass: get pivots and taking average
     for( uint i=0; i<STEPS ; i++ ){
         pivot[i] = bits[2 * i];
index 0ce57323a73c33d150f113c8d74724ca8ff211f2..a68787526576115daa26996ed70062aeb002f6b1 100644 (file)
@@ -126,17 +126,18 @@ uint MltPreview::imageVariance(QImage image)
     uint STEPS = bytes / 2;
     QVarLengthArray<uchar> pivot(STEPS);
     kDebug(DBG_AREA) << "Using " << STEPS << " steps\n";
-    uchar *bits = image.bits();
+    const uchar *bits=image.bits();
     // First pass: get pivots and taking average
-    for (uint i = 0; i < STEPS ; i++) {
-        pivot[i] = bits[i*(bytes/STEPS)];
-        avg += pivot[i];
+    for( uint i=0; i<STEPS ; i++ ){
+        pivot[i] = bits[2 * i];
+        avg+=pivot.at(i);
     }
-    avg = avg / STEPS;
+    avg=avg/STEPS;
     // Second Step: calculate delta (average?)
-    for (uint i = 0; i < STEPS; i++) {
-        int curdelta = abs(int(avg - pivot[i]));
-        delta += curdelta;
+    for (uint i=0; i<STEPS; i++)
+    {
+        int curdelta=abs(int(avg - pivot.at(i)));
+        delta+=curdelta;
     }
     return delta / STEPS;
 }