Changeset 856
- Timestamp:
- Jun 3, 2004, 5:12:11 PM (22 years ago)
- File:
-
- 1 edited
-
trunk/psLib/test/image/tst_psImage.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/test/image/tst_psImage.c
r844 r856 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 9$ $Name: not supported by cvs2svn $9 * @date $Date: 2004-06-04 0 0:19:54$8 * @version $Revision: 1.10 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2004-06-04 03:12:11 $ 10 10 * 11 11 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 15 15 #include <float.h> 16 16 #include <string.h> 17 #include <stdlib.h> 17 18 18 19 #include "psTest.h" … … 34 35 { 35 36 psSetLogLevel(PS_LOG_INFO); 36 37 testImageSubset();38 37 39 38 if (! runTestSuite(stderr,"psImage",tests)) { … … 549 548 // Verify the returned psImage structure member are equal to the values in 550 549 // the input psImage structure input. 551 for (unsigned row=0;row<r;row++) { 552 psF32* imgRow = img->data.F32[row]; 553 psF32* img2Row = img2->data.F32[row]; 554 for (unsigned col=0;col<c;col++) { 555 if (imgRow[col] - (row+col) > FLT_EPSILON) { 556 psError(__func__,"Input image was changed at %d,%d (%f)!", 557 col,row,imgRow[col]); 558 return 2; 559 } 560 561 if (imgRow[col] != img2Row[col]) { 562 psError(__func__,"returned psImage values after copy don't match!"); 563 return 2; 564 } 565 } 566 } 550 551 #define testImageCopyType(IN,OUT) \ 552 img = psImageRecycle(img,c,r,PS_TYPE_##IN); \ 553 for (unsigned row=0;row<r;row++) { \ 554 ps##IN* imgRow = img->data.IN[row]; \ 555 for (unsigned col=0;col<c;col++) { \ 556 imgRow[col] = (ps##IN)(row+col); \ 557 } \ 558 } \ 559 img2 = psImageCopy(img2,img,PS_TYPE_##OUT); \ 560 if (img2 == NULL) { \ 561 psError(__func__,"psImageCopy failed to copy U8."); \ 562 return 2; \ 563 } \ 564 for (unsigned int row=0;row<r;row++) { \ 565 ps##IN* imgRow = img->data.IN[row]; \ 566 ps##OUT* img2Row = img2->data.OUT[row]; \ 567 for (unsigned int col=0;col<c;col++) { \ 568 if (abs(imgRow[col] - (ps##IN)(row+col)) > 0.5) { \ 569 psError(__func__,"Input image was changed at %d,%d!", \ 570 col,row); \ 571 return 2; \ 572 } \ 573 if (abs(img2Row[col] - (ps##OUT)(imgRow[col])) > 0.5) { \ 574 psError(__func__,"returned psImage values after copy don't match at %d,%d " \ 575 "(%d vs %d)",\ 576 col,row,img2Row[col], (ps##OUT)(imgRow[col])); \ 577 return 2; \ 578 } \ 579 } \ 580 } 581 582 #define testImageCopyTypes(IN) \ 583 testImageCopyType(IN,U8); \ 584 testImageCopyType(IN,U16); \ 585 testImageCopyType(IN,U32); \ 586 testImageCopyType(IN,S8);\ 587 testImageCopyType(IN,S16);\ 588 testImageCopyType(IN,S32);\ 589 testImageCopyType(IN,F32);\ 590 testImageCopyType(IN,F64); 591 592 testImageCopyTypes(U8); 593 testImageCopyTypes(U16); 594 testImageCopyTypes(U32); 595 testImageCopyTypes(S8); 596 testImageCopyTypes(S16); 597 testImageCopyTypes(S32); 598 testImageCopyTypes(F32); 599 testImageCopyTypes(F64); 567 600 568 601 // Verify the returned psImage structure pointer is null and program … … 575 608 } 576 609 577 img2 = psImageCopy(img2,img,PS_TYPE_U8);578 for (unsigned row=0;row<r;row++) {579 psF32* imgRow = img->data.F32[row];580 psU8* img2Row = img2->data.U8[row];581 for (unsigned col=0;col<c;col++) {582 if (imgRow[col] - (row+col) > FLT_EPSILON) {583 psError(__func__,"Input image was changed at %d,%d (%f)!",584 col,row,imgRow[col]);585 return 2;586 }587 588 if (row+col != img2Row[col]) {589 psError(__func__,"returned psImage values after copy don't match at %d,%d (%d vs %d)",590 col,row,img2Row[col], row+col);591 return 2;592 }593 }594 }595 596 img2 = psImageCopy(img2,img,PS_TYPE_U16);597 img2 = psImageCopy(img2,img,PS_TYPE_U32);598 img2 = psImageCopy(img2,img,PS_TYPE_S8);599 img2 = psImageCopy(img2,img,PS_TYPE_S16);600 img2 = psImageCopy(img2,img,PS_TYPE_S32);601 img2 = psImageCopy(img2,img,PS_TYPE_F64);602 img2 = psImageCopy(img2,img,PS_TYPE_C32);603 img2 = psImageCopy(img2,img,PS_TYPE_C64);604 605 610 psImageFree(img); 606 611 psImageFree(img2);
Note:
See TracChangeset
for help on using the changeset viewer.
