X-Git-Url: https://granicus.if.org/sourcecode?a=blobdiff_plain;f=coders%2Fipl.c;h=19db1ddcca7f695253e587bf085860dee79b0648;hb=7beda643d8713ff62ffc17b57e4b1f0d3fc9c523;hp=ae16432788467f650fbe439f184e19d3c313509b;hpb=ab37187df1c707c6eb99e573a9448ce0b164956d;p=imagemagick diff --git a/coders/ipl.c b/coders/ipl.c index ae1643278..19db1ddcc 100644 --- a/coders/ipl.c +++ b/coders/ipl.c @@ -19,7 +19,7 @@ % 2008.05.07 % % v 0.9 % % % -% Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization % +% Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization % % dedicated to making software imaging solutions freely available. % % % % You may not use this file except in compliance with the License. You may % @@ -84,7 +84,8 @@ typedef struct _IPLInfo static MagickBooleanType WriteIPLImage(const ImageInfo *,Image *,ExceptionInfo *); -void increase (void *pixel, int byteType){ +/* +static void increase (void *pixel, int byteType){ switch(byteType){ case 0:(*((unsigned char *) pixel))++; break; case 1:(*((signed int *) pixel))++; break; @@ -93,6 +94,7 @@ void increase (void *pixel, int byteType){ default:(*((unsigned int *) pixel))++; break; } } +*/ /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -161,7 +163,7 @@ static MagickBooleanType IsIPL(const unsigned char *magick,const size_t length) % */ -void SetHeaderFromIPL(Image *image, IPLInfo *ipl){ +static void SetHeaderFromIPL(Image *image, IPLInfo *ipl){ image->columns = ipl->width; image->rows = ipl->height; image->depth = ipl->depth; @@ -302,19 +304,22 @@ static Image *ReadIPLImage(const ImageInfo *image_info,ExceptionInfo *exception) /* Thats all we need if we are pinging. */ if (image_info->ping != MagickFalse) - { - (void) CloseBlob(image); - return(GetFirstImageInList(image)); - } + { + (void) CloseBlob(image); + return(GetFirstImageInList(image)); + } length=image->columns; quantum_type=GetQuantumType(image,exception); do { SetHeaderFromIPL(image, &ipl_info); - if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) + if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; + status=SetImageExtent(image,image->columns,image->rows,exception); + if (status == MagickFalse) + return(DestroyImageList(image)); /* printf("Length: %.20g, Memory size: %.20g\n", (double) length,(double) image->depth); @@ -325,7 +330,7 @@ static Image *ReadIPLImage(const ImageInfo *image_info,ExceptionInfo *exception) status=SetQuantumFormat(image,quantum_info,quantum_format); if (status == MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); - pixels=GetQuantumPixels(quantum_info); + pixels=(unsigned char *) GetQuantumPixels(quantum_info); if(image->columns != ipl_info.width){ /* printf("Columns not set correctly! Wanted: %.20g, got: %.20g\n", @@ -434,14 +439,11 @@ ModuleExport size_t RegisterIPLImage(void) MagickInfo *entry; - entry=SetMagickInfo("IPL"); + entry=AcquireMagickInfo("IPL","IPL","IPL Image Sequence"); entry->decoder=(DecodeImageHandler *) ReadIPLImage; entry->encoder=(EncodeImageHandler *) WriteIPLImage; entry->magick=(IsImageFormatHandler *) IsIPL; - entry->adjoin=MagickTrue; - entry->description=ConstantString("IPL Image Sequence"); - entry->module=ConstantString("IPL"); - entry->endian_support=MagickTrue; + entry->flags|=CoderEndianSupportFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } @@ -538,7 +540,7 @@ static MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image, scene=0; - quantum_info=AcquireQuantumInfo(image_info, image); + quantum_info=AcquireQuantumInfo(image_info,image); if ((quantum_info->format == UndefinedQuantumFormat) && (IsHighDynamicRangeImage(image,exception) != MagickFalse)) SetQuantumFormat(image,quantum_info,FloatingPointQuantumFormat); @@ -575,12 +577,8 @@ static MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image, ipl_info.time = 1; ipl_info.width = (unsigned int) image->columns; ipl_info.height = (unsigned int) image->rows; - - if ((IssRGBColorspace(image->colorspace) == MagickFalse) && - (IsRGBColorspace(image->colorspace) == MagickFalse)) - (void) TransformImageColorspace(image,sRGBColorspace,exception); - - if(IssRGBColorspace(image->colorspace) == MagickTrue) { ipl_info.colors = 3; } + (void) TransformImageColorspace(image,sRGBColorspace,exception); + if(IssRGBCompatibleColorspace(image->colorspace) != MagickFalse) { ipl_info.colors = 3; } else{ ipl_info.colors = 1; } ipl_info.size = (unsigned int) (28 + @@ -620,7 +618,7 @@ static MagickBooleanType WriteIPLImage(const ImageInfo *image_info,Image *image, /* Convert MIFF to IPL raster pixels. */ - pixels=GetQuantumPixels(quantum_info); + pixels=(unsigned char *) GetQuantumPixels(quantum_info); if(ipl_info.colors == 1){ /* Red frame */ for(y = 0; y < (ssize_t) ipl_info.height; y++){