% Read/Write 16bit/pixel Interleaved YUV Image Format %
% %
% Software Design %
-% John Cristy %
+% Cristy %
% July 1992 %
% %
% %
-% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2018 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 %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
Forward declarations.
*/
static MagickBooleanType
- WriteUYVYImage(const ImageInfo *,Image *);
+ WriteUYVYImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Open image file.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
- assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ assert(exception->signature == MagickCoreSignature);
+ image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
if ((image->columns % 2) != 0)
image->columns++;
- (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent);
+ (void) CopyMagickString(image->filename,image_info->filename,MagickPathExtent);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
return((Image *) NULL);
(void) CloseBlob(image);
return(GetFirstImageInList(image));
}
+ status=SetImageExtent(image,image->columns,image->rows,exception);
+ if (status == MagickFalse)
+ return(DestroyImageList(image));
/*
Accumulate UYVY, then unpack into two pixels.
*/
for (y=0; y < (ssize_t) image->rows; y++)
{
q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
- if (q == (const Quantum *) NULL)
+ if (q == (Quantum *) NULL)
break;
for (x=0; x < (ssize_t) (image->columns >> 1); x++)
{
if (status == MagickFalse)
break;
}
- image->colorspace=YCbCrColorspace;
+ SetImageColorspace(image,YCbCrColorspace,exception);
if (EOFBlob(image) != MagickFalse)
ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
image->filename);
MagickInfo
*entry;
- entry=SetMagickInfo("PAL");
+ entry=AcquireMagickInfo("UYVY","PAL","16bit/pixel interleaved YUV");
entry->decoder=(DecodeImageHandler *) ReadUYVYImage;
entry->encoder=(EncodeImageHandler *) WriteUYVYImage;
- entry->adjoin=MagickFalse;
- entry->raw=MagickTrue;
- entry->endian_support=MagickTrue;
- entry->description=ConstantString("16bit/pixel interleaved YUV");
- entry->module=ConstantString("UYVY");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderRawSupportFlag;
+ entry->flags|=CoderEndianSupportFlag;
(void) RegisterMagickInfo(entry);
- entry=SetMagickInfo("UYVY");
+ entry=AcquireMagickInfo("UYVY","UYVY","16bit/pixel interleaved YUV");
entry->decoder=(DecodeImageHandler *) ReadUYVYImage;
entry->encoder=(EncodeImageHandler *) WriteUYVYImage;
- entry->adjoin=MagickFalse;
- entry->raw=MagickTrue;
- entry->endian_support=MagickTrue;
- entry->description=ConstantString("16bit/pixel interleaved YUV");
- entry->module=ConstantString("UYVY");
+ entry->flags^=CoderAdjoinFlag;
+ entry->flags|=CoderRawSupportFlag;
+ entry->flags|=CoderEndianSupportFlag;
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
% The format of the WriteUYVYImage method is:
%
% MagickBooleanType WriteUYVYImage(const ImageInfo *image_info,
-% Image *image)
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows.
%
% o image_info: the image info.
%
-% o image: The image.
-% Implicit assumption: number of columns is even.
+% o image: The image. Implicit assumption: number of columns is even.
+%
+% o exception: return any errors or warnings in this structure.
%
*/
static MagickBooleanType WriteUYVYImage(const ImageInfo *image_info,
- Image *image)
+ Image *image,ExceptionInfo *exception)
{
PixelInfo
pixel;
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
- assert(image_info->signature == MagickSignature);
+ assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if ((image->columns % 2) != 0)
image->columns++;
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickCoreSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
/*
Accumulate two pixels, then output.
*/
- uyvy_image=CloneImage(image,0,0,MagickTrue,&image->exception);
+ uyvy_image=CloneImage(image,0,0,MagickTrue,exception);
if (uyvy_image == (Image *) NULL)
- ThrowWriterException(ResourceLimitError,image->exception.reason);
- (void) TransformImageColorspace(uyvy_image,YCbCrColorspace);
+ return(MagickFalse);
+ (void) TransformImageColorspace(uyvy_image,YCbCrColorspace,exception);
full=MagickFalse;
(void) ResetMagickMemory(&pixel,0,sizeof(PixelInfo));
for (y=0; y < (ssize_t) image->rows; y++)
{
- p=GetVirtualPixels(uyvy_image,0,y,image->columns,1,&image->exception);
+ p=GetVirtualPixels(uyvy_image,0,y,image->columns,1,exception);
if (p == (const Quantum *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)