2021.05.02 00:36 "[Tiff] SIMD optimizations", by Larry Bank

2021.05.04 17:34 "Re: [Tiff] SIMD optimizations", by Steve Underwood

A list member posted repeatedly that he had private/proprietary CCITT Group 4 fax support which was much faster than what is in libtiff. Given this, one must assume that libtiff's implementation can be faster.

I work on Netpbm and I have written the code for CCITT Group 3 fax in the programs g3topbm and pbmtog3.

Netpbm is one bit per pixel for bilevel black and white images. This is called PBM format. The Group 3 fax to pbm encoder pbmtog3 works on the bits directly in byte chunks (=8 pixels at a time), so in a way it is like SIMD.

For Group 4 I have the algorithm in my head, but have never had the time to write down the code. For high efficiency the knack is to measure spans of white or black, determine the inflexion points (white - black borders) and work on them instead of testing one pixel at a time.

Group 4 encoding is just Group 3 2D encoding without the regular insertion of 1D lines among the 2D lines (i.e the error recovery has been removed, because G4 uses an error free communications channel). I've never seen a 2D encoder that truly works bit by bit. Its pointlessly inefficient.

A long time ago I submitted fixes for buffer overflows in libtiff's G3 and G4 handling. I had some speedups for the buffer management, but I don't think I submitted those. At the time my priority was making libtiff robust, so it didn't crash on numerous slightly miscoded images (e.g. a fax received with uncorrected errors). I remember it was certainly possible to speed things up a bit with relatively simple tweaks.

Regards,

Steve