IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 206


Ignore:
Timestamp:
Mar 10, 2004, 12:07:04 PM (22 years ago)
Author:
eugene
Message:

cleaned up types / implementation for math operations

Location:
trunk/archive/pslib/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/archive/pslib/include/psImages.h

    r198 r206  
    1111 */
    1212
    13 /// image data type names.
    14 typedef enum {
    15     PS_U8  = 1,
    16     PS_U16 = 2,
    17     PS_U32 = 3,
    18     PS_F32 = 4,
    19     PS_F64 = 5,
    20 } PS_IMAGE_DEPTH;
    21 
    22 PS_DECLARE_ARRAY_TYPE(psFloatArray);    ///< Declare an array of real vectors (psFloatArrayArray).
    23 
    24 typedef unsigned char  psU8;            ///< BITPIX 8   (unsigned short)
    25 typedef unsigned short psU16;           ///< BITPIX 16  (unsigned int)
    26 typedef unsigned long  psU32;           ///< BITPIX 32  (unsigned long)
    27 typedef float          psF32;           ///< BITPIX -32 (float)
    28 typedef double         psF64;           ///< BITPIX -64 (double)
    29 
    3013/// basic image data structure.
    3114typedef struct psImage {
     15    psType type;                        ///< image data type and dimension
    3216    int nx, ny;                         ///< size of image
    3317    int x0, y0;                         ///< data region relative to parent
    34     PS_IMAGE_DEPTH depth;               ///< type of image
    3518    psF32 **rows;                       ///< == rows_f32
    3619    psU8  **rows_u8;                    ///< pointers to psU8 data
  • trunk/archive/pslib/include/psMath.h

    r204 r206  
    8383
    8484/** for a set of N data types, you need a collection of N^2 - 1 functions **/
     85
     86/*** example 3: embedded data type */
     87
     88psImage A, B, Y;
     89
     90B = psBinaryOp (NULL, A, "^", psScalar(2));
     91Y = psUnaryOp (NULL, B, "log");
     92
     93/** in this method, the data types (psImage, psVector) include embedded information about their data type in
     94 * the structure.  The constant value is then handled by calling the psScalar function which returns a private
     95 * scalar data type which is always freed by the code.  This forces the layout of the data structures to be
     96 * consistent, with the type information as the first entry.  We can then define a data type which is
     97 * completely flat and can be used to check on the data type of the data.
     98 */
     99
     100typedef struct {
     101    psTypeInfo type;
     102    union {
     103        int i;
     104        float f;
     105        double d;
     106    }
     107} p_psScalar;
     108
     109typedef struct {
     110    psType type;
     111    psDimension dim;
     112} psTypeInfo;
  • trunk/archive/pslib/include/psStdArrays.h

    r205 r206  
    3838 * generally.
    3939 */
    40 typedef float psFloat;
    41 typedef int psInt;
    42 typedef complex float psComplex;
    43 typedef double psDouble;
     40typedef float          psFloat;         ///< BITPIX -32 (float)
     41typedef float          psF32;           ///< BITPIX -32 (float)
     42typedef double         psDouble;
     43typedef double         psF64;           ///< BITPIX -64 (double)
     44
     45typedef complex float  psComplex;
     46
     47typedef int8_t         psS8;
     48typedef int16_t        psS16;
     49typedef int32_t        psS32;
     50typedef int64_t        psS64;
     51typedef int8_t         psChar;
     52typedef int16_t        psShort;
     53typedef int32_t        psInt;
     54typedef int64_t        psLong;
     55
     56typedef uint8_t        psU8;            ///< BITPIX 8   
     57typedef uint16_t       psU16;           ///< BITPIX 16 
     58typedef uint32_t       psU32;           ///< BITPIX 32 
     59typedef uint64_t       psU64;           
     60typedef uint8_t        psUchar;         ///< BITPIX 8   
     61typedef uint16_t       psUshort;        ///< BITPIX 16 
     62typedef uint32_t       psUint;          ///< BITPIX 32 
     63typedef uint64_t       psUlong;         
    4464
    4565/** An array of real numbers */
     
    5272/** An array of complex numbers */
    5373PS_DECLARE_ARRAY_TYPE(psComplex);
    54 PS_CREATE_ARRAY_TYPE(psComplex);
    5574
    5675/** An array of integers */
    5776PS_DECLARE_ARRAY_TYPE(psInt);
    58 PS_CREATE_ARRAY_TYPE(psInt);
    5977
    6078/** An array of double-precision real numbers */
    6179PS_DECLARE_ARRAY_TYPE(psDouble);
    62 PS_CREATE_ARRAY_TYPE(psDouble);
     80
     81PS_DECLARE_ARRAY_TYPE(psFloatArray);    ///< Declare an array of real vectors (psFloatArrayArray).
    6382
    6483#endif
Note: See TracChangeset for help on using the changeset viewer.