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


;========================================================================== 
;  File Name 
;  ---------- 
;  LSP_STB.ASM 
; 
;  Brief Description of the Code: 
;  ------------------------------ 
;  Check LSF coefficients for stability. 
; 
;  Ref 
;  ------ 
;  LSPGETQ.C 
;========================================================================== 
 
        .mmregs 
 
        .include  ..\include\const.h 
 
        .text 
        .def    Lsp_stability 
 
        .ref    Addr_lsfq_coefQ13  ; ld8a.mem 
 
 
;----------------------------------------------------------------------- 
; Lsp_stability 
;----------------------------------------------------------------------- 
; void Lsp_stability( 
;   Word16 lsfq[]       /* (i/o) Q13 : quantized LSP parameters      */ 
; ) 
;----------------------------------------------------------------------- 
; 1. Order lsfq[i] in increasing value. (lsfq[i+1] > lsfq[i]) 
; 
; 2. if lsfq[0] < 0.005, then lsfq[0] = 0.005. 
; 
; 3. if lsfq[i+1] - lsfq[i] < 0.0391, then lsfq[i+1] = lsfq[i] + 0.0391 
; 
; 4. if lsfq[9] > 3.135 then lsfq[9] = 3.135. 
;----------------------------------------------------------------------- 
;  Constants : Addr_lsfq_coefQ13 -> lsp[] 
;----------------------------------------------------------------------- 
 
        .asg    "AR2", pLsfqCoefQ13 
        .asg    "AR3", pLsfqCoefQ13p1 
 
Lsp_stability: 
        STM     #M - 2, BRC 
        STM     #Addr_lsfq_coefQ13+8, pLsfqCoefQ13 
 
 
        RPTBD   EndCheck1 - 1 
        STM     #Addr_lsfq_coefQ13+9, pLsfqCoefQ13p1 
 
                SUB     *pLsfqCoefQ13p1, *pLsfqCoefQ13-, B 
                LD      *pLsfqCoefQ13p1-, A 
                NOP 
                XC      2, BLT 
                        DELAY   *pLsfqCoefQ13p1 
                        STL     A, *pLsfqCoefQ13p1 
EndCheck1: 
        LD      #L_LIMIT, A 
        SUB     *pLsfqCoefQ13p1+, A, B        ; pLsfqCoefQ13p1 -> &lsfq[1] 
        MAR     *pLsfqCoefQ13+                ; pLsfqCoefQ13   -> &lsfq[0] 
        STM     #M-2, BRC 
        XC      1, BGT 
                STL     A, *pLsfqCoefQ13 
 
        LD      #GAP3, B 
 
        RPTB    EndChek3 - 1 
                ADD     *pLsfqCoefQ13+, B, A            ; A = lsfq[i] + 0.0391 
                SUB     *pLsfqCoefQ13p1+, A, B 
                LD      #GAP3, B                        ; 2 nop otherwise 
                XC      1, C                            ; lsfq[i] + 0.0391 > lsfq[i+1] 
                        STL     A, *pLsfqCoefQ13 
EndChek3: 
        LD      #M_LIMIT, A 
        SUB     *pLsfqCoefQ13, A, B 
        NOP 
        NOP 
        XC      1, BLT 
                STL   A, *pLsfqCoefQ13 
        RET