comparison sp_frm.h @ 0:9008dbc8ca74

import original C code from GSM 06.06
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 14 Jun 2024 23:27:16 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:9008dbc8ca74
1 #ifndef __SP_FRM
2 #define __SP_FRM
3
4 #include "typedefs.h"
5 #include "sp_rom.h"
6
7
8 struct QuantList
9 {
10 /* structure which points to the beginning of a block of candidate vq
11 * vectors. It also stores the residual error for each vector. */
12 int iNum; /* total number in list */
13 int iRCIndex; /* an index to the first vector of the
14 * block */
15 Shortword pswPredErr[PREQ1_NUM_OF_ROWS]; /* PREQ1 is the biggest block */
16 };
17
18 /*_________________________________________________________________________
19 | |
20 | Function Prototypes |
21 |_________________________________________________________________________|
22 */
23
24 void iir_d(Shortword pswCoeff[], Shortword pswIn[],
25 Shortword pswXstate[],
26 Shortword pswYstate[],
27 int npts, int shifts,
28 Shortword swPreFirDownSh,
29 Shortword swFinalUpShift);
30
31
32 void filt4_2nd(Shortword pswCoeff[],
33 Shortword pswIn[],
34 Shortword pswXstate[],
35 Shortword pswYstate[],
36 int npts,
37 int shifts);
38
39 void initPBarVBarL(Longword pL_PBarFull[],
40 Shortword pswPBar[],
41 Shortword pswVBar[]);
42
43 void initPBarFullVBarFullL(Longword pL_CorrelSeq[],
44 Longword pL_PBarFull[],
45 Longword pL_VBarFull[]);
46
47 Shortword aflatRecursion(Shortword pswQntRc[],
48 Shortword pswPBar[],
49 Shortword pswVBar[],
50 Shortword *ppswPAddrs[],
51 Shortword *ppswVAddrs[],
52 Shortword swSegmentOrder);
53
54 void aflatNewBarRecursionL(Shortword pswQntRc[],
55 int iSegment,
56 Longword pL_PBar[],
57 Longword pL_VBar[],
58 Shortword pswPBar[],
59 Shortword pswVBar[]);
60
61
62 void setupPreQ(int iSeg, int iVector);
63
64 void setupQuant(int iSeg, int iVector);
65
66 void getNextVec(Shortword pswRc[]);
67
68 void aflat(Shortword pswSpeechToLPC[],
69 int piR0Index[],
70 Shortword pswFinalRc[],
71 int piVQCodewds[],
72 Shortword swPtch,
73 Shortword *pswVadFlag,
74 Shortword *pswSP);
75
76
77 Shortword fnExp2(Longword L_Input);
78
79 Shortword fnLog2(Longword L_Input);
80
81 void weightSpeechFrame(Shortword pswSpeechFrm[],
82 Shortword pswWNumSpace[],
83 Shortword pswWDenomSpace[],
84 Shortword pswWSpeechBuffBase[]);
85
86 void getSfrmLpcTx(Shortword swPrevR0, Shortword swNewR0,
87 Shortword pswPrevFrmKs[],
88 Shortword pswPrevFrmAs[],
89 Shortword pswPrevFrmSNWCoef[],
90 Shortword pswNewFrmKs[],
91 Shortword pswNewFrmAs[],
92 Shortword pswNewFrmSNWCoef[],
93 Shortword pswHPFSpeech[],
94 short *pswSoftInterp,
95 struct NormSw *psnsSqrtRs,
96 Shortword ppswSynthAs[][NP],
97 Shortword ppswSNWCoefAs[][NP]);
98
99 short int fnBest_CG(Shortword pswCframe[],
100 Shortword pswGframe[],
101 Shortword *pswCmaxSqr,
102 Shortword *pswGmax,
103 short int siNumPairs);
104
105 short compResidEnergy(Shortword pswSpeech[],
106 Shortword ppswInterpCoef[][NP],
107 Shortword pswPreviousCoef[],
108 Shortword pswCurrentCoef[],
109 struct NormSw psnsSqrtRs[]);
110
111 Shortword r0Quant(Longword L_UnqntzdR0);
112
113 Shortword cov32(Shortword pswIn[],
114 Longword pppL_B[NP][NP][2],
115 Longword pppL_F[NP][NP][2],
116 Longword pppL_C[NP][NP][2],
117 Longword *pL_R0,
118 Longword pL_VadAcf[],
119 Shortword *pswVadScalAuto);
120
121 Longword flat(Shortword pswSpeechIn[],
122 Shortword pswRc[],
123 int *piR0Inx,
124 Longword pL_VadAcf[],
125 Shortword *pswVadScalAuto);
126
127
128
129 void openLoopLagSearch(Shortword pswWSpeech[],
130 Shortword swPrevR0Index,
131 Shortword swCurrR0Index,
132 Shortword *psiUVCode,
133 Shortword pswLagList[],
134 Shortword pswNumLagList[],
135 Shortword pswPitchBuf[],
136 Shortword pswHNWCoefBuf[],
137 struct NormSw psnsWSfrmEng[],
138 Shortword pswVadLags[],
139 Shortword swSP);
140
141 Shortword getCCThreshold(Shortword swRp0,
142 Shortword swCC,
143 Shortword swG);
144
145 void pitchLags(Shortword swBestIntLag,
146 Shortword pswIntCs[],
147 Shortword pswIntGs[],
148 Shortword swCCThreshold,
149 Shortword pswLPeaksSorted[],
150 Shortword pswCPeaksSorted[],
151 Shortword pswGPeaksSorted[],
152 Shortword *psiNumSorted,
153 Shortword *pswPitch,
154 Shortword *pswHNWCoef);
155
156 short CGInterpValid(Shortword swFullResLag,
157 Shortword pswCIn[],
158 Shortword pswGIn[],
159 Shortword pswLOut[],
160 Shortword pswCOut[],
161 Shortword pswGOut[]);
162
163 void CGInterp(Shortword pswLIn[],
164 short siNum,
165 Shortword pswCIn[],
166 Shortword pswGIn[],
167 short siLoIntLag,
168 Shortword pswCOut[],
169 Shortword pswGOut[]);
170
171 Shortword quantLag(Shortword swRawLag,
172 Shortword *psiCode);
173
174 void findBestInQuantList(struct QuantList psqlInList,
175 int iNumVectOut,
176 struct QuantList psqlBestOutList[]);
177
178 Shortword findPeak(Shortword swSingleResLag,
179 Shortword pswCIn[],
180 Shortword pswGIn[]);
181
182 void bestDelta(Shortword pswLagList[],
183 Shortword pswCSfrm[],
184 Shortword pswGSfrm[],
185 short int siNumLags,
186 short int siSfrmIndex,
187 Shortword pswLTraj[],
188 Shortword pswCCTraj[],
189 Shortword pswGTraj[]);
190
191 Shortword
192 maxCCOverGWithSign(Shortword pswCIn[],
193 Shortword pswGIn[],
194 Shortword *pswCCMax,
195 Shortword *pswGMax,
196 Shortword swNum);
197
198 void getNWCoefs(Shortword pswACoefs[],
199 Shortword pswHCoefs[]);
200
201 #endif