anchor.diff:                  (setf (svref buffer pv) ; RED
                         (the fixnum (limit (plus yy (svref *cr-r-tab* cr)))))))))
   
  -;;; Frame decoding subroutine
  -(defun decode-frame (image s)
  +(defun decode-frame-beginning (image s)
     (read-byte s) ; length
     (read-byte s)
     (read-byte s) ; sample precision
  
positive.code: ;;;JPEG file markers
  (defconstant +M_COM+ #xfe)
  (defconstant +M_SOF0+ #xc0)
  (defconstant +M_DHT+ #xc4)
  (defconstant +M_RST0+ #xd0)
  (defconstant +M_RST7+ #xd7)
  
negative.code:                    (descriptor-height image)
                     (descriptor-width image)
                     (descriptor-ncomp image)))
            (t (error "Unsupported JPEG format" marker)))))
  
  ;;; Top level decoder function
  (defun decode-image (filename)
    (with-open-file (in filename :direction :input :element-type 'unsigned-byte)
      (decode-stream in)))
  
  (defun decode-stream-height-width (stream)
    "Return the height and width of the JPEG data read from STREAM. Does less work than
  DECODE-STREAM and also supports progressive DCT-based JPEGs."
    (unless (= (read-marker stream) +M_SOI+)
      (error "Unrecognized JPEG format"))
    (let* ((image (make-descriptor)) ;; KLUDGE doing a lot of extra consing here
           (marker (interpret-markers image 0 stream)))
      (cond ((or (= +M_SOF0+ marker)
                 (= +M_SOF2+ marker)) (decode-frame-beginning image stream)
             (values (descriptor-height image)
                     (descriptor-width image)))
            (t (error "Unsupported JPEG format" marker)))))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;; Here are some useful routines
  