plug-ins: fix #1790 Artifacts when opening tif images ...
generated by matlabs blocproc function Based on the suggested solution by Massimo, we should not compute the remaining pixels per line but only at the end of the whole block, be it tile or scanline. I have not been able to find bw or palette examples that use load_separate instead of load_contiguous, so that case is not tested. But, it also doesn't make much sense to have planar when you have just one plane.
This commit is contained in:
parent
3e6237030c
commit
94de89febf
1 changed files with 36 additions and 51 deletions
|
|
@ -2518,26 +2518,21 @@ convert_bit2byte (const guchar *src,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gint y;
|
||||
gint64 x = width * height;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
while (x >= 8)
|
||||
{
|
||||
gint x = width;
|
||||
memcpy (dest, bit2byte + *src * 8, 8);
|
||||
dest += 8;
|
||||
x -= 8;
|
||||
src++;
|
||||
}
|
||||
|
||||
while (x >= 8)
|
||||
{
|
||||
memcpy (dest, bit2byte + *src * 8, 8);
|
||||
dest += 8;
|
||||
x -= 8;
|
||||
src++;
|
||||
}
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
memcpy (dest, bit2byte + *src * 8, x);
|
||||
dest += x;
|
||||
src++;
|
||||
}
|
||||
if (x > 0)
|
||||
{
|
||||
memcpy (dest, bit2byte + *src * 8, x);
|
||||
dest += x;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2547,26 +2542,21 @@ convert_2bit2byte (const guchar *src,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gint y;
|
||||
gint64 x = width * height;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
while (x >= 4)
|
||||
{
|
||||
gint x = width;
|
||||
memcpy (dest, _2bit2byte + *src * 4, 4);
|
||||
dest += 4;
|
||||
x -= 4;
|
||||
src++;
|
||||
}
|
||||
|
||||
while (x >= 4)
|
||||
{
|
||||
memcpy (dest, _2bit2byte + *src * 4, 4);
|
||||
dest += 4;
|
||||
x -= 4;
|
||||
src++;
|
||||
}
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
memcpy (dest, _2bit2byte + *src * 4, x);
|
||||
dest += x;
|
||||
src++;
|
||||
}
|
||||
if (x > 0)
|
||||
{
|
||||
memcpy (dest, _2bit2byte + *src * 4, x);
|
||||
dest += x;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2576,26 +2566,21 @@ convert_4bit2byte (const guchar *src,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
gint y;
|
||||
gint64 x = width * height;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
while (x >= 2)
|
||||
{
|
||||
gint x = width;
|
||||
memcpy (dest, _4bit2byte + *src * 2, 2);
|
||||
dest += 2;
|
||||
x -= 2;
|
||||
src++;
|
||||
}
|
||||
|
||||
while (x >= 2)
|
||||
{
|
||||
memcpy (dest, _4bit2byte + *src * 2, 2);
|
||||
dest += 2;
|
||||
x -= 2;
|
||||
src++;
|
||||
}
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
memcpy (dest, _4bit2byte + *src * 2, x);
|
||||
dest += x;
|
||||
src++;
|
||||
}
|
||||
if (x > 0)
|
||||
{
|
||||
memcpy (dest, _4bit2byte + *src * 2, x);
|
||||
dest += x;
|
||||
src++;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue