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:
parent
b8e558452a
commit
d9bcf9b9cc
1 changed files with 3 additions and 3 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue