summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-06-05 11:59:13 +0100
committerCarl Hetherington <cth@carlh.net>2014-06-05 11:59:13 +0100
commit78b708f94d12b460d099a4323dd1ae7988672493 (patch)
tree2a3e05ba9d8ea506df8d74d9474b735679a47881
parentb60186064405914b41780021f74dd7830f2ffecb (diff)
Use Magick::Image::write rather than a hand-made loop; much faster.
-rw-r--r--ChangeLog2
-rw-r--r--src/lib/image_proxy.cc14
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 <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.
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;