Changeset 36279
- Timestamp:
- Nov 11, 2013, 10:28:05 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130904/psLib/test/imageops/tap_psImageConvolve2dCache.c
r36278 r36279 14 14 #include "pstap.h" 15 15 16 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa); 17 16 18 int main(int argc, char **argv) { 17 19 18 bool status; 19 20 plan_tests(62); 20 plan_tests(141); 21 21 22 22 psMemId id = psMemGetId(); 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 30 26 int Nx = 301; 27 int Ny = 301; 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); 28 36 29 int Xo = (Nx - 1) / 2; 30 int Yo = (Ny - 1) / 2; 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); 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); 48 49 ok(!psMemCheckLeaks (id, NULL, stdout, false), "no memory leaks"); 50 51 return exit_status(); 52 } 53 54 bool tap_convolve_delta (int Nx, int Ny, int Xo, int Yo, float sigma, float kappa) { 55 56 bool status; 31 57 32 58 psImage *input = psImageAlloc (Nx, Ny, PS_TYPE_F32); 33 59 psImageInit (input, 0.0); 34 input->data.F32[ Xo][Yo] = 1.0;60 input->data.F32[Yo][Xo] = 1.0; 35 61 36 62 psImageSmooth2dCacheData *smdata = psImageSmooth2dCacheAlloc (); … … 39 65 ok(smdata->Nsigma == 3, "init Nsigma to 3"); 40 66 41 float sigma = 2.0;42 float kappa = 1.0;43 67 status = psImageSmooth2dCacheKernel_PS1_V1 (smdata, sigma, kappa); 44 68 ok(status, "generate a kernel"); … … 80 104 ok (fabs(max_df) < 1e-5, "minor deviations"); 81 105 82 /*83 psFits *fits = NULL;84 fits = psFitsOpen ("input.fits", "w");85 psFitsWriteImage (fits, NULL, input, 0, NULL);86 psFitsClose (fits);106 if ((fabs(min_df) >= 1e-5) || (fabs(max_df) >= 1e-5)) { 107 psFits *fits = NULL; 108 fits = psFitsOpen ("input.fits", "w"); 109 psFitsWriteImage (fits, NULL, input, 0, NULL); 110 psFitsClose (fits); 87 111 88 fits = psFitsOpen ("model.fits", "w");89 psFitsWriteImage (fits, NULL, model, 0, NULL);90 psFitsClose (fits);91 */112 fits = psFitsOpen ("model.fits", "w"); 113 psFitsWriteImage (fits, NULL, model, 0, NULL); 114 psFitsClose (fits); 115 } 92 116 93 117 psFree (input); 94 118 psFree (model); 95 119 psFree (smdata); 96 ok(!psMemCheckLeaks (id, NULL, stdout, false), "no memory leaks");97 120 98 return exit_status();121 return true; 99 122 }
Note:
See TracChangeset
for help on using the changeset viewer.
