[gegl] gegl: reduce memory accesses in generic 2x2 downscale
- From: Øyvind Kolås <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] gegl: reduce memory accesses in generic 2x2 downscale
- Date: Sun, 28 Jan 2018 20:58:51 +0000 (UTC)
commit 0a23bc3a395c7affa44fe7058f6dacc6b329223f
Author: Øyvind Kolås <pippin gimp org>
Date: Sat Jan 27 01:29:11 2018 +0100
gegl: reduce memory accesses in generic 2x2 downscale
gegl/gegl-algorithms-2x2-downscale.inc | 30 +++++++++++++++---------------
1 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/gegl/gegl-algorithms-2x2-downscale.inc b/gegl/gegl-algorithms-2x2-downscale.inc
index bdea195..e2a8cc7 100644
--- a/gegl/gegl-algorithms-2x2-downscale.inc
+++ b/gegl/gegl-algorithms-2x2-downscale.inc
@@ -29,9 +29,9 @@ DOWNSCALE_FUNCNAME (const Babl *format,
for (x = 0; x < src_width / 2; x++)
{
DOWNSCALE_TYPE * aa = ((DOWNSCALE_TYPE *)(src));
- DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)(src + bpp));
- DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)(src + src_rowstride));
- DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)(src + diag));
+ DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)((guchar*)(aa) + bpp));
+ DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)((guchar*)(aa) + src_rowstride));
+ DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)((guchar*)(aa) + diag));
((DOWNSCALE_TYPE *)dst)[0] = (S(aa[0]) + S(ab[0]) + S(ba[0]) + S(bb[0])) / DOWNSCALE_DIVISOR;
@@ -50,9 +50,9 @@ DOWNSCALE_FUNCNAME (const Babl *format,
for (x = 0; x < src_width / 2; x++)
{
DOWNSCALE_TYPE * aa = ((DOWNSCALE_TYPE *)(src));
- DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)(src + bpp));
- DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)(src + src_rowstride));
- DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)(src + diag));
+ DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)((guchar*)(aa) + bpp));
+ DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)((guchar*)(aa) + src_rowstride));
+ DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)((guchar*)(aa) + diag));
((DOWNSCALE_TYPE *)dst)[0] = (S(aa[0]) + S(ab[0]) + S(ba[0]) +
S(bb[0])) / DOWNSCALE_DIVISOR;
@@ -74,9 +74,9 @@ DOWNSCALE_FUNCNAME (const Babl *format,
for (x = 0; x < src_width / 2; x++)
{
DOWNSCALE_TYPE * aa = ((DOWNSCALE_TYPE *)(src));
- DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)(src + bpp));
- DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)(src + src_rowstride));
- DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)(src + diag));
+ DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)((guchar*)(aa) + bpp));
+ DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)((guchar*)(aa) + src_rowstride));
+ DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)((guchar*)(aa) + diag));
((DOWNSCALE_TYPE *)dst)[0] =
(S(aa[0]) + S(ab[0]) + S(ba[0]) + S(bb[0])) / DOWNSCALE_DIVISOR;
@@ -100,9 +100,9 @@ DOWNSCALE_FUNCNAME (const Babl *format,
for (x = 0; x < src_width / 2; x++)
{
DOWNSCALE_TYPE * aa = ((DOWNSCALE_TYPE *)(src));
- DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)(src + bpp));
- DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)(src + src_rowstride));
- DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)(src + diag));
+ DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)((guchar*)(aa) + bpp));
+ DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)((guchar*)(aa) + src_rowstride));
+ DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)((guchar*)(aa) + diag));
((DOWNSCALE_TYPE *)dst)[0] =
(S(aa[0]) + S(ab[0]) + S(ba[0]) + S(bb[0])) / DOWNSCALE_DIVISOR;
@@ -129,9 +129,9 @@ DOWNSCALE_FUNCNAME (const Babl *format,
{
gint i;
DOWNSCALE_TYPE * aa = ((DOWNSCALE_TYPE *)(src));
- DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)(src + bpp));
- DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)(src + src_rowstride));
- DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)(src + diag));
+ DOWNSCALE_TYPE * ab = ((DOWNSCALE_TYPE *)((guchar*)(aa) + bpp));
+ DOWNSCALE_TYPE * ba = ((DOWNSCALE_TYPE *)((guchar*)(aa) + src_rowstride));
+ DOWNSCALE_TYPE * bb = ((DOWNSCALE_TYPE *)((guchar*)(aa) + diag));
for (i = 0; i < components; i++)
((DOWNSCALE_TYPE *)dst)[i] =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]