Changeset 4887 for trunk/psLib/src/mathtypes
- Timestamp:
- Aug 26, 2005, 1:01:17 PM (21 years ago)
- Location:
- trunk/psLib/src/mathtypes
- Files:
-
- 3 edited
-
psImage.c (modified) (2 diffs)
-
psVector.c (modified) (12 diffs)
-
psVector.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/mathtypes/psImage.c
r4886 r4887 9 9 * @author Ross Harman, MHPCC 10 10 * 11 * @version $Revision: 1.7 6$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-08-26 03:35:02$11 * @version $Revision: 1.77 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-08-26 23:01:17 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 219 219 case PS_TYPE_U8: 220 220 temp = va_arg (argp, psU32); 221 if ( temp >= 0 || temp <= 255)221 if ( temp >= PS_MIN_U8 && temp <= PS_MAX_U8 ) 222 222 vU8 = temp; 223 else 223 else { 224 224 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: U8 Value out of Range.\n"); 225 return false; 226 } 225 227 for (int iy = 0; iy < image->numRows; iy++) { 226 228 for (int ix = 0; ix < image->numCols; ix++) { -
trunk/psLib/src/mathtypes/psVector.c
r4821 r4887 9 9 * @author Robert DeSonia, MHPCC 10 10 * 11 * @version $Revision: 1.4 8$ $Name: not supported by cvs2svn $12 * @date $Date: 2005-08- 19 21:27:43$11 * @version $Revision: 1.49 $ $Name: not supported by cvs2svn $ 12 * @date $Date: 2005-08-26 23:01:17 $ 13 13 * 14 14 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 612 612 ...) 613 613 { 614 615 614 va_list argp; 616 615 psU8 vU8; … … 627 626 psC64 vC64; 628 627 628 unsigned int temp; 629 int temp2; 630 629 631 if (image == NULL) 630 632 return (false); … … 634 636 switch (image->type.type) { 635 637 case PS_TYPE_U8: 636 vU8 = va_arg (argp, psU32); 637 638 for (long iy = 0; iy < image->n; iy++) { 639 // for (int ix = 0; ix < image->numCols; ix++) { 638 temp = va_arg (argp, psU32); 639 if ( temp >= PS_MIN_U8 && temp <= PS_MAX_U8 ) 640 vU8 = temp; 641 else { 642 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: U8 Value out of Range.\n"); 643 return false; 644 } 645 for (long iy = 0; iy < image->n; iy++) { 640 646 image->data.U8[iy] = vU8; 641 // } 642 } 643 break; 644 647 } 648 return (true); 645 649 case PS_TYPE_F32: 646 vF32 = va_arg (argp, psF64); 647 648 for (long iy = 0; iy < image->n; iy++) { 649 // for (int ix = 0; ix < image->numCols; ix++) { 650 vF32 = (psF32)va_arg (argp, psF64); 651 for (long iy = 0; iy < image->n; iy++) { 650 652 image->data.F32[iy] = vF32; 651 // } 652 } 653 return (true); 654 653 } 654 return (true); 655 655 case PS_TYPE_F64: 656 656 vF64 = va_arg (argp, psF64); 657 658 for (long iy = 0; iy < image->n; iy++) { 659 // for (int ix = 0; ix < image->numCols; ix++) { 657 for (long iy = 0; iy < image->n; iy++) { 660 658 image->data.F64[iy] = vF64; 661 // }662 659 } 663 660 return (true); 664 661 case PS_TYPE_U16: 665 vU16 = va_arg (argp, psU32); 666 662 temp = va_arg (argp, psU32); 663 if ( temp >= PS_MIN_U16 && temp <= PS_MAX_U16 ) 664 vU16 = temp; 665 else { 666 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: U16 Value out of Range.\n"); 667 return false; 668 } 667 669 for (long iy = 0; iy < image->n; iy++) { 668 670 image->data.U16[iy] = vU16; … … 671 673 case PS_TYPE_U32: 672 674 vU32 = va_arg (argp, psU32); 673 674 675 for (long iy = 0; iy < image->n; iy++) { 675 676 image->data.U32[iy] = vU32; … … 678 679 case PS_TYPE_U64: 679 680 vU64 = va_arg (argp, psU64); 680 681 681 for (long iy = 0; iy < image->n; iy++) { 682 682 image->data.U64[iy] = vU64; … … 684 684 return (true); 685 685 case PS_TYPE_S8: 686 vS8 = va_arg (argp, psS32); 687 686 temp2 = va_arg (argp, psS32); 687 if ( temp2 >= PS_MIN_S8 && temp2 <= PS_MAX_S8 ) 688 vS8 = temp2; 689 else { 690 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: S8 Value out of Range.\n"); 691 return false; 692 } 688 693 for (long iy = 0; iy < image->n; iy++) { 689 694 image->data.S8[iy] = vS8; … … 691 696 return (true); 692 697 case PS_TYPE_S16: 693 vS16 = va_arg (argp, psS32); 694 698 temp2 = va_arg (argp, psS32); 699 if ( temp2 >= PS_MIN_S16 && temp2 <= PS_MAX_S16 ) 700 vS16 = temp2; 701 else { 702 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Error: S16 Value out of Range.\n"); 703 return false; 704 } 695 705 for (long iy = 0; iy < image->n; iy++) { 696 706 image->data.S16[iy] = vS16; … … 699 709 case PS_TYPE_S32: 700 710 vS32 = va_arg (argp, psS32); 701 702 711 for (long iy = 0; iy < image->n; iy++) { 703 712 image->data.S32[iy] = vS32; … … 706 715 case PS_TYPE_S64: 707 716 vS64 = va_arg (argp, psS64); 708 709 717 for (long iy = 0; iy < image->n; iy++) { 710 718 image->data.S64[iy] = vS64; … … 713 721 case PS_TYPE_C32: 714 722 vC32 = va_arg (argp, psC32); 715 716 723 for (long iy = 0; iy < image->n; iy++) { 717 724 image->data.C32[iy] = vC32; … … 720 727 case PS_TYPE_C64: 721 728 vC64 = va_arg (argp, psC64); 722 723 729 for (long iy = 0; iy < image->n; iy++) { 724 730 image->data.C64[iy] = vC64; 725 731 } 726 732 return (true); 727 728 733 default: 729 734 psError (PS_ERR_BAD_PARAMETER_TYPE, true, "datatype %d not defined in psImageInit\n", image->type); -
trunk/psLib/src/mathtypes/psVector.h
r4821 r4887 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.4 0$ $Name: not supported by cvs2svn $14 * @date $Date: 2005-08- 19 21:27:43$13 * @version $Revision: 1.41 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2005-08-26 23:01:17 $ 15 15 * 16 16 * Copyright 2004-2005 Maui High Performance Computing Center, University of Hawaii … … 27 27 /// @{ 28 28 29 ///< Union of psVector data types.30 /*31 typedef union {32 psU8* U8; ///< Unsigned 8-bit integer data.33 psU16* U16; ///< Unsigned 16-bit integer data.34 psU32* U32; ///< Unsigned 32-bit integer data.35 psU64* U64; ///< Unsigned 64-bit integer data.36 psS8* S8; ///< Signed 8-bit integer data.37 psS16* S16; ///< Signed 16-bit integer data.38 psS32* S32; ///< Signed 32-bit integer data.39 psS64* S64; ///< Signed 64-bit integer data.40 psF32* F32; ///< Single-precision float data.41 psF64* F64; ///< Double-precision float data.42 psC32* C32; ///< Single-precision complex data.43 psC64* C64; ///< Double-precision complex data.44 }45 p_psVectorData;46 */47 29 /** An vector to support primitive types. 48 30 *
Note:
See TracChangeset
for help on using the changeset viewer.
