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


;================================================================ 
;  File Name 
;  ---------- 
;  MOV_WARN.ASM 
; 
;  Brief Description of the Code: 
;  ------------------------------ 
;  Find the lag that has maximum correlation with scal_sig[]  
;  Only to remove warning from some compilers 
; 
;  Ref 
;  ------ 
;  PITCH_A.C 
;================================================================ 
;  mov_war3: 
;---------------------------------------------------------------- 
;  arguments: 
; 
;    signal[]   :Signal used to compute the open loop pitch. 
;    L_frame    :Length of frame to compute pitch. 
;    lag_max    :Maximum lag 
;    lag_min    :Minimum lag 
;    *cor_max   ;Maximum of normalized correlation of lag found. 
; 
;  Return lag found. 
;---------------------------------------------------------------- 
;  Str_Lag_max        .struct 
;  ptr_signal         .word   1 
;  lag_max            .word   1 
;  lag_min            .word   1 
;  ptr_cor_max        .word   1 
;  Str_Lag_max_Len    .endstruct 
;---------------------------------------------------------------- 
;  Buffer : Addr_lag_max_buf[2] at even boundary 
;---------------------------------------------------------------- 
;  Output : AR1 = p_max 
;  Modified Registers: AR0, AR1, AR4, AR5, AR6 
;---------------------------------------------------------------- 
		.mmregs 
		.include ..\include\const.h 
		.include ..\include\struct.h 
		.include ..\include\ld8amem.h 
 
        .text 
        .def     mov_war3 
 
param_lag_max   .tag     Str_Lag_max 
 
        .asg     "AR1", p_max 
		.asg     "AR4", p 
		.asg     "AR5", p1 
 
        .asg     "Addr_lag_max_buf",         max 
        .asg     "Addr_lag_max_buf+4",       inv_energy 
        .asg     "ptr_wsp",                  signal 
        .asg     "Addr_pitch_ol_buf",        scal_sig 
 
;------------------------------------------------------------- 
;  note : param_lag_max is set at Addr_pitch_ol_buf + 230, 
;         which is same data page as Addr_lag_max_buf 
;------------------------------------------------------------- 
 
		.asg     "AR4", pSig 
		.asg     "AR5", pSig1 
 
		.asg     "AR4", pTemp 
		.asg     "AR5", pMax 
 
 
mov_war3: 
 
		LD      #param_lag_max, DP 
        LD      param_lag_max.lag_max, A 
        SUB     param_lag_max.lag_min, A 
        MVDM    param_lag_max.lag_min, AR0    ; AR0 = i     = lag_min 
        ROR     A 
        STLM    A, BRC 
 
        STM     #scal_sig+PIT_MAX, pSig       ; pSig -> scal_sig[0] 
        MVMM    AR0, p_max                    ; AR1 (p_max) = lag_min 
 
        RPTBD   BLK_END - 1 
        LD      #8000h, 16, B                  ; max = MIN_32 
 
 
                MVDM    pSig, pSig1                    
                NOP 
                MAR     *pSig1-0              ; p1 = &scal_sig[-i] 
 
                LD      #L_FRAME, 0, A 
                ROR     A 
                SUB     #1, 0, A 
                STLM    A, AR6 
                LD      #0, 16, A 
 
L0: 
                MAC     *pSig, *pSig1, A 
                MAR     *+pSig(2)             ; p += 2 
	        BANZD    L0, *AR6- 
	        MAR     *+pSig1(2)            ; p1 += 2 
 
        MAX     B 
        STM     #scal_sig+PIT_MAX, pSig ; pSig -> scal_sig[0] 
        XC      2, NC 
                MVMM    AR0, p_max     ; AR1(p_max) = i 
 
        NOP 
        MAR     *+AR0(2)                   ; i += 2 
 
BLK_END 
 
        STM      #max, pMax      ; L_extract(max,&maxl_h,&max_l) 
        STL      B, -16, *pMax        ; max_h               
        LD       *pMax+, 15, A 
        LD       B, -1, B 
        SUB      A, B 
 
        RETD 
        STL      B, *pMax        ; max_l 
		NOP