IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

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/src/mathtypes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • 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 *
Note: See TracChangeset for help on using the changeset viewer.