From b5500986b29185d4b156e5182d2cb13f95130d29 Mon Sep 17 00:00:00 2001 From: sam Date: Mon, 11 Aug 2008 20:02:29 +0000 Subject: [PATCH] * 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 --- pipi/dither/floydsteinberg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pipi/dither/floydsteinberg.c b/pipi/dither/floydsteinberg.c index 2bfca37..b77fc96 100644 --- a/pipi/dither/floydsteinberg.c +++ b/pipi/dither/floydsteinberg.c @@ -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; } } }