home *** CD-ROM | disk | FTP | other *** search
/ Audio 4.94 - Over 11,000 Files / audio-11000.iso / msdos / sndbords / proaudio / pcmtlsrc / tpcm.arj / PCMF7.ASM < prev    next >
Assembly Source File  |  1992-07-29  |  25KB  |  813 lines

  1. ;$Author:   BCRANE  $
  2. ;$Date:   29 Jul 1992 16:57:56  $
  3. ;$Header:   W:/sccs/sdkapp/pcmf7.asv   1.0   29 Jul 1992 16:57:56   BCRANE  $
  4. ;$Log:   W:/sccs/sdkapp/pcmf7.asv  $
  5. ;  
  6. ;     Rev 1.0   29 Jul 1992 16:57:56   BCRANE
  7. ;  Initial revision.
  8. ;$Logfile:   W:/sccs/sdkapp/pcmf7.asv  $
  9. ;$Modtimes$
  10. ;$Revision:   1.0  $
  11. ;$Workfile:   pcmf7.asm  $ 
  12.  
  13.     .model compact, c
  14.  
  15. PCMBUFLEN equ 1024
  16. HORZDIMS equ 320
  17. VERTDIMS equ 200
  18. DSPWIDTH equ 256
  19. HORZMARG equ (HORZDIMS - DSPWIDTH) / 2 
  20. SKIPFACTOR equ PCMBUFLEN / DSPWIDTH
  21.  
  22. public dspfilter
  23. public filter7
  24.  
  25. extrn OURSTATFLAG:far
  26. extrn OURDMABUF:far
  27. extrn SBSIZE:far
  28. extrn PCMBUFDIVS:far
  29.  
  30. pushall macro
  31.     push ax
  32.     push bx
  33.     push cx
  34.     push dx
  35.     push si
  36.     push di
  37.     push es
  38.     push ds
  39.     endm
  40.  
  41. popall macro
  42.     pop ds
  43.     pop es
  44.     pop di
  45.     pop si
  46.     pop dx
  47.     pop cx
  48.     pop bx
  49.     pop ax
  50.     endm
  51.  
  52.     .code
  53.  
  54. ;; video buffer positioning variables
  55. xpos    dw     0
  56. timesin dw    0
  57. ovb     dd DSPWIDTH * 8 * 2 dup (0)
  58. ovbpel    db DSPWIDTH * 8 * 2 dup (0)
  59.  
  60. ;; Results for the filter7 routine
  61. result    dw 8 dup (0)
  62.  
  63. input    dw    0    ;; for filter7 routine 
  64. output    dw 0
  65.  
  66. dspfilter proc
  67.     pushall
  68.  
  69.     mov bx, seg OURSTATFLAG
  70.     mov es, bx
  71.     mov bx, offset OURSTATFLAG
  72.     dec word ptr es:[bx]
  73.     jns @F
  74.  
  75.     mov word ptr es:[bx], 0
  76.  
  77. @@:    cmp cs:[xpos], DSPWIDTH
  78.     jb @F
  79.     mov cs:[xpos], 0
  80. @@:
  81.     mov bx, seg OURDMABUF
  82.     mov es, bx
  83.     mov bx, offset OURDMABUF
  84.     mov si, es:[bx][2]
  85.     mov ds, si
  86.     mov si, es:[bx][0]
  87.  
  88.     mov bx, offset SBSIZE
  89.     mov ax, es:[bx]
  90.  
  91.     mov bx, offset PCMBUFDIVS
  92.     mov dx, es:[bx]
  93.     dec dx
  94.  
  95.     mov cx, cs:[timesin]
  96.     inc cs:[timesin]
  97.  
  98.     and cx, dx
  99.     
  100.     jcxz timesout
  101. @@:    add si, ax
  102.     loop @B
  103. timesout:
  104.  
  105.     cmp ax, DSPWIDTH
  106.     jb @F
  107.  
  108.     mov ax, DSPWIDTH
  109.  
  110. @@:    mov cx, ax        ; count of pels to process
  111.  
  112. nextpel:
  113.     rept SKIPFACTOR
  114.         lodsb            ; PCM data byte
  115.         xor al, 80h
  116.         mov byte ptr cs:input, al    ; for filter7
  117.         call filter7        ; calculate result[0] through result[12]
  118.     endm
  119.  
  120.     loop nextpel
  121.  
  122.     mov cx, cs:[xpos]    ; cx= current xpos
  123.     mov bx, cx        ; offset into dd table
  124.     shl bx, 1        ; *2 
  125.     shl bx, 1        ; *4 for dd
  126.     shl bx, 1        ; *2
  127.     shl bx, 1        ; *4
  128.     shl bx, 1        ; *8 for # of filters
  129.  
  130.     irp dummy,<0,2,4,6,8,10,12>
  131.         push bx            ; save pointer to table
  132.         mov ax, word ptr cs:[ovb][bx][2]    ; last es for restoring pel
  133.         or ax, ax        ; valid seg?
  134.         jz @F            ; no, skip
  135.  
  136.         mov es, ax
  137.         mov di, word ptr cs:[ovb][bx][0]    ; es:di points to pel
  138.         push bx            ; save ovb pointer
  139.         shr bx, 1        ; convert to byte index
  140.         shr bx, 1
  141.         mov al, byte ptr cs:[ovbpel][bx]    ; get last color
  142.         pop bx            ; restore ovb pointer
  143.  
  144.         mov byte ptr es:[di][HORZMARG], al    ; restore color to pel
  145.  
  146. @@:
  147.         mov ax, cs:[result][dummy]        ; band result
  148. ;        xor ax, ax
  149. ;        mov al, ah
  150. ;        cbw
  151. ;        xor ah, ah
  152. ;        sar ax, 1        ; make within display range
  153. ;        sar ax, 1        ; make within display range
  154.  
  155.         add ax, VERTDIMS * (dummy+ 1) / 14     ; middle of screen
  156.  
  157.         mov bx, HORZDIMS    ; width of screen
  158.         imul bx            ; dx:ax points to video buffer (not seg:off)
  159.         mov bx, ax
  160.  
  161.         shl dx, 1        ; adjust segment
  162.         shl dx, 1
  163.         shl dx, 1 
  164.         shl dx, 1
  165.         add dx, 0A000h        ; video buffer
  166.         mov es, dx        ; segment in video buffer
  167.  
  168.         add bx, cs:[xpos]        ; es:bx is video buffer + xpos
  169.  
  170.         mov dl, byte ptr es:[bx][HORZMARG]
  171.         mov al, byte ptr 0FFh
  172.         mov byte ptr es:[bx][HORZMARG], al
  173.  
  174.         mov ax, bx        ; save current bx
  175.         pop bx            ; restore pointer to last pel table
  176.  
  177.         mov word ptr cs:[ovb][bx][0], ax    ; store current es:bx
  178.         mov ax, es
  179.         mov word ptr cs:[ovb][bx][2], ax
  180.  
  181.         push bx
  182.         shr bx, 1
  183.         shr bx, 1
  184.         mov byte ptr cs:[ovbpel][bx], dl
  185.         pop bx
  186.  
  187.         add bx, 4        ; point to next ovb entry
  188.     endm
  189.     
  190.     inc cs:[xpos]        ; next x position
  191.  
  192.     popall
  193.     retf
  194. dspfilter endp
  195. ;;***********************************************************************
  196. ;;*
  197. ;;*  This filter bank recognizer consists of seven filter banks which
  198. ;;*  are uniformly spaced covering frequency band between 200 - 3500 Hz.
  199. ;;*  
  200. ;;*  One interesting note says that filter banks performance degrades for
  201. ;;*  filter banks with too few filters or too many filters for nonover-
  202. ;;*  lapping filter banks. Reason is that for small number of filters the
  203. ;;*  system gives very poor frequency resolution leading to an inability
  204. ;;*  to discriminate between words and otherwise with large number of fil-
  205. ;;*  ters cause too narrow the bandwidth that these filters often measuring
  206. ;;*  noise instead of speech. The later case is especially pronounced for
  207. ;;*  the female talker (with high pitch) since the speech harmonics are
  208. ;;*  widely spaced and some bands in this case are backgroung noise.
  209. ;;*
  210. ;;*
  211. ;;***********************************************************************
  212.  
  213.  
  214. ;; Assume the ADC has only 8 bit, and also this variable is useful for all
  215. ;; filter bank operation as current sample
  216.  
  217. ;;;input    dw    0    
  218.  
  219. ;; Define threshold for detecting the start and end points
  220. k1    equ    2
  221. k2    equ    5    ;These values are tentative
  222. k3    equ    15
  223. k4    equ    4
  224.  
  225. ;; Define the zero crossing threshold so that number of counts will correspond
  226. ;; to the possible fricatives which starts at the beginning of each word.
  227.  
  228. zc_cnt1    dw    0
  229. zc_cnt2    dw    0
  230.  
  231. ;; These are for get rid of the DC component
  232. x1    dw    0
  233. x2    dw    0
  234.  
  235. ;; Bandpass filter 1
  236. y11    dw    0    ;one sample delay 
  237. y12    dw    0    ;two sample delay
  238. ;; Bandpass filter 2
  239. y21    dw    0    
  240. y22    dw    0    
  241. ;; Bandpass filter 3
  242. y31    dw    0    
  243. y32    dw    0    
  244. ;; Bandpass filter 4
  245. y41    dw    0    
  246. y42    dw    0    
  247. ;; Bandpass filter 5
  248. y51    dw    0    
  249. y52    dw    0    
  250. ;; Bandpass filter 6
  251. y61    dw    0    
  252. y62    dw    0    
  253. ;; Bandpass filter 7
  254. y71    dw    0    
  255. y72    dw    0
  256.   
  257.  
  258.  
  259. filter7        PROC    
  260.     pushall
  261.         mov    ax,cs
  262.         mov    ds,ax
  263.         mov    es,ax
  264.     assume ds:_text
  265.  
  266. ;   /*\
  267. ;---|*|------------------=================================------------------------
  268. ;---|*|------------------====< Start of Main Loop >=======------------------------
  269. ;---|*|------------------=================================------------------------
  270. ;   \*/
  271. ;
  272. ;
  273. ;;***********************************************************************************                
  274. ;;*
  275. ;;* The total filter bank is seven for simplification. All are two-pole band-
  276. ;;* pass filter. The first coefficient of the filter is in table1 and second coeff.
  277. ;;* is in table2. All the second coefficients are same constant.
  278. ;;* Each sample is processed through one multiply tables and have one computed
  279. ;;* sum which will be accumulated along the whole frame. Each frame is consists of
  280. ;;* 128 to 256 samples (the optimal value is to be tested). So the whole frame
  281. ;;* is about 16 ms to 20 ms long.
  282. ;;*
  283. ;;***********************************************************************************
  284.        
  285. ;; Assume the input is stored in ax
  286. ;; Initially bx,dx are zero and ax  stores the input
  287.  
  288. waiting:
  289.     mov    input,ax         ;
  290.     mov    bx,x2             ;
  291.     sub    input,bx         ; get rid of DC offset
  292. ;; 
  293. ;;The bx retains the last value to compute the "input" for the main loop
  294. ;;which is without DC.
  295.  
  296.     mov    bx,x1             ;
  297.     mov    x2,bx             ; 
  298.     mov    x1,ax             ; 
  299.  
  300.  
  301. ;;*********************************************************************************
  302. ;;*
  303. ;;* Use of the registers and memory parameters for each filter bank
  304. ;;* 
  305. ;;* (1)    x?0 :: is the input
  306. ;;*    x?1 :: is the delay-1 term
  307. ;;*     x?2 :: is the delay-2 term
  308. ;;*  
  309. ;;* (2) AX,BX are the primary registers for handling filter bank operation
  310. ;;*     then the results are stored in these memory locations
  311. ;;*
  312. ;;*  
  313. ;;* Note: In Z8 version, both r11 & r13 are checked for the sign of its value since 
  314. ;;*       value of r13 is passed over by r11.        
  315. ;;*
  316. ;;***********************************************************************************
  317.  
  318.  
  319. ;;The bandpass filter, the formula describes :
  320. ;;
  321. ;;  y(n)=x(n)+2*COS(theta)*r*y(n-1)-r^2*y(n-2)
  322. ;;
  323. ;;All filter banks have second coeff. positive. So the subtract is always
  324. ;;performed for the second coeff. That is clearly coded in the first part
  325. ;;of the following code. But since first coeff. changes sign for each filter
  326. ;;bank.   
  327. ;;
  328.  
  329.  
  330. filter_1:
  331.  
  332. ;; Pointing to the entry of table for the first coefficient
  333.  
  334.     lea    si,table1   ;Use SI pointing to first coefficient
  335.     lea    di,table2   ;Use DI pointing to second coefficient
  336.  
  337.     mov    ax,input         ;get input value
  338.     mov    bx,y12             ;take in the delayed-2 term
  339.         or      bx,bx             ;check the sign of the delayed-2 term
  340.         js      filt_10             ;jump on sign set
  341.     mov    dx,word ptr [si+bx]  ;load the multiply value
  342.     sub    ax,dx             ;if bx>=0 subtract the result
  343.     jmp     filt_11             
  344. filt_10:   
  345.         add     si,80h*2              ;add 128(d) to address another half table
  346.         mov     dx,word ptr [si+bx]  ;otherwise bx < 0
  347.         add     ax,dx             ;add the result
  348. filt_11:                  
  349.     mov    ax,y11              ;Pass delay-1 to delay-2 for next cycle
  350.     mov    y12,ax             ;
  351.     or    ax,ax              ;check negative or positive
  352.     js    filt_12             ;if delay-1 is negative do addition
  353.     mov    dx,word ptr [si+bx]  ;multiply by coeficient
  354.     sub    ax,dx             ;otherwise subtract the result
  355.     jmp    filt_13             ;
  356. filt_12:                 ;negative
  357.         add     si,80h*2             ;if delay-1 is minus then point to negative entries     
  358.         mov     dx,word ptr [si+bx]  ;
  359.     add    ax,dx             ;add to the result
  360. filt_13:
  361.     mov    y11,ax
  362.     mov    ax,input
  363.  
  364. ;;
  365. ;;Get the absolute value of the filter bank output
  366. ;;
  367.     lea    di,table3            ;DI pointing to absolute value table
  368.     add     ax,di
  369.     mov    dx,word ptr [di]     ;get absolute value
  370.     add    ax,dx             ;use "ax" to hold whole value of sum
  371.     add result[0], ax
  372.  
  373. ;;
  374. ;;Note the second coeff. for this filter bank is negative
  375. ;;
  376.  
  377. filter_2:
  378.  
  379.     lea    si,table1+100h*2         ;pointing to next multiply table
  380.     mov    ax,input         ;
  381.         mov     bx,y22             ;
  382.         or    bx,bx
  383.         js    filt_20             ;
  384.     mov    dx,word ptr [si+bx]  ; multiply by 2nd coeff. 
  385.     sub    ax,dx             ; if r13>=0 subtract the result
  386.     jmp    filt_21             ;
  387. filt_20:   
  388.         add     si,80h*2                   ;
  389.         mov     dx,word ptr [si+bx]  ; otherwise r13<0
  390.         add     ax,dx             ; add the result
  391. filt_21:                     ;  ; 
  392.     mov    ax,y21              ;
  393.     mov    y22,ax             ;
  394.     or    ax,ax              ;
  395.     js    filt_22             ;
  396.     mov    dx,word ptr [si+bx]  ;
  397.     sub    ax,dx             ;
  398.     jmp    filt_23             ;
  399. filt_22:
  400.         add     si,80h*2             ; pointing the negative entries     
  401.         mov     dx,word ptr [si+bx]  ;
  402.     add    ax,dx             ;
  403. filt_23:
  404.     mov    y21,ax
  405.     mov    ax,input
  406.     lea    di,table3            ;
  407.     add     ax,di             ;
  408.     mov    dx,word ptr [di]     ;
  409.     add    ax,dx             ;
  410.     add result[2], ax
  411.  
  412.  
  413. ;;
  414. ;;Note that this table1 coefficient3 for the filter is negative
  415. ;;
  416.  
  417. filter_3:
  418.  
  419.     lea    si,table1+200h
  420.     mov    ax,input         ;
  421.     mov    bx,y32
  422.         or      bx,bx             ;
  423.         js      filt_30             ;
  424.     mov     dx,word ptr [si+bx]  ; multiply by 2nd coeff. 
  425.     sub    ax,dx             ; if r13>=0, subtract the result
  426.     jmp     filt_31             ;
  427. filt_30:   
  428.         add     si,80h*2                   ;
  429.         mov     dx,word ptr [si+bx]  ; otherwise r13<0
  430.         add     ax,dx             ; add the result
  431. filt_31:                     ; 
  432.     mov     ax,y31              ;
  433.     mov    y32,ax             ;
  434.     or    ax,ax              ;
  435.     js    filt_32             ;
  436.     mov    dx,word ptr [si+bx]  ;
  437.     sub    ax,dx             ;
  438.     jmp    filt_33             ;
  439. filt_32:
  440.         add     si,80h*2             ; pointing the negative entries     
  441.         mov     dx,word ptr [si+bx]  ;
  442.     add    ax,dx             ;
  443. filt_33:
  444.     mov    y21,ax             ;
  445.     mov    ax,input         ;
  446.     lea    di,table3            ;DI pointing to absolute value table
  447.     add     ax,di
  448.     mov    dx,word ptr [di]  ;get absolute value
  449.     add    ax,dx             ;use "ax" to hold whole value of sum
  450.     add result[4], ax
  451.  
  452.  
  453. ;;
  454. ;;table1 coefficient4 for the filter is zero. So in this case,delay-1 term is
  455. ;;always zero, the result is the sum of delay-2 and input
  456. ;;
  457.  
  458. filter_4:
  459.     lea    si,table1+300h         ;
  460.     mov    ax,input         ;
  461.     mov    bx,y42             ;
  462.         or      bx,bx                  ;
  463.         js      filt_40             ;
  464.     mov     dx,word ptr [si+bx]  ;2nd coefficient table
  465.     sub    ax,dx             ;
  466.         jmp     filt_41             ;
  467. filt_40:                 ;
  468.         add     si,80h*2             ;
  469.         mov     dx,word ptr [si+bx]  ;
  470.         add     ax,dx             ;
  471. filt_41:
  472.     mov    y41,ax             ;
  473.     mov    ax,input         ;
  474.     mov    ax,input         ;
  475.     mov    y41,ax             ;
  476.     lea    di,table3            ;DI pointing to absolute value table
  477.     add     ax,di
  478.     mov    dx,word ptr [di]     ;get absolute value
  479.     add    ax,dx             ;use "ax" to hold whole value of sum
  480.     add result[6], ax
  481.  
  482.  
  483. ;;
  484. ;;table1 coefficient5 for the filter is positive
  485. ;;
  486.  
  487. filter_5:
  488.     lea    si,table1+400h         ;
  489.     mov    ax,input         ;
  490.     mov    bx,y52             ;
  491.         or      bx,bx             ;
  492.         js      filt_50             ;
  493.     mov    dx,word ptr [si+bx]  ;multiply by 2nd coeff. 
  494.     add    ax,dx             ;if r13>=0 add the result
  495.     jmp     filt_51             ;
  496. filt_50:   
  497.         add     si,80h*2                  ;otherwise r13<0 modify the table
  498.         mov     dx,word ptr [si+bx]  ;pointer
  499.         sub     ax,dx             ;
  500. filt_51:                 ;subtract the result
  501.     mov    ax,y51              ;
  502.     mov    y52,ax             ;
  503.     or    ax,ax              ;
  504.     js    filt_52             ;
  505.     mov    dx,word ptr [si+bx]  ;
  506.     add    ax,dx             ;
  507.     jmp    filt_53             ;
  508. filt_52:
  509.         add     si,80h*2             ;
  510.         mov     dx,word ptr [si+bx]  ;
  511.     sub    ax,dx             ;
  512. filt_53:
  513.     mov    y51,ax
  514.     mov    ax,input
  515.     lea    di,table3            ;DI pointing to absolute value table
  516.     add     ax,di
  517.     mov    dx,word ptr [di]     ;get absolute value
  518.     add    ax,dx             ;use "ax" to hold whole value of sum
  519.     add result[8], ax
  520.  
  521.  
  522.  
  523. ;;
  524. ;;table1 coefficient6 for the filter is positive
  525. ;;
  526.  
  527.  
  528. filter_6:
  529.     lea    si,table1+500h         ;
  530.     mov    ax,input         ;
  531.     mov    bx,y62             ;
  532.         or      bx,bx             ;
  533.         js      filt_60             ;
  534.     mov    dx,word ptr [si+bx]  ;multiply by 2nd coeff. 
  535.     add    ax,dx             ;if r13>=0 add the result
  536.     jmp     filt_61             ;
  537. filt_60:   
  538.         add     si,80h*2                  ;otherwise r13<0 modify the table
  539.         mov     dx,word ptr [si+bx]  ;pointer
  540.         sub     ax,dx             ;
  541. filt_61:                 ;subtract the result
  542.     mov    ax,y61              ;
  543.     mov    y62,ax             ;
  544.     or    ax,ax              ;
  545.     js    filt_62             ;
  546.     mov    dx,word ptr [si+bx]  ;
  547.     add    ax,dx             ;
  548.     jmp    filt_63             ;
  549. filt_62:
  550.         add     si,80h*2             ;
  551.         mov     dx,word ptr [si+bx]  ;
  552.     sub    ax,dx             ;
  553. filt_63:
  554.     mov    y61,ax
  555.     mov    ax,input
  556.     lea    di,table3            ;DI pointing to absolute value table
  557.     add     ax,di
  558.     mov    dx,word ptr [di]     ;get absolute value
  559.     add    ax,dx             ;use "ax" to hold whole value of sum
  560.     add result[10], ax
  561.  
  562.  
  563. ;
  564. ;table1 coefficient7 for the filter is positive
  565. ;
  566.  
  567. filter_7:
  568.     lea    si,table1+600h         ;
  569.     mov    ax,input         ;
  570.     mov    bx,y72             ;
  571.         or      bx,bx             ;
  572.         js      filt_70             ;
  573.     mov    dx,word ptr [si+bx]  ;multiply by 2nd coeff. 
  574.     add    ax,dx             ;if r13>=0 add the result
  575.     jmp     filt_71             ;
  576. filt_70:   
  577.         add     si,80h*2                  ;otherwise r13<0 modify the table
  578.         mov     dx,word ptr [si+bx]  ;pointer
  579.         sub     ax,dx             ;
  580. filt_71:                 ;subtract the result
  581.     mov    ax,y71              ;
  582.     mov    y72,ax             ;
  583.     or    ax,ax              ;
  584.     js    filt_72             ;
  585.     mov    dx,word ptr [si+bx]  ;
  586.     add    ax,dx             ;
  587.     jmp    filt_73             ;
  588. filt_72:
  589.         add     si,80h*2             ;
  590.         mov     dx,word ptr [si+bx]  ;
  591.     sub    ax,dx             ;
  592. filt_73:
  593.     mov    y71,ax
  594.     mov    ax,input
  595.     lea    di,table3            ;DI pointing to absolute value table
  596.     add     ax,di
  597.     mov    dx,word ptr [di]     ;get absolute value
  598.     add    ax,dx             ;use "ax" to hold whole value of sum
  599.     add result[12], ax
  600.  
  601.     popall
  602.     ret
  603.  
  604. filter7 endp
  605.  
  606.  
  607. ;;*******************************************************************
  608. ;;*
  609. ;;* Start of the multiply table
  610. ;;* 
  611. ;;* Note: 1) The use of multiply table will speed up all the operation 
  612. ;;*       considerably vs the multiply instruction. 
  613. ;;*       2) The original derivation can come up seven tables for the
  614. ;;*         first coefficient and one table for the second coefficient
  615. ;;*       since the second coefficient is always constant. But the fouth
  616. ;;*       first coefficient is zero so the operation regards it is skipped.
  617. ;;*
  618. ;;*      2) The following tables describe what original coefficients from
  619. ;;*      these basic biquad bandpass filters look like based on the roughly
  620. ;;*       seven bands division on zero to pie range.
  621. ;;*
  622. ;;*      The formula for the biquad bandpass filter is :
  623. ;;*        
  624. ;;*       Y(Z)/X(Z) = 1/(1 - 2*COS(theta)*r^(-1)*Z^(-1) + r^(-2)*Z^(-2))
  625. ;;*       theta is roughly about 23 degree.
  626. ;;*
  627. ;;*      {-1.700, 0.8464},
  628. ;;*      {-1.301, 0.8464},
  629. ;;*      {-0.704, 0.8464},
  630. ;;*      { 0.0, 0.8464},
  631. ;;*      { 0.704, 0.8464},
  632. ;;*      { 1.301, 0.8464},
  633. ;;*      { 1.700, 0.8464}};
  634. ;;*
  635. ;;*
  636. ;;*      3) Each multiply table is 256*2 bytes apart. So for these seven 
  637. ;;*       filter banks operation, 256*2 bytes offset is added each times
  638. ;;*       when one filter bank operation is completed.
  639. ;;*
  640. ;;*       
  641. ;;*******************************************************************
  642.  
  643.  
  644. table1    label    word
  645.         DW   2, 3, 5, 7, 9,10,12,14,15,17,19,20,22,24,26,27
  646.         DW   29,31,32,34,36,37,39,41,43,44,46,48,49,51,53,54
  647.         DW   56,58,60,61,63,65,66,68,70,71,73,75,77,78,80,82
  648.         DW   83,85,87,88,90,92,94,95,97,99,100,102,104,105,107,109
  649.         DW   111,112,114,116,117,119,121,122,124,126,128,129,131,133,134,136
  650.         DW   138,139,141,143,145,146,148,150,151,153,155,156,158,160,162,163
  651.         DW   165,167,168,170,172,173,175,177,179,180,182,184,185,187,189,190
  652.         DW   192,194,196,197,199,201,202,204,206,207,209,211,213,214,216,218
  653.  
  654.  
  655.         DW   215,213,212,210,208,206,205,203,201,200,198,196,195,193,191,189
  656.         DW   188,186,184,183,181,179,178,176,174,172,171,169,167,166,164,1
  657.         DW   161,159,157,155,154,152,150,149,147,145,144,142,140,138,137,135
  658.         DW   133,132,130,128,127,125,123,121,120,118,116,115,113,111,110,108
  659.         DW   106,104,103,101,99,98,96,94,93,91,89,87,86,84,82,81
  660.         DW   79,77,76,74,72,70,69,67,65,64,62,60,59,57,55,53
  661.         DW   52,50,48,47,45,43,42,40,38,36,35,33,31,30,28,26  
  662.         DW   25,23,21,19,18,16,14,13,11,9,8,6,4,2,1,0
  663.  
  664. ;for filter bank #2 
  665.         DW   1, 3, 4, 5, 7, 8, 9,10,12,13,14,16,17,18,20,21
  666.         DW   22,23,25,26,27,29,30,31,33,34,35,36,38,39,40,42
  667.         DW   43,44,46,47,48,49,51,52,53,55,56,57,59,60,61,62
  668.         DW   64,65,66,68,69,70,72,73,74,75,77,78,79,81,82,83
  669.         DW   85,86,87,88,90,91,92,94,95,96,98,99,100,101,103,104
  670.         DW   105,107,108,109,111,112,113,114,116,117,118,120,121,122,124,125
  671.         DW   126,127,129,130,131,133,134,135,137,138,139,141,142,143,144,146
  672.         DW   147,148,150,151,152,154,155,156,157,159,160,161,163,164,165,167
  673.  
  674.  
  675.         DW   145,146,147,149,150,151,153,154,155,156,158,159,160,162,163,164
  676.         DW   124,125,126,128,129,130,132,133,134,136,137,138,140,141,142,143
  677.         DW   103,104,106,107,108,110,111,112,113,115,116,117,119,120,121,123
  678.        DW   82,84,85,86,87,89,90,91,93,94,95,97,98,99,100,102
  679.         DW   61,63,64,65,67,68,69,71,72,73,74,76,77,78,80,81
  680.         DW   41,42,43,45,46,47,48,50,51,52,54,55,56,58,59,60
  681.         DW   20,21,22,24,25,26,28,29,30,32,33,34,35,37,38,39
  682.         DW   0, 0, 2, 3, 4, 6, 7, 8, 9,11,12,13,15,16,17,19
  683.  
  684. ;for filter bank #3
  685.         DW   1, 1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9,10,11,11
  686.         DW   12,13,13,14,15,15,16,17,18,18,19,20,20,21,22,23
  687.         DW   23,24,25,25,26,27,27,28,29,30,30,31,32,32,33,34
  688.         DW   34,35,36,37,37,38,39,39,40,41,42,42,43,44,44,45
  689.         DW   46,46,47,48,49,49,50,51,51,52,53,54,54,55,56,56
  690.         DW   57,58,58,59,60,61,61,62,63,63,64,65,65,66,67,68
  691.         DW   68,69,70,70,71,72,73,73,74,75,75,76,77,77,78,79
  692.         DW   80,80,81,82,82,83,84,84,85,86,87,87,88,89,89,90
  693.  
  694.  
  695.         DW   88,88,87,86,86,85,84,83,83,82,81,81,80,79,79,78
  696.         DW   77,76,76,75,74,74,73,72,72,71,70,69,69,68,67,67
  697.         DW   66,65,64,64,63,62,62,61,60,60,59,58,57,57,56,55
  698.         DW   55,54,53,53,52,51,50,50,49,48,48,47,46,45,45,44
  699.         DW   43,43,42,41,41,40,39,38,38,37,36,36,35,34,33,33
  700.         DW   32,31,31,30,29,29,28,27,26,26,25,24,24,23,22,22
  701.         DW   21,20,19,19,18,17,17,16,15,14,14,13,12,12,11,10
  702.         DW   10,9, 8, 7, 7, 6, 5, 5, 4, 3, 3, 2, 1, 0, 0, 0
  703.  
  704. ;for filter bank #4
  705.     DW   0,  1,  1,  2,  3,  4,  4,  5,  6,  6,  7,  8,  8,  9, 10, 11
  706.         DW   11,12,13,13,14,15,15,16,17,18,18,19,20,20,21,22
  707.         DW   23,23,24,25,25,26,27,27,28,29,30,30,31,32,32,33
  708.         DW   34,34,35,36,37,37,38,39,39,40,41,42,42,43,44,44
  709.         DW   45,46,46,47,48,49,49,50,51,51,52,53,54,54,55,56
  710.         DW   56,57,58,58,59,60,61,61,62,63,63,64,65,65,66,67
  711.         DW   68,68,69,70,70,71,72,73,73,74,75,75,76,77,77,78
  712.         DW   79,80,80,81,82,82,83,84,84,85,86,87,87,88,89,89
  713.  
  714.         DW   89,88,88,87,86,86,85,84,83,83,82,81,81,80,79,79
  715.         DW   78,77,76,76,75,74,74,73,72,72,71,70,69,69,68,67
  716.         DW   67,66,65,64,64,63,62,62,61,60,60,59,58,57,57,56
  717.         DW   55,55,54,53,53,52,51,50,50,49,48,48,47,46,45,45
  718.         DW   44,43,43,42,41,41,40,39,38,38,37,36,36,35,34,33
  719.         DW   33,32,31,31,30,29,29,28,27,26,26,25,24,24,23,22
  720.         DW   22,21,20,19,19,18,17,17,16,15,14,14,13,12,12,11
  721.         DW   10,10,9 ,8 ,7 ,7 ,6 ,5 ,5 ,4 ,3 ,3 ,2 ,1 ,0 ,0 
  722.  
  723.  
  724. ;for filter bank #5
  725.         DW   0, 1, 3, 4, 5, 7, 8, 9,10,12,13,14,16,17,18,20
  726.         DW   21,22,23,25,26,27,29,30,31,33,34,35,36,38,39,40
  727.         DW   42,43,44,46,47,48,49,51,52,53,55,56,57,59,60,61
  728.         DW   62,64,65,66,68,69,70,72,73,74,75,77,78,79,81,82
  729.         DW   83,85,86,87,88,90,91,92,94,95,96,98,99,100,101,103
  730.         DW   104,105,107,108,109,111,112,113,114,116,117,118,120,121,122,124
  731.         DW   125,126,127,129,130,131,133,134,135,137,138,139,141,142,143,144
  732.         DW   146,147,148,150,151,152,154,155,156,157,159,160,161,163,164,165
  733.  
  734.         DW   166,164,163,162,160,159,158,156,155,154,153,151,150,149,147,146
  735.         DW   145,143,142,141,140,138,137,136,134,133,132,130,129,128,126,125
  736.         DW   124,123,121,120,119,117,116,115,113,112,111,110,108,107,106,104
  737.         DW   103,102,100,99,98,97,95,94,93,91,90,89,87,86,85,84
  738.         DW   82,81,80,78,77,76,74,73,72,71,69,68,67,65,64,63
  739.         DW   61,60,59,58,56,55,54,52,51,50,48,47,46,45,43,42
  740.         DW   41,39,38,37,35,34,33,32,30,29,28,26,25,24,22,21
  741.         DW   20,19,17,16,15,13,12,11,9,8,7,6,4,3,2, 0
  742.  
  743.  
  744. ;for filter bank #6
  745.         DW   0, 2, 3, 5, 7, 9,10,12,14,15,17,19,20,22,24,26
  746.         DW   27,29,31,32,34,36,37,39,41,43,44,46,48,49,51,53
  747.         DW   54,56,58,60,61,63,65,66,68,70,71,73,75,77,78,80
  748.         DW   82,83,85,87,88,90,92,94,95,97,99,100,102,104,105,107
  749.         DW   109,111,112,114,116,117,119,121,122,124,126,128,129,131,133,134
  750.         DW   136,138,139,141,143,145,146,148,150,151,153,155,156,158,160,162
  751.         DW   163,165,167,168,170,172,173,175,177,179,180,182,184,185,187,189
  752.         DW   190,192,194,196,197,199,201,202,204,206,207,209,211,213,214,216
  753.  
  754.         DW   217,215,213,212,210,208,206,205,203,201,200,198,196,195,193,191
  755.         DW   189,188,186,184,183,181,179,178,176,174,172,171,169,167,166,164
  756.         DW   162,161,159,157,155,154,152,150,149,147,145,144,142,140,138,137
  757.         DW   135,133,132,130,128,127,125,123,121,120,118,116,115,113,111,110
  758.         DW   108,106,104,103,101,99,98,96,94,93,91,89,87,86,84,82
  759.         DW   81,79,77,76,74,72,70,69,67,65,64,62,60,59,57,55
  760.         DW   53,52,50,48,47,45,43,42,40,38,36,35,33,31,30,28
  761.         DW   26,25,23,21,19,18,16,14,13,11,9,8,6,4,2,1
  762.  
  763.  
  764. ;for all filter banks
  765. table2  label    word
  766.         DW   0, 1, 2, 3, 3, 4, 5, 6, 7, 8, 8, 9,10,11,12,13
  767.         DW   14,14,15,16,17,18,19,19,20,21,22,23,24,25,25,26
  768.         DW   27,28,29,30,30,31,32,33,34,35,36,36,37,38,39,40
  769.         DW   41,41,42,43,44,45,46,47,47,48,49,50,51,52,52,53
  770.         DW   54,55,56,57,58,58,59,60,61,62,63,63,64,65,66,67
  771.        DW   68,69,69,70,71,72,73,74,74,75,76,77,78,79,80,80
  772.         DW   81,82,83,84,85,85,86,87,88,89,90,91,91,92,93,94
  773.         DW   95,96,96,97,98,99,100,101,102,102,103,104,105,106,107,107
  774.  
  775.         DW   107,106,106,105,104,103,102,101,101,100,99,98,97,96,95,95
  776.         DW   94,93,92,91,90,90,89,88,87,86,85,84,84,83,82,81
  777.         DW   80,79,79,78,77,76,75,74,73,73,72,71,70,69,68,68
  778.         DW   67,66,65,64,63,62,62,61,60,59,58,57,57,56,55,54
  779.         DW   53,52,51,51,50,49,48,47,46,46,45,44,43,42,41,40
  780.         DW   40,39,38,37,36,35,35,34,33,32,31,30,29,29,28,27
  781.         DW   26,25,24,24,23,22,21,20,19,18,18,17,16,15,14,13
  782.         DW   13,12,11,10,9,8,7,7,6,5,4,3,2,2,1, 0
  783.  
  784.  
  785. ;for all filter banks
  786. table3    label     word
  787.     DW   0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15
  788.     DW   16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
  789.     DW   32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47
  790.     DW   48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63
  791.     DW   64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79
  792.     DW   80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95
  793.     DW   96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111
  794.     DW   112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127
  795.  
  796.  
  797. ;;******************************
  798. ;;*
  799. ;;* End of the multiply table
  800. ;;*
  801. ;;******************************
  802.  
  803. addaxbydi proc
  804.  
  805.     push di
  806. @@:    add ax, VERTDIMS*2
  807.     sub di, 2
  808.     jnz @B
  809.     pop di
  810.     ret
  811. addaxbydi endp
  812. end
  813.