A bug in rotate

I’ve found that GMIC crashes if you try to rotate an image under certain conditions. Here is the log

Resize image [0] to 1536x115x1x3, with nearest-neighbor interpolation, dirichlet boundary conditions and alignment (0,0,0,0).
Rotate image [0] of 36.87 deg., with cubic interpolation and periodic boundary conditions.

Logfile ends.

Rotating the image by 36.8698 degrees or 36.88 works fine.

It fails with periodic boundary conditions only.

1 Like

I cannot reproduce the bug here.
I’m using :

foo :
  sp lena
  rotate 36.87,2,2 

but this works.
Could you provide a minimal command line which reproduces the crash ?

It only works with certain sizes. Try resizing to 1536x115 first

sp lena
resize 1536,115,1,3
rotate 36.87,2,2
gmic sp tiger rotate 36.87,2,2


This one doesn’t work indeed.
It seems to happen only when the optimization flag -mtune=generic is set (on Linux).
I’ll try to find what is happening.

After some investigations, I’ve found the bug and hopefully made a valid fix.

It appears that due to limited floating-point precision, it happened that computing the modulo returned an out-of-limit value (basically X mod Y returned Y, rather than 0, with X a floating point value very close to -0 and Y a large integer).

I think I’ll be able to release new pre-release packages of G’MIC, on next Monday.

Thanks for your report !

1 Like