IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 23, 2004, 1:00:17 PM (22 years ago)
Author:
desonia
Message:

Changed the means of deallocation of memory. ps_Alloc now registers an optional free function to handle any additional processing of a memory object.

Location:
trunk/psLib/test/image
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImage.c

    r1033 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.18 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-14 23:03:43 $
     8 *  @version $Revision: 1.19 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:15 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    7575                psError(__func__,"psImageAlloc returned NULL for type %x, size %dx%d.",
    7676                        type[t], numCols[i], numRows[i]);
    77                 psImageFree(image);
     77                psFree(image);
    7878                return 1;
    7979            }
     
    8282                psError(__func__,"psImageAlloc allocated wrong dimen/type (%d/%d), should be "
    8383                        "PS_IMAGE_DIMEN/%d", image->type.dimen, image->type.type, type[t]);
    84                 psImageFree(image);
     84                psFree(image);
    8585                return 2;
    8686            }
     
    8989                psError(__func__,"psImageAlloc allocated wrong size %dx%d, should be %dx%d (type = %d)",
    9090                        image->numCols, image->numRows, numCols[i], numRows[i],type[t]);
    91                 psImageFree(image);
     91                psFree(image);
    9292                return 3;
    9393            }
     
    9696                psError(__func__,"psImageAlloc returned row0/col0 of %d/%d.  Should be 0/0.",
    9797                        image->row0, image->row0);
    98                 psImageFree(image);
     98                psFree(image);
    9999                return 4;
    100100            }
     
    102102            if (image->parent != NULL) {
    103103                psError(__func__,"psImageAlloc returned non-NULL parent");
    104                 psImageFree(image);
     104                psFree(image);
    105105                return 5;
    106106            }
     
    108108            if (image->nChildren != 0) {
    109109                psError(__func__,"psImageAlloc returned non-zero number of children");
    110                 psImageFree(image);
     110                psFree(image);
    111111                return 6;
    112112            }
     
    114114            if (image->children != NULL) {
    115115                psError(__func__,"psImageAlloc returned non-NULL children vector");
    116                 psImageFree(image);
     116                psFree(image);
    117117                return 7;
    118118            }
     
    132132                            if (image->data.U16[r][c] != 2*c+r) {
    133133                                psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r);
    134                                 psImageFree(image);
     134                                psFree(image);
    135135                                return 8;
    136136                            }
     
    152152                            if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) {
    153153                                psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r);
    154                                 psImageFree(image);
     154                                psFree(image);
    155155                                return 8;
    156156                            }
     
    172172                            if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) {
    173173                                psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r);
    174                                 psImageFree(image);
     174                                psFree(image);
    175175                                return 8;
    176176                            }
     
    193193                                    fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) {
    194194                                psError(__func__,"Could not set all pixels in complex image at (%d,%d)",c,r);
    195                                 psImageFree(image);
     195                                psFree(image);
    196196                                return 8;
    197197                            }
     
    215215                                psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)",
    216216                                        type[t],c,r);
    217                                 psImageFree(image);
     217                                psFree(image);
    218218                                return 8;
    219219                            }
     
    225225            // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with no
    226226            // children is freed.
    227             psImageFree(image);
     227            psFree(image);
    228228        }
    229229    }
    230230
    231231    // #548: Verify program execution doesn't stop, if the input psImage structure pointer is null.
    232     psImageFree(NULL);
     232    psFree(NULL);
    233233
    234234    // #548: Verify no memory leaks or corruption are detected after a valid psImage structure with multiple
     
    238238    psImageSubset(NULL,image,50,50,20,20);
    239239
    240     psImageFree(image);
     240    psFree(image);
    241241
    242242    return 0;
     
    501501    }
    502502
    503     psImageFree(original);
     503    psFree(original);
    504504
    505505    return 0;
     
    599599    }
    600600
    601     psImageFree(img);
    602     psImageFree(img2);
     601    psFree(img);
     602    psFree(img2);
    603603
    604604    return 0;
     
    678678        return 2; \
    679679    } \
    680     psImageFree(img);
     680    psFree(img);
    681681
    682682    #define testImageClipByComplexType(datatype) \
     
    718718        return 2; \
    719719    } \
    720     psImageFree(img);
     720    psFree(img);
    721721
    722722    psLogMsg(__func__,PS_LOG_INFO,"Testing clipping of F64 imagery");
     
    824824        return 2; \
    825825    } \
    826     psImageFree(img);
     826    psFree(img);
    827827
    828828    testImageClipNaNByType(F32);
     
    906906        } \
    907907    } \
    908     psImageFree(img); \
    909     psImageFree(img2);
     908    psFree(img); \
     909    psFree(img2);
    910910
    911911    #define testOverlayType(DATATYPE) \
     
    10161016    }
    10171017
    1018     psImageFree(img);
    1019     psImageFree(img2);
     1018    psFree(img);
     1019    psFree(img2);
    10201020
    10211021    return 0;
  • trunk/psLib/test/image/tst_psImageFFT.c

    r1014 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-12 19:46:04 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    116116    }
    117117
    118     psImageFree(img);
    119     psImageFree(img2);
    120     psImageFree(img3);
     118    psFree(img);
     119    psFree(img2);
     120    psFree(img3);
    121121
    122122    return 0;
     
    181181    }
    182182
    183     psImageFree(img);
    184     psImageFree(img2);
    185     psImageFree(img3);
     183    psFree(img);
     184    psFree(img2);
     185    psFree(img3);
    186186
    187187    return 0;
     
    265265    }
    266266
    267     psImageFree(img);
    268     psImageFree(img2);
    269     psImageFree(img3);
     267    psFree(img);
     268    psFree(img2);
     269    psFree(img3);
    270270
    271271    return 0;
     
    311311    }
    312312
    313     psImageFree(img);
    314     psImageFree(img2);
     313    psFree(img);
     314    psFree(img2);
    315315
    316316    return 0;
     
    359359    }
    360360
    361     psImageFree(img);
    362     psImageFree(img2);
    363 
    364     return 0;
    365 }
     361    psFree(img);
     362    psFree(img2);
     363
     364    return 0;
     365}
  • trunk/psLib/test/image/tst_psImageIO.c

    r1001 r1073  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-06-11 19:18:41 $
     8 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-06-23 23:00:17 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    107107            return 4; \
    108108        } \
    109         psImageFree(img); \
     109        psFree(img); \
    110110        img_ref = img = psImageAlloc(2,2,PS_TYPE_F32); \
    111         psImageFree(img3); \
     111        psFree(img3); \
    112112        img3 = NULL; \
    113113        img = psImageReadSection(img,readM0,readN0,readM,readN,0,NULL,0,filename); \
     
    139139            } \
    140140        } \
    141         psImageFree(img); \
     141        psFree(img); \
    142142        img = NULL; \
    143         psImageFree(img3); \
     143        psFree(img3); \
    144144        img3 = NULL; \
    145145        img3 = psImageReadSection(img3,readM0,readN0,readM,readN,0,NULL,1,filename); \
     
    167167            } \
    168168        } \
    169         psImageFree(img); \
    170         psImageFree(img2); \
    171         psImageFree(img3); \
    172         psImageFree(img4); \
     169        psFree(img); \
     170        psFree(img2); \
     171        psFree(img3); \
     172        psFree(img4); \
    173173    }
    174174
     
    302302        return 15;
    303303    }
    304     psImageFree(img);
    305     psImageFree(img2);
     304    psFree(img);
     305    psFree(img2);
    306306
    307307    // Did it really overwrite the pixel values?  Let's read it in and see.
     
    322322    }
    323323
    324     psImageFree(img);
     324    psFree(img);
    325325
    326326    return 0;
  • trunk/psLib/test/image/tst_psImageStats00.c

    r1041 r1073  
    9696                   myHist->nums->data.S32[i]);
    9797        }
    98         psHistogramFree(myHist);
     98        psFree(myHist);
    9999
    100100        psMemCheckCorruption(1);
     
    133133                                "psImageStats functions",
    134134                                "Deallocate the psHistogram/psImage structure.");
    135         psHistogramFree(myHist);
    136         psImageFree(tmpImage);
    137         psImageFree(tmpMask);
     135        psFree(myHist);
     136        psFree(tmpImage);
     137        psFree(tmpMask);
    138138
    139139        psMemCheckCorruption(1);
     
    167167
    168168    psMemCheckCorruption(1);
    169     psHistogramFree(myHist);
    170     psImageFree(tmpImage);
     169    psFree(myHist);
     170    psFree(tmpImage);
    171171    psMemCheckCorruption(1);
    172172    memLeaks = psMemCheckLeaks(currentId,NULL,NULL);
  • trunk/psLib/test/image/tst_psImageStats01.c

    r904 r1073  
    123123                                "psImageStats functions",
    124124                                "Deallocate the psStats/psImage structure.");
    125         psStatsFree(myStats);
    126         psImageFree(tmpImage);
    127         psImageFree(tmpMask);
     125        psFree(myStats);
     126        psFree(tmpImage);
     127        psFree(tmpMask);
    128128
    129129        psMemCheckCorruption(1);
     
    165165    //
    166166
    167     psStatsFree(myStats);
    168     psImageFree(tmpImage);
    169     psImageFree(tmpMask);
     167    psFree(myStats);
     168    psFree(tmpImage);
     169    psFree(tmpMask);
    170170
    171171    psMemCheckCorruption(1);
  • trunk/psLib/test/image/tst_psImageStats02.c

    r1072 r1073  
    102102                            "psImageStats functions",
    103103                            "Deallocate the psStats/psImage structure.");
    104     psStatsFree(myStats);
    105     psImageFree(tmpImage);
    106     psImageFree(outImage);
    107     psPolynomial2DFree(my2DPoly);
     104    psFree(myStats);
     105    psFree(tmpImage);
     106    psFree(outImage);
     107    psFree(my2DPoly);
    108108
    109109    psMemCheckCorruption(1);
  • trunk/psLib/test/image/verified/tst_psImageStats02.stdout

    r1034 r1073  
    55\**********************************************************************************/
    66
     7SUM(Cheby(0) * Cheby(0)) is 3.000000
     8SUM(Cheby(0) * Cheby(1)) is -0.000000
     9SUM(Cheby(0) * Cheby(2)) is 0.000000
     10SUM(Cheby(1) * Cheby(0)) is -0.000000
     11SUM(Cheby(1) * Cheby(1)) is 1.500000
     12SUM(Cheby(1) * Cheby(2)) is 0.000000
     13SUM(Cheby(2) * Cheby(0)) is 0.000000
     14SUM(Cheby(2) * Cheby(1)) is 0.000000
     15SUM(Cheby(2) * Cheby(2)) is 1.500000
     16Cheby Polynomial (0, 0) coefficient is 6.000000
     17Cheby Polynomial (0, 1) coefficient is 1.154701
     18Cheby Polynomial (0, 2) coefficient is 0.000000
     19Cheby Polynomial (1, 0) coefficient is 5.773502
     20Cheby Polynomial (1, 1) coefficient is -0.000000
     21Cheby Polynomial (1, 2) coefficient is -0.000000
     22Cheby Polynomial (2, 0) coefficient is 0.000000
     23Cheby Polynomial (2, 1) coefficient is 0.000000
     24Cheby Polynomial (2, 2) coefficient is 0.000000
    725
    826---> TESTPOINT PASSED (psImageStats functions{Calculate Chebyshev Polynomials, no mask} | tst_psImageStats02.c)
Note: See TracChangeset for help on using the changeset viewer.