Ver código fonte

* 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 anos atrás
pai
commit
b5500986b2
1 arquivos alterados com 6 adições e 6 exclusões
  1. +6
    -6
      pipi/dither/floydsteinberg.c

+ 6
- 6
pipi/dither/floydsteinberg.c Ver arquivo

@@ -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;
}
}
}


Carregando…
Cancelar
Salvar