mirror of
https://gitlab.freedesktop.org/libfprint/libfprint.git
synced 2025-11-15 07:38:12 +00:00
fpi-assembling: Accept error of zero
Rather than discarding a zero error, check that the constraints are sane. This way a perfect match is possible.
This commit is contained in:
@@ -52,6 +52,9 @@ calc_error (struct fpi_frame_asmbl_ctx *ctx,
|
||||
width = ctx->frame_width - (dx > 0 ? dx : -dx);
|
||||
height = ctx->frame_height - dy;
|
||||
|
||||
if (height == 0 || width == 0)
|
||||
return INT_MAX;
|
||||
|
||||
y1 = 0;
|
||||
y2 = dy;
|
||||
i = 0;
|
||||
@@ -86,9 +89,6 @@ calc_error (struct fpi_frame_asmbl_ctx *ctx,
|
||||
err *= (ctx->frame_height * ctx->frame_width);
|
||||
err /= (height * width);
|
||||
|
||||
if (err == 0)
|
||||
return INT_MAX;
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user