anchor.diff:        (setf (svref *idct-limit-array* i) n))
   (loop for i from 384 to 511 do
         (setf (svref *idct-limit-array* i) 255))
  -
  -;;; State variables for write-bits
  -(defvar *prev-byte* 0)
  -(defvar *prev-length* 0)
   
   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   ;;; Encoder part
  
positive.code: )
  
  ;;; Quantization performance test, each branch quantizes 30000 random matrixes
  (eval-when (:load-toplevel :compile-toplevel)
  
  (format t "Performing compile-time optimization.. please wait.~%")
  (finish-output)
  
  (defvar *quantize-optimization*
    (<= (let ((time1 (get-internal-run-time)))
          (loop for i fixnum from 1 to 30000 do
                (loop for row across +q-luminance+ do
                      (loop for q-coef fixnum across row
                            maximize (round (random 128) q-coef))))
          (minus (get-internal-run-time) time1))
        (let ((time1 (get-internal-run-time)))
          (loop for i fixnum from 1 to 30000 do
                (loop for q-row across +q-luminance+ do
                      (loop for val fixnum = (random 128)
                            for absval fixnum = (abs val)
                            for qc fixnum across q-row
                            maximize
                            (cond ((< absval (ash qc -1))
                                   0)
                                  ((<= absval qc)
                                   (if (minusp val)
                                       -1
                                     1))
                                  ((<= (ash absval -1) qc)
                                   (if (zerop (logand absval 1))
                                       (if (minusp val)
                                           -1
                                         1)
                                     (if (minusp val)
                                         -2
                                       2)))
                                  (t
                                   (round val qc))))))
                      (minus (get-internal-run-time) time1))))
  (format t "Done.~%")
  (finish-output)
  )
  
  (define-constant +q-tables+ (vector +q-luminance+ +q-chrominance+))
  
  
negative.code:                              collecting (vector (svref (descriptor-huff-ac image) ta)
                                                  (svref (descriptor-huff-dc image) td))))
          do (loop for comp fixnum from 0 below ncomp
  		 with zzbuf = #(#(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 (svref (scan-cdesc scan) comp))
                                (descriptor-cid image)) ; an offset for byte positioning
  