IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 23, 2008, 4:01:55 PM (18 years ago)
Author:
Paul Price
Message:

Cleaning up lanczos

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/imageops/psImageInterpolate.c

    r18297 r18298  
    77 *  @author Paul Price, IfA
    88 *
    9  *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2008-06-24 01:47:14 $
     9 *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2008-06-24 02:01:55 $
    1111 *
    1212 *  Copyright 2004-2007 Institute for Astronomy, University of Hawaii
     
    386386        }
    387387    } else {
    388         double norm3 = 0.0;             // Normalisation
     388        double norm4 = 0.0;             // Normalisation
    389389        double norm1 = 2.0 / PS_SQR(M_PI); // Normalisation for laczos
    390         double norm2 = 4.0 / (float)num; // 2.0 / (num / 2);  // Normalisation for sinc functions
     390        double norm2 = M_PI * 4.0 / (float)num; // Normalisation for sinc function 1
     391        double norm3 =M_PI_2 * 4.0 / (float)num; // Normalisation for sinc function 2
    391392        double pos = - (num - 1)/2 - frac;  // Position of interest
    392393        for (int i = 0; i < num; i++, pos += 1.0) {
    393             norm3 += values[i] = norm1 * sin(M_PI * pos * norm2) * sin(M_PI_2 * pos * norm2) / PS_SQR(pos);
    394         }
    395         norm3 = 1.0 / norm3;
    396         for (int i = 0; i < num; i++, pos += 1.0) {
    397             values[i] *= norm3;
     394            norm4 += values[i] = norm1 * sin(pos * norm2) * sin(M_PI_2 * pos * norm3) / PS_SQR(pos);
     395        }
     396        norm4 = 1.0 / norm4
     397        for (int i = 0; i < num; i++) {
     398            values[i] *= norm4;
    398399        }
    399400    }
Note: See TracChangeset for help on using the changeset viewer.