Changeset 36319 for branches/eam_branches/ipp-20130904/psLib/test/imageops/tap_psImageConvolve2dCache.c
- Timestamp:
- Nov 28, 2013, 4:10:42 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130904/psLib/test/imageops/tap_psImageConvolve2dCache.c
r36282 r36319 14 14 #include "pstap.h" 15 15 16 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa);16 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float Nsigma, float sigma, float kappa); 17 17 18 18 int main(int argc, char **argv) { … … 23 23 24 24 // generate an image to convolve 25 tap_convolve_delta (301, 301, 150, 150, 2.0, 1.0);26 tap_convolve_delta (301, 301, 100, 200, 2.0, 1.0);27 tap_convolve_delta (301, 301, 200, 100, 2.0, 1.0);28 tap_convolve_delta (301, 301, 200, 200, 2.0, 1.0);29 tap_convolve_delta (301, 301, 100, 100, 2.0, 1.0);25 tap_convolve_delta (301, 301, 150, 150, 3.0, 2.0, 1.0); 26 tap_convolve_delta (301, 301, 100, 200, 3.0, 2.0, 1.0); 27 tap_convolve_delta (301, 301, 200, 100, 3.0, 2.0, 1.0); 28 tap_convolve_delta (301, 301, 200, 200, 3.0, 2.0, 1.0); 29 tap_convolve_delta (301, 301, 100, 100, 3.0, 2.0, 1.0); 30 30 31 tap_convolve_delta (301, 301, 150, 150, 3.0, 1.0);32 tap_convolve_delta (301, 301, 100, 200, 3.0, 1.0);33 tap_convolve_delta (301, 301, 200, 100, 3.0, 1.0);34 tap_convolve_delta (301, 301, 200, 200, 3.0, 1.0);35 tap_convolve_delta (301, 301, 100, 100, 3.0, 1.0);31 tap_convolve_delta (301, 301, 150, 150, 3.0, 3.0, 1.0); 32 tap_convolve_delta (301, 301, 100, 200, 3.0, 3.0, 1.0); 33 tap_convolve_delta (301, 301, 200, 100, 3.0, 3.0, 1.0); 34 tap_convolve_delta (301, 301, 200, 200, 3.0, 3.0, 1.0); 35 tap_convolve_delta (301, 301, 100, 100, 3.0, 3.0, 1.0); 36 36 37 tap_convolve_delta (301, 301, 150, 150, 1.0, 1.0);38 tap_convolve_delta (301, 301, 100, 200, 1.0, 1.0);39 tap_convolve_delta (301, 301, 200, 100, 1.0, 1.0);40 tap_convolve_delta (301, 301, 200, 200, 1.0, 1.0);41 tap_convolve_delta (301, 301, 100, 100, 1.0, 1.0);37 tap_convolve_delta (301, 301, 150, 150, 3.0, 1.0, 1.0); 38 tap_convolve_delta (301, 301, 100, 200, 3.0, 1.0, 1.0); 39 tap_convolve_delta (301, 301, 200, 100, 3.0, 1.0, 1.0); 40 tap_convolve_delta (301, 301, 200, 200, 3.0, 1.0, 1.0); 41 tap_convolve_delta (301, 301, 100, 100, 3.0, 1.0, 1.0); 42 42 43 tap_convolve_delta (301, 301, 150, 150, 2.0, 2.0); 44 tap_convolve_delta (301, 301, 100, 200, 2.0, 2.0); 45 tap_convolve_delta (301, 301, 200, 100, 2.0, 2.0); 46 tap_convolve_delta (301, 301, 200, 200, 2.0, 2.0); 47 tap_convolve_delta (301, 301, 100, 100, 2.0, 2.0); 43 tap_convolve_delta (301, 301, 150, 150, 3.0, 2.0, 2.0); 44 tap_convolve_delta (301, 301, 100, 200, 3.0, 2.0, 2.0); 45 tap_convolve_delta (301, 301, 200, 100, 3.0, 2.0, 2.0); 46 tap_convolve_delta (301, 301, 200, 200, 3.0, 2.0, 2.0); 47 tap_convolve_delta (301, 301, 100, 100, 3.0, 2.0, 2.0); 48 49 tap_convolve_delta (301, 301, 150, 150, 4.0, 3.0, 1.0); 50 tap_convolve_delta (301, 301, 100, 200, 4.0, 3.0, 1.0); 51 tap_convolve_delta (301, 301, 200, 100, 4.0, 3.0, 1.0); 52 tap_convolve_delta (301, 301, 200, 200, 4.0, 3.0, 1.0); 53 tap_convolve_delta (301, 301, 100, 100, 4.0, 3.0, 1.0); 54 55 tap_convolve_delta (301, 301, 150, 150, 5.0, 3.0, 1.0); 56 tap_convolve_delta (301, 301, 100, 200, 5.0, 3.0, 1.0); 57 tap_convolve_delta (301, 301, 200, 100, 5.0, 3.0, 1.0); 58 tap_convolve_delta (301, 301, 200, 200, 5.0, 3.0, 1.0); 59 tap_convolve_delta (301, 301, 100, 100, 5.0, 3.0, 1.0); 60 61 tap_convolve_delta (301, 301, 150, 150, 5.0, 1.0, 1.0); 62 tap_convolve_delta (301, 301, 100, 200, 5.0, 1.0, 1.0); 63 tap_convolve_delta (301, 301, 200, 100, 5.0, 1.0, 1.0); 64 tap_convolve_delta (301, 301, 200, 200, 5.0, 1.0, 1.0); 65 tap_convolve_delta (301, 301, 100, 100, 5.0, 1.0, 1.0); 48 66 49 67 ok(!psMemCheckLeaks (id, NULL, stdout, false), "no memory leaks"); … … 52 70 } 53 71 54 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa) {72 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float Nsigma, float sigma, float kappa) { 55 73 56 74 bool status; … … 60 78 input->data.F32[Yo][Xo] = 1.0; 61 79 62 psImageSmooth2dCacheData *smdata = psImageSmooth2dCacheAlloc ( 3.0);80 psImageSmooth2dCacheData *smdata = psImageSmooth2dCacheAlloc (Nsigma); 63 81 ok(smdata, "init smdata"); 64 82 ok(!smdata->radflux, "init radflux to NULL"); 65 ok(smdata->Nsigma == 3, "init Nsigma to 3");83 ok(smdata->Nsigma == Nsigma, "init Nsigma"); 66 84 67 85 status = psImageSmooth2dCacheKernel_PS1_V1 (smdata, sigma, kappa); … … 71 89 ok(status, "smoothed image"); 72 90 73 floats = 0.0;91 double s = 0.0; 74 92 75 93 psImage *model = psImageAlloc (Nx, Ny, PS_TYPE_F32); … … 77 95 for (int iy = 0; iy < model->numRows; iy++) { 78 96 for (int ix = 0; ix < model->numCols; ix++) { 79 float z = PS_SQR((ix + 0.5 - Xo - 0.5) / sigma) +PS_SQR((iy + 0.5 - Yo - 0.5) / sigma);80 if (z > PS_SQR(smdata->Nsigma)) continue;97 float z = 0.5*PS_SQR((ix + 0.5 - Xo - 0.5) / sigma) + 0.5*PS_SQR((iy + 0.5 - Yo - 0.5) / sigma); 98 if (z > 0.5*PS_SQR(smdata->Nsigma)) continue; 81 99 82 100 float f = 1.0 / (1.0 + z*kappa + pow(z, 1.666)); … … 101 119 } 102 120 } 103 ok (fabs(min_df) < 1e-5, "minor deviations");104 ok (fabs(max_df) < 1e-5, "minor deviations");121 ok (fabs(min_df) < 3e-5, "minor deviations"); 122 ok (fabs(max_df) < 3e-5, "minor deviations"); 105 123 106 if ((fabs(min_df) >= 1e-5) || (fabs(max_df) >= 1e-5)) {124 if ((fabs(min_df) >= 3e-5) || (fabs(max_df) >= 3e-5)) { 107 125 psFits *fits = NULL; 108 126 fits = psFitsOpen ("input.fits", "w");
Note:
See TracChangeset
for help on using the changeset viewer.
