|
@@ -51,17 +51,17 @@ pipi_image_t *pipi_dither_floydsteinberg(pipi_image_t *img, pipi_scan_t scan) |
|
|
dstdata[y * w + x2] = q; |
|
|
dstdata[y * w + x2] = q; |
|
|
|
|
|
|
|
|
/* FIXME: according to our 2008 paper, [7 4 5 0] is a better |
|
|
/* 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) |
|
|
if(x < w - 1) |
|
|
dstdata[y * w + x2 + s] += e * .4375; |
|
|
|
|
|
|
|
|
dstdata[y * w + x2 + s] += e * 7; |
|
|
if(y < h - 1) |
|
|
if(y < h - 1) |
|
|
{ |
|
|
{ |
|
|
if(x > 0) |
|
|
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) |
|
|
if(x < w - 1) |
|
|
dstdata[(y + 1) * w + x2 + s] += e * .0625; |
|
|
|
|
|
|
|
|
dstdata[(y + 1) * w + x2 + s] += e; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|