]> granicus.if.org Git - imagemagick/commitdiff
Improve speed when pinging a raw image.
authorDirk Lemstra <dirk@git.imagemagick.org>
Tue, 12 Dec 2017 20:26:48 +0000 (21:26 +0100)
committerDirk Lemstra <dirk@git.imagemagick.org>
Tue, 12 Dec 2017 20:27:22 +0000 (21:27 +0100)
coders/dng.c

index c37297ad0d0d17b26157a798885ddb6ec7a8b149..c306a661188879939318dc1e868fc0b4bf6d6de6 100644 (file)
@@ -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++)
     {