anchor.diff:            else
               Break;
         until (RunLength = G3_EOL) or (FPackedSize = 0);
  -      if Length(ChangingElems[RowUsed])<=CurChangingElem then
  -        SetLength(ChangingElems[RowUsed],Length(ChangingElems[RowUsed])*2+1); //asymptotically fast realloc
  -      ChangingElems[RowUsed,CurChangingElem]:=FWidth;
       end;
  +    fBitPos:=fWidth;
  +    UpdateChangingElem;
       AdjustEOL;
       inc(RowCount);
  +    fRowUsed:=not fRowUsed;
     until (FPackedSize = 0) or (FTarget - PChar(Dest) >= UnpackedSize);
   end;
   
  
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;
  
            while ChangingElems[RowUsed,PrevChangingElem]<=BitPos do
              inc(PrevChangingElem,2); //we might want to add 'dummy' at the end of line
            FIsWhite := not FIsWhite;
          end
          else if (RunLength > 1) and (RunLength < 9) then begin
            //vertical coding
            if RunLength <6 then
              RunLength := (ChangingElems[RowUsed, PrevChangingElem]-BitPos)+(RunLength-2)  //R0 to R3
            else
              RunLength := (ChangingElems[RowUsed, PrevChangingElem]-BitPos)-(RunLength-5);  //L1 to L3
            if RunLength<0 then break; //some garbage got here
            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;
            //find b positions again, that is moving CurChangingElem
  
            dec(PrevChangingElem);  //as we may turn left, then maybe previous changing elem of same color is better
            if PrevChangingElem=-1 then
              PrevChangingElem:=1;
  
            while ChangingElems[RowUsed,PrevChangingElem]<=BitPos do
              inc(PrevChangingElem,2);
          end
          else
            raise Exception.Create('special codes for reverting fax3 2D to uncompressed mode not implemented');
        until false;
        //if BitPos>=FWidth then Exit;
  
        RowUsed:=not RowUsed;
      end
      else begin
        // a line always starts with a white run
  
negative.code:           RunLength := FindBlackCode;
          //populating array for 2D compression (if needed)
          if ((FOptions and 1) <> 0) then begin
            inc(fBitPos, RunLength);
            UpdateChangingElem;
          end;
  
          if RunLength >= 0 then
          begin
  