about summary refs log tree commit diff
diff options
context:
space:
mode:
authorgiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-01-25 02:09:04 +0000
committergiraffedata <giraffedata@9d0c8265-081b-0410-96cb-a4ca84ce46f8>2022-01-25 02:09:04 +0000
commit982368c5ef846892f6ee246c3011ae52f483ff67 (patch)
tree10e8acc5604161d4cb6849e55d07fd466e5de0d7
parent758897609d998b6b041f2df7180e4362bce42102 (diff)
downloadnetpbm-mirror-982368c5ef846892f6ee246c3011ae52f483ff67.tar.gz
netpbm-mirror-982368c5ef846892f6ee246c3011ae52f483ff67.tar.xz
netpbm-mirror-982368c5ef846892f6ee246c3011ae52f483ff67.zip
Fix incorrect output
git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4258 9d0c8265-081b-0410-96cb-a4ca84ce46f8
-rw-r--r--doc/HISTORY3
-rw-r--r--editor/specialty/pgmabel.c11
2 files changed, 8 insertions, 6 deletions
diff --git a/doc/HISTORY b/doc/HISTORY
index 423047b3..22eeaf78 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -29,6 +29,9 @@ not yet  BJH  Release 10.98.00
               pgmtexture: Fix incorrect output.  Always broken.  (Program was
               added in primordial Netpbm in 1991).
               
+              pgmabel: Fix incorrect output.  Always broken.  (Program was
+              new in Netpbm 10.3 (July 2002).
+
               Remove Floyd-Steinberg dithering functions (ppm_fs_*) from
               libnetpbm (libppmfloyd).  No longer used.  Floyd-Steinberg
               dithering logic can be found in pnmremap.  libppmfloyd
diff --git a/editor/specialty/pgmabel.c b/editor/specialty/pgmabel.c
index aa748f88..5badfd19 100644
--- a/editor/specialty/pgmabel.c
+++ b/editor/specialty/pgmabel.c
@@ -100,20 +100,19 @@ abel ( float *y, int N, double *adl)
 {
     register int n;
     double *rho, *rhop;       /* results and new index                       */
-    float  *yp;               /* new indizes for the y-array                 */
 
     MALLOCARRAY(rho, N);
     if( !rho )
         pm_error( "out of memory" );
+    for (n=0 ; n<N ; n++)
+        rho[n] = 0;
+
     rhop = rho;
-    yp  = y;
 
     for (n=0 ; n<N ; n++)
     {
-        *(rhop++) = ((*yp++) - Sum(n,rho,N,adl))/(adl[n*N+n]);
-/*    *(rhop++) = ((*yp++) - Sum(n,rho,N))/(dr(n,n+0.5,N));  old version */
-        if ( *rhop < 0.0 ) *rhop = 0.0;         /*  error correction !       */
-/*   if (n > 2) rhop[n-1] = (rho[n-2]+rho[n-1]+rho[n])/3.0;  stabilization*/
+        rhop[n] = MAX(0, (y[n] - Sum(n,rho,N,adl))/(adl[n*N+n]));
+            /* Clip to 0 for error correction !  */
     }
     for (n=0 ; n<N ; n++)
         {