Changeset 826 for soft/giet_vm/applications/rosenfeld/nrc2
- Timestamp:
- Jul 13, 2017, 11:01:58 AM (7 years ago)
- Location:
- soft/giet_vm/applications/rosenfeld/nrc2
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/Makefile
r823 r826 7 7 8 8 # -- File list ---------- 9 FILE = nralloc1.c, nralloc2.c, nralloc2x.c, nrarith0.c, nrarith1.c, nrarith2.c, nrarith2x.c, nrbool1.c, nrbool2.c, nrio0.c, nrio1.c, nrio1x.c, nrio2.c, nrlinalg.c, nrlut.c, nrmem1.c, nrmem1x.c, nrmem2.c, nrmem2x.c, nrset1.c, nrset2.c, nrset2x.c, nrs ort1.c, nrsort2.c, nrwrap1.c, nrwrap2.c10 FILE := $(FILE), nrio1f.c, nrio1xf.c, nrio2f.c nrio2x.c nrio2xf.c nrio3.c # comment if giet9 FILE = nralloc1.c, nralloc2.c, nralloc2x.c, nrarith0.c, nrarith1.c, nrarith2.c, nrarith2x.c, nrbool1.c, nrbool2.c, nrio0.c, nrio1.c, nrio1x.c, nrio2.c, nrlinalg.c, nrlut.c, nrmem1.c, nrmem1x.c, nrmem2.c, nrmem2x.c, nrset1.c, nrset2.c, nrset2x.c, nrset3.c nrsort1.c, nrsort2.c, nrwrap1.c, nrwrap2.c 10 #FILE := $(FILE), nrio1f.c, nrio1xf.c, nrio2f.c nrio2x.c nrio2xf.c nrio3.c # comment if giet 11 11 12 12 … … 38 38 C_CONFIG_FLAGS = -DCLI 39 39 C_INC_FLAGS = -I$(INC_PATH) -I../../.. -I../../../giet_libs 40 CFLAGSCPU := -mips32 -EL -G0 -mhard-float 40 CFLAGSCPU := -mips32 -EL -G0 -mhard-float -fomit-frame-pointer -fno-builtin -ffreestanding 41 41 42 42 checktarget: … … 57 57 C_DEBUG_FLAGS = -O0 58 58 C_OPTIMISATION_FLAGS = -std=c99 -O2 -fstrict-aliasing 59 C_OS_FLAGS = -D GTODay -DTARGET_OS=LINUX59 C_OS_FLAGS = -DTARGET_OS=LINUX 60 60 C_CONFIG_FLAGS = -DCLI 61 61 C_INC_FLAGS = -I$(INC_PATH) … … 80 80 81 81 CFLAGSW := -Wredundant-decls -Wdisabled-optimization -Winline -Wpointer-arith -Wsign-compare -Wendif-labels 82 CFLAGS := $(CFLAGS) -g -Wall -fomit-frame-pointer $(CFLAGSW) $(CFLAGSCPU) -fno-builtin -ffreestanding82 CFLAGS := $(CFLAGS) -g -Wall $(CFLAGSW) $(CFLAGSCPU) 83 83 84 84 85 85 86 OBJS = $(addprefix $(OBJ_PATH)/, $(addsuffix .o, 86 OBJS = $(addprefix $(OBJ_PATH)/, $(addsuffix .o,$(basename $(FILE)))) 87 87 88 88 … … 93 93 $(PRODUCT): $(OBJS) 94 94 $(AR) -cr $@ $^ 95 $(RANLIB) $@ 95 $(RANLIB) $@ 96 96 97 97 clean: -
soft/giet_vm/applications/rosenfeld/nrc2/include/nralloc2.h
r821 r826 77 77 #undef remote_type_matrix 78 78 #define remote_type_matrix(t) \ 79 t ** short_name(t,remote_,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch )79 t ** short_name(t,remote_,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t x, int32_t y) 80 80 81 81 remote_type_matrix(int8_t); -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrc_os_config.h
r821 r826 5 5 6 6 #if TARGET_OS == GIETVM 7 #define tokenize(x) #x 7 8 #define printf(...) giet_tty_printf(__VA_ARGS__) 9 #define assert(x) giet_pthread_assert(x, "Assert failed.") 8 10 9 11 #define open(x, y) giet_fat_open(x, y) … … 20 22 #define pthread_spin_unlock(x) lock_release(x) 21 23 #define pthread_spin_init(x, y) lock_init(x) 22 #define pthread_mutex lock_tuser_lock_t24 #define pthread_mutex_t user_lock_t 23 25 #define pthread_mutex_lock(x) lock_acquire(x) 24 26 #define pthread_mutex_unlock(x) lock_release(x) -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrmem1x.h
r772 r826 4 4 */ 5 5 6 IMAGE_EXPORT(void) convert_rgb32vector_rgb8vector(rgb32 *x, long nl, long nh, rgb8 *y); 6 void roll_si16vector(int16_t * v, int32_t nl, int32_t nh); 7 void roll_ui16vector(uint16_t * v, int32_t nl, int32_t nh); 7 8 8 IMAGE_EXPORT(void) roll_svector(sint16 *v, long nl, long nh); 9 #define copy_type_vector(t) \ 10 void short_name(t,copy_,vector)(t * src, int32_t nl1, int32_t nh1, t * dst, int32_t nl2, int32_t nh2); \ 11 void short_name(t,copy1c_,vector)(t * src, int32_t nc, t * dst, int32_t nl, int32_t nh); \ 12 void short_name(t,copy_,vector_mod)(t * src, int32_t nl, int32_t nh, int32_t m, t * dst); 9 13 10 IMAGE_EXPORT(void) move_ui8vector_1left_block (uint8 *v, long nl, long nh); 11 IMAGE_EXPORT(void) move_ui16vector_1left_block(uint16 *v, long nl, long nh); 12 IMAGE_EXPORT(void) move_si16vector_1left_block(sint16 *v, long nl, long nh); 13 IMAGE_EXPORT(void) move_ui32vector_1left_block(uint32 *v, long nl, long nh); 14 IMAGE_EXPORT(void) move_si32vector_1left_block(sint32 *v, long nl, long nh); 14 copy_type_vector(int8_t); 15 copy_type_vector(uint8_t); 16 copy_type_vector(int16_t); 17 copy_type_vector(uint16_t); 18 copy_type_vector(int32_t); 19 copy_type_vector(uint32_t); 20 copy_type_vector(float); 21 copy_type_vector(double); 22 copy_type_vector(rgb8); 23 copy_type_vector(rgbx8); 15 24 16 IMAGE_EXPORT(void) move_ui8vector_1right_block (uint8 *v, long nl, long nh);17 IMAGE_EXPORT(void) move_ui16vector_1right_block(uint16 *v, long nl, long nh);18 IMAGE_EXPORT(void) move_si16vector_1right_block(sint16 *v, long nl, long nh);19 IMAGE_EXPORT(void) move_ui32vector_1right_block(uint32 *v, long nl, long nh);20 IMAGE_EXPORT(void) move_si32vector_1right_block(sint32 *v, long nl, long nh);21 25 22 IMAGE_EXPORT(void) copy1c_bvector (uint8 *src, long nc, uint8 *dst, long nl, long nh); 23 IMAGE_EXPORT(void) copy1c_si16vector (sint16 *src, long nc, sint16 *dst, long nl, long nh); 24 IMAGE_EXPORT(void) copy1c_ui16vector (uint16 *src, long nc, uint16 *dst, long nl, long nh); 25 IMAGE_EXPORT(void) copy1c_ui32vector (uint32 *src, long nc, uint32 *dst, long nl, long nh); 26 IMAGE_EXPORT(void) copy1c_f32vector (float32 *src, long nc, float32 *dst, long nl, long nh); 27 IMAGE_EXPORT(void) copy1c_f64vector (float64 *src, long nc, float64 *dst, long nl, long nh); 28 IMAGE_EXPORT(void) copy1c_rgb8vector (rgb8 *src, long nc, rgb8 *dst, long nl, long nh); 29 IMAGE_EXPORT(void) copy1c_rgbx8vector(rgbx8 *src, long nc, rgbx8 *dst, long nl, long nh); 26 // Local Variables: 27 // tab-width: 4 28 // c-basic-offset: 4 29 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 30 // indent-tabs-mode: nil 31 // End: 30 32 31 IMAGE_EXPORT(void) copy_ui8vector_mod (uint8 *src, long nl, long nh, long m, uint8 *dst); 32 IMAGE_EXPORT(void) copy_ui16vector_mod(uint16 *src, long nl, long nh, long m, uint16 *dst); 33 IMAGE_EXPORT(void) copy_si16vector_mod(sint16 *src, long nl, long nh, long m, sint16 *dst); 34 IMAGE_EXPORT(void) copy_ui32vector_mod(uint32 *src, long nl, long nh, long m, uint32 *dst); 35 IMAGE_EXPORT(void) copy_si32vector_mod(sint32 *src, long nl, long nh, long m, sint32 *dst); 36 IMAGE_EXPORT(void) copy_f32vector_mod (float32 *src, long nl, long nh, long m, float32 *dst); 37 IMAGE_EXPORT(void) copy_f64vector_mod (float64 *src, long nl, long nh, long m, float64 *dst); 33 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 34 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrmem2.h
r772 r826 11 11 #define _NRMEM2_H_ 12 12 13 #ifdef __cplusplus14 #ifdef PRAGMA_VERBOSE15 #pragma message ("C++")16 #endif17 extern "C" {18 #endif19 20 21 13 /* 22 14 * ------------------ … … 25 17 */ 26 18 27 IMAGE_EXPORT(void) dup_si8matrix (sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y); 28 IMAGE_EXPORT(void) dup_ui8matrix (uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y); 29 IMAGE_EXPORT(void) dup_si16matrix (sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y); 30 IMAGE_EXPORT(void) dup_ui16matrix (uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y); 31 IMAGE_EXPORT(void) dup_si32matrix (sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y); 32 IMAGE_EXPORT(void) dup_ui32matrix (uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y); 33 IMAGE_EXPORT(void) dup_si64matrix (sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 **Y); 34 IMAGE_EXPORT(void) dup_ui64matrix (uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 **Y); 19 #define dup_type_matrix(t) \ 20 void short_name(t,dup_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y); 35 21 36 IMAGE_EXPORT(void) dup_f32matrix (float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y); 37 IMAGE_EXPORT(void) dup_f64matrix (float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y); 22 dup_type_matrix(int8_t); 23 dup_type_matrix(uint8_t); 24 dup_type_matrix(int16_t); 25 dup_type_matrix(uint16_t); 26 dup_type_matrix(int32_t); 27 dup_type_matrix(uint32_t); 28 dup_type_matrix(int64_t); 29 dup_type_matrix(uint64_t); 30 dup_type_matrix(float); 31 dup_type_matrix(double); 32 dup_type_matrix(rgb8); 33 dup_type_matrix(rgbx8); 38 34 39 IMAGE_EXPORT(void) dup_rgb8matrix (rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y);40 IMAGE_EXPORT(void) dup_rgbx8matrix (rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y);41 35 42 36 … … 47 41 */ 48 42 49 IMAGE_EXPORT(void) resize_si8matrix (sint8 **m, long nrl, long nrh, long ncl, long nch); 50 IMAGE_EXPORT(void) resize_ui8matrix (uint8 **m, long nrl, long nrh, long ncl, long nch); 51 IMAGE_EXPORT(void) resize_si16matrix (sint16 **m, long nrl, long nrh, long ncl, long nch); 52 IMAGE_EXPORT(void) resize_ui16matrix (uint16 **m, long nrl, long nrh, long ncl, long nch); 53 IMAGE_EXPORT(void) resize_si32matrix (sint32 **m, long nrl, long nrh, long ncl, long nch); 54 IMAGE_EXPORT(void) resize_ui32matrix (uint32 **m, long nrl, long nrh, long ncl, long nch); 43 #undef resize_type_matrix 44 #define resize_type_matrix(t) \ 45 void short_name(t,resize_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 55 46 56 IMAGE_EXPORT(void) resize_f32matrix (float32 **m, long nrl, long nrh, long ncl, long nch); 57 IMAGE_EXPORT(void) resize_f64matrix (float64 **m, long nrl, long nrh, long ncl, long nch); 47 resize_type_matrix(int8_t); 48 resize_type_matrix(uint8_t); 49 resize_type_matrix(int16_t); 50 resize_type_matrix(uint16_t); 51 resize_type_matrix(int32_t); 52 resize_type_matrix(uint32_t); 53 resize_type_matrix(int64_t); 54 resize_type_matrix(uint64_t); 55 resize_type_matrix(float); 56 resize_type_matrix(double); 57 resize_type_matrix(rgb8); 58 resize_type_matrix(rgbx8); 58 59 59 IMAGE_EXPORT(void) resize_rgb8matrix (rgb8 **m, long nrl, long nrh, long ncl, long nch);60 IMAGE_EXPORT(void) resize_rgbx8matrix(rgbx8 **m, long nrl, long nrh, long ncl, long nch);61 60 62 61 … … 67 66 */ 68 67 69 /* new versions UP */ 70 IMAGE_EXPORT(void) convert_si8matrix_si16matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y); 71 IMAGE_EXPORT(void) convert_si8matrix_si32matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y); 72 IMAGE_EXPORT(void) convert_si8matrix_f32matrix (sint8 **X, int nrl, int nrh, int ncl, int nch, float32 **Y); 73 IMAGE_EXPORT(void) convert_si8matrix_f64matrix (sint8 **X, int nrl, int nrh, int ncl, int nch, float64 **Y); 68 #define convert_type_matrix(t1,t2) \ 69 void short_name(t1,convert_,short_name(t2,matrix_,matrix))(t1 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t2 ** Y); 74 70 75 IMAGE_EXPORT(void) convert_ui8matrix_ui32matrix (uint8 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y); 76 IMAGE_EXPORT(void) convert_ui8matrix_ui16matrix (uint8 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y); 77 IMAGE_EXPORT(void) convert_ui8matrix_f32matrix (uint8 **X, int nrl, int nrh, int ncl, int nch, float32 **Y); 78 IMAGE_EXPORT(void) convert_ui8matrix_f64matrix (uint8 **X, int nrl, int nrh, int ncl, int nch, float64 **Y); 71 convert_type_matrix(int8_t,int16_t); 72 convert_type_matrix(int8_t,int32_t); 73 convert_type_matrix(int8_t,float); 74 convert_type_matrix(int8_t,double); 75 convert_type_matrix(uint8_t,uint16_t); 76 convert_type_matrix(uint8_t,uint32_t); 77 convert_type_matrix(uint8_t,float); 78 convert_type_matrix(uint8_t,double); 79 convert_type_matrix(uint8_t,rgb8); 80 convert_type_matrix(uint8_t,rgbx8); 81 convert_type_matrix(int16_t,int32_t); 82 convert_type_matrix(int16_t,float); 83 convert_type_matrix(int16_t,double); 84 convert_type_matrix(uint16_t,uint32_t); 85 convert_type_matrix(uint16_t,float); 86 convert_type_matrix(uint16_t,double); 87 convert_type_matrix(int32_t,float); 88 convert_type_matrix(int32_t,double); 89 convert_type_matrix(uint32_t,float); 90 convert_type_matrix(uint32_t,double); 79 91 80 IMAGE_EXPORT(void) convert_ui8matrix_rgb8matrix (uint8 **X, int nrl, int nrh, int ncl, int nch, rgb8 **Y); 81 IMAGE_EXPORT(void) convert_ui8matrix_rgbx8matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, rgbx8 **Y); 82 83 IMAGE_EXPORT(void) convert_si16matrix_si32matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y); 84 IMAGE_EXPORT(void) convert_si16matrix_f32matrix (sint16 **X, int nrl, int nrh, int ncl, int nch, float32 **Y); 85 IMAGE_EXPORT(void) convert_si16matrix_f64matrix (sint16 **X, int nrl, int nrh, int ncl, int nch, float64 **Y); 86 87 IMAGE_EXPORT(void) convert_ui16matrix_ui32matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y); 88 IMAGE_EXPORT(void) convert_ui16matrix_f32matrix (uint16 **X, int nrl, int nrh, int ncl, int nch, float32 **Y); 89 IMAGE_EXPORT(void) convert_ui16matrix_f64matrix (uint16 **X, int nrl, int nrh, int ncl, int nch, float64 **Y); 90 91 IMAGE_EXPORT(void) convert_si32matrix_f32matrix (sint32 **X, int nrl, int nrh, int ncl, int nch, float32 **Y); 92 IMAGE_EXPORT(void) convert_si32matrix_f64matrix (sint32 **X, int nrl, int nrh, int ncl, int nch, float64 **Y); 93 94 IMAGE_EXPORT(void) convert_ui32matrix_f32matrix (uint32 **X, int nrl, int nrh, int ncl, int nch, float32 **Y); 95 IMAGE_EXPORT(void) convert_ui32matrix_f64matrix (uint32 **X, int nrl, int nrh, int ncl, int nch, float64 **Y); 92 convert_type_matrix(int16_t,int8_t); 93 convert_type_matrix(uint16_t,uint8_t); 94 convert_type_matrix(int32_t,int8_t); 95 convert_type_matrix(uint32_t,uint8_t); 96 convert_type_matrix(int32_t,int16_t); 97 convert_type_matrix(uint32_t,uint16_t); 98 convert_type_matrix(float,int8_t); 99 convert_type_matrix(float,uint8_t); 100 convert_type_matrix(float,int16_t); 101 convert_type_matrix(float,uint16_t); 102 convert_type_matrix(float,int32_t); 103 convert_type_matrix(float,uint32_t); 104 convert_type_matrix(double,int8_t); 105 convert_type_matrix(double,uint8_t); 106 convert_type_matrix(double,int16_t); 107 convert_type_matrix(double,uint16_t); 108 convert_type_matrix(double,int32_t); 109 convert_type_matrix(double,uint32_t); 110 convert_type_matrix(double,float); 111 convert_type_matrix(rgb8,uint8_t); 96 112 97 113 98 /* new versions DOWN */99 IMAGE_EXPORT(void) convert_ui16matrix_ui8matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, uint8 **y);100 IMAGE_EXPORT(void) convert_si16matrix_si8matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, sint8 **y);101 IMAGE_EXPORT(void) convert_ui32matrix_ui8matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, uint8 **y);102 IMAGE_EXPORT(void) convert_si32matrix_si8matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, sint8 **y);103 IMAGE_EXPORT(void) convert_f32matrix_ui8matrix (float32 **X, int nrl, int nrh, int ncl, int nch, uint8 **y);104 IMAGE_EXPORT(void) convert_f32matrix_si8matrix (float32 **X, int nrl, int nrh, int ncl, int nch, sint8 **y);105 106 IMAGE_EXPORT(void) convert_ui32matrix_ui16matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, uint16 **y);107 IMAGE_EXPORT(void) convert_si32matrix_si16matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, sint16 **y);108 IMAGE_EXPORT(void) convert_f32matrix_ui16matrix (float32 **X, int nrl, int nrh, int ncl, int nch, uint16 **y);109 IMAGE_EXPORT(void) convert_f32matrix_si16matrix (float32 **X, int nrl, int nrh, int ncl, int nch, sint16 **y);110 111 IMAGE_EXPORT(void) convert_f32matrix_ui32matrix (float32 **X, int nrl, int nrh, int ncl, int nch, uint32 **y);112 IMAGE_EXPORT(void) convert_f32matrix_si32matrix (float32 **X, int nrl, int nrh, int ncl, int nch, sint32 **y);113 114 114 115 /* … … 118 119 */ 119 120 120 IMAGE_EXPORT(void) lowpart_ui32matrix_ui8matrix (uint32 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y); 121 IMAGE_EXPORT(void) lowpart_ui32matrix_ui16matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y); 121 void lowpart_ui16matrix_ui8matrix(uint16_t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8_t ** Y); 122 void lowpart_ui32matrix_ui8matrix(uint32_t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8_t ** Y); 123 122 124 123 125 /* … … 127 129 */ 128 130 129 IMAGE_EXPORT(void) split_rgb8matrix(rgb8 **X, long nrl, long nrh, long ncl, long nch, uint8 **R, uint8 **G, uint8 **B);130 IMAGE_EXPORT(void) merge_rgb8matrix(uint8 **R, uint8 **G, uint8 **B, long nrl, long nrh, long ncl, long nch, rgb8 **X);131 void split_rgb8matrix(rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8_t ** R, uint8_t ** G, uint8_t ** B); 132 void merge_rgb8matrix(uint8_t ** R, uint8_t ** G, uint8_t ** B, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 ** X); 131 133 134 #endif /* _NRMEM2_H_ */ 132 135 133 #ifdef __cplusplus 134 } 135 #endif 136 // Local Variables: 137 // tab-width: 4 138 // c-basic-offset: 4 139 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 140 // indent-tabs-mode: nil 141 // End: 136 142 137 #else 138 //#pragma message(" Warning : attemp to re-include nrmem2.h") 139 #endif /* _NRMEM2_H_ */ 143 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 144 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrmem2x.h
r772 r826 12 12 #define _NRMEM2X_H_ 13 13 14 #ifdef __cplusplus15 #ifdef PRAGMA_VERBOSE16 #pragma message ("C++")17 #endif18 extern "C" {19 #endif20 14 21 15 /* ------------------------------------------ */ … … 27 21 /* ------------------------------------------ */ 28 22 29 IMAGE_EXPORT(void) reset_endline_bmatrix (byte **m, long nrl, long nrh, long ncl, long nch); 30 IMAGE_EXPORT(void) reset_endline_i16matrix (int16 **m, long nrl, long nrh, long ncl, long nch); 31 IMAGE_EXPORT(void) reset_endline_ui16matrix(uint16 **m, long nrl, long nrh, long ncl, long nch); 32 IMAGE_EXPORT(void) reset_endline_imatrix (int **m, long nrl, long nrh, long ncl, long nch); 33 IMAGE_EXPORT(void) reset_endline_i32matrix (int32 **m, long nrl, long nrh, long ncl, long nch); 34 IMAGE_EXPORT(void) reset_endline_ui32matrix(uint32 **m, long nrl, long nrh, long ncl, long nch); 35 IMAGE_EXPORT(void) reset_endline_i64matrix (int64 **m, long nrl, long nrh, long ncl, long nch); 23 #define reset_endline_type_matrix(t) \ 24 void short_name(t,reset_endline_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); \ 25 void short_name(t,endline_,matrix)(t ** m, int32_t i, int32_t l); \ 26 void short_name(t,endline0_,matrix)(t ** m, int32_t i, int32_t l, int32_t ncl); \ 27 void short_name(t,endline1_,matrix)(t ** m, int32_t i, int32_t l, int32_t ncl); 36 28 37 IMAGE_EXPORT(void) endline_bmatrix (byte **m, long i, long l); 38 IMAGE_EXPORT(void) endline_i16matrix (int16 **m, long i, long l); 39 IMAGE_EXPORT(void) endline_ui16matrix(uint16 **m, long i, long l); 40 IMAGE_EXPORT(void) endline_imatrix (int **m, long i, long l); 41 IMAGE_EXPORT(void) endline_i32matrix (int32 **m, long i, long l); 42 IMAGE_EXPORT(void) endline_ui32matrix(uint32 **m, long i, long l); 43 IMAGE_EXPORT(void) endline_i64matrix (int64 **m, long i, long l); 29 reset_endline_type_matrix(int8_t); 30 reset_endline_type_matrix(uint8_t); 31 reset_endline_type_matrix(int16_t); 32 reset_endline_type_matrix(uint16_t); 33 reset_endline_type_matrix(int32_t); 34 reset_endline_type_matrix(uint32_t); 35 reset_endline_type_matrix(int64_t); 36 reset_endline_type_matrix(uint64_t); 44 37 45 IMAGE_EXPORT(void) endline0_bmatrix (byte **m, long i, long l, long ncl);46 IMAGE_EXPORT(void) endline0_i16matrix (int16 **m, long i, long l, long ncl);47 IMAGE_EXPORT(void) endline0_ui16matrix(uint16 **m, long i, long l, long ncl);48 IMAGE_EXPORT(void) endline0_imatrix (int **m, long i, long l, long ncl);49 IMAGE_EXPORT(void) endline0_i32matrix (int32 **m, long i, long l, long ncl);50 IMAGE_EXPORT(void) endline0_ui32matrix(uint32 **m, long i, long l, long ncl);51 IMAGE_EXPORT(void) endline0_i64matrix (int64 **m, long i, long l, long ncl);52 38 53 IMAGE_EXPORT(void) endline1_bmatrix (byte **m, long i, long l, long ncl); 54 IMAGE_EXPORT(void) endline1_i16matrix (int16 **m, long i, long l, long ncl); 55 IMAGE_EXPORT(void) endline1_ui16matrix(uint16 **m, long i, long l, long ncl); 56 IMAGE_EXPORT(void) endline1_imatrix (int **m, long i, long l, long ncl); 57 IMAGE_EXPORT(void) endline1_i32matrix (int32 **m, long i, long l, long ncl); 58 IMAGE_EXPORT(void) endline1_ui32matrix(uint32 **m, long i, long l, long ncl); 59 IMAGE_EXPORT(void) endline1_i64matrix (int64 **m, long i, long l, long ncl); 39 #undef resize_type_matrix 40 #define resize_type_matrix(t) \ 41 void short_name(t,resize_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 60 42 61 IMAGE_EXPORT(void) resize_si16Pmatrix(si16Point **m, long nrl, long nrh, long ncl, long nch); 62 IMAGE_EXPORT(void) resize_ui16Pmatrix(ui16Point **m, long nrl, long nrh, long ncl, long nch); 63 IMAGE_EXPORT(void) resize_si32Pmatrix(si32Point **m, long nrl, long nrh, long ncl, long nch); 64 IMAGE_EXPORT(void) resize_ui32Pmatrix(ui32Point **m, long nrl, long nrh, long ncl, long nch); 65 IMAGE_EXPORT(void) resize_f32Pmatrix(f32Point **m, long nrl, long nrh, long ncl, long nch); 43 resize_type_matrix(si16Point); 44 resize_type_matrix(ui16Point); 45 resize_type_matrix(si32Point); 46 resize_type_matrix(ui32Point); 47 resize_type_matrix(f32Point); 48 resize_type_matrix(si16Triplet); 49 resize_type_matrix(ui16Triplet); 50 resize_type_matrix(si32Triplet); 51 resize_type_matrix(ui32Triplet); 52 resize_type_matrix(f32Triplet); 66 53 67 // Triplet Matrix 68 IMAGE_EXPORT(void) resize_si16Tmatrix(si16Triplet **m, long nrl, long nrh, long ncl, long nch); 69 IMAGE_EXPORT(void) resize_ui16Tmatrix(ui16Triplet **m, long nrl, long nrh, long ncl, long nch); 70 IMAGE_EXPORT(void) resize_si32Tmatrix(si32Triplet **m, long nrl, long nrh, long ncl, long nch); 71 IMAGE_EXPORT(void) resize_ui32Tmatrix(ui32Triplet **m, long nrl, long nrh, long ncl, long nch); 72 IMAGE_EXPORT(void) resize_f32Tmatrix (f32Triplet **m, long nrl, long nrh, long ncl, long nch); 54 55 #define type_matrix_reverse(t) \ 56 void short_name(t,,matrix_reverse)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 57 58 type_matrix_reverse(int8_t); 59 type_matrix_reverse(uint8_t); 60 type_matrix_reverse(int16_t); 61 type_matrix_reverse(uint16_t); 62 type_matrix_reverse(int32_t); 63 type_matrix_reverse(uint32_t); 64 type_matrix_reverse(int64_t); 65 type_matrix_reverse(uint64_t); 66 type_matrix_reverse(float); 67 type_matrix_reverse(double); 73 68 74 69 75 70 71 #define desinterlace_type_matrix(t) \ 72 void short_name(t,desinterlace_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D0, t ** D1); 76 73 77 /* 78 * -------------- 79 * matrix_reverse 80 * -------------- 81 */ 74 desinterlace_type_matrix(int8_t); 75 desinterlace_type_matrix(uint8_t); 76 desinterlace_type_matrix(int16_t); 77 desinterlace_type_matrix(uint16_t); 78 desinterlace_type_matrix(int32_t); 79 desinterlace_type_matrix(uint32_t); 80 desinterlace_type_matrix(int64_t); 81 desinterlace_type_matrix(uint64_t); 82 desinterlace_type_matrix(float); 83 desinterlace_type_matrix(double); 84 desinterlace_type_matrix(rgb8); 85 desinterlace_type_matrix(rgbx8); 82 86 83 //IMAGE_EXPORT(void) bmatrix_reverse (byte **m, long nrl, long nrh, long ncl, long nch);84 //IMAGE_EXPORT(void) si16matrix_reverse (sint16 **m, long nrl, long nrh, long ncl, long nch);85 //IMAGE_EXPORT(void) usmatrix_reverse(uint16 **m, long nrl, long nrh, long ncl, long nch);86 87 87 /* copie */ 88 IMAGE_EXPORT(void) copyc_bmatrix(byte **src,long nrl,long nrh,long ncl, long nch, byte **cond, byte c, byte **dst);88 #define interlace_type_matrix(t) \ 89 void short_name(t,interlace_,matrix)(t ** S0, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** S1, t ** D); 89 90 90 IMAGE_EXPORT(void) complete_border_bmatrix (byte **m, long nrl,long nrh,long ncl, long nch, long n); 91 IMAGE_EXPORT(void) complete_border1_bmatrix(byte **m, long nrl,long nrh,long ncl, long nch); 92 IMAGE_EXPORT(void) complete_border2_bmatrix(byte **m, long nrl,long nrh,long ncl, long nch); 91 interlace_type_matrix(int8_t); 92 interlace_type_matrix(uint8_t); 93 interlace_type_matrix(int16_t); 94 interlace_type_matrix(uint16_t); 95 interlace_type_matrix(int32_t); 96 interlace_type_matrix(uint32_t); 97 interlace_type_matrix(int64_t); 98 interlace_type_matrix(uint64_t); 99 interlace_type_matrix(float); 100 interlace_type_matrix(double); 101 interlace_type_matrix(rgb8); 102 interlace_type_matrix(rgbx8); 93 103 94 IMAGE_EXPORT(void) copy1c_bmatrix (byte **X, long nc, byte **Y, long nrl, long nrh, long ncl, long nch); 95 IMAGE_EXPORT(void) copy1c_si16matrix (sint16 **X, long nc, sint16 **Y, long nrl, long nrh, long ncl, long nch); 96 IMAGE_EXPORT(void) copy1c_ui16matrix (uint16 **X, long nc, uint16 **Y, long nrl, long nrh, long ncl, long nch); 97 IMAGE_EXPORT(void) copy1c_si32matrix (sint32 **X, long nc, sint32 **Y, long nrl, long nrh, long ncl, long nch); 98 IMAGE_EXPORT(void) copy1c_ui32matrix (uint32 **X, long nc, uint32 **Y, long nrl, long nrh, long ncl, long nch); 99 IMAGE_EXPORT(void) copy1c_f32matrix (float32 **X, long nc, float32 **Y, long nrl, long nrh, long ncl, long nch); 100 IMAGE_EXPORT(void) copy1c_f64matrix (float64 **X, long nc, float64 **Y, long nrl, long nrh, long ncl, long nch); 101 IMAGE_EXPORT(void) copy1c_rgb8matrix (rgb8 **X, long nc, rgb8 **Y, long nrl, long nrh, long ncl, long nch); 102 IMAGE_EXPORT(void) copy1c_rgbx8matrix(rgbx8 **X, long nc, rgbx8 **Y, long nrl, long nrh, long ncl, long nch); 104 105 #define copyc_type_matrix(t) \ 106 void short_name(t,copyc_,matrix)(t ** src, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** cond, t c, t ** dst) \ 103 107 104 108 /* … … 106 110 * dst(i,j) = src(i,j) si cond(i,j) == c 107 111 */ 108 /*109 IMAGE_EXPORT(void) copy1r_bmatrix (byte **X, long nr, byte **Y, long nrl, long nrh, long ncl, long nch);110 IMAGE_EXPORT(void) copy1r_smatrix (sint16 **X, long nr, sint16 **Y, long nrl, long nrh, long ncl, long nch);111 IMAGE_EXPORT(void) copy1r_usmatrix (uint16 **X, long nr, uint16 **Y, long nrl, long nrh, long ncl, long nch);112 IMAGE_EXPORT(void) copy1r_imatrix (int **X, long nr, int **Y, long nrl, long nrh, long ncl, long nch);113 IMAGE_EXPORT(void) copy1r_uimatrix (uint **X, long nr, uint **Y, long nrl, long nrh, long ncl, long nch);114 IMAGE_EXPORT(void) copy1r_matrix (float **X, long nr, float **Y, long nrl, long nrh, long ncl, long nch);115 IMAGE_EXPORT(void) copy1r_dmatrix (double **X, long nr, double **Y, long nrl, long nrh, long ncl, long nch);116 IMAGE_EXPORT(void) copy1r_rgb8matrix (rgb8 **X, long nr, rgb8 **Y, long nrl, long nrh, long ncl, long nch);117 IMAGE_EXPORT(void) copy1r_rgbx8matrix(rgbx8 **X, long nr, rgbx8 **Y, long nrl, long nrh, long ncl, long nch);118 112 119 IMAGE_EXPORT(void) copy_bmatrix (byte **m1, long nrl1,long nrh1,long ncl1, long nch1, byte **m2, long nrl2, long nrh2, long ncl2, long nch2); 120 IMAGE_EXPORT(void) copy_smatrix (sint16 **m1, long nrl1,long nrh1,long ncl1, long nch1, sint16 **m2, long nrl2, long nrh2, long ncl2, long nch2); 121 IMAGE_EXPORT(void) copy_usmatrix (uint16 **m1, long nrl1,long nrh1,long ncl1, long nch1, uint16 **m2, long nrl2, long nrh2, long ncl2, long nch2); 122 IMAGE_EXPORT(void) copy_imatrix (int **m1, long nrl1,long nrh1,long ncl1, long nch1, int **m2, long nrl2, long nrh2, long ncl2, long nch2); 123 IMAGE_EXPORT(void) copy_uimatrix (uint **m1, long nrl1,long nrh1,long ncl1, long nch1, uint **m2, long nrl2, long nrh2, long ncl2, long nch2); 124 IMAGE_EXPORT(void) copy_matrix (float **m1, long nrl1,long nrh1,long ncl1, long nch1, float **m2, long nrl2, long nrh2, long ncl2, long nch2); 125 IMAGE_EXPORT(void) copy_dmatrix (double **m1, long nrl1,long nrh1,long ncl1, long nch1, double **m2, long nrl2, long nrh2, long ncl2, long nch2); 126 IMAGE_EXPORT(void) copy_rgb8matrix (rgb8 **m1, long nrl1,long nrh1,long ncl1, long nch1, rgb8 **m2, long nrl2, long nrh2, long ncl2, long nch2); 127 IMAGE_EXPORT(void) copy_rgbx8matrix(rgbx8 **m1, long nrl1,long nrh1,long ncl1, long nch1, rgbx8 **m2, long nrl2, long nrh2, long ncl2, long nch2); 128 129 IMAGE_EXPORT(void) copy_sub_bmatrix(byte **src, long nrl,long nrh,long ncl, long nch, byte **dst); 130 131 IMAGE_EXPORT(void) extract_bmatrix (byte **src, long nrl,long nrh,long ncl, long nch, byte **dst); 132 IMAGE_EXPORT(void) extract_smatrix (sint16 **src, long nrl,long nrh,long ncl, long nch, sint16 **dst); 133 IMAGE_EXPORT(void) extract_usmatrix(uint16 **src, long nrl,long nrh,long ncl, long nch, uint16 **dst); 134 IMAGE_EXPORT(void) extract_imatrix (int **src, long nrl,long nrh,long ncl, long nch, int **dst); 135 IMAGE_EXPORT(void) extract_uimatrix(uint **src, long nrl,long nrh,long ncl, long nch, uint **dst); 136 IMAGE_EXPORT(void) extract_matrix (float **src, long nrl,long nrh,long ncl, long nch, float **dst); 137 IMAGE_EXPORT(void) extract_dmatrix (double **src, long nrl,long nrh,long ncl, long nch, double **dst); 138 */ 139 IMAGE_EXPORT(void) copy_center_bmatrix(byte **src, long nrl0,long nrh0,long ncl0, long nch0, byte **dst, long nrl1,long nrh1,long ncl1, long nch1); 140 141 IMAGE_EXPORT(void) copy_sub_imatrix(int **src, long nrl,long nrh,long ncl, long nch, int **dst); 142 143 IMAGE_EXPORT(void) copy_sub_imatrix_index(int **src, long nrl,long nrh, long ncl, long nch, int **dst,int *index); 144 145 /* --------------------- */ 146 /* --- De-Interleave --- */ 147 /* --------------------- */ 148 149 IMAGE_EXPORT(void) desinterlace_bmatrix (byte **S, long nrl, long nrh, long ncl, long nch, byte **D0, byte **D1); 150 IMAGE_EXPORT(void) desinterlace_rgb8matrix(rgb8 **S, long nrl, long nrh, long ncl, long nch, rgb8 **D0, rgb8 **D1); 151 152 IMAGE_EXPORT(void) interlace_bmatrix (byte **S0, long nrl, long nrh, long ncl, long nch, byte **S1, byte **D); 153 IMAGE_EXPORT(void) interlace_rgb8matrix(rgb8 **S0, long nrl, long nrh, long ncl, long nch, rgb8 **S1, rgb8 **D); 113 copyc_type_matrix(int8_t); 114 copyc_type_matrix(uint8_t); 115 copyc_type_matrix(int16_t); 116 copyc_type_matrix(uint16_t); 117 copyc_type_matrix(int32_t); 118 copyc_type_matrix(uint32_t); 119 copyc_type_matrix(int64_t); 120 copyc_type_matrix(uint64_t); 121 copyc_type_matrix(float); 122 copyc_type_matrix(double); 123 copyc_type_matrix(rgb8); 124 copyc_type_matrix(rgbx8); 154 125 155 126 156 #ifdef __cplusplus 157 } 158 #endif 127 #define complete_border_type_matrix(t) \ 128 void short_name(t,complete_border_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t n); \ 129 void short_name(t,complete_border1_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); \ 130 void short_name(t,complete_border2_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 159 131 160 #else 161 //#pragma message(" Warning : attemp to re-include nrmem2x.h") 132 complete_border_type_matrix(int8_t); 133 complete_border_type_matrix(uint8_t); 134 complete_border_type_matrix(int16_t); 135 complete_border_type_matrix(uint16_t); 136 complete_border_type_matrix(int32_t); 137 complete_border_type_matrix(uint32_t); 138 complete_border_type_matrix(int64_t); 139 complete_border_type_matrix(uint64_t); 140 complete_border_type_matrix(float); 141 complete_border_type_matrix(double); 142 complete_border_type_matrix(rgb8); 143 complete_border_type_matrix(rgbx8); 144 145 146 #define copy1c_type_matrix(t) \ 147 void short_name(t,copy1c_,matrix)(t ** X, int32_t nc, t ** Y, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); \ 148 void short_name(t,copy1r_,matrix)(t ** X, int32_t nr, t ** Y, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 149 150 copy1c_type_matrix(int8_t); 151 copy1c_type_matrix(uint8_t); 152 copy1c_type_matrix(int16_t); 153 copy1c_type_matrix(uint16_t); 154 copy1c_type_matrix(int32_t); 155 copy1c_type_matrix(uint32_t); 156 copy1c_type_matrix(int64_t); 157 copy1c_type_matrix(uint64_t); 158 copy1c_type_matrix(float); 159 copy1c_type_matrix(double); 160 copy1c_type_matrix(rgb8); 161 copy1c_type_matrix(rgbx8); 162 163 162 164 #endif /* _NRMEM2X_H_ */ 165 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrmem2xx.h
r772 r826 8 8 #define _NRMEM2XX_H_ 9 9 10 #ifdef __cplusplus11 #ifdef PRAGMA_VERBOSE12 #pragma message ("C++")13 #endif14 extern "C" {15 #endif16 10 17 11 /* ----------------------- */ 18 12 /* -- Rotation and Flip -- */ 19 13 /* ----------------------- */ 14 20 15 // no check performed on size, S and D must be different 21 IMAGE_EXPORT(void) lrotate_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch, byte **D);22 IMAGE_EXPORT(void) lrotate_smatrix (short **S, long nrl,long nrh,long ncl, long nch, short **D);23 IMAGE_EXPORT(void) lrotate_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D);24 IMAGE_EXPORT(void) lrotate_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch, sint16 **D);25 IMAGE_EXPORT(void) lrotate_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D);26 IMAGE_EXPORT(void) lrotate_imatrix (int **S, long nrl,long nrh,long ncl, long nch, int **D);27 IMAGE_EXPORT(void) lrotate_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch, uint **D);28 IMAGE_EXPORT(void) lrotate_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D);29 IMAGE_EXPORT(void) lrotate_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D);30 IMAGE_EXPORT(void) lrotate_matrix (float **S, long nrl,long nrh,long ncl, long nch, float **D);31 IMAGE_EXPORT(void) lrotate_dmatrix (double **S, long nrl,long nrh,long ncl, long nch, double **D);32 IMAGE_EXPORT(void) lrotate_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D);33 16 34 IMAGE_EXPORT(void) rrotate_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch, byte **D);35 IMAGE_EXPORT(void) rrotate_smatrix (short **S, long nrl,long nrh,long ncl, long nch, short **D);36 IMAGE_EXPORT(void) rrotate_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D);37 IMAGE_EXPORT(void) rrotate_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch, sint16 **D);38 IMAGE_EXPORT(void) rrotate_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D);39 IMAGE_EXPORT(void) rrotate_imatrix (int **S, long nrl,long nrh,long ncl, long nch, int **D);40 IMAGE_EXPORT(void) rrotate_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch, uint **D);41 IMAGE_EXPORT(void) rrotate_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D);42 IMAGE_EXPORT(void) rrotate_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D);43 IMAGE_EXPORT(void) rrotate_matrix (float **S, long nrl,long nrh,long ncl, long nch, float **D);44 IMAGE_EXPORT(void) rrotate_dmatrix (double **S, long nrl,long nrh,long ncl, long nch, double **D);45 IMAGE_EXPORT(void) rrotate_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D);46 17 47 IMAGE_EXPORT(void) lrotate1_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch); 48 IMAGE_EXPORT(void) lrotate1_smatrix (short **S, long nrl,long nrh,long ncl, long nch); 49 IMAGE_EXPORT(void) lrotate1_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch); 50 IMAGE_EXPORT(void) lrotate1_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch); 51 IMAGE_EXPORT(void) lrotate1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch); 52 IMAGE_EXPORT(void) lrotate1_imatrix (int **S, long nrl,long nrh,long ncl, long nch); 53 IMAGE_EXPORT(void) lrotate1_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch); 54 IMAGE_EXPORT(void) lrotate1_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch); 55 IMAGE_EXPORT(void) lrotate1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch); 56 IMAGE_EXPORT(void) lrotate1_matrix (float **S, long nrl,long nrh,long ncl, long nch); 57 IMAGE_EXPORT(void) lrotate1_dmatrix (double **S, long nrl,long nrh,long ncl, long nch); 58 IMAGE_EXPORT(void) lrotate1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch); 18 #define rotate_flip_type_matrix(t) \ 19 void short_name(t,lrotate_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D); \ 20 void short_name(t,rrotate_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D); \ 21 void short_name(t,lrotate1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); \ 22 void short_name(t,rrotate1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); \ 23 void short_name(t,hflip_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D); \ 24 void short_name(t,vflip_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D); \ 25 void short_name(t,hflip1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); \ 26 void short_name(t,vflip1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 59 27 60 IMAGE_EXPORT(void) rrotate1_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch);61 IMAGE_EXPORT(void) rrotate1_smatrix (short **S, long nrl,long nrh,long ncl, long nch);62 IMAGE_EXPORT(void) rrotate1_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch);63 IMAGE_EXPORT(void) rrotate1_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch);64 IMAGE_EXPORT(void) rrotate1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch);65 IMAGE_EXPORT(void) rrotate1_imatrix (int **S, long nrl,long nrh,long ncl, long nch);66 IMAGE_EXPORT(void) rrotate1_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch);67 IMAGE_EXPORT(void) rrotate1_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch);68 IMAGE_EXPORT(void) rrotate1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch);69 IMAGE_EXPORT(void) rrotate1_matrix (float **S, long nrl,long nrh,long ncl, long nch);70 IMAGE_EXPORT(void) rrotate1_dmatrix (double **S, long nrl,long nrh,long ncl, long nch);71 IMAGE_EXPORT(void) rrotate1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch);28 rotate_flip_type_matrix(int8_t); 29 rotate_flip_type_matrix(uint8_t); 30 rotate_flip_type_matrix(int16_t); 31 rotate_flip_type_matrix(uint16_t); 32 rotate_flip_type_matrix(int32_t); 33 rotate_flip_type_matrix(uint32_t); 34 rotate_flip_type_matrix(int64_t); 35 rotate_flip_type_matrix(uint64_t); 36 rotate_flip_type_matrix(float); 37 rotate_flip_type_matrix(double); 38 rotate_flip_type_matrix(rgb8); 39 rotate_flip_type_matrix(rgbx8); 72 40 73 IMAGE_EXPORT(void) hflip_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch, byte **D);74 IMAGE_EXPORT(void) hflip_smatrix (short **S, long nrl,long nrh,long ncl, long nch, short **D);75 IMAGE_EXPORT(void) hflip_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D);76 IMAGE_EXPORT(void) hflip_i16matrix (int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D);77 IMAGE_EXPORT(void) hflip_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D);78 IMAGE_EXPORT(void) hflip_imatrix (int **S, long nrl,long nrh,long ncl, long nch, int **D);79 IMAGE_EXPORT(void) hflip_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch, uint **D);80 IMAGE_EXPORT(void) hflip_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D);81 IMAGE_EXPORT(void) hflip_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D);82 IMAGE_EXPORT(void) hflip_matrix (float **S, long nrl,long nrh,long ncl, long nch, float **D);83 IMAGE_EXPORT(void) hflip_dmatrix (double **S, long nrl,long nrh,long ncl, long nch, double **D);84 IMAGE_EXPORT(void) hflip_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D);85 41 86 IMAGE_EXPORT(void) vflip_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch, byte **D); 87 IMAGE_EXPORT(void) vflip_smatrix (short **S, long nrl,long nrh,long ncl, long nch, short **D); 88 IMAGE_EXPORT(void) vflip_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D); 89 IMAGE_EXPORT(void) vflip_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch, int16 **D); 90 IMAGE_EXPORT(void) vflip_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D); 91 IMAGE_EXPORT(void) vflip_imatrix (int **S, long nrl,long nrh,long ncl, long nch, int **D); 92 IMAGE_EXPORT(void) vflip_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch, uint **D); 93 IMAGE_EXPORT(void) vflip_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D); 94 IMAGE_EXPORT(void) vflip_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D); 95 IMAGE_EXPORT(void) vflip_matrix (float **S, long nrl,long nrh,long ncl, long nch, float **D); 96 IMAGE_EXPORT(void) vflip_dmatrix (double **S, long nrl,long nrh,long ncl, long nch, double **D); 97 IMAGE_EXPORT(void) vflip_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D); 42 #endif /* _NRMEM2XX_H_ */ 98 43 99 IMAGE_EXPORT(void) hflip1_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch); 100 IMAGE_EXPORT(void) hflip1_smatrix (short **S, long nrl,long nrh,long ncl, long nch); 101 IMAGE_EXPORT(void) hflip1_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch); 102 IMAGE_EXPORT(void) hflip1_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch); 103 IMAGE_EXPORT(void) hflip1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch); 104 IMAGE_EXPORT(void) hflip1_imatrix (int **S, long nrl,long nrh,long ncl, long nch); 105 IMAGE_EXPORT(void) hflip1_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch); 106 IMAGE_EXPORT(void) hflip1_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch); 107 IMAGE_EXPORT(void) hflip1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch); 108 IMAGE_EXPORT(void) hflip1_matrix (float **S, long nrl,long nrh,long ncl, long nch); 109 IMAGE_EXPORT(void) hflip1_dmatrix (double **S, long nrl,long nrh,long ncl, long nch); 110 IMAGE_EXPORT(void) hflip1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch); 44 // Local Variables: 45 // tab-width: 4 46 // c-basic-offset: 4 47 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 48 // indent-tabs-mode: nil 49 // End: 111 50 112 IMAGE_EXPORT(void) vflip1_bmatrix (byte **S, long nrl,long nrh,long ncl, long nch); 113 IMAGE_EXPORT(void) vflip1_smatrix (short **S, long nrl,long nrh,long ncl, long nch); 114 IMAGE_EXPORT(void) vflip1_usmatrix (ushort **S, long nrl,long nrh,long ncl, long nch); 115 IMAGE_EXPORT(void) vflip1_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch); 116 IMAGE_EXPORT(void) vflip1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch); 117 IMAGE_EXPORT(void) vflip1_imatrix (int **S, long nrl,long nrh,long ncl, long nch); 118 IMAGE_EXPORT(void) vflip1_uimatrix (uint **S, long nrl,long nrh,long ncl, long nch); 119 IMAGE_EXPORT(void) vflip1_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch); 120 IMAGE_EXPORT(void) vflip1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch); 121 IMAGE_EXPORT(void) vflip1_matrix (float **S, long nrl,long nrh,long ncl, long nch); 122 IMAGE_EXPORT(void) vflip1_dmatrix (double **S, long nrl,long nrh,long ncl, long nch); 123 IMAGE_EXPORT(void) vflip1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch); 51 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 124 52 125 #ifdef __cplusplus126 }127 #endif128 129 #else130 //#pragma message(" Warning : attemp to re-include nrmem2x.h")131 #endif /* _NRMEM2XX_H_ */ -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrset1.h
r772 r826 11 11 #define _NRSET1_H_ 12 12 13 #ifdef __cplusplus14 #ifdef PRAGMA_VERBOSE15 #pragma message ("C++")16 #endif17 extern "C" {18 #endif19 20 #ifdef PRAGMA_VERBOSE21 //#pragma message("- include nrset1.h")22 #endif23 13 24 14 /* 25 15 * ------------ 26 16 * --- Zero --- 17 * --- set_vector --- 18 * --- set_vector_param --- 19 * --- set_vector_j --- 27 20 * ------------ 28 21 */ 29 22 30 IMAGE_EXPORT(void) zero_si8vector (sint8 *v, long nl, long nh); 31 IMAGE_EXPORT(void) zero_ui8vector (uint8 *v, long nl, long nh); 32 IMAGE_EXPORT(void) zero_si16vector (sint16 *v, long nl, long nh); 33 IMAGE_EXPORT(void) zero_ui16vector (uint16 *v, long nl, long nh); 34 IMAGE_EXPORT(void) zero_si32vector (sint32 *v, long nl, long nh); 35 IMAGE_EXPORT(void) zero_ui32vector (uint32 *v, long nl, long nh); 36 IMAGE_EXPORT(void) zero_si64vector (sint64 *v, long nl, long nh); 37 IMAGE_EXPORT(void) zero_ui64vector (uint64 *v, long nl, long nh); 23 #define zero_set_type_vector(t) \ 24 void short_name(t,zero_,vector)(t * v, int32_t nl, int32_t nh); \ 25 void short_name(t,set_,vector)(t * v, int32_t nl, int32_t nh, t x); \ 26 void short_name(t,set_,vector_param)(t * v, int32_t nl, int32_t nh, t x, t xstep); \ 27 void short_name(t,set_,vector_j)(t * v, int32_t nl, int32_t nh); 38 28 39 IMAGE_EXPORT(void) zero_f32vector (float32 *v, long nl, long nh); 40 IMAGE_EXPORT(void) zero_f64vector (float64 *v, long nl, long nh); 29 zero_set_type_vector(int8_t); 30 zero_set_type_vector(uint8_t); 31 zero_set_type_vector(int16_t); 32 zero_set_type_vector(uint16_t); 33 zero_set_type_vector(int32_t); 34 zero_set_type_vector(uint32_t); 35 zero_set_type_vector(int64_t); 36 zero_set_type_vector(uint64_t); 37 zero_set_type_vector(float); 38 zero_set_type_vector(double); 39 zero_set_type_vector(rgb8); 40 zero_set_type_vector(rgbx8); 41 41 42 IMAGE_EXPORT(void) zero_rgb8vector (rgb8 *v, long nl, long nh);43 IMAGE_EXPORT(void) zero_rgbx8vector(rgbx8 *v, long nl, long nh);44 45 /*46 * ------------------47 * --- set_vector ---48 * ------------------49 */50 51 IMAGE_EXPORT(void) set_si8vector (sint8 *v, long nl, long nh, sint8 x);52 IMAGE_EXPORT(void) set_ui8vector (uint8 *v, long nl, long nh, uint8 x);53 IMAGE_EXPORT(void) set_si16vector (sint16 *v, long nl, long nh, int16 x);54 IMAGE_EXPORT(void) set_ui16vector (uint16 *v, long nl, long nh, uint16 x);55 IMAGE_EXPORT(void) set_si32vector (sint32 *v, long nl, long nh, sint32 x);56 IMAGE_EXPORT(void) set_ui32vector (uint32 *v, long nl, long nh, uint32 x);57 IMAGE_EXPORT(void) set_si64vector (sint64 *v, long nl, long nh, sint64 x);58 IMAGE_EXPORT(void) set_ui64vector (uint64 *v, long nl, long nh, uint64 x);59 60 IMAGE_EXPORT(void) set_f32vector (float32 *v, long nl, long nh, float32 x);61 IMAGE_EXPORT(void) set_f64vector (float64 *v, long nl, long nh, float64 x);62 63 IMAGE_EXPORT(void) set_rgb8vector (rgb8 *v, long nl, long nh, rgb8 x);64 IMAGE_EXPORT(void) set_rgbx8vector(rgbx8 *v, long nl, long nh, rgbx8 x);65 66 /*67 * ------------------------68 * --- set_vector_param ---69 * ------------------------70 */71 72 IMAGE_EXPORT(void) set_si8vector_param (sint8 *v, long nl, long nh, sint8 x, sint8 xstep);73 IMAGE_EXPORT(void) set_ui8vector_param (uint8 *v, long nl, long nh, uint8 x, uint8 xstep);74 IMAGE_EXPORT(void) set_si16vector_param (sint16 *v, long nl, long nh, int16 x, sint16 xstep);75 IMAGE_EXPORT(void) set_ui16vector_param (uint16 *v, long nl, long nh, uint16 x, uint16 xstep);76 IMAGE_EXPORT(void) set_si32vector_param (sint32 *v, long nl, long nh, sint32 x, sint32 xstep);77 IMAGE_EXPORT(void) set_ui32vector_param (uint32 *v, long nl, long nh, uint32 x, uint32 xstep);78 IMAGE_EXPORT(void) set_si64vector_param (sint64 *v, long nl, long nh, sint64 x, sint64 xstep);79 IMAGE_EXPORT(void) set_ui64vector_param (uint64 *v, long nl, long nh, uint64 x, uint64 xstep);80 81 IMAGE_EXPORT(void) set_f32vector_param (float32 *v, long nl, long nh, float32 x, float32 xstep);82 IMAGE_EXPORT(void) set_f64vector_param (float64 *v, long nl, long nh, float64 x, float64 xstep);83 84 IMAGE_EXPORT(void) set_rgb8vector_param (rgb8 *v, long nl, long nh, rgb8 x, rgb8 xstep);85 IMAGE_EXPORT(void) set_rgbx8vector_param(rgbx8 *v, long nl, long nh, rgbx8 x, rgbx8 xstep);86 87 /*88 * --------------------89 * --- set_vector_j ---90 * --------------------91 */92 93 IMAGE_EXPORT(void) set_si8vector_j (sint8 *v, long nl, long nh);94 IMAGE_EXPORT(void) set_ui8vector_j (uint8 *v, long nl, long nh);95 IMAGE_EXPORT(void) set_si16vector_j (sint16 *v, long nl, long nh);96 IMAGE_EXPORT(void) set_ui16vector_j (uint16 *v, long nl, long nh);97 IMAGE_EXPORT(void) set_si32vector_j (sint32 *v, long nl, long nh);98 IMAGE_EXPORT(void) set_ui32vector_j (uint32 *v, long nl, long nh);99 100 IMAGE_EXPORT(void) set_f32vector_j (float32 *v, long nl, long nh);101 IMAGE_EXPORT(void) set_f64vector_j (float64 *v, long nl, long nh);102 103 IMAGE_EXPORT(void) set_rgb8vector_j (rgb8 *v, long nl, long nh);104 IMAGE_EXPORT(void) set_rgbx8vector_j(rgbx8 *v, long nl, long nh);105 42 106 43 /* … … 110 47 */ 111 48 112 IMAGE_EXPORT(void) set_si8vector_str (sint8 *v, long nl, long nh, char *str); 113 IMAGE_EXPORT(void) set_ui8vector_str (uint8 *v, long nl, long nh, char *str); 114 IMAGE_EXPORT(void) set_si16vector_str (sint16 *v, long nl, long nh, char *str); 115 IMAGE_EXPORT(void) set_ui16vector_str (uint16 *v, long nl, long nh, char *str); 116 IMAGE_EXPORT(void) set_si32vector_str (sint32 *v, long nl, long nh, char *str); 117 IMAGE_EXPORT(void) set_ui32vector_str (uint32 *v, long nl, long nh, char *str); 49 #define set_type_vector_str(t) \ 50 void short_name(t,set_,vector_str)(t * v, int32_t nl, int32_t nh, char * str); 118 51 119 #ifdef __cplusplus 120 } 121 #endif 52 set_type_vector_str(int8_t); 53 set_type_vector_str(uint8_t); 54 set_type_vector_str(int16_t); 55 set_type_vector_str(uint16_t); 56 set_type_vector_str(int32_t); 57 set_type_vector_str(uint32_t); 58 set_type_vector_str(int64_t); 59 set_type_vector_str(uint64_t); 60 122 61 123 62 #endif /* __NRSET1_H__ */ 63 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrset2.h
r772 r826 11 11 #define _NR_SET2_H_ 12 12 13 #ifdef __cplusplus14 #ifdef PRAGMA_VERBOSE15 #pragma message ("C++")16 #endif17 extern "C" {18 #endif19 13 20 #ifdef PRAGMA_VERBOSE 21 //#pragma message("- include nrset2.h") 22 #endif 23 24 IMAGE_EXPORT(void) zero_si8matrix (sint8 **m, int i0,int i1,int j0,int j1); 25 IMAGE_EXPORT(void) zero_ui8matrix (uint8 **m, int i0,int i1,int j0,int j1); 26 IMAGE_EXPORT(void) zero_si16matrix (sint16 **m, int i0,int i1,int j0,int j1); 27 IMAGE_EXPORT(void) zero_ui16matrix (uint16 **m, int i0,int i1,int j0,int j1); 28 IMAGE_EXPORT(void) zero_si32matrix (sint32 **m, int i0,int i1,int j0,int j1); 29 IMAGE_EXPORT(void) zero_ui32matrix (uint32 **m, int i0,int i1,int j0,int j1); 30 IMAGE_EXPORT(void) zero_si64matrix (sint64 **m, int i0,int i1,int j0,int j1); 31 IMAGE_EXPORT(void) zero_ui64matrix (uint64 **m, int i0,int i1,int j0,int j1); 32 33 IMAGE_EXPORT(void) zero_f32matrix (float32 **m, int i0,int i1,int j0,int j1); 34 IMAGE_EXPORT(void) zero_f64matrix (float64 **m, int i0,int i1,int j0,int j1); 35 36 IMAGE_EXPORT(void) zero_rgb8matrix (rgb8 **m, int i0,int i1,int j0,int j1); 37 IMAGE_EXPORT(void) zero_rgbx8matrix(rgbx8 **m, int i0,int i1,int j0,int j1); 38 39 /* ------------------ */ 40 /* --- set_matrix --- */ 41 /* ------------------ */ 42 43 IMAGE_EXPORT(void) set_si8matrix (sint8 **m,int i0,int i1,int j0, int j1, sint8 x); 44 IMAGE_EXPORT(void) set_ui8matrix (uint8 **m,int i0,int i1,int j0, int j1, uint8 x); 45 IMAGE_EXPORT(void) set_si16matrix (sint16 **m,int i0,int i1,int j0, int j1, sint16 x); 46 IMAGE_EXPORT(void) set_ui16matrix (uint16 **m,int i0,int i1,int j0, int j1, uint16 x); 47 IMAGE_EXPORT(void) set_si32matrix (sint32 **m,int i0,int i1,int j0, int j1, sint32 x); 48 IMAGE_EXPORT(void) set_ui32matrix (uint32 **m,int i0,int i1,int j0, int j1, uint32 x); 49 IMAGE_EXPORT(void) set_si64matrix (sint64 **m,int i0,int i1,int j0, int j1, sint64 x); 50 IMAGE_EXPORT(void) set_ui64matrix (uint64 **m,int i0,int i1,int j0, int j1, uint64 x); 51 52 IMAGE_EXPORT(void) set_f32matrix (float32 **m,int i0,int i1,int j0, int j1, float32 x); 53 IMAGE_EXPORT(void) set_f64matrix (float64 **m,int i0,int i1,int j0, int j1, float64 x); 54 55 IMAGE_EXPORT(void) set_rgb8matrix (rgb8 **m,int i0,int i1,int j0, int j1, rgb8 x); 56 IMAGE_EXPORT(void) set_rgbx8matrix(rgbx8 **m,int i0,int i1,int j0, int j1, rgbx8 x); 57 58 /* 59 * ------------------------ 14 /* ------------------ 15 * --- set_matrix --- 60 16 * --- set_matrix_param --- 61 * ------------------ ------17 * ------------------ 62 18 */ 63 64 IMAGE_EXPORT(void) set_si8matrix_param (sint8 **m, int i0, int i1, int j0, int j1, sint8 x, sint8 xstep, sint8 ystep);65 IMAGE_EXPORT(void) set_ui8matrix_param (uint8 **m, int i0, int i1, int j0, int j1, uint8 x, uint8 xstep, uint8 ystep);66 IMAGE_EXPORT(void) set_si16matrix_param (sint16 **m, int i0, int i1, int j0, int j1, sint16 x, sint16 xstep, sint16 ystep);67 IMAGE_EXPORT(void) set_ui16matrix_param (uint16 **m, int i0, int i1, int j0, int j1, uint16 x, uint16 xstep, uint16 ystep);68 IMAGE_EXPORT(void) set_si32matrix_param (sint32 **m, int i0, int i1, int j0, int j1, sint32 x, sint32 xstep, sint32 ystep);69 IMAGE_EXPORT(void) set_ui32matrix_param (uint32 **m, int i0, int i1, int j0, int j1, uint32 x, uint32 xstep, uint32 ystep);70 IMAGE_EXPORT(void) set_si64matrix_param (sint64 **m, int i0, int i1, int j0, int j1, sint64 x, sint64 xstep, sint64 ystep);71 IMAGE_EXPORT(void) set_ui64matrix_param (uint64 **m, int i0, int i1, int j0, int j1, uint64 x, uint64 xstep, uint64 ystep);72 73 IMAGE_EXPORT(void) set_f32matrix_param (float32 **m, int i0, int i1, int j0, int j1, float32 x, float32 xstep, float32 ystep);74 IMAGE_EXPORT(void) set_f64matrix_param (float64 **m, int i0, int i1, int j0, int j1, float64 x, float64 xstep, float64 ystep);75 76 IMAGE_EXPORT(void) set_rgb8matrix_param (rgb8 **m, int i0, int i1, int j0, int j1, rgb8 x, rgb8 xstep, rgb8 ystep);77 IMAGE_EXPORT(void) set_rgbx8matrix_param(rgbx8 **m, int i0, int i1, int j0, int j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep);78 19 79 20 /* … … 84 25 85 26 /* 86 * [i0 .. i0] [1 1 1]27 * [i0 .. i0] [1 1 1] 87 28 * m[... ...] = [2 2 2] 88 * [i1 .. i1] [3 3 3]29 * [i1 .. i1] [3 3 3] 89 30 */ 90 91 IMAGE_EXPORT(void) set_si8matrix_i (sint8 **m, int i0, int i1, int j0, int j1);92 IMAGE_EXPORT(void) set_ui8matrix_i (uint8 **m, int i0, int i1, int j0, int j1);93 IMAGE_EXPORT(void) set_si16matrix_i (sint16 **m, int i0, int i1, int j0, int j1);94 IMAGE_EXPORT(void) set_ui16matrix_i (uint16 **m, int i0, int i1, int j0, int j1);95 IMAGE_EXPORT(void) set_si32matrix_i (sint32 **m, int i0, int i1, int j0, int j1);96 IMAGE_EXPORT(void) set_ui32matrix_i (uint32 **m, int i0, int i1, int j0, int j1);97 IMAGE_EXPORT(void) set_si64matrix_i (sint64 **m, int i0, int i1, int j0, int j1);98 IMAGE_EXPORT(void) set_ui64matrix_i (uint64 **m, int i0, int i1, int j0, int j1);99 100 IMAGE_EXPORT(void) set_f32matrix_i (float32 **m, int i0, int i1, int j0, int j1);101 IMAGE_EXPORT(void) set_f64matrix_i (float64 **m, int i0, int i1, int j0, int j1);102 103 IMAGE_EXPORT(void) set_rgb8matrix_i (rgb8 **m, int i0, int i1, int j0, int j1);104 IMAGE_EXPORT(void) set_rgbx8matrix_i(rgbx8 **m, int i0, int i1, int j0, int j1);105 31 106 32 /* … … 111 37 112 38 /* 113 * [j0 .. j1][1 2 3]114 * m[... .. ...] = [1 2 3]115 * [j0 .. j1][1 2 3]116 */39 * [j0 .. j1] [1 2 3] 40 * m[... .. ...] = [1 2 3] 41 * [j0 .. j1] [1 2 3] 42 */ 117 43 118 IMAGE_EXPORT(void) set_si8matrix_j (sint8 **m, int i0, int i1, int j0, int j1); 119 IMAGE_EXPORT(void) set_ui8matrix_j (uint8 **m, int i0, int i1, int j0, int j1); 120 IMAGE_EXPORT(void) set_si16matrix_j (sint16 **m, int i0, int i1, int j0, int j1); 121 IMAGE_EXPORT(void) set_ui16matrix_j (uint16 **m, int i0, int i1, int j0, int j1); 122 IMAGE_EXPORT(void) set_si32matrix_j (sint32 **m, int i0, int i1, int j0, int j1); 123 IMAGE_EXPORT(void) set_ui32matrix_j (uint32 **m, int i0, int i1, int j0, int j1); 124 IMAGE_EXPORT(void) set_si64matrix_j (sint64 **m, int i0, int i1, int j0, int j1); 125 IMAGE_EXPORT(void) set_ui64matrix_ (uint64 **m, int i0, int i1, int j0, int j1); 44 #define set_type_matrix(t) \ 45 void short_name(t,zero_,matrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1); \ 46 void short_name(t,set_,matrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x); \ 47 void short_name(t,set_,matrix_param)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x, t xstep, t ystep); \ 48 void short_name(t,set_,matrix_i)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1); \ 49 void short_name(t,set_,matrix_j)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1); 126 50 127 IMAGE_EXPORT(void) set_f32matrix_j (float32 **m, int i0, int i1, int j0, int j1);128 IMAGE_EXPORT(void) set_f64matrix_j (float64 **m, int i0, int i1, int j0, int j1);129 51 130 IMAGE_EXPORT(void) set_rgb8matrix_j (rgb8 **m, int i0, int i1, int j0, int j1); 131 IMAGE_EXPORT(void) set_rgbx8matrix_j(rgbx8 **m, int i0, int i1, int j0, int j1); 52 set_type_matrix(int8_t); 53 set_type_matrix(uint8_t); 54 set_type_matrix(int16_t); 55 set_type_matrix(uint16_t); 56 set_type_matrix(int32_t); 57 set_type_matrix(uint32_t); 58 set_type_matrix(int64_t); 59 set_type_matrix(uint64_t); 60 set_type_matrix(float); 61 set_type_matrix(double); 62 set_type_matrix(rgb8); 63 set_type_matrix(rgbx8); 64 65 132 66 133 67 /* … … 135 69 */ 136 70 71 #define set_type_matrix_border(t) \ 72 void short_name(t,set_,matrix_border)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, int32_t n, t x); \ 73 void short_name(t,set_,matrix_border1)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x); 137 74 138 IMAGE_EXPORT(void) set_ui8matrix_border1(uint8 **m,int i0,int i1,int j0, int j1, uint8 x); 139 IMAGE_EXPORT(void) set_ui8matrix_border (uint8 **m,int i0,int i1,int j0, int j1, int n, uint8 x); 75 set_type_matrix_border(int8_t); 76 set_type_matrix_border(uint8_t); 77 set_type_matrix_border(int16_t); 78 set_type_matrix_border(uint16_t); 79 set_type_matrix_border(int32_t); 80 set_type_matrix_border(uint32_t); 81 set_type_matrix_border(int64_t); 82 set_type_matrix_border(uint64_t); 83 set_type_matrix_border(float); 84 set_type_matrix_border(double); 140 85 141 #ifdef __cplusplus 142 } 143 #endif 86 144 87 145 88 #endif // _NR_SET2_H_ 89 90 // Local Variables: 91 // tab-width: 4 92 // c-basic-offset: 4 93 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 94 // indent-tabs-mode: nil 95 // End: 96 97 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 98 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrset2x.h
r772 r826 4 4 */ 5 5 6 IMAGE_EXPORT(void) zero_si32Pmatrix(si32Point **m, long nrl,long nrh,long ncl,long nch); 7 IMAGE_EXPORT(void) zero_f32Pmatrix ( f32Point **m, long nrl,long nrh,long ncl,long nch); 8 IMAGE_EXPORT(void) zero_si32Tmatrix(si32Triplet **m, long nrl,long nrh,long ncl,long nch); 9 IMAGE_EXPORT(void) zero_f32Tmatrix ( f32Triplet **m, long nrl,long nrh,long ncl,long nch); 6 7 #undef zero_type_matrix 8 #define zero_type_matrix(t) \ 9 void short_name(t,zero_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch); 10 11 zero_type_matrix(si16Point); 12 zero_type_matrix(ui16Point); 13 zero_type_matrix(si32Point); 14 zero_type_matrix(ui32Point); 15 zero_type_matrix(f32Point); 16 zero_type_matrix(si16Triplet); 17 zero_type_matrix(ui16Triplet); 18 zero_type_matrix(si32Triplet); 19 zero_type_matrix(ui32Triplet); 20 zero_type_matrix(f32Triplet); 21 22 23 // Local Variables: 24 // tab-width: 4 25 // c-basic-offset: 4 26 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 27 // indent-tabs-mode: nil 28 // End: 29 30 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 31 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrset3.h
r772 r826 11 11 #define _NR_SET3_H_ 12 12 13 #ifdef __cplusplus14 #pragma message ("C++")15 extern "C" {16 #endif17 18 #ifdef VERBOSE_PRAGMA19 //#pragma message ("- *** include nrset3.h ***")20 #endif21 22 13 // ----------------- 23 14 // --- zero_cube --- 24 15 // ----------------- 25 16 26 IMAGE_EXPORT(void) zero_si8cube (sint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 27 IMAGE_EXPORT(void) zero_ui8cube (uint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 28 IMAGE_EXPORT(void) zero_si16cube (sint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 29 IMAGE_EXPORT(void) zero_ui16cube (uint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 30 IMAGE_EXPORT(void) zero_si32cube (sint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 31 IMAGE_EXPORT(void) zero_ui32cube (uint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 32 IMAGE_EXPORT(void) zero_si64cube (sint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 33 IMAGE_EXPORT(void) zero_ui64cube (uint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 34 IMAGE_EXPORT(void) zero_f32cube (float32 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 35 IMAGE_EXPORT(void) zero_f64cube (float64 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 36 IMAGE_EXPORT(void) zero_rgb8cube (rgb8 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 37 IMAGE_EXPORT(void) zero_rgbx8cube(rgbx8 ***c, int k0, int k1, int i0, int i1, int j0, int j1); 17 #define zero_type_cube(t) \ 18 void short_name(t,zero_,cube)(t *** c, int32_t k0, int32_t k1, int32_t i0, int32_t i1, int32_t j0, int32_t j1); 19 20 zero_type_cube(int8_t); 21 zero_type_cube(uint8_t); 22 zero_type_cube(int16_t); 23 zero_type_cube(uint16_t); 24 zero_type_cube(int32_t); 25 zero_type_cube(uint32_t); 26 zero_type_cube(int64_t); 27 zero_type_cube(uint64_t); 28 zero_type_cube(float); 29 zero_type_cube(double); 30 zero_type_cube(rgb8); 31 zero_type_cube(rgbx8); 32 38 33 39 34 // ---------------------- … … 41 36 // ---------------------- 42 37 43 IMAGE_EXPORT(void) set_si8cube_param (sint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint8 x, sint8 xstep, sint8 ystep, sint8 zstep); 44 IMAGE_EXPORT(void) set_ui8cube_param (uint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint8 x, uint8 xstep, uint8 ystep, uint8 zstep); 45 IMAGE_EXPORT(void) set_si16cube_param (sint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint16 x, sint16 xstep, sint16 ystep, sint16 zstep); 46 IMAGE_EXPORT(void) set_ui16cube_param (uint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint16 x, uint16 xstep, uint16 ystep, uint16 zstep); 47 IMAGE_EXPORT(void) set_si32cube_param (sint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint32 x, sint32 xstep, sint32 ystep, sint32 zstep); 48 IMAGE_EXPORT(void) set_ui32cube_param (uint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint32 x, uint32 xstep, uint32 ystep, uint32 zstep); 49 IMAGE_EXPORT(void) set_si64cube_param (sint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint64 x, sint64 xstep, sint64 ystep, sint64 zstep); 50 IMAGE_EXPORT(void) set_ui64cube_param (uint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint64 x, uint64 xstep, uint64 ystep, uint64 zstep); 51 IMAGE_EXPORT(void) set_f32cube_param (float32 ***c, int k0, int k1, int i0, int i1, int j0, int j1, float32 x, float32 xstep, float32 ystep, float32 zstep); 52 IMAGE_EXPORT(void) set_f64cube_param (float64 ***c, int k0, int k1, int i0, int i1, int j0, int j1, float64 x, float64 xstep, float64 ystep, float64 zstep); 53 IMAGE_EXPORT(void) set_rgb8cube_param (rgb8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, rgb8 x, rgb8 xstep, rgb8 ystep, rgb8 zstep); 54 IMAGE_EXPORT(void) set_rgbx8cube_param(rgbx8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep, rgbx8 zstep); 38 #define set_type_cube_param(t) \ 39 void short_name(t,set_,cube_param)(t *** c, int32_t k0, int32_t k1, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x, t xstep, t ystep, t zstep); 55 40 56 #ifdef __cplusplus 57 } 58 #endif 41 set_type_cube_param(int8_t); 42 set_type_cube_param(uint8_t); 43 set_type_cube_param(int16_t); 44 set_type_cube_param(uint16_t); 45 set_type_cube_param(int32_t); 46 set_type_cube_param(uint32_t); 47 set_type_cube_param(int64_t); 48 set_type_cube_param(uint64_t); 49 set_type_cube_param(float); 50 set_type_cube_param(double); 51 set_type_cube_param(rgb8); 52 set_type_cube_param(rgbx8); 53 54 59 55 60 56 #endif // _NR_SET3_H_ 57 58 // Local Variables: 59 // tab-width: 4 60 // c-basic-offset: 4 61 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 62 // indent-tabs-mode: nil 63 // End: 64 65 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 66 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrsort1.h
r772 r826 11 11 #define _NRSORT1_H_ 12 12 13 #ifdef __cplusplus 14 #ifdef PRAGMA_VERBOSE 15 #pragma message ("C++") 16 #endif 17 extern "C" { 18 #endif 13 #define extractnz_boundaries_type_vector(t) \ 14 void short_name(t,extractnz_boundaries_,vector)(t * v, int32_t nl, int32_t nh, int32_t * nlnz, int32_t * nhnz); 19 15 20 #ifdef PRAGMA_VERBOSE 21 //#pragma message("- include nrsort1.h") 22 #endif 16 extractnz_boundaries_type_vector(int8_t); 17 extractnz_boundaries_type_vector(uint8_t); 18 extractnz_boundaries_type_vector(int16_t); 19 extractnz_boundaries_type_vector(uint16_t); 20 extractnz_boundaries_type_vector(int32_t); 21 extractnz_boundaries_type_vector(uint32_t); 22 extractnz_boundaries_type_vector(int64_t); 23 extractnz_boundaries_type_vector(uint64_t); 24 extractnz_boundaries_type_vector(float); 25 extractnz_boundaries_type_vector(double); 23 26 24 IMAGE_EXPORT(void) extractnz_boundaries_ui8vector (uint8 *v, long nl, long nh, long *nlnz, long *nhnz);25 IMAGE_EXPORT(void) extractnz_boundaries_si16vector(sint16 *v, long nl, long nh, long *nlnz, long *nhnz);26 IMAGE_EXPORT(void) extractnz_boundaries_ui16vector(uint16 *v, long nl, long nh, long *nlnz, long *nhnz);27 IMAGE_EXPORT(void) extractnz_boundaries_si32vector(sint32 *v, long nl, long nh, long *nlnz, long *nhnz);28 IMAGE_EXPORT(void) extractnz_boundaries_ui32vector(uint32 *v, long nl, long nh, long *nlnz, long *nhnz);29 IMAGE_EXPORT(void) extractnz_boundaries_f32vector (float32 *v, long nl, long nh, long *nlnz, long *nhnz, float32 epsillon);30 IMAGE_EXPORT(void) extractnz_boundaries_f64vector (float64 *v, long nl, long nh, long *nlnz, long *nhnz, float64 epsillon);31 32 IMAGE_EXPORT(void) sort_index_dvector_selection (double *key, long nl, long nh, int *index);33 27 34 IMAGE_EXPORT(void) sort_index_ivector_selection_min (int *key, long nl, long nh, int *index);35 IMAGE_EXPORT(void) sort_index_ivector_selection_max (int *key, long nl, long nh, int *index);36 IMAGE_EXPORT(void) sort_index_ivector_selection_kmin(int *key, long nl, long nh, int *index, int k);37 IMAGE_EXPORT(void) sort_index_ivector_selection_kmax(int *key, long nl, long nh, int *index, int k);38 28 39 IMAGE_EXPORT(void) sort_index_vector_selection_min (float *key, long nl, long nh, int *index); 40 IMAGE_EXPORT(void) sort_index_vector_selection_max (float *key, long nl, long nh, int *index); 41 IMAGE_EXPORT(void) sort_index_vector_selection_kmin(float *key, long nl, long nh, int *index, int k); 42 IMAGE_EXPORT(void) sort_index_vector_selection_kmax(float *key, long nl, long nh, int *index, int k); 29 void sort_index_f64vector_selection(double * key, int32_t nl, int32_t nh, int32_t * index); 30 void sort_index_ivector_selection_min(int32_t * key, int32_t nl, int32_t nh, int32_t * index); 31 void sort_index_ivector_selection_max(int32_t * key, int32_t nl, int32_t nh, int32_t * index); 32 void sort_index_vector_selection_min(float * key, int32_t nl, int32_t nh, int32_t * index); 33 void sort_index_vector_selection_max(float * key, int32_t nl, int32_t nh, int32_t * index); 34 void sort_index_vector_selection_kmin(float * key, int32_t nl, int32_t nh, int32_t * index, int32_t k); 35 void sort_index_ivector_selection_kmin(int32_t * key, int32_t nl, int32_t nh, int32_t * index, int32_t k); 36 void sort_index_vector_selection_kmax(float * key, int32_t nl, int32_t nh, int32_t * index, int32_t k); 37 void sort_index_ivector_selection_kmax(int32_t * key, int32_t nl, int32_t nh, int32_t * index, int32_t k); 38 void sort_bvector_selection_min(int8_t * v, int32_t nl, int32_t nh); 43 39 44 40 /* … … 46 42 */ 47 43 48 IMAGE_EXPORT(void) sort_bvector_selection_min(byte *v, long nl, long nh);49 44 50 45 /* ======================================================================== */ 51 46 /* == Select = order/rank filter = median ================================= */ 52 47 /* ======================================================================== */ 48 int8_t select_bvector(int8_t * v, int32_t nl, int32_t nh, int32_t k); 49 rgb8 select_rgb8vector(rgb8 * v, int32_t nl, int32_t nh, int32_t k); 53 50 54 IMAGE_EXPORT(byte) select_bvector (byte *v, long nl, long nh, long k);55 IMAGE_EXPORT(rgb8) select_rgb8vector(rgb8 *v, long nl, long nh, long k);56 51 57 #ifdef __cplusplus58 }59 #endif60 52 61 53 #endif /* _NRSORT1_H_ */ 54 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrsort2.h
r772 r826 11 11 #define _NRSORT2_H_ 12 12 13 #ifdef __cplusplus 14 #ifdef PRAGMA_VERBOSE 15 #pragma message ("C++") 16 #endif 17 extern "C" { 18 #endif 13 #define extractnz_boundaries_type_matrix(t) \ 14 void short_name(t,extractnz_boundaries_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t * nclnz, int32_t * nchnz); 19 15 20 #ifdef PRAGMA_VERBOSE 21 //#pragma message("- include nrsort2.h") 22 #endif 16 extractnz_boundaries_type_matrix(int8_t); 17 extractnz_boundaries_type_matrix(uint8_t); 18 extractnz_boundaries_type_matrix(int16_t); 19 extractnz_boundaries_type_matrix(uint16_t); 20 extractnz_boundaries_type_matrix(int32_t); 21 extractnz_boundaries_type_matrix(uint32_t); 22 extractnz_boundaries_type_matrix(int64_t); 23 extractnz_boundaries_type_matrix(uint64_t); 24 extractnz_boundaries_type_matrix(float); 25 extractnz_boundaries_type_matrix(double); 23 26 24 IMAGE_EXPORT(void) sort_dmatrix_selection (double *m, long nl, long nh);25 27 26 IMAGE_EXPORT(void) sort_imatrix_selection2(int **m, long nl, long nh); 27 IMAGE_EXPORT(void) sort_imatrix_selection (int **m, long nrl, long nrh, long ncl, long nch, long nrow); 28 void sort_si32matrix_selection2(int32_t ** m, int32_t nl, int32_t nh); 29 void sort_f64matrix_selection(double * m, int32_t nl, int32_t nh); 30 void sort_si32matrix_selection(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nrow); 31 void sort_si32matrix_leftpart_selection2(int32_t ** m, int32_t nl, int32_t nh, int32_t len); 28 32 29 IMAGE_EXPORT(void) sort_imatrix_leftpart_selection2(int **m, long nl, long nh, long len);30 33 /* 31 34 * Sort the first len item of a 2-row matrix 32 35 */ 33 36 34 IMAGE_EXPORT(void) sort_index_imatrix_selection_kmin(int **key, long nrl,long nrh,long ncl, long nch, int **index, int k); 35 IMAGE_EXPORT(void) sort_index_imatrix_selection_kmax(int **key, long nrl,long nrh,long ncl, long nch, int **index, int k); 37 void sort_index_si32matrix_selection_kmin(int32_t ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t ** index, int32_t k); 38 void sort_index_si32matrix_selection_kmax(int32_t ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t ** index, int32_t k); 39 36 40 /* 37 41 * appel de "sort_index_ivector_selection_k" pour chaque ligne … … 39 43 */ 40 44 41 IMAGE_EXPORT(void) sortv_imatrix_selection_min(int **m, long nrl,long nrh,long ncl, long nch, long nc); 42 IMAGE_EXPORT(void) sortv_imatrix_selection_max(int **m, long nrl,long nrh,long ncl, long nch, long nc); 43 44 IMAGE_EXPORT(void) sortv_imatrix_selection_kmin(int **m, long nrl,long nrh,long ncl, long nch, long nc, int k); 45 IMAGE_EXPORT(void) sortv_imatrix_selection_kmax(int **m, long nrl,long nrh,long ncl, long nch, long nc, int k); 45 void sortv_si32matrix_selection_min(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc); 46 void sortv_si32matrix_selection_max(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc); 47 void sortv_si32matrix_selection_kmin(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc, int32_t k); 48 void sortv_si32matrix_selection_kmax(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc, int32_t k); 46 49 47 50 /* … … 49 52 * tri vertical, d'une partie des lignes 50 53 */ 51 IMAGE_EXPORT(void) sortv_index_imatrix_selection_max(int **key, long nrl,long nrh,long ncl, long nch, int *index, int nc); 52 IMAGE_EXPORT(void) sortv_index_imatrix_selection_min(int **key, long nrl,long nrh,long ncl, long nch, int *index, int nc); 54 55 void sortv_index_imatrix_selection_max(int ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t * index, int32_t nc); 56 void sortv_index_imatrix_selection_min(int32_t ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t * index, int32_t nc); 57 53 58 /* 54 59 * trie de la colonne nc de la matrice key, nc[ncl..nch] … … 56 61 */ 57 62 58 #ifdef __cplusplus 59 } 60 #endif 63 #endif /* _NRSORT2_H_ */ 61 64 62 #endif /* _NRSORT2_H_ */ 65 // Local Variables: 66 // tab-width: 4 67 // c-basic-offset: 4 68 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 69 // indent-tabs-mode: nil 70 // End: 71 72 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 73 -
soft/giet_vm/applications/rosenfeld/nrc2/include/nrwrap1.h
r772 r826 13 13 #define _NR_WRAP1_H_ 14 14 15 #ifdef __cplusplus16 #pragma message ("C++")17 extern "C" {18 #endif19 20 #ifdef VERBOSE_PRAGMA21 //#pragma message ("- *** include nrwrap1.h ***")22 #endif23 15 24 16 // ------------------------------- // … … 58 50 IMAGE_EXPORT(rgbx8*) rgbx8vector_map_1D_pitch(rgbx8 *v, int nl, int nh, void *data_1D, int pitch); 59 51 60 #ifdef __cplusplus 61 } 62 #endif 52 #endif // _NR_WRAP1_H_ 63 53 64 #endif // _NR_WRAP1_H_ 54 // Local Variables: 55 // tab-width: 4 56 // c-basic-offset: 4 57 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 58 // indent-tabs-mode: nil 59 // End: 60 61 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 62 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nralloc2.c
r821 r826 160 160 #undef remote_type_matrix 161 161 #define remote_type_matrix(t) \ 162 t ** short_name(t,remote_,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch ) \162 t ** short_name(t,remote_,matrix)(int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t x, int32_t y) \ 163 163 { \ 164 164 int32_t nrow = nrh - nrl + 1; \ … … 166 166 t ** m; \ 167 167 /* allocate pointers to row */ \ 168 m = malloc((nrow + NR_END) * sizeof(t *));\168 m = remote_malloc((nrow + NR_END) * sizeof(t *), x, y); \ 169 169 if (m == NULL) { \ 170 170 nrerror("*** Error: allocation failure in %s\n", __func__); \ … … 173 173 m -= nrl; \ 174 174 /* allocate rows and set pointers to them */ \ 175 m[nrl] = malloc((nrow * ncol + NR_END) * sizeof(t));\175 m[nrl] = remote_malloc((nrow * ncol + NR_END) * sizeof(t), x, y); \ 176 176 if (m[nrl] == NULL) { \ 177 177 nrerror("*** Error: allocation failure in %s\n", __func__); \ -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrio2.c
r822 r826 470 470 471 471 int32_t fd; 472 473 //fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT );472 473 //fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT, S_IRWXU); 474 474 fd = open(filename, O_TRUNC | O_CREAT); 475 475 if (fd < 0) { -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem1.c
r823 r826 211 211 212 212 213 // Local Variables: 214 // tab-width: 4 215 // c-basic-offset: 4 216 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 217 // indent-tabs-mode: nil 218 // End: 219 220 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 221 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem1x.c
r821 r826 4 4 5 5 /* 6 * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved7 * Univ Paris Sud XI, CNRS8 */6 * Copyright (c) 2000-2014, Lionel Lacassagne, All rights reserved 7 * Univ Paris Sud XI, CNRS 8 */ 9 9 10 10 #include <stdlib.h> … … 20 20 21 21 #include "nrmem1x.h" 22 /* --------------------------------------- */ 23 IMAGE_EXPORT(void) roll_si16vector(sint16 *v, long nl, long nh) 24 /* --------------------------------------- */ 22 23 void roll_si16vector(int16_t * v, int32_t nl, int32_t nh) 25 24 /* 26 * left rotate a uint16 vector with subscript range v[nl..nh]27 * nl & nh can be, respectively bigger and smaller than the28 * values used to allocate the vector (svector)29 * no check on nl and nh is done30 */25 * left rotate a uint16 vector with subscript range v[nl..nh] 26 * nl & nh can be, respectively bigger and smaller than the 27 * values used to allocate the vector (svector) 28 * no check on nl and nh is done 29 */ 31 30 { 32 long i; 33 sint16 tmp; 34 35 tmp = v[nl]; 36 for(i=nl; i<nh; i++) { 37 v[i] = v[i+1]; 38 } 39 v[nh] = tmp; 31 sint16 tmp; 32 tmp = v[nl]; 33 for (int32_t i = nl; i < nh; i++) { 34 v[i] = v[i + 1]; 35 } 36 v[nh] = tmp; 40 37 } 41 /* ----------------------------------------- */ 42 IMAGE_EXPORT(void) roll_ui16vector(uint16 *v, long nl, long nh) 43 /* ----------------------------------------- */ 38 39 40 void roll_ui16vector(uint16_t * v, int32_t nl, int32_t nh) 44 41 /* 45 * left rotate a uint16 vector with subscript range v[nl..nh]46 * nl & nh can be, respectively bigger and smaller than the47 * values used to allocate the vector (svector)48 * no check on nl and nh is done49 */42 * left rotate a uint16 vector with subscript range v[nl..nh] 43 * nl & nh can be, respectively bigger and smaller than the 44 * values used to allocate the vector (svector) 45 * no check on nl and nh is done 46 */ 50 47 { 51 long i; 52 uint16 tmp; 53 54 tmp = v[nl]; 55 for(i=nl; i<nh; i++) { 56 v[i] = v[i+1]; 57 } 58 v[nh] = tmp; 48 uint16 tmp; 49 tmp = v[nl]; 50 for (int32_t i = nl; i < nh; i++) { 51 v[i] = v[i + 1]; 52 } 53 v[nh] = tmp; 59 54 } 55 60 56 /* 61 57 * ------------------- … … 64 60 */ 65 61 66 /* --------------------------------------------------------------------------------------- */ 67 IMAGE_EXPORT(void) copy_bvector(uint8 *src, long nl1, long nh1, uint8 *dst, long nl2, long nh2) 68 /* --------------------------------------------------------------------------------------- */ 69 { 70 long len = nh1 - nl1 + 1; 71 memcpy(dst + nl2, src + nl1, len); 72 } 73 /* ----------------------------------------------------------------------------------------- */ 74 IMAGE_EXPORT(void) copy_svector(uint16 *src, long nl1, long nh1, uint16 *dst, long nl2, long nh2) 75 /* ----------------------------------------------------------------------------------------- */ 76 { 77 long len = nh1 - nl1 + 1; 78 static long size = sizeof(uint16); 79 memcpy(dst + nl2, src + nl1, len*size); 80 } 81 // ------------------------------------------------------------------------------------------------ 82 IMAGE_EXPORT(void) copy_si16vector(sint16 *src, long nl1, long nh1, int16 *dst, long nl2, long nh2) 83 // ------------------------------------------------------------------------------------------------ 84 { 85 long len = nh1 - nl1 + 1; 86 memcpy(dst + nl2, src + nl1, 2*len); 87 } 88 // ------------------------------------------------------------------------------------------------ 89 IMAGE_EXPORT(void) copy_ui16vector(uint16 *src, long nl1, long nh1, uint16 *dst, long nl2, long nh2) 90 // ------------------------------------------------------------------------------------------------ 91 { 92 long len = nh1 - nl1 + 1; 93 memcpy(dst + nl2, src + nl1, 2*len); 94 } 95 /* ------------------------------------------------------------------------------------- */ 96 IMAGE_EXPORT(void) copy_si32vector(sint32 *src, long nl1, long nh1, sint32 *dst, long nl2, long nh2) 97 /* ------------------------------------------------------------------------------------- */ 98 { 99 long len = nh1 - nl1 + 1; 100 static long size = sizeof(sint32); 101 memcpy(dst + nl2, src + nl1, len*size); 102 } 103 /* ---------------------------------------------------------------------------------------- */ 104 IMAGE_EXPORT(void) copy_ui32vector(uint32 *src, long nl1, long nh1, uint32 *dst, long nl2, long nh2) 105 /* ---------------------------------------------------------------------------------------- */ 106 { 107 long len = nh1 - nl1 + 1; 108 static long size = sizeof(uint32); 109 memcpy(dst + nl2, src + nl1, len*size); 110 } 111 /* ---------------------------------------------------------------------------------------- */ 112 IMAGE_EXPORT(void) copy_f32vector(float32 *src, long nl1, long nh1, float32 *dst, long nl2, long nh2) 113 /* ---------------------------------------------------------------------------------------- */ 114 { 115 long len = nh1 - nl1 + 1; 116 static long size = sizeof(float32); 117 memcpy(dst + nl2, src + nl1, len*size); 118 } 119 /* ------------------------------------------------------------------------------------------- */ 120 IMAGE_EXPORT(void) copy_f64vector(float64 *src, long nl1, long nh1, float64 *dst, long nl2, long nh2) 121 /* ------------------------------------------------------------------------------------------- */ 122 { 123 long len = nh1 - nl1 + 1; 124 static long size = sizeof(float64); 125 memcpy(dst + nl2, src + nl1, len*size); 126 } 127 /* ------------------------------------------------------------------------------------------ */ 128 IMAGE_EXPORT(void) copy_rgb8vector(rgb8 *src, long nl1, long nh1, rgb8 *dst, long nl2, long nh2) 129 /* ------------------------------------------------------------------------------------------ */ 130 { 131 long len = nh1 - nl1 + 1; 132 static long size = sizeof(rgb8); 133 memcpy(dst + nl2, src + nl1, len*size); 134 } 135 /* --------------------------------------------------------------------------------------------- */ 136 IMAGE_EXPORT(void) copy_rgbx8vector(rgbx8 *src, long nl1, long nh1, rgbx8 *dst, long nl2, long nh2) 137 /* --------------------------------------------------------------------------------------------- */ 138 { 139 long len = nh1 - nl1 + 1; 140 static long size = sizeof(rgbx8); 141 memcpy(dst + nl2, src + nl1, len*size); 142 } 143 /* ---------------------------------------------------------------------------- */ 144 IMAGE_EXPORT(void) copy1c_bvector(uint8 *src, long nc, uint8 *dst, long nl, long nh) 145 /* ---------------------------------------------------------------------------- */ 146 { 147 int j; 148 uint8 c = src[nc]; 149 for(j=nl; j<=nh; j++) dst[j] = c; 150 } 151 /* ----------------------------------------------------------------------------------- */ 152 IMAGE_EXPORT(void) copy1c_ui16vector(uint16 *src, long nc, uint16 *dst, long nl, long nh) 153 /* ----------------------------------------------------------------------------------- */ 154 { 155 int j; 156 uint16 c = src[nc]; 157 for(j=nl; j<=nh; j++) dst[j] = c; 158 } 159 /* ---------------------------------------------------------------------------------- */ 160 IMAGE_EXPORT(void) copy1c_si16vector(sint16 *src, long nc, sint16 *dst, long nl, long nh) 161 /* ---------------------------------------------------------------------------------- */ 162 { 163 int j; 164 sint16 c = src[nc]; 165 for(j=nl; j<=nh; j++) dst[j] = c; 166 } 167 /* -------------------------------------------------------------------------- */ 168 IMAGE_EXPORT(void) copy1c_ui32vector(uint32 *src, long nc, uint32 *dst, long nl, long nh) 169 /* -------------------------------------------------------------------------- */ 170 { 171 int j; 172 int c = src[nc]; 173 for(j=nl; j<=nh; j++) dst[j] = c; 174 } 175 /* ----------------------------------------------------------------------------- */ 176 IMAGE_EXPORT(void) copy1c_si32vector(sint32 *src, long nc, sint32 *dst, long nl, long nh) 177 /* ----------------------------------------------------------------------------- */ 178 { 179 int j; 180 int c = src[nc]; 181 for(j=nl; j<=nh; j++) dst[j] = c; 182 } 183 /* ----------------------------------------------------------------------------- */ 184 IMAGE_EXPORT(void) copy1c_f32vector(float32 *src, long nc, float32 *dst, long nl, long nh) 185 /* ----------------------------------------------------------------------------- */ 186 { 187 int j; 188 float c = src[nc]; 189 for(j=nl; j<=nh; j++) dst[j] = c; 190 } 191 /* -------------------------------------------------------------------------------- */ 192 IMAGE_EXPORT(void) copy1c_f64vector(float64 *src, long nc, float64 *dst, long nl, long nh) 193 /* -------------------------------------------------------------------------------- */ 194 { 195 int j; 196 float64 c = src[nc]; 197 for(j=nl; j<=nh; j++) dst[j] = c; 198 } 199 /* ------------------------------------------------------------------------------- */ 200 IMAGE_EXPORT(void) copy1c_rgb8vector(rgb8 *src, long nc, rgb8 *dst, long nl, long nh) 201 /* ------------------------------------------------------------------------------- */ 202 { 203 int j; 204 rgb8 c = src[nc]; 205 for(j=nl; j<=nh; j++) dst[j] = c; 206 } 207 /* ---------------------------------------------------------------------------------- */ 208 IMAGE_EXPORT(void) copy1c_rgbx8vector(rgbx8 *src, long nc, rgbx8 *dst, long nl, long nh) 209 /* ---------------------------------------------------------------------------------- */ 210 { 211 int j; 212 rgbx8 c = src[nc]; 213 for(j=nl; j<=nh; j++) dst[j] = c; 214 } 215 /* ----------------------------------------------------------------------------- */ 216 IMAGE_EXPORT(void) copy_bvector_mod(uint8 *src, long nl, long nh, long m, uint8 *dst) 217 /* ----------------------------------------------------------------------------- */ 218 { 219 long len; 220 long len1, len2; 221 222 if(nh>nl) { 223 len = nh - nl + 1; memcpy(dst, src + nl, len); 224 } else { 225 len1 = m - nl; memcpy(dst, src + nl, len1); 226 len2 = nh + 1; memcpy(dst+len1, src + nh, len2); 227 } 228 } 229 /* ------------------------------------------------------------------------------- */ 230 IMAGE_EXPORT(void) copy_si16vector_mod(sint16 *src, long nl, long nh, long m, sint16 *dst) 231 /* ------------------------------------------------------------------------------- */ 232 { 233 long len; 234 long len1, len2; 235 236 if(nh>nl) { 237 len = nh - nl + 1; memcpy(dst, src + nl, len*sizeof(uint16)); 238 } else { 239 len1 = m - nl; memcpy(dst, src + nl, len1*sizeof(uint16)); 240 len2 = nh + 1; memcpy(dst+len1, src + nh, len2*sizeof(uint16)); 241 } 242 } 243 /* --------------------------------------------------------------------------------- */ 244 IMAGE_EXPORT(void) copy_ui16vector_mod(uint16 *src, long nl, long nh, long m, uint16 *dst) 245 /* --------------------------------------------------------------------------------- */ 246 { 247 long len; 248 long len1, len2; 249 250 if(nh>nl) { 251 len = nh - nl + 1; memcpy(dst, src + nl, len*sizeof(uint16)); 252 } else { 253 len1 = m - nl; memcpy(dst, src + nl, len1*sizeof(uint16)); 254 len2 = nh + 1; memcpy(dst+len1, src + nh, len2*sizeof(uint16)); 255 } 256 } 257 /* --------------------------------------------------------------------------- */ 258 IMAGE_EXPORT(void) copy_ui32vector_mod(uint32 *src, long nl, long nh, long m, uint32 *dst) 259 /* --------------------------------------------------------------------------- */ 260 { 261 long len; 262 long len1, len2; 263 264 if(nh>nl) { 265 len = nh - nl + 1; memcpy(dst, src + nl, len*sizeof(uint32)); 266 } else { 267 len1 = m - nl; memcpy(dst, src + nl, len1*sizeof(uint32)); 268 len2 = nh + 1; memcpy(dst+len1, src + nh, len2*sizeof(uint32)); 269 } 270 } 271 /* --------------------------------------------------------------------------- */ 272 IMAGE_EXPORT(void) copy_si32vector_mod(sint32 *src, long nl, long nh, long m, sint32 *dst) 273 /* --------------------------------------------------------------------------- */ 274 { 275 long len; 276 long len1, len2; 277 278 if(nh>nl) { 279 len = nh - nl + 1; memcpy(dst, src + nl, len*sizeof(sint32)); 280 } else { 281 len1 = m - nl; memcpy(dst, src + nl, len1*sizeof(sint32)); 282 len2 = nh + 1; memcpy(dst+len1, src + nh, len2*sizeof(sint32)); 283 } 284 } 285 /* ------------------------------------------------------------------------------ */ 286 IMAGE_EXPORT(void) copy_f32vector_mod(float32 *src, long nl, long nh, long m, float32 *dst) 287 /* ------------------------------------------------------------------------------ */ 288 { 289 long len; 290 long len1, len2; 291 292 if(nh>nl) { 293 len = nh - nl + 1; memcpy(dst, src + nl, len*sizeof(float32)); 294 } else { 295 len1 = m - nl; memcpy(dst, src + nl, len1*sizeof(float32)); 296 len2 = nh + 1; memcpy(dst+len1, src + nh, len2*sizeof(float32)); 297 } 298 } 299 /* --------------------------------------------------------------------------------- */ 300 IMAGE_EXPORT(void) copy_f64vector_mod(float64 *src, long nl, long nh, long m, float64 *dst) 301 /* --------------------------------------------------------------------------------- */ 302 { 303 long len; 304 long len1, len2; 305 306 if(nh>nl) { 307 len = nh - nl + 1; memcpy(dst, src + nl, len*sizeof(float64)); 308 } else { 309 len1 = m - nl; memcpy(dst, src + nl, len1*sizeof(float64)); 310 len2 = nh + 1; memcpy(dst+len1, src + nh, len2*sizeof(float64)); 311 } 62 #undef copy_type_vector 63 #define copy_type_vector(t) \ 64 void short_name(t,copy_,vector)(t * src, int32_t nl1, int32_t nh1, t * dst, int32_t nl2, int32_t nh2) \ 65 { \ 66 int32_t len = nh1 - nl1 + 1; \ 67 memcpy(dst + nl2, src + nl1, len * sizeof(t)); \ 312 68 } 313 69 70 copy_type_vector(int8_t); 71 copy_type_vector(uint8_t); 72 copy_type_vector(int16_t); 73 copy_type_vector(uint16_t); 74 copy_type_vector(int32_t); 75 copy_type_vector(uint32_t); 76 copy_type_vector(float); 77 copy_type_vector(double); 78 copy_type_vector(rgb8); 79 copy_type_vector(rgbx8); 80 81 82 #undef copy1c_type_vector 83 #define copy1c_type_vector(t) \ 84 void short_name(t,copy1c_,vector)(t * src, int32_t nc, t * dst, int32_t nl, int32_t nh) \ 85 { \ 86 t c = src[nc]; \ 87 for (int32_t j = nl; j < nh; j++) { \ 88 dst[j] = c; \ 89 } \ 90 } 91 92 copy1c_type_vector(int8_t); 93 copy1c_type_vector(uint8_t); 94 copy1c_type_vector(int16_t); 95 copy1c_type_vector(uint16_t); 96 copy1c_type_vector(int32_t); 97 copy1c_type_vector(uint32_t); 98 copy1c_type_vector(float); 99 copy1c_type_vector(double); 100 copy1c_type_vector(rgb8); 101 copy1c_type_vector(rgbx8); 102 103 104 105 #undef copy_type_vector_mod 106 #define copy_type_vector_mod(t) \ 107 void short_name(t,copy_,vector_mod)(t * src, int32_t nl, int32_t nh, int32_t m, t * dst) \ 108 { \ 109 if (nh > nl) { \ 110 int32_t len = nh - nl + 1; \ 111 memcpy(dst, src + nl, len * sizeof(t)); \ 112 } \ 113 else { \ 114 int32_t len1 = m - nl; \ 115 int32_t len2 = nh + 1; \ 116 memcpy(dst, src + nl, len1 * sizeof(t)); \ 117 memcpy(dst + len1, src + nh, len2 * sizeof(t)); \ 118 } \ 119 } 120 121 122 copy_type_vector_mod(int8_t); 123 copy_type_vector_mod(uint8_t); 124 copy_type_vector_mod(int16_t); 125 copy_type_vector_mod(uint16_t); 126 copy_type_vector_mod(int32_t); 127 copy_type_vector_mod(uint32_t); 128 copy_type_vector_mod(float); 129 copy_type_vector_mod(double); 130 copy_type_vector_mod(rgb8); 131 copy_type_vector_mod(rgbx8); 132 133 134 135 // Local Variables: 136 // tab-width: 4 137 // c-basic-offset: 4 138 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 139 // indent-tabs-mode: nil 140 // End: 141 142 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 143 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem2.c
r772 r826 28 28 /* 29 29 * ------------------ 30 * --- du b_matrix ---30 * --- dup_matrix --- 31 31 * ------------------ 32 32 */ 33 /* -------------------------------------------------------------------------------------- */ 34 IMAGE_EXPORT(void) dup_si8matrix(sint8 **X, long nrl,long nrh,long ncl, long nch, sint8 **Y) 35 /* -------------------------------------------------------------------------------------- */ 36 { 37 int i; 38 for(i=nrl; i<=nrh; i++) { 39 dup_si8vector(X[i], ncl, nch, Y[i]); 40 } 33 34 35 #undef dup_type_matrix 36 #define dup_type_matrix(t) \ 37 void short_name(t,dup_,matrix)(t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** Y) \ 38 { \ 39 for (int32_t i = nrl; i <= nrh; i++) { \ 40 short_name(t,dup_,vector)(X[i], ncl, nch, Y[i]); \ 41 } \ 41 42 } 42 /* -------------------------------------------------------------------------------------- */ 43 IMAGE_EXPORT(void) dup_ui8matrix(uint8 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y) 44 /* -------------------------------------------------------------------------------------- */ 45 { 46 int i; 47 for(i=nrl; i<=nrh; i++) { 48 dup_ui8vector(X[i], ncl, nch, Y[i]); 49 } 50 } 51 /* ----------------------------------------------------------------------------------------- */ 52 IMAGE_EXPORT(void) dup_si16matrix(sint16 **X, long nrl,long nrh,long ncl, long nch, sint16 **Y) 53 /* ----------------------------------------------------------------------------------------- */ 54 { 55 int i; 56 for(i=nrl; i<=nrh; i++) { 57 dup_si16vector(X[i], ncl, nch, Y[i]); 58 } 59 } 60 /* ----------------------------------------------------------------------------------------- */ 61 IMAGE_EXPORT(void) dup_ui16matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint16 **Y) 62 /* ----------------------------------------------------------------------------------------- */ 63 { 64 int i; 65 for(i=nrl; i<=nrh; i++) { 66 dup_ui16vector(X[i], ncl, nch, Y[i]); 67 } 68 } 69 /* ----------------------------------------------------------------------------------------- */ 70 IMAGE_EXPORT(void) dup_si32matrix(sint32 **X, long nrl,long nrh,long ncl, long nch, sint32 **Y) 71 /* ----------------------------------------------------------------------------------------- */ 72 { 73 int i; 74 for(i=nrl; i<=nrh; i++) { 75 dup_si32vector(X[i], ncl, nch, Y[i]); 76 } 77 } 78 /* ----------------------------------------------------------------------------------------- */ 79 IMAGE_EXPORT(void) dup_ui32matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint32 **Y) 80 /* ----------------------------------------------------------------------------------------- */ 81 { 82 int i; 83 for(i=nrl; i<=nrh; i++) { 84 dup_ui32vector(X[i], ncl, nch, Y[i]); 85 } 86 } 87 /* ----------------------------------------------------------------------------------------- */ 88 IMAGE_EXPORT(void) dup_si64matrix(sint64 **X, long nrl,long nrh,long ncl, long nch, sint64 **Y) 89 /* ----------------------------------------------------------------------------------------- */ 90 { 91 int i; 92 for(i=nrl; i<=nrh; i++) { 93 dup_si64vector(X[i], ncl, nch, Y[i]); 94 } 95 } 96 /* ----------------------------------------------------------------------------------------- */ 97 IMAGE_EXPORT(void) dup_ui64matrix(uint64 **X, long nrl,long nrh,long ncl, long nch, uint64 **Y) 98 /* ----------------------------------------------------------------------------------------- */ 99 { 100 int i; 101 for(i=nrl; i<=nrh; i++) { 102 dup_ui64vector(X[i], ncl, nch, Y[i]); 103 } 104 } 105 /* ------------------------------------------------------------------------------------------ */ 106 IMAGE_EXPORT(void) dup_f32matrix(float32 **X, long nrl,long nrh,long ncl, long nch, float32 **Y) 107 /* ------------------------------------------------------------------------------------------ */ 108 { 109 int i; 110 for(i=nrl; i<=nrh; i++) { 111 dup_f32vector(X[i], ncl, nch, Y[i]); 112 } 113 } 114 /* ------------------------------------------------------------------------------------------ */ 115 IMAGE_EXPORT(void) dup_f64matrix(float64 **X, long nrl,long nrh,long ncl, long nch, float64 **Y) 116 /* ------------------------------------------------------------------------------------------ */ 117 { 118 int i; 119 for(i=nrl; i<=nrh; i++) { 120 dup_f64vector(X[i], ncl, nch, Y[i]); 121 } 122 } 123 /* ------------------------------------------------------------------------------------- */ 124 IMAGE_EXPORT(void) dup_rgb8matrix(rgb8 **X, long nrl,long nrh,long ncl, long nch, rgb8 **Y) 125 /* ------------------------------------------------------------------------------------- */ 126 { 127 int i; 128 for(i=nrl; i<=nrh; i++) { 129 dup_rgb8vector(X[i], ncl, nch, Y[i]); 130 } 131 } 132 /* ---------------------------------------------------------------------------------------- */ 133 IMAGE_EXPORT(void) dup_rgbx8matrix(rgbx8 **X, long nrl,long nrh,long ncl, long nch, rgbx8 **Y) 134 /* ---------------------------------------------------------------------------------------- */ 135 { 136 int i; 137 for(i=nrl; i<=nrh; i++) { 138 dup_rgbx8vector(X[i], ncl, nch, Y[i]); 139 } 140 } 43 44 dup_type_matrix(int8_t); 45 dup_type_matrix(uint8_t); 46 dup_type_matrix(int16_t); 47 dup_type_matrix(uint16_t); 48 dup_type_matrix(int32_t); 49 dup_type_matrix(uint32_t); 50 dup_type_matrix(int64_t); 51 dup_type_matrix(uint64_t); 52 dup_type_matrix(float); 53 dup_type_matrix(double); 54 dup_type_matrix(rgb8); 55 dup_type_matrix(rgbx8); 56 57 141 58 /* 142 59 * -------------- … … 144 61 * -------------- 145 62 */ 146 /* -------------------------------------------------------------------------------- */ 147 IMAGE_EXPORT(void) resize_si8matrix(sint8 **m, long nrl, long nrh, long ncl, long nch) 148 /* -------------------------------------------------------------------------------- */ 149 { 150 long i, ncol=nch-ncl+1; 151 152 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 153 } 154 /* -------------------------------------------------------------------------------- */ 155 IMAGE_EXPORT(void) resize_ui8matrix(uint8 **m, long nrl, long nrh, long ncl, long nch) 156 /* -------------------------------------------------------------------------------- */ 157 { 158 long i, ncol=nch-ncl+1; 159 160 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 161 } 162 /* ---------------------------------------------------------------------------------- */ 163 IMAGE_EXPORT(void) resize_si16matrix(sint16 **m, long nrl, long nrh, long ncl, long nch) 164 /* ---------------------------------------------------------------------------------- */ 165 { 166 long i, ncol=nch-ncl+1; 167 168 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 169 } 170 /* ---------------------------------------------------------------------------------- */ 171 IMAGE_EXPORT(void) resize_ui16matrix(uint16 **m, long nrl, long nrh, long ncl, long nch) 172 /* ---------------------------------------------------------------------------------- */ 173 { 174 long i, ncol=nch-ncl+1; 175 176 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 177 } 178 /* ---------------------------------------------------------------------------------- */ 179 IMAGE_EXPORT(void) resize_si32matrix(sint32 **m, long nrl, long nrh, long ncl, long nch) 180 /* ---------------------------------------------------------------------------------- */ 181 { 182 long i, ncol=nch-ncl+1; 183 184 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 185 } 186 /* ---------------------------------------------------------------------------------- */ 187 IMAGE_EXPORT(void) resize_ui32matrix(uint32 **m, long nrl, long nrh, long ncl, long nch) 188 /* ---------------------------------------------------------------------------------- */ 189 { 190 long i, ncol=nch-ncl+1; 191 192 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 193 } 194 /* ---------------------------------------------------------------------------------- */ 195 IMAGE_EXPORT(void) resize_f32matrix(float32 **m, long nrl, long nrh, long ncl, long nch) 196 /* ---------------------------------------------------------------------------------- */ 197 { 198 long i, ncol=nch-ncl+1; 199 200 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 201 } 202 /* ---------------------------------------------------------------------------------- */ 203 IMAGE_EXPORT(void) resize_f64matrix(float64 **m, long nrl, long nrh, long ncl, long nch) 204 /* ---------------------------------------------------------------------------------- */ 205 { 206 long i, ncol=nch-ncl+1; 207 208 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 209 } 210 /* -------------------------------------------------------------------------------- */ 211 IMAGE_EXPORT(void) resize_rgb8matrix(rgb8 **m, long nrl, long nrh, long ncl, long nch) 212 /* -------------------------------------------------------------------------------- */ 213 { 214 long i, ncol=nch-ncl+1; 215 216 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 217 } 218 /* ---------------------------------------------------------------------------------- */ 219 IMAGE_EXPORT(void) resize_rgbx8matrix(rgbx8 **m, long nrl, long nrh, long ncl, long nch) 220 /* ---------------------------------------------------------------------------------- */ 221 { 222 long i, ncol=nch-ncl+1; 223 224 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 225 } 226 /* ---------------- */ 227 /* -- Convertion -- */ 228 /* ---------------- */ 229 /* ---------------------------------------------------------------------------------------------------- */ 230 IMAGE_EXPORT(void) convert_si8matrix_si16matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) 231 /* ---------------------------------------------------------------------------------------------------- */ 232 { 233 long i; 234 for(i=nrl; i<=nrh; i++) { 235 convert_si8vector_si16vector(X[i], ncl, nch, Y[i]); 236 } 237 } 238 /* ---------------------------------------------------------------------------------------------------- */ 239 IMAGE_EXPORT(void) convert_si8matrix_si32matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) 240 /* ---------------------------------------------------------------------------------------------------- */ 241 { 242 long i; 243 for(i=nrl; i<=nrh; i++) { 244 convert_si8vector_si32vector(X[i], ncl, nch, Y[i]); 245 } 246 } 247 /* ---------------------------------------------------------------------------------------------------- */ 248 IMAGE_EXPORT(void) convert_si8matrix_f32matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 249 /* ---------------------------------------------------------------------------------------------------- */ 250 { 251 long i; 252 for(i=nrl; i<=nrh; i++) { 253 convert_si8vector_f32vector(X[i], ncl, nch, Y[i]); 254 } 255 } 256 /* ---------------------------------------------------------------------------------------------------- */ 257 IMAGE_EXPORT(void) convert_si8matrix_f64matrix(sint8 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) 258 /* ---------------------------------------------------------------------------------------------------- */ 259 { 260 long i; 261 for(i=nrl; i<=nrh; i++) { 262 convert_si8vector_f64vector(X[i], ncl, nch, Y[i]); 263 } 264 } 265 /* ---------------------------------------------------------------------------------------------------- */ 266 IMAGE_EXPORT(void) convert_ui8matrix_ui16matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) 267 /* ---------------------------------------------------------------------------------------------------- */ 268 { 269 long i; 270 for(i=nrl; i<=nrh; i++) { 271 convert_ui8vector_ui16vector(X[i], ncl, nch, Y[i]); 272 } 273 } 274 /* ---------------------------------------------------------------------------------------------------- */ 275 IMAGE_EXPORT(void) convert_ui8matrix_ui32matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) 276 /* ---------------------------------------------------------------------------------------------------- */ 277 { 278 long i; 279 for(i=nrl; i<=nrh; i++) { 280 convert_ui8vector_ui32vector(X[i], ncl, nch, Y[i]); 281 } 282 } 283 /* ---------------------------------------------------------------------------------------------------- */ 284 IMAGE_EXPORT(void) convert_ui8matrix_f32matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 285 /* ---------------------------------------------------------------------------------------------------- */ 286 { 287 long i; 288 for(i=nrl; i<=nrh; i++) { 289 convert_ui8vector_f32vector(X[i], ncl, nch, Y[i]); 290 } 291 } 292 /* ---------------------------------------------------------------------------------------------------- */ 293 IMAGE_EXPORT(void) convert_ui8matrix_f64matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) 294 /* ---------------------------------------------------------------------------------------------------- */ 295 { 296 long i; 297 for(i=nrl; i<=nrh; i++) { 298 convert_ui8vector_f64vector(X[i], ncl, nch, Y[i]); 299 } 300 } 301 /* -------------------------------------------------------------------------------------------------- */ 302 IMAGE_EXPORT(void) convert_ui8matrix_rgb8matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, rgb8 **Y) 303 /* -------------------------------------------------------------------------------------------------- */ 304 { 305 long i; 306 for(i=nrl; i<=nrh; i++) { 307 convert_ui8vector_rgb8vector(X[i], ncl, nch, Y[i]); 308 } 309 } 310 /* ---------------------------------------------------------------------------------------------------- */ 311 IMAGE_EXPORT(void) convert_ui8matrix_rgbx8matrix(uint8 **X, int nrl, int nrh, int ncl, int nch, rgbx8 **Y) 312 /* ---------------------------------------------------------------------------------------------------- */ 313 { 314 long i; 315 for(i=nrl; i<=nrh; i++) { 316 convert_ui8vector_rgbx8vector(X[i], ncl, nch, Y[i]); 317 } 63 64 #undef resize_type_matrix 65 #define resize_type_matrix(t) \ 66 void short_name(t,resize_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 67 { \ 68 int32_t ncol = nch - ncl + 1; \ 69 for (int32_t i = nrl + 1; i <= nrh; i++) { \ 70 m[i] = m[i - 1] + ncol; \ 71 } \ 318 72 } 319 73 320 /* ------------------------------------------------------------------------------------------------------ */ 321 IMAGE_EXPORT(void) convert_si16matrix_si32matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) 322 /* ------------------------------------------------------------------------------------------------------ */ 323 { 324 long i; 325 for(i=nrl; i<=nrh; i++) { 326 convert_si16vector_si32vector(X[i], ncl, nch, Y[i]); 327 } 74 resize_type_matrix(int8_t); 75 resize_type_matrix(uint8_t); 76 resize_type_matrix(int16_t); 77 resize_type_matrix(uint16_t); 78 resize_type_matrix(int32_t); 79 resize_type_matrix(uint32_t); 80 resize_type_matrix(int64_t); 81 resize_type_matrix(uint64_t); 82 resize_type_matrix(float); 83 resize_type_matrix(double); 84 resize_type_matrix(rgb8); 85 resize_type_matrix(rgbx8); 86 87 88 89 /* ---------------- */ 90 /* -- Conversion -- */ 91 /* ---------------- */ 92 93 #undef convert_type_matrix 94 #define convert_type_matrix(t1,t2) \ 95 void short_name(t1,convert_,short_name(t2,matrix_,matrix))(t1 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t2 ** Y) \ 96 { \ 97 for (int32_t i = nrl; i <= nrh; i++) { \ 98 short_name(t1,convert_,short_name(t2,vector_,vector))(X[i], ncl, nch, Y[i]); \ 99 } \ 328 100 } 329 /* ------------------------------------------------------------------------------------------------------ */ 330 IMAGE_EXPORT(void) convert_si16matrix_f32matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 331 /* ------------------------------------------------------------------------------------------------------ */ 332 { 333 long i; 334 for(i=nrl; i<=nrh; i++) { 335 convert_si16vector_f32vector(X[i], ncl, nch, Y[i]); 336 } 337 } 338 /* ------------------------------------------------------------------------------------------------------ */ 339 IMAGE_EXPORT(void) convert_si16matrix_f64matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) 340 /* ------------------------------------------------------------------------------------------------------ */ 341 { 342 long i; 343 for(i=nrl; i<=nrh; i++) { 344 convert_si16vector_f64vector(X[i], ncl, nch, Y[i]); 345 } 346 } 347 /* ------------------------------------------------------------------------------------------------------ */ 348 IMAGE_EXPORT(void) convert_ui16matrix_ui32matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) 349 /* ------------------------------------------------------------------------------------------------------ */ 350 { 351 long i; 352 for(i=nrl; i<=nrh; i++) { 353 convert_ui16vector_ui32vector(X[i], ncl, nch, Y[i]); 354 } 355 } 356 /* ------------------------------------------------------------------------------------------------------ */ 357 IMAGE_EXPORT(void) convert_ui16matrix_f32matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 358 /* ------------------------------------------------------------------------------------------------------ */ 359 { 360 long i; 361 for(i=nrl; i<=nrh; i++) { 362 convert_ui16vector_f32vector(X[i], ncl, nch, Y[i]); 363 } 364 } 365 /* ------------------------------------------------------------------------------------------------------ */ 366 IMAGE_EXPORT(void) convert_ui16matrix_f64matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) 367 /* ------------------------------------------------------------------------------------------------------ */ 368 { 369 long i; 370 for(i=nrl; i<=nrh; i++) { 371 convert_ui16vector_f64vector(X[i], ncl, nch, Y[i]); 372 } 373 } 374 /* ------------------------------------------------------------------------------------------------------ */ 375 IMAGE_EXPORT(void) convert_si32matrix_f32matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 376 /* ------------------------------------------------------------------------------------------------------ */ 377 { 378 long i; 379 for(i=nrl; i<=nrh; i++) { 380 convert_si32vector_f32vector(X[i], ncl, nch, Y[i]); 381 } 382 } 383 /* ------------------------------------------------------------------------------------------------------ */ 384 IMAGE_EXPORT(void) convert_si32matrix_f64matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) 385 /* ------------------------------------------------------------------------------------------------------ */ 386 { 387 long i; 388 for(i=nrl; i<=nrh; i++) { 389 convert_si32vector_f64vector(X[i], ncl, nch, Y[i]); 390 } 391 } 392 /* ------------------------------------------------------------------------------------------------------ */ 393 IMAGE_EXPORT(void) convert_ui32matrix_f32matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 394 /* ------------------------------------------------------------------------------------------------------ */ 395 { 396 long i; 397 for(i=nrl; i<=nrh; i++) { 398 convert_ui32vector_f32vector(X[i], ncl, nch, Y[i]); 399 } 400 } 401 /* ------------------------------------------------------------------------------------------------------ */ 402 IMAGE_EXPORT(void) convert_ui32matrix_f64matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, float64 **Y) 403 /* ------------------------------------------------------------------------------------------------------ */ 404 { 405 long i; 406 for(i=nrl; i<=nrh; i++) { 407 convert_ui32vector_f64vector(X[i], ncl, nch, Y[i]); 408 } 409 } 410 /* 411 * ------------------------- 412 * --- convert downgrade --- 413 * ------------------------- 414 */ 415 /* --------------------------------------------------------------------------------------------------- */ 416 IMAGE_EXPORT(void) convert_si16matrix_si8matrix(sint16 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) 417 /* --------------------------------------------------------------------------------------------------- */ 418 { 419 long i; 420 for(i=nrl; i<=nrh; i++) { 421 convert_si16vector_si8vector(X[i], ncl, nch, Y[i]); 422 } 423 } 424 /* --------------------------------------------------------------------------------------------------- */ 425 IMAGE_EXPORT(void) convert_ui16matrix_ui8matrix(uint16 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) 426 /* --------------------------------------------------------------------------------------------------- */ 427 { 428 long i; 429 for(i=nrl; i<=nrh; i++) { 430 convert_ui16vector_ui8vector(X[i], ncl, nch, Y[i]); 431 } 432 } 433 /* ---------------------------------------------------------------------------------------------------- */ 434 IMAGE_EXPORT(void) convert_si32matrix_si8matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) 435 /* ---------------------------------------------------------------------------------------------------- */ 436 { 437 long i; 438 for(i=nrl; i<=nrh; i++) { 439 convert_si32vector_si8vector(X[i], ncl, nch, Y[i]); 440 } 441 } 442 /* --------------------------------------------------------------------------------------------------- */ 443 IMAGE_EXPORT(void) convert_si32matrix_si16matrix(sint32 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) 444 /* --------------------------------------------------------------------------------------------------- */ 445 { 446 long i; 447 for(i=nrl; i<=nrh; i++) { 448 convert_si32vector_si16vector(X[i], ncl, nch, Y[i]); 449 } 450 } 451 /* ---------------------------------------------------------------------------------------------------- */ 452 IMAGE_EXPORT(void) convert_ui32matrix_ui8matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) 453 /* ---------------------------------------------------------------------------------------------------- */ 454 { 455 long i; 456 for(i=nrl; i<=nrh; i++) { 457 convert_ui32vector_ui8vector(X[i], ncl, nch, Y[i]); 458 } 459 } 460 /* --------------------------------------------------------------------------------------------------- */ 461 IMAGE_EXPORT(void) convert_ui32matrix_ui16matrix(uint32 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) 462 /* --------------------------------------------------------------------------------------------------- */ 463 { 464 long i; 465 for(i=nrl; i<=nrh; i++) { 466 convert_ui32vector_ui16vector(X[i], ncl, nch, Y[i]); 467 } 468 } 469 /* ---------------------------------------------------------------------------------------------------- */ 470 IMAGE_EXPORT(void) convert_f32matrix_si8matrix(float32 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) 471 /* ---------------------------------------------------------------------------------------------------- */ 472 { 473 long i; 474 for(i=nrl; i<=nrh; i++) { 475 convert_f32vector_si8vector(X[i], ncl, nch, Y[i]); 476 } 477 } 478 /* ---------------------------------------------------------------------------------------------------- */ 479 IMAGE_EXPORT(void) convert_f32matrix_ui8matrix(float32 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) 480 /* ---------------------------------------------------------------------------------------------------- */ 481 { 482 long i; 483 for(i=nrl; i<=nrh; i++) { 484 convert_f32vector_ui8vector(X[i], ncl, nch, Y[i]); 485 } 486 } 487 /* ------------------------------------------------------------------------------------------------------ */ 488 IMAGE_EXPORT(void) convert_f32matrix_si16matrix(float32 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) 489 /* ------------------------------------------------------------------------------------------------------ */ 490 { 491 long i; 492 for(i=nrl; i<=nrh; i++) { 493 convert_f32vector_si16vector(X[i], ncl, nch, Y[i]); 494 } 495 } 496 /* ------------------------------------------------------------------------------------------------------ */ 497 IMAGE_EXPORT(void) convert_f32matrix_ui16matrix(float32 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) 498 /* ------------------------------------------------------------------------------------------------------ */ 499 { 500 long i; 501 for(i=nrl; i<=nrh; i++) { 502 convert_f32vector_ui16vector(X[i], ncl, nch, Y[i]); 503 } 504 } 505 /* ------------------------------------------------------------------------------------------------------ */ 506 IMAGE_EXPORT(void) convert_f32matrix_si32matrix(float32 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) 507 /* ------------------------------------------------------------------------------------------------------ */ 508 { 509 long i; 510 for(i=nrl; i<=nrh; i++) { 511 convert_f32vector_si32vector(X[i], ncl, nch, Y[i]); 512 } 513 } 514 /* ------------------------------------------------------------------------------------------------------ */ 515 IMAGE_EXPORT(void) convert_f32matrix_ui32matrix(float32 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) 516 /* ------------------------------------------------------------------------------------------------------ */ 517 { 518 long i; 519 for(i=nrl; i<=nrh; i++) { 520 convert_f32vector_ui32vector(X[i], ncl, nch, Y[i]); 521 } 522 } 523 /* ---------------------------------------------------------------------------------------------------- */ 524 IMAGE_EXPORT(void) convert_f64matrix_si8matrix(float64 **X, int nrl, int nrh, int ncl, int nch, sint8 **Y) 525 /* ---------------------------------------------------------------------------------------------------- */ 526 { 527 long i; 528 for(i=nrl; i<=nrh; i++) { 529 convert_f64vector_si8vector(X[i], ncl, nch, Y[i]); 530 } 531 } 532 /* ---------------------------------------------------------------------------------------------------- */ 533 IMAGE_EXPORT(void) convert_f64matrix_ui8matrix(float64 **X, int nrl, int nrh, int ncl, int nch, uint8 **Y) 534 /* ---------------------------------------------------------------------------------------------------- */ 535 { 536 long i; 537 for(i=nrl; i<=nrh; i++) { 538 convert_f64vector_ui8vector(X[i], ncl, nch, Y[i]); 539 } 540 } 541 /* ------------------------------------------------------------------------------------------------------ */ 542 IMAGE_EXPORT(void) convert_f64matrix_si16matrix(float64 **X, int nrl, int nrh, int ncl, int nch, sint16 **Y) 543 /* ------------------------------------------------------------------------------------------------------ */ 544 { 545 long i; 546 for(i=nrl; i<=nrh; i++) { 547 convert_f64vector_si16vector(X[i], ncl, nch, Y[i]); 548 } 549 } 550 /* ------------------------------------------------------------------------------------------------------ */ 551 IMAGE_EXPORT(void) convert_f64matrix_ui16matrix(float64 **X, int nrl, int nrh, int ncl, int nch, uint16 **Y) 552 /* ------------------------------------------------------------------------------------------------------ */ 553 { 554 long i; 555 for(i=nrl; i<=nrh; i++) { 556 convert_f64vector_ui16vector(X[i], ncl, nch, Y[i]); 557 } 558 } 559 /* ------------------------------------------------------------------------------------------------------ */ 560 IMAGE_EXPORT(void) convert_f64matrix_si32matrix(float64 **X, int nrl, int nrh, int ncl, int nch, sint32 **Y) 561 /* ------------------------------------------------------------------------------------------------------ */ 562 { 563 long i; 564 for(i=nrl; i<=nrh; i++) { 565 convert_f64vector_si32vector(X[i], ncl, nch, Y[i]); 566 } 567 } 568 /* ------------------------------------------------------------------------------------------------------ */ 569 IMAGE_EXPORT(void) convert_f64matrix_ui32matrix(float64 **X, int nrl, int nrh, int ncl, int nch, uint32 **Y) 570 /* ------------------------------------------------------------------------------------------------------ */ 571 { 572 long i; 573 for(i=nrl; i<=nrh; i++) { 574 convert_f64vector_ui32vector(X[i], ncl, nch, Y[i]); 575 } 576 } 577 /* ------------------------------------------------------------------------------------------------------ */ 578 IMAGE_EXPORT(void) convert_f64matrix_f32matrix(float64 **X, int nrl, int nrh, int ncl, int nch, float32 **Y) 579 /* ------------------------------------------------------------------------------------------------------ */ 580 { 581 long i; 582 for(i=nrl; i<=nrh; i++) { 583 convert_f64vector_f32vector(X[i], ncl, nch, Y[i]); 584 } 585 } 586 /* ------------------------------------------------------------------------------------------------------ */ 587 IMAGE_EXPORT(void) convert_rgb8matrix_ui8matrix(rgb8 **X, long nrl, long nrh, long ncl, long nch, uint8 **Y) 588 /* ------------------------------------------------------------------------------------------------------ */ 589 { 590 long i; 591 for(i=nrl; i<=nrh; i++) { 592 convert_rgb8vector_ui8vector(X[i], ncl, nch, Y[i]); 593 } 594 } 101 102 convert_type_matrix(int8_t,int16_t); 103 convert_type_matrix(int8_t,int32_t); 104 convert_type_matrix(int8_t,float); 105 convert_type_matrix(int8_t,double); 106 convert_type_matrix(uint8_t,uint16_t); 107 convert_type_matrix(uint8_t,uint32_t); 108 convert_type_matrix(uint8_t,float); 109 convert_type_matrix(uint8_t,double); 110 convert_type_matrix(uint8_t,rgb8); 111 convert_type_matrix(uint8_t,rgbx8); 112 convert_type_matrix(int16_t,int32_t); 113 convert_type_matrix(int16_t,float); 114 convert_type_matrix(int16_t,double); 115 convert_type_matrix(uint16_t,uint32_t); 116 convert_type_matrix(uint16_t,float); 117 convert_type_matrix(uint16_t,double); 118 convert_type_matrix(int32_t,float); 119 convert_type_matrix(int32_t,double); 120 convert_type_matrix(uint32_t,float); 121 convert_type_matrix(uint32_t,double); 122 123 convert_type_matrix(int16_t,int8_t); 124 convert_type_matrix(uint16_t,uint8_t); 125 convert_type_matrix(int32_t,int8_t); 126 convert_type_matrix(uint32_t,uint8_t); 127 convert_type_matrix(int32_t,int16_t); 128 convert_type_matrix(uint32_t,uint16_t); 129 convert_type_matrix(float,int8_t); 130 convert_type_matrix(float,uint8_t); 131 convert_type_matrix(float,int16_t); 132 convert_type_matrix(float,uint16_t); 133 convert_type_matrix(float,int32_t); 134 convert_type_matrix(float,uint32_t); 135 convert_type_matrix(double,int8_t); 136 convert_type_matrix(double,uint8_t); 137 convert_type_matrix(double,int16_t); 138 convert_type_matrix(double,uint16_t); 139 convert_type_matrix(double,int32_t); 140 convert_type_matrix(double,uint32_t); 141 convert_type_matrix(double,float); 142 convert_type_matrix(rgb8,uint8_t); 143 144 595 145 /* 596 146 * ---------------------- … … 598 148 * ---------------------- 599 149 */ 600 /* ------------------------------------------------------------------------------------------------------ */ 601 IMAGE_EXPORT(void) lowpart_ui16matrix_ui8matrix(uint16 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y) 602 /* ------------------------------------------------------------------------------------------------------ */ 150 151 void lowpart_ui16matrix_ui8matrix(uint16_t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8_t ** Y) 603 152 { 604 long i; 605 606 for(i=nrl; i<=nrh; i++) { 607 lowpart_ui16vector_ui8vector(X[i], ncl,nch, Y[i]); 608 } 153 for (int32_t i = nrl; i <= nrh; i++) { 154 lowpart_ui16vector_ui8vector(X[i], ncl, nch, Y[i]); 155 } 609 156 } 610 /* ---------------------------------------------------------------------------------------- */ 611 void lowpart_ui32matrix_ui8matrix(uint32 **X, long nrl,long nrh,long ncl, long nch, uint8 **Y) 612 /* ---------------------------------------------------------------------------------------- */ 157 158 void lowpart_ui32matrix_ui8matrix(uint32_t ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8_t ** Y) 613 159 { 614 long i; 615 for(i=nrl; i<=nrh; i++) { 616 lowpart_ui32vector_ui8vector(X[i], ncl,nch, Y[i]); 617 } 160 for (int32_t i = nrl; i <= nrh; i++) { 161 lowpart_ui32vector_ui8vector(X[i], ncl,nch, Y[i]); 162 } 618 163 } 164 619 165 /* 620 166 * ------------------- … … 622 168 * ------------------- 623 169 */ 624 /* ---------------------------------------------------------------------------------------------------------------- */ 625 IMAGE_EXPORT(void) split_rgb8matrix(rgb8 **X, long nrl, long nrh, long ncl, long nch, uint8 **R, uint8 **G, uint8 **B) 626 /* ---------------------------------------------------------------------------------------------------------------- */ 170 171 void split_rgb8matrix(rgb8 ** X, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, uint8_t ** R, uint8_t ** G, uint8_t ** B) 627 172 { 628 long i, j; 629 630 for(i=nrl; i<=nrh; i++) { 631 for(j=ncl; j<=nch; j++) { 173 for (int32_t i = nrl; i <= nrh; i++) { 174 for (int32_t j = ncl; j <= nch; j++) { 632 175 split_rgb8vector(X[i], ncl, nch, R[i], G[i], B[i]); 633 634 176 } 177 } 635 178 } 636 /* ---------------------------------------------------------------------------------------------------------------- */ 637 IMAGE_EXPORT(void) merge_rgb8matrix(uint8 **R, uint8 **G, uint8 **B, long nrl, long nrh, long ncl, long nch, rgb8 **X) 638 /* ---------------------------------------------------------------------------------------------------------------- */ 179 180 void merge_rgb8matrix(uint8_t ** R, uint8_t ** G, uint8_t ** B, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, rgb8 ** X) 639 181 { 640 long i, j; 641 642 for(i=nrl; i<=nrh; i++) { 643 for(j=ncl; j<=nch; j++) { 182 for (int32_t i = nrl; i <= nrh; i++) { 183 for (int32_t j = ncl; j <= nch; j++) { 644 184 merge_rgb8vector(R[i], G[i], B[i], ncl, nch, X[i]); 645 646 185 } 186 } 647 187 } 188 189 190 // Local Variables: 191 // tab-width: 4 192 // c-basic-offset: 4 193 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 194 // indent-tabs-mode: nil 195 // End: 196 197 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 198 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem2x.c
r772 r826 10 10 11 11 /* 12 * 2002/06/11 ajout des fonctions endline13 */12 * 2002/06/11 ajout des fonctions endline 13 */ 14 14 #include <stdio.h> 15 15 #include <stddef.h> 16 16 #include <stdlib.h> 17 #include <math.h> // fabs18 17 19 18 #include "mypredef.h" … … 29 28 #include "nrmem2x.h" 30 29 30 31 31 /* ------------------------------------------ */ 32 32 /* --- ATTENTION ---------------------------- */ … … 34 34 /* l'utilisation des fonctions endline */ 35 35 /* necessite l'allocation d'une ligne de plus */ 36 /* (a cause du m[i +1]*/36 /* (a cause du m[i + 1] */ 37 37 /* ------------------------------------------ */ 38 /* ------------------------------------------------------------------------------------ */ 39 IMAGE_EXPORT(void) reset_endline_bmatrix(byte **m, long nrl, long nrh, long ncl, long nch) 40 /* ------------------------------------------------------------------------------------ */ 41 { 42 long i, ncol=nch-ncl+1; 43 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 44 return; 45 } 46 /* --------------------------------------------------------------------------------------- */ 47 IMAGE_EXPORT(void) reset_endline_i16matrix(int16 **m, long nrl, long nrh, long ncl, long nch) 48 /* --------------------------------------------------------------------------------------- */ 49 { 50 long i, ncol=nch-ncl+1; 51 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 52 return; 53 } 54 /* ----------------------------------------------------------------------------------------- */ 55 IMAGE_EXPORT(void) reset_endline_ui16matrix(uint16 **m, long nrl, long nrh, long ncl, long nch) 56 /* ----------------------------------------------------------------------------------------- */ 57 { 58 long i, ncol=nch-ncl+1; 59 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 60 return; 61 } 62 /* ----------------------------------------------------------------------------------- */ 63 IMAGE_EXPORT(void) reset_endline_imatrix(int **m, long nrl, long nrh, long ncl, long nch) 64 /* ----------------------------------------------------------------------------------- */ 65 { 66 long i, ncol=nch-ncl+1; 67 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 68 return; 69 } 70 /* --------------------------------------------------------------------------------------- */ 71 IMAGE_EXPORT(void) reset_endline_i32matrix(int32 **m, long nrl, long nrh, long ncl, long nch) 72 /* --------------------------------------------------------------------------------------- */ 73 { 74 long i, ncol=nch-ncl+1; 75 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 76 return; 77 } 78 /* ----------------------------------------------------------------------------------------- */ 79 IMAGE_EXPORT(void) reset_endline_ui32matrix(uint32 **m, long nrl, long nrh, long ncl, long nch) 80 /* ----------------------------------------------------------------------------------------- */ 81 { 82 long i, ncol=nch-ncl+1; 83 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 84 return; 85 } 86 /* --------------------------------------------------------------------------------------- */ 87 IMAGE_EXPORT(void) reset_endline_i64matrix(int64 **m, long nrl, long nrh, long ncl, long nch) 88 /* --------------------------------------------------------------------------------------- */ 89 { 90 long i, ncol=nch-ncl+1; 91 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 92 return; 93 } 94 95 /* ------------------------------------------------------ */ 96 IMAGE_EXPORT(void) endline_bmatrix(byte **m, long i, long l) 97 /* ------------------------------------------------------ */ 98 { 99 m[i+1] = m[i] + l; 100 } 101 /* --------------------------------------------------------- */ 102 IMAGE_EXPORT(void) endline_i16matrix(int16 **m, long i, long l) 103 /* --------------------------------------------------------- */ 104 { 105 m[i+1] = m[i] + l; 106 } 107 /* ----------------------------------------------------------- */ 108 IMAGE_EXPORT(void) endline_ui16matrix(uint16 **m, long i, long l) 109 /* ----------------------------------------------------------- */ 110 { 111 m[i+1] = m[i] + l; 112 } 113 /* ----------------------------------------------------- */ 114 IMAGE_EXPORT(void) endline_imatrix(int **m, long i, long l) 115 /* ----------------------------------------------------- */ 116 { 117 m[i+1] = m[i] + l; 118 } 119 /* --------------------------------------------------------- */ 120 IMAGE_EXPORT(void) endline_i32matrix(int32 **m, long i, long l) 121 /* --------------------------------------------------------- */ 122 { 123 m[i+1] = m[i] + l; 124 } 125 /* ----------------------------------------------------------- */ 126 IMAGE_EXPORT(void) endline_ui32matrix(uint32 **m, long i, long l) 127 /* ----------------------------------------------------------- */ 128 { 129 m[i+1] = m[i] + l; 130 } 131 /* --------------------------------------------------------- */ 132 IMAGE_EXPORT(void) endline_i64matrix(int64 **m, long i, long l) 133 /* --------------------------------------------------------- */ 134 { 135 m[i+1] = m[i] + l; 136 } 137 /* ----------------------------------------------------------------- */ 138 IMAGE_EXPORT(void) endline0_bmatrix(byte **m, long i, long l, long ncl) 139 /* ----------------------------------------------------------------- */ 140 { 141 m[i+1] = m[i] + l + 1; 142 143 m[i][ncl] = (byte) l; 144 } 145 /* -------------------------------------------------------------------- */ 146 IMAGE_EXPORT(void) endline0_i16matrix(int16 **m, long i, long l, long ncl) 147 /* -------------------------------------------------------------------- */ 148 { 149 m[i+1] = m[i] + l + 1; 150 151 m[i][ncl] = (int16) l; 152 } 153 /* ---------------------------------------------------------------------- */ 154 IMAGE_EXPORT(void) endline0_ui16matrix(uint16 **m, long i, long l, long ncl) 155 /* ---------------------------------------------------------------------- */ 156 { 157 m[i+1] = m[i] + l + 1; 158 159 m[i][ncl] = (uint16) l; 160 } 161 /* ---------------------------------------------------------------- */ 162 IMAGE_EXPORT(void) endline0_imatrix(int **m, long i, long l, long ncl) 163 /* ---------------------------------------------------------------- */ 164 { 165 m[i+1] = m[i] + l + 1; 166 167 m[i][ncl] = (int) l; 168 } 169 /* -------------------------------------------------------------------- */ 170 IMAGE_EXPORT(void) endline0_i32matrix(int32 **m, long i, long l, long ncl) 171 /* -------------------------------------------------------------------- */ 172 { 173 m[i+1] = m[i] + l + 1; 174 175 m[i][ncl] = (int32) l; 176 } 177 /* ---------------------------------------------------------------------- */ 178 IMAGE_EXPORT(void) endline0_ui32matrix(uint32 **m, long i, long l, long ncl) 179 /* ---------------------------------------------------------------------- */ 180 { 181 m[i+1] = m[i] + l + 1; 182 183 m[i][ncl] = (uint32) l; 184 } 185 /* -------------------------------------------------------------------- */ 186 IMAGE_EXPORT(void) endline0_i64matrix(int64 **m, long i, long l, long ncl) 187 /* -------------------------------------------------------------------- */ 188 { 189 m[i+1] = m[i] + l + 1; 190 191 m[i][ncl] = (int64) l; 192 } 193 /* ----------------------------------------------------------------- */ 194 IMAGE_EXPORT(void) endline1_bmatrix(byte **m, long i, long l, long ncl) 195 /* ----------------------------------------------------------------- */ 196 { 197 m[i+1] = m[i] + l + 1; 198 199 m[i][ncl-1] = (byte) l; 200 } 201 /* -------------------------------------------------------------------- */ 202 IMAGE_EXPORT(void) endline1_i16matrix(int16 **m, long i, long l, long ncl) 203 /* -------------------------------------------------------------------- */ 204 { 205 m[i+1] = m[i] + l + 1; 206 207 m[i][ncl-1] = (int16) l; 208 } 209 /* ---------------------------------------------------------------------- */ 210 IMAGE_EXPORT(void) endline1_ui16matrix(uint16 **m, long i, long l, long ncl) 211 /* ---------------------------------------------------------------------- */ 212 { 213 m[i+1] = m[i] + l + 1; 214 215 m[i][ncl-1] = (uint16) l; 216 } 217 /* ---------------------------------------------------------------- */ 218 IMAGE_EXPORT(void) endline1_imatrix(int **m, long i, long l, long ncl) 219 /* ---------------------------------------------------------------- */ 220 { 221 m[i+1] = m[i] + l + 1; 222 223 m[i][ncl-1] = (int) l; 224 } 225 /* -------------------------------------------------------------------- */ 226 IMAGE_EXPORT(void) endline1_i32matrix(int32 **m, long i, long l, long ncl) 227 /* -------------------------------------------------------------------- */ 228 { 229 m[i+1] = m[i] + l + 1; 230 231 m[i][ncl-1] = (int32) l; 232 } 233 /* ---------------------------------------------------------------------- */ 234 IMAGE_EXPORT(void) endline1_ui32matrix(uint32 **m, long i, long l, long ncl) 235 /* ---------------------------------------------------------------------- */ 236 { 237 m[i+1] = m[i] + l + 1; 238 239 m[i][ncl-1] = (uint32) l; 240 } 241 /* -------------------------------------------------------------------- */ 242 IMAGE_EXPORT(void) endline1_i64matrix(int64 **m, long i, long l, long ncl) 243 /* -------------------------------------------------------------------- */ 244 { 245 m[i+1] = m[i] + l + 1; 246 247 m[i][ncl-1] = (int64) l; 248 } 249 250 /* -------------------------------------------------------------------------------------- */ 251 IMAGE_EXPORT(void) resize_si16Pmatrix(si16Point **m, long nrl, long nrh, long ncl, long nch) 252 /* -------------------------------------------------------------------------------------- */ 253 { 254 long i, ncol=nch-ncl+1; 255 256 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 257 } 258 /* -------------------------------------------------------------------------------------- */ 259 IMAGE_EXPORT(void) resize_ui16Pmatrix(ui16Point **m, long nrl, long nrh, long ncl, long nch) 260 /* -------------------------------------------------------------------------------------- */ 261 { 262 long i, ncol=nch-ncl+1; 263 264 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 265 } 266 /* -------------------------------------------------------------------------------------- */ 267 IMAGE_EXPORT(void) resize_si32Pmatrix(si32Point **m, long nrl, long nrh, long ncl, long nch) 268 /* -------------------------------------------------------------------------------------- */ 269 { 270 long i, ncol=nch-ncl+1; 271 272 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 273 } 274 /* -------------------------------------------------------------------------------------- */ 275 IMAGE_EXPORT(void) resize_ui32Pmatrix(ui32Point **m, long nrl, long nrh, long ncl, long nch) 276 /* -------------------------------------------------------------------------------------- */ 277 { 278 long i, ncol=nch-ncl+1; 279 280 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 281 } 282 /* ------------------------------------------------------------------------------------ */ 283 IMAGE_EXPORT(void) resize_f32Pmatrix(f32Point **m, long nrl, long nrh, long ncl, long nch) 284 /* ------------------------------------------------------------------------------------ */ 285 { 286 long i, ncol=nch-ncl+1; 287 288 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 289 } 290 // Triplet Matrix 291 /* ---------------------------------------------------------------------------------------- */ 292 IMAGE_EXPORT(void) resize_si16Tmatrix(si16Triplet **m, long nrl, long nrh, long ncl, long nch) 293 /* ---------------------------------------------------------------------------------------- */ 294 { 295 long i, ncol=nch-ncl+1; 296 297 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 298 } 299 /* ---------------------------------------------------------------------------------------- */ 300 IMAGE_EXPORT(void) resize_ui16Tmatrix(ui16Triplet **m, long nrl, long nrh, long ncl, long nch) 301 /* ---------------------------------------------------------------------------------------- */ 302 { 303 long i, ncol=nch-ncl+1; 304 305 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 306 } 307 /* ---------------------------------------------------------------------------------------- */ 308 IMAGE_EXPORT(void) resize_si32Tmatrix(si32Triplet **m, long nrl, long nrh, long ncl, long nch) 309 /* ---------------------------------------------------------------------------------------- */ 310 { 311 long i, ncol=nch-ncl+1; 312 313 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 314 } 315 /* ---------------------------------------------------------------------------------------- */ 316 IMAGE_EXPORT(void) resize_ui32Tmatrix(ui32Triplet **m, long nrl, long nrh, long ncl, long nch) 317 /* ---------------------------------------------------------------------------------------- */ 318 { 319 long i, ncol=nch-ncl+1; 320 321 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 322 } 323 /* -------------------------------------------------------------------------------------- */ 324 IMAGE_EXPORT(void) resize_f32Tmatrix(f32Triplet **m, long nrl, long nrh, long ncl, long nch) 325 /* -------------------------------------------------------------------------------------- */ 326 { 327 long i, ncol=nch-ncl+1; 328 329 for(i=nrl+1;i<=nrh;i++) m[i]=m[i-1]+ncol; 330 } 38 39 #undef reset_endline_type_matrix 40 #define reset_endline_type_matrix(t) \ 41 void short_name(t,reset_endline_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 42 { \ 43 int32_t ncol = nch - ncl + 1; \ 44 for (int32_t i = nrl + 1; i <= nrh; i++) { \ 45 m[i] = m[i - 1] + ncol; \ 46 } \ 47 } 48 49 reset_endline_type_matrix(int8_t); 50 reset_endline_type_matrix(uint8_t); 51 reset_endline_type_matrix(int16_t); 52 reset_endline_type_matrix(uint16_t); 53 reset_endline_type_matrix(int32_t); 54 reset_endline_type_matrix(uint32_t); 55 reset_endline_type_matrix(int64_t); 56 reset_endline_type_matrix(uint64_t); 57 58 59 #undef endline_type_matrix 60 #define endline_type_matrix(t) \ 61 void short_name(t,endline_,matrix)(t ** m, int32_t i, int32_t l) \ 62 { \ 63 m[i + 1] = m[i] + l; \ 64 } \ 65 void short_name(t,endline0_,matrix)(t ** m, int32_t i, int32_t l, int32_t ncl) \ 66 { \ 67 m[i + 1] = m[i] + l + 1; \ 68 m[i][ncl] = (t) l; \ 69 } \ 70 void short_name(t,endline1_,matrix)(t ** m, int32_t i, int32_t l, int32_t ncl) \ 71 { \ 72 m[i + 1] = m[i] + l + 1; \ 73 m[i][ncl - 1] = (t) l; \ 74 } 75 76 endline_type_matrix(int8_t); 77 endline_type_matrix(uint8_t); 78 endline_type_matrix(int16_t); 79 endline_type_matrix(uint16_t); 80 endline_type_matrix(int32_t); 81 endline_type_matrix(uint32_t); 82 endline_type_matrix(int64_t); 83 endline_type_matrix(uint64_t); 84 85 86 #undef resize_type_matrix 87 #define resize_type_matrix(t) \ 88 void short_name(t,resize_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 89 { \ 90 int32_t ncol = nch - ncl + 1; \ 91 for (int32_t i = nrl + 1; i <= nrh; i++) { \ 92 m[i] = m[i - 1] + ncol; \ 93 } \ 94 } 95 96 resize_type_matrix(si16Point); 97 resize_type_matrix(ui16Point); 98 resize_type_matrix(si32Point); 99 resize_type_matrix(ui32Point); 100 resize_type_matrix(f32Point); 101 resize_type_matrix(si16Triplet); 102 resize_type_matrix(ui16Triplet); 103 resize_type_matrix(si32Triplet); 104 resize_type_matrix(ui32Triplet); 105 resize_type_matrix(f32Triplet); 106 107 331 108 /* 332 109 * -------------- … … 334 111 * -------------- 335 112 */ 336 /* ---------------------------------------------------------------- */ 337 IMAGE_EXPORT(void) bmatrix_reverse(byte **m, long nrl, long nrh, long ncl, long nch) 338 /* ---------------------------------------------------------------- */ 339 { 340 long i, mrow=(nrl+nrh+1)/2; 341 byte *t; 342 343 for(i=nrl; i<mrow; i++) { 344 t = m[i]; 345 m[i] = m[nrh-i]; 346 m[nrh-i] = t; 347 } 348 } 349 /* ----------------------------------------------------------------- */ 350 IMAGE_EXPORT(void) smatrix_reverse(sint16 **m, long nrl, long nrh, long ncl, long nch) 351 /* ----------------------------------------------------------------- */ 352 { 353 long i, mrow=(nrl+nrh+1)/2; 354 sint16 *t; 355 356 for(i=nrl; i<mrow; i++) { 357 t = m[i]; 358 m[i] = m[nrh-i]; 359 m[nrh-i] = t; 360 } 361 } 362 /* ------------------------------------------------------------------- */ 363 IMAGE_EXPORT(void) usmatrix_reverse(uint16 **m, long nrl, long nrh, long ncl, long nch) 364 /* ------------------------------------------------------------------- */ 365 { 366 long i, mrow=(nrl+nrh+1)/2; 367 uint16 *t; 368 369 for(i=nrl; i<mrow; i++) { 370 t = m[i]; 371 m[i] = m[nrh-i]; 372 m[nrh-i] = t; 373 } 374 } 375 /* --------------------------------------------------------------------------------------------------------- */ 376 IMAGE_EXPORT(void) desinterlace_bmatrix(byte **S, long nrl, long nrh, long ncl, long nch, byte **D0, byte **D1) 377 /* --------------------------------------------------------------------------------------------------------- */ 378 { 379 int i, i0, i1; 380 int j; 381 382 i0 = i1 = nrl; 383 384 if((nrl&1)==0) { 385 386 // nrl is even 387 for(i=nrl; i<=nrh; i+=2) { 388 //dup_bvector(S[i+0], ncl, nch, D0[i0++]); 389 //dup_bvector(S[i+1], ncl, nch, D1[i1++]); 390 for(j=ncl; j<=nch; j++) D0[i0][j] = S[i][j]; i0++; 391 for(j=ncl; j<=nch; j++) D1[i1][j] = S[i][j]; i1++; 392 } 393 // epilog 394 if((nrh&1)==0) { 395 //dup_bvector(S[nrh], ncl, nch, D0[i0]); 396 for(j=ncl; j<=nch; j++) D0[i0][j] = S[i][j]; i0++; 397 } 398 399 } else { 400 401 // nrl is odd 402 for(i=nrl; i<=nrh; i+=2) { 403 //dup_bvector(S[i+0], ncl, nch, D1[i1++]); 404 //dup_bvector(S[i+1], ncl, nch, D0[i0++]); 405 for(j=ncl; j<=nch; j++) D1[i1][j] = S[i][j]; i1++; 406 for(j=ncl; j<=nch; j++) D0[i0][j] = S[i][j]; i0++; 407 } 408 // epilog 409 if((nrh&1)==1) { 410 //dup_bvector(S[nrh], ncl, nch, D1[i1]); 411 for(j=ncl; j<=nch; j++) D1[i1][j] = S[i][j]; i1++; 412 } 413 } 414 } 415 /* ------------------------------------------------------------------------------------------------------------ */ 416 IMAGE_EXPORT(void) desinterlace_rgb8matrix(rgb8 **S, long nrl, long nrh, long ncl, long nch, rgb8 **D0, rgb8 **D1) 417 /* ------------------------------------------------------------------------------------------------------------ */ 418 { 419 int i, i0, i1; 420 int j; 421 422 i0 = i1 = nrl; 423 424 if((nrl&1)==0) { 425 426 // nrl is even 427 for(i=nrl; i<=nrh; i+=2) { 428 //dup_rgb8vector(S[i+0], ncl, nch, D0[i0++]); 429 //dup_rgb8vector(S[i+1], ncl, nch, D1[i1++]); 430 for(j=ncl; j<=nch; j++) D0[i0][j] = S[i][j]; i0++; 431 for(j=ncl; j<=nch; j++) D1[i1][j] = S[i][j]; i1++; 432 } 433 // epilog 434 if((nrh&1)==0) { 435 //dup_rgb8vector(S[nrh], ncl, nch, D0[i0]); 436 for(j=ncl; j<=nch; j++) D0[i0][j] = S[i][j]; i0++; 437 } 438 439 } else { 440 441 // nrl is odd 442 for(i=nrl; i<=nrh; i+=2) { 443 //dup_rgb8vector(S[i+0], ncl, nch, D1[i1++]); 444 //dup_rgb8vector(S[i+1], ncl, nch, D0[i0++]); 445 for(j=ncl; j<=nch; j++) D1[i1][j] = S[i][j]; i1++; 446 for(j=ncl; j<=nch; j++) D0[i0][j] = S[i][j]; i0++; 447 } 448 // epilog 449 if((nrh&1)==1) { 450 //dup_rgb8vector(S[nrh], ncl, nch, D1[i1]); 451 for(j=ncl; j<=nch; j++) D1[i1][j] = S[i][j]; i1++; 452 } 453 } 454 } 455 /* ------------------------------------------------------------------------------------------------------- */ 456 IMAGE_EXPORT(void) interlace_bmatrix(byte **S0, long nrl, long nrh, long ncl, long nch, byte **S1, byte **D) 457 /* ------------------------------------------------------------------------------------------------------- */ 458 { 459 // S1 & S2 are supposed to have the same height 460 int i, i0, i1; 461 int j; 462 463 i0 = i1 = nrl; 464 465 for(i=nrl; i<=nrh;) { 466 //dup_bvector(S0[i0++], ncl, nch, D[i++]); 467 //dup_bvector(S1[i1++], ncl, nch, D[i++]); 468 for(j=ncl; j<=nch; j++) D[i][j] = S0[i0][j]; i++; i0++; 469 for(j=ncl; j<=nch; j++) D[i][j] = S0[i1][j]; i++; i1++; 470 } 471 } 472 /* ---------------------------------------------------------------------------------------------------------- */ 473 IMAGE_EXPORT(void) interlace_rgb8matrix(rgb8 **S0, long nrl, long nrh, long ncl, long nch, rgb8 **S1, rgb8 **D) 474 /* ---------------------------------------------------------------------------------------------------------- */ 475 { 476 int i, i0, i1; 477 int j; 478 479 i0 = i1 = nrl; 480 481 for(i=nrl; i<=nrh;) { 482 //dup_rgb8vector(S0[i0++], ncl, nch, D[i++]); 483 //dup_rgb8vector(S1[i1++], ncl, nch, D[i++]); 484 for(j=ncl; j<=nch; j++) D[i][j] = S0[i0][j]; i++; i0++; 485 for(j=ncl; j<=nch; j++) D[i][j] = S0[i1][j]; i++; i1++; 486 } 487 } 488 489 /* ---------------------------------------------------------------------------------------------- */ 490 IMAGE_EXPORT(void) copyc_bmatrix(byte **src,long nrl,long nrh,long ncl, long nch, byte **cond, byte c, byte **dst) 491 /* ---------------------------------------------------------------------------------------------- */ 492 { 493 long i, j; 494 byte *Xi, *Yi, *Ci; 495 496 for(i=nrl; i<=nrh; i++) { 497 Xi = src [i]; 498 Yi = dst [i]; 499 Ci = cond[i]; 500 for(j=ncl; j<=nch; j++) { 501 if(Ci[j] == c) Yi[j] = Xi[j]; else Yi[j] = 0; 502 } 503 } 504 } 505 /* ------------------------------------------------------------------------------ */ 506 IMAGE_EXPORT(void) complete_border_ui8matrix(uint8 **m, long nrl,long nrh,long ncl, long nch, long n) 507 /* ------------------------------------------------------------------------------ */ 508 { 509 long i, j; 510 511 uint8 *Xi; 512 513 for(i=nrl; i<=nrh; i++) { 514 Xi = m[i]; 515 for(j=1; j<=n; j++) { 516 Xi[ncl-j] = Xi[ncl]; 517 Xi[nch+j] = Xi[nch]; 518 } 519 } 520 for(i=1; i<=n; i++) 521 dup_ui8vector(m[nrl], ncl-n, nch+n, m[nrl-i]); 522 for(i=1; i<=n; i++) 523 dup_ui8vector(m[nrh], ncl-n, nch+n, m[nrh+i]); 524 } 525 /* ------------------------------------------------------------------------------------- */ 526 IMAGE_EXPORT(void) complete_border1_ui8matrix(uint8 **m, long nrl,long nrh,long ncl, long nch) 527 /* ------------------------------------------------------------------------------------- */ 528 { 529 long i; 530 uint8 *Xi; 531 532 dup_ui8vector(m[nrl+1], ncl, nch, m[nrl]); 533 534 for(i=nrl; i<=nrh; i++) { 535 Xi = m[i]; 536 Xi[nrl] = Xi[nrl+1]; 537 Xi[nrh] = Xi[nrh-1]; 538 } 539 540 dup_ui8vector(m[nrh-1], ncl, nch, m[nrh]); 541 } 542 /* ------------------------------------------------------------------------------------- */ 543 IMAGE_EXPORT(void) complete_border2_ui8matrix(uint8 **m, long nrl,long nrh,long ncl, long nch) 544 /* ------------------------------------------------------------------------------------- */ 545 { 546 long i; 547 uint8 *Xi; 548 549 dup_ui8vector(m[nrl+2], ncl, nch, m[nrl+0]); 550 dup_ui8vector(m[nrl+2], ncl, nch, m[nrl+1]); 551 552 553 for(i=nrl; i<=nrh; i++) { 554 Xi = m[i]; 555 Xi[nrl] = Xi[nrl+1] = Xi[nrl+2]; 556 Xi[nrh] = Xi[nrh-1] = Xi[nrh-2]; 557 } 558 559 dup_ui8vector(m[nrh-2], ncl, nch, m[nrh-1]); 560 dup_ui8vector(m[nrh-2], ncl, nch, m[nrh-0]); 561 } 562 /* ------------------------------------------------------------------------------------------------ */ 563 IMAGE_EXPORT(void) copy1c_ui8matrix(uint8 **X, long nc, uint8 **Y, long nrl, long nrh, long ncl, long nch) 564 /* ------------------------------------------------------------------------------------------------ */ 565 { 566 int i; 567 568 for(i=nrl; i<=nrh; i++) { 569 //copy1c_ui8vector(X[i], nc, Y[i], ncl, nch); 570 } 571 } 572 /* -------------------------------------------------------------------------------------------------- */ 573 IMAGE_EXPORT(void) copy1c_ui16matrix(uint16 **X, long nc, uint16 **Y, long nrl, long nrh, long ncl, long nch) 574 /* -------------------------------------------------------------------------------------------------- */ 575 { 576 int i; 577 578 for(i=nrl; i<=nrh; i++) { 579 //copy1c_ui16vector(X[i], nc, Y[i], ncl, nch); 580 } 581 } 582 /* ---------------------------------------------------------------------------------------------- */ 583 IMAGE_EXPORT(void) copy1c_ui32matrix(uint32 **X, long nc, uint32 **Y, long nrl, long nrh, long ncl, long nch) 584 /* ---------------------------------------------------------------------------------------------- */ 585 { 586 int i; 587 588 for(i=nrl; i<=nrh; i++) { 589 //copy1c_ui32vector(X[i], nc, Y[i], ncl, nch); 590 } 591 } 592 /* ------------------------------------------------------------------------------------------------- */ 593 IMAGE_EXPORT(void) copy1c_f32matrix(float32 **X, long nc, float32 **Y, long nrl, long nrh, long ncl, long nch) 594 /* ------------------------------------------------------------------------------------------------- */ 595 { 596 int i; 597 598 for(i=nrl; i<=nrh; i++) { 599 //copy1c_f32vector(X[i], nc, Y[i], ncl, nch); 600 } 601 } 602 /* ---------------------------------------------------------------------------------------------------- */ 603 IMAGE_EXPORT(void) copy1c_f64matrix(float64 **X, long nc, float64 **Y, long nrl, long nrh, long ncl, long nch) 604 /* ---------------------------------------------------------------------------------------------------- */ 605 { 606 int i; 607 608 for(i=nrl; i<=nrh; i++) { 609 //copy1c_f64vector(X[i], nc, Y[i], ncl, nch); 610 } 611 } 612 /* --------------------------------------------------------------------------------------------------- */ 613 IMAGE_EXPORT(void) copy1c_rgb8matrix(rgb8 **X, long nc, rgb8 **Y, long nrl, long nrh, long ncl, long nch) 614 /* --------------------------------------------------------------------------------------------------- */ 615 { 616 int i; 617 618 for(i=nrl; i<=nrh; i++) { 619 //copy1c_rgb8vector(X[i], nc, Y[i], ncl, nch); 620 } 621 } 622 /* ------------------------------------------------------------------------------------------------------ */ 623 IMAGE_EXPORT(void) copy1c_rgbx8matrix(rgbx8 **X, long nc, rgbx8 **Y, long nrl, long nrh, long ncl, long nch) 624 /* ------------------------------------------------------------------------------------------------------ */ 625 { 626 int i; 627 628 for(i=nrl; i<=nrh; i++) { 629 //copy1c_rgbx8vector(X[i], nc, Y[i], ncl, nch); 630 } 631 } 632 /* ------------------------------------------------------------------------------------------------ */ 633 IMAGE_EXPORT(void) copy1r_ui8matrix(uint8 **X, long nr, uint8 **Y, long nrl, long nrh, long ncl, long nch) 634 /* ------------------------------------------------------------------------------------------------ */ 635 { 636 int i; 637 638 for(i=nrl; i<=nrh; i++) { 639 dup_ui8vector(X[nr], ncl, nch, Y[i]); 640 } 641 } 642 /* -------------------------------------------------------------------------------------------------- */ 643 IMAGE_EXPORT(void) copy1r_ui16matrix(uint16 **X, long nr, uint16 **Y, long nrl, long nrh, long ncl, long nch) 644 /* -------------------------------------------------------------------------------------------------- */ 645 { 646 int i; 647 648 for(i=nrl; i<=nrh; i++) { 649 dup_ui16vector(X[nr], ncl, nch, Y[i]); 650 } 651 } 652 /* ---------------------------------------------------------------------------------------------- */ 653 IMAGE_EXPORT(void) copy1r_ui32matrix(uint32 **X, long nr, uint32 **Y, long nrl, long nrh, long ncl, long nch) 654 /* ---------------------------------------------------------------------------------------------- */ 655 { 656 int i; 657 658 for(i=nrl; i<=nrh; i++) { 659 dup_ui32vector(X[nr], ncl, nch, Y[i]); 660 } 661 } 662 /* ------------------------------------------------------------------------------------------------- */ 663 IMAGE_EXPORT(void) copy1r_f32matrix(float32 **X, long nr, float32 **Y, long nrl, long nrh, long ncl, long nch) 664 /* ------------------------------------------------------------------------------------------------- */ 665 { 666 int i; 667 668 for(i=nrl; i<=nrh; i++) { 669 dup_f32vector(X[nr], ncl, nch, Y[i]); 670 } 671 } 672 /* ---------------------------------------------------------------------------------------------------- */ 673 IMAGE_EXPORT(void) copy1r_f64matrix(float64 **X, long nr, float64 **Y, long nrl, long nrh, long ncl, long nch) 674 /* ---------------------------------------------------------------------------------------------------- */ 675 { 676 int i; 677 678 for(i=nrl; i<=nrh; i++) { 679 dup_f64vector(X[nr], ncl, nch, Y[i]); 680 } 681 } 682 /* --------------------------------------------------------------------------------------------------- */ 683 IMAGE_EXPORT(void) copy1r_rgb8matrix(rgb8 **X, long nr, rgb8 **Y, long nrl, long nrh, long ncl, long nch) 684 /* --------------------------------------------------------------------------------------------------- */ 685 { 686 int i; 687 688 for(i=nrl; i<=nrh; i++) { 689 dup_rgb8vector(X[nr], ncl, nch, Y[i]); 690 } 691 } 692 /* ------------------------------------------------------------------------------------------------------ */ 693 IMAGE_EXPORT(void) copy1r_rgbx8matrix(rgbx8 **X, long nr, rgbx8 **Y, long nrl, long nrh, long ncl, long nch) 694 /* ------------------------------------------------------------------------------------------------------ */ 695 { 696 int i; 697 698 for(i=nrl; i<=nrh; i++) { 699 dup_rgbx8vector(X[nr], ncl, nch, Y[i]); 700 } 701 } 113 114 #undef type_matrix_reverse 115 #define type_matrix_reverse(t) \ 116 void short_name(t,,matrix_reverse)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 117 { \ 118 int32_t mrow = (nrl + nrh + 1) / 2; \ 119 t * temp; \ 120 for (int32_t i = nrl; i < mrow; i++) { \ 121 temp = m[i]; \ 122 m[i] = m[nrh - i]; \ 123 m[nrh - i] = temp; \ 124 } \ 125 } 126 127 type_matrix_reverse(int8_t); 128 type_matrix_reverse(uint8_t); 129 type_matrix_reverse(int16_t); 130 type_matrix_reverse(uint16_t); 131 type_matrix_reverse(int32_t); 132 type_matrix_reverse(uint32_t); 133 type_matrix_reverse(int64_t); 134 type_matrix_reverse(uint64_t); 135 type_matrix_reverse(float); 136 type_matrix_reverse(double); 137 138 139 #undef desinterlace_type_matrix 140 #define desinterlace_type_matrix(t) \ 141 void short_name(t,desinterlace_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D0, t ** D1) \ 142 { \ 143 int32_t i0, i1; \ 144 i0 = i1 = nrl; \ 145 if ((nrl & 1) == 0) { \ 146 /* nrl is even */ \ 147 for (int32_t i = nrl; i <= nrh; i += 2) { \ 148 for (int32_t j = ncl; j <= nch; j++) { \ 149 D0[i0][j] = S[i][j]; \ 150 } \ 151 i0++; \ 152 for (int32_t j = ncl; j <= nch; j++) { \ 153 D1[i1][j] = S[i][j]; \ 154 } \ 155 i1++; \ 156 } \ 157 /* epilog */ \ 158 if ((nrh & 1) == 0) { \ 159 for (int32_t j = ncl; j <= nch; j++) { \ 160 D0[i0][j] = S[nrh][j]; \ 161 } \ 162 i0++; \ 163 } \ 164 } \ 165 else { \ 166 /* nrl is odd */ \ 167 for (int32_t i = nrl; i <= nrh; i += 2) { \ 168 for (int32_t j = ncl; j <= nch; j++) { \ 169 D1[i1][j] = S[i][j]; \ 170 } \ 171 i1++; \ 172 for (int32_t j = ncl; j <= nch; j++) { \ 173 D0[i0][j] = S[i][j]; \ 174 } \ 175 i0++; \ 176 } \ 177 /* epilog */ \ 178 if ((nrh & 1) == 1) { \ 179 for (int32_t j = ncl; j <= nch; j++) { \ 180 D1[i1][j] = S[nrh][j]; \ 181 } \ 182 i1++; \ 183 } \ 184 } \ 185 } 186 187 desinterlace_type_matrix(int8_t); 188 desinterlace_type_matrix(uint8_t); 189 desinterlace_type_matrix(int16_t); 190 desinterlace_type_matrix(uint16_t); 191 desinterlace_type_matrix(int32_t); 192 desinterlace_type_matrix(uint32_t); 193 desinterlace_type_matrix(int64_t); 194 desinterlace_type_matrix(uint64_t); 195 desinterlace_type_matrix(float); 196 desinterlace_type_matrix(double); 197 desinterlace_type_matrix(rgb8); 198 desinterlace_type_matrix(rgbx8); 199 200 201 202 #undef interlace_type_matrix 203 #define interlace_type_matrix(t) \ 204 void short_name(t,interlace_,matrix)(t ** S0, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** S1, t ** D) \ 205 { \ 206 /* S1 & S2 are supposed to have the same height */ \ 207 int i0, i1; \ 208 i0 = i1 = nrl; \ 209 for (int32_t i = nrl; i <= nrh;) { \ 210 for (int32_t j = ncl; j <= nch; j++) { \ 211 D[i][j] = S0[i0][j]; \ 212 } \ 213 i++; \ 214 i0++; \ 215 for (int32_t j = ncl; j <= nch; j++) { \ 216 D[i][j] = S0[i1][j]; \ 217 } \ 218 i++; \ 219 i1++; \ 220 } \ 221 } 222 223 interlace_type_matrix(int8_t); 224 interlace_type_matrix(uint8_t); 225 interlace_type_matrix(int16_t); 226 interlace_type_matrix(uint16_t); 227 interlace_type_matrix(int32_t); 228 interlace_type_matrix(uint32_t); 229 interlace_type_matrix(int64_t); 230 interlace_type_matrix(uint64_t); 231 interlace_type_matrix(float); 232 interlace_type_matrix(double); 233 interlace_type_matrix(rgb8); 234 interlace_type_matrix(rgbx8); 235 236 237 #undef copyc_type_matrix 238 #define copyc_type_matrix(t) \ 239 void short_name(t,copyc_,matrix)(t ** src, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** cond, t c, t ** dst) \ 240 { \ 241 t * Xi; \ 242 t * Yi; \ 243 t * Ci; \ 244 for (int32_t i = nrl; i <= nrh; i++) { \ 245 Xi = src [i]; \ 246 Yi = dst [i]; \ 247 Ci = cond[i]; \ 248 for (int32_t j = ncl; j <= nch; j++) { \ 249 if (Ci[j] == c) { \ 250 Yi[j] = Xi[j]; \ 251 } \ 252 else { \ 253 Yi[j] = 0; \ 254 } \ 255 } \ 256 } \ 257 } 258 259 copyc_type_matrix(int8_t); 260 copyc_type_matrix(uint8_t); 261 copyc_type_matrix(int16_t); 262 copyc_type_matrix(uint16_t); 263 copyc_type_matrix(int32_t); 264 copyc_type_matrix(uint32_t); 265 copyc_type_matrix(int64_t); 266 copyc_type_matrix(uint64_t); 267 copyc_type_matrix(float); 268 copyc_type_matrix(double); 269 270 271 #undef complete_border_type_matrix 272 #define complete_border_type_matrix(t) \ 273 void short_name(t,complete_border_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t n) \ 274 { \ 275 t * Xi; \ 276 for (int32_t i = nrl; i <= nrh; i++) { \ 277 Xi = m[i]; \ 278 for (int32_t j = 1; j <= n; j++) { \ 279 Xi[ncl - j] = Xi[ncl]; \ 280 Xi[nch + j] = Xi[nch]; \ 281 } \ 282 } \ 283 for (int32_t i = 1; i <= n; i++) { \ 284 short_name(t,dup_,vector)(m[nrl], ncl - n, nch + n, m[nrl - i]); \ 285 } \ 286 for (int32_t i = 1; i <= n; i++) { \ 287 short_name(t,dup_,vector)(m[nrh], ncl - n, nch + n, m[nrh + i]); \ 288 } \ 289 } 290 291 complete_border_type_matrix(int8_t); 292 complete_border_type_matrix(uint8_t); 293 complete_border_type_matrix(int16_t); 294 complete_border_type_matrix(uint16_t); 295 complete_border_type_matrix(int32_t); 296 complete_border_type_matrix(uint32_t); 297 complete_border_type_matrix(int64_t); 298 complete_border_type_matrix(uint64_t); 299 complete_border_type_matrix(float); 300 complete_border_type_matrix(double); 301 complete_border_type_matrix(rgb8); 302 complete_border_type_matrix(rgbx8); 303 304 305 #undef complete_border1_type_matrix 306 #define complete_border1_type_matrix(t) \ 307 void short_name(t,complete_border1_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 308 { \ 309 t * Xi; \ 310 short_name(t,dup_,vector)(m[nrl + 1], ncl, nch, m[nrl]); \ 311 for (int32_t i = nrl; i <= nrh; i++) { \ 312 Xi = m[i]; \ 313 Xi[nrl] = Xi[nrl + 1]; \ 314 Xi[nrh] = Xi[nrh - 1]; \ 315 } \ 316 short_name(t,dup_,vector)(m[nrh - 1], ncl, nch, m[nrh]); \ 317 } 318 319 complete_border1_type_matrix(int8_t); 320 complete_border1_type_matrix(uint8_t); 321 complete_border1_type_matrix(int16_t); 322 complete_border1_type_matrix(uint16_t); 323 complete_border1_type_matrix(int32_t); 324 complete_border1_type_matrix(uint32_t); 325 complete_border1_type_matrix(int64_t); 326 complete_border1_type_matrix(uint64_t); 327 complete_border1_type_matrix(float); 328 complete_border1_type_matrix(double); 329 complete_border1_type_matrix(rgb8); 330 complete_border1_type_matrix(rgbx8); 331 332 333 #undef complete_border2_type_matrix 334 #define complete_border2_type_matrix(t) \ 335 void short_name(t,complete_border2_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 336 { \ 337 t * Xi; \ 338 short_name(t,dup_,vector)(m[nrl + 2], ncl, nch, m[nrl + 0]); \ 339 short_name(t,dup_,vector)(m[nrl + 2], ncl, nch, m[nrl + 1]); \ 340 for (int32_t i = nrl; i <= nrh; i++) { \ 341 Xi = m[i]; \ 342 Xi[nrl] = Xi[nrl + 1] = Xi[nrl + 2]; \ 343 Xi[nrh] = Xi[nrh - 1] = Xi[nrh - 2]; \ 344 } \ 345 short_name(t,dup_,vector)(m[nrh - 2], ncl, nch, m[nrh - 1]); \ 346 short_name(t,dup_,vector)(m[nrh - 2], ncl, nch, m[nrh - 0]); \ 347 } 348 349 complete_border2_type_matrix(int8_t); 350 complete_border2_type_matrix(uint8_t); 351 complete_border2_type_matrix(int16_t); 352 complete_border2_type_matrix(uint16_t); 353 complete_border2_type_matrix(int32_t); 354 complete_border2_type_matrix(uint32_t); 355 complete_border2_type_matrix(int64_t); 356 complete_border2_type_matrix(uint64_t); 357 complete_border2_type_matrix(float); 358 complete_border2_type_matrix(double); 359 complete_border2_type_matrix(rgb8); 360 complete_border2_type_matrix(rgbx8); 361 362 363 #undef copy1c_type_matrix 364 #define copy1c_type_matrix(t) \ 365 void short_name(t,copy1c_,matrix)(t ** X, int32_t nc, t ** Y, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 366 { \ 367 for (int32_t i = nrl; i <= nrh; i++) { \ 368 /* copy1c_ui8vector(X[i], nc, Y[i], ncl, nch); */ \ 369 } \ 370 } 371 372 copy1c_type_matrix(int8_t); 373 copy1c_type_matrix(uint8_t); 374 copy1c_type_matrix(int16_t); 375 copy1c_type_matrix(uint16_t); 376 copy1c_type_matrix(int32_t); 377 copy1c_type_matrix(uint32_t); 378 copy1c_type_matrix(int64_t); 379 copy1c_type_matrix(uint64_t); 380 copy1c_type_matrix(float); 381 copy1c_type_matrix(double); 382 copy1c_type_matrix(rgb8); 383 copy1c_type_matrix(rgbx8); 384 385 386 #undef copy1r_type_matrix 387 #define copy1r_type_matrix(t) \ 388 void short_name(t,copy1r_,matrix)(t ** X, int32_t nr, t ** Y, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 389 { \ 390 for (int32_t i = nrl; i <= nrh; i++) { \ 391 short_name(t,dup_,vector)(X[nr], ncl, nch, Y[i]); \ 392 } \ 393 } 394 395 copy1r_type_matrix(int8_t); 396 copy1r_type_matrix(uint8_t); 397 copy1r_type_matrix(int16_t); 398 copy1r_type_matrix(uint16_t); 399 copy1r_type_matrix(int32_t); 400 copy1r_type_matrix(uint32_t); 401 copy1r_type_matrix(int64_t); 402 copy1r_type_matrix(uint64_t); 403 copy1r_type_matrix(float); 404 copy1r_type_matrix(double); 405 copy1r_type_matrix(rgb8); 406 copy1r_type_matrix(rgbx8); 407 408 409 // Local Variables: 410 // tab-width: 4 411 // c-basic-offset: 4 412 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 413 // indent-tabs-mode: nil 414 // End: 415 416 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 417 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrmem2xx.c
r772 r826 13 13 #include "nrmem2X.h" 14 14 #include "nrmem2XX.h" 15 15 16 /* ---------------------------- */ 16 17 /* --- Left & right Rotate --- */ 17 18 /* ---------------------------- */ 18 19 // (i,j) -> (n-j,i) -> (n-i,n-j) -> (j,n-i) -> 19 /* -------------------------------------------------------------------------------------- */ 20 IMAGE_EXPORT(void) lrotate_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) 21 /* -------------------------------------------------------------------------------------- */ 22 { 23 int i, j, n = nrl + nrh; 24 for(i=nrl; i<=nrh; i++) { 25 for(j=ncl; j<=nch; j++) { 26 D[n-j][i] = S[i][j]; 27 } 28 } 20 21 22 #undef rotate_type_matrix 23 #define rotate_type_matrix(t) \ 24 void short_name(t,lrotate_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \ 25 { \ 26 int32_t n = nrl + nrh; \ 27 for (int32_t i = nrl; i <= nrh; i++) { \ 28 for (int32_t j = ncl; j <= nch; j++) { \ 29 D[n - j][i] = S[i][j]; \ 30 } \ 31 } \ 32 } \ 33 void short_name(t,rrotate_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \ 34 { \ 35 int32_t n = nrl + nrh; \ 36 for (int32_t i = nrl; i <= nrh; i++) { \ 37 for (int32_t j = ncl; j <= nch; j++) { \ 38 D[i][j] = S[n - j][i]; \ 39 } \ 40 } \ 41 } \ 42 void short_name(t,lrotate1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 43 int32_t n = nrl + nrh; \ 44 t temp; \ 45 for (int32_t i = nrl; i <= nrh; i++) { \ 46 for (int32_t j = ncl; j <= nch; j++) { \ 47 temp = S[n - j][i]; \ 48 S[n - j][i] = S[i][j]; \ 49 S[i][j] = temp; \ 50 } \ 51 } \ 52 } \ 53 void short_name(t,rrotate1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 54 { \ 55 int32_t n = nrl + nrh; \ 56 t temp; \ 57 for (int32_t i = nrl; i <= nrh; i++) { \ 58 for (int32_t j = ncl; j <= nch; j++) { \ 59 temp = S[i][j]; \ 60 S[i][j] = S[n - j][i]; \ 61 S[n - j][i] = temp; \ 62 } \ 63 } \ 29 64 } 30 /* ---------------------------------------------------------------------------------------- */ 31 IMAGE_EXPORT(void) lrotate_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) 32 /* ---------------------------------------------------------------------------------------- */ 33 { 34 int i, j, n = nrl + nrh; 35 for(i=nrl; i<=nrh; i++) { 36 for(j=ncl; j<=nch; j++) { 37 D[n-j][i] = S[i][j]; 38 } 39 } 40 } 41 /* ------------------------------------------------------------------------------------------- */ 42 IMAGE_EXPORT(void) lrotate_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) 43 /* ------------------------------------------------------------------------------------------- */ 44 { 45 int i, j, n = nrl + nrh; 46 for(i=nrl; i<=nrh; i++) { 47 for(j=ncl; j<=nch; j++) { 48 D[n-j][i] = S[i][j]; 49 } 50 } 51 } 52 /* ------------------------------------------------------------------------------------------ */ 53 IMAGE_EXPORT(void) lrotate_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) 54 /* ------------------------------------------------------------------------------------------ */ 55 { 56 int i, j, n = nrl + nrh; 57 for(i=nrl; i<=nrh; i++) { 58 for(j=ncl; j<=nch; j++) { 59 D[n-j][i] = S[i][j]; 60 } 61 } 62 } 63 /* --------------------------------------------------------------------------------------------- */ 64 IMAGE_EXPORT(void) lrotate_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) 65 /* --------------------------------------------------------------------------------------------- */ 66 { 67 int i, j, n = nrl + nrh; 68 for(i=nrl; i<=nrh; i++) { 69 for(j=ncl; j<=nch; j++) { 70 D[n-j][i] = S[i][j]; 71 } 72 } 73 } 74 /* ------------------------------------------------------------------------------------ */ 75 IMAGE_EXPORT(void) lrotate_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) 76 /* ------------------------------------------------------------------------------------ */ 77 { 78 int i, j, n = nrl + nrh; 79 for(i=nrl; i<=nrh; i++) { 80 for(j=ncl; j<=nch; j++) { 81 D[n-j][i] = S[i][j]; 82 } 83 } 84 } 85 /* --------------------------------------------------------------------------------------- */ 86 IMAGE_EXPORT(void) lrotate_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) 87 /* --------------------------------------------------------------------------------------- */ 88 { 89 int i, j, n = nrl + nrh; 90 for(i=nrl; i<=nrh; i++) { 91 for(j=ncl; j<=nch; j++) { 92 D[n-j][i] = S[i][j]; 93 } 94 } 95 } 96 /* ------------------------------------------------------------------------------------------ */ 97 IMAGE_EXPORT(void) lrotate_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) 98 /* ------------------------------------------------------------------------------------------ */ 99 { 100 int i, j, n = nrl + nrh; 101 for(i=nrl; i<=nrh; i++) { 102 for(j=ncl; j<=nch; j++) { 103 D[n-j][i] = S[i][j]; 104 } 105 } 106 } 107 /* --------------------------------------------------------------------------------------------- */ 108 IMAGE_EXPORT(void) lrotate_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) 109 /* --------------------------------------------------------------------------------------------- */ 110 { 111 int i, j, n = nrl + nrh; 112 for(i=nrl; i<=nrh; i++) { 113 for(j=ncl; j<=nch; j++) { 114 D[n-j][i] = S[i][j]; 115 } 116 } 117 } 118 /* --------------------------------------------------------------------------------------- */ 119 IMAGE_EXPORT(void) lrotate_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) 120 /* --------------------------------------------------------------------------------------- */ 121 { 122 int i, j, n = nrl + nrh; 123 for(i=nrl; i<=nrh; i++) { 124 for(j=ncl; j<=nch; j++) { 125 D[n-j][i] = S[i][j]; 126 } 127 } 128 } 129 /* ------------------------------------------------------------------------------------------ */ 130 IMAGE_EXPORT(void) lrotate_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) 131 /* ------------------------------------------------------------------------------------------ */ 132 { 133 int i, j, n = nrl + nrh; 134 for(i=nrl; i<=nrh; i++) { 135 for(j=ncl; j<=nch; j++) { 136 D[n-j][i] = S[i][j]; 137 } 138 } 139 } 140 /* ----------------------------------------------------------------------------------------- */ 141 IMAGE_EXPORT(void) lrotate_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) 142 /* ----------------------------------------------------------------------------------------- */ 143 { 144 int i, j, n = nrl + nrh; 145 for(i=nrl; i<=nrh; i++) { 146 for(j=ncl; j<=nch; j++) { 147 D[n-j][i] = S[i][j]; 148 } 149 } 150 } 151 /* -------------------------------------------------------------------------------------- */ 152 IMAGE_EXPORT(void) rrotate_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) 153 /* -------------------------------------------------------------------------------------- */ 154 { 155 int i, j, n = nrl + nrh; 156 for(i=nrl; i<=nrh; i++) { 157 for(j=ncl; j<=nch; j++) { 158 D[i][j] = S[n-j][i]; 159 } 160 } 161 } 162 /* ---------------------------------------------------------------------------------------- */ 163 IMAGE_EXPORT(void) rrotate_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) 164 /* ---------------------------------------------------------------------------------------- */ 165 { 166 int i, j, n = nrl + nrh; 167 for(i=nrl; i<=nrh; i++) { 168 for(j=ncl; j<=nch; j++) { 169 D[i][j] = S[n-j][i]; 170 } 171 } 172 } 173 /* ------------------------------------------------------------------------------------------- */ 174 IMAGE_EXPORT(void) rrotate_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) 175 /* ------------------------------------------------------------------------------------------- */ 176 { 177 int i, j, n = nrl + nrh; 178 for(i=nrl; i<=nrh; i++) { 179 for(j=ncl; j<=nch; j++) { 180 D[i][j] = S[n-j][i]; 181 } 182 } 183 } 184 /* ------------------------------------------------------------------------------------------ */ 185 IMAGE_EXPORT(void) rrotate_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) 186 /* ------------------------------------------------------------------------------------------ */ 187 { 188 int i, j, n = nrl + nrh; 189 for(i=nrl; i<=nrh; i++) { 190 for(j=ncl; j<=nch; j++) { 191 D[i][j] = S[n-j][i]; 192 } 193 } 194 } 195 /* --------------------------------------------------------------------------------------------- */ 196 IMAGE_EXPORT(void) rrotate_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) 197 /* --------------------------------------------------------------------------------------------- */ 198 { 199 int i, j, n = nrl + nrh; 200 for(i=nrl; i<=nrh; i++) { 201 for(j=ncl; j<=nch; j++) { 202 D[i][j] = S[n-j][i]; 203 } 204 } 205 } 206 /* ------------------------------------------------------------------------------------ */ 207 IMAGE_EXPORT(void) rrotate_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) 208 /* ------------------------------------------------------------------------------------ */ 209 { 210 int i, j, n = nrl + nrh; 211 for(i=nrl; i<=nrh; i++) { 212 for(j=ncl; j<=nch; j++) { 213 D[i][j] = S[n-j][i]; 214 } 215 } 216 } 217 /* --------------------------------------------------------------------------------------- */ 218 IMAGE_EXPORT(void) rrotate_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) 219 /* --------------------------------------------------------------------------------------- */ 220 { 221 int i, j, n = nrl + nrh; 222 for(i=nrl; i<=nrh; i++) { 223 for(j=ncl; j<=nch; j++) { 224 D[i][j] = S[n-j][i]; 225 } 226 } 227 } 228 /* ------------------------------------------------------------------------------------------ */ 229 IMAGE_EXPORT(void) rrotate_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) 230 /* ------------------------------------------------------------------------------------------ */ 231 { 232 int i, j, n = nrl + nrh; 233 for(i=nrl; i<=nrh; i++) { 234 for(j=ncl; j<=nch; j++) { 235 D[i][j] = S[n-j][i]; 236 } 237 } 238 } 239 /* --------------------------------------------------------------------------------------------- */ 240 IMAGE_EXPORT(void) rrotate_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) 241 /* --------------------------------------------------------------------------------------------- */ 242 { 243 int i, j, n = nrl + nrh; 244 for(i=nrl; i<=nrh; i++) { 245 for(j=ncl; j<=nch; j++) { 246 D[i][j] = S[n-j][i]; 247 } 248 } 249 } 250 /* --------------------------------------------------------------------------------------- */ 251 IMAGE_EXPORT(void) rrotate_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) 252 /* --------------------------------------------------------------------------------------- */ 253 { 254 int i, j, n = nrl + nrh; 255 for(i=nrl; i<=nrh; i++) { 256 for(j=ncl; j<=nch; j++) { 257 D[i][j] = S[n-j][i]; 258 } 259 } 260 } 261 /* ------------------------------------------------------------------------------------------ */ 262 IMAGE_EXPORT(void) rrotate_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) 263 /* ------------------------------------------------------------------------------------------ */ 264 { 265 int i, j, n = nrl + nrh; 266 for(i=nrl; i<=nrh; i++) { 267 for(j=ncl; j<=nch; j++) { 268 D[i][j] = S[n-j][i]; 269 } 270 } 271 } 272 /* ----------------------------------------------------------------------------------------- */ 273 IMAGE_EXPORT(void) rrotate_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) 274 /* ----------------------------------------------------------------------------------------- */ 275 { 276 int i, j, n = nrl + nrh; 277 for(i=nrl; i<=nrh; i++) { 278 for(j=ncl; j<=nch; j++) { 279 D[i][j] = S[n-j][i]; 280 } 281 } 282 } 283 /* ----------------------------------------------------------------------------- */ 284 IMAGE_EXPORT(void) lrotate1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) 285 /* ----------------------------------------------------------------------------- */ 286 { 287 int i, j, n = nrl + nrh; 288 byte t; 289 290 for(i=nrl; i<=nrh; i++) { 291 for(j=ncl; j<=nch; j++) { 292 t = S[n-j][i]; 293 S[n-j][i] = S[i][j]; 294 S[i][j] = t; 295 } 296 } 297 } 298 /* ------------------------------------------------------------------------------ */ 299 IMAGE_EXPORT(void) lrotate1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) 300 /* ------------------------------------------------------------------------------ */ 301 { 302 int i, j, n = nrl + nrh; 303 short t; 304 305 for(i=nrl; i<=nrh; i++) { 306 for(j=ncl; j<=nch; j++) { 307 t = S[n-j][i]; 308 S[n-j][i] = S[i][j]; 309 S[i][j] = t; 310 } 311 } 312 } 313 /* -------------------------------------------------------------------------------- */ 314 IMAGE_EXPORT(void) lrotate1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) 315 /* -------------------------------------------------------------------------------- */ 316 { 317 int i, j, n = nrl + nrh; 318 ushort t; 319 320 for(i=nrl; i<=nrh; i++) { 321 for(j=ncl; j<=nch; j++) { 322 t = S[n-j][i]; 323 S[n-j][i] = S[i][j]; 324 S[i][j] = t; 325 } 326 } 327 } 328 /* -------------------------------------------------------------------------------- */ 329 IMAGE_EXPORT(void) lrotate1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) 330 /* -------------------------------------------------------------------------------- */ 331 { 332 int i, j, n = nrl + nrh; 333 int16 t; 334 335 for(i=nrl; i<=nrh; i++) { 336 for(j=ncl; j<=nch; j++) { 337 t = S[n-j][i]; 338 S[n-j][i] = S[i][j]; 339 S[i][j] = t; 340 } 341 } 342 } 343 /* ---------------------------------------------------------------------------------- */ 344 IMAGE_EXPORT(void) lrotate1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) 345 /* ---------------------------------------------------------------------------------- */ 346 { 347 int i, j, n = nrl + nrh; 348 uint16 t; 349 350 for(i=nrl; i<=nrh; i++) { 351 for(j=ncl; j<=nch; j++) { 352 t = S[n-j][i]; 353 S[n-j][i] = S[i][j]; 354 S[i][j] = t; 355 } 356 } 357 } 358 /* ---------------------------------------------------------------------------- */ 359 IMAGE_EXPORT(void) lrotate1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) 360 /* ---------------------------------------------------------------------------- */ 361 { 362 int i, j, n = nrl + nrh; 363 int t; 364 365 for(i=nrl; i<=nrh; i++) { 366 for(j=ncl; j<=nch; j++) { 367 t = S[n-j][i]; 368 S[n-j][i] = S[i][j]; 369 S[i][j] = t; 370 } 371 } 372 } 373 /* ------------------------------------------------------------------------------ */ 374 IMAGE_EXPORT(void) lrotate1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) 375 /* ------------------------------------------------------------------------------ */ 376 { 377 int i, j, n = nrl + nrh; 378 uint t; 379 380 for(i=nrl; i<=nrh; i++) { 381 for(j=ncl; j<=nch; j++) { 382 t = S[n-j][i]; 383 S[n-j][i] = S[i][j]; 384 S[i][j] = t; 385 } 386 } 387 } 388 /* -------------------------------------------------------------------------------- */ 389 IMAGE_EXPORT(void) lrotate1_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch) 390 /* -------------------------------------------------------------------------------- */ 391 { 392 int i, j, n = nrl + nrh; 393 int32 t; 394 395 for(i=nrl; i<=nrh; i++) { 396 for(j=ncl; j<=nch; j++) { 397 t = S[n-j][i]; 398 S[n-j][i] = S[i][j]; 399 S[i][j] = t; 400 } 401 } 402 } 403 /* ---------------------------------------------------------------------------------- */ 404 IMAGE_EXPORT(void) lrotate1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) 405 /* ---------------------------------------------------------------------------------- */ 406 { 407 int i, j, n = nrl + nrh; 408 uint32 t; 409 410 for(i=nrl; i<=nrh; i++) { 411 for(j=ncl; j<=nch; j++) { 412 t = S[n-j][i]; 413 S[n-j][i] = S[i][j]; 414 S[i][j] = t; 415 } 416 } 417 } 418 /* ----------------------------------------------------------------------------- */ 419 IMAGE_EXPORT(void) lrotate1_matrix(float **S, long nrl,long nrh,long ncl, long nch) 420 /* ----------------------------------------------------------------------------- */ 421 { 422 int i, j, n = nrl + nrh; 423 float t; 424 425 for(i=nrl; i<=nrh; i++) { 426 for(j=ncl; j<=nch; j++) { 427 t = S[n-j][i]; 428 S[n-j][i] = S[i][j]; 429 S[i][j] = t; 430 } 431 } 432 } 433 /* ------------------------------------------------------------------------------- */ 434 IMAGE_EXPORT(void) lrotate1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) 435 /* ------------------------------------------------------------------------------- */ 436 { 437 int i, j, n = nrl + nrh; 438 double t; 439 440 for(i=nrl; i<=nrh; i++) { 441 for(j=ncl; j<=nch; j++) { 442 t = S[n-j][i]; 443 S[n-j][i] = S[i][j]; 444 S[i][j] = t; 445 } 446 } 447 } 448 /* -------------------------------------------------------------------------------- */ 449 IMAGE_EXPORT(void) lrotate1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) 450 /* -------------------------------------------------------------------------------- */ 451 { 452 int i, j, n = nrl + nrh; 453 rgb8 t; 454 455 for(i=nrl; i<=nrh; i++) { 456 for(j=ncl; j<=nch; j++) { 457 t = S[n-j][i]; 458 S[n-j][i] = S[i][j]; 459 S[i][j] = t; 460 } 461 } 462 } 463 /* ----------------------------------------------------------------------------- */ 464 IMAGE_EXPORT(void) rrotate1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) 465 /* ----------------------------------------------------------------------------- */ 466 { 467 int i, j, n = nrl + nrh; 468 byte t; 469 470 for(i=nrl; i<=nrh; i++) { 471 for(j=ncl; j<=nch; j++) { 472 t = S[i][j]; 473 S[i][j] = S[n-j][i]; 474 S[n-j][i] = t; 475 } 476 } 477 } 478 /* ------------------------------------------------------------------------------ */ 479 IMAGE_EXPORT(void) rrotate1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) 480 /* ------------------------------------------------------------------------------ */ 481 { 482 int i, j, n = nrl + nrh; 483 short t; 484 485 for(i=nrl; i<=nrh; i++) { 486 for(j=ncl; j<=nch; j++) { 487 t = S[i][j]; 488 S[i][j] = S[n-j][i]; 489 S[n-j][i] = t; 490 } 491 } 492 } 493 /* -------------------------------------------------------------------------------- */ 494 IMAGE_EXPORT(void) rrotate1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) 495 /* -------------------------------------------------------------------------------- */ 496 { 497 int i, j, n = nrl + nrh; 498 ushort t; 499 500 for(i=nrl; i<=nrh; i++) { 501 for(j=ncl; j<=nch; j++) { 502 t = S[i][j]; 503 S[i][j] = S[n-j][i]; 504 S[n-j][i] = t; 505 } 506 } 507 } 508 /* -------------------------------------------------------------------------------- */ 509 IMAGE_EXPORT(void) rrotate1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) 510 /* -------------------------------------------------------------------------------- */ 511 { 512 int i, j, n = nrl + nrh; 513 int16 t; 514 515 for(i=nrl; i<=nrh; i++) { 516 for(j=ncl; j<=nch; j++) { 517 t = S[i][j]; 518 S[i][j] = S[n-j][i]; 519 S[n-j][i] = t; 520 } 521 } 522 } 523 /* ---------------------------------------------------------------------------------- */ 524 IMAGE_EXPORT(void) rrotate1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) 525 /* ---------------------------------------------------------------------------------- */ 526 { 527 int i, j, n = nrl + nrh; 528 uint16 t; 529 530 for(i=nrl; i<=nrh; i++) { 531 for(j=ncl; j<=nch; j++) { 532 t = S[i][j]; 533 S[i][j] = S[n-j][i]; 534 S[n-j][i] = t; 535 } 536 } 537 } 538 /* ---------------------------------------------------------------------------- */ 539 IMAGE_EXPORT(void) rrotate1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) 540 /* ---------------------------------------------------------------------------- */ 541 { 542 int i, j, n = nrl + nrh; 543 int t; 544 545 for(i=nrl; i<=nrh; i++) { 546 for(j=ncl; j<=nch; j++) { 547 t = S[i][j]; 548 S[i][j] = S[n-j][i]; 549 S[n-j][i] = t; 550 } 551 } 552 } 553 /* ------------------------------------------------------------------------------ */ 554 IMAGE_EXPORT(void) rrotate1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) 555 /* ------------------------------------------------------------------------------ */ 556 { 557 int i, j, n = nrl + nrh; 558 uint t; 559 560 for(i=nrl; i<=nrh; i++) { 561 for(j=ncl; j<=nch; j++) { 562 t = S[i][j]; 563 S[i][j] = S[n-j][i]; 564 S[n-j][i] = t; 565 } 566 } 567 } 568 /* -------------------------------------------------------------------------------- */ 569 IMAGE_EXPORT(void) rrotate1_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch) 570 /* -------------------------------------------------------------------------------- */ 571 { 572 int i, j, n = nrl + nrh; 573 int32 t; 574 575 for(i=nrl; i<=nrh; i++) { 576 for(j=ncl; j<=nch; j++) { 577 t = S[i][j]; 578 S[i][j] = S[n-j][i]; 579 S[n-j][i] = t; 580 } 581 } 582 } 583 /* ---------------------------------------------------------------------------------- */ 584 IMAGE_EXPORT(void) rrotate1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) 585 /* ---------------------------------------------------------------------------------- */ 586 { 587 int i, j, n = nrl + nrh; 588 uint32 t; 589 590 for(i=nrl; i<=nrh; i++) { 591 for(j=ncl; j<=nch; j++) { 592 t = S[i][j]; 593 S[i][j] = S[n-j][i]; 594 S[n-j][i] = t; 595 } 596 } 597 } 598 /* ----------------------------------------------------------------------------- */ 599 IMAGE_EXPORT(void) rrotate1_matrix(float **S, long nrl,long nrh,long ncl, long nch) 600 /* ----------------------------------------------------------------------------- */ 601 { 602 int i, j, n = nrl + nrh; 603 float t; 604 605 for(i=nrl; i<=nrh; i++) { 606 for(j=ncl; j<=nch; j++) { 607 t = S[i][j]; 608 S[i][j] = S[n-j][i]; 609 S[n-j][i] = t; 610 } 611 } 612 } 613 /* ------------------------------------------------------------------------------- */ 614 IMAGE_EXPORT(void) rrotate1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) 615 /* ------------------------------------------------------------------------------- */ 616 { 617 int i, j, n = nrl + nrh; 618 double t; 619 620 for(i=nrl; i<=nrh; i++) { 621 for(j=ncl; j<=nch; j++) { 622 t = S[i][j]; 623 S[i][j] = S[n-j][i]; 624 S[n-j][i] = t; 625 } 626 } 627 } 628 /* -------------------------------------------------------------------------------- */ 629 IMAGE_EXPORT(void) rrotate1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) 630 /* -------------------------------------------------------------------------------- */ 631 { 632 int i, j, n = nrl + nrh; 633 rgb8 t; 634 635 for(i=nrl; i<=nrh; i++) { 636 for(j=ncl; j<=nch; j++) { 637 t = S[i][j]; 638 S[i][j] = S[n-j][i]; 639 S[n-j][i] = t; 640 } 641 } 642 } 65 66 rotate_type_matrix(int8_t); 67 rotate_type_matrix(uint8_t); 68 rotate_type_matrix(int16_t); 69 rotate_type_matrix(uint16_t); 70 rotate_type_matrix(int32_t); 71 rotate_type_matrix(uint32_t); 72 rotate_type_matrix(int64_t); 73 rotate_type_matrix(uint64_t); 74 rotate_type_matrix(float); 75 rotate_type_matrix(double); 76 rotate_type_matrix(rgb8); 77 rotate_type_matrix(rgbx8); 78 79 80 643 81 /* ---------------------------------- */ 644 82 /* --- Horizontal & Vertical Flip --- */ 645 83 /* ---------------------------------- */ 646 84 647 /* ------------------------------------------------------------------------------------ */ 648 IMAGE_EXPORT(void) hflip_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) 649 /* ------------------------------------------------------------------------------------ */ 650 { 651 int i, j, n = ncl + nch; 652 for(i=nrl; i<=nrh; i++) { 653 for(j=ncl; j<=nch; j++) { 654 D[i][n-j] = S[i][j]; 655 } 656 } 657 } 658 /* -------------------------------------------------------------------------------------- */ 659 IMAGE_EXPORT(void) hflip_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) 660 /* -------------------------------------------------------------------------------------- */ 661 { 662 int i, j, n = ncl + nch; 663 for(i=nrl; i<=nrh; i++) { 664 for(j=ncl; j<=nch; j++) { 665 D[i][n-j] = S[i][j]; 666 } 667 } 668 } 669 /* ----------------------------------------------------------------------------------------- */ 670 IMAGE_EXPORT(void) hflip_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) 671 /* ----------------------------------------------------------------------------------------- */ 672 { 673 int i, j, n = ncl + nch; 674 for(i=nrl; i<=nrh; i++) { 675 for(j=ncl; j<=nch; j++) { 676 D[i][n-j] = S[i][j]; 677 } 678 } 679 } 680 /* ---------------------------------------------------------------------------------------- */ 681 IMAGE_EXPORT(void) hflip_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) 682 /* ---------------------------------------------------------------------------------------- */ 683 { 684 int i, j, n = ncl + nch; 685 for(i=nrl; i<=nrh; i++) { 686 for(j=ncl; j<=nch; j++) { 687 D[i][n-j] = S[i][j]; 688 } 689 } 690 } 691 /* ------------------------------------------------------------------------------------------- */ 692 IMAGE_EXPORT(void) hflip_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) 693 /* ------------------------------------------------------------------------------------------- */ 694 { 695 int i, j, n = ncl + nch; 696 for(i=nrl; i<=nrh; i++) { 697 for(j=ncl; j<=nch; j++) { 698 D[i][n-j] = S[i][j]; 699 } 700 } 701 } 702 /* ---------------------------------------------------------------------------------- */ 703 IMAGE_EXPORT(void) hflip_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) 704 /* ---------------------------------------------------------------------------------- */ 705 { 706 int i, j, n = ncl + nch; 707 for(i=nrl; i<=nrh; i++) { 708 for(j=ncl; j<=nch; j++) { 709 D[i][n-j] = S[i][j]; 710 } 711 } 712 } 713 /* ------------------------------------------------------------------------------------- */ 714 IMAGE_EXPORT(void) hflip_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) 715 /* ------------------------------------------------------------------------------------- */ 716 { 717 int i, j, n = ncl + nch; 718 for(i=nrl; i<=nrh; i++) { 719 for(j=ncl; j<=nch; j++) { 720 D[i][n-j] = S[i][j]; 721 } 722 } 723 } 724 /* ----------------------------------------------------------------------------------------- */ 725 IMAGE_EXPORT(void) hflip_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) 726 /* ----------------------------------------------------------------------------------------- */ 727 { 728 int i, j, n = ncl + nch; 729 for(i=nrl; i<=nrh; i++) { 730 for(j=ncl; j<=nch; j++) { 731 D[i][n-j] = S[i][j]; 732 } 733 } 734 } 735 /* ------------------------------------------------------------------------------------------- */ 736 IMAGE_EXPORT(void) hflip_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) 737 /* ------------------------------------------------------------------------------------------- */ 738 { 739 int i, j, n = ncl + nch; 740 for(i=nrl; i<=nrh; i++) { 741 for(j=ncl; j<=nch; j++) { 742 D[i][n-j] = S[i][j]; 743 } 744 } 745 } 746 /* ------------------------------------------------------------------------------------- */ 747 IMAGE_EXPORT(void) hflip_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) 748 /* ------------------------------------------------------------------------------------- */ 749 { 750 int i, j, n = ncl + nch; 751 for(i=nrl; i<=nrh; i++) { 752 for(j=ncl; j<=nch; j++) { 753 D[i][n-j] = S[i][j]; 754 } 755 } 756 } 757 /* ---------------------------------------------------------------------------------------- */ 758 IMAGE_EXPORT(void) hflip_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) 759 /* ---------------------------------------------------------------------------------------- */ 760 { 761 int i, j, n = ncl + nch; 762 for(i=nrl; i<=nrh; i++) { 763 for(j=ncl; j<=nch; j++) { 764 D[i][n-j] = S[i][j]; 765 } 766 } 767 } 768 /* --------------------------------------------------------------------------------------- */ 769 IMAGE_EXPORT(void) hflip_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) 770 /* --------------------------------------------------------------------------------------- */ 771 { 772 int i, j, n = ncl + nch; 773 for(i=nrl; i<=nrh; i++) { 774 for(j=ncl; j<=nch; j++) { 775 D[i][n-j] = S[i][j]; 776 } 777 } 778 } 779 /* ------------------------------------------------------------------------------------- */ 780 IMAGE_EXPORT(void) vflip_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) 781 /* -------------------------------------------------------------------------------------- */ 782 { 783 int i, j, n = nrl + nrh; 784 for(i=nrl; i<=nrh; i++) { 785 for(j=ncl; j<=nch; j++) { 786 D[n-i][j] = S[i][j]; 787 } 788 } 789 } 790 /* -------------------------------------------------------------------------------------- */ 791 IMAGE_EXPORT(void) vflip_smatrix(short **S, long nrl,long nrh,long ncl, long nch, short **D) 792 /* -------------------------------------------------------------------------------------- */ 793 { 794 int i, j, n = nrl + nrh; 795 for(i=nrl; i<=nrh; i++) { 796 for(j=ncl; j<=nch; j++) { 797 D[n-i][j] = S[i][j]; 798 } 799 } 800 } 801 /* ----------------------------------------------------------------------------------------- */ 802 IMAGE_EXPORT(void) vflip_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch, ushort **D) 803 /* ----------------------------------------------------------------------------------------- */ 804 { 805 int i, j, n = nrl + nrh; 806 for(i=nrl; i<=nrh; i++) { 807 for(j=ncl; j<=nch; j++) { 808 D[n-i][j] = S[i][j]; 809 } 810 } 811 } 812 /* ---------------------------------------------------------------------------------------- */ 813 IMAGE_EXPORT(void) vflip_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch, int16 **D) 814 /* ---------------------------------------------------------------------------------------- */ 815 { 816 int i, j, n = nrl + nrh; 817 for(i=nrl; i<=nrh; i++) { 818 for(j=ncl; j<=nch; j++) { 819 D[n-i][j] = S[i][j]; 820 } 821 } 822 } 823 /* ------------------------------------------------------------------------------------------- */ 824 IMAGE_EXPORT(void) vflip_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) 825 /* ------------------------------------------------------------------------------------------- */ 826 { 827 int i, j, n = nrl + nrh; 828 for(i=nrl; i<=nrh; i++) { 829 for(j=ncl; j<=nch; j++) { 830 D[n-i][j] = S[i][j]; 831 } 832 } 833 } 834 /* ---------------------------------------------------------------------------------- */ 835 IMAGE_EXPORT(void) vflip_imatrix(int **S, long nrl,long nrh,long ncl, long nch, int **D) 836 /* ---------------------------------------------------------------------------------- */ 837 { 838 int i, j, n = nrl + nrh; 839 for(i=nrl; i<=nrh; i++) { 840 for(j=ncl; j<=nch; j++) { 841 D[n-i][j] = S[i][j]; 842 } 843 } 844 } 845 /* ------------------------------------------------------------------------------------- */ 846 IMAGE_EXPORT(void) vflip_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch, uint **D) 847 /* ------------------------------------------------------------------------------------- */ 848 { 849 int i, j, n = nrl + nrh; 850 for(i=nrl; i<=nrh; i++) { 851 for(j=ncl; j<=nch; j++) { 852 D[n-i][j] = S[i][j]; 853 } 854 } 855 } 856 /* ---------------------------------------------------------------------------------------- */ 857 IMAGE_EXPORT(void) vflip_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch, int32 **D) 858 /* ---------------------------------------------------------------------------------------- */ 859 { 860 int i, j, n = nrl + nrh; 861 for(i=nrl; i<=nrh; i++) { 862 for(j=ncl; j<=nch; j++) { 863 D[n-i][j] = S[i][j]; 864 } 865 } 866 } 867 /* ------------------------------------------------------------------------------------------- */ 868 IMAGE_EXPORT(void) vflip_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) 869 /* ------------------------------------------------------------------------------------------- */ 870 { 871 int i, j, n = nrl + nrh; 872 for(i=nrl; i<=nrh; i++) { 873 for(j=ncl; j<=nch; j++) { 874 D[n-i][j] = S[i][j]; 875 } 876 } 877 } 878 /* ------------------------------------------------------------------------------------- */ 879 IMAGE_EXPORT(void) vflip_matrix(float **S, long nrl,long nrh,long ncl, long nch, float **D) 880 /* ------------------------------------------------------------------------------------- */ 881 { 882 int i, j, n = nrl + nrh; 883 for(i=nrl; i<=nrh; i++) { 884 for(j=ncl; j<=nch; j++) { 885 D[n-i][j] = S[i][j]; 886 } 887 } 888 } 889 /* ---------------------------------------------------------------------------------------- */ 890 IMAGE_EXPORT(void) vflip_dmatrix(double **S, long nrl,long nrh,long ncl, long nch, double **D) 891 /* ---------------------------------------------------------------------------------------- */ 892 { 893 int i, j, n = nrl + nrh; 894 for(i=nrl; i<=nrh; i++) { 895 for(j=ncl; j<=nch; j++) { 896 D[n-i][j] = S[i][j]; 897 } 898 } 899 } 900 /* --------------------------------------------------------------------------------------- */ 901 IMAGE_EXPORT(void) vflip_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) 902 /* --------------------------------------------------------------------------------------- */ 903 { 904 int i, j, n = nrl + nrh; 905 for(i=nrl; i<=nrh; i++) { 906 for(j=ncl; j<=nch; j++) { 907 D[n-i][j] = S[i][j]; 908 } 909 } 910 } 911 /* --------------------------------------------------------------------------- */ 912 IMAGE_EXPORT(void) hflip1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) 913 /* --------------------------------------------------------------------------- */ 914 { 915 int i, j, n = ncl + nch; 916 byte t; 917 918 for(i=nrl; i<=nrh; i++) { 919 for(j=ncl; j<=nch; j++) { 920 t = S[i][n-j]; 921 S[i][n-j] = S[i][j]; 922 S[i][j] = t; 923 } 924 } 925 } 926 /* ---------------------------------------------------------------------------- */ 927 IMAGE_EXPORT(void) hflip1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) 928 /* ---------------------------------------------------------------------------- */ 929 { 930 int i, j, n = ncl + nch; 931 short t; 932 933 for(i=nrl; i<=nrh; i++) { 934 for(j=ncl; j<=nch; j++) { 935 t = S[i][n-j]; 936 S[i][n-j] = S[i][j]; 937 S[i][j] = t; 938 } 939 } 940 } 941 /* ------------------------------------------------------------------------------ */ 942 IMAGE_EXPORT(void) hflip1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) 943 /* ------------------------------------------------------------------------------ */ 944 { 945 int i, j, n = ncl + nch; 946 ushort t; 947 948 for(i=nrl; i<=nrh; i++) { 949 for(j=ncl; j<=nch; j++) { 950 t = S[i][n-j]; 951 S[i][n-j] = S[i][j]; 952 S[i][j] = t; 953 } 954 } 955 } 956 /* ------------------------------------------------------------------------------ */ 957 IMAGE_EXPORT(void) hflip1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) 958 /* ------------------------------------------------------------------------------ */ 959 { 960 int i, j, n = ncl + nch; 961 int16 t; 962 963 for(i=nrl; i<=nrh; i++) { 964 for(j=ncl; j<=nch; j++) { 965 t = S[i][n-j]; 966 S[i][n-j] = S[i][j]; 967 S[i][j] = t; 968 } 969 } 970 } 971 /* -------------------------------------------------------------------------------- */ 972 IMAGE_EXPORT(void) hflip1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) 973 /* -------------------------------------------------------------------------------- */ 974 { 975 int i, j, n = ncl + nch; 976 uint16 t; 977 978 for(i=nrl; i<=nrh; i++) { 979 for(j=ncl; j<=nch; j++) { 980 t = S[i][n-j]; 981 S[i][n-j] = S[i][j]; 982 S[i][j] = t; 983 } 984 } 985 } 986 /* -------------------------------------------------------------------------- */ 987 IMAGE_EXPORT(void) hflip1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) 988 /* -------------------------------------------------------------------------- */ 989 { 990 int i, j, n = ncl + nch; 991 int t; 992 993 for(i=nrl; i<=nrh; i++) { 994 for(j=ncl; j<=nch; j++) { 995 t = S[i][n-j]; 996 S[i][n-j] = S[i][j]; 997 S[i][j] = t; 998 } 999 } 1000 } 1001 /* ---------------------------------------------------------------------------- */ 1002 IMAGE_EXPORT(void) hflip1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) 1003 /* ---------------------------------------------------------------------------- */ 1004 { 1005 int i, j, n = ncl + nch; 1006 uint t; 1007 1008 for(i=nrl; i<=nrh; i++) { 1009 for(j=ncl; j<=nch; j++) { 1010 t = S[i][n-j]; 1011 S[i][n-j] = S[i][j]; 1012 S[i][j] = t; 1013 } 1014 } 1015 } 1016 /* ------------------------------------------------------------------------------- */ 1017 IMAGE_EXPORT(void) hflip1_i32matrix (int32 **S, long nrl,long nrh,long ncl, long nch) 1018 /* ------------------------------------------------------------------------------- */ 1019 { 1020 int i, j, n = ncl + nch; 1021 int32 t; 1022 1023 for(i=nrl; i<=nrh; i++) { 1024 for(j=ncl; j<=nch; j++) { 1025 t = S[i][n-j]; 1026 S[i][n-j] = S[i][j]; 1027 S[i][j] = t; 1028 } 1029 } 1030 } 1031 /* ------------------------------------------------------------------------------- */ 1032 IMAGE_EXPORT(void) hflip1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) 1033 /* -------------------------------------------------------------------------------- */ 1034 { 1035 int i, j, n = ncl + nch; 1036 uint32 t; 1037 1038 for(i=nrl; i<=nrh; i++) { 1039 for(j=ncl; j<=nch; j++) { 1040 t = S[i][n-j]; 1041 S[i][n-j] = S[i][j]; 1042 S[i][j] = t; 1043 } 1044 } 1045 } 1046 /* --------------------------------------------------------------------------- */ 1047 IMAGE_EXPORT(void) hflip1_matrix(float **S, long nrl,long nrh,long ncl, long nch) 1048 /* --------------------------------------------------------------------------- */ 1049 { 1050 int i, j, n = ncl + nch; 1051 float t; 1052 1053 for(i=nrl; i<=nrh; i++) { 1054 for(j=ncl; j<=nch; j++) { 1055 t = S[i][n-j]; 1056 S[i][n-j] = S[i][j]; 1057 S[i][j] = t; 1058 } 1059 } 1060 } 1061 /* ----------------------------------------------------------------------------- */ 1062 IMAGE_EXPORT(void) hflip1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) 1063 /* ----------------------------------------------------------------------------- */ 1064 { 1065 int i, j, n = ncl + nch; 1066 double t; 1067 1068 for(i=nrl; i<=nrh; i++) { 1069 for(j=ncl; j<=nch; j++) { 1070 t = S[i][n-j]; 1071 S[i][n-j] = S[i][j]; 1072 S[i][j] = t; 1073 } 1074 } 1075 } 1076 /* ------------------------------------------------------------------------------ */ 1077 IMAGE_EXPORT(void) hflip1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) 1078 /* ------------------------------------------------------------------------------ */ 1079 { 1080 int i, j, n = ncl + nch; 1081 rgb8 t; 1082 1083 for(i=nrl; i<=nrh; i++) { 1084 for(j=ncl; j<=nch; j++) { 1085 t = S[i][n-j]; 1086 S[i][n-j] = S[i][j]; 1087 S[i][j] = t; 1088 } 1089 } 1090 } 1091 /* ---------------------------------------------------------------------------- */ 1092 IMAGE_EXPORT(void) vflip1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) 1093 /* ---------------------------------------------------------------------------- */ 1094 { 1095 int i, j, n = nrl + nrh; 1096 byte t; 1097 1098 for(i=nrl; i<=nrh; i++) { 1099 for(j=ncl; j<=nch; j++) { 1100 t = S[n-i][j]; 1101 S[n-i][j] = S[i][j]; 1102 S[i][j] = t; 1103 } 1104 } 1105 } 1106 /* ---------------------------------------------------------------------------- */ 1107 IMAGE_EXPORT(void) vflip1_smatrix(short **S, long nrl,long nrh,long ncl, long nch) 1108 /* ---------------------------------------------------------------------------- */ 1109 { 1110 int i, j, n = nrl + nrh; 1111 short t; 1112 1113 for(i=nrl; i<=nrh; i++) { 1114 for(j=ncl; j<=nch; j++) { 1115 t = S[n-i][j]; 1116 S[n-i][j] = S[i][j]; 1117 S[i][j] = t; 1118 } 1119 } 1120 } 1121 /* ------------------------------------------------------------------------------ */ 1122 IMAGE_EXPORT(void) vflip1_usmatrix(ushort **S, long nrl,long nrh,long ncl, long nch) 1123 /* ------------------------------------------------------------------------------ */ 1124 { 1125 int i, j, n = nrl + nrh; 1126 ushort t; 1127 1128 for(i=nrl; i<=nrh; i++) { 1129 for(j=ncl; j<=nch; j++) { 1130 t = S[n-i][j]; 1131 S[n-i][j] = S[i][j]; 1132 S[i][j] = t; 1133 } 1134 } 1135 } 1136 /* ------------------------------------------------------------------------------ */ 1137 IMAGE_EXPORT(void) vflip1_i16matrix(int16 **S, long nrl,long nrh,long ncl, long nch) 1138 /* ------------------------------------------------------------------------------ */ 1139 { 1140 int i, j, n = nrl + nrh; 1141 int16 t; 1142 1143 for(i=nrl; i<=nrh; i++) { 1144 for(j=ncl; j<=nch; j++) { 1145 t = S[n-i][j]; 1146 S[n-i][j] = S[i][j]; 1147 S[i][j] = t; 1148 } 1149 } 1150 } 1151 /* -------------------------------------------------------------------------------- */ 1152 IMAGE_EXPORT(void) vflip1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) 1153 /* -------------------------------------------------------------------------------- */ 1154 { 1155 int i, j, n = nrl + nrh; 1156 uint16 t; 1157 1158 for(i=nrl; i<=nrh; i++) { 1159 for(j=ncl; j<=nch; j++) { 1160 t = S[n-i][j]; 1161 S[n-i][j] = S[i][j]; 1162 S[i][j] = t; 1163 } 1164 } 1165 } 1166 /* -------------------------------------------------------------------------- */ 1167 IMAGE_EXPORT(void) vflip1_imatrix(int **S, long nrl,long nrh,long ncl, long nch) 1168 /* -------------------------------------------------------------------------- */ 1169 { 1170 int i, j, n = nrl + nrh; 1171 int t; 1172 1173 for(i=nrl; i<=nrh; i++) { 1174 for(j=ncl; j<=nch; j++) { 1175 t = S[n-i][j]; 1176 S[n-i][j] = S[i][j]; 1177 S[i][j] = t; 1178 } 1179 } 1180 } 1181 /* ---------------------------------------------------------------------------- */ 1182 IMAGE_EXPORT(void) vflip1_uimatrix(uint **S, long nrl,long nrh,long ncl, long nch) 1183 /* ---------------------------------------------------------------------------- */ 1184 { 1185 int i, j, n = nrl + nrh; 1186 uint t; 1187 1188 for(i=nrl; i<=nrh; i++) { 1189 for(j=ncl; j<=nch; j++) { 1190 t = S[n-i][j]; 1191 S[n-i][j] = S[i][j]; 1192 S[i][j] = t; 1193 } 1194 } 1195 } 1196 /* ------------------------------------------------------------------------------ */ 1197 IMAGE_EXPORT(void) vflip1_i32matrix(int32 **S, long nrl,long nrh,long ncl, long nch) 1198 /* ------------------------------------------------------------------------------ */ 1199 { 1200 int i, j, n = nrl + nrh; 1201 int32 t; 1202 1203 for(i=nrl; i<=nrh; i++) { 1204 for(j=ncl; j<=nch; j++) { 1205 t = S[n-i][j]; 1206 S[n-i][j] = S[i][j]; 1207 S[i][j] = t; 1208 } 1209 } 1210 } 1211 /* -------------------------------------------------------------------------------- */ 1212 IMAGE_EXPORT(void) vflip1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) 1213 /* -------------------------------------------------------------------------------- */ 1214 { 1215 int i, j, n = nrl + nrh; 1216 uint32 t; 1217 1218 for(i=nrl; i<=nrh; i++) { 1219 for(j=ncl; j<=nch; j++) { 1220 t = S[n-i][j]; 1221 S[n-i][j] = S[i][j]; 1222 S[i][j] = t; 1223 } 1224 } 1225 } 1226 /* --------------------------------------------------------------------------- */ 1227 IMAGE_EXPORT(void) vflip1_matrix(float **S, long nrl,long nrh,long ncl, long nch) 1228 /* --------------------------------------------------------------------------- */ 1229 { 1230 int i, j, n = nrl + nrh; 1231 float t; 1232 1233 for(i=nrl; i<=nrh; i++) { 1234 for(j=ncl; j<=nch; j++) { 1235 t = S[n-i][j]; 1236 S[n-i][j] = S[i][j]; 1237 S[i][j] = t; 1238 } 1239 } 1240 } 1241 /* ----------------------------------------------------------------------------- */ 1242 IMAGE_EXPORT(void) vflip1_dmatrix(double **S, long nrl,long nrh,long ncl, long nch) 1243 /* ----------------------------------------------------------------------------- */ 1244 { 1245 int i, j, n = nrl + nrh; 1246 double t; 1247 1248 for(i=nrl; i<=nrh; i++) { 1249 for(j=ncl; j<=nch; j++) { 1250 t = S[n-i][j]; 1251 S[n-i][j] = S[i][j]; 1252 S[i][j] = t; 1253 } 1254 } 1255 } 1256 /* ------------------------------------------------------------------------------ */ 1257 IMAGE_EXPORT(void) vflip1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) 1258 /* ------------------------------------------------------------------------------ */ 1259 { 1260 int i, j, n = nrl + nrh; 1261 rgb8 t; 1262 1263 for(i=nrl; i<=nrh; i++) { 1264 for(j=ncl; j<=nch; j++) { 1265 t = S[n-i][j]; 1266 S[n-i][j] = S[i][j]; 1267 S[i][j] = t; 1268 } 1269 } 85 86 #undef flip_type_matrix 87 #define flip_type_matrix(t) \ 88 void short_name(t,hflip_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \ 89 { \ 90 int32_t n = ncl + nch; \ 91 for (int32_t i = nrl; i <= nrh; i++) { \ 92 for (int32_t j = ncl; j <= nch; j++) { \ 93 D[i][n - j] = S[i][j]; \ 94 } \ 95 } \ 96 } \ 97 void short_name(t,vflip_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \ 98 { \ 99 int32_t n = nrl + nrh; \ 100 for (int32_t i = nrl; i <= nrh; i++) { \ 101 for (int32_t j = ncl; j <= nch; j++) { \ 102 D[n - i][j] = S[i][j]; \ 103 } \ 104 } \ 105 } \ 106 void short_name(t,hflip1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 107 { \ 108 int32_t n = ncl + nch; \ 109 t temp; \ 110 for (int32_t i = nrl; i <= nrh; i++) { \ 111 for (int32_t j = ncl; j <= nch; j++) { \ 112 temp = S[i][n - j]; \ 113 S[i][n - j] = S[i][j]; \ 114 S[i][j] = temp; \ 115 } \ 116 } \ 117 } \ 118 void short_name(t,vflip1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 119 { \ 120 int32_t n = ncl + nch; \ 121 t temp; \ 122 for (int32_t i = nrl; i <= nrh; i++) { \ 123 for (int32_t j = ncl; j <= nch; j++) { \ 124 temp = S[n - i][j]; \ 125 S[n - i][j] = S[i][j]; \ 126 S[i][j] = temp; \ 127 } \ 128 } \ 1270 129 } 1271 130 131 flip_type_matrix(int8_t); 132 flip_type_matrix(uint8_t); 133 flip_type_matrix(int16_t); 134 flip_type_matrix(uint16_t); 135 flip_type_matrix(int32_t); 136 flip_type_matrix(uint32_t); 137 flip_type_matrix(int64_t); 138 flip_type_matrix(uint64_t); 139 flip_type_matrix(float); 140 flip_type_matrix(double); 141 flip_type_matrix(rgb8); 142 flip_type_matrix(rgbx8); 143 144 145 146 // Local Variables: 147 // tab-width: 4 148 // c-basic-offset: 4 149 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 150 // indent-tabs-mode: nil 151 // End: 152 153 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 154 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrset1.c
r805 r826 13 13 14 14 /* 15 * 2002/06/11 ajout des fonctions endline 16 */ 15 * 2002/06/11 ajout des fonctions endline 16 */ 17 17 18 #include <stdio.h> 18 19 #include <stddef.h> 19 20 #include <stdlib.h> 20 #include <math.h> // fabs21 21 22 22 #include "mypredef.h" … … 36 36 */ 37 37 38 /* ------------------------------------------------------- */ 39 IMAGE_EXPORT(void) zero_si8vector(sint8 *v, long nl, long nh) 40 /* ------------------------------------------------------- */ 41 { 42 int i; 43 for(i=nl; i<=nh; i++) v[i] = 0; 44 } 45 /* ------------------------------------------------------- */ 46 IMAGE_EXPORT(void) zero_ui8vector(uint8 *v, long nl, long nh) 47 /* ------------------------------------------------------- */ 48 { 49 int i; 50 for(i=nl; i<=nh; i++) v[i] = 0; 51 } 52 /* --------------------------------------------------------- */ 53 IMAGE_EXPORT(void) zero_si16vector(sint16 *v, long nl, long nh) 54 /* --------------------------------------------------------- */ 55 { 56 int i; 57 for(i=nl; i<=nh; i++) v[i] = 0; 58 } 59 /* --------------------------------------------------------- */ 60 IMAGE_EXPORT(void) zero_ui16vector(uint16 *v, long nl, long nh) 61 /* --------------------------------------------------------- */ 62 { 63 int i; 64 for(i=nl; i<=nh; i++) v[i] = 0; 65 } 66 /* --------------------------------------------------------- */ 67 IMAGE_EXPORT(void) zero_si32vector(sint32 *v, long nl, long nh) 68 /* --------------------------------------------------------- */ 69 { 70 int i; 71 for(i=nl; i<=nh; i++) v[i] = 0; 72 } 73 /* --------------------------------------------------------- */ 74 IMAGE_EXPORT(void) zero_ui32vector(uint32 *v, long nl, long nh) 75 /* --------------------------------------------------------- */ 76 { 77 int i; 78 for(i=nl; i<=nh; i++) v[i] = 0; 79 } 80 /* --------------------------------------------------------- */ 81 IMAGE_EXPORT(void) zero_si64vector(sint64 *v, long nl, long nh) 82 /* --------------------------------------------------------- */ 83 { 84 int i; 85 for(i=nl; i<=nh; i++) v[i] = 0; 86 } 87 /* --------------------------------------------------------- */ 88 IMAGE_EXPORT(void) zero_ui64vector(uint64 *v, long nl, long nh) 89 /* --------------------------------------------------------- */ 90 { 91 int i; 92 for(i=nl; i<=nh; i++) v[i] = 0; 93 } 94 /* --------------------------------------------------------- */ 95 IMAGE_EXPORT(void) zero_f32vector(float32 *v, long nl, long nh) 96 /* --------------------------------------------------------- */ 97 { 98 int i; 99 for(i=nl; i<=nh; i++) v[i] = 0; 100 } 101 /* --------------------------------------------------------- */ 102 IMAGE_EXPORT(void) zero_f64vector(float64 *v, long nl, long nh) 103 /* --------------------------------------------------------- */ 104 { 105 int i; 106 for(i=nl; i<=nh; i++) v[i] = 0; 107 } 108 /* ------------------------------------------------------- */ 109 IMAGE_EXPORT(void) zero_rgb8vector(rgb8 *v, long nl, long nh) 110 /* ------------------------------------------------------- */ 111 { 112 int i; 113 rgb8 z; 114 z.r = 0; z.g = 0; z.b = 0; 115 for(i=nl; i<=nh; i++) v[i] = z; 116 } 117 /* --------------------------------------------------------- */ 118 IMAGE_EXPORT(void) zero_rgbx8vector(rgbx8 *v, long nl, long nh) 119 /* --------------------------------------------------------- */ 120 { 121 int i; 122 rgbx8 z; 123 z.r = 0; z.g = 0; z.b = 0; z.x = 0; 124 for(i=nl; i<=nh; i++) v[i] = z; 125 } 38 39 #undef zero_type_vector 40 #define zero_type_vector(t) \ 41 void short_name(t,zero_,vector)(t * v, int32_t nl, int32_t nh) \ 42 { \ 43 for (int32_t i = nl; i <= nh; i++) { \ 44 v[i] = 0; \ 45 } \ 46 } 47 48 zero_type_vector(int8_t); 49 zero_type_vector(uint8_t); 50 zero_type_vector(int16_t); 51 zero_type_vector(uint16_t); 52 zero_type_vector(int32_t); 53 zero_type_vector(uint32_t); 54 zero_type_vector(int64_t); 55 zero_type_vector(uint64_t); 56 zero_type_vector(float); 57 zero_type_vector(double); 58 59 60 void zero_rgb8vector(rgb8 * v, int32_t nl, int32_t nh) 61 { 62 rgb8 z = {0, 0, 0}; 63 for (int32_t i = nl; i <= nh; i++) { 64 v[i] = z; 65 } 66 } 67 68 void zero_rgbx8vector(rgbx8 * v, int32_t nl, int32_t nh) 69 { 70 rgbx8 z; 71 z.r = 0; 72 z.g = 0; 73 z.b = 0; 74 z.x = 0; 75 for (int32_t i = nl; i <= nh; i++) { 76 v[i] = z; 77 } 78 } 79 80 126 81 /* 127 82 * ------------------ … … 130 85 */ 131 86 132 /* -------------------------------------------------------------- */ 133 IMAGE_EXPORT(void) set_si8vector(sint8 *v, long nl, long nh, sint8 x) 134 /* -------------------------------------------------------------- */ 135 { 136 int i; 137 for(i=nl; i<=nh; i++) 138 v[i] = x; 139 } 140 /* --------------------------------------------------------------- */ 141 IMAGE_EXPORT(void) set_ui8vector(uint8 *v, long nl, long nh, uint8 x) 142 /* --------------------------------------------------------------- */ 143 { 144 int i; 145 for(i=nl; i<=nh; i++) 146 v[i] = x; 147 } 148 /* ------------------------------------------------------------------ */ 149 IMAGE_EXPORT(void) set_si16vector(sint16 *v, long nl, long nh, sint16 x) 150 /* ------------------------------------------------------------------ */ 151 { 152 int i; 153 for(i=nl; i<=nh; i++) 154 v[i] = x; 155 } 156 /* ------------------------------------------------------------------ */ 157 IMAGE_EXPORT(void) set_ui16vector(uint16 *v, long nl, long nh, uint16 x) 158 /* ------------------------------------------------------------------ */ 159 { 160 int i; 161 for(i=nl; i<=nh; i++) 162 v[i] = x; 163 } 164 /* ------------------------------------------------------------------ */ 165 IMAGE_EXPORT(void) set_si32vector(sint32 *v, long nl, long nh, sint32 x) 166 /* ------------------------------------------------------------------ */ 167 { 168 int i; 169 for(i=nl; i<=nh; i++) 170 v[i] = x; 171 } 172 /* ------------------------------------------------------------------ */ 173 IMAGE_EXPORT(void) set_ui32vector(uint32 *v, long nl, long nh, uint32 x) 174 /* ------------------------------------------------------------------ */ 175 { 176 int i; 177 for(i=nl; i<=nh; i++) 178 v[i] = x; 179 } 180 /* ----------------------------------------------------------------- */ 181 IMAGE_EXPORT(void) set_si64vector(sint64 *v, long nl, long nh, sint64 x) 182 /* ----------------------------------------------------------------- */ 183 { 184 int i; 185 for(i=nl; i<=nh; i++) 186 v[i] = x; 187 } 188 /* ------------------------------------------------------------------ */ 189 IMAGE_EXPORT(void) set_ui64vector(uint64 *v, long nl, long nh, uint64 x) 190 /* ------------------------------------------------------------------ */ 191 { 192 int i; 193 for(i=nl; i<=nh; i++) 194 v[i] = x; 195 } 196 /* ------------------------------------------------------------------- */ 197 IMAGE_EXPORT(void) set_f32vector(float32 *v, long nl, long nh, float32 x) 198 /* ------------------------------------------------------------------- */ 199 { 200 int i; 201 for(i=nl; i<=nh; i++) 202 v[i] = x; 203 } 204 /* ------------------------------------------------------------------- */ 205 IMAGE_EXPORT(void) set_f64vector(float64 *v, long nl, long nh, float64 x) 206 /* ------------------------------------------------------------------- */ 207 { 208 int i; 209 for(i=nl; i<=nh; i++) 210 v[i] = x; 211 } 212 /* -------------------------------------------------------------- */ 213 IMAGE_EXPORT(void) set_rgb8vector(rgb8 *v, long nl, long nh, rgb8 x) 214 /* -------------------------------------------------------------- */ 215 { 216 int i; 217 218 for(i=nl; i<=nh; i++) 219 v[i] = x; 220 } 221 /* ----------------------------------------------------------------- */ 222 IMAGE_EXPORT(void) set_rgbx8vector(rgbx8 *v, long nl, long nh, rgbx8 x) 223 /* ----------------------------------------------------------------- */ 224 { 225 int i; 226 227 for(i=nl; i<=nh; i++) 228 v[i] = x; 229 } 87 88 #undef set_type_vector 89 #define set_type_vector(t) \ 90 void short_name(t,set_,vector)(t * v, int32_t nl, int32_t nh, t x) \ 91 { \ 92 for (int32_t i = nl; i <= nh; i++) { \ 93 v[i] = x; \ 94 } \ 95 } 96 97 set_type_vector(int8_t); 98 set_type_vector(uint8_t); 99 set_type_vector(int16_t); 100 set_type_vector(uint16_t); 101 set_type_vector(int32_t); 102 set_type_vector(uint32_t); 103 set_type_vector(int64_t); 104 set_type_vector(uint64_t); 105 set_type_vector(float); 106 set_type_vector(double); 107 set_type_vector(rgb8); 108 set_type_vector(rgbx8); 109 110 111 230 112 /* 231 113 * ------------------------ … … 233 115 * ------------------------ 234 116 */ 235 /* ---------------------------------------------------------------------------- */ 236 IMAGE_EXPORT(void) set_si8vector_param(sint8 *v, long nl, long nh, sint8 x, sint8 xstep) 237 /* ---------------------------------------------------------------------------- */ 238 { 239 int i; 240 for(i=nl; i<=nh; i++) { 241 v[i] = x; 242 x += xstep; 243 } 244 } 245 /* ---------------------------------------------------------------------------- */ 246 IMAGE_EXPORT(void) set_ui8vector_param(uint8 *v, long nl, long nh, uint8 x, uint8 xstep) 247 /* ---------------------------------------------------------------------------- */ 248 { 249 int i; 250 for(i=nl; i<=nh; i++) { 251 v[i] = x; 252 x += xstep; 253 } 254 } 255 /* -------------------------------------------------------------------------------- */ 256 IMAGE_EXPORT(void) set_si16vector_param(sint16 *v, long nl, long nh, sint16 x, sint16 xstep) 257 /* -------------------------------------------------------------------------------- */ 258 { 259 int i; 260 for(i=nl; i<=nh; i++) { 261 v[i] = x; 262 x += xstep; 263 } 264 } 265 /* -------------------------------------------------------------------------------- */ 266 IMAGE_EXPORT(void) set_ui16vector_param(uint16 *v, long nl, long nh, uint16 x, uint16 xstep) 267 /* -------------------------------------------------------------------------------- */ 268 { 269 int i; 270 for(i=nl; i<=nh; i++) { 271 v[i] = x; 272 x += xstep; 273 } 274 } 275 /* -------------------------------------------------------------------------------- */ 276 IMAGE_EXPORT(void) set_si32vector_param(sint32 *v, long nl, long nh, sint32 x, sint32 xstep) 277 /* -------------------------------------------------------------------------------- */ 278 { 279 int i; 280 for(i=nl; i<=nh; i++) { 281 v[i] = x; 282 x += xstep; 283 } 284 } 285 /* -------------------------------------------------------------------------------- */ 286 IMAGE_EXPORT(void) set_ui32vector_param(uint32 *v, long nl, long nh, uint32 x, uint32 xstep) 287 /* -------------------------------------------------------------------------------- */ 288 { 289 int i; 290 for(i=nl; i<=nh; i++) { 291 v[i] = x; 292 x += xstep; 293 } 294 } 295 /* -------------------------------------------------------------------------------- */ 296 IMAGE_EXPORT(void) set_si64vector_param(sint64 *v, long nl, long nh, sint64 x, sint64 xstep) 297 /* -------------------------------------------------------------------------------- */ 298 { 299 int i; 300 for(i=nl; i<=nh; i++) { 301 v[i] = x; 302 x += xstep; 303 } 304 } 305 /* -------------------------------------------------------------------------------- */ 306 IMAGE_EXPORT(void) set_ui64vector_param(uint64 *v, long nl, long nh, uint64 x, uint64 xstep) 307 /* -------------------------------------------------------------------------------- */ 308 { 309 int i; 310 for(i=nl; i<=nh; i++) { 311 v[i] = x; 312 x += xstep; 313 } 314 } 315 /* --------------------------------------------------------------------------------- */ 316 IMAGE_EXPORT(void) set_f32vector_param(float32 *v, long nl, long nh, float32 x, float32 xstep) 317 /* ---------------------------------------------------------------------------------- */ 318 { 319 int i; 320 for(i=nl; i<=nh; i++) { 321 v[i] = x; 322 x += xstep; 323 } 324 }/* --------------------------------------------------------------------------------- */ 325 IMAGE_EXPORT(void) set_f64vector_param(float64 *v, long nl, long nh, float64 x, float64 xstep) 326 /* --------------------------------------------------------------------------------- */ 327 { 328 int i; 329 for(i=nl; i<=nh; i++) { 330 v[i] = x; 331 x += xstep; 332 } 333 }/* ------------------------------------------------------------------------- */ 334 IMAGE_EXPORT(void) set_rgb8vector_param(rgb8 *v, long nl, long nh, rgb8 x, rgb8 xstep) 335 /* ------------------------------------------------------------------------- */ 336 { 337 int i; 338 for(i=nl; i<=nh; i++) { 117 118 119 #undef set_type_vector_param 120 #define set_type_vector_param(t) \ 121 void short_name(t,set_,vector_param)(t * v, int32_t nl, int32_t nh, t x, t xstep) \ 122 { \ 123 for (int32_t i = nl; i <= nh; i++) { \ 124 v[i] = x; \ 125 x += xstep; \ 126 } \ 127 } 128 129 set_type_vector_param(int8_t); 130 set_type_vector_param(uint8_t); 131 set_type_vector_param(int16_t); 132 set_type_vector_param(uint16_t); 133 set_type_vector_param(int32_t); 134 set_type_vector_param(uint32_t); 135 set_type_vector_param(int64_t); 136 set_type_vector_param(uint64_t); 137 set_type_vector_param(float); 138 set_type_vector_param(double); 139 140 141 142 void set_rgb8vector_param(rgb8 * v, int32_t nl, int32_t nh, rgb8 x, rgb8 xstep) 143 { 144 for (int32_t i = nl; i <= nh; i++) { 339 145 v[i] = x; 340 146 RGB8_ADD(x, xstep, x); 341 147 } 342 } /* ----------------------------------------------------------------------------- */343 IMAGE_EXPORT(void) set_rgbx8vector_param(rgbx8 *v, long nl, long nh, rgbx8 x, rgbx8 xstep) 344 /* ------------------------------------------------------------------------------ */ 345 { 346 int i; 347 348 for(i=nl; i<=nh; i++) {349 v[i] = x; 350 RGB8_ADD(x, xstep, x); 351 } 352 } 148 } 149 150 void set_rgbx8vector_param(rgbx8 * v, int32_t nl, int32_t nh, rgbx8 x, rgbx8 xstep) 151 { 152 for (int32_t i = nl; i <= nh; i++) { 153 v[i] = x; 154 RGBX8_ADD(x, xstep, x); 155 } 156 } 157 158 353 159 /* 354 160 * -------------------- … … 356 162 * -------------------- 357 163 */ 358 /* -------------------------------------------------------- */ 359 IMAGE_EXPORT(void) set_si8vector_j(sint8 *v, long nl, long nh) 360 /* -------------------------------------------------------- */ 361 { 362 int i; 363 364 for(i=nl; i<=nh; i++) 365 v[i] = (sint8) i; 366 } 367 /* -------------------------------------------------------- */ 368 IMAGE_EXPORT(void) set_ui8vector_j(uint8 *v, long nl, long nh) 369 /* -------------------------------------------------------- */ 370 { 371 int i; 372 373 for(i=nl; i<=nh; i++) 374 v[i] = (uint8) i; 375 } 376 /* ---------------------------------------------------------- */ 377 IMAGE_EXPORT(void) set_si16vector_j(sint16 *v, long nl, long nh) 378 /* ---------------------------------------------------------- */ 379 { 380 int i; 381 382 for(i=nl; i<=nh; i++) 383 v[i] = (sint16) i; 384 } 385 /* ---------------------------------------------------------- */ 386 IMAGE_EXPORT(void) set_ui16vector_j(uint16 *v, long nl, long nh) 387 /* ---------------------------------------------------------- */ 388 { 389 int i; 390 391 for(i=nl; i<=nh; i++) 392 v[i] = (uint16) i; 393 } 394 /* ---------------------------------------------------------- */ 395 IMAGE_EXPORT(void) set_si32vector_j(sint32 *v, long nl, long nh) 396 /* ---------------------------------------------------------- */ 397 { 398 int i; 399 400 for(i=nl; i<=nh; i++) 401 v[i] = (sint32) i; 402 } 403 /* ---------------------------------------------------------- */ 404 IMAGE_EXPORT(void) set_ui32vector_j(uint32 *v, long nl, long nh) 405 /* ---------------------------------------------------------- */ 406 { 407 int i; 408 409 for(i=nl; i<=nh; i++) 410 v[i] = (uint32) i; 411 } 412 /* ---------------------------------------------------------- */ 413 IMAGE_EXPORT(void) set_si64vector_j(sint64 *v, long nl, long nh) 414 /* ---------------------------------------------------------- */ 415 { 416 int i; 417 418 for(i=nl; i<=nh; i++) 419 v[i] = (sint64) i; 420 } 421 /* ---------------------------------------------------------- */ 422 IMAGE_EXPORT(void) set_ui64vector_j(uint64 *v, long nl, long nh) 423 /* ---------------------------------------------------------- */ 424 { 425 int i; 426 427 for(i=nl; i<=nh; i++) 428 v[i] = (uint64) i; 429 } 430 /* ---------------------------------------------------------- */ 431 IMAGE_EXPORT(void) set_f32vector_j(float32 *v, long nl, long nh) 432 /* ---------------------------------------------------------- */ 433 { 434 int i; 435 436 for(i=nl; i<=nh; i++) 437 v[i] = (float32) i; 438 } 439 /* ---------------------------------------------------------- */ 440 IMAGE_EXPORT(void) set_f64vector_j(float64 *v, long nl, long nh) 441 /* ---------------------------------------------------------- */ 442 { 443 int i; 444 445 for(i=nl; i<=nh; i++) 446 v[i] = (float64) i; 447 } 448 /* -------------------------------------------------------- */ 449 IMAGE_EXPORT(void) set_rgb8vector_j(rgb8 *v, long nl, long nh) 450 /* -------------------------------------------------------- */ 451 { 452 int i; 453 454 for(i=nl; i<=nh; i++) { 455 v[i].r = (uint8) i; 164 165 #undef set_type_vector_j 166 #define set_type_vector_j(t) \ 167 void short_name(t,set_,vector_j)(t * v, int32_t nl, int32_t nh) \ 168 { \ 169 for (int32_t i = nl; i <= nh; i++) { \ 170 v[i] = (t) i; \ 171 } \ 172 } 173 174 set_type_vector_j(int8_t); 175 set_type_vector_j(uint8_t); 176 set_type_vector_j(int16_t); 177 set_type_vector_j(uint16_t); 178 set_type_vector_j(int32_t); 179 set_type_vector_j(uint32_t); 180 set_type_vector_j(int64_t); 181 set_type_vector_j(uint64_t); 182 set_type_vector_j(float); 183 set_type_vector_j(double); 184 185 186 void set_rgb8vector_j(rgb8 * v, int32_t nl, int32_t nh) 187 { 188 for (int32_t i = nl; i <= nh; i++) { 189 v[i].r = (uint8) i; 456 190 v[i].g = (uint8) i; 457 191 v[i].b = (uint8) i; 458 192 } 459 193 } 460 /* ---------------------------------------------------------- */ 461 IMAGE_EXPORT(void) set_rgbx8vector_j(rgbx8 *v, long nl, long nh) 462 /* ---------------------------------------------------------- */ 463 { 464 int i; 465 466 for(i=nl; i<=nh; i++) { 467 v[i].r = (uint8) i; 194 195 196 void set_rgbx8vector_j(rgbx8 * v, int32_t nl, int32_t nh) 197 { 198 for (int32_t i = nl; i <= nh; i++) { 199 v[i].r = (uint8) i; 468 200 v[i].g = (uint8) i; 469 201 v[i].b = (uint8) i; … … 472 204 } 473 205 206 474 207 /* 475 208 * ---------------------- … … 478 211 */ 479 212 480 /* --------------------------------------------------------------------- */ 481 IMAGE_EXPORT(void) set_si8vector_str(sint8 *v, long nl, long nh, char *str) 482 /* --------------------------------------------------------------------- */ 483 { 484 int i; 485 char c[1]; 486 for(i=nl; i<=nh; i++) { 487 488 *c = *str++; 489 if(isdigit(*c)) 490 v[i] = (sint8) atoi(c); 491 else 492 v[i] = (sint8) 0; 493 } 494 } 495 /* --------------------------------------------------------------------- */ 496 IMAGE_EXPORT(void) set_ui8vector_str(uint8 *v, long nl, long nh, char *str) 497 /* --------------------------------------------------------------------- */ 498 { 499 // @QM 500 int i; 501 char c[2]; 502 c[1] = '\0'; 503 for (i = nl; i <= nh; i++) { 504 c[0] = *str++; 505 if (isdigit(c[0])) { 506 v[i] = (uint8) atoi(c); 507 } 508 else { 509 v[i] = (uint8) 0; 510 } 511 } 512 } 513 /* ----------------------------------------------------------------------- */ 514 IMAGE_EXPORT(void) set_si16vector_str(sint16 *v, long nl, long nh, char *str) 515 /* ----------------------------------------------------------------------- */ 516 { 517 int i; 518 char c[1]; 519 for(i=nl; i<=nh; i++) { 520 521 *c = *str++; 522 if(isdigit(*c)) 523 v[i] = (sint16) atoi(c); 524 else 525 v[i] = (sint16) 0; 526 } 527 } 528 /* ----------------------------------------------------------------------- */ 529 IMAGE_EXPORT(void) set_ui16vector_str(uint16 *v, long nl, long nh, char *str) 530 /* ----------------------------------------------------------------------- */ 531 { 532 int i; 533 char c[1]; 534 for(i=nl; i<=nh; i++) { 535 536 *c = *str++; 537 if(isdigit(*c)) 538 v[i] = (uint16) atoi(c); 539 else 540 v[i] = (uint16) 0; 541 } 542 } 543 /* ----------------------------------------------------------------------- */ 544 IMAGE_EXPORT(void) set_si32vector_str(sint32 *v, long nl, long nh, char *str) 545 /* ----------------------------------------------------------------------- */ 546 { 547 int i; 548 char c[1]; 549 for(i=nl; i<=nh; i++) { 550 551 *c = *str++; 552 if(isdigit(*c)) 553 v[i] = (sint32) atoi(c); 554 else 555 v[i] = (sint32) 0; 556 } 557 } 558 /* ----------------------------------------------------------------------- */ 559 IMAGE_EXPORT(void) set_ui32vector_str(uint32 *v, long nl, long nh, char *str) 560 /* ----------------------------------------------------------------------- */ 561 { 562 int i; 563 char c[1]; 564 for(i=nl; i<=nh; i++) { 565 566 *c = *str++; 567 if(isdigit(*c)) 568 v[i] = (uint32) atoi(c); 569 else 570 v[i] = (uint32) 0; 571 } 572 } 213 214 #undef set_type_vector_str 215 #define set_type_vector_str(t) \ 216 void short_name(t,set_,vector_str)(t * v, int32_t nl, int32_t nh, char * str) \ 217 { \ 218 char c[2]; \ 219 c[1] = '\0'; \ 220 for (int32_t i = nl; i <= nh; i++) { \ 221 c[0] = *str++; \ 222 if (isdigit(c[0])) { \ 223 v[i] = (t) atoi(c); \ 224 } \ 225 else { \ 226 v[i] = (t) 0; \ 227 } \ 228 } \ 229 } 230 231 set_type_vector_str(int8_t); 232 set_type_vector_str(uint8_t); 233 set_type_vector_str(int16_t); 234 set_type_vector_str(uint16_t); 235 set_type_vector_str(int32_t); 236 set_type_vector_str(uint32_t); 237 set_type_vector_str(int64_t); 238 set_type_vector_str(uint64_t); 239 240 241 // Local Variables: 242 // tab-width: 4 243 // c-basic-offset: 4 244 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 245 // indent-tabs-mode: nil 246 // End: 247 248 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 249 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrset2.c
r772 r826 16 16 #include <stddef.h> 17 17 #include <stdlib.h> 18 #include <math.h> // fabs19 18 20 19 #include "mypredef.h" … … 33 32 */ 34 33 35 /* ---------------------------------------------------------------------- */ 36 IMAGE_EXPORT(void) zero_si8matrix(sint8 **m, int i0, int i1, int j0, int j1) 37 /* ---------------------------------------------------------------------- */ 38 { 39 int i; 40 for(i=i0; i<=i1; i++) { 41 zero_si8vector(m[i], j0, j1); 42 } 43 } 44 /* ---------------------------------------------------------------------- */ 45 IMAGE_EXPORT(void) zero_ui8matrix(uint8 **m, int i0, int i1, int j0, int j1) 46 /* ---------------------------------------------------------------------- */ 47 { 48 int i; 49 for(i=i0; i<=i1; i++) { 50 zero_ui8vector(m[i], j0, j1); 51 } 52 } 53 /* ------------------------------------------------------------------------ */ 54 IMAGE_EXPORT(void) zero_si16matrix(sint16 **m, int i0, int i1, int j0, int j1) 55 /* ------------------------------------------------------------------------ */ 56 { 57 int i; 58 for(i=i0; i<=i1; i++) { 59 zero_si16vector(m[i], j0, j1); 60 } 61 } 62 /* ------------------------------------------------------------------------ */ 63 IMAGE_EXPORT(void) zero_ui16matrix(uint16 **m, int i0, int i1, int j0, int j1) 64 /* ------------------------------------------------------------------------ */ 65 { 66 int i; 67 for(i=i0; i<=i1; i++) { 68 zero_ui16vector(m[i], j0, j1); 69 } 70 } 71 /* ------------------------------------------------------------------------ */ 72 IMAGE_EXPORT(void) zero_si32matrix(sint32 **m, int i0, int i1, int j0, int j1) 73 /* ------------------------------------------------------------------------ */ 74 { 75 int i; 76 for(i=i0; i<=i1; i++) { 77 zero_si32vector(m[i], j0, j1); 78 } 79 } 80 /* ------------------------------------------------------------------------ */ 81 IMAGE_EXPORT(void) zero_ui32matrix(uint32 **m, int i0, int i1, int j0, int j1) 82 /* ------------------------------------------------------------------------ */ 83 { 84 int i; 85 for(i=i0; i<=i1; i++) { 86 zero_ui32vector(m[i], j0, j1); 87 } 88 } 89 /* ------------------------------------------------------------------------ */ 90 IMAGE_EXPORT(void) zero_si64matrix(sint64 **m, int i0, int i1, int j0, int j1) 91 /* ------------------------------------------------------------------------ */ 92 { 93 int i; 94 for(i=i0; i<=i1; i++) { 95 zero_si64vector(m[i], j0, j1); 96 } 97 } 98 /* ------------------------------------------------------------------------ */ 99 IMAGE_EXPORT(void) zero_ui64matrix(uint64 **m, int i0, int i1, int j0, int j1) 100 /* ------------------------------------------------------------------------ */ 101 { 102 int i; 103 for(i=i0; i<=i1; i++) { 104 zero_ui64vector(m[i], j0, j1); 105 } 106 } 107 /* ------------------------------------------------------------------------ */ 108 IMAGE_EXPORT(void) zero_f32matrix(float32 **m, int i0, int i1, int j0, int j1) 109 /* ------------------------------------------------------------------------ */ 110 { 111 int i; 112 for(i=i0; i<=i1; i++) { 113 zero_f32vector(m[i], j0, j1); 114 } 115 } 116 /* ------------------------------------------------------------------------ */ 117 IMAGE_EXPORT(void) zero_f64matrix(float64 **m, int i0, int i1, int j0, int j1) 118 /* ------------------------------------------------------------------------ */ 119 { 120 int i; 121 for(i=i0; i<=i1; i++) { 122 zero_f64vector(m[i], j0, j1); 123 } 124 } 125 /* ---------------------------------------------------------------------- */ 126 IMAGE_EXPORT(void) zero_rgb8matrix(rgb8 **m, int i0, int i1, int j0, int j1) 127 /* ---------------------------------------------------------------------- */ 128 { 129 int i; 130 for(i=i0; i<=i1; i++) { 131 zero_rgb8vector(m[i], j0, j1); 132 } 133 } 134 /* ------------------------------------------------------------------------ */ 135 IMAGE_EXPORT(void) zero_rgbx8matrix(rgbx8 **m, int i0, int i1, int j0, int j1) 136 /* ------------------------------------------------------------------------ */ 137 { 138 int i; 139 for(i=i0; i<=i1; i++) { 140 zero_rgbx8vector(m[i], j0, j1); 141 } 142 } 34 35 #undef zero_type_matrix 36 #define zero_type_matrix(t) \ 37 void short_name(t,zero_,matrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 38 { \ 39 for (int32_t i = i0; i <= i1; i++) { \ 40 short_name(t,zero_,vector)(m[i], j0, j1); \ 41 } \ 42 } 43 44 zero_type_matrix(int8_t); 45 zero_type_matrix(uint8_t); 46 zero_type_matrix(int16_t); 47 zero_type_matrix(uint16_t); 48 zero_type_matrix(int32_t); 49 zero_type_matrix(uint32_t); 50 zero_type_matrix(int64_t); 51 zero_type_matrix(uint64_t); 52 zero_type_matrix(float); 53 zero_type_matrix(double); 54 zero_type_matrix(rgb8); 55 zero_type_matrix(rgbx8); 56 143 57 /* 144 58 * ------------------ … … 147 61 */ 148 62 149 /* ------------------------------------------------------------------------------ */ 150 IMAGE_EXPORT(void) set_si8matrix(sint8 **m, int i0, int i1, int j0, int j1, sint8 x) 151 /* ------------------------------------------------------------------------------ */ 152 { 153 int i; 154 for(i=i0; i<=i1; i++) 155 set_si8vector(m[i], j0, j1, x); 156 } 157 /* ------------------------------------------------------------------------------ */ 158 IMAGE_EXPORT(void) set_ui8matrix(uint8 **m, int i0, int i1, int j0, int j1, uint8 x) 159 /* ------------------------------------------------------------------------------ */ 160 { 161 int i; 162 for(i=i0; i<=i1; i++) 163 set_ui8vector(m[i], j0, j1, x); 164 } 165 /* --------------------------------------------------------------------------------- */ 166 IMAGE_EXPORT(void) set_si16matrix(sint16 **m, int i0, int i1, int j0, int j1, sint16 x) 167 /* --------------------------------------------------------------------------------- */ 168 { 169 int i; 170 for(i=i0; i<=i1; i++) 171 set_si16vector(m[i], j0, j1, x); 172 } 173 /* --------------------------------------------------------------------------------- */ 174 IMAGE_EXPORT(void) set_ui16matrix(uint16 **m, int i0, int i1, int j0, int j1, uint16 x) 175 /* --------------------------------------------------------------------------------- */ 176 { 177 int i; 178 for(i=i0; i<=i1; i++) 179 set_ui16vector(m[i], j0, j1, x); 180 } 181 /* --------------------------------------------------------------------------------- */ 182 IMAGE_EXPORT(void) set_si32matrix(sint32 **m, int i0, int i1, int j0, int j1, sint32 x) 183 /* --------------------------------------------------------------------------------- */ 184 { 185 int i; 186 for(i=i0; i<=i1; i++) 187 set_si32vector(m[i], j0, j1, x); 188 } 189 /* --------------------------------------------------------------------------------- */ 190 IMAGE_EXPORT(void) set_ui32matrix(uint32 **m, int i0, int i1, int j0, int j1, uint32 x) 191 /* --------------------------------------------------------------------------------- */ 192 { 193 int i; 194 for(i=i0; i<=i1; i++) 195 set_ui32vector(m[i], j0, j1, x); 196 } 197 /* --------------------------------------------------------------------------------- */ 198 IMAGE_EXPORT(void) set_f32matrix(float32 **m, int i0, int i1,int j0, int j1, float32 x) 199 /* --------------------------------------------------------------------------------- */ 200 { 201 int i; 202 for(i=i0; i<=i1; i++) 203 set_f32vector(m[i], j0, j1, x); 204 } 205 /* --------------------------------------------------------------------------------- */ 206 IMAGE_EXPORT(void) set_f64matrix(float64 **m,int i0, int i1, int j0, int j1, float64 x) 207 /* --------------------------------------------------------------------------------- */ 208 { 209 int i; 210 for(i=i0; i<=i1; i++) 211 set_f64vector(m[i], j0, j1, x); 212 } 213 /* ---------------------------------------------------------------------------- */ 214 IMAGE_EXPORT(void) set_rgb8matrix(rgb8 **m,int i0, int i1, int j0, int j1, rgb8 x) 215 /* ---------------------------------------------------------------------------- */ 216 { 217 int i; 218 for(i=i0; i<=i1; i++) 219 set_rgb8vector(m[i], j0, j1, x); 220 } 221 /* ----------------------------------------------------------------------------- */ 222 IMAGE_EXPORT(void) set_rgbx8matrix(rgbx8 **m,int i0,int i1,int j0, int j1, rgbx8 x) 223 /* ----------------------------------------------------------------------------- */ 224 { 225 int i; 226 for(i=i0; i<=i1; i++) 227 set_rgbx8vector(m[i], j0, j1, x); 228 } 63 #undef set_type_matrix 64 #define set_type_matrix(t) \ 65 void short_name(t,set_,matrix)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x) \ 66 { \ 67 for (int32_t i = i0; i <= i1; i++) { \ 68 short_name(t,set_,vector)(m[i], j0, j1, x); \ 69 } \ 70 } 71 72 set_type_matrix(int8_t); 73 set_type_matrix(uint8_t); 74 set_type_matrix(int16_t); 75 set_type_matrix(uint16_t); 76 set_type_matrix(int32_t); 77 set_type_matrix(uint32_t); 78 set_type_matrix(int64_t); 79 set_type_matrix(uint64_t); 80 set_type_matrix(float); 81 set_type_matrix(double); 82 set_type_matrix(rgb8); 83 set_type_matrix(rgbx8); 84 85 86 229 87 /* 230 88 * ---------------- … … 232 90 * ---------------- 233 91 */ 234 /* ------------------------------------------------------------------------------------------------ */ 235 void set_ui8matrix_param(uint8 **m, int i0, int i1, int j0, int j1, uint8 x, uint8 xstep, uint8 ystep) 236 /* ------------------------------------------------------------------------------------------------ */ 237 { 238 int i; 239 for(i=i0; i<=i1; i++) { 240 set_ui8vector_param(m[i], j0, j1, x, xstep); 241 x += ystep; 242 } 243 } 244 /* -------------------------------------------------------------------------------------------------- */ 245 void set_si8matrix_param(sint8 **m, int i0, int i1, int j0, int j1, sint8 x, sint8 xstep, sint8 ystep) 246 /* -------------------------------------------------------------------------------------------------- */ 247 { 248 int i; 249 for(i=i0; i<=i1; i++) { 250 set_si8vector_param(m[i], j0, j1, x, xstep); 251 x += ystep; 252 } 253 } 254 /* ----------------------------------------------------------------------------------------------------- */ 255 void set_ui16matrix_param(uint16 **m, int i0, int i1, int j0, int j1, uint16 x, uint16 xstep, uint16 ystep) 256 /* ----------------------------------------------------------------------------------------------------- */ 257 { 258 int i; 259 for(i=i0; i<=i1; i++) { 260 set_ui16vector_param(m[i], j0, j1, x, xstep); 261 x += ystep; 262 } 263 } 264 /* ----------------------------------------------------------------------------------------------------- */ 265 void set_si16matrix_param(sint16 **m, int i0, int i1, int j0, int j1, sint16 x, sint16 xstep, sint16 ystep) 266 /* ----------------------------------------------------------------------------------------------------- */ 267 { 268 int i; 269 for(i=i0; i<=i1; i++) { 270 set_si16vector_param(m[i], j0, j1, x, xstep); 271 x += ystep; 272 } 273 } 274 /* ----------------------------------------------------------------------------------------------------- */ 275 void set_ui32matrix_param(uint32 **m, int i0, int i1, int j0, int j1, uint32 x, uint32 xstep, uint32 ystep) 276 /* ----------------------------------------------------------------------------------------------------- */ 277 { 278 int i; 279 for(i=i0; i<=i1; i++) { 280 set_ui32vector_param(m[i], j0, j1, x, xstep); 281 x += ystep; 282 } 283 } 284 /* ----------------------------------------------------------------------------------------------------- */ 285 void set_si32matrix_param(sint32 **m, int i0, int i1, int j0, int j1, sint32 x, sint32 xstep, sint32 ystep) 286 /* ----------------------------------------------------------------------------------------------------- */ 287 { 288 int i; 289 for(i=i0; i<=i1; i++) { 290 set_si32vector_param(m[i], j0, j1, x, xstep); 291 x += ystep; 292 } 293 } 294 /* ----------------------------------------------------------------------------------------------------- */ 295 void set_ui64matrix_param(uint64 **m, int i0, int i1, int j0, int j1, uint64 x, uint64 xstep, uint64 ystep) 296 /* ----------------------------------------------------------------------------------------------------- */ 297 { 298 int i; 299 for(i=i0; i<=i1; i++) { 300 set_ui64vector_param(m[i], j0, j1, x, xstep); 301 x += ystep; 302 } 303 } 304 /* ----------------------------------------------------------------------------------------------------- */ 305 void set_si64matrix_param(sint64 **m, int i0, int i1, int j0, int j1, sint64 x, sint64 xstep, sint64 ystep) 306 /* ----------------------------------------------------------------------------------------------------- */ 307 { 308 int i; 309 for(i=i0; i<=i1; i++) { 310 set_si64vector_param(m[i], j0, j1, x, xstep); 311 x += ystep; 312 } 313 } 314 /* -------------------------------------------------------------------------------------------------------- */ 315 void set_f32matrix_param(float32 **m, int i0, int i1, int j0, int j1, float32 x, float32 xstep, float32 ystep) 316 /* -------------------------------------------------------------------------------------------------------- */ 317 { 318 int i; 319 for(i=i0; i<=i1; i++) { 320 set_f32vector_param(m[i], j0, j1, x, xstep); 321 x += ystep; 322 } 323 } 324 /* -------------------------------------------------------------------------------------------------------- */ 325 void set_f64matrix_param(float64 **m, int i0, int i1, int j0, int j1, float64 x, float64 xstep, float64 ystep) 326 /* -------------------------------------------------------------------------------------------------------- */ 327 { 328 int i; 329 for(i=i0; i<=i1; i++) { 330 set_f64vector_param(m[i], j0, j1, x, xstep); 331 x += ystep; 332 } 333 } 334 /* --------------------------------------------------------------------------------------------- */ 335 void set_rgb8matrix_param(rgb8 **m, int i0, int i1, int j0, int j1, rgb8 x, rgb8 xstep, rgb8 ystep) 336 /* --------------------------------------------------------------------------------------------- */ 337 { 338 int i; 339 for(i=i0; i<=i1; i++) { 92 93 #undef set_type_matrix_param 94 #define set_type_matrix_param(t) \ 95 void short_name(t,set_,matrix_param)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x, t xstep, t ystep) \ 96 { \ 97 for (int32_t i = i0; i <= i1; i++) { \ 98 short_name(t,set_,vector_param)(m[i], j0, j1, x, xstep); \ 99 x += ystep; \ 100 } \ 101 } 102 103 set_type_matrix_param(int8_t); 104 set_type_matrix_param(uint8_t); 105 set_type_matrix_param(int16_t); 106 set_type_matrix_param(uint16_t); 107 set_type_matrix_param(int32_t); 108 set_type_matrix_param(uint32_t); 109 set_type_matrix_param(int64_t); 110 set_type_matrix_param(uint64_t); 111 set_type_matrix_param(float); 112 set_type_matrix_param(double); 113 114 115 void set_rgb8matrix_param(rgb8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, rgb8 x, rgb8 xstep, rgb8 ystep) 116 { 117 for (int32_t i = i0; i <= i1; i++) { 340 118 set_rgb8vector_param(m[i], j0, j1, x, xstep); 341 119 x.r += ystep.r; … … 344 122 } 345 123 } 346 /* -------------------------------------------------------------------------------------------------- */ 347 void set_rgbx8matrix_param(rgbx8 **m, int i0, int i1, int j0, int j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep) 348 /* -------------------------------------------------------------------------------------------------- */ 349 { 350 int i; 351 124 125 void set_rgbx8matrix_param(rgbx8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep) 126 { 352 127 x.x = 0; 353 for (i=i0; i<=i1; i++) {128 for (int32_t i = i0; i <= i1; i++) { 354 129 set_rgbx8vector_param(m[i], j0, j1, x, xstep); 355 130 x.r += ystep.r; 356 131 x.g += ystep.g; 357 132 x.b += ystep.b; 358 133 x.x += ystep.x; 359 134 } 360 135 } 136 137 361 138 /* 362 139 * -------------------- … … 364 141 * -------------------- 365 142 */ 366 /* ----------------------------------------------------------------------- */ 367 IMAGE_EXPORT(void) set_si8matrix_i(sint8 **m, int i0, int i1, int j0, int j1) 368 /* ----------------------------------------------------------------------- */ 369 { 370 set_si8matrix_param(m, i0, i1, j0, j1, i0,0, 1); 371 } 372 /* ----------------------------------------------------------------------- */ 373 IMAGE_EXPORT(void) set_ui8matrix_i(uint8 **m, int i0, int i1, int j0, int j1) 374 /* ----------------------------------------------------------------------- */ 375 { 376 set_ui8matrix_param(m, i0, i1, j0, j1, i0,0, 1); 377 } 378 /* ------------------------------------------------------------------------- */ 379 IMAGE_EXPORT(void) set_si16matrix_i(sint16 **m, int i0, int i1, int j0, int j1) 380 /* ------------------------------------------------------------------------- */ 381 { 382 set_si16matrix_param(m, i0, i1, j0, j1, i0,0, 1); 383 } 384 /* ------------------------------------------------------------------------- */ 385 IMAGE_EXPORT(void) set_ui16matrix_i(uint16 **m, int i0, int i1, int j0, int j1) 386 /* ------------------------------------------------------------------------- */ 387 { 388 set_ui16matrix_param(m, i0, i1, j0, j1, i0,0, 1); 389 } 390 /* ------------------------------------------------------------------------- */ 391 IMAGE_EXPORT(void) set_si32matrix_i(sint32 **m, int i0, int i1, int j0, int j1) 392 /* ------------------------------------------------------------------------- */ 393 { 394 set_si32matrix_param(m, i0, i1, j0, j1, i0,0, 1); 395 } 396 /* ------------------------------------------------------------------------- */ 397 IMAGE_EXPORT(void) set_ui32matrix_i(uint32 **m, int i0, int i1, int j0, int j1) 398 /* ------------------------------------------------------------------------- */ 399 { 400 set_ui32matrix_param(m, i0, i1, j0, j1, i0,0, 1); 401 } 402 /* ------------------------------------------------------------------------- */ 403 IMAGE_EXPORT(void) set_si64matrix_i(sint64 **m, int i0, int i1, int j0, int j1) 404 /* ------------------------------------------------------------------------- */ 405 { 406 set_si64matrix_param(m, i0, i1, j0, j1, i0,0, 1); 407 } 408 /* ------------------------------------------------------------------------- */ 409 IMAGE_EXPORT(void) set_ui64matrix_i(uint64 **m, int i0, int i1, int j0, int j1) 410 /* ------------------------------------------------------------------------- */ 411 { 412 set_ui64matrix_param(m, i0, i1, j0, j1, i0,0, 1); 413 } 414 /* ------------------------------------------------------------------------- */ 415 IMAGE_EXPORT(void) set_f32matrix_i(float32 **m, int i0, int i1, int j0, int j1) 416 /* ------------------------------------------------------------------------- */ 417 { 418 set_f32matrix_param(m, i0, i1, j0, j1, (float32) i0, (float32)0, (float32)1); 419 } 420 /* ------------------------------------------------------------------------- */ 421 IMAGE_EXPORT(void) set_f64matrix_i(float64 **m, int i0, int i1, int j0, int j1) 422 /* ------------------------------------------------------------------------- */ 423 { 424 set_f64matrix_param(m, i0, i1, j0, j1, i0,(float64)0, (float64)1); 425 } 426 /* ----------------------------------------------------------------------- */ 427 IMAGE_EXPORT(void) set_rgb8matrix_i(rgb8 **m, int i0, int i1, int j0, int j1) 428 /* ----------------------------------------------------------------------- */ 429 { 430 rgb8 x0, xstep, ystep; 143 144 #undef set_type_matrix_i 145 #define set_type_matrix_i(t) \ 146 void short_name(t,set_,matrix_i)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 147 { \ 148 short_name(t,set_,matrix_param)(m, i0, i1, j0, j1, i0, 0, 1); \ 149 } 150 151 set_type_matrix_i(int8_t); 152 set_type_matrix_i(uint8_t); 153 set_type_matrix_i(int16_t); 154 set_type_matrix_i(uint16_t); 155 set_type_matrix_i(int32_t); 156 set_type_matrix_i(uint32_t); 157 set_type_matrix_i(int64_t); 158 set_type_matrix_i(uint64_t); 159 set_type_matrix_i(float); 160 set_type_matrix_i(double); 161 162 163 void set_rgb8matrix_i(rgb8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 164 { 165 rgb8 x0; 166 rgb8 xstep; 167 rgb8 ystep; 431 168 432 169 x0.r = x0.g = x0.b = i0; … … 436 173 set_rgb8matrix_param(m, i0, i1, j0, j1, x0, xstep, ystep); 437 174 } 438 /* ------------------------------------------------------------------------- */ 439 IMAGE_EXPORT(void) set_rgbx8matrix_i(rgbx8 **m, int i0, int i1, int j0, int j1) 440 /* ------------------------------------------------------------------------- */ 441 { 442 rgbx8 x, xstep, ystep; 443 444 x.r = x.g = x.b = i0; x.x = 255; 445 xstep.r = xstep.g = xstep.b = 0; xstep.x = 255; 446 ystep.r = ystep.g = ystep.b = 1; ystep.x = 255; 175 176 177 void set_rgbx8matrix_i(rgbx8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 178 { 179 rgbx8 x; 180 rgbx8 xstep; 181 rgbx8 ystep; 182 183 x.r = x.g = x.b = i0; 184 x.x = 255; 185 xstep.r = xstep.g = xstep.b = 0; 186 xstep.x = 255; 187 ystep.r = ystep.g = ystep.b = 1; 188 ystep.x = 255; 447 189 448 190 set_rgbx8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); 449 191 } 192 193 450 194 /* 451 195 * -------------------- … … 453 197 * -------------------- 454 198 */ 455 /* ----------------------------------------------------------------------- */ 456 IMAGE_EXPORT(void) set_si8matrix_j(sint8 **m, int i0, int i1, int j0, int j1) 457 /* ----------------------------------------------------------------------- */ 458 { 459 set_si8matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 460 } 461 /* ----------------------------------------------------------------------- */ 462 IMAGE_EXPORT(void) set_ui8matrix_j(uint8 **m, int i0, int i1, int j0, int j1) 463 /* ----------------------------------------------------------------------- */ 464 { 465 set_ui8matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 466 } 467 /* ------------------------------------------------------------------------- */ 468 IMAGE_EXPORT(void) set_si16matrix_j(sint16 **m, int i0, int i1, int j0, int j1) 469 /* ------------------------------------------------------------------------- */ 470 { 471 set_si16matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 472 } 473 /* ------------------------------------------------------------------------- */ 474 IMAGE_EXPORT(void) set_ui16matrix_j(uint16 **m, int i0, int i1, int j0, int j1) 475 /* ------------------------------------------------------------------------- */ 476 { 477 set_ui16matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 478 } 479 /* ------------------------------------------------------------------------- */ 480 IMAGE_EXPORT(void) set_si32matrix_j(sint32 **m, int i0, int i1, int j0, int j1) 481 /* ------------------------------------------------------------------------- */ 482 { 483 set_si32matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 484 } 485 /* ------------------------------------------------------------------------- */ 486 IMAGE_EXPORT(void) set_ui32matrix_j(uint32 **m, int i0, int i1, int j0, int j1) 487 /* ------------------------------------------------------------------------- */ 488 { 489 set_ui32matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 490 } 491 /* ------------------------------------------------------------------------- */ 492 IMAGE_EXPORT(void) set_si64matrix_j(sint64 **m, int i0, int i1, int j0, int j1) 493 /* ------------------------------------------------------------------------- */ 494 { 495 set_si64matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 496 } 497 /* ------------------------------------------------------------------------- */ 498 IMAGE_EXPORT(void) set_ui64matrix_j(uint64 **m, int i0, int i1, int j0, int j1) 499 /* ------------------------------------------------------------------------- */ 500 { 501 set_ui64matrix_param(m, i0, i1, j0, j1, j0, 1, 0); 502 } 503 /* ------------------------------------------------------------------------- */ 504 IMAGE_EXPORT(void) set_f32matrix_j(float32 **m, int i0, int i1, int j0, int j1) 505 /* ------------------------------------------------------------------------- */ 506 { 507 set_f32matrix_param(m, i0, i1, j0, j1, (float32)j0,(float32)1, (float32)0); 508 } 509 /* ------------------------------------------------------------------------- */ 510 IMAGE_EXPORT(void) set_f64matrix_j(float64 **m, int i0, int i1, int j0, int j1) 511 /* ------------------------------------------------------------------------- */ 512 { 513 set_f64matrix_param(m, i0, i1, j0, j1, j0,(float64)1, (float64)0); 514 } 515 /* ----------------------------------------------------------------------- */ 516 IMAGE_EXPORT(void) set_rgb8matrix_j(rgb8 **m, int i0, int i1, int j0, int j1) 517 /* ----------------------------------------------------------------------- */ 518 { 519 rgb8 x, xstep, ystep; 520 521 x.r = x.g = x.b = j0; 199 200 #undef set_type_matrix_j 201 #define set_type_matrix_j(t) \ 202 void short_name(t,set_,matrix_j)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 203 { \ 204 short_name(t,set_,matrix_param)(m, i0, i1, j0, j1, j0, 1, 0); \ 205 } 206 207 set_type_matrix_j(int8_t); 208 set_type_matrix_j(uint8_t); 209 set_type_matrix_j(int16_t); 210 set_type_matrix_j(uint16_t); 211 set_type_matrix_j(int32_t); 212 set_type_matrix_j(uint32_t); 213 set_type_matrix_j(int64_t); 214 set_type_matrix_j(uint64_t); 215 set_type_matrix_j(float); 216 set_type_matrix_j(double); 217 218 219 220 void set_rgb8matrix_j(rgb8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 221 { 222 rgb8 x; 223 rgb8 xstep; 224 rgb8 ystep; 225 226 x.r = x.g = x.b = j0; 522 227 xstep.r = xstep.g = xstep.b = 1; 523 228 ystep.r = ystep.g = ystep.b = 0; … … 525 230 set_rgb8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); 526 231 } 527 /* ------------------------------------------------------------------------- */ 528 IMAGE_EXPORT(void) set_rgbx8matrix_j(rgbx8 **m, int i0, int i1, int j0, int j1) 529 /* ------------------------------------------------------------------------- */ 232 233 void set_rgbx8matrix_j(rgbx8 ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1) 530 234 { 531 235 rgbx8 x, xstep, ystep; 532 236 533 x.r = x.g = x.b = j0; x.x = 255; 534 xstep.r = xstep.g = xstep.b = 1; xstep.x = 255; 535 ystep.r = ystep.g = ystep.b = 0; ystep.x = 255; 237 x.r = x.g = x.b = j0; 238 x.x = 255; 239 xstep.r = xstep.g = xstep.b = 1; 240 xstep.x = 255; 241 ystep.r = ystep.g = ystep.b = 0; 242 ystep.x = 255; 536 243 537 244 set_rgbx8matrix_param(m, i0, i1, j0, j1, x, xstep, ystep); 538 }/* 245 } 246 247 /* 539 248 * -------------- 540 249 * --- autres --- 541 250 * -------------- 542 251 */ 543 /* ------------------------------------------------------------------------------------ */ 544 IMAGE_EXPORT(void) set_ui8matrix_border1(uint8 **m,int i0, int i1, int j0, int j1, uint8 x) 545 /* ------------------------------------------------------------------------------------- */ 546 { 547 int i; 548 549 set_ui8vector(m[i0], j0, j1, x); 550 551 for(i=i0+1; i<=i1-1; i++) { 552 m[i][j0] = x; 553 m[i][j1] = x; 554 } 555 556 set_ui8vector(m[i0], j0, j1, x); 557 } 558 /* --------------------------------------------------------------------------------------- */ 559 IMAGE_EXPORT(void) set_ui8matrix_border(uint8 **m,int i0,int i1,int j0, int j1, int n, uint8 x) 560 /* --------------------------------------------------------------------------------------- */ 561 { 562 int i, j; 563 uint8 *Xi=NULL; 564 565 for(i=i0; i<i0+n; i++) { 566 Xi = m[i]; 567 for(j=j0; j<=j1; j++) { 568 Xi[j] = x; 569 } 570 } 571 572 for(i=i0+n; i<i1; i++) { 573 Xi = m[i]; 574 for(j=0; j<n; j++) { 575 Xi[j0+j] = x; 576 Xi[j1-j] = x; 577 } 578 } 579 580 for(i=i1-n+1; i<=i1; i++) { 581 Xi = m[i]; 582 for(j=j0; j<=j1; j++) { 583 Xi[j] = x; 584 } 585 } 586 } 252 253 #undef set_type_matrix_border1 254 #define set_type_matrix_border1(t) \ 255 void short_name(t,set_,matrix_border1)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x) \ 256 { \ 257 short_name(t,set_,vector)(m[i0], j0, j1, x); \ 258 for (int32_t i = i0 + 1; i <= i1 - 1; i++) { \ 259 m[i][j0] = x; \ 260 m[i][j1] = x; \ 261 } \ 262 short_name(t,set_,vector)(m[i0], j0, j1, x); \ 263 } 264 265 266 set_type_matrix_border1(int8_t); 267 set_type_matrix_border1(uint8_t); 268 set_type_matrix_border1(int16_t); 269 set_type_matrix_border1(uint16_t); 270 set_type_matrix_border1(int32_t); 271 set_type_matrix_border1(uint32_t); 272 set_type_matrix_border1(int64_t); 273 set_type_matrix_border1(uint64_t); 274 set_type_matrix_border1(float); 275 set_type_matrix_border1(double); 276 277 278 #undef set_type_matrix_border 279 #define set_type_matrix_border(t) \ 280 void short_name(t,set_,matrix_border)(t ** m, int32_t i0, int32_t i1, int32_t j0, int32_t j1, int32_t n, t x) \ 281 { \ 282 t * Xi = NULL; \ 283 for (int32_t i = i0; i < i0 + n; i++) { \ 284 Xi = m[i]; \ 285 for (int32_t j = j0; j <= j1; j++) { \ 286 Xi[j] = x; \ 287 } \ 288 } \ 289 for (int32_t i = i0 + n; i < i1; i++) { \ 290 Xi = m[i]; \ 291 for (int32_t j = 0; j < n; j++) { \ 292 Xi[j0 + j] = x; \ 293 Xi[j1 - j] = x; \ 294 } \ 295 } \ 296 for (int32_t i = i1 - n + 1; i <= i1; i++) { \ 297 Xi = m[i]; \ 298 for (int32_t j = j0; j <= j1; j++) { \ 299 Xi[j] = x; \ 300 } \ 301 } \ 302 } 303 304 305 set_type_matrix_border(int8_t); 306 set_type_matrix_border(uint8_t); 307 set_type_matrix_border(int16_t); 308 set_type_matrix_border(uint16_t); 309 set_type_matrix_border(int32_t); 310 set_type_matrix_border(uint32_t); 311 set_type_matrix_border(int64_t); 312 set_type_matrix_border(uint64_t); 313 set_type_matrix_border(float); 314 set_type_matrix_border(double); 315 316 317 // Local Variables: 318 // tab-width: 4 319 // c-basic-offset: 4 320 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 321 // indent-tabs-mode: nil 322 // End: 323 324 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 325 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrset2x.c
r772 r826 16 16 #include <stddef.h> 17 17 #include <stdlib.h> 18 #include <math.h> // fabs19 18 20 19 #include "mypredef.h" … … 30 29 31 30 32 /* --------------------------------------------------------------------------------- */ 33 IMAGE_EXPORT(void) zero_si32Pmatrix(si32Point **m, long nrl,long nrh,long ncl,long nch) 34 /* --------------------------------------------------------------------------------- */ 35 { 36 long i,j; 37 si32Point *mi; 38 39 for(i=nrl; i<=nrh; i++) { 40 mi = m[i]; 41 for(j=ncl; j<=nch; j++) { 42 mi[j].x = 0; 43 mi[j].y = 0; 44 } 45 } 31 #undef zero_type_matrix 32 #define zero_type_matrix(t) \ 33 void short_name(t,zero_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 34 { \ 35 t * mi; \ 36 for (int32_t i = nrl; i <= nrh; i++) { \ 37 mi = m[i]; \ 38 for (int32_t j = ncl; j <= nch; j++) { \ 39 mi[j].x = 0; \ 40 mi[j].y = 0; \ 41 INIT_Z; \ 42 } \ 43 } \ 46 44 } 47 /* ------------------------------------------------------------------------------- */ 48 IMAGE_EXPORT(void) zero_f32Pmatrix(f32Point **m, long nrl,long nrh,long ncl,long nch) 49 /* ------------------------------------------------------------------------------- */ 50 { 51 long i,j; 52 f32Point *mi; 53 54 for(i=nrl; i<=nrh; i++) { 55 mi = m[i]; 56 for(j=ncl; j<=nch; j++) { 57 mi[j].x = 0; 58 mi[j].y = 0; 59 } 60 } 61 } 62 /* ----------------------------------------------------------------------------------- */ 63 IMAGE_EXPORT(void) zero_si32Tmatrix(si32Triplet **m, long nrl,long nrh,long ncl,long nch) 64 /* ----------------------------------------------------------------------------------- */ 65 { 66 long i,j; 67 si32Triplet *mi; 68 69 for(i=nrl; i<=nrh; i++) { 70 mi = m[i]; 71 for(j=ncl; j<=nch; j++) { 72 mi[j].x = 0; 73 mi[j].y = 0; 74 mi[j].z = 0; 75 } 76 } 77 } 78 /* --------------------------------------------------------------------------------- */ 79 IMAGE_EXPORT(void) zero_f32Tmatrix(f32Triplet **m, long nrl,long nrh,long ncl,long nch) 80 /* --------------------------------------------------------------------------------- */ 81 { 82 long i,j; 83 f32Triplet *mi; 84 85 for(i=nrl; i<=nrh; i++) { 86 mi = m[i]; 87 for(j=ncl; j<=nch; j++) { 88 mi[j].x = 0; 89 mi[j].y = 0; 90 mi[j].z = 0; 91 } 92 } 93 } 45 46 #define INIT_Z 47 zero_type_matrix(si16Point); 48 zero_type_matrix(ui16Point); 49 zero_type_matrix(si32Point); 50 zero_type_matrix(ui32Point); 51 zero_type_matrix(f32Point); 52 #undef INIT_Z 53 #define INIT_Z ({ mi[j].z = 0; }) 54 zero_type_matrix(si16Triplet); 55 zero_type_matrix(ui16Triplet); 56 zero_type_matrix(si32Triplet); 57 zero_type_matrix(ui32Triplet); 58 zero_type_matrix(f32Triplet); 59 60 61 62 // Local Variables: 63 // tab-width: 4 64 // c-basic-offset: 4 65 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 66 // indent-tabs-mode: nil 67 // End: 68 69 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 70 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrset3.c
r772 r826 21 21 #include "nrset3.h" 22 22 23 /* ------------------------------------------------------------------------------------- */ 24 IMAGE_EXPORT(void) zero_si8cube(sint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 25 /* ------------------------------------------------------------------------------------- */ 23 24 #undef zero_type_cube 25 #define zero_type_cube(t) \ 26 void short_name(t,zero_,cube)(t *** c, int32_t k0, int32_t k1, int32_t i0, int32_t i1, int32_t j0, int32_t j1) \ 27 { \ 28 for (int32_t k = k0; k <= k1; k++) { \ 29 short_name(t,zero_,matrix)(c[k], i0, i1, j0, j1); \ 30 } \ 31 } 32 33 zero_type_cube(int8_t); 34 zero_type_cube(uint8_t); 35 zero_type_cube(int16_t); 36 zero_type_cube(uint16_t); 37 zero_type_cube(int32_t); 38 zero_type_cube(uint32_t); 39 zero_type_cube(int64_t); 40 zero_type_cube(uint64_t); 41 zero_type_cube(float); 42 zero_type_cube(double); 43 zero_type_cube(rgb8); 44 zero_type_cube(rgbx8); 45 46 #undef set_type_cube_param 47 #define set_type_cube_param(t) \ 48 void short_name(t,set_,cube_param)(t *** c, int32_t k0, int32_t k1, int32_t i0, int32_t i1, int32_t j0, int32_t j1, t x, t xstep, t ystep, t zstep) \ 49 { \ 50 for (int32_t k = k0; k <= k1; k++) { \ 51 short_name(t,set_,matrix_param)(c[k], i0, i1, j0, j1, x, xstep, ystep); \ 52 x += zstep; \ 53 } \ 54 } 55 56 set_type_cube_param(int8_t); 57 set_type_cube_param(uint8_t); 58 set_type_cube_param(int16_t); 59 set_type_cube_param(uint16_t); 60 set_type_cube_param(int32_t); 61 set_type_cube_param(uint32_t); 62 set_type_cube_param(int64_t); 63 set_type_cube_param(uint64_t); 64 set_type_cube_param(float); 65 set_type_cube_param(double); 66 67 68 void set_rgb8cube_param(rgb8 *** c, int32_t k0, int32_t k1, int32_t i0, int32_t i1, int32_t j0, int32_t j1, rgb8 x, rgb8 xstep, rgb8 ystep, rgb8 zstep) 26 69 { 27 int k; 28 for(k=k0; k<=k1; k++) { 29 zero_si8matrix(c[k], i0, i1, j0, j1);30 70 for (int32_t k = k0; k <= k1; k++) { 71 set_rgb8matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 72 RGB8_ADD(x, xstep, x); 73 } 31 74 } 32 /* ------------------------------------------------------------------------------------- */ 33 IMAGE_EXPORT(void) zero_ui8cube(uint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 34 /* ------------------------------------------------------------------------------------- */ 75 76 void set_rgbx8cube_param(rgbx8 *** c, int32_t k0, int32_t k1, int32_t i0, int32_t i1, int32_t j0, int32_t j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep, rgbx8 zstep) 35 77 { 36 int k; 37 for(k=k0; k<=k1; k++) { 38 zero_ui8matrix(c[k], i0, i1, j0, j1);39 78 for (int32_t k = k0; k <= k1; k++) { 79 set_rgbx8matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 80 RGBX8_ADD(x, xstep, x); 81 } 40 82 } 41 /* --------------------------------------------------------------------------------------- */ 42 IMAGE_EXPORT(void) zero_si16cube(sint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 43 /* --------------------------------------------------------------------------------------- */ 44 { 45 int k; 46 for(k=k0; k<=k1; k++) { 47 zero_si16matrix(c[k], i0, i1, j0, j1); 48 } 49 } 50 /* --------------------------------------------------------------------------------------- */ 51 IMAGE_EXPORT(void) zero_ui16cube(uint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 52 /* --------------------------------------------------------------------------------------- */ 53 { 54 int k; 55 for(k=k0; k<=k1; k++) { 56 zero_ui16matrix(c[k], i0, i1, j0, j1); 57 } 58 } 59 /* --------------------------------------------------------------------------------------- */ 60 IMAGE_EXPORT(void) zero_si32cube(sint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 61 /* --------------------------------------------------------------------------------------- */ 62 { 63 int k; 64 for(k=k0; k<=k1; k++) { 65 zero_si32matrix(c[k], i0, i1, j0, j1); 66 } 67 } 68 /* ---------------------------------------------------------------------------------------- */ 69 IMAGE_EXPORT(void) zero_ui32cube( uint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 70 /* ---------------------------------------------------------------------------------------- */ 71 { 72 int k; 73 for(k=k0; k<=k1; k++) { 74 zero_ui32matrix(c[k], i0, i1, j0, j1); 75 } 76 } 77 /* --------------------------------------------------------------------------------------- */ 78 IMAGE_EXPORT(void) zero_si64cube(sint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 79 /* --------------------------------------------------------------------------------------- */ 80 { 81 int k; 82 for(k=k0; k<=k1; k++) { 83 zero_si64matrix(c[k], i0, i1, j0, j1); 84 } 85 } 86 /* --------------------------------------------------------------------------------------- */ 87 IMAGE_EXPORT(void) zero_ui64cube(uint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 88 /* --------------------------------------------------------------------------------------- */ 89 { 90 int k; 91 for(k=k0; k<=k1; k++) { 92 zero_ui64matrix(c[k], i0, i1, j0, j1); 93 } 94 } 95 /* --------------------------------------------------------------------------------------- */ 96 IMAGE_EXPORT(void) zero_f32cube(float32 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 97 /* --------------------------------------------------------------------------------------- */ 98 { 99 int k; 100 for(k=k0; k<=k1; k++) { 101 zero_f32matrix(c[k], i0, i1, j0, j1); 102 } 103 } 104 /* --------------------------------------------------------------------------------------- */ 105 IMAGE_EXPORT(void) zero_f64cube(float64 ***c, int k0, int k1, int i0, int i1, int j0, int j1) 106 /* --------------------------------------------------------------------------------------- */ 107 { 108 int k; 109 for(k=k0; k<=k1; k++) { 110 zero_f64matrix(c[k], i0, i1, j0, j1); 111 } 112 } 113 /* ------------------------------------------------------------------------------------------------------------------------------------------ */ 114 IMAGE_EXPORT(void) set_si8cube_param(sint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint8 x, sint8 xstep, sint8 ystep, sint8 zstep) 115 /* ------------------------------------------------------------------------------------------------------------------------------------------ */ 116 { 117 int k; 118 for(k=k0; k<=k1; k++) { 119 set_si8matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 120 x += zstep; 121 } 122 } 123 /* ------------------------------------------------------------------------------------------------------------------------------------------ */ 124 IMAGE_EXPORT(void) set_ui8cube_param(uint8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint8 x, uint8 xstep, uint8 ystep, uint8 zstep) 125 /* ------------------------------------------------------------------------------------------------------------------------------------------ */ 126 { 127 int k; 128 for(k=k0; k<=k1; k++) { 129 set_ui8matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 130 x += zstep; 131 } 132 } 133 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 134 IMAGE_EXPORT(void) set_si16cube_param(sint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint16 x, sint16 xstep, sint16 ystep, sint16 zstep) 135 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 136 { 137 int k; 138 for(k=k0; k<=k1; k++) { 139 set_si16matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 140 x += zstep; 141 } 142 } 143 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 144 IMAGE_EXPORT(void) set_ui16cube_param(uint16 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint16 x, uint16 xstep, uint16 ystep, uint16 zstep) 145 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 146 { 147 int k; 148 for(k=k0; k<=k1; k++) { 149 set_ui16matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 150 x += zstep; 151 } 152 } 153 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 154 IMAGE_EXPORT(void) set_si32cube_param(sint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint32 x, sint32 xstep, sint32 ystep, sint32 zstep) 155 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 156 { 157 int k; 158 for(k=k0; k<=k1; k++) { 159 set_si32matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 160 x += zstep; 161 } 162 } 163 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 164 IMAGE_EXPORT(void) set_ui32cube_param(uint32 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint32 x, uint32 xstep, uint32 ystep, uint32 zstep) 165 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 166 { 167 int k; 168 for(k=k0; k<=k1; k++) { 169 set_ui32matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 170 x += zstep; 171 } 172 } 173 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 174 IMAGE_EXPORT(void) set_si64cube_param(sint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1, sint64 x, sint64 xstep, sint64 ystep, sint64 zstep) 175 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 176 { 177 int k; 178 for(k=k0; k<=k1; k++) { 179 set_si64matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 180 x += zstep; 181 } 182 } 183 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 184 IMAGE_EXPORT(void) set_ui64cube_param(uint64 ***c, int k0, int k1, int i0, int i1, int j0, int j1, uint64 x, uint64 xstep, uint64 ystep, uint64 zstep) 185 /* ------------------------------------------------------------------------------------------------------------------------------------------------ */ 186 { 187 int k; 188 for(k=k0; k<=k1; k++) { 189 set_ui64matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 190 x += zstep; 191 } 192 } 193 /* ---------------------------------------------------------------------------------------------------------------------------------------------------- */ 194 IMAGE_EXPORT(void) set_f32cube_param(float32 ***c, int k0, int k1, int i0, int i1, int j0, int j1, float32 x, float32 xstep, float32 ystep, float32 zstep) 195 /* ---------------------------------------------------------------------------------------------------------------------------------------------------- */ 196 { 197 int k; 198 for(k=k0; k<=k1; k++) { 199 set_f32matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 200 x += zstep; 201 } 202 } 203 /* ---------------------------------------------------------------------------------------------------------------------------------------------------- */ 204 IMAGE_EXPORT(void) set_f64cube_param(float64 ***c, int k0, int k1, int i0, int i1, int j0, int j1, float64 x, float64 xstep, float64 ystep, float64 zstep) 205 /* ---------------------------------------------------------------------------------------------------------------------------------------------------- */ 206 { 207 int k; 208 for(k=k0; k<=k1; k++) { 209 set_f64matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 210 x += zstep; 211 } 212 } 213 /* --------------------------------------------------------------------------------------------------------------------------------------- */ 214 IMAGE_EXPORT(void) set_rgb8cube_param(rgb8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, rgb8 x, rgb8 xstep, rgb8 ystep, rgb8 zstep) 215 /* --------------------------------------------------------------------------------------------------------------------------------------- */ 216 { 217 int k; 218 for(k=k0; k<=k1; k++) { 219 set_rgb8matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 220 RGB8_ADD(x,xstep,x); 221 } 222 } 223 /* -------------------------------------------------------------------------------------------------------------------------------------------- */ 224 IMAGE_EXPORT(void) set_rgbx8cube_param(rgbx8 ***c, int k0, int k1, int i0, int i1, int j0, int j1, rgbx8 x, rgbx8 xstep, rgbx8 ystep, rgbx8 zstep) 225 /* -------------------------------------------------------------------------------------------------------------------------------------------- */ 226 { 227 int k; 228 for(k=k0; k<=k1; k++) { 229 set_rgbx8matrix_param(c[k], i0, i1, j0, j1, x, xstep, ystep); 230 RGBX8_ADD(x,xstep,x); 231 } 232 } 83 84 85 // Local Variables: 86 // tab-width: 4 87 // c-basic-offset: 4 88 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 89 // indent-tabs-mode: nil 90 // End: 91 92 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 93 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrsort1.c
r772 r826 16 16 #include <stddef.h> 17 17 #include <stdlib.h> 18 #include <math.h> // fabs19 18 20 19 #include "mypredef.h" … … 27 26 #include "nrsort1.h" 28 27 29 /* ------------------------------------------------------------------------------ */ 30 IMAGE_EXPORT(void) extractnz_boundaries_ui8vector(uint8 *v, long nl, long nh, long *nlnz, long *nhnz) 31 /* ------------------------------------------------------------------------------ */ 32 { 33 long left = nl, right = nh;; 34 35 while(!v[left ] && left <= nh) left++; 36 while(!v[right] && right >= nl) right--; 37 38 *nlnz = left; *nhnz = right; 39 } 40 /* ------------------------------------------------------------------------------ */ 41 IMAGE_EXPORT(void) extractnz_boundaries_si16vector(sint16 *v, long nl, long nh, long *nlnz, long *nhnz) 42 /* ------------------------------------------------------------------------------ */ 43 { 44 long left = nl, right = nh;; 45 46 while(!v[left ] && left <= nh) left++; 47 while(!v[right] && right >= nl) right--; 48 49 *nlnz = left; *nhnz = right; 50 } 51 /* --------------------------------------------------------------------------------- */ 52 IMAGE_EXPORT(void) extractnz_boundaries_ui16vector(uint16 *v, long nl, long nh, long *nlnz, long *nhnz) 53 /* --------------------------------------------------------------------------------- */ 54 { 55 long left = nl, right = nh;; 56 57 while(!v[left ] && left <= nh) left++; 58 while(!v[right] && right >= nl) right--; 59 60 *nlnz = left; *nhnz = right; 61 } 62 /* ----------------------------------------------------------------------------- */ 63 IMAGE_EXPORT(void) extractnz_boundaries_si32vector(sint32 *v, long nl, long nh, long *nlnz, long *nhnz) 64 /* ----------------------------------------------------------------------------- */ 65 { 66 long left = nl, right = nh;; 67 68 while(!v[left ] && left <= nh) left++; 69 while(!v[right] && right >= nl) right--; 70 71 *nlnz = left; *nhnz = right; 72 } 73 /* ------------------------------------------------------------------------------- */ 74 IMAGE_EXPORT(void) extractnz_boundaries_ui32vector(uint32 *v, long nl, long nh, long *nlnz, long *nhnz) 75 /* ------------------------------------------------------------------------------- */ 76 { 77 long left = nl, right = nh;; 78 79 while(!v[left ] && left <= nh) left++; 80 while(!v[right] && right >= nl) right--; 81 82 *nlnz = left; *nhnz = right; 83 } 84 /* ---------------------------------------------------------------------------------------------- */ 85 IMAGE_EXPORT(void) extractnz_boundaries_f32vector(float32 *v, long nl, long nh, long *nlnz, long *nhnz, float32 epsillon) 86 /* ---------------------------------------------------------------------------------------------- */ 87 { 88 long left = nl, right = nh;; 89 90 while(fabs(v[left ])<epsillon && left <= nh) left++; 91 while(fabs(v[right])<epsillon && right >= nl) right--; 92 93 *nlnz = left; *nhnz = right; 94 } 95 /* ------------------------------------------------------------------------------------------------- */ 96 IMAGE_EXPORT(void) extractnz_boundaries_f64vector(float64 *v, long nl, long nh, long *nlnz, long *nhnz, float64 epsillon) 97 /* ------------------------------------------------------------------------------------------------- */ 98 { 99 long left = nl, right = nh;; 100 101 while(fabs(v[left ])<epsillon && left <= nh) left++; 102 while(fabs(v[right])<epsillon && right >= nl) right--; 103 104 *nlnz = left; *nhnz = right; 105 } 106 107 /* ------------------------------------------------------------------------------------ */ 108 IMAGE_EXPORT(void) sort_index_f64vector_selection(float64 *key, long nl, long nh, int *index) 109 /* ------------------------------------------------------------------------------------ */ 110 { 111 int i, j, pos, tmp; 112 float64 x, min; 113 114 for(i=nl; i<=nh; i++) { 115 index[i] = i-nl; 116 } 117 118 for(i=nl; i<nh; i++) { 119 min = key[i]; 120 pos = i; 121 for(j=i+1; j<=nh; j++) { 122 x = key[j]; 123 if(x < min) { 124 min = x; 125 pos = j; 126 } 127 } 128 key[pos] = key[i]; 129 key[i] = min; 130 131 tmp = index[i]; 132 index[i] = index[pos]; 133 index[pos] = tmp; 134 } 135 } 136 /* ------------------------------------------------------------------------------------- */ 137 IMAGE_EXPORT(void) sort_index_ivector_selection_min(int *key, long nl, long nh, int *index) 138 /* ------------------------------------------------------------------------------------- */ 139 { 140 int i, j, pos, tmp; 141 int x, min; 142 143 for(i=nl; i<=nh; i++) { 144 //index[i] = i-nl; 145 index[i] = i;/**/ 146 } 147 148 for(i=nl; i<nh; i++) { 149 min = key[i]; 150 pos = i; 151 for(j=i+1; j<=nh; j++) { 152 x = key[j]; 153 if(x < min) { 154 min = x; 155 pos = j; 156 } 157 } 158 key[pos] = key[i]; 159 key[i] = min; 160 161 tmp = index[i]; 162 index[i] = index[pos]; 163 index[pos] = tmp; 164 } 165 } 166 /* ------------------------------------------------------------------------------------- */ 167 IMAGE_EXPORT(void) sort_index_ivector_selection_max(int *key, long nl, long nh, int *index) 168 /* ------------------------------------------------------------------------------------- */ 169 { 170 int i, j, pos, tmp; 171 int x, max; 172 173 for(i=nl; i<=nh; i++) { 174 //index[i] = i-nl; 175 index[i] = i; 176 } 177 178 for(i=nl; i<nh; i++) { 179 max = key[i]; 180 pos = i; 181 for(j=i+1; j<=nh; j++) { 182 x = key[j]; 183 if(x > max) { 184 max = x; 185 pos = j; 186 } 187 } 188 key[pos] = key[i]; 189 key[i] = max; 190 191 tmp = index[i]; 192 index[i] = index[pos]; 193 index[pos] = tmp; 194 } 195 } 196 /* -------------------------------------------------------------------------------------- */ 197 IMAGE_EXPORT(void) sort_index_vector_selection_min(float *key, long nl, long nh, int *index) 198 /* -------------------------------------------------------------------------------------- */ 199 { 200 int i, j, pos, tmp; 201 float x, min; 202 203 for(i=nl; i<=nh; i++) { 204 //index[i] = i-nl; 205 index[i] = i; 206 } 207 208 for(i=nl; i<nh; i++) { 209 min = key[i]; 210 pos = i; 211 for(j=i+1; j<=nh; j++) { 212 x = key[j]; 213 if(x < min) { 214 min = x; 215 pos = j; 216 } 217 } 218 key[pos] = key[i]; 219 key[i] = min; 220 221 tmp = index[i]; 222 index[i] = index[pos]; 223 index[pos] = tmp; 224 } 225 } 226 /* -------------------------------------------------------------------------------------- */ 227 IMAGE_EXPORT(void) sort_index_vector_selection_max(float *key, long nl, long nh, int *index) 228 /* -------------------------------------------------------------------------------------- */ 229 { 230 int i, j, pos, tmp; 231 float x, max; 232 233 for(i=nl; i<=nh; i++) { 234 //index[i] = i-nl; 235 index[i] = i; 236 } 237 238 for(i=nl; i<nh; i++) { 239 max = key[i]; 240 pos = i; 241 for(j=i+1; j<=nh; j++) { 242 x = key[j]; 243 if(x > max) { 244 max = x; 245 pos = j; 246 } 247 } 248 key[pos] = key[i]; 249 key[i] = max; 250 251 tmp = index[i]; 252 index[i] = index[pos]; 253 index[pos] = tmp; 254 } 255 } 256 /* ---------------------------------------------------------------------------------------------- */ 257 IMAGE_EXPORT(void) sort_index_vector_selection_kmin(float *key, long nl, long nh, int *index, int k) 258 /* ---------------------------------------------------------------------------------------------- */ 259 { 260 /* 261 * ATTENTION, ke tableau index DOIT etre initialise 262 */ 263 int i, j, pos, tmp, il, ih; 264 float x, min; 265 266 il = nl; 267 ih = il + k; 268 269 /*for(i=il; i<=ih; i++) { 270 index[i] = i-il; 271 }*/ 272 273 for(i=il; i<ih; i++) { 274 min = key[i]; 275 pos = i; 276 for(j=i+1; j<=nh; j++) { 277 x = key[j]; 278 if(x < min) { 279 min = x; 280 pos = j; 281 } 282 } 283 key[pos] = key[i]; 284 key[i] = min; 285 286 tmp = index[i]; 287 index[i] = index[pos]; 288 index[pos] = tmp; 289 } 290 } 291 /* --------------------------------------------------------------------------------------------- */ 292 IMAGE_EXPORT(void) sort_index_ivector_selection_kmin(int *key, long nl, long nh, int *index, int k) 293 /* --------------------------------------------------------------------------------------------- */ 294 { 295 /* 296 * ATTENTION, ke tableau index DOIT etre initialise 297 */ 298 int i, j, pos, tmp, il, ih; 299 int x, min; 300 301 il = nl; 302 ih = il + k; 303 304 /*for(i=il; i<=ih; i++) { 305 index[i] = i-il; 306 }*/ 307 308 for(i=il; i<ih; i++) { 309 min = key[i]; 310 pos = i; 311 for(j=i+1; j<=nh; j++) { 312 x = key[j]; 313 if(x < min) { 314 min = x; 315 pos = j; 316 } 317 } 318 key[pos] = key[i]; 319 key[i] = min; 320 321 tmp = index[i]; 322 index[i] = index[pos]; 323 index[pos] = tmp; 324 } 325 } 326 /* ---------------------------------------------------------------------------------------------- */ 327 IMAGE_EXPORT(void) sort_index_vector_selection_kmax(float *key, long nl, long nh, int *index, int k) 328 /* ---------------------------------------------------------------------------------------------- */ 329 { 330 /* 331 * ATTENTION, ke tableau index DOIT etre initialise 332 */ 333 int i, j, pos, tmp, il, ih; 334 float x, max; 335 336 il = nl; 337 ih = il + k; 338 339 /*for(i=il; i<=ih; i++) { 340 index[i] = i-il; 341 }*/ 342 343 for(i=il; i<ih; i++) { 344 max = key[i]; 345 pos = i; 346 for(j=i+1; j<=nh; j++) { 347 x = key[j]; 348 if(x > max) { 349 max = x; 350 pos = j; 351 } 352 } 353 key[pos] = key[i]; 354 key[i] = max; 355 356 tmp = index[i]; 357 index[i] = index[pos]; 358 index[pos] = tmp; 359 } 360 } 361 /* --------------------------------------------------------------------------------------------- */ 362 IMAGE_EXPORT(void) sort_index_ivector_selection_kmax(int *key, long nl, long nh, int *index, int k) 363 /* --------------------------------------------------------------------------------------------- */ 364 { 365 /* 366 * ATTENTION, ke tableau index DOIT etre initialise 367 */ 368 int i, j, pos, tmp, il, ih; 369 int x, max; 370 371 il = nl; 372 ih = il + k; 373 374 /*for(i=il; i<=ih; i++) { 375 index[i] = i-il; 376 }*/ 377 378 for(i=il; i<ih; i++) { 379 max = key[i]; 380 pos = i; 381 for(j=i+1; j<=nh; j++) { 382 x = key[j]; 383 if(x > max) { 384 max = x; 385 pos = j; 386 } 387 } 388 key[pos] = key[i]; 389 key[i] = max; 390 391 tmp = index[i]; 392 index[i] = index[pos]; 393 index[pos] = tmp; 394 } 395 } 396 /* ------------------------------------------------------------------ */ 397 IMAGE_EXPORT(void) sort_bvector_selection_min(byte *v, long nl, long nh) 398 /* ------------------------------------------------------------------ */ 399 { 400 int i, j; 401 int x, min, pos; 402 403 for(i=nl; i<nh; i++) { 404 min = v[i]; 405 pos = i; 406 for(j=i+1; j<=nh; j++) { 407 x = v[j]; 408 if(x < min) { 409 min = x; 410 pos = j; 411 } 412 } 413 v[pos] = v[i]; 414 v[i] = min; 415 } 416 } 417 /* -------------------------------------------------------------- */ 418 IMAGE_EXPORT(byte) select_bvector(byte *v, long nl, long nh, long k) 419 /* -------------------------------------------------------------- */ 420 { 421 int i, j, il, ih; 422 int x, min, pos; 423 424 il = nl; 425 ih = il + k; 426 427 for(i=il; i<ih; i++) { 428 min = v[i]; 429 pos = i; 430 for(j=i+1; j<=nh; j++) { 431 x = v[j]; 432 if(x < min) { 433 min = x; 434 pos = j; 435 } 436 } 437 v[pos] = v[i]; 438 v[i] = min; 439 } 440 return v[ih]; 441 } 442 /* ----------------------------------------------------------------- */ 443 IMAGE_EXPORT(rgb8) select_rgb8vector(rgb8 *v, long nl, long nh, long k) 444 /* ----------------------------------------------------------------- */ 445 { 446 int i, j, il, ih; 447 448 int rpos, gpos, bpos; 449 rgb8 xi, xj; 450 byte r,g,b; 451 byte rmin, gmin, bmin; 452 453 il = nl; 454 ih = il + k; 455 456 for(i=il; i<ih; i++) { 457 458 xi = v[i]; 459 rmin = xi.r; gmin = xi.g; bmin = xi.b; 460 rpos = gpos = bpos = i; 461 462 for(j=i+1; j<=nh; j++) { 463 xj = v[j]; 464 r = xj.r; g = xj.g; b = xj.b; 465 if(r < rmin) { rmin = r; rpos = j; } 466 if(g < gmin) { gmin = r; gpos = j; } 467 if(b < bmin) { bmin = r; bpos = j; } 468 } 469 v[rpos].r = v[i].r; v[i].r = rmin; 470 v[rpos].g = v[i].g; v[i].g = gmin; 471 v[rpos].b = v[i].b; v[i].b = bmin; 472 } 473 return v[ih]; 474 } 28 29 #undef extractnz_boundaries_type_vector 30 #define extractnz_boundaries_type_vector(t) \ 31 void short_name(t,extractnz_boundaries_,vector)(t * v, int32_t nl, int32_t nh, int32_t * nlnz, int32_t * nhnz) \ 32 { \ 33 int32_t left = nl; \ 34 int32_t right = nh; \ 35 while (!v[left] && left <= nh) { \ 36 left++; \ 37 } \ 38 while (!v[right] && right >= nl) { \ 39 right--; \ 40 } \ 41 *nlnz = left; \ 42 *nhnz = right; \ 43 } 44 45 46 extractnz_boundaries_type_vector(int8_t); 47 extractnz_boundaries_type_vector(uint8_t); 48 extractnz_boundaries_type_vector(int16_t); 49 extractnz_boundaries_type_vector(uint16_t); 50 extractnz_boundaries_type_vector(int32_t); 51 extractnz_boundaries_type_vector(uint32_t); 52 extractnz_boundaries_type_vector(int64_t); 53 extractnz_boundaries_type_vector(uint64_t); 54 extractnz_boundaries_type_vector(float); 55 extractnz_boundaries_type_vector(double); 56 57 58 59 void sort_index_f64vector_selection(double * key, int32_t nl, int32_t nh, int32_t * index) 60 { 61 int32_t pos, tmp; 62 double x, min; 63 64 for (int32_t i = nl; i<=nh; i++) { 65 index[i] = i - nl; 66 } 67 68 for (int32_t i = nl; i < nh; i++) { 69 min = key[i]; 70 pos = i; 71 for (int32_t j = i + 1; j <= nh; j++) { 72 x = key[j]; 73 if (x < min) { 74 min = x; 75 pos = j; 76 } 77 } 78 key[pos] = key[i]; 79 key[i] = min; 80 81 tmp = index[i]; 82 index[i] = index[pos]; 83 index[pos] = tmp; 84 } 85 } 86 87 void sort_index_ivector_selection_min(int32_t * key, int32_t nl, int32_t nh, int32_t * index) 88 { 89 int32_t pos, tmp; 90 int32_t x, min; 91 92 for (int32_t i = nl; i <= nh; i++) { 93 index[i] = i; 94 } 95 96 for (int32_t i = nl; i < nh; i++) { 97 min = key[i]; 98 pos = i; 99 for (int32_t j = i + 1; j <= nh; j++) { 100 x = key[j]; 101 if (x < min) { 102 min = x; 103 pos = j; 104 } 105 } 106 key[pos] = key[i]; 107 key[i] = min; 108 109 tmp = index[i]; 110 index[i] = index[pos]; 111 index[pos] = tmp; 112 } 113 } 114 115 void sort_index_ivector_selection_max(int32_t * key, int32_t nl, int32_t nh, int32_t * index) 116 { 117 int32_t pos, tmp; 118 int32_t x, max; 119 120 for (int32_t i = nl; i <= nh; i++) { 121 index[i] = i; 122 } 123 124 for (int32_t i = nl; i < nh; i++) { 125 max = key[i]; 126 pos = i; 127 for (int32_t j = i + 1; j <= nh; j++) { 128 x = key[j]; 129 if (x > max) { 130 max = x; 131 pos = j; 132 } 133 } 134 key[pos] = key[i]; 135 key[i] = max; 136 137 tmp = index[i]; 138 index[i] = index[pos]; 139 index[pos] = tmp; 140 } 141 } 142 143 void sort_index_vector_selection_min(float * key, int32_t nl, int32_t nh, int32_t * index) 144 { 145 int32_t pos, tmp; 146 float x, min; 147 148 for (int32_t i = nl; i <= nh; i++) { 149 index[i] = i; 150 } 151 152 for (int32_t i = nl; i < nh; i++) { 153 min = key[i]; 154 pos = i; 155 for (int32_t j = i + 1; j <= nh; j++) { 156 x = key[j]; 157 if (x < min) { 158 min = x; 159 pos = j; 160 } 161 } 162 key[pos] = key[i]; 163 key[i] = min; 164 165 tmp = index[i]; 166 index[i] = index[pos]; 167 index[pos] = tmp; 168 } 169 } 170 171 void sort_index_vector_selection_max(float * key, int32_t nl, int32_t nh, int32_t * index) 172 { 173 int32_t pos, tmp; 174 float x, max; 175 176 for (int32_t i = nl; i <= nh; i++) { 177 index[i] = i; 178 } 179 180 for (int32_t i = nl; i < nh; i++) { 181 max = key[i]; 182 pos = i; 183 for (int32_t j = i + 1; j <= nh; j++) { 184 x = key[j]; 185 if (x > max) { 186 max = x; 187 pos = j; 188 } 189 } 190 key[pos] = key[i]; 191 key[i] = max; 192 193 tmp = index[i]; 194 index[i] = index[pos]; 195 index[pos] = tmp; 196 } 197 } 198 199 void sort_index_vector_selection_kmin(float * key, int32_t nl, int32_t nh, int32_t * index, int32_t k) 200 { 201 /* 202 * ATTENTION, le tableau index DOIT etre initialise 203 * @QM : pourquoi est-ce commenté alors ? 204 */ 205 int32_t pos, tmp, il, ih; 206 float x, min; 207 208 il = nl; 209 ih = il + k; 210 211 /* 212 for(int32_t i = il; i <= ih; i++) { 213 index[i] = i - il; 214 } 215 */ 216 217 for (int32_t i = il; i < ih; i++) { 218 min = key[i]; 219 pos = i; 220 for (int32_t j = i + 1; j <= nh; j++) { 221 x = key[j]; 222 if (x < min) { 223 min = x; 224 pos = j; 225 } 226 } 227 key[pos] = key[i]; 228 key[i] = min; 229 230 tmp = index[i]; 231 index[i] = index[pos]; 232 index[pos] = tmp; 233 } 234 } 235 236 void sort_index_ivector_selection_kmin(int32_t * key, int32_t nl, int32_t nh, int32_t * index, int32_t k) 237 { 238 /* 239 * ATTENTION, le tableau index DOIT etre initialise 240 */ 241 int32_t pos, tmp, il, ih; 242 int32_t x, min; 243 244 il = nl; 245 ih = il + k; 246 247 /* 248 for(int32_t i = il; i <= ih; i++) { 249 index[i] = i - il; 250 } 251 */ 252 253 for (int32_t i = il; i < ih; i++) { 254 min = key[i]; 255 pos = i; 256 for (int32_t j = i + 1; j <= nh; j++) { 257 x = key[j]; 258 if (x < min) { 259 min = x; 260 pos = j; 261 } 262 } 263 key[pos] = key[i]; 264 key[i] = min; 265 266 tmp = index[i]; 267 index[i] = index[pos]; 268 index[pos] = tmp; 269 } 270 } 271 272 void sort_index_vector_selection_kmax(float * key, int32_t nl, int32_t nh, int32_t * index, int32_t k) 273 { 274 /* 275 * ATTENTION, le tableau index DOIT etre initialise 276 */ 277 int32_t pos, tmp, il, ih; 278 float x, max; 279 280 il = nl; 281 ih = il + k; 282 283 /* 284 for (int32_t i = il; i <= ih; i++) { 285 index[i] = i - il; 286 } 287 */ 288 289 for (int32_t i = il; i < ih; i++) { 290 max = key[i]; 291 pos = i; 292 for (int32_t j = i + 1; j <= nh; j++) { 293 x = key[j]; 294 if (x > max) { 295 max = x; 296 pos = j; 297 } 298 } 299 key[pos] = key[i]; 300 key[i] = max; 301 302 tmp = index[i]; 303 index[i] = index[pos]; 304 index[pos] = tmp; 305 } 306 } 307 308 void sort_index_ivector_selection_kmax(int32_t * key, int32_t nl, int32_t nh, int32_t * index, int32_t k) 309 { 310 /* 311 * ATTENTION, le tableau index DOIT etre initialise 312 */ 313 int32_t pos, tmp, il, ih; 314 int32_t x, max; 315 316 il = nl; 317 ih = il + k; 318 319 /* 320 for (int32_t i = i l; i <= ih; i++) { 321 index[i] = i - il; 322 } 323 */ 324 325 for (int32_t i = il; i < ih; i++) { 326 max = key[i]; 327 pos = i; 328 for (int32_t j = i + 1; j <= nh; j++) { 329 x = key[j]; 330 if (x > max) { 331 max = x; 332 pos = j; 333 } 334 } 335 key[pos] = key[i]; 336 key[i] = max; 337 338 tmp = index[i]; 339 index[i] = index[pos]; 340 index[pos] = tmp; 341 } 342 } 343 344 345 void sort_bvector_selection_min(int8_t * v, int32_t nl, int32_t nh) 346 { 347 int8_t x, min; 348 int32_t pos; 349 350 for (int32_t i = nl; i < nh; i++) { 351 min = v[i]; 352 pos = i; 353 for (int32_t j = i + 1; j <= nh; j++) { 354 x = v[j]; 355 if (x < min) { 356 min = x; 357 pos = j; 358 } 359 } 360 v[pos] = v[i]; 361 v[i] = min; 362 } 363 } 364 365 int8_t select_bvector(int8_t * v, int32_t nl, int32_t nh, int32_t k) 366 { 367 int32_t il, ih; 368 int8_t x, min, pos; 369 370 il = nl; 371 ih = il + k; 372 373 for (int32_t i = il; i < ih; i++) { 374 min = v[i]; 375 pos = i; 376 for (int32_t j = i + 1; j <= nh; j++) { 377 x = v[j]; 378 if (x < min) { 379 min = x; 380 pos = j; 381 } 382 } 383 v[pos] = v[i]; 384 v[i] = min; 385 } 386 return v[ih]; 387 } 388 389 rgb8 select_rgb8vector(rgb8 * v, int32_t nl, int32_t nh, int32_t k) 390 { 391 int32_t il, ih; 392 int32_t rpos, gpos, bpos; 393 394 rgb8 xi, xj; 395 int8_t r, g, b; 396 int8_t rmin, gmin, bmin; 397 398 il = nl; 399 ih = il + k; 400 401 for (int32_t i = il; i < ih; i++) { 402 xi = v[i]; 403 rmin = xi.r; 404 gmin = xi.g; 405 bmin = xi.b; 406 rpos = gpos = bpos = i; 407 408 for (int32_t j = i + 1; j <= nh; j++) { 409 xj = v[j]; 410 r = xj.r; 411 g = xj.g; 412 b = xj.b; 413 if (r < rmin) { 414 rmin = r; 415 rpos = j; 416 } 417 if (g < gmin) { 418 gmin = r; 419 gpos = j; 420 } 421 if (b < bmin) { 422 bmin = r; 423 bpos = j; 424 } 425 } 426 v[rpos].r = v[i].r; 427 v[i].r = rmin; 428 v[rpos].g = v[i].g; 429 v[i].g = gmin; 430 v[rpos].b = v[i].b; 431 v[i].b = bmin; 432 } 433 return v[ih]; 434 } 435 436 // Local Variables: 437 // tab-width: 4 438 // c-basic-offset: 4 439 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 440 // indent-tabs-mode: nil 441 // End: 442 443 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 444 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrsort2.c
r772 r826 16 16 #include <stddef.h> 17 17 #include <stdlib.h> 18 #include <math.h> // fabs19 18 20 19 #include "mypredef.h" … … 30 29 #include "nrsort2.h" 31 30 32 /* ------------------------------------------------------------------------------------------------------ */ 33 IMAGE_EXPORT(void) extractnz_boundaries_ui8matrix(uint8 **m, long nrl,long nrh, long ncl, long nch, long *nclnz, long *nchnz) 34 /* ------------------------------------------------------------------------------------------------------ */ 35 { 36 int i; 37 long a, b; 38 long left, right; 39 40 extractnz_boundaries_ui8vector(m[nrl], ncl, nch, &left, &right); // premier intervalle 41 for(i=nrl+1; i<=nrh; i++) { 42 extractnz_boundaries_ui8vector(m[i], ncl, nch, &a, &b); 43 if(a < left) left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 44 if(b > right) right = b; 45 } 46 *nclnz = left; 47 *nchnz = right; 48 } 49 /* ------------------------------------------------------------------------------------------------------- */ 50 IMAGE_EXPORT(void) extractnz_boundaries_si16matrix(sint16 **m, long nrl,long nrh, long ncl, long nch, long *nclnz, long *nchnz) 51 /* ------------------------------------------------------------------------------------------------------- */ 52 { 53 int i; 54 long a, b; 55 long left, right; 56 57 extractnz_boundaries_si16vector(m[nrl], ncl, nch, &left, &right); // premier intervalle 58 for(i=nrl+1; i<=nrh; i++) { 59 extractnz_boundaries_si16vector(m[i], ncl, nch, &a, &b); 60 if(a < left) 61 left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 62 if(b > right) 63 right = b; 64 } 65 *nclnz = left; 66 *nchnz = right; 67 } 68 /* --------------------------------------------------------------------------------------------------------- */ 69 IMAGE_EXPORT(void) extractnz_boundaries_ui16matrix(uint16 **m, long nrl,long nrh, long ncl, long nch, long *nclnz, long *nchnz) 70 /* --------------------------------------------------------------------------------------------------------- */ 71 { 72 int i; 73 long a, b; 74 long left, right; 75 76 extractnz_boundaries_ui16vector(m[nrl], ncl, nch, &left, &right); // premier intervalle 77 for(i=nrl+1; i<=nrh; i++) { 78 extractnz_boundaries_ui16vector(m[i], ncl, nch, &a, &b); 79 if(a < left) left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 80 if(b > right) right = b; 81 } 82 *nclnz = left; 83 *nchnz = right; 84 } 85 /* ------------------------------------------------------------------------------------------------------ */ 86 IMAGE_EXPORT(void) extractnz_boundaries_si32matrix (sint32 **m, long nrl,long nrh, long ncl, long nch, long *nclnz, long *nchnz) 87 /* ------------------------------------------------------------------------------------------------------ */ 88 { 89 int i; 90 long a, b; 91 long left, right; 92 93 extractnz_boundaries_si32vector(m[nrl], ncl, nch, &left, &right); // premier intervalle 94 for(i=nrl+1; i<=nrh; i++) { 95 extractnz_boundaries_si32vector(m[i], ncl, nch, &a, &b); 96 if(a < left) left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 97 if(b > right) right = b; 98 } 99 *nclnz = left; 100 *nchnz = right; 101 } 102 /* ------------------------------------------------------------------------------------------------------- */ 103 IMAGE_EXPORT(void) extractnz_boundaries_ui32matrix(uint32 **m, long nrl,long nrh, long ncl, long nch, long *nclnz, long *nchnz) 104 /* ------------------------------------------------------------------------------------------------------- */ 105 { 106 int i; 107 long a, b; 108 long left, right; 109 110 extractnz_boundaries_ui32vector(m[nrl], ncl, nch, &left, &right); // premier intervalle 111 for(i=nrl+1; i<=nrh; i++) { 112 extractnz_boundaries_ui32vector(m[i], ncl, nch, &a, &b); 113 if(a < left) left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 114 if(b > right) right = b; 115 } 116 *nclnz = left; 117 *nchnz = right; 118 } 119 /* ----------------------------------------------------------------------------------------------------------------------- */ 120 IMAGE_EXPORT(void) extractnz_boundaries_f32matrix(float32 **m, long nrl,long nrh, long ncl, long nch, long *nclnz, long *nchnz, float32 epsillon) 121 /* ----------------------------------------------------------------------------------------------------------------------- */ 122 { 123 int i; 124 long a, b; 125 long left, right; 126 127 extractnz_boundaries_f32vector(m[nrl], ncl, nch, &left, &right, epsillon); // premier intervalle 128 for(i=nrl+1; i<=nrh; i++) { 129 extractnz_boundaries_f32vector(m[i], ncl, nch, &a, &b, epsillon); 130 if(a < left) left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 131 if(b > right) right = b; 132 } 133 *nclnz = left; 134 *nchnz = right; 135 } 136 /* ------------------------------------------------------------------------------------------------------------------------- */ 137 IMAGE_EXPORT(void) extractnz_boundaries_f64matrix(float64 **m, long nrl,long nrh,long ncl, long nch, long *nclnz, long *nchnz, float64 epsillon) 138 /* ------------------------------------------------------------------------------------------------------------------------- */ 139 { 140 int i; 141 long a, b; 142 long left, right; 143 144 extractnz_boundaries_f64vector(m[nrl], ncl, nch, &left, &right, epsillon); // premier intervalle 145 for(i=nrl+1; i<=nrh; i++) { 146 extractnz_boundaries_f64vector(m[i], ncl, nch, &a, &b, epsillon); 147 if(a < left) left = a; // agrandissement de l'intervalle SI necessaire (et non le contraire) 148 if(b > right) right = b; 149 } 150 *nclnz = left; 151 *nchnz = right; 152 } 153 /* --------------------------------------------------------------- */ 154 IMAGE_EXPORT(void) sort_si32matrix_selection2(sint32 **m, long nl, long nh) 155 /* --------------------------------------------------------------- */ 156 /* 157 * sort an matrix of int with the selection algorithm 158 * the key is supposed to be in row 1 159 * the flag associated, in row 0 160 */ 161 { 162 int i, j; 163 sint32 x, min, pos, tmp; 164 165 //display_imatrix(m, 0, 1, nl, nh, "%10d", "Before"); 166 167 for(i=nl; i<nh; i++) { 168 min = m[1][i]; 169 pos = i; 170 for(j=i+1; j<=nh; j++) { 171 x = m[1][j]; 172 if(x < min) { 173 min = x; 174 pos = j; 175 } 176 } 177 m[1][pos] = m[1][i]; 178 m[1][i] = min; 179 180 tmp = m[0][i]; 181 m[0][i] = m[0][pos]; 182 m[0][pos] = tmp; 183 } 184 //display_imatrix(m, 0, 1, nl, nh, "%10d", "After"); 185 } 186 /* ---------------------------------------------------------------------------------- */ 187 IMAGE_EXPORT(void) sort_si32matrix_leftpart_selection2(sint32 **m, long nl, long nh, long len) 188 /* ---------------------------------------------------------------------------------- */ 189 /* 190 * sort an matrix of int with the selection algorithm 191 * the key is supposed to be in row 1 192 * the flag associated, in row 0 193 * the sort is performed only on the len first items 194 * for selecting the len first smallest values (for Tracking algo) 195 */ 196 { 197 int i, j; 198 sint32 x, min, pos, tmp; 199 long ih = nl + len - 1; 200 int *X, *F; 201 202 //display_imatrix(m, 0, 1, nl, nh, "%10d", "Before"); 203 204 F = m[0]; 205 X = m[1]; 206 207 208 for(i=nl; i<=ih; i++) { 209 min = X[i]; 210 pos = i; 211 for(j=i+1; j<=nh; j++) { 212 x = X[j]; 213 if(x < min) { 214 min = x; 215 pos = j; 216 } 217 } 218 X[pos] = X[i]; 219 X[i] = min; 220 221 tmp = F[i]; 222 F[i] = F[pos]; 223 F[pos] = tmp; 224 } 225 } 226 /* ---------------------------------------------------------------- */ 227 IMAGE_EXPORT(void) sort_f64matrix_selection(float64 *m, long nl, long nh) 228 /* ---------------------------------------------------------------- */ 229 { 230 int i, j, pos; 231 float64 x, min; 232 233 for(i=nl; i<nh; i++) { 234 min = m[i]; 235 pos = i; 236 for(j=i+1; j<=nh; j++) { 237 x = m[j]; 238 if(x < min) { 239 min = x; 240 pos = j; 241 } 242 } 243 m[pos] = m[i]; 244 m[i] = min; 245 } 246 } 247 /* ----------------------------------------------------------------------------------------------- */ 248 IMAGE_EXPORT(void) sort_si32matrix_selection(sint32 **m, long nrl, long nrh, long ncl, long nch, long nrow) 249 /* ----------------------------------------------------------------------------------------------- */ 250 /* 251 * sort an matrix of int with the selection algorithm 252 * the key is supposed to be in row nrow 253 */ 254 { 255 int i, j, k; 256 sint32 x, min, pos, tmp; 257 258 //display_imatrix(m, nrl, nrh, ncl, nch, "%10d", NULL); 259 for(i=ncl; i<nch; i++) { 260 min = m[nrow][i]; 261 pos = i; 262 for(j=i+1; j<=nch; j++) { 263 x = m[nrow][j]; 264 if(x < min) { 265 min = x; 266 pos = j; 267 } 268 } 269 270 // big swap 271 for(k=nrl; k<=nrh; k++) { 272 tmp = m[k][i]; 273 m[k][i] = m[k][pos]; 274 m[k][pos] = tmp; 275 } // k 276 //display_imatrix(m, nrl, nrh, ncl, nch, "%10d", NULL); 277 278 } // i 279 } 280 /* -------------------------------------------------------------------------------------------------- */ 281 IMAGE_EXPORT(void) sortv_si32matrix_selection_min(sint32 **m, long nrl, long nrh, long ncl, long nch, long nc) 282 /* -------------------------------------------------------------------------------------------------- */ 283 { 284 /* 285 * sort an matrix of int, with the selection algorithm. 286 * the key is in column nc 287 * the sort is performed, by doing a purmutation on the lines, 288 * instead of copying the lines. 289 */ 290 int i, j; 291 292 sint32 x, min, pos; 293 sint32 *ptr; 294 295 //display_imatrix(m, nrl, nrh, ncl, nch, "%10d", NULL); 296 for(i=nrl; i<nrh; i++) { 297 min = m[i][nc]; 298 pos = i; 299 for(j=i+1; j<=nrh; j++) { 300 x = m[j][nc]; 301 if(x < min) { 302 min = x; 303 pos = j; 304 } 305 } // j 306 307 /* permutation des pointeurs de ligne de la matrice */ 308 ptr = m[i]; 309 m[i] = m[pos]; 310 m[pos] = ptr; 311 312 } // i 313 } 314 /* ---------------------------------------------------------------------------------------------------------- */ 315 IMAGE_EXPORT(void) sortv_si32matrix_selection_kmin(sint32 **m, long nrl, long nrh, long ncl, long nch, long nc, int k) 316 /* ---------------------------------------------------------------------------------------------------------- */ 317 { 318 /* 319 * sort an matrix of int, with the selection algorithm. 320 * the key is in column nc 321 * the sort is performed, by doing a purmutation on the lines, 322 * instead of copying the lines. 323 */ 324 int i, j; 325 int il = nrl; 326 int ih = nrl + k; 327 328 sint32 x, min, pos; 329 sint32 *ptr; 330 331 //display_imatrix(m, nrl, nrh, ncl, nch, "%10d", NULL); 332 for(i=il; i<ih; i++) { 333 min = m[i][nc]; 334 pos = i; 335 for(j=i+1; j<=nrh; j++) { 336 x = m[j][nc]; 337 if(x < min) { 338 min = x; 339 pos = j; 340 } 341 } // j 342 343 /* permutation des pointeurs de ligne de la matrice */ 344 ptr = m[i]; 345 m[i] = m[pos]; 346 m[pos] = ptr; 347 348 } // i 349 } 350 /* -------------------------------------------------------------------------------------------------- */ 351 IMAGE_EXPORT(void) sortv_si32matrix_selection_max(sint32 **m, long nrl, long nrh, long ncl, long nch, long nc) 352 /* -------------------------------------------------------------------------------------------------- */ 353 { 354 /* 355 * sort an matrix of int, with the selection algorithm. 356 * from max to min 357 * the key is in column nc 358 * the sort is performed, by doing a purmutation on the lines, 359 * instead of copying the lines. 360 */ 361 int i, j; 362 363 sint32 x, max, pos; 364 sint32 *ptr; 365 366 //display_imatrix(m, nrl, nrh, ncl, nch, "%10d", NULL); 367 for(i=nrl; i<nrh; i++) { 368 max = m[i][nc]; 369 pos = i; 370 for(j=i+1; j<=nrh; j++) { 371 x = m[j][nc]; 372 if(x > max) { 373 max = x; 374 pos = j; 375 } 376 } // j 377 378 /* permutation des pointeurs de ligne de la matrice */ 379 ptr = m[i]; 380 m[i] = m[pos]; 381 m[pos] = ptr; 382 383 } // i 384 } 385 /* ---------------------------------------------------------------------------------------------------------- */ 386 IMAGE_EXPORT(void) sortv_si32matrix_selection_kmax(sint32 **m, long nrl, long nrh, long ncl, long nch, long nc, sint32 k) 387 /* ---------------------------------------------------------------------------------------------------------- */ 388 { 389 /* 390 * sort an matrix of int, with the selection algorithm. 391 * from max to min 392 * the key is in column nc 393 * the sort is performed, by doing a purmutation on the lines, 394 * instead of copying the lines. 395 */ 396 int i, j; 397 //int il = nrl; 398 //int ik = nrl + k; 399 400 sint32 x, max, pos; 401 sint32 *ptr; 402 403 //display_imatrix(m, nrl, nrh, ncl, nch, "%10d", NULL); 404 for(i=nrl; i<nrh; i++) { 405 max = m[i][nc]; 406 pos = i; 407 for(j=i+1; j<=nrh; j++) { 408 x = m[j][nc]; 409 if(x > max) { 410 max = x; 411 pos = j; 412 } 413 } // j 414 415 /* permutation des pointeurs de ligne de la matrice */ 416 ptr = m[i]; 417 m[i] = m[pos]; 418 m[pos] = ptr; 419 420 } // i 421 } 422 423 /* ------------------------------------------------------------------------------------------------------------------- */ 424 IMAGE_EXPORT(void) sort_index_si32matrix_selection_kmin(sint32 **key, long nrl,long nrh,long ncl, long nch, sint32 **index, int k) 425 /* ------------------------------------------------------------------------------------------------------------------- */ 426 { 427 int i; 428 429 set_si32matrix_j(index, nrl,nrh, ncl,nch); 430 431 for(i=nrl; i<=nrh; i++) { 432 //printf("-------------------- %d --------------------\n", i); 433 //display_ivector(key[i], ncl, nch, "%4d", "key0"); 434 //display_ivector(index[i], ncl, nch, "%4d", "index0"); 435 436 sort_index_ivector_selection_kmin(key[i], ncl, nch, index[i], k); 437 438 //display_ivector(key[i], ncl, nch, "%4d", "key1"); 439 //display_ivector(index[i], ncl, nch, "%4d", "index1"); 440 441 } 442 } 443 /* ------------------------------------------------------------------------------------------------------------------- */ 444 IMAGE_EXPORT(void) sort_index_si32matrix_selection_kmax(sint32 **key, long nrl,long nrh,long ncl, long nch, sint32 **index, int k) 445 /* ------------------------------------------------------------------------------------------------------------------- */ 446 { 447 int i; 448 449 set_si32matrix_j(index, nrl,nrh, ncl,nch); 450 451 for(i=nrl; i<=nrh; i++) { 452 //printf("-------------------- %d --------------------\n", i); 453 //display_ivector(key[i], ncl, nch, "%4d", "key0\n"); 454 //display_ivector(index[i], ncl, nch, "%4d", "index0\n"); 455 456 sort_index_ivector_selection_kmax(key[i], ncl, nch, index[i], k); 457 458 //display_ivector(key[i], ncl, nch, "%4d", "key1\n"); 459 //display_ivector(index[i], ncl, nch, "%4d", "index1\n"); 460 } 461 } 462 /* ------------------------------------------------------------------------------------------------------------------- */ 463 IMAGE_EXPORT(void) sortv_index_imatrix_selection_max(int **key, long nrl,long nrh,long ncl, long nch, int *index, int nc) 464 /* ------------------------------------------------------------------------------------------------------------------- */ 465 { 466 int i, j, pos, tmp, il, ih; 467 int x, max; 468 int *ptr; 469 470 il = nrl; 471 ih = nrh; 472 473 for(i=il; i<=ih; i++) { 474 index[i] = i; 475 }/**/ 476 477 for(i=il; i<ih; i++) { 478 max = key[i][nc]; 479 pos = i; 480 for(j=i+1; j<=nrh; j++) { 481 x = key[j][nc]; 482 if(x > max) { 483 max = x; 484 pos = j; 485 } 486 } 487 //printf("Max = %d, swap (%d, %d)\n", max, i, pos); 488 /* permutation des pointeurs de ligne de la matrice */ 489 ptr = key[i]; 490 key[i] = key[pos]; 491 key[pos] = ptr; 492 493 /* permutation des indices de l'index */ 494 tmp = index[i]; 495 index[i] = index[pos]; 496 index[pos] = tmp; 497 } 498 } 499 /* ------------------------------------------------------------------------------------------------------------------- */ 500 IMAGE_EXPORT(void) sortv_index_imatrix_selection_min(int **key, long nrl,long nrh,long ncl, long nch, int *index, int nc) 501 /* ------------------------------------------------------------------------------------------------------------------- */ 502 { 503 int i, j, pos, tmp, il, ih; 504 int x, min; 505 int *ptr; 506 507 il = nrl; 508 ih = nrh; 509 510 for(i=il; i<=ih; i++) { 511 index[i] = i; 512 }/**/ 513 514 for(i=il; i<ih; i++) { 515 min = key[i][nc]; 516 pos = i; 517 for(j=i+1; j<=nrh; j++) { 518 x = key[j][nc]; 519 if(x < min) { 520 min = x; 521 pos = j; 522 } 523 } 524 //printf("Max = %d, swap (%d, %d)\n", max, i, pos); 525 /* permutation des pointeurs de ligne de la matrice */ 526 ptr = key[i]; 527 key[i] = key[pos]; 528 key[pos] = ptr; 529 530 /* permutation des indices de l'index */ 531 tmp = index[i]; 532 index[i] = index[pos]; 533 index[pos] = tmp; 534 } 535 } 31 32 #undef extractnz_boundaries_type_matrix 33 #define extractnz_boundaries_type_matrix(t) \ 34 void short_name(t,extractnz_boundaries_,matrix)(t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t * nclnz, int32_t * nchnz) \ 35 { \ 36 int32_t a, b; \ 37 int32_t left, right; \ 38 short_name(t,extractnz_boundaries_,vector)(m[nrl], ncl, nch, &left, &right); /* premier intervalle */ \ 39 for (int32_t i = nrl + 1; i <= nrh; i++) { \ 40 short_name(t,extractnz_boundaries_,vector)(m[i], ncl, nch, &a, &b); \ 41 if (a < left) { \ 42 left = a; /* agrandissement de l'intervalle SI necessaire (et non le contraire) */ \ 43 } \ 44 if (b > right) { \ 45 right = b; \ 46 } \ 47 } \ 48 *nclnz = left; \ 49 *nchnz = right; \ 50 } 51 52 extractnz_boundaries_type_matrix(int8_t); 53 extractnz_boundaries_type_matrix(uint8_t); 54 extractnz_boundaries_type_matrix(int16_t); 55 extractnz_boundaries_type_matrix(uint16_t); 56 extractnz_boundaries_type_matrix(int32_t); 57 extractnz_boundaries_type_matrix(uint32_t); 58 extractnz_boundaries_type_matrix(int64_t); 59 extractnz_boundaries_type_matrix(uint64_t); 60 extractnz_boundaries_type_matrix(float); 61 extractnz_boundaries_type_matrix(double); 62 63 64 65 void sort_si32matrix_selection2(int32_t ** m, int32_t nl, int32_t nh) 66 { 67 /* 68 * sort an matrix of int32_t with the selection algorithm 69 * the key is supposed to be in row 1 70 * the flag associated, in row 0 71 */ 72 int32_t x, min, pos, tmp; 73 74 for (int32_t i = nl; i < nh; i++) { 75 min = m[1][i]; 76 pos = i; 77 for (int32_t j = i + 1; j <= nh; j++) { 78 x = m[1][j]; 79 if (x < min) { 80 min = x; 81 pos = j; 82 } 83 } 84 m[1][pos] = m[1][i]; 85 m[1][i] = min; 86 87 tmp = m[0][i]; 88 m[0][i] = m[0][pos]; 89 m[0][pos] = tmp; 90 } 91 } 92 93 void sort_si32matrix_leftpart_selection2(int32_t ** m, int32_t nl, int32_t nh, int32_t len) 94 { 95 /* 96 * sort an matrix of int32_t with the selection algorithm 97 * the key is supposed to be in row 1 98 * the flag associated, in row 0 99 * the sort is performed only on the len first items 100 * for selecting the len first smallest values (for Tracking algo) 101 */ 102 int32_t x, min, pos, tmp; 103 int32_t ih = nl + len - 1; 104 int32_t * X; 105 int32_t * F; 106 107 F = m[0]; 108 X = m[1]; 109 110 for (int32_t i = nl; i <= ih; i++) { 111 min = X[i]; 112 pos = i; 113 for (int32_t j = i + 1; j <= nh; j++) { 114 x = X[j]; 115 if (x < min) { 116 min = x; 117 pos = j; 118 } 119 } 120 X[pos] = X[i]; 121 X[i] = min; 122 123 tmp = F[i]; 124 F[i] = F[pos]; 125 F[pos] = tmp; 126 } 127 } 128 129 void sort_f64matrix_selection(double * m, int32_t nl, int32_t nh) 130 { 131 int32_t pos; 132 float64 x, min; 133 134 for (int32_t i = nl; i < nh; i++) { 135 min = m[i]; 136 pos = i; 137 for (int32_t j = i + 1; j <= nh; j++) { 138 x = m[j]; 139 if (x < min) { 140 min = x; 141 pos = j; 142 } 143 } 144 m[pos] = m[i]; 145 m[i] = min; 146 } 147 } 148 149 void sort_si32matrix_selection(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nrow) 150 { 151 /* 152 * sort an matrix of int32_t with the selection algorithm 153 * the key is supposed to be in row nrow 154 */ 155 int32_t x, min, pos, tmp; 156 157 for (int32_t i = ncl; i < nch; i++) { 158 min = m[nrow][i]; 159 pos = i; 160 for (int32_t j = i + 1; j <= nch; j++) { 161 x = m[nrow][j]; 162 if (x < min) { 163 min = x; 164 pos = j; 165 } 166 } 167 168 // big swap 169 for (int32_t k = nrl; k <= nrh; k++) { 170 tmp = m[k][i]; 171 m[k][i] = m[k][pos]; 172 m[k][pos] = tmp; 173 } 174 } 175 } 176 177 void sortv_si32matrix_selection_min(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc) 178 { 179 /* 180 * sort an matrix of int, with the selection algorithm. 181 * the key is in column nc 182 * the sort is performed, by doing a purmutation on the lines, 183 * instead of copying the lines. 184 */ 185 186 int32_t x, min, pos; 187 int32_t * ptr; 188 189 for (int32_t i = nrl; i < nrh; i++) { 190 min = m[i][nc]; 191 pos = i; 192 for (int32_t j = i + 1; j <= nrh; j++) { 193 x = m[j][nc]; 194 if (x < min) { 195 min = x; 196 pos = j; 197 } 198 } 199 200 /* permutation des pointeurs de ligne de la matrice */ 201 ptr = m[i]; 202 m[i] = m[pos]; 203 m[pos] = ptr; 204 } 205 } 206 207 void sortv_si32matrix_selection_kmin(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc, int32_t k) 208 { 209 /* 210 * sort an matrix of int, with the selection algorithm. 211 * the key is in column nc 212 * the sort is performed, by doing a purmutation on the lines, 213 * instead of copying the lines. 214 */ 215 int32_t il = nrl; 216 int32_t ih = nrl + k; 217 218 int32_t x, min, pos; 219 int32_t * ptr; 220 221 for (int32_t i = il; i < ih; i++) { 222 min = m[i][nc]; 223 pos = i; 224 for(int32_t j = i + 1; j <= nrh; j++) { 225 x = m[j][nc]; 226 if (x < min) { 227 min = x; 228 pos = j; 229 } 230 } 231 232 /* permutation des pointeurs de ligne de la matrice */ 233 ptr = m[i]; 234 m[i] = m[pos]; 235 m[pos] = ptr; 236 237 } 238 } 239 240 void sortv_si32matrix_selection_max(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc) 241 { 242 /* 243 * sort an matrix of int, with the selection algorithm. 244 * from max to min 245 * the key is in column nc 246 * the sort is performed, by doing a purmutation on the lines, 247 * instead of copying the lines. 248 */ 249 250 int32_t x, max, pos; 251 int32_t * ptr; 252 253 for (int32_t i = nrl; i < nrh; i++) { 254 max = m[i][nc]; 255 pos = i; 256 for (int32_t j = i + 1; j <= nrh; j++) { 257 x = m[j][nc]; 258 if (x > max) { 259 max = x; 260 pos = j; 261 } 262 } 263 264 /* permutation des pointeurs de ligne de la matrice */ 265 ptr = m[i]; 266 m[i] = m[pos]; 267 m[pos] = ptr; 268 } 269 } 270 271 void sortv_si32matrix_selection_kmax(int32_t ** m, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t nc, int32_t k) 272 { 273 /* 274 * sort an matrix of int, with the selection algorithm. 275 * from max to min 276 * the key is in column nc 277 * the sort is performed, by doing a purmutation on the lines, 278 * instead of copying the lines. 279 */ 280 int32_t x, max, pos; 281 int32_t * ptr; 282 283 for (int32_t i = nrl; i < nrh; i++) { 284 max = m[i][nc]; 285 pos = i; 286 for (int32_t j = i + 1; j <= nrh; j++) { 287 x = m[j][nc]; 288 if (x > max) { 289 max = x; 290 pos = j; 291 } 292 } 293 294 /* permutation des pointeurs de ligne de la matrice */ 295 ptr = m[i]; 296 m[i] = m[pos]; 297 m[pos] = ptr; 298 } 299 } 300 301 void sort_index_si32matrix_selection_kmin(int32_t ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t ** index, int32_t k) 302 { 303 set_si32matrix_j(index, nrl,nrh, ncl,nch); 304 for (int32_t i = nrl; i <= nrh; i++) { 305 sort_index_ivector_selection_kmin(key[i], ncl, nch, index[i], k); 306 } 307 } 308 309 void sort_index_si32matrix_selection_kmax(int32_t ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t ** index, int32_t k) 310 { 311 set_si32matrix_j(index, nrl,nrh, ncl,nch); 312 for (int32_t i = nrl; i <= nrh; i++) { 313 sort_index_ivector_selection_kmax(key[i], ncl, nch, index[i], k); 314 } 315 } 316 317 void sortv_index_imatrix_selection_max(int ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t * index, int32_t nc) 318 { 319 int32_t pos, tmp, il, ih; 320 int32_t x, max; 321 int32_t * ptr; 322 323 il = nrl; 324 ih = nrh; 325 326 for (int32_t i = il; i <= ih; i++) { 327 index[i] = i; 328 } 329 330 for (int32_t i = il; i < ih; i++) { 331 max = key[i][nc]; 332 pos = i; 333 for (int32_t j = i + 1; j <= nrh; j++) { 334 x = key[j][nc]; 335 if (x > max) { 336 max = x; 337 pos = j; 338 } 339 } 340 /* permutation des pointeurs de ligne de la matrice */ 341 ptr = key[i]; 342 key[i] = key[pos]; 343 key[pos] = ptr; 344 345 /* permutation des indices de l'index */ 346 tmp = index[i]; 347 index[i] = index[pos]; 348 index[pos] = tmp; 349 } 350 } 351 352 void sortv_index_imatrix_selection_min(int32_t ** key, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, int32_t * index, int32_t nc) 353 { 354 int32_t pos, tmp, il, ih; 355 int32_t x, min; 356 int32_t * ptr; 357 358 il = nrl; 359 ih = nrh; 360 361 for (int32_t i = il; i <= ih; i++) { 362 index[i] = i; 363 } 364 365 for (int32_t i = il; i < ih; i++) { 366 min = key[i][nc]; 367 pos = i; 368 for (int32_t j = i + 1; j <= nrh; j++) { 369 x = key[j][nc]; 370 if (x < min) { 371 min = x; 372 pos = j; 373 } 374 } 375 /* permutation des pointeurs de ligne de la matrice */ 376 ptr = key[i]; 377 key[i] = key[pos]; 378 key[pos] = ptr; 379 380 /* permutation des indices de l'index */ 381 tmp = index[i]; 382 index[i] = index[pos]; 383 index[pos] = tmp; 384 } 385 } 386 387 388 // Local Variables: 389 // tab-width: 4 390 // c-basic-offset: 4 391 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 392 // indent-tabs-mode: nil 393 // End: 394 395 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 396 -
soft/giet_vm/applications/rosenfeld/nrc2/src/nrwrap1.c
r772 r826 12 12 13 13 /* 14 * 2002/06/11 ajout des fonctions endline 15 */ 14 * 2002/06/11 ajout des fonctions endline 15 */ 16 16 17 #include <stdio.h> 17 18 #include <stddef.h> 18 19 #include <stdlib.h> 19 #include <math.h> // fabs20 20 21 21 #include "mypredef.h" … … 27 27 #include "nrwrap1.h" 28 28 29 /* --------------- */30 /* --- Mapping --- */31 /* --------------- */32 29 33 /* -------------------------------------------- */34 IMAGE_EXPORT(sint8*) si8vector_map(int nl, int nh)35 /* -------------------------------------------- */36 {37 // nothing to do: no alloc required...38 return NULL;39 }40 /* -------------------------------------------- */41 IMAGE_EXPORT(uint8*) ui8vector_map(int nl, int nh)42 /* -------------------------------------------- */43 {44 // nothing to do: no alloc required...45 return NULL;46 }47 /* ---------------------------------------------- */48 IMAGE_EXPORT(sint16*) si16vector_map(int nl, int nh)49 /* ---------------------------------------------- */50 {51 // nothing to do: no alloc required...52 return NULL;53 }54 /* ---------------------------------------------- */55 IMAGE_EXPORT(uint16*) ui16vector_map(int nl, int nh)56 /* ---------------------------------------------- */57 {58 // nothing to do: no alloc required...59 return NULL;60 }61 /* ---------------------------------------------- */62 IMAGE_EXPORT(sint32*) si32vector_map(int nl, int nh)63 /* ---------------------------------------------- */64 {65 // nothing to do: no alloc required...66 return NULL;67 }68 /* ---------------------------------------------- */69 IMAGE_EXPORT(uint32*) ui32vector_map(int nl, int nh)70 /* ---------------------------------------------- */71 {72 // nothing to do: no alloc required...73 return NULL;74 }75 /* ---------------------------------------------- */76 IMAGE_EXPORT(float32*) f32vector_map(int nl, int nh)77 /* ---------------------------------------------- */78 {79 // nothing to do: no alloc required...80 return NULL;81 }82 /* ---------------------------------------------- */83 IMAGE_EXPORT(float64*) f64vector_map(int nl, int nh)84 /* ---------------------------------------------- */85 {86 // nothing to do: no alloc required...87 return NULL;88 }89 /* -------------------------------------------- */90 IMAGE_EXPORT(rgb8*) rgb8vector_map(int nl, int nh)91 /* -------------------------------------------- */92 {93 // nothing to do: no alloc required...94 return NULL;95 }96 /* ---------------------------------------------- */97 IMAGE_EXPORT(rgbx8*) rgbx8vector_map(int nl, int nh)98 /* ---------------------------------------------- */99 {100 // nothing to do: no alloc required...101 return NULL;102 }103 30 /* ------------------ */ 104 31 /* --- Mapping 1D --- */ 105 32 /* ------------------ */ 106 /* ----------------------------------------------------------------------------------------- */ 107 IMAGE_EXPORT(sint8*) si8vector_map_1D_pitch(sint8 *v, int nl, int nh, void *data_1D, int pitch) 108 /* ----------------------------------------------------------------------------------------- */ 109 { 110 v = (sint8*) data_1D; 111 v -= nl; 112 return v; 113 } 114 /* ----------------------------------------------------------------------------------------- */ 115 IMAGE_EXPORT(uint8*) ui8vector_map_1D_pitch(uint8 *v, int nl, int nh, void *data_1D, int pitch) 116 /* ----------------------------------------------------------------------------------------- */ 117 { 118 v = (uint8*) data_1D; 119 v -= nl; 120 return v; 121 } 122 /* -------------------------------------------------------------------------------------------- */ 123 IMAGE_EXPORT(uint16*) ui16vector_map_1D_pitch(uint16 *v, int nl, int nh, void *data_1D, int pitch) 124 /* -------------------------------------------------------------------------------------------- */ 125 { 126 v = (uint16*) data_1D; 127 v -= nl; 128 return v; 129 } 130 /* -------------------------------------------------------------------------------------------- */ 131 IMAGE_EXPORT(sint16*) si16vector_map_1D_pitch(sint16 *v, int nl, int nh, void *data_1D, int pitch) 132 /* -------------------------------------------------------------------------------------------- */ 133 { 134 v = (sint16*) data_1D; 135 v -= nl; 136 return v; 137 } 138 /* -------------------------------------------------------------------------------------------- */ 139 IMAGE_EXPORT(uint32*) ui32vector_map_1D_pitch(uint32 *v, int nl, int nh, void *data_1D, int pitch) 140 /* -------------------------------------------------------------------------------------------- */ 141 { 142 v = (uint32*) data_1D; 143 v -= nl; 144 return v; 145 } 146 /* -------------------------------------------------------------------------------------------- */ 147 IMAGE_EXPORT(sint32*) si32vector_map_1D_pitch(sint32 *v, int nl, int nh, void *data_1D, int pitch) 148 /* -------------------------------------------------------------------------------------------- */ 149 { 150 v = (sint32*) data_1D; 151 v -= nl; 152 return v; 153 } 154 /* --------------------------------------------------------------------------------------------- */ 155 IMAGE_EXPORT(float32*) f32vector_map_1D_pitch(float32 *v, int nl, int nh, void *data_1D, int pitch) 156 /* --------------------------------------------------------------------------------------------- */ 157 { 158 v = (float32*) data_1D; 159 v -= nl; 160 return v; 161 } 162 /* --------------------------------------------------------------------------------------------- */ 163 IMAGE_EXPORT(float64*) f64vector_map_1D_pitch(float64 *v, int nl, int nh, void *data_1D, int pitch) 164 /* --------------------------------------------------------------------------------------------- */ 165 { 166 v = (float64*) data_1D; 167 v -= nl; 168 return v; 169 } 170 /* ---------------------------------------------------------------------------------------- */ 171 IMAGE_EXPORT(rgb8*) rgb8vector_map_1D_pitch(rgb8 *v, int nl, int nh, void *data_1D, int pitch) 172 /* ---------------------------------------------------------------------------------------- */ 173 { 174 v = (rgb8*) data_1D; 175 v -= nl; 176 return v; 177 } 178 /* ------------------------------------------------------------------------------------------- */ 179 IMAGE_EXPORT(rgbx8*) rgbx8vector_map_1D_pitch(rgbx8 *v, int nl, int nh, void *data_1D, int pitch) 180 /* ------------------------------------------------------------------------------------------- */ 181 { 182 v = (rgbx8*) data_1D; 183 v -= nl; 184 return v; 33 34 #undef type_vector_map_1D_pitch 35 #define type_vector_map_1D_pitch(t) \ 36 t * short_name(t,,vector_map_1D_pitch)(t * v, int32_t nl, int32_t nh, void * data_1D, int32_t pitch) \ 37 { \ 38 v = (t *) data_1D; \ 39 v -= nl; \ 40 return v; \ 185 41 } 186 42 43 type_vector_map_1D_pitch(int8_t); 44 type_vector_map_1D_pitch(uint8_t); 45 type_vector_map_1D_pitch(int16_t); 46 type_vector_map_1D_pitch(uint16_t); 47 type_vector_map_1D_pitch(int32_t); 48 type_vector_map_1D_pitch(uint32_t); 49 type_vector_map_1D_pitch(int64_t); 50 type_vector_map_1D_pitch(uint64_t); 51 type_vector_map_1D_pitch(float); 52 type_vector_map_1D_pitch(double); 53 type_vector_map_1D_pitch(rgb8); 54 type_vector_map_1D_pitch(rgbx8); 55 56 57 58 59 // Local Variables: 60 // tab-width: 4 61 // c-basic-offset: 4 62 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 63 // indent-tabs-mode: nil 64 // End: 65 66 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 67
Note: See TracChangeset
for help on using the changeset viewer.