anchor.diff:      with TwoDimCodes[I] do AddCode(F2DStates, Code, Len, I);
   end;
   
  +procedure TCCITTDecoder.UpdateChangingElem;
  +begin
  +  if Length(fChangingElems[not fRowUsed])<=fCurChangingElem then
  +    SetLength(fChangingElems[not fRowUsed],Length(fChangingElems[not fRowUsed])*2+1); //asymptotically fast realloc
  +  fChangingElems[not fRowUsed,fCurChangingElem]:=fBitPos;
  +  inc(fCurChangingElem);
  +end;
  +
   //----------------- TCCITTFax3Decoder ----------------------------------------------------------------------------------
   
   procedure TCCITTFax3Decoder.Decode(var Source, Dest: Pointer; PackedSize, UnpackedSize: Integer);
  
positive.code:           else
              RunLength := FindBlackCode;
            FillRun(RunLength);
            inc(BitPos, RunLength);
  
            if Length(ChangingElems[not RowUsed])<=CurChangingElem then
              SetLength(ChangingElems[not RowUsed],Length(ChangingElems[not RowUsed])*2+1); //asymptotically fast realloc
            ChangingElems[not RowUsed,CurChangingElem]:=BitPos;
            inc(CurChangingElem);
  
            if BitPos = FWidth then
              Break;
  
            FIsWhite := not FIsWhite;
  
negative.code:     FTarget: PByte;
      FFreeTargetBits: Byte;
      FWordAligned: Boolean;
  
      //some fields for 2D compression. Will be used in Fax3 (T4) as well as Fax4 (T6) decoders
      fChangingElems: array [Boolean] of array of Integer;  //coordinates of these pixels on prev. row
      fcurChangingElem: Integer; //even (0,2,...) means changing from white to black,
                              //odd (1,3,...) are black to white
      fprevChangingElem: Integer;
      fRowUsed: Boolean;
      fBitPos: Integer;
  
      procedure MakeStates;
    protected
      procedure ReverseBits(Source: Pointer; PackedSize: Integer);
  