Simplified some arithmetic and fixed some bugs when using negative display windows.
Fixed bugs when reformatting one image with a negative format to another.
Fixed the expected output of a test case which was wrong.
Validated the results against the result of a similar operation in other software.