Changeset 823 for soft/giet_vm/applications/rosenfeld/nrc2/src/nrlinalg.c
- Timestamp:
- Jun 14, 2016, 5:23:56 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/applications/rosenfeld/nrc2/src/nrlinalg.c
r772 r823 24 24 #include "nrlinalg.h" 25 25 26 #undef transpose_type_matrix 27 #define transpose_type_matrix(t) \ 28 void short_name(t,transpose_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch, t ** D) \ 29 { \ 30 for (int32_t i = nrl; i <= nch; i++) { \ 31 for (int32_t j = ncl; j <= nch; j++) { \ 32 D[j][i] = S[i][j]; \ 33 } \ 34 } \ 35 } 26 36 27 /* ---------------------------------------------------------------------------------------- */ 28 IMAGE_EXPORT(void) transpose_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch, byte **D) 29 /* ---------------------------------------------------------------------------------------- */ 30 { 31 int i, j; 32 33 for(i=nrl; i<=nch; i++) { 34 for(j=ncl; j<=nch; j++) { 35 D[j][i] = S[i][j]; 36 } 37 } 37 transpose_type_matrix(int8_t); 38 transpose_type_matrix(uint8_t); 39 transpose_type_matrix(int16_t); 40 transpose_type_matrix(uint16_t); 41 transpose_type_matrix(int32_t); 42 transpose_type_matrix(uint32_t); 43 transpose_type_matrix(int64_t); 44 transpose_type_matrix(uint64_t); 45 transpose_type_matrix(float); 46 transpose_type_matrix(double); 47 transpose_type_matrix(rgb8); 48 transpose_type_matrix(rgbx8); 49 50 51 #undef transpose1_type_matrix 52 #define transpose1_type_matrix(t) \ 53 void short_name(t,transpose1_,matrix)(t ** S, int32_t nrl, int32_t nrh, int32_t ncl, int32_t nch) \ 54 { \ 55 t tmp; \ 56 for (int32_t i = nrl; i <= nch; i++) { \ 57 for (int32_t j = i + 1; j <= nch; j++) { \ 58 tmp = S[j][i]; \ 59 S[j][i] = S[i][j]; \ 60 S[i][j] = tmp; \ 61 } \ 62 } \ 38 63 } 39 /* ------------------------------------------------------------------------------------------- */ 40 IMAGE_EXPORT(void) transpose_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch, sint16 **D) 41 /* ------------------------------------------------------------------------------------------- */ 42 { 43 int i, j; 44 45 for(i=nrl; i<=nch; i++) { 46 for(j=ncl; j<=nch; j++) { 47 D[j][i] = S[i][j]; 48 } 49 } 50 } 51 /* ------------------------------------------------------------------------------------------- */ 52 IMAGE_EXPORT(void) transpose_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch, uint16 **D) 53 /* ------------------------------------------------------------------------------------------- */ 54 { 55 int i, j; 56 57 for(i=nrl; i<=nch; i++) { 58 for(j=ncl; j<=nch; j++) { 59 D[j][i] = S[i][j]; 60 } 61 } 62 } 63 /* ----------------------------------------------------------------------------------------------- */ 64 IMAGE_EXPORT(void) transpose_si32matrix(sint32 **S, long nrl,long nrh,long ncl, long nch, sint32 **D) 65 /* ----------------------------------------------------------------------------------------------- */ 66 { 67 int i, j; 68 69 for(i=nrl; i<=nch; i++) { 70 for(j=ncl; j<=nch; j++) { 71 D[j][i] = S[i][j]; 72 } 73 } 74 } 75 /* ----------------------------------------------------------------------------------------------- */ 76 IMAGE_EXPORT(void) transpose_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch, uint32 **D) 77 /* ----------------------------------------------------------------------------------------------- */ 78 { 79 int i, j; 80 81 for(i=nrl; i<=nch; i++) { 82 for(j=ncl; j<=nch; j++) { 83 D[j][i] = S[i][j]; 84 } 85 } 86 } 87 /* ----------------------------------------------------------------------------------------- */ 88 IMAGE_EXPORT(void) transpose_f32matrix(float32 **S, long nrl,long nrh,long ncl, long nch, float32 **D) 89 /* ----------------------------------------------------------------------------------------- */ 90 { 91 int i, j; 92 93 for(i=nrl; i<=nch; i++) { 94 for(j=ncl; j<=nch; j++) { 95 D[j][i] = S[i][j]; 96 } 97 } 98 } 99 /* -------------------------------------------------------------------------------------------- */ 100 IMAGE_EXPORT(void) transpose_dmatrix(float64 **S, long nrl,long nrh,long ncl, long nch, float64 **D) 101 /* -------------------------------------------------------------------------------------------- */ 102 { 103 int i, j; 104 105 for(i=nrl; i<=nch; i++) { 106 for(j=ncl; j<=nch; j++) { 107 D[j][i] = S[i][j]; 108 } 109 } 110 } 111 /* ------------------------------------------------------------------------------------------- */ 112 IMAGE_EXPORT(void) transpose_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch, rgb8 **D) 113 /* ------------------------------------------------------------------------------------------- */ 114 { 115 int i, j; 116 117 for(i=nrl; i<=nch; i++) { 118 for(j=ncl; j<=nch; j++) { 119 D[j][i] = S[i][j]; 120 } 121 } 122 } 123 /* ------------------------------------------------------------------------------- */ 124 IMAGE_EXPORT(void) transpose1_bmatrix(byte **S, long nrl,long nrh,long ncl, long nch) 125 /* ------------------------------------------------------------------------------- */ 126 { 127 int i, j; 128 byte t; 129 130 for(i=nrl; i<=nch; i++) { 131 for(j=i+1; j<=nch; j++) { 132 t = S[j][i]; 133 S[j][i] = S[i][j]; 134 S[i][j] = t; 135 } 136 } 137 } 138 /* ---------------------------------------------------------------------------------- */ 139 IMAGE_EXPORT(void) transpose1_si16matrix(sint16 **S, long nrl,long nrh,long ncl, long nch) 140 /* ---------------------------------------------------------------------------------- */ 141 { 142 int i, j; 143 int16 t; 144 145 for(i=nrl; i<=nch; i++) { 146 for(j=i+1; j<=nch; j++) { 147 t = S[j][i]; 148 S[j][i] = S[i][j]; 149 S[i][j] = t; 150 } 151 } 152 } 153 /* ------------------------------------------------------------------------------------ */ 154 IMAGE_EXPORT(void) transpose1_ui16matrix(uint16 **S, long nrl,long nrh,long ncl, long nch) 155 /* ------------------------------------------------------------------------------------ */ 156 { 157 int i, j; 158 uint16 t; 159 160 for(i=nrl; i<=nch; i++) { 161 for(j=i+1; j<=nch; j++) { 162 t = S[j][i]; 163 S[j][i] = S[i][j]; 164 S[i][j] = t; 165 } 166 } 167 } 168 /* ---------------------------------------------------------------------------------- */ 169 IMAGE_EXPORT(void) transpose1_si32matrix(sint32 **S, long nrl,long nrh,long ncl, long nch) 170 /* ---------------------------------------------------------------------------------- */ 171 { 172 int i, j; 173 int32 t; 174 175 for(i=nrl; i<=nch; i++) { 176 for(j=i+1; j<=nch; j++) { 177 t = S[j][i]; 178 S[j][i] = S[i][j]; 179 S[i][j] = t; 180 } 181 } 182 } 183 /* ------------------------------------------------------------------------------------ */ 184 IMAGE_EXPORT(void) transpose1_ui32matrix(uint32 **S, long nrl,long nrh,long ncl, long nch) 185 /* ------------------------------------------------------------------------------------ */ 186 { 187 int i, j; 188 uint32 t; 189 190 for(i=nrl; i<=nch; i++) { 191 for(j=i+1; j<=nch; j++) { 192 t = S[j][i]; 193 S[j][i] = S[i][j]; 194 S[i][j] = t; 195 } 196 } 197 } 198 /* ------------------------------------------------------------------------------- */ 199 IMAGE_EXPORT(void) transpose1_f32matrix(float32 **S, long nrl,long nrh,long ncl, long nch) 200 /* ------------------------------------------------------------------------------- */ 201 { 202 int i, j; 203 float t; 204 205 for(i=nrl; i<=nch; i++) { 206 for(j=i+1; j<=nch; j++) { 207 t = S[j][i]; 208 S[j][i] = S[i][j]; 209 S[i][j] = t; 210 } 211 } 212 } 213 /* --------------------------------------------------------------------------------- */ 214 IMAGE_EXPORT(void) transpose1_f64matrix(float64 **S, long nrl,long nrh,long ncl, long nch) 215 /* --------------------------------------------------------------------------------- */ 216 { 217 int i, j; 218 double t; 219 220 for(i=nrl; i<=nch; i++) { 221 for(j=i+1; j<=nch; j++) { 222 t = S[j][i]; 223 S[j][i] = S[i][j]; 224 S[i][j] = t; 225 } 226 } 227 } 228 /* ---------------------------------------------------------------------------------- */ 229 IMAGE_EXPORT(void) transpose1_rgb8matrix(rgb8 **S, long nrl,long nrh,long ncl, long nch) 230 /* ---------------------------------------------------------------------------------- */ 231 { 232 int i, j; 233 rgb8 t; 234 235 for(i=nrl; i<=nch; i++) { 236 for(j=i+1; j<=nch; j++) { 237 t = S[j][i]; 238 S[j][i] = S[i][j]; 239 S[i][j] = t; 240 } 241 } 242 } 64 65 transpose1_type_matrix(int8_t); 66 transpose1_type_matrix(uint8_t); 67 transpose1_type_matrix(int16_t); 68 transpose1_type_matrix(uint16_t); 69 transpose1_type_matrix(int32_t); 70 transpose1_type_matrix(uint32_t); 71 transpose1_type_matrix(int64_t); 72 transpose1_type_matrix(uint64_t); 73 transpose1_type_matrix(float); 74 transpose1_type_matrix(double); 75 transpose1_type_matrix(rgb8); 76 transpose1_type_matrix(rgbx8); 77 78 79 80 81 // Local Variables: 82 // tab-width: 4 83 // c-basic-offset: 4 84 // c-file-offsets:((innamespace . 0)(inline-open . 0)) 85 // indent-tabs-mode: nil 86 // End: 87 88 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=4:softtabstop=4 89
Note: See TracChangeset
for help on using the changeset viewer.