Changeset 5064
- Timestamp:
- Sep 16, 2005, 1:56:51 PM (21 years ago)
- Location:
- trunk/psLib
- Files:
-
- 7 edited
-
src/imageops/psImagePixelManip.c (modified) (5 diffs)
-
src/imageops/psImagePixelManip.h (modified) (3 diffs)
-
src/mathtypes/psImage.c (modified) (2 diffs)
-
src/mathtypes/psImage.h (modified) (2 diffs)
-
src/mathtypes/psVector.c (modified) (7 diffs)
-
src/mathtypes/psVector.h (modified) (2 diffs)
-
test/mathtypes/tst_psImage.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/imageops/psImagePixelManip.c
r4938 r5064 10 10 * @author Ross Harman, MHPCC 11 11 * 12 * @version $Revision: 1.1 1$ $Name: not supported by cvs2svn $13 * @date $Date: 2005-09- 01 01:05:41$12 * @version $Revision: 1.12 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2005-09-16 23:56:48 $ 14 14 * 15 15 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 399 399 // the region is defined wrt the parent image 400 400 void psImageMaskRegion(psImage *image, 401 psRegion *region,401 psRegion region, 402 402 const char *op, 403 403 psMaskType maskValue) … … 406 406 for (int iy = 0; iy < image->numRows; iy++) { 407 407 for (int ix = 0; ix < image->numCols; ix++) { 408 if (ix + image->col0 < region ->x0)408 if (ix + image->col0 < region.x0) 409 409 continue; 410 if (ix + image->col0 >= region ->x1)410 if (ix + image->col0 >= region.x1) 411 411 continue; 412 if (iy + image->row0 < region ->y0)412 if (iy + image->row0 < region.y0) 413 413 continue; 414 if (iy + image->row0 >= region ->y1)414 if (iy + image->row0 >= region.y1) 415 415 continue; 416 416 if ( !strncmp(op, "&", 2) || !strncmp(op, "AND", 5) ) { … … 430 430 // the region is defined wrt the parent image 431 431 void psImageKeepRegion(psImage *image, 432 psRegion *region,432 psRegion region, 433 433 const char *op, 434 434 psMaskType maskValue) … … 437 437 for (int iy = 0; iy < image->numRows; iy++) { 438 438 for (int ix = 0; ix < image->numCols; ix++) { 439 if (ix + image->col0 < region ->x0)439 if (ix + image->col0 < region.x0) 440 440 goto maskit; 441 if (ix + image->col0 >= region ->x1)441 if (ix + image->col0 >= region.x1) 442 442 goto maskit; 443 if (iy + image->row0 < region ->y0)443 if (iy + image->row0 < region.y0) 444 444 goto maskit; 445 if (iy + image->row0 >= region ->y1)445 if (iy + image->row0 >= region.y1) 446 446 goto maskit; 447 447 continue; -
trunk/psLib/src/imageops/psImagePixelManip.h
r4938 r5064 8 8 * @author Robert DeSonia, MHPCC 9 9 * 10 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $11 * @date $Date: 2005-09- 01 01:05:41$10 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 11 * @date $Date: 2005-09-16 23:56:48 $ 12 12 * 13 13 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 94 94 void psImageMaskRegion( 95 95 psImage *image, ///< the image to set 96 psRegion *region,///< the specified region96 psRegion region, ///< the specified region 97 97 const char *op, ///< the logical operation 98 98 psMaskType maskValue ///< the specified bits … … 106 106 void psImageKeepRegion( 107 107 psImage *image, ///< the image to set 108 psRegion *region,///< the specified region108 psRegion region, ///< the specified region 109 109 const char *op, ///< the logical operation 110 110 psMaskType maskValue ///< the specified bits -
trunk/psLib/src/mathtypes/psImage.c
r5057 r5064 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.8 2$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09-1 5 21:22:22$11 * @version $Revision: 1.83 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-16 23:56:51 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 165 165 // XXX EAM : this needs to be changes to use psRegion rather than psRegion* 166 166 psRegion psRegionForImage(psImage *image, 167 psRegion *in)167 psRegion in) 168 168 { 169 169 170 170 // x0,y0, x1,y1 are in *parent* units 171 171 // PS_ASSERT_PTR_NON_NULL(in, NULL); 172 if( in == NULL ) { 173 psError(PS_ERR_BAD_PARAMETER_NULL, true, "Unallowable operation. psRegion *in is NULL."); 174 return *in; 175 } 176 /* if (out == NULL) { 177 // out = psRegionAlloc(in->x0, in->x1, in->y0, in->y1); 178 *out = psRegionSet(in->x0, in->x1, in->y0, in->y1); 179 } else { 180 *out = *in; 181 } 182 */ // XXX these are probably wrong (see above) 183 if (in->x1 <= 0) { 184 in->x1 = image->col0 + image->numCols + in->x1; 185 } 186 if (in->y1 <= 0) { 187 in->y1 = image->row0 + image->numRows + in->y1; 172 /* 173 if( in == NULL ) { 174 psError(PS_ERR_BAD_PARAMETER_NULL, true, "Unallowable operation. psRegion in is NULL."); 175 return in; 176 } 177 */ /* if (out == NULL) { 178 // out = psRegionAlloc(in->x0, in->x1, in->y0, in->y1); 179 *out = psRegionSet(in->x0, in->x1, in->y0, in->y1); 180 } else { 181 *out = *in; 182 } 183 */ // XXX these are probably wrong (see above) 184 if (in.x1 <= 0) { 185 in.x1 = image->col0 + image->numCols + in.x1; 186 } 187 if (in.y1 <= 0) { 188 in.y1 = image->row0 + image->numRows + in.y1; 188 189 } 189 190 190 191 // force the lower-limits to be on the child 191 in ->x0 = PS_MAX(image->col0, in->x0);192 in ->y0 = PS_MAX(image->row0, in->y0);192 in.x0 = PS_MAX(image->col0, in.x0); 193 in.y0 = PS_MAX(image->row0, in.y0); 193 194 194 195 // force the upper-limits to be on the child 195 in ->x1 = PS_MIN(image->col0 + image->numCols, in->x1);196 in ->y1 = PS_MIN(image->row0 + image->numRows, in->y1);197 return ( *in);196 in.x1 = PS_MIN(image->col0 + image->numCols, in.x1); 197 in.y1 = PS_MIN(image->row0 + image->numRows, in.y1); 198 return (in); 198 199 } 199 200 -
trunk/psLib/src/mathtypes/psImage.h
r5057 r5064 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.6 8$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-09-1 5 21:22:22$13 * @version $Revision: 1.69 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-16 23:56:51 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 168 168 psRegion psRegionForImage( 169 169 psImage *image, ///< the image for which the region is to be set 170 psRegion *in///< the image region limits170 psRegion in ///< the image region limits 171 171 ); 172 172 -
trunk/psLib/src/mathtypes/psVector.c
r4944 r5064 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.5 1$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-09- 02 21:32:06$11 * @version $Revision: 1.52 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-09-16 23:56:51 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 616 616 617 617 618 bool psVectorInit(psVector * image,618 bool psVectorInit(psVector *vector, 619 619 ...) 620 620 { … … 636 636 int temp2; 637 637 638 if ( image== NULL)638 if (vector == NULL) 639 639 return (false); 640 640 641 va_start (argp, image);642 643 switch ( image->type.type) {641 va_start (argp, vector); 642 643 switch (vector->type.type) { 644 644 case PS_TYPE_U8: 645 645 temp = va_arg (argp, psU32); … … 650 650 return false; 651 651 } 652 for (long iy = 0; iy < image->n; iy++) {653 image->data.U8[iy] = vU8;652 for (long iy = 0; iy < vector->n; iy++) { 653 vector->data.U8[iy] = vU8; 654 654 } 655 655 return (true); 656 656 case PS_TYPE_F32: 657 657 vF32 = (psF32)va_arg (argp, psF64); 658 for (long iy = 0; iy < image->n; iy++) {659 image->data.F32[iy] = vF32;658 for (long iy = 0; iy < vector->n; iy++) { 659 vector->data.F32[iy] = vF32; 660 660 } 661 661 return (true); 662 662 case PS_TYPE_F64: 663 663 vF64 = va_arg (argp, psF64); 664 for (long iy = 0; iy < image->n; iy++) {665 image->data.F64[iy] = vF64;664 for (long iy = 0; iy < vector->n; iy++) { 665 vector->data.F64[iy] = vF64; 666 666 } 667 667 return (true); … … 674 674 return false; 675 675 } 676 for (long iy = 0; iy < image->n; iy++) {677 image->data.U16[iy] = vU16;676 for (long iy = 0; iy < vector->n; iy++) { 677 vector->data.U16[iy] = vU16; 678 678 } 679 679 return (true); 680 680 case PS_TYPE_U32: 681 681 vU32 = va_arg (argp, psU32); 682 for (long iy = 0; iy < image->n; iy++) {683 image->data.U32[iy] = vU32;682 for (long iy = 0; iy < vector->n; iy++) { 683 vector->data.U32[iy] = vU32; 684 684 } 685 685 return (true); 686 686 case PS_TYPE_U64: 687 687 vU64 = va_arg (argp, psU64); 688 for (long iy = 0; iy < image->n; iy++) {689 image->data.U64[iy] = vU64;688 for (long iy = 0; iy < vector->n; iy++) { 689 vector->data.U64[iy] = vU64; 690 690 } 691 691 return (true); … … 698 698 return false; 699 699 } 700 for (long iy = 0; iy < image->n; iy++) {701 image->data.S8[iy] = vS8;700 for (long iy = 0; iy < vector->n; iy++) { 701 vector->data.S8[iy] = vS8; 702 702 } 703 703 return (true); … … 710 710 return false; 711 711 } 712 for (long iy = 0; iy < image->n; iy++) {713 image->data.S16[iy] = vS16;712 for (long iy = 0; iy < vector->n; iy++) { 713 vector->data.S16[iy] = vS16; 714 714 } 715 715 return (true); 716 716 case PS_TYPE_S32: 717 717 vS32 = va_arg (argp, psS32); 718 for (long iy = 0; iy < image->n; iy++) {719 image->data.S32[iy] = vS32;718 for (long iy = 0; iy < vector->n; iy++) { 719 vector->data.S32[iy] = vS32; 720 720 } 721 721 return (true); 722 722 case PS_TYPE_S64: 723 723 vS64 = va_arg (argp, psS64); 724 for (long iy = 0; iy < image->n; iy++) {725 image->data.S64[iy] = vS64;724 for (long iy = 0; iy < vector->n; iy++) { 725 vector->data.S64[iy] = vS64; 726 726 } 727 727 return (true); 728 728 case PS_TYPE_C32: 729 729 vC32 = va_arg (argp, psC32); 730 for (long iy = 0; iy < image->n; iy++) {731 image->data.C32[iy] = vC32;730 for (long iy = 0; iy < vector->n; iy++) { 731 vector->data.C32[iy] = vC32; 732 732 } 733 733 return (true); 734 734 case PS_TYPE_C64: 735 735 vC64 = va_arg (argp, psC64); 736 for (long iy = 0; iy < image->n; iy++) {737 image->data.C64[iy] = vC64;736 for (long iy = 0; iy < vector->n; iy++) { 737 vector->data.C64[iy] = vC64; 738 738 } 739 739 return (true); 740 740 default: 741 psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", image->type);741 psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", vector->type); 742 742 return (false); 743 743 } -
trunk/psLib/src/mathtypes/psVector.h
r5057 r5064 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 4$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-09-1 5 21:22:22$13 * @version $Revision: 1.45 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-09-16 23:56:51 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 204 204 */ 205 205 bool psVectorInit( 206 psVector * image,///< the vector to be initialized206 psVector *vector, ///< the vector to be initialized 207 207 ... ///< Variable argument list for initialization 208 208 ); -
trunk/psLib/test/mathtypes/tst_psImage.c
r4980 r5064 6 6 * @author Robert DeSonia, MHPCC 7 7 * 8 * @version $Revision: 1. 5$ $Name: not supported by cvs2svn $9 * @date $Date: 2005-09- 09 02:02:54$8 * @version $Revision: 1.6 $ $Name: not supported by cvs2svn $ 9 * @date $Date: 2005-09-16 23:56:51 $ 10 10 * 11 11 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 286 286 { 287 287 psImage *in; 288 psRegion inReg [1];288 psRegion inReg; 289 289 psRegion out; 290 290 in = psImageAlloc(1, 1, PS_TYPE_S32); 291 inReg [0]= psRegionSet(1, 2, 1, 2);291 inReg = psRegionSet(1, 2, 1, 2); 292 292 out = psRegionForImage(in,inReg); 293 psRegion inReg2 [1];293 psRegion inReg2; 294 294 psRegion out2; 295 inReg2 [0]= psRegionSet(-1, 0, -2, -1);295 inReg2 = psRegionSet(-1, 0, -2, -1); 296 296 out2 = psRegionForImage(in, inReg2); 297 297
Note:
See TracChangeset
for help on using the changeset viewer.
