IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 714


Ignore:
Timestamp:
May 17, 2004, 4:34:00 PM (22 years ago)
Author:
desonia
Message:

modified psImage to match currect IfA input and added copy function.

Location:
trunk/psLib
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/psLib.kdevses

    r667 r714  
    22<!DOCTYPE KDevPrjSession>
    33<KDevPrjSession>
    4  <DocsAndViews NumberOfDocuments="9" >
    5   <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psError.h" >
    6    <View0 line="16" Type="???" >
    7     <AdditionalSettings Top="1" Width="1532" Attach="1" Height="943" Left="1" MinMaxMode="0" />
     4 <DocsAndViews NumberOfDocuments="4" >
     5  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psImage.h" >
     6   <View0 line="115" Type="???" >
     7    <AdditionalSettings Top="1" Width="1291" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    88   </View0>
    99  </Doc0>
    10   <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psError.c" >
    11    <View0 line="72" Type="???" >
    12     <AdditionalSettings Top="1" Width="1532" Attach="1" Height="914" Left="1" MinMaxMode="0" />
     10  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/Makefile" >
     11   <View0 line="4" Type="???" >
     12    <AdditionalSettings Top="1" Width="1291" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    1313   </View0>
    1414  </Doc1>
    15   <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psTrace.h" >
    16    <View0 line="0" Type="???" >
    17     <AdditionalSettings Top="1" Width="1217" Attach="1" Height="599" Left="1" MinMaxMode="0" />
     15  <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/Makefile" >
     16   <View0 line="73" Type="???" >
     17    <AdditionalSettings Top="1" Width="1291" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    1818   </View0>
    1919  </Doc2>
    20   <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psLogMsg.h" >
    21    <View0 line="16" Type="???" >
    22     <AdditionalSettings Top="1" Width="1217" Attach="1" Height="599" Left="1" MinMaxMode="0" />
     20  <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psImage.c" >
     21   <View0 line="69" Type="???" >
     22    <AdditionalSettings Top="1" Width="1291" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    2323   </View0>
    2424  </Doc3>
    25   <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psLogMsg.c" >
    26    <View0 line="318" Type="???" >
    27     <AdditionalSettings Top="1" Width="1217" Attach="1" Height="599" Left="1" MinMaxMode="0" />
    28    </View0>
    29   </Doc4>
    30   <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psMemory.c" >
    31    <View0 line="388" Type="???" >
    32     <AdditionalSettings Top="1" Width="1355" Attach="1" Height="787" Left="1" MinMaxMode="0" />
    33    </View0>
    34   </Doc5>
    35   <Doc6 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/psImage.h" >
    36    <View0 line="45" Type="???" >
    37     <AdditionalSettings Top="1" Width="1355" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    38    </View0>
    39   </Doc6>
    40   <Doc7 NumberOfViews="1" URL="file:/home/desonia/psLib/src/dataManip/psImage.c" >
    41    <View0 line="60" Type="???" >
    42     <AdditionalSettings Top="1" Width="1355" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    43    </View0>
    44   </Doc7>
    45   <Doc8 NumberOfViews="1" URL="file:/home/desonia/psLib/src/collections/psVector.h" >
    46    <View0 line="58" Type="???" >
    47     <AdditionalSettings Top="1" Width="1355" Attach="1" Height="772" Left="1" MinMaxMode="0" />
    48    </View0>
    49   </Doc8>
    5025 </DocsAndViews>
    5126 <pluginList>
  • trunk/psLib/src/image/psImage.c

    r712 r714  
    77 *  @author Ross Harman, MHPCC
    88 *   
    9  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-05-17 21:00:24 $
     9 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-05-18 02:33:59 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    121121
    122122    for (int row = 0; row < numRows; row++) {
    123         memcpy(out->data.v[row],image->data.u8[row0+row] + inputColOffset,outputRowSize);
     123        memcpy(out->data.v[row],image->data.U8[row0+row] + inputColOffset,outputRowSize);
    124124    }
    125125
     
    165165    return numFreed;
    166166}
     167
     168psImage *psImageCopy(psImage* restrict output, const psImage *input, psElemType type)
     169{
     170    psElemType inDatatype;
     171    int elementSize;
     172    int numRows;
     173    int numCols;
     174
     175    if (input == NULL || input->data.v == NULL) {
     176        psError(__func__,"Can not copy image because input image or its pixel buffer is NULL.");
     177        return NULL;
     178    }
     179
     180    if (input == output) {
     181        psError(__func__,"Can not copy image because given input and output parameter reference the same "
     182                "psImage struct.");
     183        return NULL;
     184    }
     185
     186    if (input->type.dimen != PS_DIMEN_IMAGE) {
     187        psError(__func__,"Can not copy image because input image is not actually an image.");
     188        return NULL;
     189    }
     190
     191    inDatatype = input->type.type;
     192    numRows = input->numRows;
     193    numCols = input->numCols;
     194    elementSize = PSELEMTYPE_SIZEOF(inDatatype);
     195
     196    if (inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR) {
     197        psError(__func__,"Can not copy image to/from a void* matrix");
     198        return NULL;
     199    }
     200
     201
     202    if (output == NULL) {
     203        output = psImageAlloc(numCols,numRows,type);
     204    } else if (output->numCols != numCols || output->numRows != numRows ||
     205               output->type.type != type) {        // sizes/type different, can't reuse the given image buffer
     206        psImageFree(output);
     207        output = psImageAlloc(numCols,numRows,type);
     208    }
     209
     210    // cover the trival case of copy of the same type.
     211    if (type == inDatatype) {
     212        memcpy(output->data.v[0],input->data.v[0],elementSize*numRows*numCols);
     213        return output;
     214    }
     215
     216    #define PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,INTYPE,OUTTYPE) \
     217    { \
     218        ps##INTYPE *in; \
     219        ps##OUTTYPE *out; \
     220        for (int row=0;row<numRows;row++) { \
     221            in = IN->data.INTYPE[row]; \
     222            out = OUT->data.OUTTYPE[row]; \
     223            for (int col=0;col<numCols;col++) { \
     224                in[col] = (ps##INTYPE) out[col]; \
     225            } \
     226        } \
     227    }
     228
     229    #define PSIMAGE_ELEMENT_ASSIGN(OUT,IN,OUTTYPE) \
     230    switch (IN->type.type) { \
     231    case PS_TYPE_S8: \
     232        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S8,OUTTYPE); \
     233        break; \
     234    case PS_TYPE_S16: \
     235        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S16,OUTTYPE); \
     236        break; \
     237    case PS_TYPE_S32: \
     238        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S32,OUTTYPE); \
     239        break; \
     240    case PS_TYPE_S64: \
     241        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S64,OUTTYPE); \
     242        break; \
     243    case PS_TYPE_U8: \
     244        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U8,OUTTYPE); \
     245        break; \
     246    case PS_TYPE_U16: \
     247        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U16,OUTTYPE); \
     248        break; \
     249    case PS_TYPE_U32: \
     250        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U32,OUTTYPE); \
     251        break; \
     252    case PS_TYPE_U64: \
     253        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U64,OUTTYPE); \
     254        break; \
     255    case PS_TYPE_F32: \
     256        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,F32,OUTTYPE); \
     257        break; \
     258    case PS_TYPE_F64: \
     259        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,F64,OUTTYPE); \
     260        break; \
     261    case PS_TYPE_C32: \
     262        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,C32,OUTTYPE); \
     263        break; \
     264    default: \
     265        break; \
     266    }
     267
     268    switch (type) {
     269    case PS_TYPE_S8:
     270        PSIMAGE_ELEMENT_ASSIGN(output,input,S8);
     271        break;
     272    case PS_TYPE_S16:
     273        PSIMAGE_ELEMENT_ASSIGN(output,input,S16);
     274        break;
     275    case PS_TYPE_S32:
     276        PSIMAGE_ELEMENT_ASSIGN(output,input,S32);
     277        break;
     278    case PS_TYPE_S64:
     279        PSIMAGE_ELEMENT_ASSIGN(output,input,S64);
     280        break;
     281    case PS_TYPE_U8:
     282        PSIMAGE_ELEMENT_ASSIGN(output,input,U8);
     283        break;
     284    case PS_TYPE_U16:
     285        PSIMAGE_ELEMENT_ASSIGN(output,input,U16);
     286        break;
     287    case PS_TYPE_U32:
     288        PSIMAGE_ELEMENT_ASSIGN(output,input,U32);
     289        break;
     290    case PS_TYPE_U64:
     291        PSIMAGE_ELEMENT_ASSIGN(output,input,U64);
     292        break;
     293    case PS_TYPE_F32:
     294        PSIMAGE_ELEMENT_ASSIGN(output,input,F32);
     295        break;
     296    case PS_TYPE_F64:
     297        PSIMAGE_ELEMENT_ASSIGN(output,input,F64);
     298        break;
     299    case PS_TYPE_C32:
     300        PSIMAGE_ELEMENT_ASSIGN(output,input,C32);
     301        break;
     302    case PS_TYPE_C64:
     303        PSIMAGE_ELEMENT_ASSIGN(output,input,C64);
     304        break;
     305    case PS_TYPE_PTR:
     306        psError(__func__,"Can't copy image into a matrix of pointers.");
     307        psImageFree(output);
     308        return NULL;
     309    }
     310
     311    return output;
     312}
  • trunk/psLib/src/image/psImage.h

    r711 r714  
    77 *  @author Ross Harman, MHPCC
    88 *   
    9  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-05-17 20:59:34 $
     9 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-05-18 02:33:59 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444
    4545    union {
    46         psU8    **u8;                   ///< unsigned 8-bit integer data.
    47         psU16   **u16;                  ///< unsigned 16-bit integer data.
    48         psU32   **u32;                  ///< unsigned 32-bit integer data.
    49         psU32   **u64;                  ///< unsigned 64-bit integer data.
    50         psS8    **s8;                   ///< signed 8-bit integer data.
    51         psS16   **s16;                  ///< signed 16-bit integer data.
    52         psS32   **s32;                  ///< signed 32-bit integer data.
    53         psS32   **s64;                  ///< signed 64-bit integer data.
    54         psF32   **f32;                  ///< single-precision float data.
    55         psF64   **f64;                  ///< double-precision float data.
    56         psC32   **c32;                  ///< single-precision complex data.
    57         psC32   **c64;                  ///< double-precision complex data.
     46        psU8    **U8;                   ///< unsigned 8-bit integer data.
     47        psU16   **U16;                  ///< unsigned 16-bit integer data.
     48        psU32   **U32;                  ///< unsigned 32-bit integer data.
     49        psU64   **U64;                  ///< unsigned 64-bit integer data.
     50        psS8    **S8;                   ///< signed 8-bit integer data.
     51        psS16   **S16;                  ///< signed 16-bit integer data.
     52        psS32   **S32;                  ///< signed 32-bit integer data.
     53        psS64   **S64;                  ///< signed 64-bit integer data.
     54        psF32   **F32;                  ///< single-precision float data.
     55        psF64   **F64;                  ///< double-precision float data.
     56        psC32   **C32;                  ///< single-precision complex data.
     57        psC64   **C64;                  ///< double-precision complex data.
    5858        void    **v;                    ///< void pointers to data
    5959    } data;                             ///< Union for data types.
     
    113113 */
    114114void psImageFreePixels(
    115     psImage *restrict image             ///< psImage to free pixel memory from
     115    psImage* restrict image             ///< psImage to free pixel memory from
    116116);
    117117
     
    125125);
    126126
    127 
     127/** Makes a copy of a psImage
     128 *
     129 * return psImage*  Copy of the input psImage.  This may not be equal to the output parameter
     130 *
     131 */
     132psImage *psImageCopy(
     133    psImage* restrict output,
     134    ///< if not NULL, a psImage that could be recycled.  If it can not be used, it will be freed via
     135    ///< psImageFree
     136    const psImage *input,               ///< the psImage to copy
     137    psElemType type                     ///< the desired datatype of the returned copy
     138);
    128139
    129140#endif
  • trunk/psLib/src/mathtypes/psImage.c

    r712 r714  
    77 *  @author Ross Harman, MHPCC
    88 *   
    9  *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-05-17 21:00:24 $
     9 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-05-18 02:33:59 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    121121
    122122    for (int row = 0; row < numRows; row++) {
    123         memcpy(out->data.v[row],image->data.u8[row0+row] + inputColOffset,outputRowSize);
     123        memcpy(out->data.v[row],image->data.U8[row0+row] + inputColOffset,outputRowSize);
    124124    }
    125125
     
    165165    return numFreed;
    166166}
     167
     168psImage *psImageCopy(psImage* restrict output, const psImage *input, psElemType type)
     169{
     170    psElemType inDatatype;
     171    int elementSize;
     172    int numRows;
     173    int numCols;
     174
     175    if (input == NULL || input->data.v == NULL) {
     176        psError(__func__,"Can not copy image because input image or its pixel buffer is NULL.");
     177        return NULL;
     178    }
     179
     180    if (input == output) {
     181        psError(__func__,"Can not copy image because given input and output parameter reference the same "
     182                "psImage struct.");
     183        return NULL;
     184    }
     185
     186    if (input->type.dimen != PS_DIMEN_IMAGE) {
     187        psError(__func__,"Can not copy image because input image is not actually an image.");
     188        return NULL;
     189    }
     190
     191    inDatatype = input->type.type;
     192    numRows = input->numRows;
     193    numCols = input->numCols;
     194    elementSize = PSELEMTYPE_SIZEOF(inDatatype);
     195
     196    if (inDatatype == PS_TYPE_PTR || type == PS_TYPE_PTR) {
     197        psError(__func__,"Can not copy image to/from a void* matrix");
     198        return NULL;
     199    }
     200
     201
     202    if (output == NULL) {
     203        output = psImageAlloc(numCols,numRows,type);
     204    } else if (output->numCols != numCols || output->numRows != numRows ||
     205               output->type.type != type) {        // sizes/type different, can't reuse the given image buffer
     206        psImageFree(output);
     207        output = psImageAlloc(numCols,numRows,type);
     208    }
     209
     210    // cover the trival case of copy of the same type.
     211    if (type == inDatatype) {
     212        memcpy(output->data.v[0],input->data.v[0],elementSize*numRows*numCols);
     213        return output;
     214    }
     215
     216    #define PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,INTYPE,OUTTYPE) \
     217    { \
     218        ps##INTYPE *in; \
     219        ps##OUTTYPE *out; \
     220        for (int row=0;row<numRows;row++) { \
     221            in = IN->data.INTYPE[row]; \
     222            out = OUT->data.OUTTYPE[row]; \
     223            for (int col=0;col<numCols;col++) { \
     224                in[col] = (ps##INTYPE) out[col]; \
     225            } \
     226        } \
     227    }
     228
     229    #define PSIMAGE_ELEMENT_ASSIGN(OUT,IN,OUTTYPE) \
     230    switch (IN->type.type) { \
     231    case PS_TYPE_S8: \
     232        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S8,OUTTYPE); \
     233        break; \
     234    case PS_TYPE_S16: \
     235        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S16,OUTTYPE); \
     236        break; \
     237    case PS_TYPE_S32: \
     238        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S32,OUTTYPE); \
     239        break; \
     240    case PS_TYPE_S64: \
     241        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,S64,OUTTYPE); \
     242        break; \
     243    case PS_TYPE_U8: \
     244        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U8,OUTTYPE); \
     245        break; \
     246    case PS_TYPE_U16: \
     247        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U16,OUTTYPE); \
     248        break; \
     249    case PS_TYPE_U32: \
     250        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U32,OUTTYPE); \
     251        break; \
     252    case PS_TYPE_U64: \
     253        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,U64,OUTTYPE); \
     254        break; \
     255    case PS_TYPE_F32: \
     256        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,F32,OUTTYPE); \
     257        break; \
     258    case PS_TYPE_F64: \
     259        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,F64,OUTTYPE); \
     260        break; \
     261    case PS_TYPE_C32: \
     262        PSIMAGE_ELEMENT_ASSIGN_LOOP(OUT,IN,C32,OUTTYPE); \
     263        break; \
     264    default: \
     265        break; \
     266    }
     267
     268    switch (type) {
     269    case PS_TYPE_S8:
     270        PSIMAGE_ELEMENT_ASSIGN(output,input,S8);
     271        break;
     272    case PS_TYPE_S16:
     273        PSIMAGE_ELEMENT_ASSIGN(output,input,S16);
     274        break;
     275    case PS_TYPE_S32:
     276        PSIMAGE_ELEMENT_ASSIGN(output,input,S32);
     277        break;
     278    case PS_TYPE_S64:
     279        PSIMAGE_ELEMENT_ASSIGN(output,input,S64);
     280        break;
     281    case PS_TYPE_U8:
     282        PSIMAGE_ELEMENT_ASSIGN(output,input,U8);
     283        break;
     284    case PS_TYPE_U16:
     285        PSIMAGE_ELEMENT_ASSIGN(output,input,U16);
     286        break;
     287    case PS_TYPE_U32:
     288        PSIMAGE_ELEMENT_ASSIGN(output,input,U32);
     289        break;
     290    case PS_TYPE_U64:
     291        PSIMAGE_ELEMENT_ASSIGN(output,input,U64);
     292        break;
     293    case PS_TYPE_F32:
     294        PSIMAGE_ELEMENT_ASSIGN(output,input,F32);
     295        break;
     296    case PS_TYPE_F64:
     297        PSIMAGE_ELEMENT_ASSIGN(output,input,F64);
     298        break;
     299    case PS_TYPE_C32:
     300        PSIMAGE_ELEMENT_ASSIGN(output,input,C32);
     301        break;
     302    case PS_TYPE_C64:
     303        PSIMAGE_ELEMENT_ASSIGN(output,input,C64);
     304        break;
     305    case PS_TYPE_PTR:
     306        psError(__func__,"Can't copy image into a matrix of pointers.");
     307        psImageFree(output);
     308        return NULL;
     309    }
     310
     311    return output;
     312}
  • trunk/psLib/src/mathtypes/psImage.h

    r711 r714  
    77 *  @author Ross Harman, MHPCC
    88 *   
    9  *  @version $Revision: 1.8 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-05-17 20:59:34 $
     9 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-05-18 02:33:59 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444
    4545    union {
    46         psU8    **u8;                   ///< unsigned 8-bit integer data.
    47         psU16   **u16;                  ///< unsigned 16-bit integer data.
    48         psU32   **u32;                  ///< unsigned 32-bit integer data.
    49         psU32   **u64;                  ///< unsigned 64-bit integer data.
    50         psS8    **s8;                   ///< signed 8-bit integer data.
    51         psS16   **s16;                  ///< signed 16-bit integer data.
    52         psS32   **s32;                  ///< signed 32-bit integer data.
    53         psS32   **s64;                  ///< signed 64-bit integer data.
    54         psF32   **f32;                  ///< single-precision float data.
    55         psF64   **f64;                  ///< double-precision float data.
    56         psC32   **c32;                  ///< single-precision complex data.
    57         psC32   **c64;                  ///< double-precision complex data.
     46        psU8    **U8;                   ///< unsigned 8-bit integer data.
     47        psU16   **U16;                  ///< unsigned 16-bit integer data.
     48        psU32   **U32;                  ///< unsigned 32-bit integer data.
     49        psU64   **U64;                  ///< unsigned 64-bit integer data.
     50        psS8    **S8;                   ///< signed 8-bit integer data.
     51        psS16   **S16;                  ///< signed 16-bit integer data.
     52        psS32   **S32;                  ///< signed 32-bit integer data.
     53        psS64   **S64;                  ///< signed 64-bit integer data.
     54        psF32   **F32;                  ///< single-precision float data.
     55        psF64   **F64;                  ///< double-precision float data.
     56        psC32   **C32;                  ///< single-precision complex data.
     57        psC64   **C64;                  ///< double-precision complex data.
    5858        void    **v;                    ///< void pointers to data
    5959    } data;                             ///< Union for data types.
     
    113113 */
    114114void psImageFreePixels(
    115     psImage *restrict image             ///< psImage to free pixel memory from
     115    psImage* restrict image             ///< psImage to free pixel memory from
    116116);
    117117
     
    125125);
    126126
    127 
     127/** Makes a copy of a psImage
     128 *
     129 * return psImage*  Copy of the input psImage.  This may not be equal to the output parameter
     130 *
     131 */
     132psImage *psImageCopy(
     133    psImage* restrict output,
     134    ///< if not NULL, a psImage that could be recycled.  If it can not be used, it will be freed via
     135    ///< psImageFree
     136    const psImage *input,               ///< the psImage to copy
     137    psElemType type                     ///< the desired datatype of the returned copy
     138);
    128139
    129140#endif
  • trunk/psLib/src/sys/psType.h

    r711 r714  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-17 20:59:34 $
     21 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-05-18 02:33:59 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6969    PS_TYPE_COMPLEX_DOUBLE   = 0x810,   ///< Complex numbers consisting of double-precision floating point.
    7070    PS_TYPE_PTR              = 0x000,   ///< Something else that's not supported for arithmetic.
     71
     72    PS_TYPE_S8               = 0x101,   ///< Character.
     73    PS_TYPE_S16              = 0x102,   ///< Short integer.
     74    PS_TYPE_S32              = 0x104,   ///< Integer.
     75    PS_TYPE_S64              = 0x108,   ///< Long integer.
     76    PS_TYPE_U8               = 0x301,   ///< Unsigned character.
     77    PS_TYPE_U16              = 0x302,   ///< Unsigned short integer.
     78    PS_TYPE_U32              = 0x304,   ///< Unsigned integer.
     79    PS_TYPE_U64              = 0x308,   ///< Unsigned long integer.
     80    PS_TYPE_F32              = 0x404,   ///< Single-precision Floating point.
     81    PS_TYPE_F64              = 0x408,   ///< Double-precision floating point.
     82    PS_TYPE_C32              = 0x808,   ///< Complex numbers consisting of single-precision floating point.
     83    PS_TYPE_C64              = 0x810,   ///< Complex numbers consisting of double-precision floating point.
    7184} psElemType;
    7285
  • trunk/psLib/src/sysUtils/psType.h

    r711 r714  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.3 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-17 20:59:34 $
     21 *  @version $Revision: 1.4 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-05-18 02:33:59 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6969    PS_TYPE_COMPLEX_DOUBLE   = 0x810,   ///< Complex numbers consisting of double-precision floating point.
    7070    PS_TYPE_PTR              = 0x000,   ///< Something else that's not supported for arithmetic.
     71
     72    PS_TYPE_S8               = 0x101,   ///< Character.
     73    PS_TYPE_S16              = 0x102,   ///< Short integer.
     74    PS_TYPE_S32              = 0x104,   ///< Integer.
     75    PS_TYPE_S64              = 0x108,   ///< Long integer.
     76    PS_TYPE_U8               = 0x301,   ///< Unsigned character.
     77    PS_TYPE_U16              = 0x302,   ///< Unsigned short integer.
     78    PS_TYPE_U32              = 0x304,   ///< Unsigned integer.
     79    PS_TYPE_U64              = 0x308,   ///< Unsigned long integer.
     80    PS_TYPE_F32              = 0x404,   ///< Single-precision Floating point.
     81    PS_TYPE_F64              = 0x408,   ///< Double-precision floating point.
     82    PS_TYPE_C32              = 0x808,   ///< Complex numbers consisting of single-precision floating point.
     83    PS_TYPE_C64              = 0x810,   ///< Complex numbers consisting of double-precision floating point.
    7184} psElemType;
    7285
  • trunk/psLib/test/collections/Makefile

    r697 r714  
    33##  Makefile:   test/collections
    44##
    5 ##  $Revision: 1.4 $  $Name: not supported by cvs2svn $
    6 ##  $Date: 2004-05-15 00:20:18 $
     5##  $Revision: 1.5 $  $Name: not supported by cvs2svn $
     6##  $Date: 2004-05-18 02:34:00 $
    77##
    88##  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4646tst_psSort_03: tst_psSort_03.o
    4747tst_psSort_04: tst_psSort_04.o
     48tst_psImage: tst_psImage.o
    4849
    4950clean:
  • trunk/psLib/test/image/tst_psImage.c

    r694 r714  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-05-15 00:16:31 $
     8 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-05-18 02:34:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    116116                    for (int r=0;r<rows;r++) {
    117117                        for (int c=0;c<cols;c++) {
    118                             image->data.ui16[r][c] = 2*c+r;
    119                         }
    120                     }
    121                     for (int r=0;r<rows;r++) {
    122                         for (int c=0;c<cols;c++) {
    123                             if (image->data.ui16[r][c] != 2*c+r) {
     118                            image->data.U16[r][c] = 2*c+r;
     119                        }
     120                    }
     121                    for (int r=0;r<rows;r++) {
     122                        for (int c=0;c<cols;c++) {
     123                            if (image->data.U16[r][c] != 2*c+r) {
    124124                                psError(__func__,"Could not set all pixels in uint16 image at (%d,%d)",c,r);
    125125                                psImageFree(image);
     
    136136                    for (int r=0;r<rows;r++) {
    137137                        for (int c=0;c<cols;c++) {
    138                             image->data.f32[r][c] = 2.0f*c+r;
    139                         }
    140                     }
    141                     for (int r=0;r<rows;r++) {
    142                         for (int c=0;c<cols;c++) {
    143                             if (fabsf(image->data.f32[r][c] - (2.0f*c+r)) > FLT_EPSILON) {
     138                            image->data.F32[r][c] = 2.0f*c+r;
     139                        }
     140                    }
     141                    for (int r=0;r<rows;r++) {
     142                        for (int c=0;c<cols;c++) {
     143                            if (fabsf(image->data.F32[r][c] - (2.0f*c+r)) > FLT_EPSILON) {
    144144                                psError(__func__,"Could not set all pixels in float image at (%d,%d)",c,r);
    145145                                psImageFree(image);
     
    156156                    for (int r=0;r<rows;r++) {
    157157                        for (int c=0;c<cols;c++) {
    158                             image->data.f64[r][c] = 2.0f*c+r;
    159                         }
    160                     }
    161                     for (int r=0;r<rows;r++) {
    162                         for (int c=0;c<cols;c++) {
    163                             if (fabs(image->data.f64[r][c] - (2.0f*c+r)) > DBL_EPSILON) {
     158                            image->data.F64[r][c] = 2.0f*c+r;
     159                        }
     160                    }
     161                    for (int r=0;r<rows;r++) {
     162                        for (int c=0;c<cols;c++) {
     163                            if (fabs(image->data.F64[r][c] - (2.0f*c+r)) > DBL_EPSILON) {
    164164                                psError(__func__,"Could not set all pixels in double image at (%d,%d)",c,r);
    165165                                psImageFree(image);
     
    176176                    for (int r=0;r<rows;r++) {
    177177                        for (int c=0;c<cols;c++) {
    178                             image->data.c32[r][c] = r + I * c;
    179                         }
    180                     }
    181                     for (int r=0;r<rows;r++) {
    182                         for (int c=0;c<cols;c++) {
    183                             if (fabsf(crealf(image->data.c32[r][c]) - r) > FLT_EPSILON ||
    184                                     fabsf(cimagf(image->data.c32[r][c]) - c) > FLT_EPSILON ) {
     178                            image->data.C32[r][c] = r + I * c;
     179                        }
     180                    }
     181                    for (int r=0;r<rows;r++) {
     182                        for (int c=0;c<cols;c++) {
     183                            if (fabsf(crealf(image->data.C32[r][c]) - r) > FLT_EPSILON ||
     184                                    fabsf(cimagf(image->data.C32[r][c]) - c) > FLT_EPSILON ) {
    185185                                psError(__func__,"Could not set all pixels in complex image at (%d,%d)",c,r);
    186186                                psImageFree(image);
     
    198198                    for (int r=0;r<rows;r++) {
    199199                        for (int c=0;c<cols;c++) {
    200                             image->data.ui8[r][c] = (uint8_t)(r + c);
    201                         }
    202                     }
    203                     for (int r=0;r<rows;r++) {
    204                         for (int c=0;c<cols;c++) {
    205                             if (image->data.ui8[r][c] != (uint8_t)(r + c)) {
     200                            image->data.U8[r][c] = (uint8_t)(r + c);
     201                        }
     202                    }
     203                    for (int r=0;r<rows;r++) {
     204                        for (int c=0;c<cols;c++) {
     205                            if (image->data.U8[r][c] != (uint8_t)(r + c)) {
    206206                                psError(__func__,"Could not set all pixels in image (type=%d) at (%d,%d)",
    207207                                        type[t],c,r);
  • trunk/psLib/test/sysUtils/tst_psMemory.c

    r647 r714  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-05-12 19:04:26 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-05-18 02:34:00 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    170170    cb = psMemExhaustedCallbackSet(TPOutOfMemoryExhaustedCallback);
    171171
    172     mem = (int*) psAlloc(LONG_MAX);
     172    mem = (int*) psAlloc(ULONG_MAX);
    173173
    174174    psMemExhaustedCallbackSet(cb);
Note: See TracChangeset for help on using the changeset viewer.