anchor.diff:  (defun subsample (inbuf outbuf H V xlim ylim iH iV)
     (declare #.*optimize*
              (type fixnum H V xlim ylim iV iH)
  -           (type (simple-vector *) inbuf outbuf))
  +           (type fixnum-2d-array inbuf)
  +	   (type (simple-array fixnum-2d-array (*)) outbuf))
     (loop for by fixnum from 0 below V do
           (loop for bx fixnum from 0 below H
  -              for block = (svref outbuf (plus bx (mul by H))) do
  +              for block = (aref outbuf (plus bx (mul by H))) do
                 (loop for y fixnum from (ash by 3) by iV
                       for yp fixnum from 0 to 7 do
                       (loop for x fixnum from (ash bx 3) by iH
                             for xp fixnum from 0 to 7 do
  -                          (setf (dbref block xp yp)
  +                          (setf (fixref block xp yp)
                                   (the fixnum (cond ((and (<= x xlim) (<= y ylim))
  -                                                   (dbref inbuf x y))
  +                                                   (fixref inbuf x y))
                                                     ((and (> x xlim) (> y ylim))
  -                                                   (dbref inbuf xlim ylim))
  +                                                   (fixref inbuf xlim ylim))
                                                     ((> x xlim)
  -                                                   (dbref inbuf xlim y))
  +                                                   (fixref inbuf xlim y))
                                                     ((> y ylim)
  -                                                   (dbref inbuf x ylim))
  +                                                   (fixref inbuf x ylim))
                                                     (t
                                                      (error "Internal error"))
                                                      ))))))))
  
positive.code:                          (loop
                             ;; collecting sampling rates for a components in the scan
                             for i fixnum from 0 below ncomp
                             for cid fixnum = (first (svref (scan-cdesc scan) i))
                             for pos fixnum = (position cid (descriptor-cid image))
                             collecting (list (svref (descriptor-H image) pos)
                                              (svref (descriptor-V image) pos)))))
           (Hmax (loop for entry across fr maximize (first entry)))
           (Vmax (loop for entry across fr maximize (second entry)))
           (x-growth (ash Hmax 3))
           (y-growth (ash Vmax 3))
  	 (*ws* (make-array 8 :initial-contents (loop for i from 0 to 7 collecting (make-array 8)))) ; Temporary workspace for IDCT
           (freqs (make-array ncomp :initial-contents
                              (loop for i fixnum from 0 below ncomp ; collecting sampling frequencies
                                    for cid fixnum = (first (svref (scan-cdesc scan) i))
                                    for pos fixnum = (position cid (descriptor-cid image))
                                    collecting (list (svref (descriptor-iH image) pos)
                                                     (svref (descriptor-iV image) pos)))))
           (preds (make-array ncomp :initial-element 0)))
      (declare #.*optimize*
               (type fixnum ncomp Hmax Vmax x-growth y-growth nwidth)
               (type (simple-vector *) freqs fr)
  	     (special *ws*)
               (dynamic-extent fr freqs))
      (catch 'marker
  
negative.code:            (make-array ncomp
                         :initial-contents
                         (loop for i fixnum from 0 below ncomp
                               for ta fixnum = (logand (second (aref (scan-cdesc scan) i)) 15)
                               for td fixnum = (ash (second (aref (scan-cdesc scan) i)) -4)
                               collecting (vector (aref (descriptor-huff-ac image) ta)
                                                  (aref (descriptor-huff-dc image) td))))
          do (loop for comp fixnum from 0 below ncomp
  	      with zzbuf = (2d-fixnum-array
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0))
                   for pos fixnum =
                      (position (first (aref (scan-cdesc scan) comp))
                                (descriptor-cid image)) ; an offset for byte positioning
                   for q-tab = (aref (descriptor-qtables image) (aref (descriptor-qdest image) comp))
                   for H fixnum = (first (aref freqs comp))
                   for V fixnum = (second (aref freqs comp))
                   for nw fixnum = (mul nwidth V)
                   for nx fixnum = (mul (descriptor-ncomp image) H)
                   for blocks-y fixnum = (second (aref fr comp))
                   for blocks-x fixnum = (first (aref fr comp)) do
                      (loop for y fixnum from 0 below blocks-y
  		       for y-pos fixnum from (mul (ash y 3) V) by (ash V 3) do
                               (loop for x fixnum from 0 below blocks-x
                                     for x-pos fixnum from (mul (ash x 3) H) by (ash H 3)
                                     for decoded-block of-type fixnum-2d-array =
  				  (izigzag (decode-block (descriptor-zz image)
  							 (aref tables comp) nextbit s) zzbuf) do
                                     ;; DC decoding and predictor update
                                        (incf (fixref decoded-block 0 0) (aref preds comp))
                                        (setf (aref preds comp) (fixref decoded-block 0 0))
                                        (when (and (< (plus x-pos (scan-x scan)) (descriptor-width image))
                                                   (< (plus y-pos (scan-y scan)) (descriptor-height image)))
                                          ;; inverse DCT and block write to the buffer
  