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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/dataManip/psVectorFFT.c

    r1010 r1073  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-06-12 02:17:25 $
     7 *  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-06-23 23:00:15 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3535    /* got good image data? */
    3636    if (in==NULL) {
    37         psImageFree(out);
     37        psFree(out);
    3838        return NULL;
    3939    }
     
    4444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    4545                type);
    46         psImageFree(out);
     46        psFree(out);
    4747        return NULL;
    4848    }
     
    5151        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    5252                type);
    53         psImageFree(out);
     53        psFree(out);
    5454        return NULL;
    5555
     
    7676    if (plan == NULL) {
    7777        psError(__func__,"Failed to create FFTW plan.");
    78         psImageFree(out);
     78        psFree(out);
    7979        return NULL;
    8080    }
     
    9898
    9999    if (in == NULL) {
    100         psImageFree(out);
     100        psFree(out);
    101101        return NULL;
    102102    }
     
    143143        psError(__func__,"Can not extract real component from given image type (%d).",
    144144                type);
    145         psImageFree(out);
     145        psFree(out);
    146146        return NULL;
    147147    }
     
    158158
    159159    if (in == NULL) {
    160         psImageFree(out);
     160        psFree(out);
    161161        return NULL;
    162162    }
     
    205205        psError(__func__,"Can not extract imaginary component from given image type (%d).",
    206206                type);
    207         psImageFree(out);
     207        psFree(out);
    208208        return NULL;
    209209    }
     
    220220
    221221    if (real == NULL || imag == NULL) {
    222         psImageFree(out);
     222        psFree(out);
    223223        return NULL;
    224224    }
     
    230230    if (imag->type.type != type) {
    231231        psError(__func__,"The inputs to psImageComplex must be the same type.");
    232         psImageFree(out);
     232        psFree(out);
    233233        return NULL;
    234234    }
     
    237237            imag->numRows != numRows) {
    238238        psError(__func__,"The inputs to psImageComplex must be the same dimensions.");
    239         psImageFree(out);
     239        psFree(out);
    240240        return NULL;
    241241    }
     
    243243    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    244244        psError(__func__,"The inputs to psImageComplex can not be complex.");
    245         psImageFree(out);
     245        psFree(out);
    246246        return NULL;
    247247    }
     
    249249    if (type != PS_TYPE_F32 && type != PS_TYPE_F64) {
    250250        psError(__func__,"The input type to psImageComplex must be a floating point.");
    251         psImageFree(out);
     251        psFree(out);
    252252        return NULL;
    253253    }
     
    287287        psError(__func__,"Can not merge real and imaginary portions for given image type (%d).",
    288288                type);
    289         psImageFree(out);
     289        psFree(out);
    290290        return NULL;
    291291    }
     
    302302
    303303    if (in == NULL) {
    304         psImageFree(out);
     304        psFree(out);
    305305        return NULL;
    306306    }
     
    347347        psError(__func__,"Can not compute complex conjugate for given image type (%d).",
    348348                type);
    349         psImageFree(out);
     349        psFree(out);
    350350        return NULL;
    351351    }
     
    362362
    363363    if (in == NULL) {
    364         psImageFree(out);
     364        psFree(out);
    365365        return NULL;
    366366    }
     
    374374    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    375375        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    376         psImageFree(out);
     376        psFree(out);
    377377        return NULL;
    378378    }
     
    417417        psError(__func__,"Can not power spectrum for given image type (%d).",
    418418                type);
    419         psImageFree(out);
     419        psFree(out);
    420420        return NULL;
    421421    }
     
    435435    /* got good image data? */
    436436    if (in==NULL) {
    437         psVectorFree(out);
     437        psFree(out);
    438438        return NULL;
    439439    }
     
    444444        psError(__func__,"Input image must be a 32-bit float or complex image (type=%d)",
    445445                type);
    446         psVectorFree(out);
     446        psFree(out);
    447447        return NULL;
    448448    }
     
    451451        psError(__func__,"Input image must be complex image for reverse FFT (type=%d).",
    452452                type);
    453         psVectorFree(out);
     453        psFree(out);
    454454        return NULL;
    455455
     
    491491    if (plan == NULL) {
    492492        psError(__func__,"Failed to create FFTW plan.");
    493         psVectorFree(out);
     493        psFree(out);
    494494        return NULL;
    495495    }
     
    510510
    511511    if (in == NULL) {
    512         psVectorFree(out);
     512        psFree(out);
    513513        return NULL;
    514514    }
     
    542542        psError(__func__,"Can not extract real component from given vector type (%d).",
    543543                type);
    544         psVectorFree(out);
     544        psFree(out);
    545545        return NULL;
    546546    }
     
    556556
    557557    if (in == NULL) {
    558         psVectorFree(out);
     558        psFree(out);
    559559        return NULL;
    560560    }
     
    588588        psError(__func__,"Can not extract imaginary component from given vector type (%d).",
    589589                type);
    590         psVectorFree(out);
     590        psFree(out);
    591591        return NULL;
    592592    }
     
    602602
    603603    if (real == NULL || imag == NULL) {
    604         psVectorFree(out);
     604        psFree(out);
    605605        return NULL;
    606606    }
     
    615615    if (imag->type.type != type) {
    616616        psError(__func__,"The inputs to psVectorComplex must be the same type.");
    617         psVectorFree(out);
     617        psFree(out);
    618618        return NULL;
    619619    }
     
    621621    if (PS_IS_PSELEMTYPE_COMPLEX(type)) {
    622622        psError(__func__,"The inputs to psVectorComplex can not be complex.");
    623         psVectorFree(out);
     623        psFree(out);
    624624        return NULL;
    625625    }
     
    640640        psError(__func__,"Can not merge real and imaginary portions for given vector type (%d).",
    641641                type);
    642         psVectorFree(out);
     642        psFree(out);
    643643        return NULL;
    644644    }
     
    654654
    655655    if (in == NULL) {
    656         psVectorFree(out);
     656        psFree(out);
    657657        return NULL;
    658658    }
     
    687687        psError(__func__,"Can not compute complex conjugate for given vector type (%d).",
    688688                type);
    689         psVectorFree(out);
     689        psFree(out);
    690690        return NULL;
    691691    }
     
    703703
    704704    if (in == NULL) {
    705         psVectorFree(out);
     705        psFree(out);
    706706        return NULL;
    707707    }
     
    716716    if (! PS_IS_PSELEMTYPE_COMPLEX(type)) {
    717717        psError(__func__,"Power Spectrum for non-complex inputs is not implemented.");
    718         psVectorFree(out);
     718        psFree(out);
    719719        return NULL;
    720720    }
     
    747747        psError(__func__,"Can not power spectrum for given vector type (%d).",
    748748                type);
    749         psVectorFree(out);
    750         return NULL;
    751     }
    752 
    753     return out;
    754 
    755 }
     749        psFree(out);
     750        return NULL;
     751    }
     752
     753    return out;
     754
     755}
Note: See TracChangeset for help on using the changeset viewer.