anchor.diff:      procedure DecodeQuantTable;
       procedure DecodeHuffmanTable;
       procedure DecodeSOF;
  -    procedure DecodeHuffmanScan;
  +    procedure DecodeSequentialDCTScan;
       procedure DecodeDNL;
  +    procedure DecodeHuffmanBlock(CompNum, QuantID: Integer);
  +    procedure DecodeArithmBlock(CompNum, QuantID: Integer); //will raise exception so far
     public
       constructor Create(Properties: Pointer);
       destructor Destroy; override;
  
positive.code: //      GraphicExError(Format('quantization table %d not present',[fColorComponents[i].QuantId]));
    end;
  
    //now we determine layout of interleaved output
    LeastCommonDivider:=1;
    for i := 0 to Nf-1 do
      LeastCommonDivider := max(LeastCommonDivider, fColorComponents[i].HSampling * fColorComponents[i].VSampling);
    //we know that we have at least one channel with VSampling=HSampling=1 (otherwise we'd better lower resolution)
    //and also that only 1,2,4 are allowed. So, no problem.
    fInterleavedBlockSize:=0;
    for i := 0 to Nf-1 do begin
      fColorComponents[i].SampleCount := LeastCommonDivider div (fColorComponents[i].HSampling * fColorComponents[i].VSampling);
      fColorComponents[i].SampleOffset := fInterleavedBlockSize;
      fColorComponents[i].Run := fDest;
      inc(fColorComponents[i].Run,fInterleavedBlockSize);
      inc(fInterleavedBlockSize, fColorComponents[i].SampleCount * fBytesPerSample);
    end;
    fRowSize := fX * fInterleavedBlockSize;
    fBlocksPerRow := (fX + 7) div (8 * LeastCommonDivider);
  
  
    //here we begin scans
  
negative.code:     PRED: array [0..3] of Integer;  //previous DC coefficient for each component.
        //After each RST it must reset to 0
        //no more than 4 components per scan is allowed, so we use static array here
      //not sure we need these
      curCol: array [0..3] of Integer;  //to manage edges of image if part of block is used
      curLine: array [0..3] of Integer;
    //settings of current scan
      Ns: Word; //number of components in current scan
      ScanHeaders: array of TJpegScanHeader;
      Ss: Byte; //start of spectral/predictor selection
      Se: Byte; //end of spectral/predictor selection (for progressive mode)
      Ah: Byte; //high bit of DCT coefs
      Al: Byte; //low bit of DCT coefs (for another type of progressive mode)
  
      fBuffer: TRealArray64;  //for DCT mode of course
  
      fDecodeBlockProc: TDecodeBlockProc;
  
      function NextByte: Byte;
      function NextWord: Word; //will swap
  