Reading a file including some scenes, it has same problem at all partition type.
And at PartitionInterlace , it occurs endless loop.
I made a patch about thease problems, And it is good for "None","Line" and "Plane" interlace.
But,,, at PartitionInterlace, it was able to evade "endless loop" but it only recognized the last scene.
I don't know why?
this is my patch for Version 6.4.4-1
Code: Select all
*** rgb.c.orig 2008-09-20 12:33:28.000000000 +0900
--- rgb.c 2008-10-03 16:22:57.000000000 +0900
***************
*** 130,135 ****
--- 130,138 ----
unsigned char
*pixels;
+ int
+ scene;
+
/*
Open image file.
*/
***************
*** 190,195 ****
--- 193,199 ----
break;
}
}
+ scene=0;
do
{
/*
***************
*** 209,218 ****
/*
No interlacing: RGBRGBRGBRGBRGBRGB...
*/
! length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
! count=ReadBlob(image,length,pixels);
! if (count != (ssize_t) length)
! break;
for (y=0; y < (long) image->extract_info.height; y++)
{
q=GetImagePixels(canvas_image,0,0,canvas_image->columns,1);
--- 213,225 ----
/*
No interlacing: RGBRGBRGBRGBRGBRGB...
*/
! if (scene == 0)
! {
! length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
! count=ReadBlob(image,length,pixels);
! if (count != (ssize_t) length)
! break;
! }
for (y=0; y < (long) image->extract_info.height; y++)
{
q=GetImagePixels(canvas_image,0,0,canvas_image->columns,1);
***************
*** 269,278 ****
/*
Line interlacing: RRR...GGG...BBB...RRR...GGG...BBB...
*/
! length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
! count=ReadBlob(image,length,pixels);
! if (count != (ssize_t) length)
! break;
for (y=0; y < (long) image->extract_info.height; y++)
{
for (i=0; i < (image->matte != MagickFalse ? 4 : 3); i++)
--- 276,288 ----
/*
Line interlacing: RRR...GGG...BBB...RRR...GGG...BBB...
*/
! if (scene == 0)
! {
! length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
! count=ReadBlob(image,length,pixels);
! if (count != (ssize_t) length)
! break;
! }
for (y=0; y < (long) image->extract_info.height; y++)
{
for (i=0; i < (image->matte != MagickFalse ? 4 : 3); i++)
***************
*** 345,355 ****
"UnexpectedEndOfFile",image->filename);
break;
}
}
- length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
- count=ReadBlob(image,length,pixels);
- if (count != (ssize_t) length)
- break;
for (y=0; y < (long) image->extract_info.height; y++)
{
q=GetImagePixels(canvas_image,0,0,canvas_image->columns,1);
--- 355,384 ----
"UnexpectedEndOfFile",image->filename);
break;
}
+ /* Skip Images */
+ for (i=0; i< scene; i++)
+ {
+ for(y=0; y < (long) image->extract_info.height; y++)
+ {
+ length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
+ count=ReadBlob(image,length,pixels);
+ }
+ }
+ length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
+ count=ReadBlob(image,length,pixels);
+ if (count != (ssize_t) length)
+ break;
+ }
+ else /* Interlace == PlaneInterlace */
+ {
+ if (scene == 0)
+ {
+ length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
+ count=ReadBlob(image,length,pixels);
+ if (count != (ssize_t) length)
+ break;
+ }
}
for (y=0; y < (long) image->extract_info.height; y++)
{
q=GetImagePixels(canvas_image,0,0,canvas_image->columns,1);
***************
*** 397,402 ****
--- 426,441 ----
image=DestroyImageList(image);
return((Image *) NULL);
}
+ /* Skip Images */
+ for (i=0; i< scene; i++)
+ {
+ for(y=0; y < (long) image->extract_info.height; y++)
+ {
+ length=GetQuantumExtent(canvas_image,
+ quantum_info,GreenQuantum);
+ count=ReadBlob(image,length,pixels);
+ }
+ }
length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
count=ReadBlob(image,length,pixels);
if (count != (ssize_t) length)
***************
*** 449,454 ****
--- 488,503 ----
image=DestroyImageList(image);
return((Image *) NULL);
}
+ /* Skip Images */
+ for (i=0; i< scene; i++)
+ {
+ for(y=0; y < (long) image->extract_info.height; y++)
+ {
+ length=GetQuantumExtent(canvas_image,
+ quantum_info,BlueQuantum);
+ count=ReadBlob(image,length,pixels);
+ }
+ }
length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
count=ReadBlob(image,length,pixels);
if (count != (ssize_t) length)
***************
*** 503,508 ****
--- 552,567 ----
image=DestroyImageList(image);
return((Image *) NULL);
}
+ /* Skip Images */
+ for (i=0; i< scene; i++)
+ {
+ for(y=0; y < (long) image->extract_info.height; y++)
+ {
+ length=GetQuantumExtent(canvas_image,
+ quantum_info,AlphaQuantum);
+ count=ReadBlob(image,length,pixels);
+ }
+ }
length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
count=ReadBlob(image,length,pixels);
if (count != (ssize_t) length)
***************
*** 579,584 ****
--- 638,644 ----
if (status == MagickFalse)
break;
}
+ scene++;
} while (count == (ssize_t) length);
InheritException(exception,&image->exception);
quantum_info=DestroyQuantumInfo(quantum_info);