[gimp/gimp-2-10] plug-ins: fix #1790 Artifacts when opening tif images ...
- From: Jacob Boerema <jboerema src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] plug-ins: fix #1790 Artifacts when opening tif images ...
- Date: Wed, 8 Jun 2022 17:29:31 +0000 (UTC)
commit b061fac229754e8dbda635394484385a3e6a0caa
Author: Jacob Boerema <jgboerema gmail com>
Date: Wed Jun 8 13:22:46 2022 -0400
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.
(cherry picked from commit 94de89febf24ae93034e861c1777cc8592b0c4b4)
plug-ins/file-tiff/file-tiff-load.c | 87 +++++++++++++++----------------------
1 file changed, 36 insertions(+), 51 deletions(-)
---
diff --git a/plug-ins/file-tiff/file-tiff-load.c b/plug-ins/file-tiff/file-tiff-load.c
index c88e9a2ea0..24c0257952 100644
--- a/plug-ins/file-tiff/file-tiff-load.c
+++ b/plug-ins/file-tiff/file-tiff-load.c
@@ -2478,26 +2478,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;
-
- while (x >= 8)
- {
- memcpy (dest, bit2byte + *src * 8, 8);
- dest += 8;
- x -= 8;
- src++;
- }
+ 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++;
}
}
@@ -2507,26 +2502,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;
-
- while (x >= 4)
- {
- memcpy (dest, _2bit2byte + *src * 4, 4);
- dest += 4;
- x -= 4;
- src++;
- }
+ 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++;
}
}
@@ -2536,26 +2526,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;
-
- while (x >= 2)
- {
- memcpy (dest, _4bit2byte + *src * 2, 2);
- dest += 2;
- x -= 2;
- src++;
- }
+ 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++;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]