.title dcmprsP;*******************************************************************************G;_TITLE DCMPRS, a subroutine to decompress a line of image data;#;_CALL_SEQ the FORTRAN call is6; 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 inputE; string to trace down the tree to the leaf. The valueD; 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 versionD; can replace the fortran version of the same name. ByK; utilizing the macro version, the speed of the decompressionD; 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;;_ENDP;*******************************************************************************;; local variables;2root: .long ;tree root pointer;: .entry dcmprs,^m;8 movl 4(ap),r11 ;input buffer descriptor5 movl 4(r11),r11 ;input buffer address9 movl 8(ap),r10 ;output buffer descriptor1 movl 4(r10),r10 ;output buffer address3 movl @12(ap),r9 ;number input bytes? movl @16(ap),r8 ;number output samples expected5 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 sample7 decl r9 ;..it is not compressed1 movzbw (r11)+,r6 ;get first sample4 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 - left1 movw 4(r7)[r5],r5 ;get left pointer) brb cont ;continue2right: 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 value3 subw2 r2,r6 ;compute difference1 addw2 #256,r6 ;make it positive3 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