mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
lib: Remove num_stripes from do_movement_estimation()
We never used a number of stripes that didn't match the length of the list anyway. Closes: #132
This commit is contained in:
@@ -121,13 +121,12 @@ static void find_overlap(struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned int do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
|
static unsigned int do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
|
||||||
GSList *stripes, size_t num_stripes,
|
GSList *stripes, gboolean reverse)
|
||||||
gboolean reverse)
|
|
||||||
{
|
{
|
||||||
GSList *list_entry = stripes;
|
GSList *l;
|
||||||
GTimer *timer;
|
GTimer *timer;
|
||||||
int frame = 1;
|
guint num_frames = 0;
|
||||||
struct fpi_frame *prev_stripe = list_entry->data;
|
struct fpi_frame *prev_stripe;
|
||||||
unsigned int min_error;
|
unsigned int min_error;
|
||||||
/* Max error is width * height * 255, for AES2501 which has the largest
|
/* Max error is width * height * 255, for AES2501 which has the largest
|
||||||
* sensor its 192*16*255 = 783360. So for 32bit value it's ~5482 frame before
|
* sensor its 192*16*255 = 783360. So for 32bit value it's ~5482 frame before
|
||||||
@@ -135,32 +134,28 @@ static unsigned int do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
*/
|
*/
|
||||||
unsigned long long total_error = 0;
|
unsigned long long total_error = 0;
|
||||||
|
|
||||||
list_entry = g_slist_next(list_entry);
|
|
||||||
|
|
||||||
timer = g_timer_new();
|
timer = g_timer_new();
|
||||||
do {
|
prev_stripe = stripes->data;
|
||||||
struct fpi_frame *cur_stripe = list_entry->data;
|
for (l = stripes; l != NULL; l = l->next, num_frames++) {
|
||||||
|
struct fpi_frame *cur_stripe = l->data;
|
||||||
|
|
||||||
if (reverse) {
|
if (reverse) {
|
||||||
find_overlap(ctx, prev_stripe, cur_stripe, &min_error);
|
find_overlap(ctx, prev_stripe, cur_stripe, &min_error);
|
||||||
cur_stripe->delta_y = -cur_stripe->delta_y;
|
cur_stripe->delta_y = -cur_stripe->delta_y;
|
||||||
cur_stripe->delta_x = -cur_stripe->delta_x;
|
cur_stripe->delta_x = -cur_stripe->delta_x;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
find_overlap(ctx, cur_stripe, prev_stripe, &min_error);
|
find_overlap(ctx, cur_stripe, prev_stripe, &min_error);
|
||||||
|
}
|
||||||
total_error += min_error;
|
total_error += min_error;
|
||||||
|
|
||||||
frame++;
|
|
||||||
prev_stripe = cur_stripe;
|
prev_stripe = cur_stripe;
|
||||||
list_entry = g_slist_next(list_entry);
|
}
|
||||||
|
|
||||||
} while (frame < num_stripes);
|
|
||||||
|
|
||||||
g_timer_stop(timer);
|
g_timer_stop(timer);
|
||||||
fp_dbg("calc delta completed in %f secs", g_timer_elapsed(timer, NULL));
|
fp_dbg("calc delta completed in %f secs", g_timer_elapsed(timer, NULL));
|
||||||
g_timer_destroy(timer);
|
g_timer_destroy(timer);
|
||||||
|
|
||||||
return total_error / num_stripes;
|
return total_error / num_frames;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -183,11 +178,14 @@ void fpi_do_movement_estimation(struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
GSList *stripes, size_t num_stripes)
|
GSList *stripes, size_t num_stripes)
|
||||||
{
|
{
|
||||||
int err, rev_err;
|
int err, rev_err;
|
||||||
err = do_movement_estimation(ctx, stripes, num_stripes, FALSE);
|
|
||||||
rev_err = do_movement_estimation(ctx, stripes, num_stripes, TRUE);
|
g_return_if_fail (g_slist_length(stripes) != num_stripes);
|
||||||
|
|
||||||
|
err = do_movement_estimation(ctx, stripes, FALSE);
|
||||||
|
rev_err = do_movement_estimation(ctx, stripes, TRUE);
|
||||||
fp_dbg("errors: %d rev: %d", err, rev_err);
|
fp_dbg("errors: %d rev: %d", err, rev_err);
|
||||||
if (err < rev_err) {
|
if (err < rev_err) {
|
||||||
do_movement_estimation(ctx, stripes, num_stripes, FALSE);
|
do_movement_estimation(ctx, stripes, FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user