[gegl] Issue #193 - Convolution matrix with channel turned off shifts image ...
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Issue #193 - Convolution matrix with channel turned off shifts image ...
- Date: Mon, 26 Aug 2019 12:59:20 +0000 (UTC)
commit 9992399d46a45b0c8c043d201818bacb697b084b
Author: Ell <ell_se yahoo com>
Date: Mon Aug 26 15:55:42 2019 +0300
Issue #193 - Convolution matrix with channel turned off shifts image ...
... leftward and downwards
Fix the source-buffer offset of filtered-out components, to avoid
incorrectly shifting them.
operations/common/convolution-matrix.c | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/operations/common/convolution-matrix.c b/operations/common/convolution-matrix.c
index ca27c5885..bd0a33261 100644
--- a/operations/common/convolution-matrix.c
+++ b/operations/common/convolution-matrix.c
@@ -212,6 +212,13 @@ normalize_div_off (gfloat matrix[MAX_MATRIX_SIZE][MAX_MATRIX_SIZE],
return valid;
}
+static gint inline
+matrix_center_offset (const GeglRectangle *extended,
+ gint matrix_size)
+{
+ return (extended->width + 1) * (matrix_size / 2);
+}
+
static void inline
convolve_pixel_componentwise (GeglProperties *o,
gfloat *src_buf,
@@ -256,6 +263,7 @@ convolve_pixel_componentwise (GeglProperties *o,
}
else
{
+ s_offset += 4 * matrix_center_offset (extended, matrix_size);
dst_buf[d_offset + i] = src_buf[s_offset + i];
}
}
@@ -406,6 +414,7 @@ convolve_pixel_alpha_weight_componentwise (GeglProperties *o,
}
else
{
+ s_offset += 4 * matrix_center_offset (extended, matrix_size);
sum = src_buf[s_offset + i];
}
dst_buf[d_offset + i] = sum;
@@ -442,6 +451,7 @@ convolve_pixel_alpha_weight_componentwise (GeglProperties *o,
}
else
{
+ s_offset += 4 * matrix_center_offset (extended, matrix_size);
sum = src_buf[s_offset + i];
}
dst_buf[d_offset + i] = sum;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]