[gegl] Revert "algorithms: re-arrange pointer arithmetic and loops in downscale_2x2 functions"
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] Revert "algorithms: re-arrange pointer arithmetic and loops in downscale_2x2 functions"
- Date: Mon, 9 Apr 2018 01:57:49 +0000 (UTC)
commit 08529dfb53cbd06b099febf66e418d0b565e563e
Author: Øyvind Kolås <pippin gimp org>
Date: Mon Apr 9 03:56:39 2018 +0200
Revert "algorithms: re-arrange pointer arithmetic and loops in downscale_2x2 functions"
This reverts accidentally commited 37af1f48abd685cde9259ecf4a771f1424076646.
gegl/gegl-algorithms.c | 28 ++++++++++++++++------------
perf/test-gegl-buffer-access.c | 19 ++-----------------
2 files changed, 18 insertions(+), 29 deletions(-)
---
diff --git a/gegl/gegl-algorithms.c b/gegl/gegl-algorithms.c
index 3f33741..fd008bf 100644
--- a/gegl/gegl-algorithms.c
+++ b/gegl/gegl-algorithms.c
@@ -467,10 +467,6 @@ gegl_bilinear_u8_nl (guchar *dest_buf,
const gint components,
const gint d_rowstride)
{
- /* performance optimizations notes:
- * replacing the floating point fractions with fixed point arithmetic
- * slows things down.
- */
const gint ver = s_rowstride;
const gint diag = ver + components;
const gint dst_y = dst_rect->y;
@@ -838,15 +834,16 @@ gegl_downscale_2x2_u8_rgba (const Babl *format,
for (y = 0; y < src_height / 2; y++)
{
gint x;
- guchar *aa = src_data + src_rowstride * y * 2;
+ guchar *src = src_data + src_rowstride * y * 2;
guchar *dst = dst_data + dst_rowstride * y;
+ uint8_t * aa = ((uint8_t *)(src));
+ uint8_t * ab = ((uint8_t *)(src + bpp));
+ uint8_t * ba = ((uint8_t *)(src + src_rowstride));
+ uint8_t * bb = ((uint8_t *)(src + diag));
for (x = 0; x < src_width / 2; x++)
{
- uint8_t * ab = ((uint8_t *)(aa + bpp));
- uint8_t * ba = ((uint8_t *)(aa + src_rowstride));
- uint8_t * bb = ((uint8_t *)(aa + diag));
((uint8_t *)dst)[0] = lut_u16_to_u8[ (lut_u8_to_u16[aa[0]] +
lut_u8_to_u16[ab[0]] +
@@ -864,6 +861,9 @@ gegl_downscale_2x2_u8_rgba (const Babl *format,
dst += bpp;
aa += bpp * 2;
+ ab += bpp * 2;
+ ba += bpp * 2;
+ bb += bpp * 2;
}
}
}
@@ -887,15 +887,16 @@ gegl_downscale_2x2_u8_rgb (const Babl *format,
for (y = 0; y < src_height / 2; y++)
{
gint x;
- guchar *aa = src_data + src_rowstride * y * 2;
+ guchar *src = src_data + src_rowstride * y * 2;
guchar *dst = dst_data + dst_rowstride * y;
+ uint8_t * aa = ((uint8_t *)(src));
+ uint8_t * ab = ((uint8_t *)(src + bpp));
+ uint8_t * ba = ((uint8_t *)(src + src_rowstride));
+ uint8_t * bb = ((uint8_t *)(src + diag));
for (x = 0; x < src_width / 2; x++)
{
- uint8_t * ab = ((uint8_t *)(aa + bpp));
- uint8_t * ba = ((uint8_t *)(aa + src_rowstride));
- uint8_t * bb = ((uint8_t *)(aa + diag));
((uint8_t *)dst)[0] = lut_u16_to_u8[ (lut_u8_to_u16[aa[0]] +
lut_u8_to_u16[ab[0]] +
@@ -911,6 +912,9 @@ gegl_downscale_2x2_u8_rgb (const Babl *format,
lut_u8_to_u16[bb[2]])>>2 ];
dst += bpp;
aa += bpp * 2;
+ ab += bpp * 2;
+ ba += bpp * 2;
+ bb += bpp * 2;
}
}
}
diff --git a/perf/test-gegl-buffer-access.c b/perf/test-gegl-buffer-access.c
index 11c5d2d..b523f6d 100644
--- a/perf/test-gegl-buffer-access.c
+++ b/perf/test-gegl-buffer-access.c
@@ -8,7 +8,7 @@ main (gint argc,
{
GeglBuffer *buffer;
GeglRectangle bound = {0, 0, 1024, 1024};
- GeglRectangle bound2 = {0, 0, 341, 341};
+ GeglRectangle bound2 = {0, 0, 300, 300};
const Babl *format;
guchar *sbuf;
guchar *buf;
@@ -101,6 +101,7 @@ main (gint argc,
test_end ("nearest 0.333", 1.0 * bound2.width * bound2.height * ITERATIONS * 4);
+
{
const Babl *format = babl_format ("R'G'B'A u8");
GeglBuffer *buffer = gegl_buffer_new (&bound, format);
@@ -117,22 +118,6 @@ main (gint argc,
}
test_end ("bilinear 0.333", 1.0 * bound2.width * bound2.height * ITERATIONS * 4);
- {
- const Babl *format = babl_format ("R'G'B'A u8");
- GeglBuffer *buffer = gegl_buffer_new (&bound, format);
- test_start ();
- for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
- {
- /* pre-initialize */
- gegl_buffer_set (buffer, &bound, 0, NULL, sbuf, GEGL_AUTO_ROWSTRIDE);
- test_start_iter ();
- gegl_buffer_get (buffer, &bound2, 0.333, NULL, buf, GEGL_AUTO_ROWSTRIDE,
GEGL_ABYSS_NONE|GEGL_BUFFER_FILTER_BILINEAR);
- test_end_iter ();
- }
- g_object_unref (buffer);
- }
- test_end ("mip+bilin 0.333", 1.0 * bound2.width * bound2.height * ITERATIONS * 4);
-
test_start ();
for (i=0;i<ITERATIONS && converged < BAIL_COUNT;i++)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]