From c0b89ac5bfb90835ef01573267020e42d4fe070c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 23 Aug 2015 12:17:05 +0200 Subject: Imported Upstream version 1.8.0 --- render/thscreen.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) mode change 100644 => 100755 render/thscreen.c (limited to 'render/thscreen.c') diff --git a/render/thscreen.c b/render/thscreen.c old mode 100644 new mode 100755 index 8523e38..7c115f3 --- a/render/thscreen.c +++ b/render/thscreen.c @@ -130,6 +130,16 @@ void screen_edscreens( for (; ip != ein1; ip += pinc, op += pinc, x += xinc) { double ov[THMXCH2D], tv[THMXCH2D], ev[THMXCH2D]; + /* Limit error propogation if asked */ + if (t->mxerr != 0.0) { + for (j = 0; j < t->np; j++) { + if (t->ebuf[j][x] < -t->mxerr) + t->ebuf[j][x] = -t->mxerr; + else if (t->ebuf[j][x] > t->mxerr) + t->ebuf[j][x] = t->mxerr; + } + } + /* For each plane */ for (j = 0; j < t->np; j++) { tv[j] = t->luts[j][ip[j]] / 65535.0; /* 0.0 - 1.0 value */ @@ -253,7 +263,8 @@ thscreens *new_thscreens( double (**lutfunc)(void *cntx, double in), /* List of callback functions, NULL if none */ int edif, /* nz if using error diffusion */ void (*quant)(void *qcntx, double *out, double *in), /* optional quantization func. for edif */ - void *qcntx + void *qcntx, + double mxerr /* If error diffusion anf != 0, max error to propogate */ ) { thscreens *t; int i, bi = -1; @@ -287,6 +298,7 @@ thscreens *new_thscreens( t->qcntx = qcntx; t->mxwidth = mxwidth; + t->mxerr = mxerr; t->lastyoff = -1; /* Allocate and initialise a next line error buffer. */ -- cgit v1.2.3