[asterisk-commits] kpfleming: branch kpfleming/multimodule-build r111494 - in /team/kpfleming/mu...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Mar 27 15:40:49 CDT 2008
Author: kpfleming
Date: Thu Mar 27 15:40:48 2008
New Revision: 111494
URL: http://svn.digium.com/view/asterisk?view=rev&rev=111494
Log:
a new attempt an improved build system with lots of new features... stay tuned
Added:
team/kpfleming/multimodule-build/
- copied from r110880, trunk/
team/kpfleming/multimodule-build/astbuild/
Modified:
team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.c
team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.h
team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.c
team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.h
team/kpfleming/multimodule-build/codecs/ilbc/LPCencode.c
team/kpfleming/multimodule-build/codecs/ilbc/LPCencode.h
team/kpfleming/multimodule-build/codecs/ilbc/StateConstructW.c
team/kpfleming/multimodule-build/codecs/ilbc/StateConstructW.h
team/kpfleming/multimodule-build/codecs/ilbc/StateSearchW.c
team/kpfleming/multimodule-build/codecs/ilbc/StateSearchW.h
team/kpfleming/multimodule-build/codecs/ilbc/anaFilter.c
team/kpfleming/multimodule-build/codecs/ilbc/anaFilter.h
team/kpfleming/multimodule-build/codecs/ilbc/constants.c
team/kpfleming/multimodule-build/codecs/ilbc/constants.h
team/kpfleming/multimodule-build/codecs/ilbc/createCB.c
team/kpfleming/multimodule-build/codecs/ilbc/createCB.h
team/kpfleming/multimodule-build/codecs/ilbc/doCPLC.c
team/kpfleming/multimodule-build/codecs/ilbc/doCPLC.h
team/kpfleming/multimodule-build/codecs/ilbc/enhancer.c
team/kpfleming/multimodule-build/codecs/ilbc/enhancer.h
team/kpfleming/multimodule-build/codecs/ilbc/filter.c
team/kpfleming/multimodule-build/codecs/ilbc/filter.h
team/kpfleming/multimodule-build/codecs/ilbc/gainquant.c
team/kpfleming/multimodule-build/codecs/ilbc/gainquant.h
team/kpfleming/multimodule-build/codecs/ilbc/getCBvec.c
team/kpfleming/multimodule-build/codecs/ilbc/getCBvec.h
team/kpfleming/multimodule-build/codecs/ilbc/helpfun.c
team/kpfleming/multimodule-build/codecs/ilbc/helpfun.h
team/kpfleming/multimodule-build/codecs/ilbc/hpInput.c
team/kpfleming/multimodule-build/codecs/ilbc/hpInput.h
team/kpfleming/multimodule-build/codecs/ilbc/hpOutput.c
team/kpfleming/multimodule-build/codecs/ilbc/hpOutput.h
team/kpfleming/multimodule-build/codecs/ilbc/iCBConstruct.c
team/kpfleming/multimodule-build/codecs/ilbc/iCBConstruct.h
team/kpfleming/multimodule-build/codecs/ilbc/iCBSearch.c
team/kpfleming/multimodule-build/codecs/ilbc/iCBSearch.h
team/kpfleming/multimodule-build/codecs/ilbc/iLBC_decode.c
team/kpfleming/multimodule-build/codecs/ilbc/iLBC_decode.h
team/kpfleming/multimodule-build/codecs/ilbc/iLBC_define.h
team/kpfleming/multimodule-build/codecs/ilbc/iLBC_encode.c
team/kpfleming/multimodule-build/codecs/ilbc/iLBC_encode.h
team/kpfleming/multimodule-build/codecs/ilbc/lsf.c
team/kpfleming/multimodule-build/codecs/ilbc/lsf.h
team/kpfleming/multimodule-build/codecs/ilbc/packing.c
team/kpfleming/multimodule-build/codecs/ilbc/packing.h
team/kpfleming/multimodule-build/codecs/ilbc/syntFilter.c
team/kpfleming/multimodule-build/codecs/ilbc/syntFilter.h
Modified: team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.c?view=diff&rev=111494&r1=110880&r2=111494
==============================================================================
--- team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.c (original)
+++ team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.c Thu Mar 27 15:40:48 2008
@@ -1,110 +1,114 @@
-/******************************************************************
+ /******************************************************************
- iLBC Speech Coder ANSI-C Source Code
+ iLBC Speech Coder ANSI-C Source Code
- FrameClassify.c
+ FrameClassify.c
- Copyright (C) The Internet Society (2004).
- All Rights Reserved.
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
-******************************************************************/
+ ******************************************************************/
-#include "iLBC_define.h"
-#include "FrameClassify.h"
+ #include "iLBC_define.h"
-/*---------------------------------------------------------------*
- * Classification of subframes to localize start state
- *--------------------------------------------------------------*/
+ /*---------------------------------------------------------------*
+ * Classification of subframes to localize start state
+ *--------------------------------------------------------------*/
-int FrameClassify( /* index to the max-energy sub-frame */
- iLBC_Enc_Inst_t *iLBCenc_inst,
- /* (i/o) the encoder state structure */
- float *residual /* (i) lpc residual signal */
-) {
- float max_ssqEn, fssqEn[NSUB_MAX], bssqEn[NSUB_MAX], *pp;
- int n, l, max_ssqEn_n;
- const float ssqEn_win[NSUB_MAX-1]={(float)0.8,(float)0.9,
- (float)1.0,(float)0.9,(float)0.8};
- const float sampEn_win[5]={(float)1.0/(float)6.0,
- (float)2.0/(float)6.0, (float)3.0/(float)6.0,
- (float)4.0/(float)6.0, (float)5.0/(float)6.0};
-
- /* init the front and back energies to zero */
+ int FrameClassify( /* index to the max-energy sub-frame */
+ iLBC_Enc_Inst_t *iLBCenc_inst,
+ /* (i/o) the encoder state structure */
+ float *residual /* (i) lpc residual signal */
+ ) {
+ float max_ssqEn, fssqEn[NSUB_MAX], bssqEn[NSUB_MAX], *pp;
+ int n, l, max_ssqEn_n;
+ const float ssqEn_win[NSUB_MAX-1]={(float)0.8,(float)0.9,
+ (float)1.0,(float)0.9,(float)0.8};
+ const float sampEn_win[5]={(float)1.0/(float)6.0,
+ (float)2.0/(float)6.0, (float)3.0/(float)6.0,
+ (float)4.0/(float)6.0, (float)5.0/(float)6.0};
- memset(fssqEn, 0, NSUB_MAX*sizeof(float));
- memset(bssqEn, 0, NSUB_MAX*sizeof(float));
+ /* init the front and back energies to zero */
- /* Calculate front of first seqence */
+ memset(fssqEn, 0, NSUB_MAX*sizeof(float));
+ memset(bssqEn, 0, NSUB_MAX*sizeof(float));
- n=0;
- pp=residual;
+ /* Calculate front of first seqence */
+
+ n=0;
+ pp=residual;
+ for (l=0; l<5; l++) {
+ fssqEn[n] += sampEn_win[l] * (*pp) * (*pp);
+ pp++;
+ }
+ for (l=5; l<SUBL; l++) {
- for (l=0; l<5; l++) {
- fssqEn[n] += sampEn_win[l] * (*pp) * (*pp);
- pp++;
- }
- for (l=5; l<SUBL; l++) {
- fssqEn[n] += (*pp) * (*pp);
- pp++;
- }
-
- /* Calculate front and back of all middle sequences */
-
- for (n=1; n<iLBCenc_inst->nsub-1; n++) {
- pp=residual+n*SUBL;
- for (l=0; l<5; l++) {
- fssqEn[n] += sampEn_win[l] * (*pp) * (*pp);
- bssqEn[n] += (*pp) * (*pp);
- pp++;
- }
- for (l=5; l<SUBL-5; l++) {
- fssqEn[n] += (*pp) * (*pp);
- bssqEn[n] += (*pp) * (*pp);
- pp++;
- }
- for (l=SUBL-5; l<SUBL; l++) {
- fssqEn[n] += (*pp) * (*pp);
- bssqEn[n] += sampEn_win[SUBL-l-1] * (*pp) * (*pp);
- pp++;
- }
- }
-
- /* Calculate back of last seqence */
-
- n=iLBCenc_inst->nsub-1;
- pp=residual+n*SUBL;
- for (l=0; l<SUBL-5; l++) {
- bssqEn[n] += (*pp) * (*pp);
- pp++;
- }
- for (l=SUBL-5; l<SUBL; l++) {
- bssqEn[n] += sampEn_win[SUBL-l-1] * (*pp) * (*pp);
- pp++;
- }
-
- /* find the index to the weighted 80 sample with
- most energy */
-
- if (iLBCenc_inst->mode==20) l=1;
- else l=0;
-
- max_ssqEn=(fssqEn[0]+bssqEn[1])*ssqEn_win[l];
- max_ssqEn_n=1;
- for (n=2; n<iLBCenc_inst->nsub; n++) {
-
- l++;
- if ((fssqEn[n-1]+bssqEn[n])*ssqEn_win[l] > max_ssqEn) {
- max_ssqEn=(fssqEn[n-1]+bssqEn[n]) *
- ssqEn_win[l];
- max_ssqEn_n=n;
- }
- }
- return max_ssqEn_n;
-}
+ fssqEn[n] += (*pp) * (*pp);
+ pp++;
+ }
+
+ /* Calculate front and back of all middle sequences */
+
+ for (n=1; n<iLBCenc_inst->nsub-1; n++) {
+ pp=residual+n*SUBL;
+ for (l=0; l<5; l++) {
+ fssqEn[n] += sampEn_win[l] * (*pp) * (*pp);
+ bssqEn[n] += (*pp) * (*pp);
+ pp++;
+ }
+ for (l=5; l<SUBL-5; l++) {
+ fssqEn[n] += (*pp) * (*pp);
+ bssqEn[n] += (*pp) * (*pp);
+ pp++;
+ }
+ for (l=SUBL-5; l<SUBL; l++) {
+ fssqEn[n] += (*pp) * (*pp);
+ bssqEn[n] += sampEn_win[SUBL-l-1] * (*pp) * (*pp);
+ pp++;
+ }
+ }
+
+ /* Calculate back of last seqence */
+
+ n=iLBCenc_inst->nsub-1;
+ pp=residual+n*SUBL;
+ for (l=0; l<SUBL-5; l++) {
+ bssqEn[n] += (*pp) * (*pp);
+ pp++;
+ }
+ for (l=SUBL-5; l<SUBL; l++) {
+ bssqEn[n] += sampEn_win[SUBL-l-1] * (*pp) * (*pp);
+ pp++;
+ }
+
+ /* find the index to the weighted 80 sample with
+ most energy */
+
+ if (iLBCenc_inst->mode==20) l=1;
+ else l=0;
+
+ max_ssqEn=(fssqEn[0]+bssqEn[1])*ssqEn_win[l];
+ max_ssqEn_n=1;
+ for (n=2; n<iLBCenc_inst->nsub; n++) {
+
+
+
+
+ l++;
+ if ((fssqEn[n-1]+bssqEn[n])*ssqEn_win[l] > max_ssqEn) {
+ max_ssqEn=(fssqEn[n-1]+bssqEn[n]) *
+ ssqEn_win[l];
+ max_ssqEn_n=n;
+ }
+ }
+
+ return max_ssqEn_n;
+ }
+
Modified: team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.h?view=diff&rev=111494&r1=110880&r2=111494
==============================================================================
--- team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.h (original)
+++ team/kpfleming/multimodule-build/codecs/ilbc/FrameClassify.h Thu Mar 27 15:40:48 2008
@@ -1,26 +1,27 @@
-/******************************************************************
+ /******************************************************************
- iLBC Speech Coder ANSI-C Source Code
+ iLBC Speech Coder ANSI-C Source Code
- FrameClassify.h
+ FrameClassify.h
- Copyright (C) The Internet Society (2004).
- All Rights Reserved.
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
-******************************************************************/
+ ******************************************************************/
+
+ #ifndef __iLBC_FRAMECLASSIFY_H
+ #define __iLBC_FRAMECLASSIFY_H
+
+ int FrameClassify( /* index to the max-energy sub-frame */
+ iLBC_Enc_Inst_t *iLBCenc_inst,
+ /* (i/o) the encoder state structure */
+ float *residual /* (i) lpc residual signal */
+ );
-#ifndef __iLBC_FRAMECLASSIFY_H
-#define __iLBC_FRAMECLASSIFY_H
-
-int FrameClassify( /* index to the max-energy sub-frame */
- iLBC_Enc_Inst_t *iLBCenc_inst,
- /* (i/o) the encoder state structure */
- float *residual /* (i) lpc residual signal */
-);
-
-#endif
+ #endif
+
Modified: team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.c?view=diff&rev=111494&r1=110880&r2=111494
==============================================================================
--- team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.c (original)
+++ team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.c Thu Mar 27 15:40:48 2008
@@ -1,152 +1,158 @@
-/******************************************************************
+ /******************************************************************
- iLBC Speech Coder ANSI-C Source Code
+ iLBC Speech Coder ANSI-C Source Code
- LPC_decode.c
+ LPC_decode.c
- Copyright (C) The Internet Society (2004).
- All Rights Reserved.
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
-******************************************************************/
+ ******************************************************************/
-#include <math.h>
-#include <string.h>
+ #include <math.h>
+ #include <string.h>
-#include "helpfun.h"
-#include "lsf.h"
-#include "iLBC_define.h"
-#include "LPCdecode.h"
-#include "constants.h"
+ #include "helpfun.h"
+ #include "lsf.h"
+ #include "iLBC_define.h"
+ #include "constants.h"
-/*---------------------------------------------------------------*
- * interpolation of lsf coefficients for the decoder
- *--------------------------------------------------------------*/
+ /*---------------------------------------------------------------*
+ * interpolation of lsf coefficients for the decoder
+ *--------------------------------------------------------------*/
-void LSFinterpolate2a_dec(
- float *a, /* (o) lpc coefficients for a sub-frame */
- float *lsf1, /* (i) first lsf coefficient vector */
+ void LSFinterpolate2a_dec(
+ float *a, /* (o) lpc coefficients for a sub-frame */
+ float *lsf1, /* (i) first lsf coefficient vector */
+ float *lsf2, /* (i) second lsf coefficient vector */
+ float coef, /* (i) interpolation weight */
+ int length /* (i) length of lsf vectors */
+ ){
+ float lsftmp[LPC_FILTERORDER];
+ interpolate(lsftmp, lsf1, lsf2, coef, length);
+ lsf2a(a, lsftmp);
+ }
- float *lsf2, /* (i) second lsf coefficient vector */
- float coef, /* (i) interpolation weight */
- int length /* (i) length of lsf vectors */
-){
- float lsftmp[LPC_FILTERORDER];
-
- interpolate(lsftmp, lsf1, lsf2, coef, length);
- lsf2a(a, lsftmp);
-}
+ /*---------------------------------------------------------------*
+ * obtain dequantized lsf coefficients from quantization index
+ *--------------------------------------------------------------*/
-/*---------------------------------------------------------------*
- * obtain dequantized lsf coefficients from quantization index
- *--------------------------------------------------------------*/
-
-void SimplelsfDEQ(
- float *lsfdeq, /* (o) dequantized lsf coefficients */
- int *index, /* (i) quantization index */
- int lpc_n /* (i) number of LPCs */
-){
- int i, j, pos, cb_pos;
-
- /* decode first LSF */
-
- pos = 0;
- cb_pos = 0;
- for (i = 0; i < LSF_NSPLIT; i++) {
- for (j = 0; j < dim_lsfCbTbl[i]; j++) {
- lsfdeq[pos + j] = lsfCbTbl[cb_pos +
- (long)(index[i])*dim_lsfCbTbl[i] + j];
- }
- pos += dim_lsfCbTbl[i];
- cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
- }
-
- if (lpc_n>1) {
-
- /* decode last LSF */
-
- pos = 0;
- cb_pos = 0;
- for (i = 0; i < LSF_NSPLIT; i++) {
- for (j = 0; j < dim_lsfCbTbl[i]; j++) {
- lsfdeq[LPC_FILTERORDER + pos + j] =
- lsfCbTbl[cb_pos +
- (long)(index[LSF_NSPLIT + i])*
- dim_lsfCbTbl[i] + j];
- }
- pos += dim_lsfCbTbl[i];
- cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
- }
- }
-}
-
-/*----------------------------------------------------------------*
-
-
- * obtain synthesis and weighting filters form lsf coefficients
- *---------------------------------------------------------------*/
-
-void DecoderInterpolateLSF(
- float *syntdenum, /* (o) synthesis filter coefficients */
- float *weightdenum, /* (o) weighting denumerator
- coefficients */
- float *lsfdeq, /* (i) dequantized lsf coefficients */
- int length, /* (i) length of lsf coefficient vector */
- iLBC_Dec_Inst_t *iLBCdec_inst
- /* (i) the decoder state structure */
-){
- int i, pos, lp_length;
- float lp[LPC_FILTERORDER + 1], *lsfdeq2;
-
- lsfdeq2 = lsfdeq + length;
- lp_length = length + 1;
-
- if (iLBCdec_inst->mode==30) {
- /* sub-frame 1: Interpolation between old and first */
-
- LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq,
- lsf_weightTbl_30ms[0], length);
- memcpy(syntdenum,lp,lp_length*sizeof(float));
- bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM,
- lp_length);
-
- /* sub-frames 2 to 6: interpolation between first
- and last LSF */
-
- pos = lp_length;
- for (i = 1; i < 6; i++) {
- LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2,
- lsf_weightTbl_30ms[i], length);
- memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
- bwexpand(weightdenum + pos, lp,
- LPC_CHIRP_WEIGHTDENUM, lp_length);
- pos += lp_length;
- }
- }
- else {
- pos = 0;
- for (i = 0; i < iLBCdec_inst->nsub; i++) {
- LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold,
- lsfdeq, lsf_weightTbl_20ms[i], length);
- memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
- bwexpand(weightdenum+pos, lp, LPC_CHIRP_WEIGHTDENUM,
- lp_length);
- pos += lp_length;
- }
- }
-
- /* update memory */
+ void SimplelsfDEQ(
+ float *lsfdeq, /* (o) dequantized lsf coefficients */
+ int *index, /* (i) quantization index */
+ int lpc_n /* (i) number of LPCs */
+ ){
+ int i, j, pos, cb_pos;
- if (iLBCdec_inst->mode==30)
- memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2,
- length*sizeof(float));
- else
- memcpy(iLBCdec_inst->lsfdeqold, lsfdeq,
- length*sizeof(float));
-
-}
+ /* decode first LSF */
+
+ pos = 0;
+ cb_pos = 0;
+ for (i = 0; i < LSF_NSPLIT; i++) {
+ for (j = 0; j < dim_lsfCbTbl[i]; j++) {
+ lsfdeq[pos + j] = lsfCbTbl[cb_pos +
+ (long)(index[i])*dim_lsfCbTbl[i] + j];
+ }
+ pos += dim_lsfCbTbl[i];
+ cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
+ }
+
+ if (lpc_n>1) {
+
+ /* decode last LSF */
+
+ pos = 0;
+ cb_pos = 0;
+ for (i = 0; i < LSF_NSPLIT; i++) {
+ for (j = 0; j < dim_lsfCbTbl[i]; j++) {
+ lsfdeq[LPC_FILTERORDER + pos + j] =
+ lsfCbTbl[cb_pos +
+ (long)(index[LSF_NSPLIT + i])*
+ dim_lsfCbTbl[i] + j];
+ }
+ pos += dim_lsfCbTbl[i];
+ cb_pos += size_lsfCbTbl[i]*dim_lsfCbTbl[i];
+ }
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * obtain synthesis and weighting filters form lsf coefficients
+ *---------------------------------------------------------------*/
+
+ void DecoderInterpolateLSF(
+ float *syntdenum, /* (o) synthesis filter coefficients */
+ float *weightdenum, /* (o) weighting denumerator
+ coefficients */
+ float *lsfdeq, /* (i) dequantized lsf coefficients */
+ int length, /* (i) length of lsf coefficient vector */
+ iLBC_Dec_Inst_t *iLBCdec_inst
+ /* (i) the decoder state structure */
+ ){
+ int i, pos, lp_length;
+ float lp[LPC_FILTERORDER + 1], *lsfdeq2;
+
+
+
+
+
+
+ lsfdeq2 = lsfdeq + length;
+ lp_length = length + 1;
+
+ if (iLBCdec_inst->mode==30) {
+ /* sub-frame 1: Interpolation between old and first */
+
+ LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold, lsfdeq,
+ lsf_weightTbl_30ms[0], length);
+ memcpy(syntdenum,lp,lp_length*sizeof(float));
+ bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM,
+ lp_length);
+
+ /* sub-frames 2 to 6: interpolation between first
+ and last LSF */
+
+ pos = lp_length;
+ for (i = 1; i < 6; i++) {
+ LSFinterpolate2a_dec(lp, lsfdeq, lsfdeq2,
+ lsf_weightTbl_30ms[i], length);
+ memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
+ bwexpand(weightdenum + pos, lp,
+ LPC_CHIRP_WEIGHTDENUM, lp_length);
+ pos += lp_length;
+ }
+ }
+ else {
+ pos = 0;
+ for (i = 0; i < iLBCdec_inst->nsub; i++) {
+ LSFinterpolate2a_dec(lp, iLBCdec_inst->lsfdeqold,
+ lsfdeq, lsf_weightTbl_20ms[i], length);
+ memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
+ bwexpand(weightdenum+pos, lp, LPC_CHIRP_WEIGHTDENUM,
+ lp_length);
+ pos += lp_length;
+ }
+ }
+
+ /* update memory */
+
+ if (iLBCdec_inst->mode==30)
+ memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2,
+ length*sizeof(float));
+ else
+ memcpy(iLBCdec_inst->lsfdeqold, lsfdeq,
+ length*sizeof(float));
+
+ }
+
+
+
+
+
+
Modified: team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.h?view=diff&rev=111494&r1=110880&r2=111494
==============================================================================
--- team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.h (original)
+++ team/kpfleming/multimodule-build/codecs/ilbc/LPCdecode.h Thu Mar 27 15:40:48 2008
@@ -1,44 +1,52 @@
-/******************************************************************
+ /******************************************************************
- iLBC Speech Coder ANSI-C Source Code
+ iLBC Speech Coder ANSI-C Source Code
- LPC_decode.h
+ LPC_decode.h
- Copyright (C) The Internet Society (2004).
- All Rights Reserved.
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
-******************************************************************/
+ ******************************************************************/
-#ifndef __iLBC_LPC_DECODE_H
-#define __iLBC_LPC_DECODE_H
+ #ifndef __iLBC_LPC_DECODE_H
+ #define __iLBC_LPC_DECODE_H
-void LSFinterpolate2a_dec(
+ void LSFinterpolate2a_dec(
+ float *a, /* (o) lpc coefficients for a sub-frame */
+ float *lsf1, /* (i) first lsf coefficient vector */
+ float *lsf2, /* (i) second lsf coefficient vector */
+ float coef, /* (i) interpolation weight */
+ int length /* (i) length of lsf vectors */
+ );
+
+ void SimplelsfDEQ(
+ float *lsfdeq, /* (o) dequantized lsf coefficients */
+ int *index, /* (i) quantization index */
+ int lpc_n /* (i) number of LPCs */
+ );
+
+ void DecoderInterpolateLSF(
+ float *syntdenum, /* (o) synthesis filter coefficients */
+ float *weightdenum, /* (o) weighting denumerator
+ coefficients */
+ float *lsfdeq, /* (i) dequantized lsf coefficients */
+ int length, /* (i) length of lsf coefficient vector */
+ iLBC_Dec_Inst_t *iLBCdec_inst
+ /* (i) the decoder state structure */
+ );
+
+ #endif
- float *a, /* (o) lpc coefficients for a sub-frame */
- float *lsf1, /* (i) first lsf coefficient vector */
- float *lsf2, /* (i) second lsf coefficient vector */
- float coef, /* (i) interpolation weight */
- int length /* (i) length of lsf vectors */
-);
-
-void SimplelsfDEQ(
- float *lsfdeq, /* (o) dequantized lsf coefficients */
- int *index, /* (i) quantization index */
- int lpc_n /* (i) number of LPCs */
-);
-
-void DecoderInterpolateLSF(
- float *syntdenum, /* (o) synthesis filter coefficients */
- float *weightdenum, /* (o) weighting denumerator
- coefficients */
- float *lsfdeq, /* (i) dequantized lsf coefficients */
- int length, /* (i) length of lsf coefficient vector */
- iLBC_Dec_Inst_t *iLBCdec_inst
- /* (i) the decoder state structure */
-);
-
-#endif
+
+
+
+
+
+
+
+
Modified: team/kpfleming/multimodule-build/codecs/ilbc/LPCencode.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/multimodule-build/codecs/ilbc/LPCencode.c?view=diff&rev=111494&r1=110880&r2=111494
==============================================================================
--- team/kpfleming/multimodule-build/codecs/ilbc/LPCencode.c (original)
+++ team/kpfleming/multimodule-build/codecs/ilbc/LPCencode.c Thu Mar 27 15:40:48 2008
@@ -1,228 +1,241 @@
-/******************************************************************
-
- iLBC Speech Coder ANSI-C Source Code
-
- LPCencode.c
-
- Copyright (C) The Internet Society (2004).
- All Rights Reserved.
-
-******************************************************************/
-
-#include <string.h>
-
-
-
-#include "iLBC_define.h"
-#include "LPCencode.h"
-#include "helpfun.h"
-#include "lsf.h"
-#include "constants.h"
-
-/*----------------------------------------------------------------*
- * lpc analysis (subrutine to LPCencode)
- *---------------------------------------------------------------*/
-
-static void SimpleAnalysis(
- float *lsf, /* (o) lsf coefficients */
- float *data, /* (i) new data vector */
- iLBC_Enc_Inst_t *iLBCenc_inst
- /* (i/o) the encoder state structure */
-){
- int k, is;
- float temp[BLOCKL_MAX], lp[LPC_FILTERORDER + 1];
- float lp2[LPC_FILTERORDER + 1];
- float r[LPC_FILTERORDER + 1];
-
- is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
- memcpy(iLBCenc_inst->lpc_buffer+is,data,
- iLBCenc_inst->blockl*sizeof(float));
-
- /* No lookahead, last window is asymmetric */
-
- for (k = 0; k < iLBCenc_inst->lpc_n; k++) {
-
- is = LPC_LOOKBACK;
-
- if (k < (iLBCenc_inst->lpc_n - 1)) {
- window(temp, lpc_winTbl,
- iLBCenc_inst->lpc_buffer, BLOCKL_MAX);
- } else {
- window(temp, lpc_asymwinTbl,
- iLBCenc_inst->lpc_buffer + is, BLOCKL_MAX);
- }
-
- autocorr(r, temp, BLOCKL_MAX, LPC_FILTERORDER);
- window(r, r, lpc_lagwinTbl, LPC_FILTERORDER + 1);
-
- levdurb(lp, temp, r, LPC_FILTERORDER);
- bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, LPC_FILTERORDER+1);
-
- a2lsf(lsf + k*LPC_FILTERORDER, lp2);
- }
- is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
- memmove(iLBCenc_inst->lpc_buffer,
- iLBCenc_inst->lpc_buffer+LPC_LOOKBACK+BLOCKL_MAX-is,
- is*sizeof(float));
-}
-
-/*----------------------------------------------------------------*
-
-
- * lsf interpolator and conversion from lsf to a coefficients
- * (subrutine to SimpleInterpolateLSF)
- *---------------------------------------------------------------*/
-
-static void LSFinterpolate2a_enc(
- float *a, /* (o) lpc coefficients */
- float *lsf1,/* (i) first set of lsf coefficients */
- float *lsf2,/* (i) second set of lsf coefficients */
- float coef, /* (i) weighting coefficient to use between
- lsf1 and lsf2 */
- long length /* (i) length of coefficient vectors */
-){
- float lsftmp[LPC_FILTERORDER];
-
- interpolate(lsftmp, lsf1, lsf2, coef, length);
- lsf2a(a, lsftmp);
-}
-
-/*----------------------------------------------------------------*
- * lsf interpolator (subrutine to LPCencode)
- *---------------------------------------------------------------*/
-
-static void SimpleInterpolateLSF(
- float *syntdenum, /* (o) the synthesis filter denominator
- resulting from the quantized
- interpolated lsf */
- float *weightdenum, /* (o) the weighting filter denominator
- resulting from the unquantized
- interpolated lsf */
- float *lsf, /* (i) the unquantized lsf coefficients */
- float *lsfdeq, /* (i) the dequantized lsf coefficients */
- float *lsfold, /* (i) the unquantized lsf coefficients of
- the previous signal frame */
- float *lsfdeqold, /* (i) the dequantized lsf coefficients of
- the previous signal frame */
- int length, /* (i) should equate LPC_FILTERORDER */
- iLBC_Enc_Inst_t *iLBCenc_inst
- /* (i/o) the encoder state structure */
-){
- int i, pos, lp_length;
- float lp[LPC_FILTERORDER + 1], *lsf2, *lsfdeq2;
-
- lsf2 = lsf + length;
- lsfdeq2 = lsfdeq + length;
- lp_length = length + 1;
-
- if (iLBCenc_inst->mode==30) {
- /* sub-frame 1: Interpolation between old and first
- set of lsf coefficients */
-
- LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
- lsf_weightTbl_30ms[0], length);
- memcpy(syntdenum,lp,lp_length*sizeof(float));
- LSFinterpolate2a_enc(lp, lsfold, lsf,
-
-
- lsf_weightTbl_30ms[0], length);
- bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
-
- /* sub-frame 2 to 6: Interpolation between first
- and second set of lsf coefficients */
-
- pos = lp_length;
- for (i = 1; i < iLBCenc_inst->nsub; i++) {
- LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2,
- lsf_weightTbl_30ms[i], length);
- memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
-
- LSFinterpolate2a_enc(lp, lsf, lsf2,
- lsf_weightTbl_30ms[i], length);
- bwexpand(weightdenum + pos, lp,
- LPC_CHIRP_WEIGHTDENUM, lp_length);
- pos += lp_length;
- }
- }
- else {
- pos = 0;
- for (i = 0; i < iLBCenc_inst->nsub; i++) {
- LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
- lsf_weightTbl_20ms[i], length);
- memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
- LSFinterpolate2a_enc(lp, lsfold, lsf,
- lsf_weightTbl_20ms[i], length);
- bwexpand(weightdenum+pos, lp,
- LPC_CHIRP_WEIGHTDENUM, lp_length);
- pos += lp_length;
- }
- }
-
- /* update memory */
-
- if (iLBCenc_inst->mode==30) {
- memcpy(lsfold, lsf2, length*sizeof(float));
- memcpy(lsfdeqold, lsfdeq2, length*sizeof(float));
- }
- else {
- memcpy(lsfold, lsf, length*sizeof(float));
- memcpy(lsfdeqold, lsfdeq, length*sizeof(float));
- }
-}
-
-/*----------------------------------------------------------------*
- * lsf quantizer (subrutine to LPCencode)
- *---------------------------------------------------------------*/
-
-static void SimplelsfQ(
- float *lsfdeq, /* (o) dequantized lsf coefficients
- (dimension FILTERORDER) */
- int *index, /* (o) quantization index */
- float *lsf, /* (i) the lsf coefficient vector to be
-
-
- quantized (dimension FILTERORDER ) */
- int lpc_n /* (i) number of lsf sets to quantize */
-){
- /* Quantize first LSF with memoryless split VQ */
- SplitVQ(lsfdeq, index, lsf, lsfCbTbl, LSF_NSPLIT,
- dim_lsfCbTbl, size_lsfCbTbl);
-
- if (lpc_n==2) {
- /* Quantize second LSF with memoryless split VQ */
- SplitVQ(lsfdeq + LPC_FILTERORDER, index + LSF_NSPLIT,
- lsf + LPC_FILTERORDER, lsfCbTbl, LSF_NSPLIT,
- dim_lsfCbTbl, size_lsfCbTbl);
- }
-}
-
-/*----------------------------------------------------------------*
- * lpc encoder
- *---------------------------------------------------------------*/
-
-void LPCencode(
- float *syntdenum, /* (i/o) synthesis filter coefficients
- before/after encoding */
- float *weightdenum, /* (i/o) weighting denumerator
- coefficients before/after
- encoding */
- int *lsf_index, /* (o) lsf quantization index */
- float *data, /* (i) lsf coefficients to quantize */
- iLBC_Enc_Inst_t *iLBCenc_inst
- /* (i/o) the encoder state structure */
-){
- float lsf[LPC_FILTERORDER * LPC_N_MAX];
- float lsfdeq[LPC_FILTERORDER * LPC_N_MAX];
- int change=0;
-
- SimpleAnalysis(lsf, data, iLBCenc_inst);
- SimplelsfQ(lsfdeq, lsf_index, lsf, iLBCenc_inst->lpc_n);
- change=LSF_check(lsfdeq, LPC_FILTERORDER, iLBCenc_inst->lpc_n);
- SimpleInterpolateLSF(syntdenum, weightdenum,
- lsf, lsfdeq, iLBCenc_inst->lsfold,
- iLBCenc_inst->lsfdeqold, LPC_FILTERORDER, iLBCenc_inst);
-}
-
-
-
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ LPCencode.c
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #include <string.h>
+
+ #include "iLBC_define.h"
+ #include "helpfun.h"
+ #include "lsf.h"
+ #include "constants.h"
+
+
+
+
+
+ /*----------------------------------------------------------------*
+ * lpc analysis (subrutine to LPCencode)
+ *---------------------------------------------------------------*/
+
+ void SimpleAnalysis(
+ float *lsf, /* (o) lsf coefficients */
+ float *data, /* (i) new data vector */
+ iLBC_Enc_Inst_t *iLBCenc_inst
+ /* (i/o) the encoder state structure */
+ ){
+ int k, is;
+ float temp[BLOCKL_MAX], lp[LPC_FILTERORDER + 1];
+ float lp2[LPC_FILTERORDER + 1];
+ float r[LPC_FILTERORDER + 1];
+
+ is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
+ memcpy(iLBCenc_inst->lpc_buffer+is,data,
+ iLBCenc_inst->blockl*sizeof(float));
+
+ /* No lookahead, last window is asymmetric */
+
+ for (k = 0; k < iLBCenc_inst->lpc_n; k++) {
+
+ is = LPC_LOOKBACK;
+
+ if (k < (iLBCenc_inst->lpc_n - 1)) {
+ window(temp, lpc_winTbl,
+ iLBCenc_inst->lpc_buffer, BLOCKL_MAX);
+ } else {
+ window(temp, lpc_asymwinTbl,
+ iLBCenc_inst->lpc_buffer + is, BLOCKL_MAX);
+ }
+
+ autocorr(r, temp, BLOCKL_MAX, LPC_FILTERORDER);
+ window(r, r, lpc_lagwinTbl, LPC_FILTERORDER + 1);
+
+ levdurb(lp, temp, r, LPC_FILTERORDER);
+ bwexpand(lp2, lp, LPC_CHIRP_SYNTDENUM, LPC_FILTERORDER+1);
+
+ a2lsf(lsf + k*LPC_FILTERORDER, lp2);
+ }
+ is=LPC_LOOKBACK+BLOCKL_MAX-iLBCenc_inst->blockl;
+ memmove(iLBCenc_inst->lpc_buffer,
+ iLBCenc_inst->lpc_buffer+LPC_LOOKBACK+BLOCKL_MAX-is,
+ is*sizeof(float));
+ }
+
+ /*----------------------------------------------------------------*
+
+
+
+
+
+ * lsf interpolator and conversion from lsf to a coefficients
+ * (subrutine to SimpleInterpolateLSF)
+ *---------------------------------------------------------------*/
+
+ void LSFinterpolate2a_enc(
+ float *a, /* (o) lpc coefficients */
+ float *lsf1,/* (i) first set of lsf coefficients */
+ float *lsf2,/* (i) second set of lsf coefficients */
+ float coef, /* (i) weighting coefficient to use between
+ lsf1 and lsf2 */
+ long length /* (i) length of coefficient vectors */
+ ){
+ float lsftmp[LPC_FILTERORDER];
+
+ interpolate(lsftmp, lsf1, lsf2, coef, length);
+ lsf2a(a, lsftmp);
+ }
+
+ /*----------------------------------------------------------------*
+ * lsf interpolator (subrutine to LPCencode)
+ *---------------------------------------------------------------*/
+
+ void SimpleInterpolateLSF(
+ float *syntdenum, /* (o) the synthesis filter denominator
+ resulting from the quantized
+ interpolated lsf */
+ float *weightdenum, /* (o) the weighting filter denominator
+ resulting from the unquantized
+ interpolated lsf */
+ float *lsf, /* (i) the unquantized lsf coefficients */
+ float *lsfdeq, /* (i) the dequantized lsf coefficients */
+ float *lsfold, /* (i) the unquantized lsf coefficients of
+ the previous signal frame */
+ float *lsfdeqold, /* (i) the dequantized lsf coefficients of
+ the previous signal frame */
+ int length, /* (i) should equate LPC_FILTERORDER */
+ iLBC_Enc_Inst_t *iLBCenc_inst
+ /* (i/o) the encoder state structure */
+ ){
+ int i, pos, lp_length;
+ float lp[LPC_FILTERORDER + 1], *lsf2, *lsfdeq2;
+
+ lsf2 = lsf + length;
+ lsfdeq2 = lsfdeq + length;
+ lp_length = length + 1;
+
+ if (iLBCenc_inst->mode==30) {
+ /* sub-frame 1: Interpolation between old and first
+
+
+
+
+
+ set of lsf coefficients */
+
+ LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
+ lsf_weightTbl_30ms[0], length);
+ memcpy(syntdenum,lp,lp_length*sizeof(float));
+ LSFinterpolate2a_enc(lp, lsfold, lsf,
+ lsf_weightTbl_30ms[0], length);
+ bwexpand(weightdenum, lp, LPC_CHIRP_WEIGHTDENUM, lp_length);
+
+ /* sub-frame 2 to 6: Interpolation between first
+ and second set of lsf coefficients */
+
+ pos = lp_length;
+ for (i = 1; i < iLBCenc_inst->nsub; i++) {
+ LSFinterpolate2a_enc(lp, lsfdeq, lsfdeq2,
+ lsf_weightTbl_30ms[i], length);
+ memcpy(syntdenum + pos,lp,lp_length*sizeof(float));
+
+ LSFinterpolate2a_enc(lp, lsf, lsf2,
+ lsf_weightTbl_30ms[i], length);
+ bwexpand(weightdenum + pos, lp,
+ LPC_CHIRP_WEIGHTDENUM, lp_length);
+ pos += lp_length;
+ }
+ }
+ else {
+ pos = 0;
+ for (i = 0; i < iLBCenc_inst->nsub; i++) {
+ LSFinterpolate2a_enc(lp, lsfdeqold, lsfdeq,
+ lsf_weightTbl_20ms[i], length);
+ memcpy(syntdenum+pos,lp,lp_length*sizeof(float));
+ LSFinterpolate2a_enc(lp, lsfold, lsf,
+ lsf_weightTbl_20ms[i], length);
+ bwexpand(weightdenum+pos, lp,
+ LPC_CHIRP_WEIGHTDENUM, lp_length);
+ pos += lp_length;
+ }
+ }
+
+ /* update memory */
+
+ if (iLBCenc_inst->mode==30) {
+ memcpy(lsfold, lsf2, length*sizeof(float));
+ memcpy(lsfdeqold, lsfdeq2, length*sizeof(float));
+ }
+ else {
+ memcpy(lsfold, lsf, length*sizeof(float));
+ memcpy(lsfdeqold, lsfdeq, length*sizeof(float));
+
+
+
+
+
+ }
+ }
+
[... 13169 lines stripped ...]
More information about the asterisk-commits
mailing list