2007.07.12 15:21 "[Tiff] how to rotate an image", by Oliver Geisen

2007.07.17 12:10 "Re: [Tiff] Re: Bit shifting and rotating of TIFF images", by Ron

On Tue, Jul 17, 2007 at 11:32:35AM +0200, Oliver Geisen wrote:

Simulated image of 16300x27501 pixels, bilevel:

Results:

*  plain reading/writing (no bit-manipulation): 0.294 sec
 bit-shift operator ("<<" resp. ">>"):  1.920 sec* using


 lookup-table:                          0.380 sec* using

>>
>> That is interesting. It seems that you are right that for the CPU you are
>> using the lookup-table approach is much faster. Maybe it is always
>> faster.

I think this is true for images beyond a specific size (number of pixels).

I suspect you'll find the size (and perhaps even layout) of your lookup table is a significant factor. Along with the data you look up in it. If the entries you need don't fit in the cache that's when the performance penalties kick in.

Also if your algorithmic method isn't the best it can be, and not coded in hand optimised (or at least audited) assembler, then what you are comparing may not be a 'fair' contest.

I know of at least one fairly recent benchmark where an algorithmic method supposedly beats a lookup table, but its implementation also relies on fast bit manipulations that are available to the processor, but not exposed to people coding in C.

Since your current results are only about 25% slower than a raw copy, whether its worth pursuing that really depends on how big a number you are adding 25% to ;-)... and whether your performance figures really do stay around this level with varying input data.

Cheers,

Ron