IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 3, 2004, 3:05:00 PM (22 years ago)
Author:
desonia
Message:

changed the psError signature to match SDRS. Also made misc. cleanups as
I was combing the files.

File:
1 edited

Legend:

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

    r2204 r2273  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.12 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-10-27 00:57:33 $
     8 *  @version $Revision: 1.13 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-11-04 01:05:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    8585    img2 = psImageFFT(img2,img,PS_FFT_FORWARD);
    8686    if (img2->type.type != PS_TYPE_C32) {
    87         psError(__func__,"FFT didn't produce complex values?");
     87        psError(PS_ERR_UNKNOWN, true,"FFT didn't produce complex values?");
    8888        return 1;
    8989    }
    9090    if (img2->numCols != m || img2->numRows != n) {
    91         psError(__func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
     91        psError(PS_ERR_UNKNOWN, true,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
    9292                img2->numCols,img2->numRows,m,n);
    9393        return 2;
     
    103103                if (! (col == 0 && (row == 1 || row == n-1))
    104104                        && ! (row == 0 && (col==1 || col == n-1)) ) {
    105                     psError(__func__,"Result invalid at %d,%d (%.2f)",col,row,mag);
     105                    psError(PS_ERR_UNKNOWN, true,"Result invalid at %d,%d (%.2f)",col,row,mag);
    106106                    return 3;
    107107                }
     
    109109                if ( (col == 0 && (row == 1 || row == n-1))
    110110                        || (row == 0 && (col==1 || col == n-1)) ) {
    111                     psError(__func__,"Result invalid at %d,%d (%.2f)",col,row,mag);
     111                    psError(PS_ERR_UNKNOWN, true,"Result invalid at %d,%d (%.2f)",col,row,mag);
    112112                    return 4;
    113113                }
     
    120120
    121121    if (img3->type.type != PS_TYPE_C32) {
    122         psError(__func__,"FFT didn't produce complex values?");
     122        psError(PS_ERR_UNKNOWN, true,"FFT didn't produce complex values?");
    123123        return 5;
    124124    }
    125125
    126126    if (img3->numCols != m || img3->numRows != n) {
    127         psError(__func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
     127        psError(PS_ERR_UNKNOWN, true,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
    128128                img3->numCols,img3->numRows,m,n);
    129129        return 6;
     
    136136            psF32 pixel = creal(img3Row[col])/m/n;
    137137            if (fabsf(pixel-imgRow[col]) > 0.1) {
    138                 psError(__func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
     138                psError(PS_ERR_UNKNOWN, true,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
    139139                        col,row,pixel,imgRow[col]);
    140140                return 7;
     
    149149        char* typeStr;
    150150        PS_TYPE_NAME(typeStr,img3->type.type)
    151         psError(__func__,"FFT asked to make real result, but I got a %s type image?",typeStr);
     151        psError(PS_ERR_UNKNOWN, true,"FFT asked to make real result, but I got a %s type image?",typeStr);
    152152        return 8;
    153153    }
    154154
    155155    if (img3->numCols != m || img3->numRows != n) {
    156         psError(__func__,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
     156        psError(PS_ERR_UNKNOWN, true,"FFT didn't produce proper size result (%dx%d vs. expected %dx%d).",
    157157                img3->numCols,img3->numRows,m,n);
    158158        return 9;
     
    165165            psF32 pixel = img3Row[col]/m/n;
    166166            if (fabsf(pixel-imgRow[col]) > 0.1) {
    167                 psError(__func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
     167                psError(PS_ERR_UNKNOWN, true,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
    168168                        col,row,pixel,imgRow[col]);
    169169                return 10;
     
    175175    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error.");
    176176    if (psImageFFT(NULL,img2,PS_FFT_REVERSE|PS_FFT_FORWARD) != NULL) {
    177         psError(__func__,"PS_FFT_REVERSE|PS_FFT_FORWARD option produced something?");
     177        psError(PS_ERR_UNKNOWN, true,"PS_FFT_REVERSE|PS_FFT_FORWARD option produced something?");
    178178        return 11;
    179179    }
     
    181181    psLogMsg(__func__,PS_LOG_INFO,"Following should be an error.");
    182182    if (psImageFFT(NULL,img2,PS_FFT_FORWARD|PS_FFT_REAL_RESULT) != NULL) {
    183         psError(__func__,"PS_FFT_FORWARD|PS_FFT_REAL_RESULT option produced something?");
     183        psError(PS_ERR_UNKNOWN, true,"PS_FFT_FORWARD|PS_FFT_REAL_RESULT option produced something?");
    184184        return 12;
    185185    }
     
    188188    img4 = psImageFFT(NULL,NULL,PS_FFT_FORWARD);
    189189    if (img4 != NULL ) {
    190         psError(__func__,"psImageFFT should return null for a null input image.");
     190        psError(PS_ERR_UNKNOWN, true,"psImageFFT should return null for a null input image.");
    191191        return 10;
    192192    }
     
    197197    img5 = psImageFFT(NULL,img4,PS_FFT_REAL_RESULT);
    198198    if (img5 != NULL) {
    199         psError(__func__,"psImageFFT should return null for an invalid FFT direction.");
     199        psError(PS_ERR_UNKNOWN, true,"psImageFFT should return null for an invalid FFT direction.");
    200200        return 11;
    201201    }
     
    229229    img2 = psImageReal(img2,img);
    230230    if (img2 == NULL) {
    231         psError(__func__,"psImageReal returned a NULL?");
     231        psError(PS_ERR_UNKNOWN, true,"psImageReal returned a NULL?");
    232232        return 1;
    233233    }
    234234    if (img2->type.type != PS_TYPE_F32) {
    235         psError(__func__,"psImageReal returned a wrong type (%d)?",
     235        psError(PS_ERR_UNKNOWN, true,"psImageReal returned a wrong type (%d)?",
    236236                img2->type.type);
    237237        return 2;
     
    240240    img3 = psImageImaginary(img3,img);
    241241    if (img3 == NULL) {
    242         psError(__func__,"psImageImaginary returned a NULL?");
     242        psError(PS_ERR_UNKNOWN, true,"psImageImaginary returned a NULL?");
    243243        return 3;
    244244    }
    245245    if (img3->type.type != PS_TYPE_F32) {
    246         psError(__func__,"psImageImaginary returned a wrong type (%d)?",
     246        psError(PS_ERR_UNKNOWN, true,"psImageImaginary returned a wrong type (%d)?",
    247247                img3->type.type);
    248248        return 4;
     
    255255        for (psU32 col=0;col<m;col++) {
    256256            if (fabsf(img2Row[col] - row) > FLT_EPSILON) {
    257                 psError(__func__,"psImageReal didn't return the real portion at n=%d",
     257                psError(PS_ERR_UNKNOWN, true,"psImageReal didn't return the real portion at n=%d",
    258258                        n);
    259259                return 5;
    260260            }
    261261            if (fabsf(img3Row[col] - col) > FLT_EPSILON) {
    262                 psError(__func__,"psImageImaginary didn't return the imag portion at n=%d",
     262                psError(PS_ERR_UNKNOWN, true,"psImageImaginary didn't return the imag portion at n=%d",
    263263                        n);
    264264                return 6;
     
    307307    // 3. verify that the result is a psC32
    308308    if (img3->type.type != PS_TYPE_C32) {
    309         psError(__func__,"Image Type from psImageComplex is not complex? (%d)",
     309        psError(PS_ERR_UNKNOWN, true,"Image Type from psImageComplex is not complex? (%d)",
    310310                img3->type.type);
    311311        return 1;
     
    319319            if (fabsf(crealf(img3Row[col]) - row) > FLT_EPSILON ||
    320320                    fabsf(cimagf(img3Row[col]) - col) > FLT_EPSILON) {
    321                 psError(__func__,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)",
     321                psError(PS_ERR_UNKNOWN, true,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)",
    322322                        col,row,crealf(img3Row[col]),cimagf(img3Row[col]));
    323323                return 2;
     
    334334    // 8. verify that an appropriate error occurred. (this partially has to be done via inspection)
    335335    if (img3 != NULL) {
    336         psError(__func__,"psImageComplex returned a image though input types mismatched.");
     336        psError(PS_ERR_UNKNOWN, true,"psImageComplex returned a image though input types mismatched.");
    337337        return 3;
    338338    }
     
    347347    // 11. verify thet an appropriate error occurred.
    348348    if (img3 != NULL) {
    349         psError(__func__,"psImageComplex returned a image though input sizes mismatched.");
     349        psError(PS_ERR_UNKNOWN, true,"psImageComplex returned a image though input sizes mismatched.");
    350350        return 4;
    351351    }
     
    380380    // 3. verify result is psC32
    381381    if (img2->type.type != PS_TYPE_C32) {
    382         psError(__func__,"the psImageConjugate didn't return a C32 image.");
     382        psError(PS_ERR_UNKNOWN, true,"the psImageConjugate didn't return a C32 image.");
    383383        return 1;
    384384    }
     
    390390            if (fabsf(crealf(img2Row[col]) - row) > FLT_EPSILON ||
    391391                    fabsf(cimagf(img2Row[col]) + col) > FLT_EPSILON) {
    392                 psError(__func__,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)",
     392                psError(PS_ERR_UNKNOWN, true,"psImageComplex result is invalid (%d,%d, %.2f+%.2fi)",
    393393                        col,row,crealf(img2Row[col]),cimagf(img2Row[col]));
    394394                return 2;
     
    425425    // 3. verify result is psF32
    426426    if (img2->type.type != PS_TYPE_F32) {
    427         psError(__func__,"the type was not PS_TYPE_F32.");
     427        psError(PS_ERR_UNKNOWN, true,"the type was not PS_TYPE_F32.");
    428428        return 1;
    429429    }
     
    438438
    439439            if (fabsf(img2Row[col] - power) > 2.0f*FLT_EPSILON) {
    440                 psError(__func__,"psImagePowerSpectrum result is invalid (%d,%d, %.2f vs %.2f)",
     440                psError(PS_ERR_UNKNOWN, true,"psImagePowerSpectrum result is invalid (%d,%d, %.2f vs %.2f)",
    441441                        col,row,img2Row[col],power);
    442442                return 2;
Note: See TracChangeset for help on using the changeset viewer.