[asterisk-commits] mjordan: branch 1.8 r351450 - in /branches/1.8: codecs/ codecs/ilbc/ contrib/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 18 14:54:43 CST 2012
Author: mjordan
Date: Wed Jan 18 14:54:37 2012
New Revision: 351450
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=351450
Log:
Include iLBC source code for distribution with Asterisk
This patch includes the iLBC source code for distribution with Asterisk.
Clarification regarding the iLBC source code was provided by Google, and
the appropriate licenses have been included in the codecs/ilbc folder.
Review: https://reviewboard.asterisk.org/r/1675
Review: https://reviewboard.asterisk.org/r/1649
(closes issue: ASTERISK-18943)
Reporter: Leif Madsen
Tested by: Matt Jordan
Added:
branches/1.8/codecs/ilbc/FrameClassify.c (with props)
branches/1.8/codecs/ilbc/FrameClassify.h (with props)
branches/1.8/codecs/ilbc/LICENSE (with props)
branches/1.8/codecs/ilbc/LICENSE_ADDENDUM (with props)
branches/1.8/codecs/ilbc/LPCdecode.c (with props)
branches/1.8/codecs/ilbc/LPCdecode.h (with props)
branches/1.8/codecs/ilbc/LPCencode.c (with props)
branches/1.8/codecs/ilbc/LPCencode.h (with props)
branches/1.8/codecs/ilbc/PATENTS (with props)
branches/1.8/codecs/ilbc/StateConstructW.c (with props)
branches/1.8/codecs/ilbc/StateConstructW.h (with props)
branches/1.8/codecs/ilbc/StateSearchW.c (with props)
branches/1.8/codecs/ilbc/StateSearchW.h (with props)
branches/1.8/codecs/ilbc/anaFilter.c (with props)
branches/1.8/codecs/ilbc/anaFilter.h (with props)
branches/1.8/codecs/ilbc/constants.c (with props)
branches/1.8/codecs/ilbc/constants.h (with props)
branches/1.8/codecs/ilbc/createCB.c (with props)
branches/1.8/codecs/ilbc/createCB.h (with props)
branches/1.8/codecs/ilbc/doCPLC.c (with props)
branches/1.8/codecs/ilbc/doCPLC.h (with props)
branches/1.8/codecs/ilbc/enhancer.c (with props)
branches/1.8/codecs/ilbc/enhancer.h (with props)
branches/1.8/codecs/ilbc/extract-cfile.awk (with props)
branches/1.8/codecs/ilbc/filter.c (with props)
branches/1.8/codecs/ilbc/filter.h (with props)
branches/1.8/codecs/ilbc/gainquant.c (with props)
branches/1.8/codecs/ilbc/gainquant.h (with props)
branches/1.8/codecs/ilbc/getCBvec.c (with props)
branches/1.8/codecs/ilbc/getCBvec.h (with props)
branches/1.8/codecs/ilbc/helpfun.c (with props)
branches/1.8/codecs/ilbc/helpfun.h (with props)
branches/1.8/codecs/ilbc/hpInput.c (with props)
branches/1.8/codecs/ilbc/hpInput.h (with props)
branches/1.8/codecs/ilbc/hpOutput.c (with props)
branches/1.8/codecs/ilbc/hpOutput.h (with props)
branches/1.8/codecs/ilbc/iCBConstruct.c (with props)
branches/1.8/codecs/ilbc/iCBConstruct.h (with props)
branches/1.8/codecs/ilbc/iCBSearch.c (with props)
branches/1.8/codecs/ilbc/iCBSearch.h (with props)
branches/1.8/codecs/ilbc/iLBC_decode.c (with props)
branches/1.8/codecs/ilbc/iLBC_decode.h (with props)
branches/1.8/codecs/ilbc/iLBC_define.h (with props)
branches/1.8/codecs/ilbc/iLBC_encode.c (with props)
branches/1.8/codecs/ilbc/iLBC_encode.h (with props)
branches/1.8/codecs/ilbc/iLBC_test.c (with props)
branches/1.8/codecs/ilbc/lsf.c (with props)
branches/1.8/codecs/ilbc/lsf.h (with props)
branches/1.8/codecs/ilbc/packing.c (with props)
branches/1.8/codecs/ilbc/packing.h (with props)
branches/1.8/codecs/ilbc/rfc3951.txt (with props)
branches/1.8/codecs/ilbc/syntFilter.c (with props)
branches/1.8/codecs/ilbc/syntFilter.h (with props)
Modified:
branches/1.8/codecs/codec_ilbc.c
branches/1.8/codecs/ilbc/Makefile
branches/1.8/contrib/scripts/get_ilbc_source.sh
Modified: branches/1.8/codecs/codec_ilbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/codec_ilbc.c?view=diff&rev=351450&r1=351449&r2=351450
==============================================================================
--- branches/1.8/codecs/codec_ilbc.c (original)
+++ branches/1.8/codecs/codec_ilbc.c Wed Jan 18 14:54:37 2012
@@ -26,7 +26,6 @@
*/
/*** MODULEINFO
- <defaultenabled>no</defaultenabled>
<support_level>core</support_level>
***/
Added: branches/1.8/codecs/ilbc/FrameClassify.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/FrameClassify.c?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/FrameClassify.c (added)
+++ branches/1.8/codecs/ilbc/FrameClassify.c Wed Jan 18 14:54:37 2012
@@ -1,0 +1,114 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ FrameClassify.c
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #include "iLBC_define.h"
+
+ /*---------------------------------------------------------------*
+ * 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 */
+
+ memset(fssqEn, 0, NSUB_MAX*sizeof(float));
+ memset(bssqEn, 0, NSUB_MAX*sizeof(float));
+
+ /* 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++) {
+
+
+
+
+
+ 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;
+ }
+
Propchange: branches/1.8/codecs/ilbc/FrameClassify.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/FrameClassify.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/FrameClassify.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/FrameClassify.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/FrameClassify.h?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/FrameClassify.h (added)
+++ branches/1.8/codecs/ilbc/FrameClassify.h Wed Jan 18 14:54:37 2012
@@ -1,0 +1,27 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ FrameClassify.h
+
+ 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 */
+ );
+
+
+
+
+
+ #endif
+
Propchange: branches/1.8/codecs/ilbc/FrameClassify.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/FrameClassify.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/FrameClassify.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/LICENSE
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/LICENSE?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/LICENSE (added)
+++ branches/1.8/codecs/ilbc/LICENSE Wed Jan 18 14:54:37 2012
@@ -1,0 +1,29 @@
+Copyright (c) 2011, The WebRTC project authors. All rights reserved.
+
+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 Google 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 COPYRIGHT
+HOLDER 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.
Propchange: branches/1.8/codecs/ilbc/LICENSE
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/LICENSE
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/LICENSE
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/LICENSE_ADDENDUM
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/LICENSE_ADDENDUM?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/LICENSE_ADDENDUM (added)
+++ branches/1.8/codecs/ilbc/LICENSE_ADDENDUM Wed Jan 18 14:54:37 2012
@@ -1,0 +1,55 @@
+
+INTRODUCTION
+Google Inc. acquired Global IP Solutions, Inc. (GIPS) in 2011, and GIPS is now
+a subsidiary of Google. Google Inc. and its subsidiaries and affiliates
+("Google") would like to update and clarify their position with respect to any
+patents and patent applications it may own that cover the iLBC (internet low
+bit-rate) codec technology that is the subject of IETF RFC 3951 and RFC 3952.
+This notice is provided in accordance with RFC 3979 and RFC 4879 covering IPR
+in the IETF.
+
+DECLARATION
+
+"iLBC Specification" means IETF RFC 3951 and RFC 3952.
+
+Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, transfer, and otherwise run, modify
+and propagate implementations of the iLBC Specification, where such license
+applies only to those patent claims, both currently owned by Google and
+acquired in the future, licensable by Google that must necessarily be
+infringed because of what is specifically required by the normative portions
+of the iLBC Specification. This license is offered on the condition that
+you grant a reciprocal license under the same terms as this license to all
+parties for implementations of the iLBC Specification under those patent
+claims, both currently owned by you and acquired in the future, licensable
+by you that must necessarily be infringed because of what is specifically
+required by the normative portions of the iLBC Specification. If you or
+your agent or exclusive licensee institute or order or agree to the
+institution of patent litigation against any entity (including a cross-claim
+or counterclaim in a lawsuit) alleging that any implementation of the iLBC
+Specification constitutes direct or contributory patent infringement, or
+inducement of patent infringement, then any patent rights granted to you
+under this license shall terminate as of the date such litigation is filed.
+
+In addition to the license above relating to what is required by the
+specification, the following license relating to the reference implementation
+is offered.
+
+"The iLBC reference implementation" means the c-code reference implementation
+in Appendix A of IETF RFC 3951.
+
+Google hereby grants to you a perpetual, worldwide, non-exclusive, no-charge,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, transfer, and otherwise run, modify
+and propagate the iLBC reference implementation, where such license applies
+only to those patent claims, both currently owned by Google and acquired in
+the future, licensable by Google that are necessarily infringed by the iLBC
+reference implementation. This grant does not include claims that would be
+infringed only as a consequence of further modification of the iLBC reference
+implementation. If you or your agent or exclusive licensee institute or order
+or agree to the institution of patent litigation against any entity (including
+a cross-claim or counterclaim in a lawsuit) alleging that the iLBC reference
+implementation constitutes direct or contributory patent infringement, or
+inducement of patent infringement, then any patent rights granted to you
+under this License shall terminate as of the date such litigation is filed.
Propchange: branches/1.8/codecs/ilbc/LICENSE_ADDENDUM
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/LICENSE_ADDENDUM
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/LICENSE_ADDENDUM
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/LPCdecode.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/LPCdecode.c?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/LPCdecode.c (added)
+++ branches/1.8/codecs/ilbc/LPCdecode.c Wed Jan 18 14:54:37 2012
@@ -1,0 +1,158 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ LPC_decode.c
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #include <math.h>
+ #include <string.h>
+
+ #include "helpfun.h"
+ #include "lsf.h"
+ #include "iLBC_define.h"
+ #include "constants.h"
+
+ /*---------------------------------------------------------------*
+ * 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 */
+ 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
+ *--------------------------------------------------------------*/
+
+ 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 */
+
+ if (iLBCdec_inst->mode==30)
+ memcpy(iLBCdec_inst->lsfdeqold, lsfdeq2,
+ length*sizeof(float));
+ else
+ memcpy(iLBCdec_inst->lsfdeqold, lsfdeq,
+ length*sizeof(float));
+
+ }
+
+
+
+
+
+
Propchange: branches/1.8/codecs/ilbc/LPCdecode.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/LPCdecode.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/LPCdecode.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/LPCdecode.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/LPCdecode.h?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/LPCdecode.h (added)
+++ branches/1.8/codecs/ilbc/LPCdecode.h Wed Jan 18 14:54:37 2012
@@ -1,0 +1,52 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ LPC_decode.h
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #ifndef __iLBC_LPC_DECODE_H
+ #define __iLBC_LPC_DECODE_H
+
+ 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
+
+
+
+
+
+
+
+
+
+
+
+
Propchange: branches/1.8/codecs/ilbc/LPCdecode.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/LPCdecode.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/LPCdecode.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/LPCencode.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/LPCencode.c?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/LPCencode.c (added)
+++ branches/1.8/codecs/ilbc/LPCencode.c Wed Jan 18 14:54:37 2012
@@ -1,0 +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 "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));
+
+
+
+
+
+ }
+ }
+
+ /*----------------------------------------------------------------*
+ * lsf quantizer (subrutine to LPCencode)
+ *---------------------------------------------------------------*/
+
+ 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);
+ }
+
Propchange: branches/1.8/codecs/ilbc/LPCencode.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/LPCencode.c
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/LPCencode.c
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/LPCencode.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/LPCencode.h?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/LPCencode.h (added)
+++ branches/1.8/codecs/ilbc/LPCencode.h Wed Jan 18 14:54:37 2012
@@ -1,0 +1,28 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ LPCencode.h
+
+ Copyright (C) The Internet Society (2004).
+ All Rights Reserved.
+
+ ******************************************************************/
+
+ #ifndef __iLBC_LPCENCOD_H
+ #define __iLBC_LPCENCOD_H
+
+ 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 */
+ );
+
+ #endif
+
Propchange: branches/1.8/codecs/ilbc/LPCencode.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/LPCencode.h
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/LPCencode.h
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: branches/1.8/codecs/ilbc/Makefile
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/Makefile?view=diff&rev=351450&r1=351449&r2=351450
==============================================================================
--- branches/1.8/codecs/ilbc/Makefile (original)
+++ branches/1.8/codecs/ilbc/Makefile Wed Jan 18 14:54:37 2012
@@ -1,11 +1,12 @@
LIB=libilbc.a
CFLAGS+=-fPIC
-OBJS=anaFilter.o iCBSearch.o packing.o \
- constants.o gainquant.o iLBC_decode.o StateConstructW.o \
- createCB.o getCBvec.o iLBC_encode.o StateSearchW.o doCPLC.o \
- helpfun.o syntFilter.o enhancer.o hpInput.o LPCdecode.o \
- filter.o hpOutput.o LPCencode.o FrameClassify.o iCBConstruct.o lsf.o
+OBJS=anaFilter.o constants.o createCB.o \
+ doCPLC.o enhancer.o filter.o FrameClassify.o \
+ gainquant.o getCBvec.o helpfun.o hpInput.o hpOutput.o \
+ iCBConstruct.o iCBSearch.o iLBC_decode.o iLBC_encode.o iLBC_test.o \
+ LPCdecode.o LPCencode.o lsf.o packing.o StateConstructW.o StateSearchW.o \
+ syntFilter.o \
include $(ASTTOPDIR)/Makefile.rules
Added: branches/1.8/codecs/ilbc/PATENTS
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/PATENTS?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/PATENTS (added)
+++ branches/1.8/codecs/ilbc/PATENTS Wed Jan 18 14:54:37 2012
@@ -1,0 +1,24 @@
+Additional IP Rights Grant (Patents)
+
+"This implementation" means the copyrightable works distributed by
+Google as part of the WebRTC code package.
+
+Google hereby grants to you a perpetual, worldwide, non-exclusive,
+no-charge, irrevocable (except as stated in this section) patent
+license to make, have made, use, offer to sell, sell, import,
+transfer, and otherwise run, modify and propagate the contents of this
+implementation of the WebRTC code package, where such license applies
+only to those patent claims, both currently owned by Google and
+acquired in the future, licensable by Google that are necessarily
+infringed by this implementation of the WebRTC code package. This
+grant does not include claims that would be infringed only as a
+consequence of further modification of this implementation. If you or
+your agent or exclusive licensee institute or order or agree to the
+institution of patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that this
+implementation of the WebRTC code package or any code incorporated
+within this implementation of the WebRTC code package constitutes
+direct or contributory patent infringement, or inducement of patent
+infringement, then any patent rights granted to you under this License
+for this implementation of the WebRTC code package shall terminate as
+of the date such litigation is filed.
Propchange: branches/1.8/codecs/ilbc/PATENTS
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: branches/1.8/codecs/ilbc/PATENTS
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: branches/1.8/codecs/ilbc/PATENTS
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: branches/1.8/codecs/ilbc/StateConstructW.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/codecs/ilbc/StateConstructW.c?view=auto&rev=351450
==============================================================================
--- branches/1.8/codecs/ilbc/StateConstructW.c (added)
+++ branches/1.8/codecs/ilbc/StateConstructW.c Wed Jan 18 14:54:37 2012
@@ -1,0 +1,86 @@
+
+ /******************************************************************
+
+ iLBC Speech Coder ANSI-C Source Code
+
+ StateConstructW.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"
+
+ /*----------------------------------------------------------------*
+ * decoding of the start state
[... 18770 lines stripped ...]
More information about the asterisk-commits
mailing list