]> git.sesse.net Git - kdenlive/commitdiff
Adapt to MLT image conversion refactorization.
authorDan Dennedy <dan@dennedy.org>
Sat, 4 Jul 2009 21:06:12 +0000 (21:06 +0000)
committerDan Dennedy <dan@dennedy.org>
Sat, 4 Jul 2009 21:06:12 +0000 (21:06 +0000)
svn path=/trunk/kdenlive/; revision=3727

src/kthumb.cpp
src/renderer.cpp
thumbnailer/westleypreview.cpp

index f4f9529a9cf885dce5101858b76709f12da0b8cd..f78ada2cb2526130d2bb25b0134fb823a7ef4eee 100644 (file)
@@ -198,7 +198,7 @@ void KThumb::extractImage(int frame, int frame2)
         return;
     }
     Mlt::Frame *mltFrame;
-    mlt_image_format format = mlt_image_yuv422;
+    mlt_image_format format = mlt_image_rgb24a;
     if (frame != -1) {
         //videoThumbProducer.getThumb(frame);
         m_producer->seek(frame);
@@ -211,23 +211,17 @@ void KThumb::extractImage(int frame, int frame2)
             emit thumbReady(frame, p);
             return;
         } else {
-            int frame_width = 0;
-            int frame_height = 0;
-            mltFrame->set("normalised_height", theight);
-            mltFrame->set("normalised_width", twidth);
+            int frame_width = twidth;
+            int frame_height = theight;
             QPixmap pix(twidth, theight);
             uint8_t *data = mltFrame->get_image(format, frame_width, frame_height, 0);
-            uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
-            mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
-
-            QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+            QImage image((uchar *)data, frame_width, frame_height, QImage::Format_ARGB32);
 
             if (!image.isNull()) {
                 pix = QPixmap::fromImage(image.rgbSwapped());
             } else
                 pix.fill(Qt::red);
 
-            mlt_pool_release(new_image);
             delete mltFrame;
             emit thumbReady(frame, pix);
         }
@@ -241,23 +235,17 @@ void KThumb::extractImage(int frame, int frame2)
             emit thumbReady(frame2, p);
             return;
         } else {
-            int frame_width = 0;
-            int frame_height = 0;
-            mltFrame->set("normalised_height", theight);
-            mltFrame->set("normalised_width", twidth);
+            int frame_width = twidth;
+            int frame_height = theight;
             QPixmap pix(twidth, theight);
             uint8_t *data = mltFrame->get_image(format, frame_width, frame_height, 0);
-            uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
-            mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
-
-            QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+            QImage image((uchar *)data, frame_width, frame_height, QImage::Format_ARGB32);
 
             if (!image.isNull()) {
                 pix = QPixmap::fromImage(image.rgbSwapped());
             } else
                 pix.fill(Qt::red);
 
-            mlt_pool_release(new_image);
             delete mltFrame;
             emit thumbReady(frame2, pix);
         }
@@ -334,24 +322,18 @@ QPixmap KThumb::getFrame(Mlt::Producer *producer, int framepos, int width, int h
         return p;
     }
 
-    mlt_image_format format = mlt_image_yuv422;
-    int frame_width = 0;
-    int frame_height = 0;
-    frame->set("normalised_height", height);
-    frame->set("normalised_width", width);
+    mlt_image_format format = mlt_image_rgb24a;
+    int frame_width = width;
+    int frame_height = height;
     QPixmap pix(width, height);
     uint8_t *data = frame->get_image(format, frame_width, frame_height, 0);
-    uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
-    mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
-
-    QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+    QImage image((uchar *)data, frame_width, frame_height, QImage::Format_ARGB32);
 
     if (!image.isNull()) {
         pix = QPixmap::fromImage(image.rgbSwapped());
     } else
         pix.fill(Qt::red);
 
-    mlt_pool_release(new_image);
     delete frame;
     return pix;
 }
index ba2ff686bc1617cd65f5da6b5ca327846ad59906..0e3a20684e3c0e79fdf23111d5bdc3fc55a2125f 100644 (file)
@@ -626,25 +626,18 @@ void Render::getFileProperties(const QDomElement &xml, const QString &clipId, bo
             else
                 filePropertyMap["type"] = "video";
 
-            mlt_image_format format = mlt_image_yuv422;
-            int frame_width = 0;
-            int frame_height = 0;
-            //frame->set("rescale.interp", "hyper");
-            frame->set("normalised_height", height);
-            frame->set("normalised_width", width);
+            mlt_image_format format = mlt_image_rgb24a;
+            int frame_width = width;
+            int frame_height = height;
             QPixmap pix(width, height);
-
             uint8_t *data = frame->get_image(format, frame_width, frame_height, 0);
-            uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
-            mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
-            QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+            QImage image((uchar *)data, frame_width, frame_height, QImage::Format_ARGB32);
 
             if (!image.isNull()) {
                 pix = QPixmap::fromImage(image.rgbSwapped());
             } else
                 pix.fill(Qt::black);
 
-            mlt_pool_release(new_image);
             emit replyGetImage(clipId, pix);
 
         } else if (frame->get_int("test_audio") == 0) {
index 3b3ae15e90f9acbb4eed1f0cc10eceda9206f01e..ceb77b352903f5649e3def7f03965627e677c32d 100644 (file)
@@ -102,25 +102,18 @@ QImage MltPreview::getFrame(Mlt::Producer *producer, int framepos, int /*width*/
         return result;
     }
 
-    mlt_image_format format = mlt_image_yuv422;
-    int frame_width = 0;
-    int frame_height = 0;
+    mlt_image_format format = mlt_image_rgb24a;
     height = 200;
     double ar = frame->get_double("aspect_ratio");
     if (ar == 0.0) ar = 1.33;
     int calculated_width = (int)((double) height * ar);
-    frame->set("normalised_width", calculated_width);
-    frame->set("normalised_height", height);
-    uint8_t *data = frame->get_image(format, frame_width, frame_height, 0);
-    uint8_t *new_image = (uint8_t *)mlt_pool_alloc(frame_width * (frame_height + 1) * 4);
-    mlt_convert_yuv422_to_rgb24a((uint8_t *)data, new_image, frame_width * frame_height);
-    QImage image((uchar *)new_image, frame_width, frame_height, QImage::Format_ARGB32);
+    uint8_t *data = frame->get_image(format, calculated_width, height, 0);
+    QImage image((uchar *)data, calculated_width, height, QImage::Format_ARGB32);
 
     if (!image.isNull()) {
         result = image.rgbSwapped().convertToFormat(QImage::Format_RGB32);
     }
 
-    mlt_pool_release(new_image);
     delete frame;
     return result;
 }