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


;========================================================================== 
;  File Name 
;  ---------- 
;  UPDT_ERR.ASM 
; 
;  Brief Description of the Code: 
;  ------------------------------ 
;  Maintains the memory used to compute the error function 
;  due to an adaptive codebook mismatch between encoder and decoder 
; 
;  Ref 
;  ------ 
;  COD_LD8K.C 
;========================================================================== 
;  Function : update_exc_err 
;---------------------------------------------------------------------- 
;  static void update_exc_err( 
;   Word16 gain_pit,      /* (i) pitch gain */ 
;   Word16 T0             /* (i) integer part of pitch delay */ 
;  ) 
;---------------------------------------------------------------------- 
;  Constants : Addr_T0 -> T0 
;              Addr_gain_pit -> gain_pit 
; 
;  Pointer : ptr_L_exc_err -> L_exc_err 
; 
;  Modified Registers : AR0, AR4, AR5, DP, BRC 
;---------------------------------------------------------------------- 
        .mmregs 
        .include ../include/const.h 
        .include ../include/ld8amem.h 
        .include ../include/tab_ld8a.h 
        .include ../include/qua_gain.h 
 
        .text 
        .def     update_exc_err 
 
update_exc_err: 
        STM     #0, BK 
        LD      #Addr_T0, DP 
        LD      #L_SUBFR, A 
        SUB     Addr_T0, A 
        BCD     Else, ALEQ 
        STM     #Addr_gain_pit, AR4 
 
If: 
                MVDM    #ptr_L_exc_err, AR5 
                LD      #-1, B 
                MAR     *AR5+ 
; MPY32_16 : 
                LD       #0, A 
                MACSU    *AR5-, *AR4, A 
                LD       A, -16, A 
                MAC      *AR4, *AR5, A 
 
                LD       A, 1, A 
                ADD      #4000h, A 
                MAX      B 
 
                STM      #BL, AR5 
; MPY32_16 : 
                LD       #0, A 
                MACSU    *AR5+, *AR4, A 
                LD       A, -16, A 
                MAC      *AR5, *AR4, A 
 
                LD       A, 1, A 
                ADD      #4000h, A 
 
                BD       Next 
                MAX      B 
                NOP 
 
Else: 
; zone1 = tab_zone[n] 
                NEG      A 
                STLM     A, AR5 
                STM      #tab_zone, AR0 
                NOP 
                MAR      *AR5+0 
                LD       *AR5, A        ; A = zone1 
 
; zone2 = tab_zone[i]; 
                MVDM     Addr_T0, AR5 
                NOP 
                MAR      *AR5-          ; i = sub(T0, 1) 
                MAR      *AR5+0 
                LD       *AR5, B        ; B = zone2 
 
                SUB      A, B 
                STLM     B, BRC 
 
                LD       #ptr_L_exc_err, DP 
                LD       A, 1, A 
                ADD      ptr_L_exc_err, A 
                STLM     A, AR5 
                STM      #3, AR0 
                MAR      *AR5+ 
                RPTBD    BLK1_END-1 
                LD       #-1, B 
 
; MPY32_16 : 
                         LD       #0, A 
                         MACSU    *AR5-, *AR4, A 
                         LD       A, -16, A 
                         MAC      *AR4, *AR5+0%, A 
 
                         LD       A, 1, A 
                         ADD      #4000h, A 
                         MAX      B 
BLK1_END 
 
Next: 
        MVDM    ptr_L_exc_err, AR5 
        STM     #4, AR0 
        STM     #3-1, BRC 
        RPTBD   BLK2_END-1 
        MAR     *+AR5(2*2) 
 
                DLD     *AR5+, A 
                DST     A, *AR5-0 
BLK2_END 
        MAR     *+AR5(2) 
        DST     B, *AR5 
        RET