Browse Source

* floydsteinberg.c: minor optimisation in the FStein error propagation.

git-svn-id: file:///srv/caca.zoy.org/var/lib/svn/libpipi/trunk@2699 92316355-f0b4-4df1-b90c-862c8a59935f
remotes/tiles
sam 16 years ago
parent
commit
b5500986b2
1 changed files with 6 additions and 6 deletions
  1. +6
    -6
      pipi/dither/floydsteinberg.c

+ 6
- 6
pipi/dither/floydsteinberg.c View File

@@ -51,17 +51,17 @@ pipi_image_t *pipi_dither_floydsteinberg(pipi_image_t *img, pipi_scan_t scan)
dstdata[y * w + x2] = q;

/* FIXME: according to our 2008 paper, [7 4 5 0] is a better
* error diffusion kernel for serpentine scan. */
e = p - q;
* error diffusion kernel for serpentine scan than [7 3 5 1]. */
e = (p - q) / 16;
if(x < w - 1)
dstdata[y * w + x2 + s] += e * .4375;
dstdata[y * w + x2 + s] += e * 7;
if(y < h - 1)
{
if(x > 0)
dstdata[(y + 1) * w + x2 - s] += e * .1875;
dstdata[(y + 1) * w + x2] += e * .3125;
dstdata[(y + 1) * w + x2 - s] += e * 3;
dstdata[(y + 1) * w + x2] += e * 5;
if(x < w - 1)
dstdata[(y + 1) * w + x2 + s] += e * .0625;
dstdata[(y + 1) * w + x2 + s] += e;
}
}
}


Loading…
Cancel
Save