about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--doc/HISTORY4
-rw-r--r--editor/pnmremap.c20
2 files changed, 24 insertions, 0 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 704e0593..80395f45 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -21,6 +21,10 @@ not yet  BJH  Release 10.63.00
               since at least 10.26 (May 2001), but after 10.18 (September
               2003).  Thanks Ludolf Holzheid (lholzheid@bihl-wiedemann.de).
 
+              pnmremap (ergo pnmquant): fix bug: incorrect output with
+              -norandom and floyd-steinberg dithering.  Always broken.
+              (-norandom was introduced in 10.30 (June 2007)).
+
               pamtilt: fix bug: incorrect output or invalid memory access
               crash.  Always broken (program was new in Neptbm 10.30
               (October 2005)).
diff --git a/editor/pnmremap.c b/editor/pnmremap.c
index dcd4e2a5..ec381f32 100644
--- a/editor/pnmremap.c
+++ b/editor/pnmremap.c
@@ -378,6 +378,24 @@ randomizeError(long **      const err,
 
 
 static void
+zeroError(long **      const err,
+          unsigned int const width,
+          unsigned int const depth) {
+/*----------------------------------------------------------------------------
+   Set all errors to zero in the error array err[][].
+-----------------------------------------------------------------------------*/
+    unsigned int col;
+
+    for (col = 0; col < width; ++col) {
+        unsigned int plane;
+        for (plane = 0; plane < depth; ++plane) 
+            err[plane][col] = 0;
+    }
+}
+
+
+
+static void
 fserrSetForward(struct fserr * const fserrP) {
 
     fserrP->fsForward = TRUE;
@@ -434,6 +452,8 @@ initFserr(struct pam *   const pamP,
 
     if (initRandom)
         randomizeError(fserrP->thiserr, fserrSize, pamP->depth);
+    else
+        zeroError(fserrP->thiserr, fserrSize, pamP->depth);
 
     fserrSetForward(fserrP);
 }