Changeset 1635
- Timestamp:
- Aug 27, 2004, 9:49:54 AM (22 years ago)
- Location:
- trunk/psLib/src/image
- Files:
-
- 2 edited
-
psImageManip.c (modified) (7 diffs)
-
psImageManip.h (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psLib/src/image/psImageManip.c
r1605 r1635 1 2 1 /** @file psImageManip.c 3 2 * … … 11 10 * @author Ross Harman, MHPCC 12 11 * 13 * @version $Revision: 1.1 7$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-2 0 02:55:58$12 * @version $Revision: 1.18 $ $Name: not supported by cvs2svn $ 13 * @date $Date: 2004-08-27 19:49:54 $ 15 14 * 16 15 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii 17 16 */ 18 #include <math.h> // for 19 // isfinite(), 20 // etc. 17 18 #include <math.h> // for isfinite(), etc. 21 19 #include <stdlib.h> 22 20 #include <stdbool.h> 23 #include <string.h> // for 24 // memcpy, 25 // etc. 21 #include <string.h> // for memcpy, etc. 26 22 27 23 #include "psError.h" … … 594 590 const psImage* in, 595 591 float angle, 596 floatunexposedValue,592 psC64 unexposedValue, 597 593 psImageInterpolateMode mode) 598 594 { … … 764 760 765 761 #define PSIMAGE_ROTATE_ARBITRARY_LOOP(TYPE,MODE) { \ 766 if (unexposedValue < PS_MIN_##TYPE || unexposedValue > PS_MAX_##TYPE) { \ 767 psError(__func__,"The given unexposedValue (%g) is outside of the " \ 762 if (creal(unexposedValue) < PS_MIN_##TYPE || creal(unexposedValue) > PS_MAX_##TYPE || \ 763 cimag(unexposedValue) < PS_MIN_##TYPE || cimag(unexposedValue) > PS_MAX_##TYPE) { \ 764 psError(__func__,"The given unexposedValue (%g%+g) is outside of the " \ 768 765 "image type's range (%g->%g).", \ 769 unexposedValue, (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ 766 creal(unexposedValue),cimag(unexposedValue), \ 767 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ 770 768 psFree(out); \ 771 769 out = NULL; \ … … 850 848 float dx, 851 849 float dy, 852 ps F64 unexposedValue,850 psC64 unexposedValue, 853 851 psImageInterpolateMode mode) 854 852 { … … 870 868 out = psImageRecycle(out, outCols, outRows, type); 871 869 872 #define PSIMAGE_SHIFT_CASE( TYPE) \870 #define PSIMAGE_SHIFT_CASE(MODE,TYPE) \ 873 871 case PS_TYPE_##TYPE: \ 874 if (unexposedValue < PS_MIN_##TYPE || unexposedValue > PS_MAX_##TYPE) { \ 875 psError(__func__,"The given unexposedValue (%g) is outside of the " \ 872 if (creal(unexposedValue) < PS_MIN_##TYPE || creal(unexposedValue) > PS_MAX_##TYPE || \ 873 cimag(unexposedValue) < PS_MIN_##TYPE || cimag(unexposedValue) > PS_MAX_##TYPE) { \ 874 psError(__func__,"The given unexposedValue (%g%+g) is outside of the " \ 876 875 "image type's range (%g->%g).", \ 877 unexposedValue, (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ 876 creal(unexposedValue), cimag(unexposedValue), \ 877 (double)PS_MIN_##TYPE,(double)PS_MAX_##TYPE); \ 878 878 psFree(out); \ 879 879 out = NULL; \ … … 884 884 float y = dy+(float)row; \ 885 885 for (int col=0;col<outCols;col++) { \ 886 outRow[col] = p sImagePixelInterpolate(in,dx+(float)col,y,unexposedValue,mode); \886 outRow[col] = p_psImagePixelInterpolate##MODE##_##TYPE(in,dx+(float)col,y,unexposedValue); \ 887 887 } \ 888 888 } \ 889 889 break; 890 890 891 switch (in->type.type) { 892 PSIMAGE_SHIFT_CASE(U8); 893 PSIMAGE_SHIFT_CASE(U16); 894 PSIMAGE_SHIFT_CASE(U32); 895 PSIMAGE_SHIFT_CASE(U64); 896 PSIMAGE_SHIFT_CASE(S8); 897 PSIMAGE_SHIFT_CASE(S16); 898 PSIMAGE_SHIFT_CASE(S32); 899 PSIMAGE_SHIFT_CASE(S64); 900 PSIMAGE_SHIFT_CASE(F32); 901 PSIMAGE_SHIFT_CASE(F64); 902 PSIMAGE_SHIFT_CASE(C32); 903 PSIMAGE_SHIFT_CASE(C64); 891 #define PSIMAGE_SHIFT_ARBITRARY_CASE(MODE) \ 892 case PS_INTERPOLATE_##MODE: \ 893 switch (in->type.type) { \ 894 PSIMAGE_SHIFT_CASE(MODE,U8); \ 895 PSIMAGE_SHIFT_CASE(MODE,U16); \ 896 PSIMAGE_SHIFT_CASE(MODE,U32); \ 897 PSIMAGE_SHIFT_CASE(MODE,U64); \ 898 PSIMAGE_SHIFT_CASE(MODE,S8); \ 899 PSIMAGE_SHIFT_CASE(MODE,S16); \ 900 PSIMAGE_SHIFT_CASE(MODE,S32); \ 901 PSIMAGE_SHIFT_CASE(MODE,S64); \ 902 PSIMAGE_SHIFT_CASE(MODE,F32); \ 903 PSIMAGE_SHIFT_CASE(MODE,F64); \ 904 PSIMAGE_SHIFT_CASE(MODE,C32); \ 905 PSIMAGE_SHIFT_CASE(MODE,C64); \ 906 default: \ 907 psError(__func__, "Image type (%d) not supported.", type); \ 908 psFree(out); \ 909 out = NULL; \ 910 } 911 912 switch (mode) { 913 PSIMAGE_SHIFT_ARBITRARY_CASE(FLAT); 914 PSIMAGE_SHIFT_ARBITRARY_CASE(BILINEAR); 904 915 default: 905 psError(__func__, " Image type (%d) not supported.", type);916 psError(__func__, "Unsupported interpolation mode (%d)", mode); 906 917 psFree(out); 907 918 out = NULL; 908 919 } 920 909 921 return out; 910 922 } -
trunk/psLib/src/image/psImageManip.h
r1605 r1635 11 11 * @author Ross Harman, MHPCC 12 12 * 13 * @version $Revision: 1.1 2$ $Name: not supported by cvs2svn $14 * @date $Date: 2004-08-2 0 02:55:58$13 * @version $Revision: 1.13 $ $Name: not supported by cvs2svn $ 14 * @date $Date: 2004-08-27 19:49:54 $ 15 15 * 16 16 * Copyright 2004 Maui High Performance Computing Center, University of Hawaii … … 141 141 const psImage* in, ///< input image 142 142 float angle, ///< the rotation angle in degrees. 143 floatunexposedValue, ///< the output image pixel values for non-imagery areas143 psC64 unexposedValue, ///< the output image pixel values for non-imagery areas 144 144 psImageInterpolateMode mode ///< the interpolation mode used 145 145 ); … … 161 161 float dx, ///< the shift in x direction. 162 162 float dy, ///< the shift in y direction. 163 floatunexposedValue, ///< the output image pixel values for non-imagery areas163 psC64 unexposedValue, ///< the output image pixel values for non-imagery areas 164 164 psImageInterpolateMode mode ///< the interpolation mode to use 165 165 );
Note:
See TracChangeset
for help on using the changeset viewer.
