From 0652b56fe1b20f4dd6c5b9d1b8ec5783eae053ef Mon Sep 17 00:00:00 2001
From: Brian West <brian@freeswitch.org>
Date: Sat, 9 Feb 2008 22:36:00 +0000
Subject: [PATCH] bring this in sync with latest voipcodec release... need to
 update mod_voipcodecs.c to new lpc10 changes

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7572 d0543943-73ff-0310-b7d9-9358b9ac24b2
---
 libs/voipcodecs/src/g711.c                    |  7 ++--
 libs/voipcodecs/src/g722_decode.c             |  7 ++--
 libs/voipcodecs/src/g722_encode.c             |  7 ++--
 libs/voipcodecs/src/g726.c                    |  7 ++--
 libs/voipcodecs/src/gsm0610_decode.c          |  7 ++--
 libs/voipcodecs/src/gsm0610_encode.c          |  7 ++--
 libs/voipcodecs/src/gsm0610_long_term.c       |  7 ++--
 libs/voipcodecs/src/gsm0610_lpc.c             |  7 ++--
 libs/voipcodecs/src/gsm0610_preprocess.c      |  7 ++--
 libs/voipcodecs/src/gsm0610_rpe.c             |  7 ++--
 libs/voipcodecs/src/gsm0610_short_term.c      |  7 ++--
 libs/voipcodecs/src/ima_adpcm.c               |  5 +--
 libs/voipcodecs/src/lpc10_analyse.c           | 35 ++++++++++---------
 libs/voipcodecs/src/lpc10_decode.c            | 20 ++++++-----
 libs/voipcodecs/src/lpc10_encode.c            | 14 ++++----
 libs/voipcodecs/src/lpc10_placev.c            |  7 ++--
 libs/voipcodecs/src/lpc10_voicing.c           | 33 ++++++++---------
 libs/voipcodecs/src/oki_adpcm.c               |  7 ++--
 .../src/voipcodecs/bit_operations.h           |  2 +-
 libs/voipcodecs/src/voipcodecs/bitstream.h    |  2 +-
 libs/voipcodecs/src/voipcodecs/dc_restore.h   |  4 +--
 libs/voipcodecs/src/voipcodecs/g711.h         |  9 ++---
 libs/voipcodecs/src/voipcodecs/g722.h         |  9 ++---
 libs/voipcodecs/src/voipcodecs/g726.h         | 35 +++----------------
 libs/voipcodecs/src/voipcodecs/gsm0610.h      |  9 ++---
 libs/voipcodecs/src/voipcodecs/ima_adpcm.h    |  2 +-
 libs/voipcodecs/src/voipcodecs/lpc10.h        | 19 +++++-----
 libs/voipcodecs/src/voipcodecs/oki_adpcm.h    | 12 +++----
 libs/voipcodecs/src/voipcodecs/telephony.h    |  2 +-
 libs/voipcodecs/src/voipcodecs/vector_int.h   |  2 +-
 libs/voipcodecs/src/voipcodecs/version.h      |  2 +-
 libs/voipcodecs/src/voipcodecs/version.h.in   |  2 +-
 32 files changed, 155 insertions(+), 154 deletions(-)

diff --git a/libs/voipcodecs/src/g711.c b/libs/voipcodecs/src/g711.c
index 6568bd1b4b..bc63f67264 100644
--- a/libs/voipcodecs/src/g711.c
+++ b/libs/voipcodecs/src/g711.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser Lesser GNU General Public License version 2.1.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g711.c,v 1.4 2006/11/19 14:07:24 steveu Exp $
+ * $Id: g711.c,v 1.6 2008/02/09 15:32:56 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/g722_decode.c b/libs/voipcodecs/src/g722_decode.c
index 8b52b84342..a173f892d0 100644
--- a/libs/voipcodecs/src/g722_decode.c
+++ b/libs/voipcodecs/src/g722_decode.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser Lesser GNU General Public License version 2.1.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,7 +29,7 @@
  * Computer Science, Speech Group
  * Chengxiang Lu and Alex Hauptmann
  *
- * $Id: g722_decode.c,v 1.19 2007/03/14 11:51:01 steveu Exp $
+ * $Id: g722_decode.c,v 1.20 2008/02/09 15:32:56 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/g722_encode.c b/libs/voipcodecs/src/g722_encode.c
index 3612b7d50c..e90a419eac 100644
--- a/libs/voipcodecs/src/g722_encode.c
+++ b/libs/voipcodecs/src/g722_encode.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser Lesser GNU General Public License version 2.1.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,7 +29,7 @@
  * Computer Science, Speech Group
  * Chengxiang Lu and Alex Hauptmann
  *
- * $Id: g722_encode.c,v 1.17 2007/03/14 11:51:01 steveu Exp $
+ * $Id: g722_encode.c,v 1.18 2008/02/09 15:32:56 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/g726.c b/libs/voipcodecs/src/g726.c
index e7172219ad..b63c945ff9 100644
--- a/libs/voipcodecs/src/g726.c
+++ b/libs/voipcodecs/src/g726.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -48,7 +49,7 @@
  * 2550 Garcia Avenue
  * Mountain View, California  94043
  *
- * $Id: g726.c,v 1.17 2006/11/19 14:07:24 steveu Exp $
+ * $Id: g726.c,v 1.18 2008/02/09 15:32:56 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_decode.c b/libs/voipcodecs/src/gsm0610_decode.c
index a4d26371af..ce852dc9ec 100644
--- a/libs/voipcodecs/src/gsm0610_decode.c
+++ b/libs/voipcodecs/src/gsm0610_decode.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_decode.c,v 1.14 2007/08/21 14:25:54 steveu Exp $
+ * $Id: gsm0610_decode.c,v 1.15 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_encode.c b/libs/voipcodecs/src/gsm0610_encode.c
index b0ce3004b8..f6209fb202 100644
--- a/libs/voipcodecs/src/gsm0610_encode.c
+++ b/libs/voipcodecs/src/gsm0610_encode.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_encode.c,v 1.17 2007/11/26 13:28:59 steveu Exp $
+ * $Id: gsm0610_encode.c,v 1.18 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_long_term.c b/libs/voipcodecs/src/gsm0610_long_term.c
index f8bc8902be..ade57f6b56 100644
--- a/libs/voipcodecs/src/gsm0610_long_term.c
+++ b/libs/voipcodecs/src/gsm0610_long_term.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_long_term.c,v 1.10 2007/08/20 15:22:22 steveu Exp $
+ * $Id: gsm0610_long_term.c,v 1.11 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_lpc.c b/libs/voipcodecs/src/gsm0610_lpc.c
index c53e64c7e4..5873908ec7 100644
--- a/libs/voipcodecs/src/gsm0610_lpc.c
+++ b/libs/voipcodecs/src/gsm0610_lpc.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_lpc.c,v 1.15 2007/08/20 15:22:22 steveu Exp $
+ * $Id: gsm0610_lpc.c,v 1.16 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_preprocess.c b/libs/voipcodecs/src/gsm0610_preprocess.c
index cef911a5cc..c237d46479 100644
--- a/libs/voipcodecs/src/gsm0610_preprocess.c
+++ b/libs/voipcodecs/src/gsm0610_preprocess.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_preprocess.c,v 1.8 2007/08/20 15:22:22 steveu Exp $
+ * $Id: gsm0610_preprocess.c,v 1.9 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_rpe.c b/libs/voipcodecs/src/gsm0610_rpe.c
index 2e03fd9098..f0f09ca06f 100644
--- a/libs/voipcodecs/src/gsm0610_rpe.c
+++ b/libs/voipcodecs/src/gsm0610_rpe.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_rpe.c,v 1.14 2007/08/20 15:22:22 steveu Exp $
+ * $Id: gsm0610_rpe.c,v 1.15 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/gsm0610_short_term.c b/libs/voipcodecs/src/gsm0610_short_term.c
index fb0cbab65c..8b96865b6c 100644
--- a/libs/voipcodecs/src/gsm0610_short_term.c
+++ b/libs/voipcodecs/src/gsm0610_short_term.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -25,7 +26,7 @@
  * This code is based on the widely used GSM 06.10 code available from
  * http://kbs.cs.tu-berlin.de/~jutta/toast.html
  *
- * $Id: gsm0610_short_term.c,v 1.10 2007/08/20 15:22:22 steveu Exp $
+ * $Id: gsm0610_short_term.c,v 1.11 2008/02/09 15:31:36 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/ima_adpcm.c b/libs/voipcodecs/src/ima_adpcm.c
index d721cd10e4..6612bb3fc2 100644
--- a/libs/voipcodecs/src/ima_adpcm.c
+++ b/libs/voipcodecs/src/ima_adpcm.c
@@ -11,8 +11,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
diff --git a/libs/voipcodecs/src/lpc10_analyse.c b/libs/voipcodecs/src/lpc10_analyse.c
index b88eb06ccb..8be5b52295 100644
--- a/libs/voipcodecs/src/lpc10_analyse.c
+++ b/libs/voipcodecs/src/lpc10_analyse.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +27,7 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_analyse.c,v 1.13 2007/01/03 14:15:35 steveu Exp $
+ * $Id: lpc10_analyse.c,v 1.15 2008/02/09 15:31:36 steveu Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -78,13 +79,13 @@ static void remove_dc_bias(float speech[], int len, float sigout[])
 /*- End of function --------------------------------------------------------*/
 
 static void eval_amdf(float speech[],
-                       int32_t lpita,
-                       const int32_t tau[], 
-                       int32_t ltau,
-                       int32_t maxlag,
-                       float amdf[],
-                       int32_t *minptr,
-                       int32_t *maxptr)
+                      int32_t lpita,
+                      const int32_t tau[], 
+                      int32_t ltau,
+                      int32_t maxlag,
+                      float amdf[],
+                      int32_t *minptr,
+                      int32_t *maxptr)
 {
     float sum;
     int i;
@@ -307,13 +308,13 @@ static void dynamic_pitch_tracking(lpc10_encode_state_t *s,
 
 /* Detection of onsets in (or slightly preceding) the futuremost frame of speech. */
 static void onset(lpc10_encode_state_t *s,
-                   float *pebuf,
-                   int32_t osbuf[],
-                   int32_t *osptr,
-                   int32_t oslen,
-                   int32_t sbufl,
-                   int32_t sbufh,
-                   int32_t lframe)
+                  float *pebuf,
+                  int32_t osbuf[],
+                  int32_t *osptr,
+                  int32_t oslen,
+                  int32_t sbufl,
+                  int32_t sbufh,
+                  int32_t lframe)
 {
     int32_t i;
     float r1;
diff --git a/libs/voipcodecs/src/lpc10_decode.c b/libs/voipcodecs/src/lpc10_decode.c
index e58ab02047..107542a68a 100644
--- a/libs/voipcodecs/src/lpc10_decode.c
+++ b/libs/voipcodecs/src/lpc10_decode.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +27,7 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_decode.c,v 1.16 2007/11/26 13:28:59 steveu Exp $
+ * $Id: lpc10_decode.c,v 1.18 2008/02/09 15:31:36 steveu Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -1079,7 +1080,7 @@ int lpc10_decode_release(lpc10_decode_state_t *s)
 }
 /*- End of function --------------------------------------------------------*/
 
-int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int quant)
+int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len)
 {
     int voice[2];
     int32_t pitch;
@@ -1089,18 +1090,21 @@ int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], i
     float rms;
     int i;
     int j;
+    int base;
 
-    /* Decode 54 bits to LPC10_SAMPLES_PER_FRAME speech samples. */
-    for (i = 0;  i < quant;  i++)
+    /* Decode 54 bits in 7 bytes to LPC10_SAMPLES_PER_FRAME speech samples. */
+    len /= 7;
+    for (i = 0;  i < len;  i++)
     {
         lpc10_unpack(&frame, &code[i*7]);
         decode(s, &frame, voice, &pitch, &rms, rc);
         synths(s, voice, &pitch, &rms, rc, speech);
+        base = i*LPC10_SAMPLES_PER_FRAME;
         for (j = 0;  j < LPC10_SAMPLES_PER_FRAME;  j++)
-            amp[i*LPC10_SAMPLES_PER_FRAME + j] = (int16_t) rintf(32768.0f*speech[j]);
+            amp[base + j] = (int16_t) rintf(32768.0f*speech[j]);
     }
 
-    return quant*LPC10_SAMPLES_PER_FRAME;
+    return len*LPC10_SAMPLES_PER_FRAME;
 }
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/
diff --git a/libs/voipcodecs/src/lpc10_encode.c b/libs/voipcodecs/src/lpc10_encode.c
index 83a15eb428..c12708987f 100644
--- a/libs/voipcodecs/src/lpc10_encode.c
+++ b/libs/voipcodecs/src/lpc10_encode.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +27,7 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_encode.c,v 1.17 2007/11/26 13:28:59 steveu Exp $
+ * $Id: lpc10_encode.c,v 1.19 2008/02/09 15:31:36 steveu Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -368,7 +369,7 @@ int lpc10_encode_release(lpc10_encode_state_t *s)
 }
 /*- End of function --------------------------------------------------------*/
 
-int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int quant)
+int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len)
 {
     int32_t voice[2];
     int32_t pitch;
@@ -379,7 +380,8 @@ int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], i
     int i;
     int j;
 
-    for (i = 0;  i < quant;  i++)
+    len /= LPC10_SAMPLES_PER_FRAME;
+    for (i = 0;  i < len;  i++)
     {
         for (j = 0;  j < LPC10_SAMPLES_PER_FRAME;  j++)
             speech[j] = (float) amp[i*LPC10_SAMPLES_PER_FRAME + j]/32768.0f;
@@ -388,7 +390,7 @@ int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], i
         encode(s, &frame, voice, pitch, rms, rc);
         lpc10_pack(s, &code[7*i], &frame);
     }
-    return quant*7;
+    return len*7;
 }
 /*- End of function --------------------------------------------------------*/
 /*- End of file ------------------------------------------------------------*/
diff --git a/libs/voipcodecs/src/lpc10_placev.c b/libs/voipcodecs/src/lpc10_placev.c
index e1d819ba38..ccf8653cf4 100644
--- a/libs/voipcodecs/src/lpc10_placev.c
+++ b/libs/voipcodecs/src/lpc10_placev.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +27,7 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_placev.c,v 1.12 2007/01/03 14:15:35 steveu Exp $
+ * $Id: lpc10_placev.c,v 1.13 2008/02/09 15:31:36 steveu Exp $
  */
 
 #ifdef HAVE_CONFIG_H
diff --git a/libs/voipcodecs/src/lpc10_voicing.c b/libs/voipcodecs/src/lpc10_voicing.c
index cd297c0cb1..55df585210 100644
--- a/libs/voipcodecs/src/lpc10_voicing.c
+++ b/libs/voipcodecs/src/lpc10_voicing.c
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +27,7 @@
  * implementation of the LPC-10 2400 bps Voice Coder. They do not
  * exert copyright claims on their code, and it may be freely used.
  *
- * $Id: lpc10_voicing.c,v 1.7 2006/11/30 15:41:47 steveu Exp $
+ * $Id: lpc10_voicing.c,v 1.9 2008/02/09 15:31:36 steveu Exp $
  */
 
 #ifdef HAVE_CONFIG_H
@@ -51,19 +52,19 @@
 #include "lpc10_encdecs.h"
 
 static void vparms(int32_t vwin[],
-                    float *inbuf,
-                    float *lpbuf,
-                    const int32_t buflim[],
-                    int32_t half,
-                    float *dither,
-                    int32_t *mintau,
-                    int32_t *zc, 
-                    int32_t *lbe,
-                    int32_t *fbe,
-                    float *qs,
-                    float *rc1,
-                    float *ar_b,
-                    float *ar_f)
+                   float *inbuf,
+                   float *lpbuf,
+                   const int32_t buflim[],
+                   int32_t half,
+                   float *dither,
+                   int32_t *mintau,
+                   int32_t *zc, 
+                   int32_t *lbe,
+                   int32_t *fbe,
+                   float *qs,
+                   float *rc1,
+                   float *ar_b,
+                   float *ar_f)
 {
     int32_t inbuf_offset;
     int32_t lpbuf_offset;
diff --git a/libs/voipcodecs/src/oki_adpcm.c b/libs/voipcodecs/src/oki_adpcm.c
index 1073048795..d8784ad0f2 100644
--- a/libs/voipcodecs/src/oki_adpcm.c
+++ b/libs/voipcodecs/src/oki_adpcm.c
@@ -15,8 +15,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -27,7 +28,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: oki_adpcm.c,v 1.22 2006/11/28 16:59:56 steveu Exp $
+ * $Id: oki_adpcm.c,v 1.23 2008/02/09 15:33:40 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/voipcodecs/bit_operations.h b/libs/voipcodecs/src/voipcodecs/bit_operations.h
index 9d5e928ca4..cf643680c9 100644
--- a/libs/voipcodecs/src/voipcodecs/bit_operations.h
+++ b/libs/voipcodecs/src/voipcodecs/bit_operations.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * bit_operations.h - Various bit level operations, such as bit reversal
  *
diff --git a/libs/voipcodecs/src/voipcodecs/bitstream.h b/libs/voipcodecs/src/voipcodecs/bitstream.h
index 15131fdcce..ccd9e9b87d 100644
--- a/libs/voipcodecs/src/voipcodecs/bitstream.h
+++ b/libs/voipcodecs/src/voipcodecs/bitstream.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * bitstream.h - Bitstream composition and decomposition routines.
  *
diff --git a/libs/voipcodecs/src/voipcodecs/dc_restore.h b/libs/voipcodecs/src/voipcodecs/dc_restore.h
index 64fee03456..7846f37f46 100644
--- a/libs/voipcodecs/src/voipcodecs/dc_restore.h
+++ b/libs/voipcodecs/src/voipcodecs/dc_restore.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * dc_restore.h - General telephony routines to restore the zero D.C.
  *                level to audio which has a D.C. bias.
@@ -11,7 +11,7 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
+ * it under the terms of the GNU General Public License version 2, as
  * published by the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
diff --git a/libs/voipcodecs/src/voipcodecs/g711.h b/libs/voipcodecs/src/voipcodecs/g711.h
index bf4b8e72b8..3e7ca63a44 100644
--- a/libs/voipcodecs/src/voipcodecs/g711.h
+++ b/libs/voipcodecs/src/voipcodecs/g711.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * g711.h - In line A-law and u-law conversion routines
  *
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: g711.h,v 1.8 2007/12/13 11:31:32 steveu Exp $
+ * $Id: g711.h,v 1.9 2008/02/09 15:32:26 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/voipcodecs/g722.h b/libs/voipcodecs/src/voipcodecs/g722.h
index d96d15b21d..966992fd00 100644
--- a/libs/voipcodecs/src/voipcodecs/g722.h
+++ b/libs/voipcodecs/src/voipcodecs/g722.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * g722.h - The ITU G.722 codec.
  *
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -28,7 +29,7 @@
  * Computer Science, Speech Group
  * Chengxiang Lu and Alex Hauptmann
  *
- * $Id: g722.h,v 1.16 2007/04/08 08:16:17 steveu Exp $
+ * $Id: g722.h,v 1.17 2008/02/09 15:32:26 steveu Exp $
  */
 
 
diff --git a/libs/voipcodecs/src/voipcodecs/g726.h b/libs/voipcodecs/src/voipcodecs/g726.h
index df2e0b9480..f1212e3cfb 100644
--- a/libs/voipcodecs/src/voipcodecs/g726.h
+++ b/libs/voipcodecs/src/voipcodecs/g726.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * g726.h - ITU G.726 codec.
  *
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,33 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * Based on G.721/G.723 code which is:
- *
- * This source code is a product of Sun Microsystems, Inc. and is provided
- * for unrestricted use.  Users may copy or modify this source code without
- * charge.
- *
- * SUN SOURCE CODE IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING
- * THE WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
- * Sun source code is provided with no support and without any obligation on
- * the part of Sun Microsystems, Inc. to assist in its use, correction,
- * modification or enhancement.
- *
- * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
- * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY THIS SOFTWARE
- * OR ANY PART THEREOF.
- *
- * In no event will Sun Microsystems, Inc. be liable for any lost revenue
- * or profits or other special, indirect and consequential damages, even if
- * Sun has been advised of the possibility of such damages.
- *
- * Sun Microsystems, Inc.
- * 2550 Garcia Avenue
- * Mountain View, California  94043
- *
- * $Id: g726.h,v 1.18 2007/12/13 11:31:32 steveu Exp $
+ * $Id: g726.h,v 1.19 2008/02/09 15:32:26 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/voipcodecs/gsm0610.h b/libs/voipcodecs/src/voipcodecs/gsm0610.h
index 282065adcc..83e05e89f5 100644
--- a/libs/voipcodecs/src/voipcodecs/gsm0610.h
+++ b/libs/voipcodecs/src/voipcodecs/gsm0610.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * gsm0610.h - GSM 06.10 full rate speech codec.
  *
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: gsm0610.h,v 1.13 2007/12/13 11:31:32 steveu Exp $
+ * $Id: gsm0610.h,v 1.14 2008/02/09 15:31:36 steveu Exp $
  */
 
 #if !defined(_SPANDSP_GSM0610_H_)
diff --git a/libs/voipcodecs/src/voipcodecs/ima_adpcm.h b/libs/voipcodecs/src/voipcodecs/ima_adpcm.h
index 573f5066ca..e3976b1ad5 100644
--- a/libs/voipcodecs/src/voipcodecs/ima_adpcm.h
+++ b/libs/voipcodecs/src/voipcodecs/ima_adpcm.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * imaadpcm.c - Conversion routines between linear 16 bit PCM data and
  *		        IMA/DVI/Intel ADPCM format.
diff --git a/libs/voipcodecs/src/voipcodecs/lpc10.h b/libs/voipcodecs/src/voipcodecs/lpc10.h
index 192d63dcac..24b4c14a7c 100644
--- a/libs/voipcodecs/src/voipcodecs/lpc10.h
+++ b/libs/voipcodecs/src/voipcodecs/lpc10.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * lpc10.h - LPC10 low bit rate speech codec.
  *
@@ -10,8 +10,9 @@
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,7 +23,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: lpc10.h,v 1.13 2007/04/08 08:16:18 steveu Exp $
+ * $Id: lpc10.h,v 1.15 2008/02/09 15:31:36 steveu Exp $
  */
 
 #if !defined(_SPANDSP_LPC10_H_)
@@ -184,9 +185,10 @@ int lpc10_encode_release(lpc10_encode_state_t *s);
     \param s The LPC10e context.
     \param ima_data The LPC10e data produced.
     \param amp The audio sample buffer.
-    \param len The number of samples in the buffer.
+    \param len The number of samples in the buffer. This must be a multiple of 180, as
+           this is the number of samples on a frame.
     \return The number of bytes of LPC10e data produced. */
-int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int quant);
+int lpc10_encode(lpc10_encode_state_t *s, uint8_t code[], const int16_t amp[], int len);
 
 /*! Initialise an LPC10e decode context.
     \param s The LPC10e context
@@ -200,9 +202,10 @@ int lpc10_decode_release(lpc10_decode_state_t *s);
     \param s The LPC10e context.
     \param amp The audio sample buffer.
     \param code The LPC10e data.
-    \param quant The number of frames of LPC10e data to be decoded.
+    \param len The number of bytes of LPC10e data to be decoded. This must be a multiple of 7,
+           as each frame is packed into 7 bytes.
     \return The number of samples returned. */
-int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int quant);
+int lpc10_decode(lpc10_decode_state_t *s, int16_t amp[], const uint8_t code[], int len);
 
 
 #if defined(__cplusplus)
diff --git a/libs/voipcodecs/src/voipcodecs/oki_adpcm.h b/libs/voipcodecs/src/voipcodecs/oki_adpcm.h
index d050a995ee..9c68720be3 100644
--- a/libs/voipcodecs/src/voipcodecs/oki_adpcm.h
+++ b/libs/voipcodecs/src/voipcodecs/oki_adpcm.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * oki_adpcm.h - Conversion routines between linear 16 bit PCM data and
  *		         OKI (Dialogic) ADPCM format.
@@ -8,14 +8,12 @@
  *
  * Copyright (C) 2001 Steve Underwood
  *
- * Based on a bit from here, a bit from there, eye of toad,
- * ear of bat, etc - plus, of course, my own 2 cents.
- *
  * All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Lesser GNU General Public License version 2.1, as
- * published by the Free Software Foundation.
+ * it under the terms of the GNU General Public License version 2, or
+ * the Lesser GNU General Public License version 2.1, as published by
+ * the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -26,7 +24,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: oki_adpcm.h,v 1.17 2007/12/13 11:31:33 steveu Exp $
+ * $Id: oki_adpcm.h,v 1.18 2008/02/09 15:33:40 steveu Exp $
  */
 
 /*! \file */
diff --git a/libs/voipcodecs/src/voipcodecs/telephony.h b/libs/voipcodecs/src/voipcodecs/telephony.h
index e9f079a27b..b33786ef09 100644
--- a/libs/voipcodecs/src/voipcodecs/telephony.h
+++ b/libs/voipcodecs/src/voipcodecs/telephony.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * telephony.h - some very basic telephony definitions
  *
diff --git a/libs/voipcodecs/src/voipcodecs/vector_int.h b/libs/voipcodecs/src/voipcodecs/vector_int.h
index 92591ef096..9a162a7309 100644
--- a/libs/voipcodecs/src/voipcodecs/vector_int.h
+++ b/libs/voipcodecs/src/voipcodecs/vector_int.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * vector_int.h
  *
diff --git a/libs/voipcodecs/src/voipcodecs/version.h b/libs/voipcodecs/src/voipcodecs/version.h
index 9991ad2268..b7b2992936 100644
--- a/libs/voipcodecs/src/voipcodecs/version.h
+++ b/libs/voipcodecs/src/voipcodecs/version.h
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * version.h - A tag file, so the exact installed revision can be assertained.
  *
diff --git a/libs/voipcodecs/src/voipcodecs/version.h.in b/libs/voipcodecs/src/voipcodecs/version.h.in
index 9991ad2268..b7b2992936 100644
--- a/libs/voipcodecs/src/voipcodecs/version.h.in
+++ b/libs/voipcodecs/src/voipcodecs/version.h.in
@@ -1,5 +1,5 @@
 /*
- * SpanDSP - a series of DSP components for telephony
+ * VoIPcodecs - a series of DSP components for telephony
  *
  * version.h - A tag file, so the exact installed revision can be assertained.
  *