IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 1682


Ignore:
Timestamp:
Sep 2, 2004, 11:17:03 AM (22 years ago)
Author:
evanalst
Message:

Add addition case to testImageCopy for when output argument is NULL the
new image structure created should be of the same type as the input.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psLib/test/image/tst_psImage.c

    r1664 r1682  
    66 *  @author Robert DeSonia, MHPCC
    77 *
    8  *  @version $Revision: 1.24 $ $Name: not supported by cvs2svn $
    9  *  @date $Date: 2004-08-31 19:36:02 $
     8 *  @version $Revision: 1.25 $ $Name: not supported by cvs2svn $
     9 *  @date $Date: 2004-09-02 21:17:03 $
    1010 *
    1111 *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
     
    526526    psImage* img2 = NULL;
    527527    psImage* img3 = NULL;
     528    psImage* img4 = NULL;
    528529    unsigned int c = 128;
    529530    unsigned int r = 256;
     
    550551        psError(__func__,"the image given for recycled wasn't");
    551552        return 1;
     553    }
     554
     555    // Verify the returned psImage structure is the same type as the input image structure
     556    // if the specified output argument is NULL.
     557    img4 = psImageCopy(NULL,img,PS_TYPE_F32);
     558    if (img4 == NULL) {
     559        psError(__func__,"output image doesn't exist");
     560        return 4;
     561    }
     562    if (img4->type.type != img->type.type) {
     563        psError(__func__,"output image is not the same type as input image");
     564        return 4;
     565    }
     566    for (unsigned int row=0;row<r;row++) {
     567        psF32* imgInRow = img->data.F32[row];
     568        psF32* imgOutRow = img4->data.F32[row];
     569        for (unsigned col=0;col<c;col++) {
     570            if( imgInRow[col] != imgOutRow[col] ) {
     571                psError(__func__,"Input image not equal to output image at %d,%d!",
     572                        col, row);
     573                return 4;
     574            }
     575        }
    552576    }
    553577
     
    632656    psFree(img);
    633657    psFree(img2);
     658    psFree(img3);
     659    psFree(img4);
    634660
    635661    return 0;
Note: See TracChangeset for help on using the changeset viewer.