The patch "compare.diff" modifies the functions image_sim_compare and image_sim_compare_fast so that it compares with the eight possible isometric transformations (compositions of 90°-rotations, mirrors, transpose,...), using the same similarity signature.
The patch "fill_data.diff" is a slight modification of the image_sim_fill_data, that creates the similarity signature. When the image size is not a multiple of 32, all cells had size w/32, so the last w%32 pixels were just ignored, and more importantly it was not symmetric at all when the signature was built from the other side, which is annoying for my comparison algorithm. So I changed the cell size (x_inc) from a constant one to "round(w_left/n_left)", in order to spread the spare pixels (eg to split 42 pixels into 4 cells, it results in 11,10,11,10 instead of 10,10,10,10). With an image of size w with w%32=16, my rotation-invariant algorithm results in a similarity of 0.951000 with the original version, and 0.999968 with this modification (apparently lossless jpeg rotation is not perfectly lossless).
I haven't done any special integration, I just modify the default behavior, so that you can test it and decide how to integrate it, maybe this should be an option. I haven't modified the "alternate" comparison algorithm, but it is straightforward as my algorithm only changes which cells it compares, not how it compares them.
Any comment, any idea, any question, feel free :-)