diff options
Diffstat (limited to 'match/match.c')
| -rw-r--r-- | match/match.c | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/match/match.c b/match/match.c index a3f4deb..4cb4495 100644 --- a/match/match.c +++ b/match/match.c | |||
| @@ -64,25 +64,25 @@ static void buildixvector(int *ix, mat_t mstar, int nrows, int ncols) | |||
| 64 | 64 | ||
| 65 | /********************************************************/ | 65 | /********************************************************/ |
| 66 | 66 | ||
| 67 | static void step2a(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 67 | static void step2a(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 68 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 68 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 69 | int dmin); | 69 | int dmin); |
| 70 | static void step2b(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 70 | static void step2b(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 71 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 71 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 72 | int dmin); | 72 | int dmin); |
| 73 | static void step3(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 73 | static void step3(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 74 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 74 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 75 | int dmin); | 75 | int dmin); |
| 76 | static void step4(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 76 | static void step4(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 77 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 77 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 78 | int dmin, int row, int col); | 78 | int dmin, int row, int col); |
| 79 | static void step5(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 79 | static void step5(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 80 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 80 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 81 | int dmin); | 81 | int dmin); |
| 82 | 82 | ||
| 83 | static void ixoptimal(int *ix, float *mdist, int nrows, int ncols) | 83 | static void ixoptimal(int *ix, int *mdist, int nrows, int ncols) |
| 84 | { | 84 | { |
| 85 | float *mdistTemp, *mdistEnd, *columnEnd, value, minValue; | 85 | int *mdistTemp, *mdistEnd, *columnEnd, value, minValue; |
| 86 | int dmin, row, col; | 86 | int dmin, row, col; |
| 87 | col_t ccol, crow; | 87 | col_t ccol, crow; |
| 88 | mat_t mstar, mprime, nmstar; | 88 | mat_t mstar, mprime, nmstar; |
| @@ -181,7 +181,7 @@ static void ixoptimal(int *ix, float *mdist, int nrows, int ncols) | |||
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | /********************************************************/ | 183 | /********************************************************/ |
| 184 | static void step2a(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 184 | static void step2a(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 185 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 185 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 186 | int dmin) | 186 | int dmin) |
| 187 | { | 187 | { |
| @@ -204,7 +204,7 @@ static void step2a(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | |||
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | /********************************************************/ | 206 | /********************************************************/ |
| 207 | static void step2b(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 207 | static void step2b(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 208 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 208 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 209 | int dmin) | 209 | int dmin) |
| 210 | { | 210 | { |
| @@ -229,7 +229,7 @@ static void step2b(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | |||
| 229 | } | 229 | } |
| 230 | 230 | ||
| 231 | /********************************************************/ | 231 | /********************************************************/ |
| 232 | static void step3(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 232 | static void step3(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 233 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 233 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 234 | int dmin) | 234 | int dmin) |
| 235 | { | 235 | { |
| @@ -279,7 +279,7 @@ static void step3(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | |||
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | /********************************************************/ | 281 | /********************************************************/ |
| 282 | static void step4(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 282 | static void step4(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 283 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 283 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 284 | int dmin, int row, int col) | 284 | int dmin, int row, int col) |
| 285 | { | 285 | { |
| @@ -330,11 +330,11 @@ static void step4(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | |||
| 330 | } | 330 | } |
| 331 | 331 | ||
| 332 | /********************************************************/ | 332 | /********************************************************/ |
| 333 | static void step5(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | 333 | static void step5(int *ix, int *mdist, mat_t mstar, mat_t nmstar, |
| 334 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, | 334 | mat_t mprime, col_t ccol, col_t crow, int nrows, int ncols, |
| 335 | int dmin) | 335 | int dmin) |
| 336 | { | 336 | { |
| 337 | float h = 0, value; | 337 | int h = 0, value; |
| 338 | int row, col, found = 0; | 338 | int row, col, found = 0; |
| 339 | 339 | ||
| 340 | /* find smallest uncovered element h */ | 340 | /* find smallest uncovered element h */ |
| @@ -378,15 +378,8 @@ static void step5(int *ix, float *mdist, mat_t mstar, mat_t nmstar, | |||
| 378 | dmin); | 378 | dmin); |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | void match_fingers(int ix[DIM_FINGER], float A[DIM2_FINGER], int nrow, int ncol) | 381 | void match_fingers(int ix[DIM_FINGER], int A[DIM2_FINGER], int nrow, int ncol) |
| 382 | { | 382 | { |
| 383 | int i; | ||
| 384 | float max = 1; | ||
| 385 | for (i = 0; i < nrow * ncol; i++) | ||
| 386 | if (A[i] > max) | ||
| 387 | max = A[i]; | ||
| 388 | for (i = 0; i < nrow * ncol; i++) | ||
| 389 | A[i] /= max; | ||
| 390 | ixoptimal(ix, A, nrow, ncol); | 383 | ixoptimal(ix, A, nrow, ncol); |
| 391 | } | 384 | } |
| 392 | 385 | ||
