00001
00002
00003
00004
00005
00006
00007 #include <stdio.h>
00008 #include <stdlib.h>
00009 #include <string.h>
00010
00011 #include "imcore.h"
00012 #include "util.h"
00013 #include "floatmath.h"
00014
00015 extern void areals(ap_t *ap, int iareal[NAREAL]) {
00016 int i,nup,j,np;
00017 float t,thresh,fconst,offset;
00018 plstruct *plarray;
00019
00020
00021
00022 np = ap->npl_pix;
00023 plarray = ap->plarray;
00024 thresh = ap->thresh;
00025 fconst = ap->fconst;
00026 offset = ap->areal_offset;
00027
00028
00029
00030 (void)memset(iareal,0,NAREAL*sizeof(int));
00031
00032
00033
00034 for (i = 0; i < np; i++) {
00035 t = plarray[i].z;
00036 if (t <= thresh)
00037 continue;
00038 nup = MIN(NAREAL,(int)(logf(t)*fconst - offset)+1);
00039 nup = MAX(1,nup);
00040 for (j = 0; j < nup; j++)
00041 iareal[j]++;
00042 }
00043 }
00044
00045
00046
00047
00048
00049
00050
00051
00052