IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1606


Ignore:
Timestamp:
Aug 23, 2004, 12:36:04 PM (22 years ago)
Author:
desonia
Message:

changed psImageSubset to subset an image without making a deep copy.

Location:
trunk/psLib
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/psLib.kdevses

    r1549 r1606  
    22<!DOCTYPE KDevPrjSession>
    33<KDevPrjSession>
    4  <DocsAndViews NumberOfDocuments="8" >
    5   <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psMemory.c" >
     4 <DocsAndViews NumberOfDocuments="2" >
     5  <Doc0 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImage.c" >
    66   <View0 line="0" Type="???" >
    7     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="751" Left="2" MinMaxMode="0" />
     7    <AdditionalSettings Top="2" Width="1183" Attach="1" Height="775" Left="2" MinMaxMode="0" />
    88   </View0>
    99  </Doc0>
    10   <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/test/sysUtils/tst_psMemory.c" >
    11    <View0 line="227" Type="???" >
    12     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
     10  <Doc1 NumberOfViews="1" URL="file:/home/desonia/psLib/src/image/psImage.h" >
     11   <View0 line="31" Type="???" >
     12    <AdditionalSettings Top="2" Width="1183" Attach="1" Height="749" Left="2" MinMaxMode="0" />
    1313   </View0>
    1414  </Doc1>
    15   <Doc2 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psType.h" >
    16    <View0 line="93" Type="???" >
    17     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
    18    </View0>
    19   </Doc2>
    20   <Doc3 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psMetadata_02.c" >
    21    <View0 line="0" Type="???" >
    22     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
    23    </View0>
    24   </Doc3>
    25   <Doc4 NumberOfViews="1" URL="file:/home/desonia/psLib/test/astronomy/tst_psMetadata_01.c" >
    26    <View0 line="242" Type="???" >
    27     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="531" Left="2" MinMaxMode="0" />
    28    </View0>
    29   </Doc4>
    30   <Doc5 NumberOfViews="1" URL="file:/home/desonia/psLib/src/astronomy/psMetadata.c" >
    31    <View0 line="45" Type="???" >
    32     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
    33    </View0>
    34   </Doc5>
    35   <Doc6 NumberOfViews="1" URL="file:/home/desonia/psLib/src/sysUtils/psError.c" >
    36    <View0 line="86" Type="???" >
    37     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="531" Left="2" MinMaxMode="0" />
    38    </View0>
    39   </Doc6>
    40   <Doc7 NumberOfViews="1" URL="file:/home/desonia/psLib/src/astronomy/makedir/psAstrometry.d" >
    41    <View0 line="0" Type="???" >
    42     <AdditionalSettings Top="2" Width="1136" Attach="1" Height="533" Left="2" MinMaxMode="0" />
    43    </View0>
    44   </Doc7>
    4515 </DocsAndViews>
    4616 <pluginList>
  • trunk/psLib/src/image/psImage.c

    r1440 r1606  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 23:34:58 $
     12 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-23 22:36:03 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343{
    4444    int area = 0;
    45     int elementSize = PSELEMTYPE_SIZEOF(type);  // element
    46 
    47     // size in
    48     // bytes
    49     int rowSize = numCols * elementSize;        // row
    50 
    51     // size
    52 
    53     // in bytes.
     45    int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     46    int rowSize = numCols * elementSize;        // row size in bytes.
    5447
    5548    area = numCols * numRows;
     
    7164    image->data.V = psAlloc(sizeof(void *) * numRows);
    7265    if (image->data.V == NULL) {
     66        psFree(image);
    7367        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
    7468    }
    7569
    76     image->data.V[0] = psAlloc(area * elementSize);
    77     if (image->data.V[0] == NULL) {
     70    image->rawDataBuffer = psAlloc(area * elementSize);
     71    if (image->rawDataBuffer == NULL) {
     72        psFree(image);
     73        psFree(image->data.V);
    7874        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
    7975    }
    8076
     77    // set the row pointers.
     78    image->data.V[0] = image->rawDataBuffer;
    8179    for (int i = 1; i < numRows; i++) {
    8280        image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
     
    119117    psImageFreeChildren(image);
    120118
    121     psFree(image->data.V[0]);
     119    psFree(image->rawDataBuffer);
    122120    psFree(image->data.V);
    123121    image->data.V = NULL;
     
    167165    }
    168166    // Resize the image buffer
    169     old->data.V[0] = psRealloc(old->data.V[0], numCols * numRows * elementSize);
     167    old->rawDataBuffer = psRealloc(old->data.V[0], numCols * numRows * elementSize);
    170168    old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
    171169
    172170    // recreate the row pointers
     171    old->data.V[0] = old->rawDataBuffer;
    173172    for (int i = 1; i < numRows; i++) {
    174173        old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
  • trunk/psLib/src/image/psImage.h

    r1442 r1606  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-10 01:05:53 $
     14 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-23 22:36:03 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6868    int nChildren;                     ///< Number of subimages.
    6969    struct psImage* *children;         ///< Children of this region.
     70
     71    void* rawDataBuffer;
    7072}
    7173psImage;
  • trunk/psLib/src/image/psImageExtraction.c

    r1603 r1606  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-20 01:10:54 $
     12*  @version $Revision: 1.11 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-23 22:36:03 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    2323#include "psError.h"
    2424
    25 psImage* psImageSubset(psImage* out,
    26                        psImage* image,
     25psImage* psImageSubset(psImage* image,
    2726                       unsigned int numCols,
    2827                       unsigned int numRows,
     
    3029                       unsigned int row0)
    3130{
    32     unsigned int elementSize;   // size of image
    33 
    34     // element in
    35     // bytes
    36     unsigned int outputRowSize; // output row
    37 
    38     // size in bytes
    39     unsigned int inputColOffset;        // offset
    40 
    41     // in
    42     // bytes
    43     // to
    44     // first
    45     // subset
    46 
    47     // pixel in input row
     31    psImage* out;
     32    unsigned int elementSize;          // size of image element in bytes
     33    unsigned int inputColOffset;       // offset in bytes to first subset pixel in input row
    4834
    4935    if (image == NULL || image->data.V == NULL) {
     
    8066    elementSize = PSELEMTYPE_SIZEOF(image->type.type);
    8167
    82     out = psImageRecycle(out, numCols, numRows, image->type.type);
    83 
    84     // set the parent information into the child
    85     // output image
    86     *(int *)&out->row0 = row0;
    87     *(int *)&out->col0 = col0;
    88     *(psImage* *) & out->parent = (psImage* ) image;
     68    out = psAlloc(sizeof(psImage));
     69    *(psType*)&out->type = image->type;
     70    *(unsigned int*)&out->numCols = numCols;
     71    *(unsigned int*)&out->numRows = numRows;
     72    *(int*)&out->row0 = row0;
     73    *(int*)&out->col0 = col0;
     74    out->parent = image;
     75    out->nChildren = 0;
     76    out->children = NULL;
     77    out->rawDataBuffer = psMemIncrRefCounter(image->rawDataBuffer);
     78    out->data.V = psAlloc(sizeof(void*)*numRows);
     79
     80    // set the new psImage's deallocator to the same as the input image
     81    p_psMemSetDeallocator(out,p_psMemGetDeallocator(image));
     82
     83    inputColOffset = elementSize * col0;
     84    for (int row = 0; row < numRows; row++) {
     85        out->data.V[row] = image->data.U8[row0 + row] + inputColOffset;
     86    }
    8987
    9088    // add output image as a child of the input
    9189    // image.
    9290    image->nChildren++;
    93     image->children = (psImage* *) psRealloc(image->children, image->nChildren * sizeof(psImage* ));
     91    image->children = (psImage**) psRealloc(image->children, image->nChildren * sizeof(psImage* ));
    9492    image->children[image->nChildren - 1] = out;
    95 
    96     inputColOffset = elementSize * col0;
    97     outputRowSize = elementSize * numCols;
    98 
    99     for (int row = 0; row < numRows; row++) {
    100         memcpy(out->data.V[row], image->data.U8[row0 + row] + inputColOffset, outputRowSize);
    101     }
    10293
    10394    return (out);
     
    151142    // datatype.
    152143    if (type == inDatatype) {
    153         memcpy(output->data.V[0], input->data.V[0], elementSize * elements);
     144        for (int row=0;row<numRows;row++) {
     145            memcpy(output->data.V[row], input->data.V[row], elementSize * numCols);
     146        }
    154147        return output;
    155148    }
    156149    #define PSIMAGE_ELEMENT_COPY(IN,INTYPE,OUT,OUTTYPE,ELEMENTS) { \
    157         ps##INTYPE *in = IN->data.INTYPE[0]; \
    158         ps##OUTTYPE *out = OUT->data.OUTTYPE[0]; \
    159         for (int e=0;e<ELEMENTS;e++) { \
    160             *(out++) = *(in++); \
     150        ps##INTYPE *in; \
     151        ps##OUTTYPE *out; \
     152        for(int row=0;row<numRows;row++) { \
     153            in = IN->data.INTYPE[row]; \
     154            out = OUT->data.OUTTYPE[row]; \
     155            for (int col=0;col<numCols;col++) { \
     156                *(out++) = *(in++); \
     157            } \
    161158        } \
    162159    }
  • trunk/psLib/src/image/psImageExtraction.h

    r1441 r1606  
    1010*  @author Robert DeSonia, MHPCC
    1111*
    12 *  @version $Revision: 1.9 $ $Name: not supported by cvs2svn $
    13 *  @date $Date: 2004-08-09 23:40:55 $
     12*  @version $Revision: 1.10 $ $Name: not supported by cvs2svn $
     13*  @date $Date: 2004-08-23 22:36:03 $
    1414*
    1515*  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4444 */
    4545psImage* psImageSubset(
    46     psImage* out,                      ///< image to recycle, or NULL.
    4746    psImage* image,                    ///< Parent image.
    4847    unsigned int numCols,              ///< Subimage width (<= image.nCols - col0).
     
    5049    unsigned int col0,                 ///< Subimage col-offset (0 <= col0 < nCol).
    5150    unsigned int row0                  ///< Subimage row-offset (0 <= row0 < nCol).
     51);
     52
     53/** Create a subimage of the specified area.
     54 *
     55 * Uses psLib memory allocation functions to create an image based on a larger
     56 * one.
     57 *
     58 * @return psImage* : Pointer to psImage.
     59 *
     60 */
     61psImage* psImageSubsection(
     62    psImage* image,                    ///< Parent image.
     63    const char* section                ///< Subsection in the form '[x1:x2,y1:y2]'
    5264);
    5365
  • trunk/psLib/src/mathtypes/psImage.c

    r1440 r1606  
    1010 *  @author Ross Harman, MHPCC
    1111 *
    12  *  @version $Revision: 1.39 $ $Name: not supported by cvs2svn $
    13  *  @date $Date: 2004-08-09 23:34:58 $
     12 *  @version $Revision: 1.40 $ $Name: not supported by cvs2svn $
     13 *  @date $Date: 2004-08-23 22:36:03 $
    1414 *
    1515 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    4343{
    4444    int area = 0;
    45     int elementSize = PSELEMTYPE_SIZEOF(type);  // element
    46 
    47     // size in
    48     // bytes
    49     int rowSize = numCols * elementSize;        // row
    50 
    51     // size
    52 
    53     // in bytes.
     45    int elementSize = PSELEMTYPE_SIZEOF(type);  // element size in bytes
     46    int rowSize = numCols * elementSize;        // row size in bytes.
    5447
    5548    area = numCols * numRows;
     
    7164    image->data.V = psAlloc(sizeof(void *) * numRows);
    7265    if (image->data.V == NULL) {
     66        psFree(image);
    7367        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
    7468    }
    7569
    76     image->data.V[0] = psAlloc(area * elementSize);
    77     if (image->data.V[0] == NULL) {
     70    image->rawDataBuffer = psAlloc(area * elementSize);
     71    if (image->rawDataBuffer == NULL) {
     72        psFree(image);
     73        psFree(image->data.V);
    7874        psAbort(__func__, " : Line %d - Failed to allocate memory", __LINE__);
    7975    }
    8076
     77    // set the row pointers.
     78    image->data.V[0] = image->rawDataBuffer;
    8179    for (int i = 1; i < numRows; i++) {
    8280        image->data.V[i] = (void *)((int8_t *) image->data.V[i - 1] + rowSize);
     
    119117    psImageFreeChildren(image);
    120118
    121     psFree(image->data.V[0]);
     119    psFree(image->rawDataBuffer);
    122120    psFree(image->data.V);
    123121    image->data.V = NULL;
     
    167165    }
    168166    // Resize the image buffer
    169     old->data.V[0] = psRealloc(old->data.V[0], numCols * numRows * elementSize);
     167    old->rawDataBuffer = psRealloc(old->data.V[0], numCols * numRows * elementSize);
    170168    old->data.V = (void **)psRealloc(old->data.V, numRows * sizeof(void *));
    171169
    172170    // recreate the row pointers
     171    old->data.V[0] = old->rawDataBuffer;
    173172    for (int i = 1; i < numRows; i++) {
    174173        old->data.V[i] = (void *)((int8_t *) old->data.V[i - 1] + rowSize);
  • trunk/psLib/src/mathtypes/psImage.h

    r1442 r1606  
    1212 *  @author Ross Harman, MHPCC
    1313 *
    14  *  @version $Revision: 1.32 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-10 01:05:53 $
     14 *  @version $Revision: 1.33 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-23 22:36:03 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    6868    int nChildren;                     ///< Number of subimages.
    6969    struct psImage* *children;         ///< Children of this region.
     70
     71    void* rawDataBuffer;
    7072}
    7173psImage;
  • trunk/psLib/src/sys/psMemory.h

    r1448 r1606  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-10 01:55:34 $
     14 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-23 22:36:03 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    135135               );
    136136
    137 void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
    138 psFreeFcn p_psMemGetDeallocator(void *ptr);
    139 
    140137/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    141138#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
    142139#endif
     140
     141/** Set the deallocator routine
     142 *
     143 *  A deallocator routine can optionally be assigned to a memory block to
     144 *  ensure that associated memory blocks also get freed, e.g., memory buffers
     145 *  referenced within a struct.
     146 *
     147 */
     148void p_psMemSetDeallocator(
     149    void *ptr,                         ///< the memory block to operate on
     150    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
     151);
     152
     153/** Get the deallocator routine
     154 *
     155 *  This function returns the deallocator for a memory block.  A deallocator
     156 *  routine can optionally be assigned to a memory block to ensure that
     157 *  associated memory blocks also get freed, e.g., memory buffers referenced
     158 *  within a struct. 
     159 *
     160 *  @return psFreeFcn    the routine to be called at deallocation.
     161 */
     162psFreeFcn p_psMemGetDeallocator(
     163    void *ptr                          ///< the memory block
     164);
    143165
    144166/** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
  • trunk/psLib/src/sysUtils/psMemory.h

    r1448 r1606  
    1212 *  @ingroup MemoryManagement
    1313 *
    14  *  @version $Revision: 1.28 $ $Name: not supported by cvs2svn $
    15  *  @date $Date: 2004-08-10 01:55:34 $
     14 *  @version $Revision: 1.29 $ $Name: not supported by cvs2svn $
     15 *  @date $Date: 2004-08-23 22:36:03 $
    1616 *
    1717 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    135135               );
    136136
    137 void p_psMemSetDeallocator(void *ptr, psFreeFcn freeFcn);
    138 psFreeFcn p_psMemGetDeallocator(void *ptr);
    139 
    140137/// Memory allocation. psAlloc sends file and line number to p_psAlloc.
    141138#define psAlloc(size) p_psAlloc(size, __FILE__, __LINE__)
    142139#endif
     140
     141/** Set the deallocator routine
     142 *
     143 *  A deallocator routine can optionally be assigned to a memory block to
     144 *  ensure that associated memory blocks also get freed, e.g., memory buffers
     145 *  referenced within a struct.
     146 *
     147 */
     148void p_psMemSetDeallocator(
     149    void *ptr,                         ///< the memory block to operate on
     150    psFreeFcn freeFcn                  ///< the function to be executed at deallocation
     151);
     152
     153/** Get the deallocator routine
     154 *
     155 *  This function returns the deallocator for a memory block.  A deallocator
     156 *  routine can optionally be assigned to a memory block to ensure that
     157 *  associated memory blocks also get freed, e.g., memory buffers referenced
     158 *  within a struct. 
     159 *
     160 *  @return psFreeFcn    the routine to be called at deallocation.
     161 */
     162psFreeFcn p_psMemGetDeallocator(
     163    void *ptr                          ///< the memory block
     164);
    143165
    144166/** Memory re-allocation.  This operates much like realloc(), but is guaranteed to return a non-NULL value.
  • trunk/psLib/test/image/tst_psImage.c

    r1406 r1606  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.22 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-08-06 22:34:06 $
     8 *  @version $Revision: 1.23 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-08-23 22:36:03 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5050    psLogSetLevel(PS_LOG_INFO);
    5151
    52     if (! runTestSuite(stderr,"psImage",tests,argc,argv)) {
    53         psError(__FILE__,"One or more tests failed");
    54         return 1;
    55     }
    56     return 0;
     52    return ! runTestSuite(stderr,"psImage",tests,argc,argv);
    5753}
    5854
     
    247243    // children isfreed.
    248244    image = psImageAlloc(100,100,PS_TYPE_F32);
    249     psImageSubset(NULL,image,50,50,0,0);
    250     psImageSubset(NULL,image,50,50,20,20);
     245    psImageSubset(image,50,50,0,0);
     246    psImageSubset(image,50,50,20,20);
    251247
    252248    psFree(image);
     
    273269    }
    274270
    275     psLogMsg(__func__,PS_LOG_INFO,"memcpy(&preSubsetStruct,original,sizeof(psImage));");
    276271    memcpy(&preSubsetStruct,original,sizeof(psImage));
    277272
    278     psLogMsg(__func__,PS_LOG_INFO,"subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);");
    279     subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);
    280 
    281     psLogMsg(__func__,PS_LOG_INFO,"subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);");
    282     subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);
    283 
    284     psLogMsg(__func__,PS_LOG_INFO,"subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);");
    285     subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);
    286 
    287     psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure is equal to the input psImage "
    288              "structure parameter out, if input parameter out is specified.");
    289 
    290     if (subset1 != subset2 || subset2 == NULL) {
    291         psError(__func__,"psImageSubset didn't recycle the psImage given");
    292         return 1;
    293     }
    294 
    295     psLogMsg(__func__,PS_LOG_INFO,"Verify a new psImage structure is created, if input parameter out is set "
    296              "to null.");
    297 
    298     if (subset3 == NULL) {
    299         psError(__func__,"psImageSubset output was NULL for subset3.");
    300         return 2;
    301     }
     273    subset2 = psImageSubset(original,c/2,r/2,c/4,r/4);
     274
     275    subset3 = psImageSubset(original,c/2,r/2,0,0);
    302276
    303277    psLogMsg(__func__,PS_LOG_INFO,"Verify the returned psImage structure contains expected values in the "
     
    397371
    398372    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    399     subset1 = psImageSubset(NULL,NULL,c/2,r/2,0,0);
     373    subset1 = psImageSubset(NULL,c/2,r/2,0,0);
    400374    if (subset1 != NULL) {
    401375        psError(__func__,"psImageSubset didn't return NULL when input image was NULL.");
     
    409383    memcpy(&preSubsetStruct,original,sizeof(psImage));
    410384    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    411     subset1 = psImageSubset(NULL,original,c/2,0,0,0);
     385    subset1 = psImageSubset(original,c/2,0,0,0);
    412386    if (subset1 != NULL) {
    413387        psError(__func__,"psImageSubset didn't return NULL when numRows=0.");
     
    415389    }
    416390    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    417     subset1 = psImageSubset(NULL,original,0,r/2,0,0);
     391    subset1 = psImageSubset(original,0,r/2,0,0);
    418392    if (subset1 != NULL) {
    419393        psError(__func__,"psImageSubset didn't return NULL when numCols=0.");
     
    431405
    432406    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    433     subset1 = psImageSubset(NULL,original,c/2,r/2,c,0);
     407    subset1 = psImageSubset(original,c/2,r/2,c,0);
    434408    if (subset1 != NULL) {
    435409        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    438412    }
    439413    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    440     subset1 = psImageSubset(NULL,original,c/2,r/2,0,r);
     414    subset1 = psImageSubset(original,c/2,r/2,0,r);
    441415    if (subset1 != NULL) {
    442416        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    445419    }
    446420    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    447     subset1 = psImageSubset(NULL,original,c/2,r/2,-1,0);
     421    subset1 = psImageSubset(original,c/2,r/2,-1,0);
    448422    if (subset1 != NULL) {
    449423        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    452426    }
    453427    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    454     subset1 = psImageSubset(NULL,original,c/2,r/2,0,-1);
     428    subset1 = psImageSubset(original,c/2,r/2,0,-1);
    455429    if (subset1 != NULL) {
    456430        psError(__func__,"psImageSubset didn't return NULL when subset origin was outside of "
     
    465439
    466440    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    467     subset1 = psImageSubset(NULL,original,c/2,r/2,c/2,0);
     441    subset1 = psImageSubset(original,c/2,r/2,c/2,0);
    468442    if (subset1 != NULL) {
    469443        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via rows).");
     
    471445    }
    472446    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    473     subset1 = psImageSubset(NULL,original,c/2,r/2,0,r/2);
     447    subset1 = psImageSubset(original,c/2,r/2,0,r/2);
    474448    if (subset1 != NULL) {
    475449        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via cols).");
     
    477451    }
    478452    psLogMsg(__func__,PS_LOG_INFO,"An error should follow...");
    479     subset1 = psImageSubset(NULL,original,c/2,r/2,c/2,r/2);
     453    subset1 = psImageSubset(original,c/2,r/2,c/2,r/2);
    480454    if (subset1 != NULL) {
    481455        psError(__func__,"psImageSubset didn't return NULL when subset was outside of image (via row+cols).");
  • trunk/psLib/test/image/tst_psImageFFT.c

    r1406 r1606  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.5 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-08-06 22:34:06 $
     8 *  @version $Revision: 1.6 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-08-23 22:36:03 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    5858    psLogSetLevel(PS_LOG_INFO);
    5959
    60     if (! runTestSuite(stderr,"psFFT",tests,argc,argv) ) {
    61         psAbort(__FILE__,"One or more tests failed");
    62     }
    63     return 0;
     60    return (! runTestSuite(stderr,"psFFT",tests,argc,argv) );
    6461}
    6562
     
    8481
    8582    // 2. perform a forward transform
    86     img2 = psImageFFT(NULL,img,PS_FFT_FORWARD);
     83    img2 = psImageFFT(img2,img,PS_FFT_FORWARD);
    8784    if (img2->type.type != PS_TYPE_C32) {
    8885        psError(__func__,"FFT didn't produce complex values?");
     
    109106    }
    110107
     108
    111109    // 4. perform a reverse transform
    112     img3 = psImageFFT(NULL,img2,PS_FFT_REVERSE);
     110    img3 = psImageFFT(img3,img2,PS_FFT_REVERSE);
     111
    113112    if (img3->type.type != PS_TYPE_C32) {
    114113        psError(__func__,"FFT didn't produce complex values?");
     
    122121            psF32 pixel = creal(img3Row[col])/m/n;
    123122            if (fabsf(pixel-imgRow[col]) > 0.1) {
    124                 psError(__func__,"Reverse FFT didn't gime original image back (%d,%d %.2f vs %.2f)",
     123                psError(__func__,"Reverse FFT didn't give original image back (%d,%d %.2f vs %.2f)",
    125124                        col,row,pixel,imgRow[col]);
    126125                return 5;
  • trunk/psLib/test/image/verified/tst_psImage.stderr

    r1404 r1606  
    3939\**********************************************************************************/
    4040
    41 <DATE><TIME>|<HOST>|I|testImageSubset|memcpy(&preSubsetStruct,original,sizeof(psImage));
    42 <DATE><TIME>|<HOST>|I|testImageSubset|subset1 = psImageAlloc(c/4,r/4,PS_TYPE_U8);
    43 <DATE><TIME>|<HOST>|I|testImageSubset|subset2 = psImageSubset(subset1,original,c/2,r/2,c/4,r/4);
    44 <DATE><TIME>|<HOST>|I|testImageSubset|subset3 = psImageSubset(NULL,original,c/2,r/2,0,0);
    45 <DATE><TIME>|<HOST>|I|testImageSubset|Verify the returned psImage structure is equal to the input psImage structure parameter out, if input parameter out is specified.
    46 <DATE><TIME>|<HOST>|I|testImageSubset|Verify a new psImage structure is created, if input parameter out is set to null.
    4741<DATE><TIME>|<HOST>|I|testImageSubset|Verify the returned psImage structure contains expected values in the row member, if the input psImage structure image contains known values.
    4842<DATE><TIME>|<HOST>|I|testImageSubset|Verify the returned psImage structure members nrow and ncol are equal to the input parameter nrow and ncol respectively.
Note: See TracChangeset for help on using the changeset viewer.