📄 performs vselp vocoder codebook search.txt
字号:
*==============================================================================** TEXAS INSTRUMENTS, INC. ** CODEBOOK SEARCH - FOR VSELP** Revision Date: 08/06/97* * USAGE This routine is C Callable and can be called as:* * int v_srch(int numBasis, short *R, short *wiPtr,short *TABLE,* short * wBasisPtr,short *D)** numBasis --- number of weighted basis vectors* *R --- array of Rm values, the cross correlations * between weighted speech and weighted basis * vectors* *wiPtr --- weighted speech vectors* *TABLE --- table of codewords * *wBasisPtr --- weighted basis vectors* *D --- matrix of Dmj values, the cross correlations * between the weighted basis vectors** If routine is not to be used as a C callable function then* you need to initialize values for all of the values passed* as these are assumed to be in registers as defined by the * calling convention of the compiler,TEXAS INSTRUMENTS, INC.
*
* CODEBOOK SEARCH - FOR VSELP
*
* Revision Date: 08/06/97
*
* USAGE This routine is C Callable and can be called as:
*
* int v_srch(int numBasis, short *R, short *wiPtr,short *TABLE,
* short * wBasisPtr,short *D)
*
* numBasis --- number of weighted basis vectors
* *R --- array of Rm values, the cross correlations
* between weighted speech and weighted basis
* vectors
* *wiPtr --- weighted speech vectors
* *TABLE --- table of codewords
* *wBasisPtr --- weighted basis vectors
* *D --- matrix of Dmj values, the cross correlations
* between the weighted basis vectors
*
* If routine is not to be used as a C callable function then
* you need to initialize values for all of the values passed
* as these are assumed to be in registers as defined by the
* calling convention of the compiler, (refer to the C compiler
* reference guide).
*
* C CODE
*
* The C source code for this was written by Motorola Systems
* Research Laboratories and is authorized by Motorola for the
* use of development of North American digital cellular
* standards. As such, the C code cannot be shown here.
*
* DESCRIPTION
*
* Performs VSELP vocoder codebook search. This routine performs
* the entire v_srch.c function as written by Motorola. It
* involves calculating correlations between weighted basis
* vectors and weighted speech vector (Rm's), C0, and
* 0.25 * sum of Djj for G0. It then calculates all Dmj and
* finishes calculating G0. It then initializes the best vector
* to be code vector zero and performs search by finding the
* vector that produces the highest C^2/G value.
*
* TECHNIQUES
*
* The loops of the code are unrolled.
*
* MEMORY NOTE
*
* Vectors wiPtr and wBasisPtr have to be aligned on opposite word
* boundaries to avoid memory hits.
*
* CYCLES
*
* loop 1 loop 2 loop 3
*
* 342 639 2087
*
* Total Cycles = 3068
*
*==============================================================================
.global _v_srch
.text
_v_srch:
ADD .L1X B15, 0, A9 ; copy stack pointer
|| STW .D2 B13, *--B15 ; push B13 onto stack
STW .D2 B14, *--B15[2] ; push B14 onto stack
|| STW .D1 A10, *--A9[2] ; push A10 onto stack
STW .D2 B11, *--B15[2] ; push B11 onto stack
|| STW .D1 A11, *--A9[2] ; push A11 onto stack
STW .D2 B12, *--B15[2] ; push B12 onto stack
|| STW .D1 A12, *--A9[2] ; push A12 onto stack
STW .D1 A13, *--A9[2] ; push A13 onto stack
|| STW .D2 B10,*--B15[2] ; push B10 onto stack
*** BEGIN Benchmark Timing ***
B_START:
LDH .D2 *++B4,B0 ; R++; R_tmp = *R;
|| MV .L1 A8,A10 ; tmpPtr = wBasisPtr
|| MVK .S1 0,A3 ; C = 0.0
|| ADD .L2X 0,A6,B14 ; tmpPtr2 = wiPtr
LDW .D1 *A10++,A0 ; *tmpPtr++,
|| LDW .D2 *B14++,B5 ; *tmpPtr2++,
MVK .S2 0,B1 ; p0 = 0
|| B .S1 LOOP1 ; for (endPtr2 = tmpPtr2 + S_LEN;
|| STW .D1 A15,*--A9[2] ; push A14 onto stack
|| ZERO .L1 A5 ; G = 0.0
|| MV .L2X A4,B2 ; outer lp cntr
LDW .D1 *A10++,A0 ; *tmpPtr++,
|| LDW .D2 *B14++,B5 ; *tmpPtr2++,
|| ADD .S2 -1,B2,B2 ; dec outer lp cntr
MVK .S1 18,A1 ; lp cntr =18 for 21 iterations of loop
|| B .S2 LOOP1 ; for (endPtr2 = tmpPtr2 + S_LEN;
|| STW .D2 B3,*--B15[3] ; push A15 onto stack
|| STW .D1 A14,*--A9 ; push B3 onto stack
|| MPY .M1 A13,0,A13 ; p1 = 0
|| ADD .L1 1,A4,A7 ; Ddim = numBasis + 1
LDW .D1 *A10++,A0 ; *tmpPtr++,
|| LDW .D2 *B14++,B5 ; *tmpPtr2++,
|| SHL .S2 B0,15,B0 ; R_tmp = (*R << 15);
LOOP1: ; LOOP1A BEGINS HERE
MPYH .M2X A0,B5,B1 ; p0 = *tmpPtr * *tmpPtr2,
|| MPYH .M1 A0,A0,A13 ; p1 = *tmpPtr * *tmpPtr,
|| [B1] ADD .L2 B0,B1,B0 ; R_tmp += p0,
|| ADD .L1 A5,A13,A5 ; G += p1,
|| [A1] B .S1 LOOP1 ; for (endPtr2 = tmpPtr2 + S_LEN;
LDW .D1 *A10++,A0 ; *tmpPtr++,
|| LDW .D2 *B14++,B5 ; *tmpPtr2++,
|| MPY .M2X A0,B5,B1 ; p0 = *tmpPtr * *tmpPtr2,
|| MPY .M1 A0,A0,A13 ; p1 = *tmpPtr * *tmpPtr,
|| ADD .L2 B0,B1,B0 ; R_tmp += p0,
|| ADD .L1 A5,A13,A5 ; G += p1,
|| [A1] ADD .S1 -1,A1,A1
; end of LOOP1
SHR .S2 B0,14,B0 ; *R = (R_tmp >> 14);
|| [B2] B .S1 LOOP1 ; for (endPtr = tmpPtr+numBasis * S_LEN
|| [B2] LDH .D2 *+B4[1],B0 ; R_tmp = *R
|| ADD .L2X 0,A6,B14 ; tmpPtr2 = wiPtr
|| SUB .D1 A10,16,A10 ; sub 16 from A10
|| SUB .L1X A3,B0,A3 ; C -= R_tmp;
[B2] LDW .D1 *A10++,A0 ; *tmpPtr++,
|| [B2] LDW .D2 *B14++,B5 ; *tmpPtr2++,
ZERO .L1 A13 ; p1 = 0
|| ZERO .L2 B1 ; p0 = 0
|| [B2] B .S1 LOOP1 ; for (endPtr2 = tmpPtr2 + S_LEN;
|| STH .D2 B0,*B4++ ; *R = R_tmp; R++;
||[!B2] MVK .S2 8,B9 ; used to calculate new D + m*Ddim + j
; in START2
[B2] LDW .D1 *A10++,A0 ; *tmpPtr++,
|| [B2] LDW .D2 *B14++,B5 ; *tmpPtr2++,
|| MVK .S1 18,A1 ; lp cntr = 18 for 21 iterations of loop
[B2] B .S1 LOOP1 ; for (endPtr2 = tmpPtr2 + S_LEN;
||[!B2] MVK .S2 80,B0 ; used for indexing S_LEN in next loop
||[!B2] ADD .L1 0,A8,A10 ; tmpPtr = wBasisPtr + (m-1) * S_LEN
; for next loop
[B2] LDW .D1 *A10++,A0 ; *tmpPtr++,
|| [B2] LDW .D2 *B14++,B5 ; *tmpPtr2++,
|| [B2] ADD .L2 -1,B2,B2 ; dec outer lp cntr
|| [B2] SHL .S2 B0,15,B0 ; R_tmp = (*R << 15);
|| ADD .L1 1,A4,A7 ; Ddim = numBasis + 1
START2:
LDW .D1 *A10++,A13 ; *tmpPtr,
|| SUB .L1X A10,B0,A15 ; A15 = wBasisPtr + (m-2) * S_LEN
|| SHL .S1 A7,1,A13 ; used to calculate D + Ddim
|| ADD .L2X A8,B0,B14 ; tmpPtr2 = wBasisPtr + (j-1) * S_LEN for next loop
LDW .D1 *A10++,A0 ; *tmpPtr,
|| LDW .D2 *B14++,B10 ; *tmpPtr2,
|| SUB .L2X B4,A13,B4 ; R -= Ddim
|| MV .S2 B14,B12 ; B12 = wBasisPtr + (j-1) * S_LEN
LDW .D1 *A10++,A13 ; *tmpPtr,
|| LDW .D2 *B14++,B2 ; *tmpPtr2,
|| ADD .L2X B8,A13,B11 ; D + m*Ddim
|| B .S1 LOOP2 ; for LOOP2
|| MVK .S2 2,B13 ; used for j lp cntr
|| ZERO .L1 A11 ; p0 = 0
|| MPY .M1X B0,1,A14 ; used for indexing S_LEN in next loop
LDW .D1 *A10++,A0 ; *tmpPtr,
|| LDW .D2 *B14++,B10 ; *tmpPtr2,
|| ADD .S2 4,B11,B11 ; D + m*Ddim + j = D + 8 + 2
|| MV .L2X A4,B5 ; move numBasis to other reg file
|| ZERO .L1 A12 ; Dcurrent0 = 0
|| MVK .S1 8,A9 ; used to calculate new D + m*Ddim + j
LDW .D1 *A10++,A13 ; *tmpPtr,
|| LDW .D2 *B14++,B2 ; *tmpPtr2,
|| ADD .L1 -1,A4,A2 ; for m lp cntr = numBasis-2
|| SUB .L2X A4,B13,B1 ; for j lp cntr = numBasis-2
|| MVK .S2 0,B7 ; Dcurrent1 = 0
|| B .S1 LOOP2 ; for LOOP2
LOOP2B:
LDW .D1 *A10++,A0 ; *tmpPtr,
|| LDW .D2 *B14++,B10 ; *tmpPtr2,
|| [A2] MVK .S1 8,A1 ; lp cntr = 8 for 11 iterations of loop
||[!A2] SUB .L1 A1,A1,A1 ; avoid last Branch to LOOP2
|| MVK .S2 0,B5 ; p1 = 0
||[!B1] ADD .L2 1,B13,B13 ; used for j lp cntr
LOOP2: ; LOOP BEGINS HERE
LDW .D1 *A10++,A13 ; *tmpPtr,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -