From 91dff95b26387c15f5a789b9ecb611432bde70e9 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Tue, 12 Dec 2017 21:26:48 +0100 Subject: [PATCH] Improve speed when pinging a raw image. --- coders/dng.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/coders/dng.c b/coders/dng.c index c37297ad0..c306a6611 100644 --- a/coders/dng.c +++ b/coders/dng.c @@ -305,6 +305,17 @@ static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception) libraw_strerror(errcode),"`%s'",image->filename); return(DestroyImageList(image)); } + image->columns=raw_info->sizes.width; + image->rows=raw_info->sizes.height; + image->page.width=raw_info->sizes.raw_width; + image->page.height=raw_info->sizes.raw_height; + image->page.x=raw_info->sizes.left_margin; + image->page.y=raw_info->sizes.top_margin; + if (image_info->ping != MagickFalse) + { + libraw_close(raw_info); + return(image); + } errcode=libraw_unpack(raw_info); if (errcode != LIBRAW_SUCCESS) { @@ -338,10 +349,6 @@ static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception) image->columns=raw_image->width; image->rows=raw_image->height; image->depth=raw_image->bits; - image->page.width=raw_info->sizes.width; - image->page.height=raw_info->sizes.height; - image->page.x=raw_info->sizes.left_margin; - image->page.y=raw_info->sizes.top_margin; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) { @@ -349,12 +356,6 @@ static Image *ReadDNGImage(const ImageInfo *image_info,ExceptionInfo *exception) libraw_close(raw_info); return(DestroyImageList(image)); } - if (image_info->ping != MagickFalse) - { - libraw_dcraw_clear_mem(raw_image); - libraw_close(raw_info); - return(image); - } p=(unsigned short *) raw_image->data; for (y=0; y < (ssize_t) image->rows; y++) { -- 2.40.0