mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
lib: Remove num_stripes from movement_estimation()
fpi_do_movement_estimation is always called with num_stripes set to the length of the list. Rather than using the passed value, assume we should consume all stripes from the list. Closes: #132
This commit is contained in:
committed by
Benjamin Berg
parent
0b87b21d52
commit
dcc04089d1
@@ -128,13 +128,12 @@ find_overlap (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
|
|
||||||
static unsigned int
|
static unsigned int
|
||||||
do_movement_estimation (struct fpi_frame_asmbl_ctx *ctx,
|
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
|
||||||
@@ -142,12 +141,11 @@ 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;
|
||||||
|
for (l = stripes; l != NULL; l = l->next, num_frames++)
|
||||||
{
|
{
|
||||||
struct fpi_frame *cur_stripe = list_entry->data;
|
struct fpi_frame *cur_stripe = l->data;
|
||||||
|
|
||||||
if (reverse)
|
if (reverse)
|
||||||
{
|
{
|
||||||
@@ -161,18 +159,14 @@ do_movement_estimation (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
}
|
}
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -197,11 +191,13 @@ fpi_do_movement_estimation (struct fpi_frame_asmbl_ctx *ctx,
|
|||||||
{
|
{
|
||||||
int err, rev_err;
|
int err, rev_err;
|
||||||
|
|
||||||
err = do_movement_estimation (ctx, stripes, num_stripes, FALSE);
|
g_return_if_fail (g_slist_length(stripes) != num_stripes);
|
||||||
rev_err = do_movement_estimation (ctx, stripes, num_stripes, TRUE);
|
|
||||||
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
|
|||||||
Reference in New Issue
Block a user