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


        .mmregs 
 
        .include  ..\include\const.h 
        .include  ..\include\tab_ld8a.h 
        .include  ..\include\ld8amem.h 
 
        .text 
        .def      Gain_predict 
 
        .ref      Pow2_14 
        .ref      Log2 
 
;---------------------------------------------------------------------- 
;  Gain_predict 
;---------------------------------------------------------------------- 
;  void Gain_predict( 
;     Word16 past_qua_en[],/* (i) Q10 :Past quantized energies        */ 
;     Word16 code[],       /* (i) Q13 :Innovative vector.             */ 
;     Word16 L_subfr,      /* (i)     :Subframe length.               */ 
;     Word16 *gcode0,      /* (o) Qxx :Predicted codebook gain        */ 
;     Word16 *exp_gcode0   /* (o)     :Q-Format(gcode0)               */ 
;  ) 
;---------------------------------------------------------------------- 
;  Constants : Addr_cn -> code 
;              L_SUBFR = L_subfr 
; 
;  Pointers :  ptr_prev_qua_eng -> past_qua_en 
; 
;  Outputs  :  B = exp_gcode0 
;              A = gcode0 
;---------------------------------------------------------------------- 
 
        .asg    "Addr_local_buf1", exponent 
        .asg    "Addr_local_buf1+1", frac 
 
        .asg    "AR3", pCn 
        .asg    "AR3", pEngQ10 
        .asg    "AR4", pCoefQ13 
 
        .asg    "AR5", pExp 
 
Gain_predict: 
 
        STM     #Addr_cn, pCn 
        SQUR    *pCn+, A 
        RPT     #L_SUBFR - 2 
                SQURA   *pCn+, A 
 
        CALLD   Log2 
        STM     #exponent, pExp 
 
        STM     #-24660, T 
        MAR     *pExp+                  ; pExp -> frac 
        MPY     *pExp-, A               ; pExp -> exp 
        SFTA    A, -15 
        LD      A,-1,A 
        LD      A,1, A 
        MAC     *pExp, A 
 
        ADD     #32588, 6, A 
        MVDM    ptr_prev_qua_eng, pEngQ10 
        STM     #PredCoefQ13, pCoefQ13 
        SFTA    A, 10                           ; Q14 -> Q24 
        RPT     #4 - 1 
                MAC     *pCoefQ13+, *pEngQ10+, A 
 
        STM     #5439, T 
        MPYA    A 
        SFTA    A, -8                     ; Q24 -> Q16 
 
        STL     A, -16, *pExp 
        CALLD   Pow2_14 
        SUB     *pExp, 16, A 
        SFTA    A, -1, B 
 
        RETD 
        LD      #14, B 
        SUB     *pExp, B