[gegl] buffer: make bilinear buffer interpolation consistent with others
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] buffer: make bilinear buffer interpolation consistent with others
- Date: Sun, 4 Feb 2018 20:37:38 +0000 (UTC)
commit 549f907b63627071a90232dc7c9a43e094352859
Author: Øyvind Kolås <pippin gimp org>
Date: Sun Feb 4 21:33:45 2018 +0100
buffer: make bilinear buffer interpolation consistent with others
Sorting out mismatch between it - and nearest/boxfilter scaling algorithms
for blitting from GeglBuffer, as reported in bug #793134
gegl/gegl-algorithms-bilinear.inc | 4 ++--
gegl/gegl-algorithms.c | 16 +++++++++-------
2 files changed, 11 insertions(+), 9 deletions(-)
---
diff --git a/gegl/gegl-algorithms-bilinear.inc b/gegl/gegl-algorithms-bilinear.inc
index 1afc62f..b759d75 100644
--- a/gegl/gegl-algorithms-bilinear.inc
+++ b/gegl/gegl-algorithms-bilinear.inc
@@ -17,7 +17,7 @@ BILINEAR_FUNCNAME (guchar *dest_buf,
for (gint x = 0; x < dst_rect->width; x++)
{
- gfloat sx = (dst_rect->x + x) / scale - src_rect->x;
+ gfloat sx = (dst_rect->x + x + 0.5f) / scale - src_rect->x - 0.5f;
jj[x] = int_floorf (sx);
dx[x] = sx - jj[x];
jj[x] *= components;
@@ -25,7 +25,7 @@ BILINEAR_FUNCNAME (guchar *dest_buf,
#define IMPL(...) do{ \
for (gint y = 0; y < dst_rect->height; y++)\
{\
- const gfloat sy = (dst_rect->y + y) / scale - src_rect->y;\
+ const gfloat sy = (dst_rect->y + y + 0.5f) / scale - src_rect->y - 0.5f;\
const gint ii = int_floorf (sy);\
const gfloat dy = (sy - ii);\
const gfloat rdy = 1.0 - dy;\
diff --git a/gegl/gegl-algorithms.c b/gegl/gegl-algorithms.c
index b04bbf4..3ac62cc 100644
--- a/gegl/gegl-algorithms.c
+++ b/gegl/gegl-algorithms.c
@@ -348,7 +348,7 @@ gegl_bilinear_u8_nl (guchar *dest_buf,
for (gint x = 0; x < dst_rect->width; x++)
{
- gfloat sx = (dst_rect->x + x ) / scale - src_rect->x;
+ gfloat sx = (dst_rect->x + x + 0.5f) / scale - src_rect->x - 0.5f;
jj[x] = int_floorf (sx);
dx[x] = (sx - jj[x]);
jj[x] *= components;
@@ -356,7 +356,7 @@ gegl_bilinear_u8_nl (guchar *dest_buf,
#define IMPL(components, ...) do{ \
for (gint y = 0; y < dst_height; y++)\
{\
- const gfloat sy = (dst_y + y ) / scale - src_y;\
+ const gfloat sy = (dst_y + y + 0.5f) / scale - src_y - 0.5f;\
const gint ii = int_floorf (sy);\
const gfloat dy = (sy - ii);\
const gfloat rdy = 1.0f - dy;\
@@ -813,14 +813,16 @@ void gegl_resample_bilinear (guchar *dest_buf,
{
if (comp_type == gegl_babl_u8 ())
{
- const gint bpp = babl_format_get_bytes_per_pixel (format);
- gegl_bilinear_u8_nl (dest_buf, source_buf, dst_rect, src_rect,
- s_rowstride, scale, bpp, d_rowstride);
+ const gint bpp = babl_format_get_bytes_per_pixel (format);
+ gegl_bilinear_u8_nl (dest_buf, source_buf, dst_rect, src_rect,
+ s_rowstride, scale, bpp, d_rowstride);
}
else
{
- gegl_resample_bilinear_generic (dest_buf, source_buf, dst_rect, src_rect,
- s_rowstride, scale, format, d_rowstride);
+ gegl_resample_bilinear_generic (dest_buf, source_buf,
+ dst_rect, src_rect,
+ s_rowstride, scale, format,
+ d_rowstride);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]