From 78b708f94d12b460d099a4323dd1ae7988672493 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 5 Jun 2014 11:59:13 +0100 Subject: [PATCH] Use Magick::Image::write rather than a hand-made loop; much faster. --- ChangeLog | 2 ++ src/lib/image_proxy.cc | 14 ++------------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index c6db10402..576fa0d39 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2014-06-05 Carl Hetherington + * 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. diff --git a/src/lib/image_proxy.cc b/src/lib/image_proxy.cc index 230bfacad..dbfd8c6d4 100644 --- a/src/lib/image_proxy.cc +++ b/src/lib/image_proxy.cc @@ -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; -- 2.30.2