The environment is an embedded DaVinci (DM6446) architecture, using FC6 as the host, and cross compiling all the libraries. The version of IM is 6.8.4-8 (downloaded on April 10th).
Basically an encoder passes a JPEG image in memory as a char*. I have verified the image is valid as the SOI (0xff,0xd8) and EOI (0xff,0xd9) bytes are being passed properly, and that MagickReadImageBlob() seems stuck in an endless loop.
I have asked about MAGICK_DEBUG and where to place it (either in a Makefile or export it in the target or host environment). I have tried adding -DMAGICK_DEBUG to CFLAGS and 'export MAGICK_DEBUG=1' to no avail.
Here is the code I use.
Code: Select all
void Zoom_in_on_image (char *Image_Buffer; private_image_data_t *Image_struct)
{
MagickBooleanType status;
MagickWand *magick_wand;
ExceptionInfo *exception;
ImageInfo *image_info;
ExceptionType an_error;
int j=0;
size_t iLen=0, iSize=0;
unsigned char *IM_Image_Buffer;
// Routine enters with a
// char * Image_Buffer ( pointer to the jpeg image)
// and an Image_struct which has data on the image like .img_size, .geometry members
// from an outside encoder
// The Image structure also has (for the decoder) .data and a .queue members
iSize = Image_struct.img_size;
printf("Beginning bytes, [0]=0x%X, [1]=0x%X\n",Image_Buffer[0],Image_Bufferf[1] );
// *** These bytes are 0xFF and 0xD8 *** which are the right bytes (SOI) for a JPEG
printf( "last 2 bytes = [0x%X], [0x%X]\n",Image_Buffer[iSize-2],Image_Buffer[iSize-1] );
// *** These bytes are 0xFF and 0xD9 *** which are the right bytes (EOI) for a JPEG
// Start of ImageMagicK code
MagickWandGenesis ();
magick_wand = NewMagickWand();
MagickGetException ( magick_wand, &an_error);
if (an_error)
printf( "Error in creating wand\n")
// Clear wand space
ClearMagickWand (magick_wand);
// Tell ImageMagick it is a jpeg
MagickSetFormat ( magick_wand, "JPG" );
// Read image into wand
// The failure is here **** Seems to be caught in a loop ***** Never gets past this point. *****
// NOTE: If I use &Image_Buffer it will complain that it is not a jpeg, so I know it passes the JPEG test going into this API.
printf( "At ReadImageBlob\n");
status = MagickReadImageBlob ( magick_wand, Image_Buffer, iSize);
MagickGetException ( magick_wand, &an_error);
if (an_error)
{
ExceptionType severity;
char *err = MagickGetException(magick_wand, &severity);
printf( "ImageMagickReadImageBlob Error:[%s]", err);
MagickRelinquishMemory(err);
}
if (status)
{
printf("MagicReadImageBlob returned error=[%d]\n",status);
}
[ Zoom code goes here, but since I never get past the MagickReadImageBlob, it would be irrelevant to post it]
MagickWandTerminus();
Thanks in advance.
Glen