Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2013-02

Faster way of doing this?

3 messages · 1 person · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Reinier Olislagers

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

Reply by email