📄 lsp2lpc.asm
字号:
/*******************************************************************************
Copyright(c) 2000 - 2002 Analog Devices. All Rights Reserved.
Developed by Joint Development Software Application Team, IPDC, Bangalore, India
for Blackfin DSPs ( Micro Signal Architecture 1.0 specification).
By using this module you agree to the terms of the Analog Devices License
Agreement for DSP Software.
********************************************************************************
Module Name : lsp2lpc.asm
Label name : __lsp2lpc
Version : 1.3
Change History :
Version Date Author Comments
1.3 11/18/2002 Swarnalatha Tested with VDSP++ 3.0
compiler 6.2.2 on
ADSP-21535 Rev.0.2
1.2 11/13/2002 Swarnalatha Tested with VDSP++ 3.0
on ADSP-21535 Rev. 0.2
1.1 01/22/2002 Srinivas Modified to match
silicon cycle count
1.0 06/26/2001 Srinivas Original
Description : Computes the LPC's from line spectral pairs (LSP).
Algorithm :
- Find the coefficients of sum F1(z) and difference F2(z)
(function __Get_lsp_pol does this)
- Multiply F1(z) by 1+z^{-1} and F2(z) by 1-z^{-1}
for (i = 5; i > 0; i--)
{
f1[i] += f1[i-1];
f2[i] -= f2[i-1];
}
- LP Coefficients A(z) = ( F1(z) + F2(z) ) / 2
for (i = 1, j = 10; i <= 5; i++, j--)
{
a[i] = f1[i] + f2[i];
a[j] = f1[i] - f2[i];
}
Prototype : void lsp2lpc(fract16 lsp[], fract16 a[])
lsp -> pointer to lsp vector &lsp[0]
a -> pointer to output LP coefficients &a[0]
Assumptions : (1) Order of the predictor filter = 10
Registers Used : R0-R3, I0-I2, L0-L2, P0-P5, LC0.
Performance :
Code size : 162 bytes
Cycle count : 299 Cycles.
******************************************************************************/
.section L1_code;
.global __lsp2lpc;
.align 8;
.extern __get_lsp_pol;
__lsp2lpc:
[--SP] = (P5:3);
[--SP] = RETS;
L0 = 0;
L1 = 0;
L2 = 0;
P3 = R0; //pointer to lsp array
P4 = R1; //pointer to LP coeff's array
SP += -48; //memory for arrays f1 and f2 6 elements each
P5 = SP;
P5 += 20; //pointing to f1[0]
R1 = P5; //&f1[0]
CALL __get_lsp_pol;
P3 += 2; //P3 pointing to lsp[1]
R0 = P3; //&lsp[1]
P5 += 24; //pointing to f2[0]
R1 = P5; //&f2[0]
CALL __get_lsp_pol;
P5 += -44; //pointing to f1[5]
P3 = P5;
P3 += 24; //pointing to f2[5]
R0 = [P5++]; //load f1[i]
R1 = [P5--]; //load f1[i-1]
P0 = 5;
R2 = [P3]; //load f2[i]
LSETUP(LSTART0,LEND0)LC0 = P0;
LSTART0:R0 = R0 + R1(S) || R3 = [P3+4];
//f1[i] = f1[i] + f1[i-1], load f2[i-1]
R0 = R1 << 0 || [P5++] = R0;
//move f1[i-1], store f1[i]
R2 = R2 - R3(S) || R1 = [P5+4];
//f2[i] = f2[i] - f2[i-1], load f1[i-1]
LEND0: R2 = R3 << 0 || [P3++] = R2;
//move f2[i-1], store f2[i]
I0 = P4; //pointer to a[0]
R1.L = 4096; //1 in 4.12 format
P5+=-4; //pointer to f1[1]
W[I0++] = R1.L || R0 = [P5--];
//a[0] = 1, load f1[1]
P4 += 20; //pointing to the last element a[10]
P3+=-4; //pointer to f2[1]
I2 = P3;
P0 = 5;
R1 = [I2--]; //f2[1]
R2 = R0 + R1, R3 = R0 - R1(S);
//f1[i] + f2[i], f1[i] - f2[i]
LSETUP(LSTART1,LEND1)LC0 = P0;
LSTART1:R3 = R3 >>> 13 || R0 = [P5--];
//a[11-i] in 4.12 format, load a[i]
R2 = R2 >>> 13 || W[P4--] = R3 || R1 = [I2--];
//a[i] in 4.12 format, store a[11-i], load a[11-i]
LEND1: R2 = R0 + R1, R3 = R0 - R1(S) || W[I0++] = R2.L;
//f1[i] + f2[i], f1[i] - f2[i], store a[11-i]
SP += 48;
RETS = [SP++];
(P5:3)=[SP++];
RTS;
NOP; //to avoid one stall if LINK or UNLINK happens to be
//the next instruction after RTS in the memory.
__lsp2lpc.end:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -