* #36737: switch back to svn repo, remove assert in sip_transaction.c
diff --git a/jni/pjproject-android/.svn/pristine/a4/a40c6a55cd4a98fbf5f746b7c9efcc93dae85fb4.svn-base b/jni/pjproject-android/.svn/pristine/a4/a40c6a55cd4a98fbf5f746b7c9efcc93dae85fb4.svn-base
new file mode 100644
index 0000000..fabefb3
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a4/a40c6a55cd4a98fbf5f746b7c9efcc93dae85fb4.svn-base
@@ -0,0 +1,47 @@
+TESTING
+
+SANITY CHECKS:
+- Do pjlib-test
+- Do pjsip-test
+
+BASIC FLOW TEST (compaq1.cfg, compaq2.cfg);
+- with other pjsua
+- with EyeBeam
+- Register
+ - with Route
+ - without Route
+ - with TCP
+- Presence (client and server)
+- Call (UAC and UAS)
+ - hold and being held
+ - DTMF send/receive
+- IM and typing
+- Call transfer (with and without norefersub)
+- Call Hold
+- Re-Invite
+- DTMF
+- RTCP
+- TCP (if there's UDP route, then Contact will be UDP)
+
+- Repeat basic flow test without Route set (to wheter TCP is correctly specified in the contact etc)
+
+
+- STUN test (fwd1.cfg)
+
+COMPATIBILITY WITH FWD
+- presence (xpidf)
+
+
+MULTIPLE ACCOUNTS (combo.cfg)
+
+DIGEST with qop=auth (sipcenter?)
+
+AUDIO QUALITY
+- call to another pjsua that loops incoming call
+
+TEST THE SAMPLES
+
+LINUX TEST
+
+UPDATE DOCUMENTATION
+
diff --git a/jni/pjproject-android/.svn/pristine/a4/a42f2f4ca0857d8ab191b4dfee11ef9bff63921e.svn-base b/jni/pjproject-android/.svn/pristine/a4/a42f2f4ca0857d8ab191b4dfee11ef9bff63921e.svn-base
new file mode 100644
index 0000000..dee13b0
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a4/a42f2f4ca0857d8ab191b4dfee11ef9bff63921e.svn-base
@@ -0,0 +1,701 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ enhancer.c
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #include <math.h>
+ #include <string.h>
+ #include "iLBC_define.h"
+ #include "constants.h"
+ #include "filter.h"
+
+ /*----------------------------------------------------------------*
+ * Find index in array such that the array element with said
+ * index is the element of said array closest to "value"
+ * according to the squared-error criterion
+ *---------------------------------------------------------------*/
+
+ void NearestNeighbor(
+
+
+
+
+
+ int *index, /* (o) index of array element closest
+ to value */
+ float *array, /* (i) data array */
+ float value,/* (i) value */
+ int arlength/* (i) dimension of data array */
+ ){
+ int i;
+ float bestcrit,crit;
+
+ crit=array[0]-value;
+ bestcrit=crit*crit;
+ *index=0;
+ for (i=1; i<arlength; i++) {
+ crit=array[i]-value;
+ crit=crit*crit;
+
+ if (crit<bestcrit) {
+ bestcrit=crit;
+ *index=i;
+ }
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * compute cross correlation between sequences
+ *---------------------------------------------------------------*/
+
+ void mycorr1(
+ float* corr, /* (o) correlation of seq1 and seq2 */
+ float* seq1, /* (i) first sequence */
+ int dim1, /* (i) dimension first seq1 */
+ const float *seq2, /* (i) second sequence */
+ int dim2 /* (i) dimension seq2 */
+ ){
+ int i,j;
+
+ for (i=0; i<=dim1-dim2; i++) {
+ corr[i]=0.0;
+ for (j=0; j<dim2; j++) {
+ corr[i] += seq1[i+j] * seq2[j];
+ }
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * upsample finite array assuming zeros outside bounds
+ *---------------------------------------------------------------*/
+
+
+
+
+
+
+ void enh_upsample(
+ float* useq1, /* (o) upsampled output sequence */
+ float* seq1,/* (i) unupsampled sequence */
+ int dim1, /* (i) dimension seq1 */
+ int hfl /* (i) polyphase filter length=2*hfl+1 */
+ ){
+ float *pu,*ps;
+ int i,j,k,q,filterlength,hfl2;
+ const float *polyp[ENH_UPS0]; /* pointers to
+ polyphase columns */
+ const float *pp;
+
+ /* define pointers for filter */
+
+ filterlength=2*hfl+1;
+
+ if ( filterlength > dim1 ) {
+ hfl2=(int) (dim1/2);
+ for (j=0; j<ENH_UPS0; j++) {
+ polyp[j]=polyphaserTbl+j*filterlength+hfl-hfl2;
+ }
+ hfl=hfl2;
+ filterlength=2*hfl+1;
+ }
+ else {
+ for (j=0; j<ENH_UPS0; j++) {
+ polyp[j]=polyphaserTbl+j*filterlength;
+ }
+ }
+
+ /* filtering: filter overhangs left side of sequence */
+
+ pu=useq1;
+ for (i=hfl; i<filterlength; i++) {
+ for (j=0; j<ENH_UPS0; j++) {
+ *pu=0.0;
+ pp = polyp[j];
+ ps = seq1+i;
+ for (k=0; k<=i; k++) {
+ *pu += *ps-- * *pp++;
+ }
+ pu++;
+ }
+ }
+
+ /* filtering: simple convolution=inner products */
+
+ for (i=filterlength; i<dim1; i++) {
+
+
+
+
+
+ for (j=0;j<ENH_UPS0; j++){
+ *pu=0.0;
+ pp = polyp[j];
+ ps = seq1+i;
+ for (k=0; k<filterlength; k++) {
+ *pu += *ps-- * *pp++;
+ }
+ pu++;
+ }
+ }
+
+ /* filtering: filter overhangs right side of sequence */
+
+ for (q=1; q<=hfl; q++) {
+ for (j=0; j<ENH_UPS0; j++) {
+ *pu=0.0;
+ pp = polyp[j]+q;
+ ps = seq1+dim1-1;
+ for (k=0; k<filterlength-q; k++) {
+ *pu += *ps-- * *pp++;
+ }
+ pu++;
+ }
+ }
+ }
+
+
+ /*----------------------------------------------------------------*
+ * find segment starting near idata+estSegPos that has highest
+ * correlation with idata+centerStartPos through
+ * idata+centerStartPos+ENH_BLOCKL-1 segment is found at a
+ * resolution of ENH_UPSO times the original of the original
+ * sampling rate
+ *---------------------------------------------------------------*/
+
+ void refiner(
+ float *seg, /* (o) segment array */
+ float *updStartPos, /* (o) updated start point */
+ float* idata, /* (i) original data buffer */
+ int idatal, /* (i) dimension of idata */
+ int centerStartPos, /* (i) beginning center segment */
+ float estSegPos,/* (i) estimated beginning other segment */
+ float period /* (i) estimated pitch period */
+ ){
+ int estSegPosRounded,searchSegStartPos,searchSegEndPos,corrdim;
+ int tloc,tloc2,i,st,en,fraction;
+ float vect[ENH_VECTL],corrVec[ENH_CORRDIM],maxv;
+ float corrVecUps[ENH_CORRDIM*ENH_UPS0];
+
+ (void)period;
+
+
+
+ /* defining array bounds */
+
+ estSegPosRounded=(int)(estSegPos - 0.5);
+
+ searchSegStartPos=estSegPosRounded-ENH_SLOP;
+
+ if (searchSegStartPos<0) {
+ searchSegStartPos=0;
+ }
+ searchSegEndPos=estSegPosRounded+ENH_SLOP;
+
+ if (searchSegEndPos+ENH_BLOCKL >= idatal) {
+ searchSegEndPos=idatal-ENH_BLOCKL-1;
+ }
+ corrdim=searchSegEndPos-searchSegStartPos+1;
+
+ /* compute upsampled correlation (corr33) and find
+ location of max */
+
+ mycorr1(corrVec,idata+searchSegStartPos,
+ corrdim+ENH_BLOCKL-1,idata+centerStartPos,ENH_BLOCKL);
+ enh_upsample(corrVecUps,corrVec,corrdim,ENH_FL0);
+ tloc=0; maxv=corrVecUps[0];
+ for (i=1; i<ENH_UPS0*corrdim; i++) {
+
+ if (corrVecUps[i]>maxv) {
+ tloc=i;
+ maxv=corrVecUps[i];
+ }
+ }
+
+ /* make vector can be upsampled without ever running outside
+ bounds */
+
+ *updStartPos= (float)searchSegStartPos +
+ (float)tloc/(float)ENH_UPS0+(float)1.0;
+ tloc2=(int)(tloc/ENH_UPS0);
+
+ if (tloc>tloc2*ENH_UPS0) {
+ tloc2++;
+ }
+ st=searchSegStartPos+tloc2-ENH_FL0;
+
+ if (st<0) {
+ memset(vect,0,-st*sizeof(float));
+ memcpy(&vect[-st],idata, (ENH_VECTL+st)*sizeof(float));
+ }
+ else {
+
+
+
+
+
+ en=st+ENH_VECTL;
+
+ if (en>idatal) {
+ memcpy(vect, &idata[st],
+ (ENH_VECTL-(en-idatal))*sizeof(float));
+ memset(&vect[ENH_VECTL-(en-idatal)], 0,
+ (en-idatal)*sizeof(float));
+ }
+ else {
+ memcpy(vect, &idata[st], ENH_VECTL*sizeof(float));
+ }
+ }
+ fraction=tloc2*ENH_UPS0-tloc;
+
+ /* compute the segment (this is actually a convolution) */
+
+ mycorr1(seg,vect,ENH_VECTL,polyphaserTbl+(2*ENH_FL0+1)*fraction,
+ 2*ENH_FL0+1);
+ }
+
+ /*----------------------------------------------------------------*
+ * find the smoothed output data
+ *---------------------------------------------------------------*/
+
+ void smath(
+ float *odata, /* (o) smoothed output */
+ float *sseq,/* (i) said second sequence of waveforms */
+ int hl, /* (i) 2*hl+1 is sseq dimension */
+ float alpha0/* (i) max smoothing energy fraction */
+ ){
+ int i,k;
+ float w00,w10,w11,A,B,C,*psseq,err,errs;
+ float surround[BLOCKL_MAX]; /* shape contributed by other than
+ current */
+ float wt[2*ENH_HL+1]; /* waveform weighting to get
+ surround shape */
+ float denom;
+
+ /* create shape of contribution from all waveforms except the
+ current one */
+
+ for (i=1; i<=2*hl+1; i++) {
+ wt[i-1] = (float)0.5*(1 - (float)cos(2*PI*i/(2*hl+2)));
+ }
+ wt[hl]=0.0; /* for clarity, not used */
+ for (i=0; i<ENH_BLOCKL; i++) {
+ surround[i]=sseq[i]*wt[0];
+ }
+
+
+
+
+
+ for (k=1; k<hl; k++) {
+ psseq=sseq+k*ENH_BLOCKL;
+ for(i=0;i<ENH_BLOCKL; i++) {
+ surround[i]+=psseq[i]*wt[k];
+ }
+ }
+ for (k=hl+1; k<=2*hl; k++) {
+ psseq=sseq+k*ENH_BLOCKL;
+ for(i=0;i<ENH_BLOCKL; i++) {
+ surround[i]+=psseq[i]*wt[k];
+ }
+ }
+
+ /* compute some inner products */
+
+ w00 = w10 = w11 = 0.0;
+ psseq=sseq+hl*ENH_BLOCKL; /* current block */
+ for (i=0; i<ENH_BLOCKL;i++) {
+ w00+=psseq[i]*psseq[i];
+ w11+=surround[i]*surround[i];
+ w10+=surround[i]*psseq[i];
+ }
+
+ if (fabs(w11) < 1.0) {
+ w11=1.0;
+ }
+ C = (float)sqrt( w00/w11);
+
+ /* first try enhancement without power-constraint */
+
+ errs=0.0;
+ psseq=sseq+hl*ENH_BLOCKL;
+ for (i=0; i<ENH_BLOCKL; i++) {
+ odata[i]=C*surround[i];
+ err=psseq[i]-odata[i];
+ errs+=err*err;
+ }
+
+ /* if constraint violated by first try, add constraint */
+
+ if (errs > alpha0 * w00) {
+ if ( w00 < 1) {
+ w00=1;
+ }
+ denom = (w11*w00-w10*w10)/(w00*w00);
+
+ if (denom > 0.0001) { /* eliminates numerical problems
+ for if smooth */
+
+
+
+
+
+ A = (float)sqrt( (alpha0- alpha0*alpha0/4)/denom);
+ B = -alpha0/2 - A * w10/w00;
+ B = B+1;
+ }
+ else { /* essentially no difference between cycles;
+ smoothing not needed */
+ A= 0.0;
+ B= 1.0;
+ }
+
+ /* create smoothed sequence */
+
+ psseq=sseq+hl*ENH_BLOCKL;
+ for (i=0; i<ENH_BLOCKL; i++) {
+ odata[i]=A*surround[i]+B*psseq[i];
+ }
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * get the pitch-synchronous sample sequence
+ *---------------------------------------------------------------*/
+
+ void getsseq(
+ float *sseq, /* (o) the pitch-synchronous sequence */
+ float *idata, /* (i) original data */
+ int idatal, /* (i) dimension of data */
+ int centerStartPos, /* (i) where current block starts */
+ float *period, /* (i) rough-pitch-period array */
+ float *plocs, /* (i) where periods of period array
+ are taken */
+ int periodl, /* (i) dimension period array */
+ int hl /* (i) 2*hl+1 is the number of sequences */
+ ){
+ int i,centerEndPos,q;
+ float blockStartPos[2*ENH_HL+1];
+ int lagBlock[2*ENH_HL+1];
+ float plocs2[ENH_PLOCSL];
+ float *psseq;
+
+ centerEndPos=centerStartPos+ENH_BLOCKL-1;
+
+ /* present */
+
+ NearestNeighbor(lagBlock+hl,plocs,
+ (float)0.5*(centerStartPos+centerEndPos),periodl);
+
+ blockStartPos[hl]=(float)centerStartPos;
+
+
+
+
+
+ psseq=sseq+ENH_BLOCKL*hl;
+ memcpy(psseq, idata+centerStartPos, ENH_BLOCKL*sizeof(float));
+
+ /* past */
+
+ for (q=hl-1; q>=0; q--) {
+ blockStartPos[q]=blockStartPos[q+1]-period[lagBlock[q+1]];
+ NearestNeighbor(lagBlock+q,plocs,
+ blockStartPos[q]+
+ ENH_BLOCKL_HALF-period[lagBlock[q+1]], periodl);
+
+
+ if (blockStartPos[q]-ENH_OVERHANG>=0) {
+ refiner(sseq+q*ENH_BLOCKL, blockStartPos+q, idata,
+ idatal, centerStartPos, blockStartPos[q],
+ period[lagBlock[q+1]]);
+ } else {
+ psseq=sseq+q*ENH_BLOCKL;
+ memset(psseq, 0, ENH_BLOCKL*sizeof(float));
+ }
+ }
+
+ /* future */
+
+ for (i=0; i<periodl; i++) {
+ plocs2[i]=plocs[i]-period[i];
+ }
+ for (q=hl+1; q<=2*hl; q++) {
+ NearestNeighbor(lagBlock+q,plocs2,
+ blockStartPos[q-1]+ENH_BLOCKL_HALF,periodl);
+
+ blockStartPos[q]=blockStartPos[q-1]+period[lagBlock[q]];
+ if (blockStartPos[q]+ENH_BLOCKL+ENH_OVERHANG<idatal) {
+ refiner(sseq+ENH_BLOCKL*q, blockStartPos+q, idata,
+ idatal, centerStartPos, blockStartPos[q],
+ period[lagBlock[q]]);
+ }
+ else {
+ psseq=sseq+q*ENH_BLOCKL;
+ memset(psseq, 0, ENH_BLOCKL*sizeof(float));
+ }
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * perform enhancement on idata+centerStartPos through
+ * idata+centerStartPos+ENH_BLOCKL-1
+ *---------------------------------------------------------------*/
+
+
+
+
+
+ void enhancer(
+ float *odata, /* (o) smoothed block, dimension blockl */
+ float *idata, /* (i) data buffer used for enhancing */
+ int idatal, /* (i) dimension idata */
+ int centerStartPos, /* (i) first sample current block
+ within idata */
+ float alpha0, /* (i) max correction-energy-fraction
+ (in [0,1]) */
+ float *period, /* (i) pitch period array */
+ float *plocs, /* (i) locations where period array
+ values valid */
+ int periodl /* (i) dimension of period and plocs */
+ ){
+ float sseq[(2*ENH_HL+1)*ENH_BLOCKL];
+
+ /* get said second sequence of segments */
+
+ getsseq(sseq,idata,idatal,centerStartPos,period,
+ plocs,periodl,ENH_HL);
+
+ /* compute the smoothed output from said second sequence */
+
+ smath(odata,sseq,ENH_HL,alpha0);
+
+ }
+
+ /*----------------------------------------------------------------*
+ * cross correlation
+ *---------------------------------------------------------------*/
+
+ float xCorrCoef(
+ float *target, /* (i) first array */
+ float *regressor, /* (i) second array */
+ int subl /* (i) dimension arrays */
+ ){
+ int i;
+ float ftmp1, ftmp2;
+
+ ftmp1 = 0.0;
+ ftmp2 = 0.0;
+ for (i=0; i<subl; i++) {
+ ftmp1 += target[i]*regressor[i];
+ ftmp2 += regressor[i]*regressor[i];
+ }
+
+ if (ftmp1 > 0.0) {
+ return (float)(ftmp1*ftmp1/ftmp2);
+ }
+
+
+
+
+
+ else {
+ return (float)0.0;
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * interface for enhancer
+ *---------------------------------------------------------------*/
+
+ int enhancerInterface(
+ float *out, /* (o) enhanced signal */
+ float *in, /* (i) unenhanced signal */
+ iLBC_Dec_Inst_t *iLBCdec_inst /* (i) buffers etc */
+ ){
+ float *enh_buf, *enh_period;
+ int iblock, isample;
+ int lag=0, ilag, i, ioffset;
+ float cc, maxcc;
+ float ftmp1, ftmp2;
+ float *inPtr, *enh_bufPtr1, *enh_bufPtr2;
+ float plc_pred[ENH_BLOCKL];
+
+ float lpState[6], downsampled[(ENH_NBLOCKS*ENH_BLOCKL+120)/2];
+ int inLen=ENH_NBLOCKS*ENH_BLOCKL+120;
+ int start, plc_blockl, inlag;
+
+ enh_buf=iLBCdec_inst->enh_buf;
+ enh_period=iLBCdec_inst->enh_period;
+
+ memmove(enh_buf, &enh_buf[iLBCdec_inst->blockl],
+ (ENH_BUFL-iLBCdec_inst->blockl)*sizeof(float));
+
+ memcpy(&enh_buf[ENH_BUFL-iLBCdec_inst->blockl], in,
+ iLBCdec_inst->blockl*sizeof(float));
+
+ if (iLBCdec_inst->mode==30)
+ plc_blockl=ENH_BLOCKL;
+ else
+ plc_blockl=40;
+
+ /* when 20 ms frame, move processing one block */
+ ioffset=0;
+ if (iLBCdec_inst->mode==20) ioffset=1;
+
+ i=3-ioffset;
+ memmove(enh_period, &enh_period[i],
+ (ENH_NBLOCKS_TOT-i)*sizeof(float));
+
+
+
+
+
+
+ /* Set state information to the 6 samples right before
+ the samples to be downsampled. */
+
+ memcpy(lpState,
+ enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-126,
+ 6*sizeof(float));
+
+ /* Down sample a factor 2 to save computations */
+
+ DownSample(enh_buf+(ENH_NBLOCKS_EXTRA+ioffset)*ENH_BLOCKL-120,
+ lpFilt_coefsTbl, inLen-ioffset*ENH_BLOCKL,
+ lpState, downsampled);
+
+ /* Estimate the pitch in the down sampled domain. */
+ for (iblock = 0; iblock<ENH_NBLOCKS-ioffset; iblock++) {
+
+ lag = 10;
+ maxcc = xCorrCoef(downsampled+60+iblock*
+ ENH_BLOCKL_HALF, downsampled+60+iblock*
+ ENH_BLOCKL_HALF-lag, ENH_BLOCKL_HALF);
+ for (ilag=11; ilag<60; ilag++) {
+ cc = xCorrCoef(downsampled+60+iblock*
+ ENH_BLOCKL_HALF, downsampled+60+iblock*
+ ENH_BLOCKL_HALF-ilag, ENH_BLOCKL_HALF);
+
+ if (cc > maxcc) {
+ maxcc = cc;
+ lag = ilag;
+ }
+ }
+
+ /* Store the estimated lag in the non-downsampled domain */
+ enh_period[iblock+ENH_NBLOCKS_EXTRA+ioffset] = (float)lag*2;
+
+
+ }
+
+
+ /* PLC was performed on the previous packet */
+ if (iLBCdec_inst->prev_enh_pl==1) {
+
+ inlag=(int)enh_period[ENH_NBLOCKS_EXTRA+ioffset];
+
+ lag = inlag-1;
+ maxcc = xCorrCoef(in, in+lag, plc_blockl);
+ for (ilag=inlag; ilag<=inlag+1; ilag++) {
+ cc = xCorrCoef(in, in+ilag, plc_blockl);
+
+
+
+
+
+
+ if (cc > maxcc) {
+ maxcc = cc;
+ lag = ilag;
+ }
+ }
+
+ enh_period[ENH_NBLOCKS_EXTRA+ioffset-1]=(float)lag;
+
+ /* compute new concealed residual for the old lookahead,
+ mix the forward PLC with a backward PLC from
+ the new frame */
+
+ inPtr=&in[lag-1];
+
+ enh_bufPtr1=&plc_pred[plc_blockl-1];
+
+ if (lag>plc_blockl) {
+ start=plc_blockl;
+ } else {
+ start=lag;
+ }
+
+ for (isample = start; isample>0; isample--) {
+ *enh_bufPtr1-- = *inPtr--;
+ }
+
+ enh_bufPtr2=&enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl];
+ for (isample = (plc_blockl-1-lag); isample>=0; isample--) {
+ *enh_bufPtr1-- = *enh_bufPtr2--;
+ }
+
+ /* limit energy change */
+ ftmp2=0.0;
+ ftmp1=0.0;
+ for (i=0;i<plc_blockl;i++) {
+ ftmp2+=enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl-i]*
+ enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl-i];
+ ftmp1+=plc_pred[i]*plc_pred[i];
+ }
+ ftmp1=(float)sqrt(ftmp1/(float)plc_blockl);
+ ftmp2=(float)sqrt(ftmp2/(float)plc_blockl);
+ if (ftmp1>(float)2.0*ftmp2 && ftmp1>0.0) {
+ for (i=0;i<plc_blockl-10;i++) {
+ plc_pred[i]*=(float)2.0*ftmp2/ftmp1;
+ }
+ for (i=plc_blockl-10;i<plc_blockl;i++) {
+ plc_pred[i]*=(float)(i-plc_blockl+10)*
+ ((float)1.0-(float)2.0*ftmp2/ftmp1)/(float)(10)+
+
+
+
+
+
+ (float)2.0*ftmp2/ftmp1;
+ }
+ }
+
+ enh_bufPtr1=&enh_buf[ENH_BUFL-1-iLBCdec_inst->blockl];
+ for (i=0; i<plc_blockl; i++) {
+ ftmp1 = (float) (i+1) / (float) (plc_blockl+1);
+ *enh_bufPtr1 *= ftmp1;
+ *enh_bufPtr1 += ((float)1.0-ftmp1)*
+ plc_pred[plc_blockl-1-i];
+ enh_bufPtr1--;
+ }
+ }
+
+ if (iLBCdec_inst->mode==20) {
+ /* Enhancer with 40 samples delay */
+ for (iblock = 0; iblock<2; iblock++) {
+ enhancer(out+iblock*ENH_BLOCKL, enh_buf,
+ ENH_BUFL, (5+iblock)*ENH_BLOCKL+40,
+ ENH_ALPHA0, enh_period, enh_plocsTbl,
+ ENH_NBLOCKS_TOT);
+ }
+ } else if (iLBCdec_inst->mode==30) {
+ /* Enhancer with 80 samples delay */
+ for (iblock = 0; iblock<3; iblock++) {
+ enhancer(out+iblock*ENH_BLOCKL, enh_buf,
+ ENH_BUFL, (4+iblock)*ENH_BLOCKL,
+ ENH_ALPHA0, enh_period, enh_plocsTbl,
+ ENH_NBLOCKS_TOT);
+ }
+ }
+
+ return (lag*2);
+ }
+
diff --git a/jni/pjproject-android/.svn/pristine/a4/a4a164b91d169d75aaaa626ce83b2eaf8d52565b.svn-base b/jni/pjproject-android/.svn/pristine/a4/a4a164b91d169d75aaaa626ce83b2eaf8d52565b.svn-base
new file mode 100644
index 0000000..e8c3761
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a4/a4a164b91d169d75aaaa626ce83b2eaf8d52565b.svn-base
@@ -0,0 +1,155 @@
+/* Copyright (C) 2002-2006 Jean-Marc Valin */
+/**
+ @file sb_celp.h
+ @brief Sub-band CELP mode used for wideband encoding
+*/
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+#ifndef SB_CELP_H
+#define SB_CELP_H
+
+#include "modes.h"
+#include <speex/speex_bits.h>
+#include "nb_celp.h"
+
+/**Structure representing the full state of the sub-band encoder*/
+typedef struct SBEncState {
+ const SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */
+ void *st_low; /**< State of the low-band (narrowband) encoder */
+ int full_frame_size; /**< Length of full-band frames*/
+ int frame_size; /**< Length of high-band frames*/
+ int subframeSize; /**< Length of high-band sub-frames*/
+ int nbSubframes; /**< Number of high-band sub-frames*/
+ int windowSize; /**< Length of high-band LPC window*/
+ int lpcSize; /**< Order of high-band LPC analysis */
+ int first; /**< First frame? */
+ spx_word16_t lpc_floor; /**< Controls LPC analysis noise floor */
+ spx_word16_t gamma1; /**< Perceptual weighting coef 1 */
+ spx_word16_t gamma2; /**< Perceptual weighting coef 2 */
+
+ char *stack; /**< Temporary allocation stack */
+ spx_word16_t *high; /**< High-band signal (buffer) */
+ spx_word16_t *h0_mem, *h1_mem;
+
+ const spx_word16_t *window; /**< LPC analysis window */
+ const spx_word16_t *lagWindow; /**< Auto-correlation window */
+ spx_lsp_t *old_lsp; /**< LSPs of previous frame */
+ spx_lsp_t *old_qlsp; /**< Quantized LSPs of previous frame */
+ spx_coef_t *interp_qlpc; /**< Interpolated quantized LPCs for current sub-frame */
+
+ spx_mem_t *mem_sp; /**< Synthesis signal memory */
+ spx_mem_t *mem_sp2;
+ spx_mem_t *mem_sw; /**< Perceptual signal memory */
+ spx_word32_t *pi_gain;
+ spx_word16_t *exc_rms;
+ spx_word16_t *innov_rms_save; /**< If non-NULL, innovation is copied here */
+
+#ifndef DISABLE_VBR
+ float vbr_quality; /**< Quality setting for VBR encoding */
+ int vbr_enabled; /**< 1 for enabling VBR, 0 otherwise */
+ spx_int32_t vbr_max; /**< Max bit-rate allowed in VBR mode (total) */
+ spx_int32_t vbr_max_high; /**< Max bit-rate allowed in VBR mode for the high-band */
+ spx_int32_t abr_enabled; /**< ABR setting (in bps), 0 if off */
+ float abr_drift;
+ float abr_drift2;
+ float abr_count;
+ int vad_enabled; /**< 1 for enabling VAD, 0 otherwise */
+ float relative_quality;
+#endif /* #ifndef DISABLE_VBR */
+
+ int encode_submode;
+ const SpeexSubmode * const *submodes;
+ int submodeID;
+ int submodeSelect;
+ int complexity;
+ spx_int32_t sampling_rate;
+
+} SBEncState;
+
+
+/**Structure representing the full state of the sub-band decoder*/
+typedef struct SBDecState {
+ const SpeexMode *mode; /**< Pointer to the mode (containing for vtable info) */
+ void *st_low; /**< State of the low-band (narrowband) encoder */
+ int full_frame_size;
+ int frame_size;
+ int subframeSize;
+ int nbSubframes;
+ int lpcSize;
+ int first;
+ spx_int32_t sampling_rate;
+ int lpc_enh_enabled;
+
+ char *stack;
+ spx_word16_t *g0_mem, *g1_mem;
+
+ spx_word16_t *excBuf;
+ spx_lsp_t *old_qlsp;
+ spx_coef_t *interp_qlpc;
+
+ spx_mem_t *mem_sp;
+ spx_word32_t *pi_gain;
+ spx_word16_t *exc_rms;
+ spx_word16_t *innov_save; /** If non-NULL, innovation is copied here */
+
+ spx_word16_t last_ener;
+ spx_int32_t seed;
+
+ int encode_submode;
+ const SpeexSubmode * const *submodes;
+ int submodeID;
+} SBDecState;
+
+
+/**Initializes encoder state*/
+void *sb_encoder_init(const SpeexMode *m);
+
+/**De-allocates encoder state resources*/
+void sb_encoder_destroy(void *state);
+
+/**Encodes one frame*/
+int sb_encode(void *state, void *in, SpeexBits *bits);
+
+
+/**Initializes decoder state*/
+void *sb_decoder_init(const SpeexMode *m);
+
+/**De-allocates decoder state resources*/
+void sb_decoder_destroy(void *state);
+
+/**Decodes one frame*/
+int sb_decode(void *state, SpeexBits *bits, void *out);
+
+int sb_encoder_ctl(void *state, int request, void *ptr);
+
+int sb_decoder_ctl(void *state, int request, void *ptr);
+
+#endif
diff --git a/jni/pjproject-android/.svn/pristine/a4/a4ac37067b662921d766cf5fc407a8398a5dbd39.svn-base b/jni/pjproject-android/.svn/pristine/a4/a4ac37067b662921d766cf5fc407a8398a5dbd39.svn-base
new file mode 100644
index 0000000..7b21f87
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a4/a4ac37067b662921d766cf5fc407a8398a5dbd39.svn-base
@@ -0,0 +1,100 @@
+/* $Id$ */
+/*
+ * Copyright (C) 2011-2011 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <pj/os.h>
+#include "TargetConditionals.h"
+
+#if TARGET_OS_IPHONE
+
+PJ_DEF(int) pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[],
+ unsigned flags)
+{
+ return (*main_func)(argc, argv);
+}
+
+#else
+
+#include <pthread.h>
+#include <AppKit/AppKit.h>
+#include <CoreFoundation/CFRunLoop.h>
+#include <Foundation/Foundation.h>
+
+#define THIS_FILE "os_core_darwin.m"
+
+typedef struct run_app_t {
+ pj_main_func_ptr main_func;
+ int argc;
+ char **argv;
+ int retval;
+} run_app_t;
+
+@interface DeadThread: NSObject { ;; }
++ (void)enterMultiThreadedMode;
++ (void)emptyThreadMethod:(id)obj;
+@end
+
+@implementation DeadThread
++ (void)enterMultiThreadedMode
+{
+ [NSThread detachNewThreadSelector:@selector(emptyThreadMethod:)
+ toTarget:[DeadThread class] withObject:nil];
+}
+
++ (void)emptyThreadMethod:(id)obj { ; }
+@end
+
+static void* main_thread(void *data)
+{
+ run_app_t *param = (run_app_t *)data;
+
+ param->retval = (*param->main_func)(param->argc, param->argv);
+ CFRunLoopStop(CFRunLoopGetMain());
+
+ return NULL;
+}
+
+/*
+ * pj_run_app()
+ * This function has to be called from the main thread. The purpose of
+ * this function is to initialize the application's memory pool, event
+ * loop management, and multi-threading environment.
+ */
+PJ_DEF(int) pj_run_app(pj_main_func_ptr main_func, int argc, char *argv[],
+ unsigned flags)
+{
+ pthread_t thread;
+ run_app_t param;
+ NSAutoreleasePool *pool;
+
+ pool = [[NSAutoreleasePool alloc] init];
+ [NSApplication sharedApplication];
+ [DeadThread enterMultiThreadedMode];
+
+ param.argc = argc;
+ param.argv = (char **)argv;
+ param.main_func = main_func;
+ if (pthread_create(&thread, NULL, &main_thread, ¶m) == 0) {
+ CFRunLoopRun();
+ }
+
+ PJ_UNUSED_ARG(pool);
+
+ return param.retval;
+}
+
+#endif
diff --git a/jni/pjproject-android/.svn/pristine/a4/a4f269bdc6ff58abe4c156424fa79c62559909b5.svn-base b/jni/pjproject-android/.svn/pristine/a4/a4f269bdc6ff58abe4c156424fa79c62559909b5.svn-base
new file mode 100644
index 0000000..f85b249
--- /dev/null
+++ b/jni/pjproject-android/.svn/pristine/a4/a4f269bdc6ff58abe4c156424fa79c62559909b5.svn-base
@@ -0,0 +1,94 @@
+/* Copyright (C) 2002 Jean-Marc Valin */
+/**
+ @file speex_header.h
+ @brief Describes the Speex header
+*/
+/*
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+
+ - Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ - Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ - Neither the name of the Xiph.org Foundation nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+*/
+
+
+#ifndef SPEEX_HEADER_H
+#define SPEEX_HEADER_H
+/** @defgroup SpeexHeader SpeexHeader: Makes it easy to write/parse an Ogg/Speex header
+ * This is the Speex header for the Ogg encapsulation. You don't need that if you just use RTP.
+ * @{
+ */
+
+#include "speex/speex_types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct SpeexMode;
+
+/** Length of the Speex header identifier */
+#define SPEEX_HEADER_STRING_LENGTH 8
+
+/** Maximum number of characters for encoding the Speex version number in the header */
+#define SPEEX_HEADER_VERSION_LENGTH 20
+
+/** Speex header info for file-based formats */
+typedef struct SpeexHeader {
+ char speex_string[SPEEX_HEADER_STRING_LENGTH]; /**< Identifies a Speex bit-stream, always set to "Speex " */
+ char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
+ spx_int32_t speex_version_id; /**< Version for Speex (for checking compatibility) */
+ spx_int32_t header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
+ spx_int32_t rate; /**< Sampling rate used */
+ spx_int32_t mode; /**< Mode used (0 for narrowband, 1 for wideband) */
+ spx_int32_t mode_bitstream_version; /**< Version ID of the bit-stream */
+ spx_int32_t nb_channels; /**< Number of channels encoded */
+ spx_int32_t bitrate; /**< Bit-rate used */
+ spx_int32_t frame_size; /**< Size of frames */
+ spx_int32_t vbr; /**< 1 for a VBR encoding, 0 otherwise */
+ spx_int32_t frames_per_packet; /**< Number of frames stored per Ogg packet */
+ spx_int32_t extra_headers; /**< Number of additional headers after the comments */
+ spx_int32_t reserved1; /**< Reserved for future use, must be zero */
+ spx_int32_t reserved2; /**< Reserved for future use, must be zero */
+} SpeexHeader;
+
+/** Initializes a SpeexHeader using basic information */
+void speex_init_header(SpeexHeader *header, int rate, int nb_channels, const struct SpeexMode *m);
+
+/** Creates the header packet from the header itself (mostly involves endianness conversion) */
+char *speex_header_to_packet(SpeexHeader *header, int *size);
+
+/** Creates a SpeexHeader from a packet */
+SpeexHeader *speex_packet_to_header(char *packet, int size);
+
+/** Frees the memory allocated by either speex_header_to_packet() or speex_packet_to_header() */
+void speex_header_free(void *ptr);
+
+#ifdef __cplusplus
+}
+#endif
+
+/** @} */
+#endif