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


;========================================================================== 
;  File Name 
;  ---------- 
;  TEST_ERR.ASM 
; 
;  Brief Description of the Code: 
;  ------------------------------ 
;  Computes the accumulated potential error 
;  in the adaptive codebook contribution 
; 
;  Ref 
;  ------ 
;  COD_LD8K.C 
;========================================================================== 
;  Function : test_err 
;---------------------------------------------------------------------- 
;  static Word16 test_err(  /* (o) flag set to 1 if taming is necessary  */ 
;   Word16 T0,       /* (i) integer part of pitch delay           */ 
;   Word16 T0_frac   /* (i) fractional part of pitch delay        */ 
;  ) 
;---------------------------------------------------------------------- 
;  Constants : Addr_T0 -> T0 
;              Addr_T0_frac -> T0_frac 
; 
;  Pointer : ptr_L_exc_err -> L_exc_err 
; 
;  Return output : A = test_err(xxx) 
; 
;  Modified Registers : AR5, DP 
;---------------------------------------------------------------------- 
		.mmregs 
        .include ../include/const.h 
        .include ../include/ld8amem.h 
        .include ../include/tab_ld8a.h 
 
        .text 
        .def     test_err 
 
test_err: 
        LD      #Addr_T0, DP 
        LD      Addr_T0_frac, A         
        BC	frac_lt0, ALT 
	        LD      Addr_T0, A 
                ADD     #1, A            ; A = t1 
                B	frac_end 
frac_lt0: 
	        LD      Addr_T0, A 
frac_end:		                 
 
        ADD     #L_INTER10-2+tab_zone, A, B 
        STLM    B, AR5 
        SUB     #L_SUBFR+L_INTER10, A 
 
        LD      *AR5, 1, B              ; B = zone2<<1 
        LD      #ptr_L_exc_err, DP 
 
        XC      1, ALT 
                LD      #0, A 
 
        ADD     #tab_zone, A 
        STLM    A, AR5 
 
        ADD     ptr_L_exc_err, B, A 
        LD      B, -1, B                ; B = zone2 
        SUB     *AR5, B 
        STLM    B, BRC 
        STLM    A, AR5 
 
        RPTBD   BLK_END-1 
        LD      #-1, A 
 
                DLD     *AR5-, B 
                MAX     A 
BLK_END 
        SUB     #THRESH_ERR, 15, A 
        LD      #0, A 
        NOP 
        XC      1, AGT 
                LD      #1, A 
        RET