Use Magick::Image::write rather than a hand-made loop; much faster.
authorCarl Hetherington <cth@carlh.net>
Thu, 5 Jun 2014 10:59:13 +0000 (11:59 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 5 Jun 2014 10:59:13 +0000 (11:59 +0100)
ChangeLog
src/lib/image_proxy.cc

index c6db1040220b643a078a23c260ab098f62aef48a..576fa0d399795c733f9bb806294c283c371ed2c2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2014-06-05  Carl Hetherington  <cth@carlh.net>
 
+       * Large speed-up to multi-image source file decoding.
+
        * Back-port changes from v2 which work out how separate
        audio files should be resampled by looking at the video
        files which are present at the same time.
index 230bfacadc51cfba2dcf6eeb76b281da95e895cd..dbfd8c6d4ed48038eeac2b83e6a8fffe558d3da4 100644 (file)
@@ -134,18 +134,8 @@ MagickImageProxy::image () const
        _image.reset (new Image (PIX_FMT_RGB24, size, true));
 
        using namespace MagickCore;
-       
-       uint8_t* p = _image->data()[0];
-       for (int y = 0; y < size.height; ++y) {
-               uint8_t* q = p;
-               for (int x = 0; x < size.width; ++x) {
-                       Magick::Color c = magick_image->pixelColor (x, y);
-                       *q++ = c.redQuantum() * 255 / QuantumRange;
-                       *q++ = c.greenQuantum() * 255 / QuantumRange;
-                       *q++ = c.blueQuantum() * 255 / QuantumRange;
-               }
-               p += _image->stride()[0];
-       }
+
+       magick_image->write (0, 0, size.width, size.height, "RGB", CharPixel, _image->data()[0]);
 
        delete magick_image;