IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 693


Ignore:
Timestamp:
May 14, 2004, 2:14:56 PM (22 years ago)
Author:
desonia
Message:

Fixed error found during testing of psImage.

Location:
trunk/psLib/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/src/image/psImage.c

    r692 r693  
    77 *  @author Ross Harman, MHPCC
    88 *   
    9  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-05-14 22:39:58 $
     9 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-05-15 00:14:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434    area = numCols*numRows;
    3535
     36    if (area < 1) {
     37        psError(__func__, "Invalid value for number of rows or columns (numRows=%d, numCols=%d).",
     38                numRows, numCols);
     39        return NULL;
     40    }
     41
    3642    psImage *image = (psImage *)psAlloc(sizeof(psImage));
    3743
    38     if(area < 1) {
    39         image->data.v[0] = NULL;
    40     } else {
    41         image->data.v[0] = psAlloc(area*elementSize);
     44    image->data.v = psAlloc(sizeof(void*)*numRows);
    4245
    43         for(int i = 1; i < numRows; i++) {
    44             image->data.v[i] = (void*)((int8_t*)image->data.v[i-1]+rowSize);
    45         }
     46    image->data.v[0] = psAlloc(area*elementSize);
     47
     48    for(int i = 1; i < numRows; i++) {
     49        image->data.v[i] = (void*)((int8_t*)image->data.v[i-1]+rowSize);
    4650    }
    4751
  • trunk/psLib/src/mathtypes/psImage.c

    r692 r693  
    77 *  @author Ross Harman, MHPCC
    88 *   
    9  *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
    10  *  @date $Date: 2004-05-14 22:39:58 $
     9 *  @version $Revision: 1.7 $ $Name: not supported by cvs2svn $
     10 *  @date $Date: 2004-05-15 00:14:56 $
    1111 *
    1212 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    3434    area = numCols*numRows;
    3535
     36    if (area < 1) {
     37        psError(__func__, "Invalid value for number of rows or columns (numRows=%d, numCols=%d).",
     38                numRows, numCols);
     39        return NULL;
     40    }
     41
    3642    psImage *image = (psImage *)psAlloc(sizeof(psImage));
    3743
    38     if(area < 1) {
    39         image->data.v[0] = NULL;
    40     } else {
    41         image->data.v[0] = psAlloc(area*elementSize);
     44    image->data.v = psAlloc(sizeof(void*)*numRows);
    4245
    43         for(int i = 1; i < numRows; i++) {
    44             image->data.v[i] = (void*)((int8_t*)image->data.v[i-1]+rowSize);
    45         }
     46    image->data.v[0] = psAlloc(area*elementSize);
     47
     48    for(int i = 1; i < numRows; i++) {
     49        image->data.v[i] = (void*)((int8_t*)image->data.v[i-1]+rowSize);
    4650    }
    4751
  • trunk/psLib/src/sys/psType.h

    r672 r693  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-13 23:36:27 $
     21 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-05-15 00:14:56 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242 */
    4343typedef enum {
    44     PS_TYPE_INT8 = 0x11,              ///< Character.
    45     PS_TYPE_INT16 = 0x12,             ///< Short integer.
    46     PS_TYPE_INT32 = 0x14,             ///< Integer.
    47     PS_TYPE_INT64 = 0x18,             ///< Long integer.
    48     PS_TYPE_UINT8 = 0x31,             ///< Unsigned character.
    49     PS_TYPE_UINT16 = 0x32,            ///< Unsigned short integer.
    50     PS_TYPE_UINT32 = 0x34,            ///< Unsigned integer.
    51     PS_TYPE_UINT64 = 0x38,            ///< Unsigned long integer.
    52     PS_TYPE_FLOAT = 0x44,             ///< Single-precision Floating point.
    53     PS_TYPE_DOUBLE = 0x48,            ///< Double-precision floating point.
    54     PS_TYPE_COMPLEX_FLOAT = 0x84,     ///< Complex numbers consisting of single-precision floating point.
    55     PS_TYPE_COMPLEX_DOUBLE = 0x88,    ///< Complex numbers consisting of double-precision floating point.
     44    PS_TYPE_INT8 = 0x101,              ///< Character.
     45    PS_TYPE_INT16 = 0x102,             ///< Short integer.
     46    PS_TYPE_INT32 = 0x104,             ///< Integer.
     47    PS_TYPE_INT64 = 0x108,             ///< Long integer.
     48    PS_TYPE_UINT8 = 0x301,             ///< Unsigned character.
     49    PS_TYPE_UINT16 = 0x302,            ///< Unsigned short integer.
     50    PS_TYPE_UINT32 = 0x304,            ///< Unsigned integer.
     51    PS_TYPE_UINT64 = 0x308,            ///< Unsigned long integer.
     52    PS_TYPE_FLOAT = 0x404,             ///< Single-precision Floating point.
     53    PS_TYPE_DOUBLE = 0x408,            ///< Double-precision floating point.
     54    PS_TYPE_COMPLEX_FLOAT = 0x808,     ///< Complex numbers consisting of single-precision floating point.
     55    PS_TYPE_COMPLEX_DOUBLE = 0x810,    ///< Complex numbers consisting of double-precision floating point.
    5656    PS_TYPE_PTR = 0x00,               ///< Something else that's not supported for arithmetic.}
    5757} psElemType;
    5858
    59 #define IS_PSELEMTYPE_INT(x) (x & 0x10 == 0x10)
    60 #define IS_PSELEMTYPE_UNSIGNED(x) (x & 0x20 == 0x20)
    61 #define IS_PSELEMTYPE_REAL(x) (x & 0x40 == 0x40)
    62 #define IS_PSELEMTYPE_COMPLEX(x) (x & 0x80 == 0x80)
    63 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) : (x & 0x0F) )
     59#define IS_PSELEMTYPE_INT(x) (x & 0x100 == 0x100)
     60#define IS_PSELEMTYPE_UNSIGNED(x) (x & 0x200 == 0x200)
     61#define IS_PSELEMTYPE_REAL(x) (x & 0x400 == 0x400)
     62#define IS_PSELEMTYPE_COMPLEX(x) (x & 0x800 == 0x800)
     63#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) : (x & 0xFF) )
    6464
    6565/** Dimensions of a data type.
  • trunk/psLib/src/sysUtils/psType.h

    r672 r693  
    1919 *  @author Ross Harman, MHPCC
    2020 *
    21  *  @version $Revision: 1.1 $ $Name: not supported by cvs2svn $
    22  *  @date $Date: 2004-05-13 23:36:27 $
     21 *  @version $Revision: 1.2 $ $Name: not supported by cvs2svn $
     22 *  @date $Date: 2004-05-15 00:14:56 $
    2323 *
    2424 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4242 */
    4343typedef enum {
    44     PS_TYPE_INT8 = 0x11,              ///< Character.
    45     PS_TYPE_INT16 = 0x12,             ///< Short integer.
    46     PS_TYPE_INT32 = 0x14,             ///< Integer.
    47     PS_TYPE_INT64 = 0x18,             ///< Long integer.
    48     PS_TYPE_UINT8 = 0x31,             ///< Unsigned character.
    49     PS_TYPE_UINT16 = 0x32,            ///< Unsigned short integer.
    50     PS_TYPE_UINT32 = 0x34,            ///< Unsigned integer.
    51     PS_TYPE_UINT64 = 0x38,            ///< Unsigned long integer.
    52     PS_TYPE_FLOAT = 0x44,             ///< Single-precision Floating point.
    53     PS_TYPE_DOUBLE = 0x48,            ///< Double-precision floating point.
    54     PS_TYPE_COMPLEX_FLOAT = 0x84,     ///< Complex numbers consisting of single-precision floating point.
    55     PS_TYPE_COMPLEX_DOUBLE = 0x88,    ///< Complex numbers consisting of double-precision floating point.
     44    PS_TYPE_INT8 = 0x101,              ///< Character.
     45    PS_TYPE_INT16 = 0x102,             ///< Short integer.
     46    PS_TYPE_INT32 = 0x104,             ///< Integer.
     47    PS_TYPE_INT64 = 0x108,             ///< Long integer.
     48    PS_TYPE_UINT8 = 0x301,             ///< Unsigned character.
     49    PS_TYPE_UINT16 = 0x302,            ///< Unsigned short integer.
     50    PS_TYPE_UINT32 = 0x304,            ///< Unsigned integer.
     51    PS_TYPE_UINT64 = 0x308,            ///< Unsigned long integer.
     52    PS_TYPE_FLOAT = 0x404,             ///< Single-precision Floating point.
     53    PS_TYPE_DOUBLE = 0x408,            ///< Double-precision floating point.
     54    PS_TYPE_COMPLEX_FLOAT = 0x808,     ///< Complex numbers consisting of single-precision floating point.
     55    PS_TYPE_COMPLEX_DOUBLE = 0x810,    ///< Complex numbers consisting of double-precision floating point.
    5656    PS_TYPE_PTR = 0x00,               ///< Something else that's not supported for arithmetic.}
    5757} psElemType;
    5858
    59 #define IS_PSELEMTYPE_INT(x) (x & 0x10 == 0x10)
    60 #define IS_PSELEMTYPE_UNSIGNED(x) (x & 0x20 == 0x20)
    61 #define IS_PSELEMTYPE_REAL(x) (x & 0x40 == 0x40)
    62 #define IS_PSELEMTYPE_COMPLEX(x) (x & 0x80 == 0x80)
    63 #define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) : (x & 0x0F) )
     59#define IS_PSELEMTYPE_INT(x) (x & 0x100 == 0x100)
     60#define IS_PSELEMTYPE_UNSIGNED(x) (x & 0x200 == 0x200)
     61#define IS_PSELEMTYPE_REAL(x) (x & 0x400 == 0x400)
     62#define IS_PSELEMTYPE_COMPLEX(x) (x & 0x800 == 0x800)
     63#define PSELEMTYPE_SIZEOF(x) ( (x==PS_TYPE_PTR) ? sizeof(void*) : (x & 0xFF) )
    6464
    6565/** Dimensions of a data type.
Note: See TracChangeset for help on using the changeset viewer.