anchor.diff:          (dcval 0))
       (declare #.*optimize*
                (type fixnum tmp0 tmp1 tmp2 tmp3 tmp10 tmp11 tmp12 tmp13 z1 z2 z3 z4 z5 dcval)
  -             (type sint16-2d-array block *ws*)
  +             (type sint16-2d-array block)
                (dynamic-extent tmp0 tmp1 tmp2 tmp3 tmp10 tmp11 tmp12 tmp13 z1 z2 z3 z4 z5 dcval))
       (loop for dptr fixnum from 0 to 7 ; iterating over columns
             if (and (zerop (s16ref block dptr 1))
  
positive.code: ;;; NB: probably it's a good idea to encapsulate this behavior into a class, but I'm
  ;;; afraid that method dispatch would be too slow
  
  (defun write-bits (bi ni s)
    (declare #.*optimize*
             ;(special *prev-length* *prev-byte*)
             (type fixnum bi ni *prev-legnth*)
  	   (type uint8 *prev-byte*)
             (type stream s))
    (loop with lim fixnum = (if (> ni 8) 1 0)
          for i fixnum from lim downto 0 do
  
negative.code:     (declare #.*optimize* (type fixnum n))
      (aref +csize+ (plus n 1023)))
  
  (defvar *zz-result* (make-array 64 :element-type 'sint16))
  (declaim (type sint16-array *zz-result*))
  
  ;;; zigzag ordering
  (defun zigzag (buffer)
    (declare #.*optimize*
  	   (type sint16-2d-array buffer))
    (loop for row of-type sint16-array across buffer
       for z-row of-type uint8-array across +zigzag-index+ do
         (loop for x fixnum from 0 to 7 do
  