[prev in list] [next in list] [prev in thread] [next in thread] 

List:       imagemagick-developer
Subject:    JPEG coder bug? or an enhancement request?
From:       rbennett () au1 ! ibm ! com
Date:       2000-08-25 2:00:13
[Download RAW message or body]


In debugging a recent problem I had reason to plod through the coder
source for Jpegs.  In my opinion, the JPEG coder incorrectly issues
WarningDelegate exceptions for all errors issued by the jpeg library.

According to the jpeg library documentation

"The JPEG library never writes any message directly; it always goes
 through the error handling routines.  Three classes of messages are
 recognized:
   * Fatal errors: the library cannot continue.
   * Warnings: the library can continue, but the data is corrupt, and a
     damaged output image is likely to result.
   * Trace/informational messages.  These come with a trace level
     indicating the importance of the message; you can control the
     verbosity of the program by adjusting the maximum trace level that
     will be displayed."

Based on the JPEG library definitions, JPEG library messages of level
-1 should throw a WarningCorruptImage exception instead of a
DelegateWarning.  The modified code would look:

static unsigned int EmitMessage(j_common_ptr jpeg_info,int level)
{
  char
    message[JMSG_LENGTH_MAX];

  Image
    *image;

  (jpeg_info->err->format_message)(jpeg_info,message);
  image=(Image *) jpeg_info->client_data;
  if (level < 0)
    {
      if ((jpeg_info->err->num_warnings == 0) ||
          (jpeg_info->err->trace_level >= 3))
        ThrowBinaryException(CorruptImageWarning,(char *)
message,image->filename);
        // ThrowBinaryException(DelegateWarning,(char *)
message,image->filename);
      jpeg_info->err->num_warnings++;
    }
  else
    if (jpeg_info->err->trace_level >= level)
      ThrowBinaryException(DelegateWarning,(char *)
message,image->filename);
  return(True);
}

Rob Bennett
Advisory Support Specialist - Tivoli Storage Manager (ADSM)
IBM Support Centre
Business Phone 61-8-9261 8457  Mobile:  61 411 138 630   Fax: 61-8-9261
8536   Home Phone 61-8-9305 6435



***********************************************************************
To remove yourself from this mailing list, send mail to:
	majordomo@imagemagick.org

Include the following command in the body of your message:
	unsubscribe magick-developer
***********************************************************************

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic