]> git.sesse.net Git - kdenlive/blobdiff - src/kthumb.cpp
Cleanup
[kdenlive] / src / kthumb.cpp
index a87f654d6ac8cf6c741218f3c390ebf9b5f62815..bdd6d9689ad240ac90f68243074fba2a167da734 100644 (file)
@@ -205,7 +205,9 @@ QImage KThumb::getFrame(Mlt::Frame *frame, int frameWidth, int displayWidth, int
     int ow = frameWidth;
     int oh = height;
     mlt_image_format format = mlt_image_rgb24a;
-
+    frame->set("rescale.interp", "nearest");
+    frame->set("deinterlace_method", "onefield");
+    frame->set("progressive", "1");
     const uchar* imagedata = frame->get_image(format, ow, oh);
     QImage image(ow, oh, QImage::Format_ARGB32_Premultiplied);
     memcpy(image.bits(), imagedata, ow * oh * 4);//.byteCount());
@@ -247,7 +249,8 @@ uint KThumb::imageVariance(QImage image )
         avg+=pivot[i];
 #endif
     }
-    avg=avg/STEPS;
+    if (STEPS)
+        avg=avg/STEPS;
     // Second Step: calculate delta (average?)
     for (uint i=0; i<STEPS; i++)
     {
@@ -258,7 +261,10 @@ uint KThumb::imageVariance(QImage image )
 #endif
         delta+=curdelta;
     }
-    return delta/STEPS;
+    if (STEPS)
+        return delta/STEPS;
+    else
+        return 0;
 }
 
 /*
@@ -355,7 +361,7 @@ void KThumb::slotGetIntraThumbs()
     const int theight = KdenliveSettings::trackheight();
     const int frameWidth = (int)(theight * m_ratio + 0.5);
     const int displayWidth = (int)(theight * m_dar + 0.5);
-    QString path = m_url.path() + "_";
+    QString path = m_url.path() + '_';
     bool addedThumbs = false;
 
     while (!m_intraFramesQueue.isEmpty()) {