         .title dcmprs P ;*******************************************************************************G ;_TITLE         DCMPRS, a subroutine to decompress a line of image data  ; # ;_CALL_SEQ      the FORTRAN call is 6 ;               CALL DCMPRS (ibuf, obuf, nb, ns, tree) ; G ;_ARGS          ibuf - input compressed bit string (character variable) J ;               obuf - output decompressed image line (character variable)E ;                      (both ibuf and obuf must declared as character ; ;                      variables in by the calling program) 6 ;               nb -   number of bytes in input string> ;               ns -   number of bytes expected in output line9 ;               tree - binary tree for decompressing line  ; A ;_DESC          The routine uses each successive bit in the input E ;               string to trace down the tree to the leaf.  The value D ;               of the pixel is stored in the leaf.  If diff is true@ ;               the routine reconstructs the undifferenced pixelD ;               value.  For VAX/VMS users using the fortran versionsA ;               of the decompression software, this macro version D ;               can replace the fortran version of the same name. ByK ;               utilizing the macro version, the speed of the decompression D ;               software will improve by a factor of 2. This routineI ;               only works with the fortran versions of the decompression  ;               software ; D ;_HIST          28Jul87, DMcMacken, ISD, Flagstaff, Original version ;  ;_END P ;******************************************************************************* ;  ;       local variables  ; 2 root:   .long                   ;tree root pointer ; :         .entry  dcmprs,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11> ; 8         movl    4(ap),r11       ;input buffer descriptor5         movl    4(r11),r11      ;input buffer address 9         movl    8(ap),r10       ;output buffer descriptor 1         movl    4(r10),r10	;output buffer address 3         movl    @12(ap),r9      ;number input bytes ?         movl    @16(ap),r8      ;number output samples expected 5         movl    20(ap),r7       ;address of code tree  ;          movl    #1023,r5         mull2   #5,r5          movzwl  (r7)[r5],root          decl    root         mull2   #5,root  ; 3         decl    r8              ;count first sample 7         decl    r9              ;..it is not compressed 1         movzbw  (r11)+,r6       ;get first sample 4         movb    r6,(r10)+       ;return it unchanged ; 8         movl    root,r5         ;pointer to root of tree. loop:   movzbw  (r11)+,r3       ;get next byte,         movl    #7,r4           ;bit pointer/ lp2:    bbc     r4,r3,right     ;test input bit *                                 ;0 - right)                                 ;1 - left 1         movw    4(r7)[r5],r5    ;get left pointer )         brb     cont            ;continue 2 right:  movw    2(r7)[r5],r5    ;get right pointer, cont:   decl    r5              ;compute new*         mull2   #5,r5           ;...offset)         cmpw    #-1,(r7)[r5]    ;at leaf? 6         beql    next            ;no, go to next branch/         movw    (r7)[r5],r2     ;yes, get value 3         subw2   r2,r6           ;compute difference 1         addw2   #256,r6         ;make it positive 3         movw    r6,r2           ;return value to r2 .         movb    r2,(r10)+       ;return sample3         movl    root,r5         ;point back to root .         sobgtr  r8,next         ;more samples?5         ret                     ;no, return to caller ; next:   sobgeq  r4,lp2          ;more bits in current byte? A         sobgtr  r9,loop         ;no, is there another input byte? +         ret                     ;no, return          .end