Page 2 of 2

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-11T07:32:52-07:00
by NicolasRobidoux
Cristy's patch looks like a good one: In exact arithmetic, we are never taking a square root of something negative. But we're not in exact arithmetic.
From svn diff:

Code: Select all

-  const double sqrt_discriminant = sqrt(discriminant);
+  const double sqrt_discriminant =
+    sqrt(discriminant < -0.0 ? 0.0 : discriminant);
If more problems crop up, I should carefully put some MagickEpsilons in there.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-11T07:39:40-07:00
by NicolasRobidoux
This bug is an immediate illustration of "direct" SVD decompositions being ill-conditioned. Fast, but better be extra careful. And I was not.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-11T08:31:08-07:00
by NicolasRobidoux
Forgot to use changelist again with IM6 (Makefile.PL, magick-baseconfig.h and version.h changed when I did not intend to).
-----
In any case, I made the test this one to minimize the impact of "various computation branches on floating point computation":

Code: Select all

 /*
   * In exact arithmetic, discriminant can't be negative. In floating
   * point, it can, because of the bad conditioning of SVD
   * decompositions done through the associated normal matrix.
   */
  const double sqrt_discriminant =
    sqrt(discriminant > 0.0 ? discriminant : 0.0);

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-11T20:09:50-07:00
by anthony
The patch seems to have solved the problem.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-12T06:02:12-07:00
by NicolasRobidoux
I'm really impressed at how fast Cristy, Anthony and Fred got the issue figured out and solved.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-12T10:59:33-07:00
by fmw42
NicolasRobidoux wrote:I'm really impressed at how fast Cristy, Anthony and Fred got the issue figured out and solved.
Thanks goes to Anthony and Cristy and you. I really had nothing to contribute on this one.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-13T00:47:43-07:00
by tsanders
Is there any progress on the new beta release? Thanks.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-13T05:32:54-07:00
by tsanders
Found it! Checked it out and it works 100% OK! Thanks everyone, GREAT JOB!

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-13T05:51:03-07:00
by NicolasRobidoux
tsanders wrote:GREAT JOB!
... to you too. Thank you for your very informative bug report.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-13T16:16:02-07:00
by anthony
I have mapped it into IMv7 too.

Re: WEIRD: convert -distort Affine producing black images

Posted: 2012-12-14T06:28:37-07:00
by NicolasRobidoux
anthony wrote:I have mapped it into IMv7 too.
Apologies if I forgot. Juggling -> dropping balls.