📄 chebps11.asm
字号:
;==========================================================================
; File Name
; ----------
; LP_LSP.ASM
;
; Brief Description of the Code:
; ------------------------------
; Evaluates the Chebichev polynomial series
;
; Ref
; ------
; LPC.C
;==========================================================================
;--------------------------------------------------------------
; function Word16 Chebps_11(Word16 x, Word16 f[], Word16 n)
; ~~~~~~~~~~~~~~~~~~~~
; Evaluates the Chebichev polynomial series
;--------------------------------------------------------------
;
; The polynomial order is
; n = M/2 (M is the prediction order)
; The polynomial is given by
; C(x) = T_n(x) + f(1)T_n-1(x) + ... +f(n-1)T_1(x) + f(n)/2
; Arguments:
; x: input value of evaluation; x = cos(frequency) in Q15
; f[]: coefficients of the pol.
; in Q11(Chebps_11), in Q10(Chebps_10)
; n: order of the pol.
;
; The value of C(x) is returned. (Saturated to +-1.99 in Q14)
;
;--------------------------------------------------------------
; Input : DP -> Addr_Chebps_Buf ; Aligned on word boundary
; BK = 5
; BRC = n - 3
;
; AR0 = 1 ; For dual memory operand addressing in
; ; circular buffer
; AR4 -> X
; AR3 -> f[1] ; Use circular buffer, BK = 5
;
; Output: A = Chebps_11(Word16 x, Word16 f[], Word16 n)
; AR4 -> X
; AR3 -> f[1]
;
; Used and unchanged : AR3, AR4
; Modified : AR5
;
;--------------------------------------------------------------
; AR3 -> f[i], AR4 -> X, AR5 -> b1_l ( BL )
;--------------------------------------------------------------
.MMREGS
.include ..\include\lpc_lsp.h
.def Chebps_11
.def Chebps_10
.asg "AR3", pCoef
.asg "AR4", pX
.asg "AR5", pB1_l
one_hi .set 256 ; 1.0 in Q24
one_lo .set 0
one_hi1 .set 128 ; 1.0 in Q24
MPY32_16 .macro
LD #0, A
MACSU *AR5+, *AR4, A
LD A, -16, A
LD A, -1, A
LD A, 1, A
MAC *AR5-, *AR4, A
.endm
Chebps_11
STM BL, AR5
LD #one_hi, 16, A
DST A, B2 ; b2 = 1.0 in Q24
LD *pX, 10, B
ADD *pCoef+0%, 13, B ; B = b1 = 2*x + f[1]
RPTB BLK_END-1
MPY32_16 ; AR4 -> X, AR5 -> b1_l ( BL )
; A = t0 = x*b1
LD A, 1, A ; t0 = 2.0*x*b1
DSUB B2, A ; t0 = 2.0*x*b1 - b2
ADD *pCoef+0%, 13, A ; t0 = 2.0*x*b1 - b2 + f[i]
; Now A = b0, B = b1
DST B, B2 ; b2 = b1
LD A, B ; b1 = b0
BLK_END
MPY32_16 ; t0 = x*b1
DSUB B2, A ; t0 = x*b1 - b2
RETD
ADD *pCoef+0%, 12, A ; t0 = x*b1 - b2 + f[i]/2
LD A, 6, A
Chebps_10
STM BL, AR5
LD #one_hi1, 16, A
DST A, B2 ; b2 = 1.0 in Q23
LD *pX, 9, B
ADD *pCoef+0%, 13, B ; B = b1 = 2*x + f[1]
RPTB BLK_END1-1
MPY32_16 ; AR4 -> X, AR5 -> b1_l ( BL )
; A = t0 = x*b1
LD A, 1, A ; t0 = 2.0*x*b1
DSUB B2, A ; t0 = 2.0*x*b1 - b2
ADD *pCoef+0%, 13, A ; t0 = 2.0*x*b1 - b2 + f[i]
; Now A = b0, B = b1
DST B, B2 ; b2 = b1
LD A, B ; b1 = b0
BLK_END1
MPY32_16 ; t0 = x*b1
DSUB B2, A ; t0 = x*b1 - b2
RETD
ADD *pCoef+0%, 12, A ; t0 = x*b1 - b2 + f[i]/2
LD A, 7, A
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -