IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 4887


Ignore:
Timestamp:
Aug 26, 2005, 1:01:17 PM (21 years ago)
Author:
drobbin
Message:

tested and updated init functions in Image and Vector

Location:
trunk/psLib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/pslib.kdevelop

    r4877 r4887  
    4949        <envvar value="1" name="WANT_AUTOMAKE_1_6" />
    5050      </envvars>
    51       <abortonerror>false</abortonerror>
    52       <numberofjobs>2</numberofjobs>
    53       <dontact>false</dontact>
    54       <makebin/>
    55       <prio>0</prio>
    5651    </make>
    5752  </kdevautoproject>
  • trunk/psLib/src/mathtypes/psImage.c

    r4886 r4887  
    99 *  @author Ross Harman, MHPCC
    1010 *
    11  *  @version $Revision: 1.76 $ $Name: not supported by cvs2svn $
    12  *  @date $Date: 2005-08-26 03:35:02 $
     11 *  @version $Revision: 1.77 $ $Name: not supported by cvs2svn $
     12 *  @date $Date: 2005-08-26 23:01:17 $
    1313 *
    1414 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    219219    case PS_TYPE_U8:
    220220        temp = va_arg (argp, psU32);
    221         if ( temp >= 0 || temp <= 255 )
     221        if ( temp >= PS_MIN_U8 && temp <= PS_MAX_U8 )
    222222            vU8 = temp;
    223         else
     223        else {
    224224            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U8 Value out of Range.\n");
     225            return false;
     226        }
    225227        for (int iy = 0; iy < image->numRows; iy++) {
    226228            for (int ix = 0; ix < image->numCols; ix++) {
  • trunk/psLib/src/mathtypes/psVector.c

    r4821 r4887  
    99*  @author Robert DeSonia, MHPCC
    1010*
    11 *  @version $Revision: 1.48 $ $Name: not supported by cvs2svn $
    12 *  @date $Date: 2005-08-19 21:27:43 $
     11*  @version $Revision: 1.49 $ $Name: not supported by cvs2svn $
     12*  @date $Date: 2005-08-26 23:01:17 $
    1313*
    1414*  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    612612                  ...)
    613613{
    614 
    615614    va_list argp;
    616615    psU8  vU8;
     
    627626    psC64 vC64;
    628627
     628    unsigned int temp;
     629    int temp2;
     630
    629631    if (image == NULL)
    630632        return (false);
     
    634636    switch (image->type.type) {
    635637    case PS_TYPE_U8:
    636         vU8 = va_arg (argp, psU32);
    637 
    638         for (long iy = 0; iy < image->n; iy++) {
    639             //            for (int ix = 0; ix < image->numCols; ix++) {
     638        temp = va_arg (argp, psU32);
     639        if ( temp >= PS_MIN_U8 && temp <= PS_MAX_U8 )
     640            vU8 = temp;
     641        else {
     642            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U8 Value out of Range.\n");
     643            return false;
     644        }
     645        for (long iy = 0; iy < image->n; iy++) {
    640646            image->data.U8[iy] = vU8;
    641             //            }
    642         }
    643         break;
    644 
     647        }
     648        return (true);
    645649    case PS_TYPE_F32:
    646         vF32 = va_arg (argp, psF64);
    647 
    648         for (long iy = 0; iy < image->n; iy++) {
    649             //           for (int ix = 0; ix < image->numCols; ix++) {
     650        vF32 = (psF32)va_arg (argp, psF64);
     651        for (long iy = 0; iy < image->n; iy++) {
    650652            image->data.F32[iy] = vF32;
    651             //            }
    652         }
    653         return (true);
    654 
     653        }
     654        return (true);
    655655    case PS_TYPE_F64:
    656656        vF64 = va_arg (argp, psF64);
    657 
    658         for (long iy = 0; iy < image->n; iy++) {
    659             //            for (int ix = 0; ix < image->numCols; ix++) {
     657        for (long iy = 0; iy < image->n; iy++) {
    660658            image->data.F64[iy] = vF64;
    661             //            }
    662659        }
    663660        return (true);
    664661    case PS_TYPE_U16:
    665         vU16 = va_arg (argp, psU32);
    666 
     662        temp = va_arg (argp, psU32);
     663        if ( temp >= PS_MIN_U16 && temp <= PS_MAX_U16 )
     664            vU16 = temp;
     665        else {
     666            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  U16 Value out of Range.\n");
     667            return false;
     668        }
    667669        for (long iy = 0; iy < image->n; iy++) {
    668670            image->data.U16[iy] = vU16;
     
    671673    case PS_TYPE_U32:
    672674        vU32 = va_arg (argp, psU32);
    673 
    674675        for (long iy = 0; iy < image->n; iy++) {
    675676            image->data.U32[iy] = vU32;
     
    678679    case PS_TYPE_U64:
    679680        vU64 = va_arg (argp, psU64);
    680 
    681681        for (long iy = 0; iy < image->n; iy++) {
    682682            image->data.U64[iy] = vU64;
     
    684684        return (true);
    685685    case PS_TYPE_S8:
    686         vS8 = va_arg (argp, psS32);
    687 
     686        temp2 = va_arg (argp, psS32);
     687        if ( temp2 >= PS_MIN_S8 && temp2 <= PS_MAX_S8 )
     688            vS8 = temp2;
     689        else {
     690            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  S8 Value out of Range.\n");
     691            return false;
     692        }
    688693        for (long iy = 0; iy < image->n; iy++) {
    689694            image->data.S8[iy] = vS8;
     
    691696        return (true);
    692697    case PS_TYPE_S16:
    693         vS16 = va_arg (argp, psS32);
    694 
     698        temp2 = va_arg (argp, psS32);
     699        if ( temp2 >= PS_MIN_S16 && temp2 <= PS_MAX_S16 )
     700            vS16 = temp2;
     701        else {
     702            psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error:  S16 Value out of Range.\n");
     703            return false;
     704        }
    695705        for (long iy = 0; iy < image->n; iy++) {
    696706            image->data.S16[iy] = vS16;
     
    699709    case PS_TYPE_S32:
    700710        vS32 = va_arg (argp, psS32);
    701 
    702711        for (long iy = 0; iy < image->n; iy++) {
    703712            image->data.S32[iy] = vS32;
     
    706715    case PS_TYPE_S64:
    707716        vS64 = va_arg (argp, psS64);
    708 
    709717        for (long iy = 0; iy < image->n; iy++) {
    710718            image->data.S64[iy] = vS64;
     
    713721    case PS_TYPE_C32:
    714722        vC32 = va_arg (argp, psC32);
    715 
    716723        for (long iy = 0; iy < image->n; iy++) {
    717724            image->data.C32[iy] = vC32;
     
    720727    case PS_TYPE_C64:
    721728        vC64 = va_arg (argp, psC64);
    722 
    723729        for (long iy = 0; iy < image->n; iy++) {
    724730            image->data.C64[iy] = vC64;
    725731        }
    726732        return (true);
    727 
    728733    default:
    729734        psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", image->type);
  • trunk/psLib/src/mathtypes/psVector.h

    r4821 r4887  
    1111 *  @author Ross Harman, MHPCC
    1212 *
    13  *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
    14  *  @date $Date: 2005-08-19 21:27:43 $
     13 *  @version $Revision: 1.41 $ $Name: not supported by cvs2svn $
     14 *  @date $Date: 2005-08-26 23:01:17 $
    1515 *
    1616 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2727/// @{
    2828
    29 ///< Union of psVector data types.
    30 /*
    31 typedef union {
    32     psU8* U8;                          ///< Unsigned 8-bit integer data.
    33     psU16* U16;                        ///< Unsigned 16-bit integer data.
    34     psU32* U32;                        ///< Unsigned 32-bit integer data.
    35     psU64* U64;                        ///< Unsigned 64-bit integer data.
    36     psS8* S8;                          ///< Signed 8-bit integer data.
    37     psS16* S16;                        ///< Signed 16-bit integer data.
    38     psS32* S32;                        ///< Signed 32-bit integer data.
    39     psS64* S64;                        ///< Signed 64-bit integer data.
    40     psF32* F32;                        ///< Single-precision float data.
    41     psF64* F64;                        ///< Double-precision float data.
    42     psC32* C32;                        ///< Single-precision complex data.
    43     psC64* C64;                        ///< Double-precision complex data.
    44 }
    45 p_psVectorData;
    46 */
    4729/** An vector to support primitive types.
    4830 *
  • trunk/psLib/test/mathtypes/tst_psImage.c

    r4886 r4887  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2005-08-26 03:35:03 $
     8 *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2005-08-26 23:01:17 $
    1010 *
    1111 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    328328    int nCol = 1;
    329329    in1 = psImageAlloc(nRow, nCol, PS_TYPE_U8);
    330     if ( !psImageInit(in1, 1 ) ) {
     330    if ( !psImageInit(in1, -1 ) ) {
    331331        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "ImageInit failed.  U8 Case - 1x1\n");
    332332    }
  • trunk/psLib/test/mathtypes/tst_psVector.c

    r4547 r4887  
    1414 *  @author  Ross Harman, MHPCC
    1515 *
    16  *  @version $Revision: 1.1 $  $Name: not supported by cvs2svn $
    17  *  @date  $Date: 2005-07-13 02:47:00 $
     16 *  @version $Revision: 1.2 $  $Name: not supported by cvs2svn $
     17 *  @date  $Date: 2005-08-26 23:01:17 $
    1818 *
    1919 *  Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii
     
    2727static psS32 testVectorRealloc(void);
    2828static psS32 testVectorExtend(void);
     29static psS32 testVectorInit(void);
    2930
    3031testDescription tests[] = {
     
    3233                              {testVectorRealloc,-2,"psVectorRealloc",0,false},
    3334                              {testVectorExtend,-3,"psVectorExtend",0,false},
     35                              {testVectorInit,-4,"psVectorInit",0,false},
    3436                              {NULL}
    3537                          };
     
    270272    return 0;
    271273}
     274
     275psS32 testVectorInit(void)
     276{
     277    psVector *in1 = NULL;
     278    psVector *in2 = NULL;
     279    psVector *in3 = NULL;
     280    psVector *in4 = NULL;
     281    psVector *in5 = NULL;
     282    psVector *in6 = NULL;
     283    psVector *in7 = NULL;
     284    psVector *in8 = NULL;
     285    psVector *in9 = NULL;
     286    psVector *in10 = NULL;
     287    psVector *in11 = NULL;
     288    psVector *in12 = NULL;
     289    int nalloc = 1;
     290    in1 = psVectorAlloc(nalloc, PS_TYPE_U8);
     291    in2 = psVectorAlloc(nalloc, PS_TYPE_U16);
     292    in3 = psVectorAlloc(nalloc, PS_TYPE_U32);
     293    in4 = psVectorAlloc(nalloc, PS_TYPE_U64);
     294    in5 = psVectorAlloc(nalloc, PS_TYPE_S8);
     295    in6 = psVectorAlloc(nalloc, PS_TYPE_S16);
     296    in7 = psVectorAlloc(nalloc, PS_TYPE_S32);
     297    in8 = psVectorAlloc(nalloc, PS_TYPE_S64);
     298    in9 = psVectorAlloc(nalloc, PS_TYPE_F32);
     299    in10 = psVectorAlloc(nalloc, PS_TYPE_F64);
     300    in11 = psVectorAlloc(nalloc, PS_TYPE_C32);
     301    in12 = psVectorAlloc(nalloc, PS_TYPE_C64);
     302    psC32 vC32;
     303    psC64 vC64;
     304
     305    if ( !psVectorInit(in1, 1 ) ) {
     306        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U8 Case \n");
     307    }
     308    if ( !psVectorInit(in2, PS_MAX_U64) ) {
     309        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U16 Case \n");
     310    }
     311    if ( !psVectorInit(in3, 10) ) {
     312        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U32 Case \n");
     313    }
     314    if ( !psVectorInit(in4, -1) ) {
     315        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  U64 Case \n");
     316    }
     317    if ( !psVectorInit(in5, PS_MAX_S16 ) ) {
     318        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  S8 Case \n");
     319    }
     320    if ( !psVectorInit(in6, -100 ) ) {
     321        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  S16 Case \n");
     322    }
     323    if ( !psVectorInit(in7, 1 ) ) {
     324        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  S32 Case \n");
     325    }
     326    if ( !psVectorInit(in8, PS_MAX_U64 ) ) {
     327        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  S64 Case \n");
     328    }
     329    if ( !psVectorInit(in9, 1.1 ) ) {
     330        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  F32 Case \n");
     331    }
     332    if ( !psVectorInit(in10, 1.4 ) ) {
     333        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  F64 Case \n");
     334    }
     335
     336    vC32 = 1.23 + 1.19I;
     337    vC64 = 2.13 + 2.31I;
     338    if ( !psVectorInit(in11, vC32 ) ) {
     339        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  C32 Case \n");
     340    }
     341    if ( !psVectorInit(in12, vC64 ) ) {
     342        psError(PS_ERR_BAD_PARAMETER_VALUE, true, "VectorInit failed.  C64 Case \n");
     343    }
     344
     345    psFree(in1);
     346    psFree(in2);
     347    psFree(in3);
     348    psFree(in4);
     349    psFree(in5);
     350    psFree(in6);
     351    psFree(in7);
     352    psFree(in8);
     353    psFree(in9);
     354    psFree(in10);
     355    psFree(in11);
     356    psFree(in12);
     357    return 0;
     358}
  • trunk/psLib/test/mathtypes/verified/tst_psImage.stderr

    r4886 r4887  
    122122
    123123<DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO)
     124    Error:  U8 Value out of Range.
     125<DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO)
     126    ImageInit failed.  U8 Case - 1x1
     127<DATE><TIME>|<HOST>|E|psImageInit (FILE:LINENO)
    124128    datatype 260 not defined in psImageInit
    125129<DATE><TIME>|<HOST>|E|testImageInit (FILE:LINENO)
  • trunk/psLib/test/mathtypes/verified/tst_psVector.stderr

    r4547 r4887  
    3232---> TESTPOINT PASSED (psVector{psVectorExtend} | tst_psVector.c)
    3333
     34/***************************** TESTPOINT ******************************************\
     35*             TestFile: tst_psVector.c                                             *
     36*            TestPoint: psVector{psVectorInit}                                     *
     37*             TestType: Positive                                                   *
     38\**********************************************************************************/
     39
     40<DATE><TIME>|<HOST>|E|psVectorInit (FILE:LINENO)
     41    Error:  U16 Value out of Range.
     42<DATE><TIME>|<HOST>|E|testVectorInit (FILE:LINENO)
     43    VectorInit failed.  U16 Case
     44<DATE><TIME>|<HOST>|E|psVectorInit (FILE:LINENO)
     45    Error:  S8 Value out of Range.
     46<DATE><TIME>|<HOST>|E|testVectorInit (FILE:LINENO)
     47    VectorInit failed.  S8 Case
     48
     49---> TESTPOINT PASSED (psVector{psVectorInit} | tst_psVector.c)
     50
Note: See TracChangeset for help on using the changeset viewer.