[fpc-pascal] Faster way of doing this?

Reinier Olislagers reinierolislagers at gmail.com
Tue Feb 26 11:37:36 CET 2013


I've been looking at adding some support for bilevel (black & white)
TIFF images.

I seem to have something working for uncompressed images, but I'm almost
sure that this:
procedure TFPReaderTiff.ReadImgValue(BitCount: Word; var Run: Pointer;
x: dword;
  Predictor: word; var LastValue: word; out Value: Word); inline;
var
  BitNumber: byte;
begin
...
  //Get the value of the right bit depending on x value
  // and scale it to dword: either $ffff or $0000
  BitNumber:=7-(x mod 8); //Leftmost pixel starts with bit 7
  Value:=$ffff*
        ((PCUInt8(Run)^) and (1 shl BitNumber) shr BitNumber);

can be rewritten so it is faster.

Any suggestions?

Thanks,
Reinier



More information about the fpc-pascal mailing list