.title IMGCVL ; ; convolver control code .mcall CSI$ CSI$ ; ; CVLCTL:: ;this code fills 3 buffers with bytes and then ;calls CONVOL sub to convolve data jsr pc,$SAVAL ;save all regs mov BUFSIZ,R0 ;load byte count asr R0 ;get word count mov #BUF,R1 ;load start address mov BUFCTR,R2 ;load destination buffer address bgt 9$ ;if normally 2,4 blt 1$ ;special case 1st call when bufctr = -1 ;case of bufctr=0 1st line just swap buffer ptrs ;move line2 to line1 , line3 to line 2 ;ignore data actually read in !!!!! mov LINE1,-(SP) ;tmp it mov LINE2,LINE1 ;swap around buffer addresses not data ! mov LINE3,LINE2 mov (SP)+,LINE3 ;round robin the buffer addreses clr INITK ;initialize kernel on first call only ; mov #2,BUFCTR ;go from 0 to 2 and on exit will be at 4 ; br 12$ ;go tell main done and read in data for line 3 ; ; 1$: ;we must clr 1st row to zeros and move buf-BUF2 ;clr 1st row mov #BUF1,R2 ;address of 1st row 2$: clr (R2)+ sob R0,2$ ;clr all words to zeros ; mov #BUF1,LINE1 mov #BUF2,LINE2 mov #BUF3,LINE3 ;initailize buffer pointers for rotating stack ; mov #2,BUFCTR ;load buf counter to point to 2nd line mov BUFCTR,R2 ;reload R2 with legal offset mov BUFSIZ,R0 ;refresh R0 to proper word count asr R0 ;get words not bytes br 9$ ;go move buf to BUF2 ,1st call to cvl ; ; ; 9$: mov BUFPTR(R2),R2 ; 10$: mov (R1)+,R3 ;mov data from BUF to BUFn swab R3 ;FORTRAN BYTES NEED TO BE REVERSED mov R3,(R2)+ ;store it back sob R0,10$ ; 12$: cmp #2,BUFCTR ;is this 2nd buffer ? bne 20$ ;if not try 1st,3rd ; mov YIN,YINTMP ;store temp code mov INVBN,INVBNt mov INVBN+2,INVBNt+2 ;store original line addresses ; add YINX,YIN ;incr to following line # cmp YIN,#511. ;tst for out of image bounds ? ble 15$ ;if not go on mov #511.,YIN ;load last line twice ; 15$: add YINX,INVBN+2 ;incr if from disk adc INVBN br MORE ;go input folowing raster line ; 20$: cmp #4,BUFCTR ;3rd line read ? set up for 1st bne DONE ;ignore if error mov YINTMP,YIN mov INVBNt,INVBN mov INVBNt+2,INVBN+2 ;having filled 3 buffers with rasters ; ; ;all 3 buffers are filled , go call UNSHARver ; clr BUFCTR ;zero buf ctr for next time clr CVLTYP ;default to unsharp bit #KERMSK,$SWTHI ;tst for /KE switch beq 3$ ;if not tst on mov #2,CVLTYP ;load type br callit 3$: bit #DSKMSK,$SWTHI ;tst for despiker ? /DS:n beq 4$ ;if not go on mov #3,CVLTYP ;load despiker call br callit 4$: bit #CVLMSK,CSIBLK+C.MKW2 ;tst for negated CV switch ? bne callit ;if not use isotropic filter ;it has 2 parameters mov #1,CVLTYP ;else use UNSHARP masking filter ; UNSHARP MASKING CONVOLVER ; callit: MOV #ARGS,R5 ;LOAD ADDRS OF ARGS jsr pc,CONVOL ARGS: br DONE ;# of args CVLTYP ;addres of type of convolver BUFPTR: ;table of buffer ptrs LINE1: BUF1 LINE2: BUF2 LINE3: BUF3 ALPHA ;alpha BETA BUF ;store result back INITK ;initailize flag only calc kernel once ; DONE: jsr pc,SWAPB ;swap byttes back from fortran land ; SEC rts pc ; ; ; MORE: add #2,BUFcTR ;point to next buffer CLC ;flag caller not done yet rts pc ;unsave regs and return to caller ; ; table of lines read in their order ; ; INITK: 0 ;initialize kernel this call flag time saver CVLTYP: 0 ;0=unsharp,1=iostropic INVBNt: .blkw 2 ;tmp INVBN holder YINTMP: 0 ;tmp YIN holder ; ; .end