www.pudn.com > g729Decoder.rar > CONVOLVE.asm


;========================================================================== 
;  File Name 
;  ---------- 
;  CONVOLVE.ASM 
; 
;  Brief Description of the Code: 
;  ------------------------------ 
;  Perform the convolution between two vectors x[] and h[] and 
;  write the result in the vector y[]. 
;  All vectors are of length N. 
; 
;  Ref 
;  ------ 
;  FILTER.C 
;========================================================================== 
;  void Convolve( 
;    Word16 x[],      /* (i)     : input vector                           */ 
;    Word16 h[],      /* (i) Q12 : impulse response                       */ 
;    Word16 y[],      /* (o)     : output vector                          */ 
;    Word16 L         /* (i)     : vector size                            */ 
;  ) 
;----------------------------------------------------------------------- 
;  Str_Conv           .sturct 
;  ptr_x              .word   1 
;  ptr_h              .word   1 
;  ptr_y              .word   1 
;  Str_Conv_Len       .endstruct 
;----------------------------------------------------------------------- 
;  Str_Conv   param_conv 
;----------------------------------------------------------------------- 
;  Input  : BRC = L - 1 
;           pConv_X -> x 
;           pConv_H -> h 
;           pConv_y -> y 
; 
;  Output : y[] 
; 
;  Modified Registers : AR3, AR4, AR5 
; 
;  Note   : DP = 0 
;----------------------------------------------------------------------- 
;  Modification by Chuan (3/97) 
; 
;   Using AR3 - AR5 as input parameters instead of param_conv. 
;----------------------------------------------------------------------- 
        .MMREGS 
        .include ..\include\const.h 
        .include ..\include\struct.h 
        .include ..\include\ld8amem.h 
        .include ..\include\convolve.h 
 
        .def     Convolve 
 
Convolve: 
        LD      #0, DP 
 
        SSBX    OVM 
 
        RPTBD   BLK_END-1 
        STM     #0, AR0 
                LD      #0, A 
                RPT     AR0 
                        MAC    *pConv_X+, *pConv_H-, A 
                LD      A, 3, A 
                STL     A, -16,*pConv_Y+ 
 
                MAR     *AR0+                   ; n++ 
                MAR     *pConv_X-0 
                MAR     *pConv_H+ 
				NOP 
                MAR     *pConv_H+0 
BLK_END 
        RSBX    OVM 
        RET