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_psImageConvolve.c

    r2204 r2273  
    55 *  @author Robert DeSonia, MHPCC
    66 *
    7  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    8  *  @date $Date: 2004-10-27 00:57:33 $
     7 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     8 *  @date $Date: 2004-11-04 01:05:00 $
    99 *
    1010 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5252
    5353        if (k == NULL) {
    54             psError(__func__,"psKernelAlloc returned NULL for [%d:%d,%d:%d].",
     54            psError(PS_ERR_UNKNOWN, true,"psKernelAlloc returned NULL for [%d:%d,%d:%d].",
    5555                    xMin[i], xMax[i], yMin[i], yMax[i]);
    5656            return i*10+1;
     
    5959        if (k->xMin != xMin[i] || k->xMax != xMax[i] ||
    6060                k->yMin != yMin[i] || k->yMax != yMax[i]) {
    61             psError(__func__,"Min/max members, [%d:%d,%d:%d], of psKernel wrong. Should be [%d:%d,%d:%d].",
     61            psError(PS_ERR_UNKNOWN, true,"Min/max members, [%d:%d,%d:%d], of psKernel wrong. Should be [%d:%d,%d:%d].",
    6262                    k->xMin,k->xMax, k->yMin, k->yMax,
    6363                    xMin[i], xMax[i], yMin[i], yMax[i]);
     
    6767        if (k->image->numCols != xMax[i]-xMin[i]+1 ||
    6868                k->image->numRows != yMax[i]-yMin[i]+1) {
    69             psError(__func__,"Size of the kernel image is wrong (%dx%d vs %dx%d).",
     69            psError(PS_ERR_UNKNOWN, true,"Size of the kernel image is wrong (%dx%d vs %dx%d).",
    7070                    xMax[i]-xMin[i]+1, yMax[i]-yMin[i]+1,
    7171                    k->image->numCols, k->image->numRows);
     
    7575        for (psS32 j=yMin[i]; j<yMax[i]; j++) {
    7676            if (k->kernel[j]+xMin[i] != k->image->data.PS_TYPE_KERNEL_DATA[j-yMin[i]]) {
    77                 psError(__func__,"The kernel pointer was set wrong for row %d.",
     77                psError(PS_ERR_UNKNOWN, true,"The kernel pointer was set wrong for row %d.",
    7878                        j);
    7979                return i*10+4;
     
    8787    k = psKernelAlloc(5, -5, -2, 2);
    8888    if (k == NULL) {
    89         psError(__func__,"psKernelAlloc returned NULL for xMin > xMax.");
     89        psError(PS_ERR_UNKNOWN, true,"psKernelAlloc returned NULL for xMin > xMax.");
    9090        return i*10+5;
    9191    }
    9292
    9393    if (k->xMin != -5 || k->xMax != 5) {
    94         psError(__func__,"psKernelAlloc didn't swap xMin & xMax.");
     94        psError(PS_ERR_UNKNOWN, true,"psKernelAlloc didn't swap xMin & xMax.");
    9595        return i*10+6;
    9696    }
     
    101101    k = psKernelAlloc(-2, 2, 5, -5);
    102102    if (k == NULL) {
    103         psError(__func__,"psKernelAlloc returned NULL for yMin > yMax.");
     103        psError(PS_ERR_UNKNOWN, true,"psKernelAlloc returned NULL for yMin > yMax.");
    104104        return i*10+7;
    105105    }
    106106
    107107    if (k->yMin != -5 || k->yMax != 5) {
    108         psError(__func__,"psKernelAlloc didn't swap yMin & yMax.");
     108        psError(PS_ERR_UNKNOWN, true,"psKernelAlloc didn't swap yMin & yMax.");
    109109        return i*10+8;
    110110    }
     
    136136
    137137    if (result == NULL) {
    138         psError(__func__,"psKernelGenerate returned NULL.");
     138        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL.");
    139139        return 1;
    140140    }
     
    142142    if (result->xMin != -1 || result->xMax != 1 ||
    143143            result->yMin != -2 || result->yMax != 2) {
    144         psError(__func__,"psKernelGenerate result had a range of [%d:%d,%d:%d].  Suppose to be [0:1,1:2].",
     144        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result had a range of [%d:%d,%d:%d].  Suppose to be [0:1,1:2].",
    145145                result->xMin, result->xMax, result->yMin, result->yMax);
    146146        return 2;
     
    154154    }
    155155    if (fabsf(1.0 - sum) > FLT_EPSILON) {
    156         psError(__func__,"psKernelGenerate result is not normalized (sum=%g).",
     156        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result is not normalized (sum=%g).",
    157157                sum);
    158158
     
    166166            fabsf(result->kernel[-1][ 0] - 2.0/10.0) > FLT_EPSILON ||
    167167            fabsf(result->kernel[-2][-1] - 0.0/10.0) > FLT_EPSILON) {
    168         psError(__func__,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",
     168        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",
    169169                result->kernel[-1][0], result->kernel[1][1],
    170170                result->kernel[2][0], result->kernel[-2][-1]);
     
    191191
    192192    if (result == NULL) {
    193         psError(__func__,"psKernelGenerate returned NULL.");
     193        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL.");
    194194        return 5;
    195195    }
     
    197197    if (result->xMin != 0 || result->xMax != 1 ||
    198198            result->yMin != 0 || result->yMax != 3) {
    199         psError(__func__,"psKernelGenerate result had a range of [%d:%d,%d:%d].  Suppose to be [0:1,1:2].",
     199        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result had a range of [%d:%d,%d:%d].  Suppose to be [0:1,1:2].",
    200200                result->xMin, result->xMax, result->yMin, result->yMax);
    201201        return 6;
     
    209209    }
    210210    if (fabsf(1.0 - sum) > FLT_EPSILON) {
    211         psError(__func__,"psKernelGenerate result is not normalized (sum=%g).",
     211        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result is not normalized (sum=%g).",
    212212                sum);
    213213
     
    220220            fabsf(result->kernel[3][1] - 8.0/21.0) > FLT_EPSILON ||
    221221            fabsf(result->kernel[2][1] - 10.0/21.0) > FLT_EPSILON) {
    222         psError(__func__,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",
     222        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values, %g,%g;%g,%g, are wrong. Suppose to be 2,6;1,0.",
    223223                result->kernel[1][0], result->kernel[1][1],
    224224                result->kernel[2][0], result->kernel[2][1]);
     
    246246    result = psKernelGenerate(tVec, xVec, yVec, false);
    247247    if (result == NULL) {
    248         psError(__func__,"psKernelGenerate returned NULL.");
     248        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned NULL.");
    249249        return 9;
    250250    }
     
    254254            fabsf(result->kernel[ 1][ 1] - 6.0/8.0) > FLT_EPSILON ||
    255255            fabsf(result->kernel[ 0][ 0] - 1.0/8.0) > FLT_EPSILON) {
    256         psError(__func__,"psKernelGenerate result values wrong for truncated time vector.");
     256        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate result values wrong for truncated time vector.");
    257257
    258258        return 10;
     
    264264    result = psKernelGenerate(NULL, xVec, yVec, true);
    265265    if (result != NULL) {
    266         psError(__func__,"psKernelGenerate returned a kernel with no time vector.");
     266        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned a kernel with no time vector.");
    267267        return 11;
    268268    }
     
    271271    result = psKernelGenerate(tVec, NULL, yVec, true);
    272272    if (result != NULL) {
    273         psError(__func__,"psKernelGenerate returned a kernel with no x vector.");
     273        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned a kernel with no x vector.");
    274274        return 11;
    275275    }
     
    278278    result = psKernelGenerate(tVec, xVec, NULL, true);
    279279    if (result != NULL) {
    280         psError(__func__,"psKernelGenerate returned a kernel with no y vector.");
     280        psError(PS_ERR_UNKNOWN, true,"psKernelGenerate returned a kernel with no y vector.");
    281281        return 11;
    282282    }
     
    336336 
    337337    if (out == NULL) {
    338         psError(__func__, "psImageConvolve returned a NULL for direct gaussian case.");
     338        psError(PS_ERR_UNKNOWN, true, "psImageConvolve returned a NULL for direct gaussian case.");
    339339        return 1;
    340340    }
    341341 
    342342    if (out->numCols != c || out->numRows != r) {
    343         psError(__func__, "psImageConvolve result image is %dx%d, but expected %dx%d.",
     343        psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is %dx%d, but expected %dx%d.",
    344344                out->numCols, out->numRows,
    345345                c,r);
     
    350350        char* typeStr;
    351351        PS_TYPE_NAME(typeStr,out->type.type);
    352         psError(__func__, "psImageConvolve result image is of type %s, not psF32.",
     352        psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is of type %s, not psF32.",
    353353                typeStr);
    354354        return 3;
     
    359359        for (psS32 j=-1;j<1;j++) {
    360360            if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) {
    361                 psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     361                psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
    362362                        c/2+j,r/2+i,
    363363                        out->data.F32[r/2+i][c/2+j], g->kernel[i][j]);
     
    365365            }
    366366            if (i >= 0 && j >= 0 && fabsf(out->data.F32[i][j] - g->kernel[i][j]) > 0.0001) {
    367                 psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     367                psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
    368368                        j,i,
    369369                        out->data.F32[i][j], g->kernel[i][j]);
     
    371371            }
    372372            if (i <= 0 && fabsf(out->data.F32[r-1+i][c/2+j] - g->kernel[i][j]) > 0.0001) {
    373                 psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     373                psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
    374374                        c/2+j,r-1+i,
    375375                        out->data.F32[r-1+i][c/2+j], g->kernel[i][j]);
     
    397397 
    398398    if (out == NULL) {
    399         psError(__func__, "psImageConvolve returned a NULL for gaussian case.");
     399        psError(PS_ERR_UNKNOWN, true, "psImageConvolve returned a NULL for gaussian case.");
    400400        return 10;
    401401    }
    402402 
    403403    if (out != out2) {
    404         psError(__func__, "psImageConvolve didn't recycle the supplied out image struct.");
     404        psError(PS_ERR_UNKNOWN, true, "psImageConvolve didn't recycle the supplied out image struct.");
    405405        return 11;
    406406    }
    407407 
    408408    if (out->numCols != c || out->numRows != r) {
    409         psError(__func__, "psImageConvolve result image is %dx%d, but expected %dx%d.",
     409        psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is %dx%d, but expected %dx%d.",
    410410                out->numCols, out->numRows,
    411411                c,r);
     
    416416        char* typeStr;
    417417        PS_TYPE_NAME(typeStr,out->type.type);
    418         psError(__func__, "psImageConvolve result image is of type %s, not psF32.",
     418        psError(PS_ERR_UNKNOWN, true, "psImageConvolve result image is of type %s, not psF32.",
    419419                typeStr);
    420420        return 13;
     
    426426        for (psS32 j=-1;j<1;j++) {
    427427            if (fabsf(out->data.F32[r/2+i][c/2+j] - g->kernel[i][j]) > 0.0001) {
    428                 psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     428                psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
    429429                        c/2+j,r/2+i,
    430430                        out->data.F32[r/2+i][c/2+j], g->kernel[i][j]);
     
    433433            }
    434434            if (i >= 0 && j >= 0 && fabsf(out->data.F32[i][j] - g->kernel[i][j]) > 0.0001) {
    435                 psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     435                psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
    436436                        j,i,
    437437                        out->data.F32[i][j], g->kernel[i][j]);
     
    439439            }
    440440            if (i <= 0 && fabsf(out->data.F32[r-1+i][c/2+j] - g->kernel[i][j]) > 0.0001) {
    441                 psError(__func__,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
     441                psError(PS_ERR_UNKNOWN, true,"Convolved image wrong at %d,%d.  Value is %g, expected %g.",
    442442                        c/2+j,r-1+i,
    443443                        out->data.F32[r-1+i][c/2+j], g->kernel[i][j]);
Note: See TracChangeset for help on using the changeset viewer.