aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2014-07-04 17:30:39 +0300
committerDamian Minkov <damencho@jitsi.org>2014-07-04 17:30:39 +0300
commitde4cbe96b3f10c50b603791e2785f46f48569a2e (patch)
treedfcb645dd01f4877c0302cb6251efff2fc48557d /src
parent2e897e13e296de6057da8214fde54cb7eae47a59 (diff)
downloadjitsi-de4cbe96b3f10c50b603791e2785f46f48569a2e.zip
jitsi-de4cbe96b3f10c50b603791e2785f46f48569a2e.tar.gz
jitsi-de4cbe96b3f10c50b603791e2785f46f48569a2e.tar.bz2
Moves speex and g722 in libjitsi using package org.jitsi. Updates binaries.
Diffstat (limited to 'src')
-rw-r--r--src/native/build.xml190
-rw-r--r--src/native/g722/Makefile18
-rw-r--r--src/native/g722/g722.c631
-rw-r--r--src/native/g722/g722.h130
-rw-r--r--src/native/g722/g722_private.h111
-rw-r--r--src/native/g722/mmx_sse_decs.h61
-rw-r--r--src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.c60
-rw-r--r--src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.h37
-rw-r--r--src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.c58
-rw-r--r--src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.h37
-rw-r--r--src/native/g722/saturated.h159
-rw-r--r--src/native/g722/telephony.h91
-rw-r--r--src/native/g722/vector_int.c628
-rw-r--r--src/native/g722/vector_int.h180
-rw-r--r--src/native/speex/Makefile16
-rw-r--r--src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.c292
-rw-r--r--src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.h189
17 files changed, 0 insertions, 2888 deletions
diff --git a/src/native/build.xml b/src/native/build.xml
index fbed1ff..1ae9bf2 100644
--- a/src/native/build.xml
+++ b/src/native/build.xml
@@ -96,7 +96,6 @@
<echo message="x264 library: ${x264}" />
<echo message="lame library: ${lame}" />
<echo message="portaudio library: ${portaudio}" />
- <echo message="speex library: ${speex}" />
<echo message="Install directory ${native_install_dir}" />
<echo message="arch: ${arch}" />
-->
@@ -221,151 +220,6 @@
</cc>
</target>
- <!-- compile jspeex library -->
- <target name="speex" description="Build jspeex shared library" depends="init-native">
-
- <condition property="is.speex.set" value="true">
- <and>
- <isset property="speex"/>
- <not>
- <isset property="speex.dynamic"/>
- </not>
- </and>
- </condition>
- <condition property="is.speex.set" value="true">
- <and>
- <isset property="speex.dynamic"/>
- <not>
- <isset property="speex"/>
- </not>
- </and>
- </condition>
-
- <condition property="is.speex.dynamic.set" value="true">
- <and>
- <isset property="speex.dynamic"/>
- <isset property="is.running.linux"/>
- </and>
- </condition>
-
- <fail message="speex repository not set!" unless="is.speex.set" />
-
- <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnspeex" objdir="${obj}">
- <!-- common compiler flags -->
- <compilerarg value="-std=c99" />
- <compilerarg value="-Wall" />
- <compilerarg value="-O2" />
- <compilerarg value="-I${speex}/include" />
- <compilerarg value="-D_JNI_IMPLEMENTATION_" />
-
- <linkerarg value="-L${speex}/libspeex/.libs" />
-
- <!-- Linux specific flags -->
- <compilerarg value="-m32" if="cross_32" unless="is.running.macos" />
- <compilerarg value="-m64" if="cross_64" unless="is.running.macos" />
- <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" />
- <compilerarg value="-I${system.JAVA_HOME}/include/linux" if="is.running.linux" />
-
- <linkerarg value="-m32" if="cross_32" unless="is.running.macos" />
- <linkerarg value="-m64" if="cross_64" unless="is.running.macos" />
-
- <!-- static libraries MUST be at the end otherwise
- they will not be added to shared library
- -->
- <linkerarg value="-Wl,-z,relro" if="is.running.debian"/>
- <linkerarg value="-Wl,-Bstatic" location="end" if="is.running.linux" unless="speex.dynamic"/>
- <linkerarg value="-lspeex" location="end" if="is.running.linux" unless="speex.dynamic"/>
- <linkerarg value="-lspeexdsp" location="end" if="is.running.linux" unless="speex.dynamic"/>
- <linkerarg value="-Wl,-Bdynamic" location="end" if="is.running.linux" />
- <linkerarg value="-lspeex" location="end" if="is.speex.dynamic.set"/>
- <linkerarg value="-lspeexdsp" location="end" if="is.speex.dynamic.set"/>
- <linkerarg value="-lm" location="end" if="is.running.linux" />
-
- <!-- Mac OS X specific flags -->
- <compilerarg value="-mmacosx-version-min=10.5" if="is.running.macos"/>
- <compilerarg value="-arch" if="is.running.macos" />
- <compilerarg value="x86_64" if="is.running.macos" />
- <compilerarg value="-arch" if="is.running.macos" />
- <compilerarg value="i386" if="is.running.macos" />
- <compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" />
-
- <linkerarg value="-o" location="end" if="is.running.macos" />
- <linkerarg value="libjspeex.jnilib" location="end" if="is.running.macos" />
- <linkerarg value="-dynamiclib" if="is.running.macos" />
- <linkerarg value="-arch" if="is.running.macos" />
- <linkerarg value="x86_64" if="is.running.macos" />
- <linkerarg value="-arch" if="is.running.macos" />
- <linkerarg value="i386" if="is.running.macos" />
- <linkerarg value="-lspeex" location="end" if="is.running.macos" />
- <linkerarg value="-lspeexdsp" location="end" if="is.running.macos" />
-
- <!-- Windows specific flags -->
- <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.windows" />
- <compilerarg value="-I${system.JAVA_HOME}/include/win32" if="is.running.windows" />
-
- <linkerarg value="-ojspeex.dll" if="is.running.windows" />
- <linkerarg value="-Wl,--kill-at" if="is.running.windows" />
- <linkerarg value="-Wl,-Bstatic" location="end" if="is.running.windows" />
- <linkerarg value="-lspeex" location="end" if="is.running.windows" />
- <linkerarg value="-lspeexdsp" location="end" if="is.running.windows" />
- <linkerarg value="-Wl,-Bdynamic" location="end" if="is.running.windows" />
- <linkerarg value="-lm" location="end" if="is.running.windows" />
-
- <fileset dir="${src}/native/speex" includes="*.c"/>
- </cc>
- </target>
-
- <!-- compile jng722 library -->
- <target name="g722" description="Build jng722 shared library" depends="init-native">
-
- <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jng722" objdir="${obj}">
- <!-- common compiler flags -->
- <compilerarg value="-std=c99" />
- <compilerarg value="-Wall" />
- <compilerarg value="-O2" />
- <compilerarg value="-D_JNI_IMPLEMENTATION_" />
-
- <!-- Linux specific flags -->
- <compilerarg value="-m32" if="cross_32" unless="is.running.macos" />
- <compilerarg value="-m64" if="cross_64" unless="is.running.macos" />
- <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.linux" />
- <compilerarg value="-I${system.JAVA_HOME}/include/linux" if="is.running.linux" />
-
- <linkerarg value="-m32" if="cross_32" unless="is.running.macos" />
- <linkerarg value="-m64" if="cross_64" unless="is.running.macos" />
- <linkerarg value="-Wl,-z,relro" if="is.running.debian"/>
-
- <!-- Mac OS X specific flags -->
- <compilerarg value="-mmacosx-version-min=10.5" if="is.running.macos"/>
- <compilerarg value="-arch" if="is.running.macos" />
- <compilerarg value="x86_64" if="is.running.macos" />
- <compilerarg value="-arch" if="is.running.macos" />
- <compilerarg value="i386" if="is.running.macos" />
- <compilerarg value="-arch" if="is.running.macos" />
- <compilerarg value="ppc" if="is.running.macos" />
- <compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" />
-
- <linkerarg value="-o" location="end" if="is.running.macos" />
- <linkerarg value="libjng722.jnilib" location="end" if="is.running.macos" />
- <linkerarg value="-dynamiclib" if="is.running.macos" />
- <linkerarg value="-arch" if="is.running.macos" />
- <linkerarg value="x86_64" if="is.running.macos" />
- <linkerarg value="-arch" if="is.running.macos" />
- <linkerarg value="i386" if="is.running.macos" />
- <linkerarg value="-arch" if="is.running.macos" />
- <linkerarg value="ppc" if="is.running.macos" />
-
- <!-- Windows specific flags -->
- <compilerarg value="-I${system.JAVA_HOME}/include" if="is.running.windows" />
- <compilerarg value="-I${system.JAVA_HOME}/include/win32" if="is.running.windows" />
-
- <linkerarg value="-ojng722.dll" if="is.running.windows" />
- <linkerarg value="-Wl,--kill-at" if="is.running.windows" />
-
- <fileset dir="${src}/native/g722" includes="*.c"/>
- </cc>
- </target>
-
<!-- compile hwaddressretriever library -->
<target name="hwaddressretriever" description="Build hwaddressretriever shared library" depends="init-native,hwaddressretriever-windows"
unless="is.running.windows">
@@ -536,42 +390,6 @@
</cc>
</target>
- <!-- compile jnquicktime library for Mac OS X (32-bit/64-bit/ppc) -->
- <target name="quicktime" description="Build jnquicktime shared library for Mac OS X" if="is.running.macos"
- depends="init-native">
- <cc outtype="shared" name="gcc" outfile="${native_install_dir}/jnquicktime" objdir="${obj}">
- <compilerarg value="-Wall" />
- <compilerarg value="-O2" />
- <compilerarg value="-arch" />
- <compilerarg value="x86_64" />
- <compilerarg value="-arch" />
- <compilerarg value="i386" />
- <compilerarg value="-arch" />
- <compilerarg value="ppc" />
- <compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" />
-
- <linkerarg value="-o" location="end" />
- <linkerarg value="libjnquicktime.jnilib" location="end" />
- <linkerarg value="-arch" />
- <linkerarg value="x86_64" />
- <linkerarg value="-arch" />
- <linkerarg value="i386" />
- <linkerarg value="-arch" />
- <linkerarg value="ppc" />
- <linkerarg value="-framework" />
- <linkerarg value="Foundation" />
- <linkerarg value="-framework" />
- <linkerarg value="QTKit" />
- <linkerarg value="-framework" />
- <linkerarg value="Quartz" />
-
- <fileset dir="${src}/native/macosx/quicktime" includes="*.c *.m"/>
- </cc>
-
- <delete dir="${obj}" failonerror="false" />
- <delete file="${native_install_dir}/history.xml" failonerror="false" />
- </target>
-
<target name="sysactivity" description="Build sysactivity"
depends="init-native">
@@ -802,8 +620,6 @@
<target name="help-native">
<echo message="Targets available:" />
<echo message="'ant screencapture' to compile screencapture shared library" />
- <echo message="'ant speex' to compile jspeex shared library" />
- <echo message="'ant g722' to compile jng722 shared library" />
<echo message="'ant hid' to compile hid shared library" />
<echo message="'ant hwaddressretriever' to compile hwaddressretriever shared library" />
<echo message="'ant galagonotification (Linux only)' to compile galagonotification shared library" />
@@ -815,12 +631,6 @@
<echo message="Options:" />
<echo message="-Darch: cross-compile for 32-bit (-Darch=32), 64-bit (-Darch=64) or ppc (-Darch=ppc, Mac OS X only) targets. Windows users have to use gcc >= 4.5." />
<echo message="" />
- <echo message="Please note that external libraries such as ffmpeg, x264, lame, portaudio and speex have to be compiled" />
- <echo message="(follow READMEs in relevant directory) before trying to compile libffmpeg and libjnportaudio" />
- <echo message="When compiling libffmpeg you have to tell ant script the directory of ffmpeg and x264 with" />
- <echo message="-Dffmpeg=/path/to/ffmpeg and -Dx264=/path/to/x264 -Dlame=/path/to/lame" />
- <echo message="When compiling libjnportaudio you have to tell ant script the directory of portaudio and speex with" />
- <echo message="-Dportaudio=/path/to/portaudio and -Dspeex=/path/to/speex" />
</target>
<!-- compile jmsoutlookaddrbook library for Windows -->
diff --git a/src/native/g722/Makefile b/src/native/g722/Makefile
deleted file mode 100644
index a0c2dc5..0000000
--- a/src/native/g722/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-JAVA_HOME?=/usr/lib/jvm/java-6-sun
-
-TARGET=../../../lib/native/linux-64/libjg722.so
-
-CC=gcc
-CPPFLAGS=-D_JNI_IMPLEMENTATION_ \
- -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
- -O2 \
- -Wall
-LDFLAGS=-shared -fPIC
-LIBS=
-
-$(TARGET): \
- g722.c \
- net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.c \
- net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.c \
- vector_int.c
- $(CC) $(CPPFLAGS) $^ $(LDFLAGS) -o $@ $(LIBS)
diff --git a/src/native/g722/g722.c b/src/native/g722/g722.c
deleted file mode 100644
index f456333..0000000
--- a/src/native/g722/g722.c
+++ /dev/null
@@ -1,631 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g722.c - The ITU G.722 codec.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2005 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Based in part on a single channel G.722 codec which is:
- *
- * Copyright (c) CMU 1993
- * Computer Science, Speech Group
- * Chengxiang Lu and Alex Hauptmann
- *
- * $Id: g722.c,v 1.10 2009/04/22 12:57:40 steveu Exp $
- */
-
-/*! \file */
-
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
-
-#include <inttypes.h>
-#include <memory.h>
-#include <stdlib.h>
-#if defined(HAVE_TGMATH_H)
-#include <tgmath.h>
-#endif
-#if defined(HAVE_MATH_H)
-#include <math.h>
-#endif
-//#include "floating_fudge.h"
-
-#include "telephony.h"
-//#include "spandsp/fast_convert.h"
-#include "saturated.h"
-#include "vector_int.h"
-#include "g722.h"
-
-#include "g722_private.h"
-
-static const int16_t qmf_coeffs_fwd[12] =
-{
- 3, -11, 12, 32, -210, 951, 3876, -805, 362, -156, 53, -11,
-};
-
-static const int16_t qmf_coeffs_rev[12] =
-{
- -11, 53, -156, 362, -805, 3876, 951, -210, 32, 12, -11, 3
-};
-
-static const int16_t qm2[4] =
-{
- -7408, -1616, 7408, 1616
-};
-
-static const int16_t qm4[16] =
-{
- 0, -20456, -12896, -8968,
- -6288, -4240, -2584, -1200,
- 20456, 12896, 8968, 6288,
- 4240, 2584, 1200, 0
-};
-
-static const int16_t qm5[32] =
-{
- -280, -280, -23352, -17560,
- -14120, -11664, -9752, -8184,
- -6864, -5712, -4696, -3784,
- -2960, -2208, -1520, -880,
- 23352, 17560, 14120, 11664,
- 9752, 8184, 6864, 5712,
- 4696, 3784, 2960, 2208,
- 1520, 880, 280, -280
-};
-
-static const int16_t qm6[64] =
-{
- -136, -136, -136, -136,
- -24808, -21904, -19008, -16704,
- -14984, -13512, -12280, -11192,
- -10232, -9360, -8576, -7856,
- -7192, -6576, -6000, -5456,
- -4944, -4464, -4008, -3576,
- -3168, -2776, -2400, -2032,
- -1688, -1360, -1040, -728,
- 24808, 21904, 19008, 16704,
- 14984, 13512, 12280, 11192,
- 10232, 9360, 8576, 7856,
- 7192, 6576, 6000, 5456,
- 4944, 4464, 4008, 3576,
- 3168, 2776, 2400, 2032,
- 1688, 1360, 1040, 728,
- 432, 136, -432, -136
-};
-
-static const int16_t q6[32] =
-{
- 0, 35, 72, 110,
- 150, 190, 233, 276,
- 323, 370, 422, 473,
- 530, 587, 650, 714,
- 786, 858, 940, 1023,
- 1121, 1219, 1339, 1458,
- 1612, 1765, 1980, 2195,
- 2557, 2919, 0, 0
-};
-
-static const int16_t ilb[32] =
-{
- 2048, 2093, 2139, 2186,
- 2233, 2282, 2332, 2383,
- 2435, 2489, 2543, 2599,
- 2656, 2714, 2774, 2834,
- 2896, 2960, 3025, 3091,
- 3158, 3228, 3298, 3371,
- 3444, 3520, 3597, 3676,
- 3756, 3838, 3922, 4008
-};
-
-static const int16_t iln[32] =
-{
- 0, 63, 62, 31, 30, 29, 28, 27,
- 26, 25, 24, 23, 22, 21, 20, 19,
- 18, 17, 16, 15, 14, 13, 12, 11,
- 10, 9, 8, 7, 6, 5, 4, 0
-};
-
-static const int16_t ilp[32] =
-{
- 0, 61, 60, 59, 58, 57, 56, 55,
- 54, 53, 52, 51, 50, 49, 48, 47,
- 46, 45, 44, 43, 42, 41, 40, 39,
- 38, 37, 36, 35, 34, 33, 32, 0
-};
-
-static const int16_t ihn[3] =
-{
- 0, 1, 0
-};
-
-static const int16_t ihp[3] =
-{
- 0, 3, 2
-};
-
-static const int16_t wl[8] =
-{
- -60, -30, 58, 172, 334, 538, 1198, 3042
-};
-
-static const int16_t rl42[16] =
-{
- 0, 7, 6, 5, 4, 3, 2, 1,
- 7, 6, 5, 4, 3, 2, 1, 0
-};
-
-static const int16_t wh[3] =
-{
- 0, -214, 798
-};
-
-static const int16_t rh2[4] =
-{
- 2, 1, 2, 1
-};
-
-static void block4(g722_band_t *s, int16_t dx)
-{
- int16_t wd1;
- int16_t wd2;
- int16_t wd3;
- int16_t sp;
- int16_t r;
- int16_t p;
- int16_t ap[2];
- int32_t wd32;
- int32_t sz;
- int i;
-
- /* RECONS */
- r = saturated_add16(s->s, dx);
- /* PARREC */
- p = saturated_add16(s->sz, dx);
-
- /* UPPOL2 */
- wd1 = saturate((int32_t) s->a[0] << 2);
- wd32 = ((p ^ s->p[0]) & 0x8000) ? wd1 : -wd1;
- if (wd32 > 32767)
- wd32 = 32767;
- wd3 = (int16_t) ((((p ^ s->p[1]) & 0x8000) ? -128 : 128)
- + (wd32 >> 7)
- + (((int32_t) s->a[1]*(int32_t) 32512) >> 15));
- if (abs(wd3) > 12288)
- wd3 = (wd3 < 0) ? -12288 : 12288;
- ap[1] = wd3;
-
- /* UPPOL1 */
- wd1 = ((p ^ s->p[0]) & 0x8000) ? -192 : 192;
- wd2 = (int16_t) (((int32_t) s->a[0]*(int32_t) 32640) >> 15);
- ap[0] = saturated_add16(wd1, wd2);
-
- wd3 = saturated_sub16(15360, ap[1]);
- if (abs(ap[0]) > wd3)
- ap[0] = (ap[0] < 0) ? -wd3 : wd3;
-
- /* FILTEP */
- wd1 = saturated_add16(r, r);
- wd1 = (int16_t) (((int32_t) ap[0]*(int32_t) wd1) >> 15);
- wd2 = saturated_add16(s->r, s->r);
- wd2 = (int16_t) (((int32_t) ap[1]*(int32_t) wd2) >> 15);
- sp = saturated_add16(wd1, wd2);
- s->r = r;
- s->a[1] = ap[1];
- s->a[0] = ap[0];
- s->p[1] = s->p[0];
- s->p[0] = p;
-
- /* UPZERO */
- /* DELAYA */
- /* FILTEZ */
- wd1 = (dx == 0) ? 0 : 128;
- s->d[0] = dx;
- sz = 0;
- for (i = 5; i >= 0; i--)
- {
- wd2 = ((s->d[i + 1] ^ dx) & 0x8000) ? -wd1 : wd1;
- wd3 = (int16_t) (((int32_t) s->b[i]*(int32_t) 32640) >> 15);
- s->b[i] = saturated_add16(wd2, wd3);
- wd3 = saturated_add16(s->d[i], s->d[i]);
- sz += ((int32_t) s->b[i]*(int32_t) wd3) >> 15;
- s->d[i + 1] = s->d[i];
- }
- s->sz = saturate(sz);
-
- /* PREDIC */
- s->s = saturated_add16(sp, s->sz);
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int rate, int options)
-{
- if (s == NULL)
- {
- if ((s = (g722_decode_state_t *) malloc(sizeof(*s))) == NULL)
- return NULL;
- }
- memset(s, 0, sizeof(*s));
- if (rate == 48000)
- s->bits_per_sample = 6;
- else if (rate == 56000)
- s->bits_per_sample = 7;
- else
- s->bits_per_sample = 8;
- if ((options & G722_SAMPLE_RATE_8000))
- s->eight_k = TRUE;
- if ((options & G722_PACKED) && s->bits_per_sample != 8)
- s->packed = TRUE;
- else
- s->packed = FALSE;
- s->band[0].det = 32;
- s->band[1].det = 8;
- return s;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s)
-{
- return 0;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s)
-{
- free(s);
- return 0;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len)
-{
- int rlow;
- int ihigh;
- int16_t dlow;
- int16_t dhigh;
- int rhigh;
- int wd1;
- int wd2;
- int wd3;
- int code;
- int outlen;
- int j;
-
- outlen = 0;
- rhigh = 0;
- for (j = 0; j < len; )
- {
- if (s->packed)
- {
- /* Unpack the code bits */
- if (s->in_bits < s->bits_per_sample)
- {
- s->in_buffer |= (g722_data[j++] << s->in_bits);
- s->in_bits += 8;
- }
- code = s->in_buffer & ((1 << s->bits_per_sample) - 1);
- s->in_buffer >>= s->bits_per_sample;
- s->in_bits -= s->bits_per_sample;
- }
- else
- {
- code = g722_data[j++];
- }
-
- switch (s->bits_per_sample)
- {
- default:
- case 8:
- wd1 = code & 0x3F;
- ihigh = (code >> 6) & 0x03;
- wd2 = qm6[wd1];
- wd1 >>= 2;
- break;
- case 7:
- wd1 = code & 0x1F;
- ihigh = (code >> 5) & 0x03;
- wd2 = qm5[wd1];
- wd1 >>= 1;
- break;
- case 6:
- wd1 = code & 0x0F;
- ihigh = (code >> 4) & 0x03;
- wd2 = qm4[wd1];
- break;
- }
- /* Block 5L, LOW BAND INVQBL */
- wd2 = ((int32_t) s->band[0].det*(int32_t) wd2) >> 15;
- /* Block 5L, RECONS */
- /* Block 6L, LIMIT */
- rlow = saturate15(s->band[0].s + wd2);
-
- /* Block 2L, INVQAL */
- wd2 = qm4[wd1];
- dlow = (int16_t) (((int32_t) s->band[0].det*(int32_t) wd2) >> 15);
-
- /* Block 3L, LOGSCL */
- wd2 = rl42[wd1];
- wd1 = ((int32_t) s->band[0].nb*(int32_t) 127) >> 7;
- wd1 += wl[wd2];
- if (wd1 < 0)
- wd1 = 0;
- else if (wd1 > 18432)
- wd1 = 18432;
- s->band[0].nb = (int16_t) wd1;
-
- /* Block 3L, SCALEL */
- wd1 = (s->band[0].nb >> 6) & 31;
- wd2 = 8 - (s->band[0].nb >> 11);
- wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
- s->band[0].det = (int16_t) (wd3 << 2);
-
- block4(&s->band[0], dlow);
-
- if (!s->eight_k)
- {
- /* Block 2H, INVQAH */
- wd2 = qm2[ihigh];
- dhigh = (int16_t) (((int32_t) s->band[1].det*(int32_t) wd2) >> 15);
- /* Block 5H, RECONS */
- /* Block 6H, LIMIT */
- rhigh = saturate15(dhigh + s->band[1].s);
-
- /* Block 2H, INVQAH */
- wd2 = rh2[ihigh];
- wd1 = ((int32_t) s->band[1].nb*(int32_t) 127) >> 7;
- wd1 += wh[wd2];
- if (wd1 < 0)
- wd1 = 0;
- else if (wd1 > 22528)
- wd1 = 22528;
- s->band[1].nb = (int16_t) wd1;
-
- /* Block 3H, SCALEH */
- wd1 = (s->band[1].nb >> 6) & 31;
- wd2 = 10 - (s->band[1].nb >> 11);
- wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
- s->band[1].det = (int16_t) (wd3 << 2);
-
- block4(&s->band[1], dhigh);
- }
-
- if (s->itu_test_mode)
- {
- amp[outlen++] = (int16_t) (rlow << 1);
- amp[outlen++] = (int16_t) (rhigh << 1);
- }
- else
- {
- if (s->eight_k)
- {
- /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */
- amp[outlen++] = (int16_t) (rlow << 1);
- }
- else
- {
- /* Apply the QMF to build the final signal */
- s->x[s->ptr] = (int16_t) (rlow + rhigh);
- s->y[s->ptr] = (int16_t) (rlow - rhigh);
- if (++s->ptr >= 12)
- s->ptr = 0;
- /* We shift by 12 to allow for the QMF filters (DC gain = 4096), less 1
- to allow for the 15 bit input to the G.722 algorithm. */
- amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr) >> 11);
- amp[outlen++] = (int16_t) (vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr) >> 11);
- }
- }
- }
- return outlen;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options)
-{
- if (s == NULL)
- {
- if ((s = (g722_encode_state_t *) malloc(sizeof(*s))) == NULL)
- return NULL;
- }
- memset(s, 0, sizeof(*s));
- if (rate == 48000)
- s->bits_per_sample = 6;
- else if (rate == 56000)
- s->bits_per_sample = 7;
- else
- s->bits_per_sample = 8;
- if ((options & G722_SAMPLE_RATE_8000))
- s->eight_k = TRUE;
- if ((options & G722_PACKED) && s->bits_per_sample != 8)
- s->packed = TRUE;
- else
- s->packed = FALSE;
- s->band[0].det = 32;
- s->band[1].det = 8;
- return s;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s)
-{
- return 0;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s)
-{
- free(s);
- return 0;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int) g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len)
-{
- int16_t dlow;
- int16_t dhigh;
- int el;
- int wd;
- int wd1;
- int ril;
- int wd2;
- int il4;
- int ih2;
- int wd3;
- int eh;
- int g722_bytes;
- int ihigh;
- int ilow;
- int code;
- /* Low and high band PCM from the QMF */
- int16_t xlow;
- int16_t xhigh;
- int32_t sumeven;
- int32_t sumodd;
- int mih;
- int i;
- int j;
-
- g722_bytes = 0;
- xhigh = 0;
- for (j = 0; j < len; )
- {
- if (s->itu_test_mode)
- {
- xlow =
- xhigh = amp[j++] >> 1;
- }
- else
- {
- if (s->eight_k)
- {
- /* We shift by 1 to allow for the 15 bit input to the G.722 algorithm. */
- xlow = amp[j++] >> 1;
- }
- else
- {
- /* Apply the transmit QMF */
- s->x[s->ptr] = amp[j++];
- s->y[s->ptr] = amp[j++];
- if (++s->ptr >= 12)
- s->ptr = 0;
- sumodd = vec_circular_dot_prodi16(s->x, qmf_coeffs_fwd, 12, s->ptr);
- sumeven = vec_circular_dot_prodi16(s->y, qmf_coeffs_rev, 12, s->ptr);
- /* We shift by 12 to allow for the QMF filters (DC gain = 4096), plus 1
- to allow for us summing two filters, plus 1 to allow for the 15 bit
- input to the G.722 algorithm. */
- xlow = (int16_t) ((sumeven + sumodd) >> 14);
- xhigh = (int16_t) ((sumeven - sumodd) >> 14);
- }
- }
- /* Block 1L, SUBTRA */
- el = saturated_sub16(xlow, s->band[0].s);
-
- /* Block 1L, QUANTL */
- wd = (el >= 0) ? el : ~el;
-
- for (i = 1; i < 30; i++)
- {
- wd1 = ((int32_t) q6[i]*(int32_t) s->band[0].det) >> 12;
- if (wd < wd1)
- break;
- }
- ilow = (el < 0) ? iln[i] : ilp[i];
-
- /* Block 2L, INVQAL */
- ril = ilow >> 2;
- wd2 = qm4[ril];
- dlow = (int16_t) (((int32_t) s->band[0].det*(int32_t) wd2) >> 15);
-
- /* Block 3L, LOGSCL */
- il4 = rl42[ril];
- wd = ((int32_t) s->band[0].nb*(int32_t) 127) >> 7;
- s->band[0].nb = (int16_t) (wd + wl[il4]);
- if (s->band[0].nb < 0)
- s->band[0].nb = 0;
- else if (s->band[0].nb > 18432)
- s->band[0].nb = 18432;
-
- /* Block 3L, SCALEL */
- wd1 = (s->band[0].nb >> 6) & 31;
- wd2 = 8 - (s->band[0].nb >> 11);
- wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
- s->band[0].det = (int16_t) (wd3 << 2);
-
- block4(&s->band[0], dlow);
-
- if (s->eight_k)
- {
- /* Just leave the high bits as zero */
- code = (0xC0 | ilow) >> (8 - s->bits_per_sample);
- }
- else
- {
- /* Block 1H, SUBTRA */
- eh = saturated_sub16(xhigh, s->band[1].s);
-
- /* Block 1H, QUANTH */
- wd = (eh >= 0) ? eh : ~eh;
- wd1 = (564*s->band[1].det) >> 12;
- mih = (wd >= wd1) ? 2 : 1;
- ihigh = (eh < 0) ? ihn[mih] : ihp[mih];
-
- /* Block 2H, INVQAH */
- wd2 = qm2[ihigh];
- dhigh = (int16_t) (((int32_t) s->band[1].det*(int32_t) wd2) >> 15);
-
- /* Block 3H, LOGSCH */
- ih2 = rh2[ihigh];
- wd = ((int32_t) s->band[1].nb*(int32_t) 127) >> 7;
- s->band[1].nb = (int16_t) (wd + wh[ih2]);
- if (s->band[1].nb < 0)
- s->band[1].nb = 0;
- else if (s->band[1].nb > 22528)
- s->band[1].nb = 22528;
-
- /* Block 3H, SCALEH */
- wd1 = (s->band[1].nb >> 6) & 31;
- wd2 = 10 - (s->band[1].nb >> 11);
- wd3 = (wd2 < 0) ? (ilb[wd1] << -wd2) : (ilb[wd1] >> wd2);
- s->band[1].det = (int16_t) (wd3 << 2);
-
- block4(&s->band[1], dhigh);
- code = ((ihigh << 6) | ilow) >> (8 - s->bits_per_sample);
- }
-
- if (s->packed)
- {
- /* Pack the code bits */
- s->out_buffer |= (code << s->out_bits);
- s->out_bits += s->bits_per_sample;
- if (s->out_bits >= 8)
- {
- g722_data[g722_bytes++] = (uint8_t) (s->out_buffer & 0xFF);
- s->out_bits -= 8;
- s->out_buffer >>= 8;
- }
- }
- else
- {
- g722_data[g722_bytes++] = (uint8_t) code;
- }
- }
- return g722_bytes;
-}
-/*- End of function --------------------------------------------------------*/
-/*- End of file ------------------------------------------------------------*/
diff --git a/src/native/g722/g722.h b/src/native/g722/g722.h
deleted file mode 100644
index 66e5d79..0000000
--- a/src/native/g722/g722.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * g722.h - The ITU G.722 codec.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2005 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Based on a single channel G.722 codec which is:
- *
- ***** Copyright (c) CMU 1993 *****
- * Computer Science, Speech Group
- * Chengxiang Lu and Alex Hauptmann
- *
- * $Id: g722.h,v 1.26 2009/04/12 09:12:10 steveu Exp $
- */
-
-
-/*! \file */
-
-#if !defined(_SPANDSP_G722_H_)
-#define _SPANDSP_G722_H_
-
-/*! \page g722_page G.722 encoding and decoding
-\section g722_page_sec_1 What does it do?
-The G.722 module is a bit exact implementation of the ITU G.722 specification for all three
-specified bit rates - 64000bps, 56000bps and 48000bps. It passes the ITU tests.
-
-To allow fast and flexible interworking with narrow band telephony, the encoder and decoder
-support an option for the linear audio to be an 8k samples/second stream. In this mode the
-codec is considerably faster, and still fully compatible with wideband terminals using G.722.
-
-\section g722_page_sec_2 How does it work?
-???.
-*/
-
-enum
-{
- G722_SAMPLE_RATE_8000 = 0x0001,
- G722_PACKED = 0x0002
-};
-
-/*!
- G.722 encode state
- */
-typedef struct g722_encode_state_s g722_encode_state_t;
-
-/*!
- G.722 decode state
- */
-typedef struct g722_decode_state_s g722_decode_state_t;
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-/*! Initialise an G.722 encode context.
- \param s The G.722 encode context.
- \param rate The required bit rate for the G.722 data.
- The valid rates are 64000, 56000 and 48000.
- \param options
- \return A pointer to the G.722 encode context, or NULL for error. */
-SPAN_DECLARE(g722_encode_state_t *) g722_encode_init(g722_encode_state_t *s, int rate, int options);
-
-/*! Release a G.722 encode context.
- \param s The G.722 encode context.
- \return 0 for OK. */
-SPAN_DECLARE(int) g722_encode_release(g722_encode_state_t *s);
-
-/*! Free a G.722 encode context.
- \param s The G.722 encode context.
- \return 0 for OK. */
-SPAN_DECLARE(int) g722_encode_free(g722_encode_state_t *s);
-
-/*! Encode a buffer of linear PCM data to G.722
- \param s The G.722 context.
- \param g722_data The G.722 data produced.
- \param amp The audio sample buffer.
- \param len The number of samples in the buffer.
- \return The number of bytes of G.722 data produced. */
-SPAN_DECLARE(int) g722_encode(g722_encode_state_t *s, uint8_t g722_data[], const int16_t amp[], int len);
-
-/*! Initialise an G.722 decode context.
- \param s The G.722 decode context.
- \param rate The bit rate of the G.722 data.
- The valid rates are 64000, 56000 and 48000.
- \param options
- \return A pointer to the G.722 decode context, or NULL for error. */
-SPAN_DECLARE(g722_decode_state_t *) g722_decode_init(g722_decode_state_t *s, int rate, int options);
-
-/*! Release a G.722 decode context.
- \param s The G.722 decode context.
- \return 0 for OK. */
-SPAN_DECLARE(int) g722_decode_release(g722_decode_state_t *s);
-
-/*! Free a G.722 decode context.
- \param s The G.722 decode context.
- \return 0 for OK. */
-SPAN_DECLARE(int) g722_decode_free(g722_decode_state_t *s);
-
-/*! Decode a buffer of G.722 data to linear PCM.
- \param s The G.722 context.
- \param amp The audio sample buffer.
- \param g722_data
- \param len
- \return The number of samples returned. */
-SPAN_DECLARE(int) g722_decode(g722_decode_state_t *s, int16_t amp[], const uint8_t g722_data[], int len);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
diff --git a/src/native/g722/g722_private.h b/src/native/g722/g722_private.h
deleted file mode 100644
index 7d3b5d1..0000000
--- a/src/native/g722/g722_private.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * private/g722.h - The ITU G.722 codec.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2005 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Based on a single channel G.722 codec which is:
- *
- ***** Copyright (c) CMU 1993 *****
- * Computer Science, Speech Group
- * Chengxiang Lu and Alex Hauptmann
- *
- * $Id: g722.h,v 1.2 2009/04/12 09:12:11 steveu Exp $
- */
-
-
-/*! \file */
-
-#if !defined(_SPANDSP_PRIVATE_G722_H_)
-#define _SPANDSP_PRIVATE_G722_H_
-
-/*! The per band parameters for both encoding and decoding G.722 */
-typedef struct
-{
- int16_t nb;
- int16_t det;
- int16_t s;
- int16_t sz;
- int16_t r;
- int16_t p[2];
- int16_t a[2];
- int16_t b[6];
- int16_t d[7];
-} g722_band_t;
-
-/*!
- G.722 encode state
- */
-struct g722_encode_state_s
-{
- /*! TRUE if the operating in the special ITU test mode, with the band split filters
- disabled. */
- int itu_test_mode;
- /*! TRUE if the G.722 data is packed */
- int packed;
- /*! TRUE if encode from 8k samples/second */
- int eight_k;
- /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
- int bits_per_sample;
-
- /*! Signal history for the QMF */
- int16_t x[12];
- int16_t y[12];
- int ptr;
-
- g722_band_t band[2];
-
- uint32_t in_buffer;
- int in_bits;
- uint32_t out_buffer;
- int out_bits;
-};
-
-/*!
- G.722 decode state
- */
-struct g722_decode_state_s
-{
- /*! TRUE if the operating in the special ITU test mode, with the band split filters
- disabled. */
- int itu_test_mode;
- /*! TRUE if the G.722 data is packed */
- int packed;
- /*! TRUE if decode to 8k samples/second */
- int eight_k;
- /*! 6 for 48000kbps, 7 for 56000kbps, or 8 for 64000kbps. */
- int bits_per_sample;
-
- /*! Signal history for the QMF */
- int16_t x[12];
- int16_t y[12];
- int ptr;
-
- g722_band_t band[2];
-
- uint32_t in_buffer;
- int in_bits;
- uint32_t out_buffer;
- int out_bits;
-};
-
-#endif
-/*- End of file ------------------------------------------------------------*/
diff --git a/src/native/g722/mmx_sse_decs.h b/src/native/g722/mmx_sse_decs.h
deleted file mode 100644
index 40dca54..0000000
--- a/src/native/g722/mmx_sse_decs.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * mmx_sse_decs.h - Pull in the appropriate systems headers for the MMX/SSE settings.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2009 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: mmx_sse_decs.h,v 1.1 2009/07/12 09:23:09 steveu Exp $
- */
-
-#if !defined(_MMX_SSE_DECS_H_)
-#define _MMX_SSE_DECS_H_
-
-#if defined(SPANDSP_USE_MMX)
-#include <mmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE)
-#include <xmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE2)
-#include <emmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE3)
-#include <pmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSSE3)
-#include <tmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE4_1)
-#include <smmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE4_2)
-#include <nmmintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE4A)
-#include <ammintrin.h>
-#endif
-#if defined(SPANDSP_USE_SSE5)
-#include <bmmintrin.h>
-#endif
-
-#endif
-
-/*- End of include ---------------------------------------------------------*/
diff --git a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.c b/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.c
deleted file mode 100644
index 0f20be9..0000000
--- a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-#include "net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.h"
-
-#include <inttypes.h>
-#include <stdint.h>
-
-#include "telephony.h"
-#include "g722.h"
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder_g722_1decoder_1close
- (JNIEnv *jniEnv, jclass clazz, jlong decoder)
-{
- g722_decode_state_t *d = (g722_decode_state_t *) (intptr_t) decoder;
-
- g722_decode_release(d);
- g722_decode_free(d);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder_g722_1decoder_1open
- (JNIEnv *jniEnv, jclass clazz)
-{
- return (jlong) (intptr_t) g722_decode_init(NULL, 64000, 0);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder_g722_1decoder_1process
- (JNIEnv *jniEnv, jclass clazz,
- jlong decoder,
- jbyteArray input, jint inputOffset,
- jbyteArray output, jint outputOffset, jint outputLength)
-{
- jbyte *outputPtr = (*jniEnv)->GetByteArrayElements(jniEnv, output, NULL);
-
- if (outputPtr)
- {
- jbyte *inputPtr
- = (*jniEnv)->GetPrimitiveArrayCritical(jniEnv, input, NULL);
-
- if (inputPtr)
- {
- g722_decode(
- (g722_decode_state_t *) (intptr_t) decoder,
- (int16_t *) (outputPtr + outputOffset),
- (const uint8_t *) (inputPtr + inputOffset),
- outputLength / (sizeof(int16_t) * 2));
- (*jniEnv)->ReleasePrimitiveArrayCritical(
- jniEnv,
- input, inputPtr,
- JNI_ABORT);
- }
- (*jniEnv)->ReleaseByteArrayElements(jniEnv, output, outputPtr, 0);
- }
-}
diff --git a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.h b/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.h
deleted file mode 100644
index d82c846..0000000
--- a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder */
-
-#ifndef _Included_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder
-#define _Included_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder
- * Method: g722_decoder_close
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder_g722_1decoder_1close
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder
- * Method: g722_decoder_open
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder_g722_1decoder_1open
- (JNIEnv *, jclass);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder
- * Method: g722_decoder_process
- * Signature: (J[BI[BII)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIDecoder_g722_1decoder_1process
- (JNIEnv *, jclass, jlong, jbyteArray, jint, jbyteArray, jint, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.c b/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.c
deleted file mode 100644
index 5ae1eaf..0000000
--- a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-#include "net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.h"
-
-#include <inttypes.h>
-#include "telephony.h"
-#include "g722.h"
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder_g722_1encoder_1close
- (JNIEnv *jniEnv, jclass clazz, jlong encoder)
-{
- g722_encode_state_t *e = (g722_encode_state_t *) (intptr_t) encoder;
-
- g722_encode_release(e);
- g722_encode_free(e);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder_g722_1encoder_1open
- (JNIEnv *jniEnv, jclass clazz)
-{
- return (jlong) (intptr_t) g722_encode_init(NULL, 64000, 0);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder_g722_1encoder_1process
- (JNIEnv *jniEnv, jclass clazz,
- jlong encoder,
- jbyteArray input, jint inputOffset,
- jbyteArray output, jint outputOffset, jint outputLength)
-{
- jbyte *outputPtr = (*jniEnv)->GetByteArrayElements(jniEnv, output, NULL);
-
- if (outputPtr)
- {
- jbyte *inputPtr
- = (*jniEnv)->GetPrimitiveArrayCritical(jniEnv, input, NULL);
-
- if (inputPtr)
- {
- g722_encode(
- (g722_encode_state_t *) (intptr_t) encoder,
- (uint8_t *) (outputPtr + outputOffset),
- (const int16_t *) (inputPtr + inputOffset),
- 2 * (outputLength / sizeof(uint8_t)));
- (*jniEnv)->ReleasePrimitiveArrayCritical(
- jniEnv,
- input, inputPtr,
- JNI_ABORT);
- }
- (*jniEnv)->ReleaseByteArrayElements(jniEnv, output, outputPtr, 0);
- }
-}
diff --git a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.h b/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.h
deleted file mode 100644
index e743977..0000000
--- a/src/native/g722/net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder */
-
-#ifndef _Included_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder
-#define _Included_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder
- * Method: g722_encoder_close
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder_g722_1encoder_1close
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder
- * Method: g722_encoder_open
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder_g722_1encoder_1open
- (JNIEnv *, jclass);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder
- * Method: g722_encoder_process
- * Signature: (J[BI[BII)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_g722_JNIEncoder_g722_1encoder_1process
- (JNIEnv *, jclass, jlong, jbyteArray, jint, jbyteArray, jint, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif
diff --git a/src/native/g722/saturated.h b/src/native/g722/saturated.h
deleted file mode 100644
index 689c95a..0000000
--- a/src/native/g722/saturated.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * saturated.h - General saturated arithmetic routines.
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2001, 2008 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: saturated.h,v 1.4 2009/02/05 12:21:36 steveu Exp $
- */
-
-/*! \file */
-
-#if !defined(_SPANDSP_SATURATED_H_)
-#define _SPANDSP_SATURATED_H_
-
-/*! \page saturated_page Saturated arithmetic
-
-\section saturated_page_sec_1 What does it do?
-
-
-\section saturated_page_sec_2 How does it work?
-
-*/
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-static __inline__ int16_t saturate(int32_t amp)
-{
- int16_t amp16;
-
- /* Hopefully this is optimised for the common case - not clipping */
- amp16 = (int16_t) amp;
- if (amp == amp16)
- return amp16;
- if (amp > INT16_MAX)
- return INT16_MAX;
- return INT16_MIN;
-}
-/*- End of function --------------------------------------------------------*/
-
-/*! Saturate to 15 bits, rather than the usual 16 bits. This is often a useful function. */
-static __inline__ int16_t saturate15(int32_t amp)
-{
- if (amp > 16383)
- return 16383;
- if (amp < -16384)
- return -16384;
- return (int16_t) amp;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int16_t saturated_add16(int16_t a, int16_t b)
-{
-#if defined(__GNUC__) && defined(__i386__)
- __asm__ __volatile__(
- " addw %2,%0;\n"
- " jno 0f;\n"
- " movw $0x7fff,%0;\n"
- " adcw $0,%0;\n"
- "0:"
- : "=r" (a)
- : "0" (a), "ir" (b)
- : "cc"
- );
- return a;
-#else
- return saturate((int32_t) a + (int32_t) b);
-#endif
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int32_t saturated_add32(int32_t a, int32_t b)
-{
-#if defined(__GNUC__) && defined(__i386__)
- __asm__ __volatile__(
- " addl %2,%0;\n"
- " jno 0f;\n"
- " movl $0x7fffffff,%0;\n"
- " adcl $0,%0;\n"
- "0:"
- : "=r" (a)
- : "0" (a), "ir" (b)
- : "cc"
- );
- return a;
-#else
- uint32_t A;
-
- if (a < 0)
- {
- if (b >= 0)
- return a + b;
- /*endif*/
- A = (uint32_t) -(a + 1) + (uint32_t) -(b + 1);
- return (A >= INT32_MAX) ? INT32_MIN : -(int32_t) A - 2;
- }
- /*endif*/
- if (b <= 0)
- return a + b;
- /*endif*/
- A = (uint32_t) a + (uint32_t) b;
- return (A > INT32_MAX) ? INT32_MAX : A;
-#endif
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int16_t saturated_sub16(int16_t a, int16_t b)
-{
- return saturate((int32_t) a - (int32_t) b);
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int16_t saturated_mul16(int16_t a, int16_t b)
-{
- if (a == INT16_MIN && b == INT16_MIN)
- return INT16_MAX;
- /*endif*/
- return (int16_t) (((int32_t) a*(int32_t) b) >> 15);
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int32_t saturated_mul_16_32(int16_t a, int16_t b)
-{
- return ((int32_t) a*(int32_t) b) << 1;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int16_t saturated_abs16(int16_t a)
-{
- return (a == INT16_MIN) ? INT16_MAX : (int16_t) abs(a);
-}
-/*- End of function --------------------------------------------------------*/
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
-/*- End of file ------------------------------------------------------------*/
diff --git a/src/native/g722/telephony.h b/src/native/g722/telephony.h
deleted file mode 100644
index 703c0bd..0000000
--- a/src/native/g722/telephony.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * telephony.h - some very basic telephony definitions
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2003 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: telephony.h,v 1.18.4.2 2009/12/21 18:38:06 steveu Exp $
- */
-
-#if !defined(_SPANDSP_TELEPHONY_H_)
-#define _SPANDSP_TELEPHONY_H_
-
-#if defined(_M_IX86) || defined(_M_X64)
-#if defined(LIBSPANDSP_EXPORTS)
-#define SPAN_DECLARE(type) __declspec(dllexport) type __stdcall
-#define SPAN_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl
-#define SPAN_DECLARE_DATA __declspec(dllexport)
-#else
-#define SPAN_DECLARE(type) __declspec(dllimport) type __stdcall
-#define SPAN_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl
-#define SPAN_DECLARE_DATA __declspec(dllimport)
-#endif
-#elif defined(SPANDSP_USE_EXPORT_CAPABILITY) && (defined(__GNUC__) || defined(__SUNCC__))
-#define SPAN_DECLARE(type) __attribute__((visibility("default"))) type
-#define SPAN_DECLARE_NONSTD(type) __attribute__((visibility("default"))) type
-#define SPAN_DECLARE_DATA __attribute__((visibility("default")))
-#else
-#define SPAN_DECLARE(type) /**/ type
-#define SPAN_DECLARE_NONSTD(type) /**/ type
-#define SPAN_DECLARE_DATA /**/
-#endif
-
-#define SAMPLE_RATE 8000
-
-/* This is based on A-law, but u-law is only 0.03dB different */
-#define DBM0_MAX_POWER (3.14f + 3.02f)
-#define DBM0_MAX_SINE_POWER (3.14f)
-/* This is based on the ITU definition of dbOv in G.100.1 */
-#define DBOV_MAX_POWER (0.0f)
-#define DBOV_MAX_SINE_POWER (-3.02f)
-
-/*! \brief A handler for pure receive. The buffer cannot be altered. */
-typedef int (span_rx_handler_t)(void *s, const int16_t amp[], int len);
-
-/*! \brief A handler for receive, where the buffer can be altered. */
-typedef int (span_mod_handler_t)(void *s, int16_t amp[], int len);
-
-/*! \brief A handler for missing receive data fill-in. */
-typedef int (span_rx_fillin_handler_t)(void *s, int len);
-
-/*! \brief A handler for transmit, where the buffer will be filled. */
-typedef int (span_tx_handler_t)(void *s, int16_t amp[], int max_len);
-
-#define ms_to_samples(t) ((t)*(SAMPLE_RATE/1000))
-#define us_to_samples(t) ((t)/(1000000/SAMPLE_RATE))
-
-#if !defined(FALSE)
-#define FALSE 0
-#endif
-#if !defined(TRUE)
-#define TRUE (!FALSE)
-#endif
-
-#if defined(__cplusplus)
-/* C++ doesn't seem to have sane rounding functions/macros yet */
-#if !defined(WIN32)
-#define lrint(x) ((long int) (x))
-#define lrintf(x) ((long int) (x))
-#endif
-#endif
-
-#endif
-/*- End of file ------------------------------------------------------------*/
diff --git a/src/native/g722/vector_int.c b/src/native/g722/vector_int.c
deleted file mode 100644
index 0cdcbf2..0000000
--- a/src/native/g722/vector_int.c
+++ /dev/null
@@ -1,628 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * vector_int.c - Integer vector arithmetic
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2006 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: vector_int.c,v 1.26.4.1 2009/12/28 11:54:59 steveu Exp $
- */
-
-/*! \file */
-
-#if defined(HAVE_CONFIG_H)
-#include "config.h"
-#endif
-
-#include <inttypes.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#if defined(HAVE_TGMATH_H)
-#include <tgmath.h>
-#endif
-#if defined(HAVE_MATH_H)
-#include <math.h>
-#endif
-#include <assert.h>
-
-//#include "floating_fudge.h"
-#include "mmx_sse_decs.h"
-
-#include "telephony.h"
-#include "vector_int.h"
-
-SPAN_DECLARE(int32_t) vec_dot_prodi16(const int16_t x[], const int16_t y[], int n)
-{
- int32_t z;
-
-#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__)
- __asm__ __volatile__(
- " emms;\n"
- " pxor %%mm0,%%mm0;\n"
- " leaq -32(%%rsi,%%rax,2),%%rdx;\n" /* rdx = top - 32 */
-
- " cmpq %%rdx,%%rsi;\n"
- " ja 1f;\n"
-
- /* Work in blocks of 16 int16_t's until we are near the end */
- " .p2align 2;\n"
- "2:\n"
- " movq (%%rdi),%%mm1;\n"
- " movq (%%rsi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- " movq 8(%%rdi),%%mm1;\n"
- " movq 8(%%rsi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- " movq 16(%%rdi),%%mm1;\n"
- " movq 16(%%rsi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- " movq 24(%%rdi),%%mm1;\n"
- " movq 24(%%rsi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " addq $32,%%rsi;\n"
- " addq $32,%%rdi;\n"
- " cmpq %%rdx,%%rsi;\n"
- " jbe 2b;\n"
-
- " .p2align 2;\n"
- "1:\n"
- " addq $24,%%rdx;\n" /* Now edx = top - 8 */
- " cmpq %%rdx,%%rsi;\n"
- " ja 3f;\n"
-
- /* Work in blocks of 4 int16_t's until we are near the end */
- " .p2align 2;\n"
- "4:\n"
- " movq (%%rdi),%%mm1;\n"
- " movq (%%rsi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " addq $8,%%rsi;\n"
- " addq $8,%%rdi;\n"
- " cmpq %%rdx,%%rsi;"
- " jbe 4b;\n"
-
- " .p2align 2;\n"
- "3:\n"
- " addq $4,%%rdx;\n" /* Now edx = top - 4 */
- " cmpq %%rdx,%%rsi;\n"
- " ja 5f;\n"
-
- /* Work in a block of 2 int16_t's */
- " movd (%%rdi),%%mm1;\n"
- " movd (%%rsi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " addq $4,%%rsi;\n"
- " addq $4,%%rdi;\n"
-
- " .p2align 2;\n"
- "5:\n"
- " addq $2,%%rdx;\n" /* Now edx = top - 2 */
- " cmpq %%rdx,%%rsi;\n"
- " ja 6f;\n"
-
- /* Deal with the very last int16_t, when n is odd */
- " movswl (%%rdi),%%eax;\n"
- " andl $65535,%%eax;\n"
- " movd %%eax,%%mm1;\n"
- " movswl (%%rsi),%%eax;\n"
- " andl $65535,%%eax;\n"
- " movd %%eax,%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " .p2align 2;\n"
- "6:\n"
- /* Merge the pieces of the answer */
- " movq %%mm0,%%mm1;\n"
- " punpckhdq %%mm0,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- /* Et voila, eax has the final result */
- " movd %%mm0,%%eax;\n"
-
- " emms;\n"
- : "=a" (z)
- : "S" (x), "D" (y), "a" (n)
- : "cc"
- );
-#elif defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__i386__)
- __asm__ __volatile__(
- " emms;\n"
- " pxor %%mm0,%%mm0;\n"
- " leal -32(%%esi,%%eax,2),%%edx;\n" /* edx = top - 32 */
-
- " cmpl %%edx,%%esi;\n"
- " ja 1f;\n"
-
- /* Work in blocks of 16 int16_t's until we are near the end */
- " .p2align 2;\n"
- "2:\n"
- " movq (%%edi),%%mm1;\n"
- " movq (%%esi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- " movq 8(%%edi),%%mm1;\n"
- " movq 8(%%esi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- " movq 16(%%edi),%%mm1;\n"
- " movq 16(%%esi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- " movq 24(%%edi),%%mm1;\n"
- " movq 24(%%esi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " addl $32,%%esi;\n"
- " addl $32,%%edi;\n"
- " cmpl %%edx,%%esi;\n"
- " jbe 2b;\n"
-
- " .p2align 2;\n"
- "1:\n"
- " addl $24,%%edx;\n" /* Now edx = top - 8 */
- " cmpl %%edx,%%esi;\n"
- " ja 3f;\n"
-
- /* Work in blocks of 4 int16_t's until we are near the end */
- " .p2align 2;\n"
- "4:\n"
- " movq (%%edi),%%mm1;\n"
- " movq (%%esi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " addl $8,%%esi;\n"
- " addl $8,%%edi;\n"
- " cmpl %%edx,%%esi;"
- " jbe 4b;\n"
-
- " .p2align 2;\n"
- "3:\n"
- " addl $4,%%edx;\n" /* Now edx = top - 4 */
- " cmpl %%edx,%%esi;\n"
- " ja 5f;\n"
-
- /* Work in a block of 2 int16_t's */
- " movd (%%edi),%%mm1;\n"
- " movd (%%esi),%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " addl $4,%%esi;\n"
- " addl $4,%%edi;\n"
-
- " .p2align 2;\n"
- "5:\n"
- " addl $2,%%edx;\n" /* Now edx = top - 2 */
- " cmpl %%edx,%%esi;\n"
- " ja 6f;\n"
-
- /* Deal with the very last int16_t, when n is odd */
- " movswl (%%edi),%%eax;\n"
- " andl $65535,%%eax;\n"
- " movd %%eax,%%mm1;\n"
- " movswl (%%esi),%%eax;\n"
- " andl $65535,%%eax;\n"
- " movd %%eax,%%mm2;\n"
- " pmaddwd %%mm2,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
-
- " .p2align 2;\n"
- "6:\n"
- /* Merge the pieces of the answer */
- " movq %%mm0,%%mm1;\n"
- " punpckhdq %%mm0,%%mm1;\n"
- " paddd %%mm1,%%mm0;\n"
- /* Et voila, eax has the final result */
- " movd %%mm0,%%eax;\n"
-
- " emms;\n"
- : "=a" (z)
- : "S" (x), "D" (y), "a" (n)
- : "cc"
- );
-#else
- int i;
-
- z = 0;
- for (i = 0; i < n; i++)
- z += (int32_t) x[i]*(int32_t) y[i];
-#endif
- return z;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int32_t) vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos)
-{
- int32_t z;
-
- z = vec_dot_prodi16(&x[pos], &y[0], n - pos);
- z += vec_dot_prodi16(&x[0], &y[n - pos], pos);
- return z;
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error)
-{
- int i;
-
- for (i = 0; i < n; i++)
- y[i] += (int16_t) (((int32_t) x[i]*(int32_t) error) >> 15);
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error)
-{
- vec_lmsi16(&x[pos], &y[0], n - pos, error);
- vec_lmsi16(&x[0], &y[n - pos], pos, error);
-}
-/*- End of function --------------------------------------------------------*/
-
-SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[])
-{
-#if defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__x86_64__)
- static const int32_t lower_bound = 0x80008000;
- static const int32_t upper_bound = 0x7FFF7FFF;
- int32_t max;
-
- __asm__ __volatile__(
- " emms;\n"
- " pushq %%rdx;\n"
- " leaq -8(%%rsi,%%rax,2),%%rdx;\n"
-
- " cmpq %%rdx,%%rsi;\n"
- " jbe 2f;\n"
- " movd %[lower],%%mm0;\n"
- " movd %[upper],%%mm1;\n"
- " jmp 1f;\n"
-
- " .p2align 2;\n"
- "2:\n"
- " movq (%%rsi),%%mm0;\n" /* mm0 will be max's */
- " movq %%mm0,%%mm1;\n" /* mm1 will be min's */
- " addq $8,%%rsi;\n"
- " cmpq %%rdx,%%rsi;\n"
- " ja 4f;\n"
-
- "3:\n"
- " movq (%%rsi),%%mm2;\n"
-
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " movq %%mm3,%%mm4;\n"
- " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */
- " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */
- " por %%mm3,%%mm4;\n"
- " movq %%mm4,%%mm0;\n" /* Now mm0 is updated max's */
-
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */
-
- " addq $8,%%rsi;\n"
- " cmpq %%rdx,%%rsi;\n"
- " jbe 3b;\n"
-
- " .p2align 2;\n"
- "4:\n"
- /* Merge down the 4-word max/mins to lower 2 words */
- " movq %%mm0,%%mm2;\n"
- " psrlq $32,%%mm2;\n"
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */
- " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm0;\n" /* now mm0 is updated max's */
-
- " movq %%mm1,%%mm2;\n"
- " psrlq $32,%%mm2;\n"
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */
-
- " .p2align 2;\n"
- "1:\n"
- " addq $4,%%rdx;\n" /* now dx = top-4 */
- " cmpq %%rdx,%%rsi;\n"
- " ja 5f;\n"
- /* Here, there are >= 2 words of input remaining */
- " movd (%%rsi),%%mm2;\n"
-
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " movq %%mm3,%%mm4;\n"
- " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */
- " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */
- " por %%mm3,%%mm4;\n"
- " movq %%mm4,%%mm0;\n" /* now mm0 is updated max's */
-
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */
-
- " addq $4,%%rsi;\n"
-
- " .p2align 2;\n"
- "5:\n"
- /* Merge down the 2-word max/mins to 1 word */
- " movq %%mm0,%%mm2;\n"
- " psrlq $16,%%mm2;\n"
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */
- " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */
- " por %%mm3,%%mm2;\n"
- " movd %%mm2,%%ecx;\n" /* cx is max so far */
-
- " movq %%mm1,%%mm2;\n"
- " psrlq $16,%%mm2;\n"
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movd %%mm2,%%eax;\n" /* ax is min so far */
-
- " addq $2,%%rdx;\n" /* now dx = top-2 */
- " cmpq %%rdx,%%rsi;\n"
- " ja 6f;\n"
-
- /* Here, there is one word of input left */
- " cmpw (%%rsi),%%cx;\n"
- " jge 9f;\n"
- " movw (%%rsi),%%cx;\n"
- " .p2align 2;\n"
- "9:\n"
- " cmpw (%%rsi),%%ax;\n"
- " jle 6f;\n"
- " movw (%%rsi),%%ax;\n"
-
- " .p2align 2;\n"
- "6:\n"
- /* (finally!) cx is the max, ax the min */
- " movswl %%cx,%%ecx;\n"
- " movswl %%ax,%%eax;\n"
-
- " popq %%rdx;\n" /* ptr to output max,min vals */
- " andq %%rdx,%%rdx;\n"
- " jz 7f;\n"
- " movw %%cx,(%%rdx);\n" /* max */
- " movw %%ax,2(%%rdx);\n" /* min */
- " .p2align 2;\n"
- "7:\n"
- /* Now calculate max absolute value */
- " negl %%eax;\n"
- " cmpl %%ecx,%%eax;\n"
- " jge 8f;\n"
- " movl %%ecx,%%eax;\n"
- " .p2align 2;\n"
- "8:\n"
- " emms;\n"
- : "=a" (max)
- : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound)
- : "ecx"
- );
-#elif defined(__GNUC__) && defined(SPANDSP_USE_MMX) && defined(__i386__)
- static const int32_t lower_bound = 0x80008000;
- static const int32_t upper_bound = 0x7FFF7FFF;
- int32_t max;
-
- __asm__ __volatile__(
- " emms;\n"
- " pushl %%edx;\n"
- " leal -8(%%esi,%%eax,2),%%edx;\n"
-
- " cmpl %%edx,%%esi;\n"
- " jbe 2f;\n"
- " movd %[lower],%%mm0;\n"
- " movd %[upper],%%mm1;\n"
- " jmp 1f;\n"
-
- " .p2align 2;\n"
- "2:\n"
- " movq (%%esi),%%mm0;\n" /* mm0 will be max's */
- " movq %%mm0,%%mm1;\n" /* mm1 will be min's */
- " addl $8,%%esi;\n"
- " cmpl %%edx,%%esi;\n"
- " ja 4f;\n"
-
- " .p2align 2;\n"
- "3:\n"
- " movq (%%esi),%%mm2;\n"
-
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " movq %%mm3,%%mm4;\n"
- " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */
- " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */
- " por %%mm3,%%mm4;\n"
- " movq %%mm4,%%mm0;\n" /* Now mm0 is updated max's */
-
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */
-
- " addl $8,%%esi;\n"
- " cmpl %%edx,%%esi;\n"
- " jbe 3b;\n"
-
- " .p2align 2;\n"
- "4:\n"
- /* Merge down the 4-word max/mins to lower 2 words */
- " movq %%mm0,%%mm2;\n"
- " psrlq $32,%%mm2;\n"
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */
- " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm0;\n" /* now mm0 is updated max's */
-
- " movq %%mm1,%%mm2;\n"
- " psrlq $32,%%mm2;\n"
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */
-
- " .p2align 2;\n"
- "1:\n"
- " addl $4,%%edx;\n" /* now dx = top-4 */
- " cmpl %%edx,%%esi;\n"
- " ja 5f;\n"
- /* Here, there are >= 2 words of input remaining */
- " movd (%%esi),%%mm2;\n"
-
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " movq %%mm3,%%mm4;\n"
- " pand %%mm2,%%mm3;\n" /* mm3 is mm2 masked to new max's */
- " pandn %%mm0,%%mm4;\n" /* mm4 is mm0 masked to its max's */
- " por %%mm3,%%mm4;\n"
- " movq %%mm4,%%mm0;\n" /* now mm0 is updated max's */
-
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movq %%mm2,%%mm1;\n" /* now mm1 is updated min's */
-
- " addl $4,%%esi;\n"
-
- " .p2align 2;\n"
- "5:\n"
- /* Merge down the 2-word max/mins to 1 word */
- " movq %%mm0,%%mm2;\n"
- " psrlq $16,%%mm2;\n"
- " movq %%mm2,%%mm3;\n"
- " pcmpgtw %%mm0,%%mm3;\n" /* mm3 is bitmask for words where mm2 > mm0 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new max's */
- " pandn %%mm0,%%mm3;\n" /* mm3 is mm0 masked to its max's */
- " por %%mm3,%%mm2;\n"
- " movd %%mm2,%%ecx;\n" /* cx is max so far */
-
- " movq %%mm1,%%mm2;\n"
- " psrlq $16,%%mm2;\n"
- " movq %%mm1,%%mm3;\n"
- " pcmpgtw %%mm2,%%mm3;\n" /* mm3 is bitmask for words where mm2 < mm1 */
- " pand %%mm3,%%mm2;\n" /* mm2 is mm2 masked to new min's */
- " pandn %%mm1,%%mm3;\n" /* mm3 is mm1 masked to its min's */
- " por %%mm3,%%mm2;\n"
- " movd %%mm2,%%eax;\n" /* ax is min so far */
-
- " addl $2,%%edx;\n" /* now dx = top-2 */
- " cmpl %%edx,%%esi;\n"
- " ja 6f;\n"
-
- /* Here, there is one word of input left */
- " cmpw (%%esi),%%cx;\n"
- " jge 9f;\n"
- " movw (%%esi),%%cx;\n"
- " .p2align 2;\n"
- "9:\n"
- " cmpw (%%esi),%%ax;\n"
- " jle 6f;\n"
- " movw (%%esi),%%ax;\n"
-
- " .p2align 2;\n"
- "6:\n"
- /* (finally!) cx is the max, ax the min */
- " movswl %%cx,%%ecx;\n"
- " movswl %%ax,%%eax;\n"
-
- " popl %%edx;\n" /* ptr to output max,min vals */
- " andl %%edx,%%edx;\n"
- " jz 7f;\n"
- " movw %%cx,(%%edx);\n" /* max */
- " movw %%ax,2(%%edx);\n" /* min */
- " .p2align 2;\n"
- "7:\n"
- /* Now calculate max absolute value */
- " negl %%eax;\n"
- " cmpl %%ecx,%%eax;\n"
- " jge 8f;\n"
- " movl %%ecx,%%eax;\n"
- " .p2align 2;\n"
- "8:\n"
- " emms;\n"
- : "=a" (max)
- : "S" (x), "a" (n), "d" (out), [lower] "m" (lower_bound), [upper] "m" (upper_bound)
- : "ecx"
- );
-#else
- int i;
- int16_t min;
- int16_t max;
- int16_t temp;
- int32_t z;
-
- max = INT16_MIN;
- min = INT16_MAX;
- for (i = 0; i < n; i++)
- {
- temp = x[i];
- if (temp > max)
- max = temp;
- /*endif*/
- if (temp < min)
- min = temp;
- /*endif*/
- }
- /*endfor*/
- if (out)
- {
- out[0] = max;
- out[1] = min;
- }
- z = abs(min);
- if (z > max)
- return z;
-#endif
- return max;
-}
-/*- End of function --------------------------------------------------------*/
-/*- End of file ------------------------------------------------------------*/
diff --git a/src/native/g722/vector_int.h b/src/native/g722/vector_int.h
deleted file mode 100644
index 04a632f..0000000
--- a/src/native/g722/vector_int.h
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * SpanDSP - a series of DSP components for telephony
- *
- * vector_int.h
- *
- * Written by Steve Underwood <steveu@coppice.org>
- *
- * Copyright (C) 2003 Steve Underwood
- *
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Lesser 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id: vector_int.h,v 1.14 2009/01/31 08:48:11 steveu Exp $
- */
-
-#if !defined(_SPANDSP_VECTOR_INT_H_)
-#define _SPANDSP_VECTOR_INT_H_
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-
-static __inline__ void vec_copyi(int z[], const int x[], int n)
-{
- memcpy(z, x, n*sizeof(z[0]));
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_copyi16(int16_t z[], const int16_t x[], int n)
-{
- memcpy(z, x, n*sizeof(z[0]));
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_copyi32(int32_t z[], const int32_t x[], int n)
-{
- memcpy(z, x, n*sizeof(z[0]));
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_zeroi(int z[], int n)
-{
- memset(z, 0, n*sizeof(z[0]));
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_zeroi16(int16_t z[], int n)
-{
- memset(z, 0, n*sizeof(z[0]));
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_zeroi32(int32_t z[], int n)
-{
- memset(z, 0, n*sizeof(z[0]));
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_seti(int z[], int x, int n)
-{
- int i;
-
- for (i = 0; i < n; i++)
- z[i] = x;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_seti16(int16_t z[], int16_t x, int n)
-{
- int i;
-
- for (i = 0; i < n; i++)
- z[i] = x;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_seti32(int32_t z[], int32_t x, int n)
-{
- int i;
-
- for (i = 0; i < n; i++)
- z[i] = x;
-}
-/*- End of function --------------------------------------------------------*/
-
-/*! \brief Find the dot product of two int16_t vectors.
- \param x The first vector.
- \param y The first vector.
- \param n The number of elements in the vectors.
- \return The dot product of the two vectors. */
-SPAN_DECLARE(int32_t) vec_dot_prodi16(const int16_t x[], const int16_t y[], int n);
-
-/*! \brief Find the dot product of two int16_t vectors, where the first is a circular buffer
- with an offset for the starting position.
- \param x The first vector.
- \param y The first vector.
- \param n The number of elements in the vectors.
- \param pos The starting position in the x vector.
- \return The dot product of the two vectors. */
-SPAN_DECLARE(int32_t) vec_circular_dot_prodi16(const int16_t x[], const int16_t y[], int n, int pos);
-
-SPAN_DECLARE(void) vec_lmsi16(const int16_t x[], int16_t y[], int n, int16_t error);
-
-SPAN_DECLARE(void) vec_circular_lmsi16(const int16_t x[], int16_t y[], int n, int pos, int16_t error);
-
-/*! \brief Find the minimum and maximum values in an int16_t vector.
- \param x The vector to be searched.
- \param n The number of elements in the vector.
- \param out A two element vector. The first will receive the
- maximum. The second will receive the minimum. This parameter
- may be set to NULL.
- \return The absolute maximum value. Since the range of negative numbers
- exceeds the range of positive one, the returned integer is longer
- than the ones being searched. */
-SPAN_DECLARE(int32_t) vec_min_maxi16(const int16_t x[], int n, int16_t out[]);
-
-static __inline__ int vec_norm2i16(const int16_t *vec, int len)
-{
- int i;
- int sum;
-
- sum = 0;
- for (i = 0; i < len; i++)
- sum += vec[i]*vec[i];
- return sum;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ void vec_sari16(int16_t *vec, int len, int shift)
-{
- int i;
-
- for (i = 0; i < len; i++)
- vec[i] >>= shift;
-}
-/*- End of function --------------------------------------------------------*/
-
-static __inline__ int vec_max_bitsi16(const int16_t *vec, int len)
-{
- int i;
- int max;
- int v;
- int b;
-
- max = 0;
- for (i = 0; i < len; i++)
- {
- v = abs(vec[i]);
- if (v > max)
- max = v;
- }
- b = 0;
- while (max != 0)
- {
- b++;
- max >>= 1;
- }
- return b;
-}
-/*- End of function --------------------------------------------------------*/
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
-/*- End of file ------------------------------------------------------------*/
diff --git a/src/native/speex/Makefile b/src/native/speex/Makefile
deleted file mode 100644
index 10942ef..0000000
--- a/src/native/speex/Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-JAVA_HOME?=/usr/lib/jvm/java-6-sun
-SPEEX_HOME?=/home/lubomir/src/speex-1.2rc1
-
-TARGET=../../../lib/native/linux/libjspeex.so
-
-CC=gcc
-CPPFLAGS=-D_JNI_IMPLEMENTATION_ \
- -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
- -I$(SPEEX_HOME)/include \
- -O2 \
- -Wall
-LDFLAGS=-shared -fPIC
-LIBS=-L$(SPEEX_HOME)/libspeex/.libs -Wl,-Bstatic -lspeex -lspeexdsp -Wl,-Bdynamic -lm
-
-$(TARGET): net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.c net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.h
- $(CC) $(CPPFLAGS) $< $(LDFLAGS) -o $@ $(LIBS)
diff --git a/src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.c b/src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.c
deleted file mode 100644
index 26b8768..0000000
--- a/src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/*
- * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-#include "net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.h"
-
-#include <speex/speex.h>
-#include <speex/speex_resampler.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1destroy
- (JNIEnv *jniEnv, jclass clazz, jlong bits)
-{
- SpeexBits *bitsPtr = (SpeexBits *) (intptr_t) bits;
-
- speex_bits_destroy(bitsPtr);
- free(bitsPtr);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1init
- (JNIEnv *jniEnv, jclass clazz)
-{
- SpeexBits *bits = malloc(sizeof(SpeexBits));
-
- if (bits)
- speex_bits_init(bits);
- return (jlong) (intptr_t) bits;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1nbytes
- (JNIEnv *jniEnv, jclass clazz, jlong bits)
-{
- return speex_bits_nbytes((SpeexBits *) (intptr_t) bits);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1read_1from
- (JNIEnv *jniEnv, jclass clazz,
- jlong bits, jbyteArray bytes, jint bytesOffset, jint len)
-{
- jbyte *bytesPtr = (*jniEnv)->GetPrimitiveArrayCritical(jniEnv, bytes, NULL);
-
- if (bytesPtr)
- {
- speex_bits_read_from(
- (SpeexBits *) (intptr_t) bits,
- (char *) (bytesPtr + bytesOffset),
- len);
- (*jniEnv)->ReleasePrimitiveArrayCritical(
- jniEnv,
- bytes,
- bytesPtr,
- JNI_ABORT);
- }
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1remaining
- (JNIEnv *jniEnv, jclass clazz, jlong bits)
-{
- return speex_bits_remaining((SpeexBits *) (intptr_t) bits);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1reset
- (JNIEnv *jniEnv, jclass clazz, jlong bits)
-{
- speex_bits_reset((SpeexBits *) (intptr_t) bits);
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1write
- (JNIEnv *jniEnv, jclass clazz,
- jlong bits, jbyteArray bytes, jint bytesOffset, jint max_len)
-{
- jbyte *bytesPtr = (*jniEnv)->GetPrimitiveArrayCritical(jniEnv, bytes, NULL);
- jint ret;
-
- if (bytesPtr)
- {
- ret
- = speex_bits_write(
- (SpeexBits *) (intptr_t) bits,
- (char *) (bytesPtr + bytesOffset),
- max_len);
- (*jniEnv)->ReleasePrimitiveArrayCritical(jniEnv, bytes, bytesPtr, 0);
- }
- else
- ret = 0;
- return ret;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decode_1int
- (JNIEnv *jniEnv, jclass clazz,
- jlong state, jlong bits, jbyteArray out, jint outOffset)
-{
- jbyte *outPtr = (*jniEnv)->GetByteArrayElements(jniEnv, out, NULL);
- jint ret;
-
- if (outPtr)
- {
- ret
- = speex_decode_int(
- (void *) (intptr_t) state,
- (SpeexBits *) (intptr_t) bits,
- (spx_int16_t *) (outPtr + outOffset));
- (*jniEnv)->ReleaseByteArrayElements(jniEnv, out, outPtr, 0);
- }
- else
- ret = -2;
- return ret;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1ctl__JI
- (JNIEnv *jniEnv, jclass clazz, jlong state, jint request)
-{
- int ret;
- int value = 0;
-
- ret = speex_decoder_ctl((void *) (intptr_t) state, request, &value);
- if (ret == 0)
- ret = value;
- return ret;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1ctl__JII
- (JNIEnv *jniEnv, jclass clazz, jlong state, jint request, jint value)
-{
- return speex_decoder_ctl((void *) (intptr_t) state, request, &value);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1destroy
- (JNIEnv *jniEnv, jclass clazz, jlong state)
-{
- speex_decoder_destroy((void *) (intptr_t) state);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1init
- (JNIEnv *jniEnv, jclass clazz, jlong mode)
-{
- return (jlong) (intptr_t) speex_decoder_init((SpeexMode *) (intptr_t) mode);
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encode_1int
- (JNIEnv *jniEnv, jclass clazz,
- jlong state, jbyteArray in, jint inOffset, jlong bits)
-{
- jbyte *inPtr = (*jniEnv)->GetByteArrayElements(jniEnv, in, NULL);
- jint ret;
-
- if (inPtr)
- {
- ret
- = speex_encode_int(
- (void *) (intptr_t) state,
- (spx_int16_t *) (inPtr + inOffset),
- (SpeexBits *) (intptr_t) bits);
- (*jniEnv)->ReleaseByteArrayElements(jniEnv, in, inPtr, JNI_ABORT);
- }
- else
- ret = 0;
- return ret;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1ctl__JI
- (JNIEnv *jniEnv, jclass clazz, jlong state, jint request)
-{
- int ret;
- int value = 0;
-
- ret = speex_encoder_ctl((void *) (intptr_t) state, request, &value);
- if (ret == 0)
- ret = value;
- return ret;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1ctl__JII
- (JNIEnv *jniEnv, jclass clazz, jlong state, jint request, jint value)
-{
- return speex_encoder_ctl((void *) (intptr_t) state, request, &value);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1destroy
- (JNIEnv *jniEnv, jclass clazz, jlong state)
-{
- speex_encoder_destroy((void *) (intptr_t) state);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1init
- (JNIEnv *jniEnv, jclass clazz, jlong mode)
-{
- return (jlong) (intptr_t) speex_encoder_init((SpeexMode *) (intptr_t) mode);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1lib_1get_1mode
- (JNIEnv *jniEnv, jclass clazz, jint mode)
-{
- return (jlong) (intptr_t) speex_lib_get_mode(mode);
-}
-
-JNIEXPORT void JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1destroy
- (JNIEnv *jniENv, jclass clazz, jlong state)
-{
- speex_resampler_destroy((SpeexResamplerState *) (intptr_t) state);
-}
-
-JNIEXPORT jlong JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1init
- (JNIEnv *jniEnv, jclass clazz,
- jint nb_channels, jint in_rate, jint out_rate, jint quality, jlong err)
-{
- return
- (jlong)
- (intptr_t)
- speex_resampler_init(
- nb_channels,
- in_rate, out_rate,
- quality,
- (int *) (intptr_t) err);
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1process_1interleaved_1int
- (JNIEnv *jniEnv, jclass clazz,
- jlong state,
- jbyteArray in, jint inOffset, jint in_len,
- jbyteArray out, jint outOffset, jint out_len)
-{
- jbyte *inPtr = (*jniEnv)->GetPrimitiveArrayCritical(jniEnv, in, NULL);
- jint ret;
-
- if (inPtr)
- {
- jbyte *outPtr = (*jniEnv)->GetPrimitiveArrayCritical(jniEnv, out, NULL);
-
- if (outPtr)
- {
- spx_uint32_t _in_len = in_len;
- spx_uint32_t _out_len = out_len;
-
- ret
- = speex_resampler_process_interleaved_int(
- (SpeexResamplerState *) (intptr_t) state,
- (spx_int16_t *) (inPtr + inOffset),
- &_in_len,
- (spx_int16_t *) (outPtr + outOffset),
- &_out_len);
- (*jniEnv)->ReleasePrimitiveArrayCritical(jniEnv, out, outPtr, 0);
-
- /*
- * speex_resampler_process_interleaved_int is supposed to return the
- * number of samples which have been written but it doesn't seem to
- * do it and instead returns zero.
- */
- ret = _out_len;
- }
- else
- ret = 0;
- (*jniEnv)->ReleasePrimitiveArrayCritical(jniEnv, in, inPtr, JNI_ABORT);
- }
- else
- ret = 0;
- return ret;
-}
-
-JNIEXPORT jint JNICALL
-Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1set_1rate
- (JNIEnv *jniEnv, jclass clazz, jlong state, jint in_rate, jint out_rate)
-{
- return
- speex_resampler_set_rate(
- (SpeexResamplerState *) (intptr_t) state,
- in_rate, out_rate);
-}
diff --git a/src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.h b/src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.h
deleted file mode 100644
index 9c9eef8..0000000
--- a/src/native/speex/net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex */
-
-#ifndef _Included_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
-#define _Included_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
-#ifdef __cplusplus
-extern "C" {
-#endif
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_destroy
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1destroy
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_init
- * Signature: ()J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1init
- (JNIEnv *, jclass);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_nbytes
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1nbytes
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_read_from
- * Signature: (J[BII)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1read_1from
- (JNIEnv *, jclass, jlong, jbyteArray, jint, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_remaining
- * Signature: (J)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1remaining
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_reset
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1reset
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_bits_write
- * Signature: (J[BII)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1bits_1write
- (JNIEnv *, jclass, jlong, jbyteArray, jint, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_decode_int
- * Signature: (JJ[BI)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decode_1int
- (JNIEnv *, jclass, jlong, jlong, jbyteArray, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_decoder_ctl
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1ctl__JI
- (JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_decoder_ctl
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1ctl__JII
- (JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_decoder_destroy
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1destroy
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_decoder_init
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1decoder_1init
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_encode_int
- * Signature: (J[BIJ)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encode_1int
- (JNIEnv *, jclass, jlong, jbyteArray, jint, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_encoder_ctl
- * Signature: (JI)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1ctl__JI
- (JNIEnv *, jclass, jlong, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_encoder_ctl
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1ctl__JII
- (JNIEnv *, jclass, jlong, jint, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_encoder_destroy
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1destroy
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_encoder_init
- * Signature: (J)J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1encoder_1init
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_lib_get_mode
- * Signature: (I)J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1lib_1get_1mode
- (JNIEnv *, jclass, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_resampler_destroy
- * Signature: (J)V
- */
-JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1destroy
- (JNIEnv *, jclass, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_resampler_init
- * Signature: (IIIIJ)J
- */
-JNIEXPORT jlong JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1init
- (JNIEnv *, jclass, jint, jint, jint, jint, jlong);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_resampler_process_interleaved_int
- * Signature: (J[BII[BII)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1process_1interleaved_1int
- (JNIEnv *, jclass, jlong, jbyteArray, jint, jint, jbyteArray, jint, jint);
-
-/*
- * Class: net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex
- * Method: speex_resampler_set_rate
- * Signature: (JII)I
- */
-JNIEXPORT jint JNICALL Java_net_java_sip_communicator_impl_neomedia_codec_audio_speex_Speex_speex_1resampler_1set_1rate
- (JNIEnv *, jclass, jlong, jint, jint);
-
-#ifdef __cplusplus
-}
-#endif
-#endif