enhancer.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700
  1. /******************************************************************
  2. iLBC Speech Coder ANSI-C Source Code
  3. enhancer.c
  4. Copyright (C) The Internet Society (2004).
  5. All Rights Reserved.
  6. ******************************************************************/
  7. #include <math.h>
  8. #include <string.h>
  9. #include "iLBC_define.h"
  10. #include "constants.h"
  11. #include "filter.h"
  12. /*----------------------------------------------------------------*
  13. * Find index in array such that the array element with said
  14. * index is the element of said array closest to "value"
  15. * according to the squared-error criterion
  16. *---------------------------------------------------------------*/
  17. void NearestNeighbor(
  18. int *index, /* (o) index of array element closest
  19. to value */
  20. float *array, /* (i) data array */
  21. float value,/* (i) value */
  22. int arlength/* (i) dimension of data array */
  23. ){
  24. int i;
  25. float bestcrit,crit;
  26. crit=array[0]-value;
  27. bestcrit=crit*crit;
  28. *index=0;
  29. for (i=1; i<arlength; i++) {
  30. crit=array[i]-value;
  31. crit=crit*crit;
  32. if (crit<bestcrit) {
  33. bestcrit=crit;
  34. *index=i;
  35. }
  36. }
  37. }
  38. /*----------------------------------------------------------------*
  39. * compute cross correlation between sequences
  40. *---------------------------------------------------------------*/
  41. void mycorr1(
  42. float* corr, /* (o) correlation of seq1 and seq2 */
  43. float* seq1, /* (i) first sequence */
  44. int dim1, /* (i) dimension first seq1 */
  45. const float *seq2, /* (i) second sequence */
  46. int dim2 /* (i) dimension seq2 */
  47. ){
  48. int i,j;
  49. for (i=0; i<=dim1-dim2; i++) {
  50. corr[i]=0.0;
  51. for (j=0; j<dim2; j++) {
  52. corr[i] += seq1[i+j] * seq2[j];
  53. }
  54. }
  55. }
  56. /*----------------------------------------------------------------*
  57. * upsample finite array assuming zeros outside bounds
  58. *---------------------------------------------------------------*/
  59. void enh_upsample(
  60. float* useq1, /* (o) upsampled output sequence */
  61. float* seq1,/* (i) unupsampled sequence */
  62. int dim1, /* (i) dimension seq1 */
  63. int hfl /* (i) polyphase filter length=2*hfl+1 */
  64. ){
  65. float *pu,*ps;
  66. int i,j,k,q,filterlength,hfl2;
  67. const float *polyp[ENH_UPS0]; /* pointers to
  68. polyphase columns */
  69. const float *pp;
  70. /* define pointers for filter */
  71. filterlength=2*hfl+1;
  72. if ( filterlength > dim1 ) {
  73. hfl2=(int) (dim1/2);
  74. for (j=0; j<ENH_UPS0; j++) {
  75. polyp[j]=polyphaserTbl+j*filterlength+hfl-hfl2;
  76. }
  77. hfl=hfl2;
  78. filterlength=2*hfl+1;
  79. }
  80. else {
  81. for (j=0; j<ENH_UPS0; j++) {
  82. polyp[j]=polyphaserTbl+j*filterlength;
  83. }
  84. }
  85. /* filtering: filter overhangs left side of sequence */
  86. pu=useq1;
  87. for (i=hfl; i<filterlength; i++) {
  88. for (j=0; j<ENH_UPS0; j++) {
  89. *pu=0.0;
  90. pp = polyp[j];
  91. ps = seq1+i;
  92. for (k=0; k<=i; k++) {
  93. *pu += *ps-- * *pp++;
  94. }
  95. pu++;
  96. }
  97. }
  98. /* filtering: simple convolution=inner products */
  99. for (i=filterlength; i<dim1; i++) {
  100. for (j=0;j<ENH_UPS0; j++){
  101. *pu=0.0;
  102. pp = polyp[j];
  103. ps = seq1+i;
  104. for (k=0; k<filterlength; k++) {
  105. *pu += *ps-- * *pp++;
  106. }
  107. pu++;
  108. }
  109. }
  110. /* filtering: filter overhangs right side of sequence */
  111. for (q=1; q<=hfl; q++) {
  112. for (j=0; j<ENH_UPS0; j++) {
  113. *pu=0.0;
  114. pp = polyp[j]+q;
  115. ps = seq1+dim1-1;
  116. for (k=0; k<filterlength-q; k++) {
  117. *pu += *ps-- * *pp++;
  118. }
  119. pu++;
  120. }
  121. }
  122. }
  123. /*----------------------------------------------------------------*
  124. * find segment starting near idata+estSegPos that has highest
  125. * correlation with idata+centerStartPos through
  126. * idata+centerStartPos+ENH_BLOCKL-1 segment is found at a
  127. * resolution of ENH_UPSO times the original of the original
  128. * sampling rate
  129. *---------------------------------------------------------------*/
  130. void refiner(
  131. float *seg, /* (o) segment array */
  132. float *updStartPos, /* (o) updated start point */
  133. float* idata, /* (i) original data buffer */
  134. int idatal, /* (i) dimension of idata */
  135. int centerStartPos, /* (i) beginning center segment */
  136. float estSegPos,/* (i) estimated beginning other segment */
  137. float period /* (i) estimated pitch period */
  138. ){
  139. int estSegPosRounded,searchSegStartPos,searchSegEndPos,corrdim;
  140. int tloc,tloc2,i,st,en,fraction;
  141. float vect[ENH_VECTL],corrVec[ENH_CORRDIM],maxv;
  142. float corrVecUps[ENH_CORRDIM*ENH_UPS0];
  143. /* defining array bounds */
  144. estSegPosRounded=(int)(estSegPos - 0.5);
  145. searchSegStartPos=estSegPosRounded-ENH_SLOP;
  146. if (searchSegStartPos<0) {
  147. searchSegStartPos=0;
  148. }
  149. searchSegEndPos=estSegPosRounded+ENH_SLOP;
  150. if (searchSegEndPos+ENH_BLOCKL >= idatal) {
  151. searchSegEndPos=idatal-ENH_BLOCKL-1;
  152. }
  153. corrdim=searchSegEndPos-searchSegStartPos+1;
  154. /* compute upsampled correlation (corr33) and find
  155. location of max */
  156. mycorr1(corrVec,idata+searchSegStartPos,
  157. corrdim+ENH_BLOCKL-1,idata+centerStartPos,ENH_BLOCKL);
  158. enh_upsample(corrVecUps,corrVec,corrdim,ENH_FL0);
  159. tloc=0; maxv=corrVecUps[0];
  160. for (i=1; i<ENH_UPS0*corrdim; i++) {
  161. if (corrVecUps[i]>maxv) {
  162. tloc=i;
  163. maxv=corrVecUps[i];
  164. }
  165. }
  166. /* make vector can be upsampled without ever running outside
  167. bounds */
  168. *updStartPos= (float)searchSegStartPos +
  169. (float)tloc/(float)ENH_UPS0+(float)1.0;
  170. tloc2=(int)(tloc/ENH_UPS0);
  171. if (tloc>tloc2*ENH_UPS0) {
  172. tloc2++;
  173. }
  174. st=searchSegStartPos+tloc2-ENH_FL0;
  175. if (st<0) {
  176. memset(vect,0,-st*sizeof(float));
  177. memcpy(&vect[-st],idata, (ENH_VECTL+st)*sizeof(float));
  178. }
  179. else {
  180. en=st+ENH_VECTL;
  181. if (en>idatal) {
  182. memcpy(vect, &idata[st],
  183. (ENH_VECTL-(en-idatal))*sizeof(float));
  184. memset(&vect[ENH_VECTL-(en-idatal)], 0,
  185. (en-idatal)*sizeof(float));
  186. }
  187. else {
  188. memcpy(vect, &idata[st], ENH_VECTL*sizeof(float));
  189. }
  190. }
  191. fraction=tloc2*ENH_UPS0-tloc;
  192. /* compute the segment (this is actually a convolution) */
  193. mycorr1(seg,vect,ENH_VECTL,polyphaserTbl+(2*ENH_FL0+1)*fraction,
  194. 2*ENH_FL0+1);
  195. }
  196. /*----------------------------------------------------------------*
  197. * find the smoothed output data
  198. *---------------------------------------------------------------*/
  199. void smath(
  200. float *odata, /* (o) smoothed output */
  201. float *sseq,/* (i) said second sequence of waveforms */
  202. int hl, /* (i) 2*hl+1 is sseq dimension */
  203. float alpha0/* (i) max smoothing energy fraction */
  204. ){
  205. int i,k;
  206. float w00,w10,w11,A,B,C,*psseq,err,errs;
  207. float surround[BLOCKL_MAX]; /* shape contributed by other than
  208. current */
  209. float wt[2*ENH_HL+1]; /* waveform weighting to get
  210. surround shape */
  211. float denom;
  212. /* create shape of contribution from all waveforms except the
  213. current one */
  214. for (i=1; i<=2*hl+1; i++) {
  215. wt[i-1] = (float)0.5*(1 - (float)cos(2*PI*i/(2*hl+2)));
  216. }
  217. wt[hl]=0.0; /* for clarity, not used */
  218. for (i=0; i<ENH_BLOCKL; i++) {
  219. surround[i]=sseq[i]*wt[0];
  220. }
  221. for (k=1; k<hl; k++) {
  222. psseq=sseq+k*ENH_BLOCKL;
  223. for(i=0;i<ENH_BLOCKL; i++) {
  224. surround[i]+=psseq[i]*wt[k];
  225. }
  226. }
  227. for (k=hl+1; k<=2*hl; k++) {
  228. psseq=sseq+k*ENH_BLOCKL;
  229. for(i=0;i<ENH_BLOCKL; i++) {
  230. surround[i]+=psseq[i]*wt[k];
  231. }
  232. }
  233. /* compute some inner products */
  234. w00 = w10 = w11 = 0.0;
  235. psseq=sseq+hl*ENH_BLOCKL; /* current block */
  236. for (i=0; i<ENH_BLOCKL;i++) {
  237. w00+=psseq[i]*psseq[i];
  238. w11+=surround[i]*surround[i];
  239. w10+=surround[i]*psseq[i];
  240. }
  241. if (fabs(w11) < 1.0) {
  242. w11=1.0;
  243. }
  244. C = (float)sqrt( w00/w11);
  245. /* first try enhancement without power-constraint */
  246. errs=0.0;
  247. psseq=sseq+hl*ENH_BLOCKL;
  248. for (i=0; i<ENH_BLOCKL; i++) {
  249. odata[i]=C*surround[i];
  250. err=psseq[i]-odata[i];
  251. errs+=err*err;
  252. }
  253. /* if constraint violated by first try, add constraint */
  254. if (errs > alpha0 * w00) {
  255. if ( w00 < 1) {
  256. w00=1;
  257. }
  258. denom = (w11*w00-w10*w10)/(w00*w00);
  259. if (denom > 0.0001) { /* eliminates numerical problems
  260. for if smooth */
  261. A = (float)sqrt( (alpha0- alpha0*alpha0/4)/denom);
  262. B = -alpha0/2 - A * w10/w00;
  263. B = B+1;
  264. }
  265. else { /* essentially no difference between cycles;
  266. smoothing not needed */
  267. A= 0.0;
  268. B= 1.0;
  269. }
  270. /* create smoothed sequence */
  271. psseq=sseq+hl*ENH_BLOCKL;
  272. for (i=0; i<ENH_BLOCKL; i++) {
  273. odata[i]=A*surround[i]+B*psseq[i];
  274. }
  275. }
  276. }
  277. /*----------------------------------------------------------------*
  278. * get the pitch-synchronous sample sequence
  279. *---------------------------------------------------------------*/
  280. void getsseq(
  281. float *sseq, /* (o) the pitch-synchronous sequence */
  282. float *idata, /* (i) original data */
  283. int idatal, /* (i) dimension of data */
  284. int centerStartPos, /* (i) where current block starts */
  285. float *period, /* (i) rough-pitch-period array */
  286. float *plocs, /* (i) where periods of period array
  287. are taken */
  288. int periodl, /* (i) dimension period array */
  289. int hl /* (i) 2*hl+1 is the number of sequences */
  290. ){
  291. int i,centerEndPos,q;
  292. float blockStartPos[2*ENH_HL+1];
  293. int lagBlock[2*ENH_HL+1];
  294. float plocs2[ENH_PLOCSL];
  295. float *psseq;
  296. centerEndPos=centerStartPos+ENH_BLOCKL-1;
  297. /* present */
  298. NearestNeighbor(lagBlock+hl,plocs,
  299. (float)0.5*(centerStartPos+centerEndPos),periodl);
  300. blockStartPos[hl]=(float)centerStartPos;
  301. psseq=sseq+ENH_BLOCKL*hl;
  302. memcpy(psseq, idata+centerStartPos, ENH_BLOCKL*sizeof(float));
  303. /* past */
  304. for (q=hl-1; q>=0; q--) {
  305. blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]];
  306. NearestNeighbor(lagBlock+q,plocs,
  307. blockStartPos[q]+
  308. ENH_BLOCKL_HALF-period[lagBlock[q+1]], periodl);
  309. if (blockStartPos[q]-ENH_OVERHANG>=0) {
  310. refiner(sseq+q*ENH_BLOCKL, blockStartPos+q, idata,
  311. idatal, centerStartPos, blockStartPos[q],
  312. period[lagBlock[q+1]]);
  313. } else {
  314. psseq=sseq+q*ENH_BLOCKL;
  315. memset(psseq, 0, ENH_BLOCKL*sizeof(float));
  316. }
  317. }
  318. /* future */
  319. for (i=0; i<periodl; i++) {
  320. plocs2[i]=plocs[i]-period[i];
  321. }
  322. for (q=hl+1; q<=2*hl; q++) {
  323. NearestNeighbor(lagBlock+q,plocs2,
  324. blockStartPos[q-1]+ENH_BLOCKL_HALF,periodl);
  325. blockStartPos[q]=blockStartPos[q-1]+period[lagBlock[q]];
  326. if (blockStartPos[q]+ENH_BLOCKL+ENH_OVERHANG<idatal) {
  327. refiner(sseq+ENH_BLOCKL*q, blockStartPos+q, idata,
  328. idatal, centerStartPos, blockStartPos[q],
  329. period[lagBlock[q]]);
  330. }
  331. else {
  332. psseq=sseq+q*ENH_BLOCKL;
  333. memset(psseq, 0, ENH_BLOCKL*sizeof(float));
  334. }
  335. }
  336. }
  337. /*----------------------------------------------------------------*
  338. * perform enhancement on idata+centerStartPos through
  339. * idata+centerStartPos+ENH_BLOCKL-1
  340. *---------------------------------------------------------------*/
  341. void enhancer(
  342. float *odata, /* (o) smoothed block, dimension blockl */
  343. float *idata, /* (i) data buffer used for enhancing */
  344. int idatal, /* (i) dimension idata */
  345. int centerStartPos, /* (i) first sample current block
  346. within idata */
  347. float alpha0, /* (i) max correction-energy-fraction
  348. (in [0,1]) */
  349. float *period, /* (i) pitch period array */
  350. float *plocs, /* (i) locations where period array
  351. values valid */
  352. int periodl /* (i) dimension of period and plocs */
  353. ){
  354. float sseq[(2*ENH_HL+1)*ENH_BLOCKL];
  355. /* get said second sequence of segments */
  356. getsseq(sseq,idata,idatal,centerStartPos,period,
  357. plocs,periodl,ENH_HL);
  358. /* compute the smoothed output from said second sequence */
  359. smath(odata,sseq,ENH_HL,alpha0);
  360. }
  361. /*----------------------------------------------------------------*
  362. * cross correlation
  363. *---------------------------------------------------------------*/
  364. float xCorrCoef(
  365. float *target, /* (i) first array */
  366. float *regressor, /* (i) second array */
  367. int subl /* (i) dimension arrays */
  368. ){
  369. int i;
  370. float ftmp1, ftmp2;
  371. ftmp1 = 0.0;
  372. ftmp2 = 0.0;
  373. for (i=0; i<subl; i++) {
  374. ftmp1 += target[i]*regressor[i];
  375. ftmp2 += regressor[i]*regressor[i];
  376. }
  377. if (ftmp1 > 0.0) {
  378. return (float)(ftmp1*ftmp1/ftmp2);
  379. }
  380. else {
  381. return (float)0.0;
  382. }
  383. }
  384. /*----------------------------------------------------------------*
  385. * interface for enhancer
  386. *---------------------------------------------------------------*/
  387. int enhancerInterface(
  388. float *out, /* (o) enhanced signal */
  389. float *in, /* (i) unenhanced signal */
  390. iLBC_Dec_Inst_t *iLBCdec_inst /* (i) buffers etc */
  391. ){
  392. float *enh_buf, *enh_period;
  393. int iblock, isample;
  394. int lag=0, ilag, i, ioffset;
  395. float cc, maxcc;
  396. float ftmp1, ftmp2;
  397. float *inPtr, *enh_bufPtr1, *enh_bufPtr2;
  398. float plc_pred[ENH_BLOCKL];
  399. float lpState[6], downsampled[(ENH_NBLOCKS*ENH_BLOCKL+120)/2];
  400. int inLen=ENH_NBLOCKS*ENH_BLOCKL+120;
  401. int start, plc_blockl, inlag;
  402. enh_buf=iLBCdec_inst->enh_buf;
  403. enh_period=iLBCdec_inst->enh_period;
  404. memmove(enh_buf, &enh_buf[iLBCdec_inst->blockl],
  405. (ENH_BUFL-iLBCdec_inst->blockl)*sizeof(float));
  406. memcpy(&enh_buf[ENH_BUFL-iLBCdec_inst->blockl], in,
  407. iLBCdec_inst->blockl*sizeof(float));
  408. if (iLBCdec_inst->mode==30)
  409. plc_blockl=ENH_BLOCKL;
  410. else
  411. plc_blockl=40;
  412. /* when 20 ms frame, move processing one block */
  413. ioffset=0;
  414. if (iLBCdec_inst->mode==20) ioffset=1;
  415. i=3-ioffset;
  416. memmove(enh_period, &enh_period[i],
  417. (ENH_NBLOCKS_TOT-i)*sizeof(float));
  418. /* Set state information to the 6 samples right before
  419. the samples to be downsampled. */
  420. memcpy(lpState,
  421. enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-126,
  422. 6*sizeof(float));
  423. /* Down sample a factor 2 to save computations */
  424. DownSample(enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-120,
  425. lpFilt_coefsTbl, inLen-ioffset*ENH_BLOCKL,
  426. lpState, downsampled);
  427. /* Estimate the pitch in the down sampled domain. */
  428. for (iblock = 0; iblock<ENH_NBLOCKS-ioffset; iblock++) {
  429. lag = 10;
  430. maxcc = xCorrCoef(downsampled+60+iblock*
  431. ENH_BLOCKL_HALF, downsampled+60+iblock*
  432. ENH_BLOCKL_HALF-lag, ENH_BLOCKL_HALF);
  433. for (ilag=11; ilag<60; ilag++) {
  434. cc = xCorrCoef(downsampled+60+iblock*
  435. ENH_BLOCKL_HALF, downsampled+60+iblock*
  436. ENH_BLOCKL_HALF-ilag, ENH_BLOCKL_HALF);
  437. if (cc > maxcc) {
  438. maxcc = cc;
  439. lag = ilag;
  440. }
  441. }
  442. /* Store the estimated lag in the non-downsampled domain */
  443. enh_period[iblock+ENH_NBLOCKS_EXTRA+ioffset] = (float)lag*2;
  444. }
  445. /* PLC was performed on the previous packet */
  446. if (iLBCdec_inst->prev_enh_pl==1) {
  447. inlag=(int)enh_period[ENH_NBLOCKS_EXTRA+ioffset];
  448. lag = inlag-1;
  449. maxcc = xCorrCoef(in, in+lag, plc_blockl);
  450. for (ilag=inlag; ilag<=inlag+1; ilag++) {
  451. cc = xCorrCoef(in, in+ilag, plc_blockl);
  452. if (cc > maxcc) {
  453. maxcc = cc;
  454. lag = ilag;
  455. }
  456. }
  457. enh_period[ENH_NBLOCKS_EXTRA+ioffset-1]=(float)lag;
  458. /* compute new concealed residual for the old lookahead,
  459. mix the forward PLC with a backward PLC from
  460. the new frame */
  461. inPtr=&in[lag-1];
  462. enh_bufPtr1=&plc_pred[plc_blockl-1];
  463. if (lag>plc_blockl) {
  464. start=plc_blockl;
  465. } else {
  466. start=lag;
  467. }
  468. for (isample = start; isample>0; isample--) {
  469. *enh_bufPtr1-- = *inPtr--;
  470. }
  471. enh_bufPtr2=&enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl];
  472. for (isample = (plc_blockl-1-lag); isample>=0; isample--) {
  473. *enh_bufPtr1-- = *enh_bufPtr2--;
  474. }
  475. /* limit energy change */
  476. ftmp2=0.0;
  477. ftmp1=0.0;
  478. for (i=0;i<plc_blockl;i++) {
  479. ftmp2+=enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl-i]*
  480. enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl-i];
  481. ftmp1+=plc_pred[i]*plc_pred[i];
  482. }
  483. ftmp1=(float)sqrt(ftmp1/(float)plc_blockl);
  484. ftmp2=(float)sqrt(ftmp2/(float)plc_blockl);
  485. if (ftmp1>(float)2.0*ftmp2 && ftmp1>0.0) {
  486. for (i=0;i<plc_blockl-10;i++) {
  487. plc_pred[i]*=(float)2.0*ftmp2/ftmp1;
  488. }
  489. for (i=plc_blockl-10;i<plc_blockl;i++) {
  490. plc_pred[i]*=(float)(i-plc_blockl+10)*
  491. ((float)1.0-(float)2.0*ftmp2/ftmp1)/(float)(10)+
  492. (float)2.0*ftmp2/ftmp1;
  493. }
  494. }
  495. enh_bufPtr1=&enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl];
  496. for (i=0; i<plc_blockl; i++) {
  497. ftmp1 = (float) (i+1) / (float) (plc_blockl+1);
  498. *enh_bufPtr1 *= ftmp1;
  499. *enh_bufPtr1 += ((float)1.0-ftmp1)*
  500. plc_pred[plc_blockl-1-i];
  501. enh_bufPtr1--;
  502. }
  503. }
  504. if (iLBCdec_inst->mode==20) {
  505. /* Enhancer with 40 samples delay */
  506. for (iblock = 0; iblock<2; iblock++) {
  507. enhancer(out+iblock*ENH_BLOCKL, enh_buf,
  508. ENH_BUFL, (5+iblock)*ENH_BLOCKL+40,
  509. ENH_ALPHA0, enh_period, enh_plocsTbl,
  510. ENH_NBLOCKS_TOT);
  511. }
  512. } else if (iLBCdec_inst->mode==30) {
  513. /* Enhancer with 80 samples delay */
  514. for (iblock = 0; iblock<3; iblock++) {
  515. enhancer(out+iblock*ENH_BLOCKL, enh_buf,
  516. ENH_BUFL, (4+iblock)*ENH_BLOCKL,
  517. ENH_ALPHA0, enh_period, enh_plocsTbl,
  518. ENH_NBLOCKS_TOT);
  519. }
  520. }
  521. return (lag*2);
  522. }