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:
Benjamin Berg 2019-12-06 18:54:49 +01:00
parent b8e558452a
commit d9bcf9b9cc

View file

@ -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;
}