summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2000-09-26 22:31:50 +0000
committerMonty <xiphmont@xiph.org>2000-09-26 22:31:50 +0000
commitc293f43e78b2b4c9084613c6a9ef9e2ebe1849dc (patch)
tree85677145f236860d2e7a51592abcba54e2aef461
parent404ec158e8892d248768f0ea795a118648ac35e0 (diff)
downloadlibvorbis-git-c293f43e78b2b4c9084613c6a9ef9e2ebe1849dc.tar.gz
Lookup optimizations for vorbis_lsp_to_curve, also an integerized version.
svn path=/branches/branch_postbeta2/vorbis/; revision=697
-rwxr-xr-xconfigure135
-rw-r--r--lib/Makefile.in8
-rw-r--r--lib/bitwise.c27
-rw-r--r--lib/bitwise.h4
-rw-r--r--lib/floor0.c76
-rw-r--r--lib/lookup.c92
-rw-r--r--lib/lookup.h33
-rw-r--r--lib/lookup_data.h190
-rwxr-xr-xlib/lookups.pl143
-rw-r--r--lib/lpc.c7
-rw-r--r--lib/lpc.h3
-rw-r--r--lib/lsp.c197
-rw-r--r--lib/lsp.h9
-rw-r--r--lib/psytune.c15
14 files changed, 739 insertions, 200 deletions
diff --git a/configure b/configure
index 36214655..c165945e 100755
--- a/configure
+++ b/configure
@@ -1094,16 +1094,17 @@ else
case $host in
*86-*-linux*)
DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
- OPT="-O20 -ffast-math -D_REENTRANT -fsigned-char"
- PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char"
-
+ OPT="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char"
+# PROFILE="-Wall -W -pg -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static"
+ PROFILE="-Wall -W -pg -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline -static"
+
# glibc < 2.1.3 has a serious FP bug in the math inline header
# that will cripple Vorbis. Look to see if the magic FP stack
# clobber is missing in the mathinline header, thus indicating
# the buggy version
cat > conftest.$ac_ext <<EOF
-#line 1107 "configure"
+#line 1108 "configure"
#include "confdefs.h"
#define __LIBC_INTERNAL_MATH_INLINES 1
@@ -1123,7 +1124,7 @@ rm -f conftest*
if test ${bad} = "maybe" ;then
cat > conftest.$ac_ext <<EOF
-#line 1127 "configure"
+#line 1128 "configure"
#include "confdefs.h"
#define __LIBC_INTERNAL_MATH_INLINES 1
@@ -1179,12 +1180,12 @@ rm -f conftest*
fi
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1183: checking for ANSI C header files" >&5
+echo "configure:1184: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1188 "configure"
+#line 1189 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -1192,7 +1193,7 @@ else
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1196: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1197: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1209,7 +1210,7 @@ rm -f conftest*
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1213 "configure"
+#line 1214 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -1227,7 +1228,7 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 1231 "configure"
+#line 1232 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -1248,7 +1249,7 @@ if test "$cross_compiling" = yes; then
:
else
cat > conftest.$ac_ext <<EOF
-#line 1252 "configure"
+#line 1253 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -1259,7 +1260,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
exit (0); }
EOF
-if { (eval echo configure:1263: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1264: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
:
else
@@ -1288,7 +1289,7 @@ fi
# pthread_lib="-lpthread"; AC_DEFINE(HAVE_LIBPTHREAD), :)
# We no longer use config.h
echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:1292: checking for pthread_create in -lpthread" >&5
+echo "configure:1293: checking for pthread_create in -lpthread" >&5
ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -1296,7 +1297,7 @@ else
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1300 "configure"
+#line 1301 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error. */
/* We use char because int might match the return type of a gcc2
@@ -1307,7 +1308,7 @@ int main() {
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:1311: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:1312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_lib_$ac_lib_var=yes"
else
@@ -1376,7 +1377,7 @@ dummy="__noconf"
# behind the times on type madness
echo $ac_n "checking for int16_t""... $ac_c" 1>&6
-echo "configure:1380: checking for int16_t" >&5
+echo "configure:1381: checking for int16_t" >&5
if eval "test \"`echo '$''{'has_int16_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1385,7 +1386,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1389 "configure"
+#line 1390 "configure"
#include "confdefs.h"
#ifdef __BEOS__
@@ -1396,7 +1397,7 @@ int16_t foo;
int main() {return 0;}
EOF
-if { (eval echo configure:1400: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1401: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
has_int16_t=yes
else
@@ -1413,7 +1414,7 @@ fi
echo "$ac_t""$has_int16_t" 1>&6
echo $ac_n "checking for int32_t""... $ac_c" 1>&6
-echo "configure:1417: checking for int32_t" >&5
+echo "configure:1418: checking for int32_t" >&5
if eval "test \"`echo '$''{'has_int32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1422,7 +1423,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1426 "configure"
+#line 1427 "configure"
#include "confdefs.h"
#ifdef __BEOS__
@@ -1433,7 +1434,7 @@ int32_t foo;
int main() {return 0;}
EOF
-if { (eval echo configure:1437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1438: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
has_int32_t=yes
else
@@ -1450,7 +1451,7 @@ fi
echo "$ac_t""$has_int32_t" 1>&6
echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
-echo "configure:1454: checking for uint32_t" >&5
+echo "configure:1455: checking for uint32_t" >&5
if eval "test \"`echo '$''{'has_uint32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1459,7 +1460,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1463 "configure"
+#line 1464 "configure"
#include "confdefs.h"
#ifdef __BEOS__
@@ -1470,7 +1471,7 @@ uint32_t foo;
int main() {return 0;}
EOF
-if { (eval echo configure:1474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1475: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
has_uint32_t=yes
else
@@ -1487,7 +1488,7 @@ fi
echo "$ac_t""$has_uint32_t" 1>&6
echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6
-echo "configure:1491: checking for u_int32_t" >&5
+echo "configure:1492: checking for u_int32_t" >&5
if eval "test \"`echo '$''{'has_u_int32_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1496,7 +1497,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1500 "configure"
+#line 1501 "configure"
#include "confdefs.h"
#ifdef __BEOS__
@@ -1507,7 +1508,7 @@ u_int32_t foo;
int main() {return 0;}
EOF
-if { (eval echo configure:1511: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1512: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
has_u_int32_t=yes
else
@@ -1524,7 +1525,7 @@ fi
echo "$ac_t""$has_u_int32_t" 1>&6
echo $ac_n "checking for int64_t""... $ac_c" 1>&6
-echo "configure:1528: checking for int64_t" >&5
+echo "configure:1529: checking for int64_t" >&5
if eval "test \"`echo '$''{'has_int64_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1533,7 +1534,7 @@ else
else
cat > conftest.$ac_ext <<EOF
-#line 1537 "configure"
+#line 1538 "configure"
#include "confdefs.h"
#ifdef __BEOS__
@@ -1544,7 +1545,7 @@ int64_t foo;
int main() {return 0;}
EOF
-if { (eval echo configure:1548: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1549: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
has_int64_t=yes
else
@@ -1561,7 +1562,7 @@ fi
echo "$ac_t""$has_int64_t" 1>&6
echo $ac_n "checking size of short""... $ac_c" 1>&6
-echo "configure:1565: checking size of short" >&5
+echo "configure:1566: checking size of short" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1569,7 +1570,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1573 "configure"
+#line 1574 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1580,7 +1581,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1585: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_short=`cat conftestval`
else
@@ -1600,7 +1601,7 @@ EOF
echo $ac_n "checking size of int""... $ac_c" 1>&6
-echo "configure:1604: checking size of int" >&5
+echo "configure:1605: checking size of int" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1608,7 +1609,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1612 "configure"
+#line 1613 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1619,7 +1620,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_int=`cat conftestval`
else
@@ -1639,7 +1640,7 @@ EOF
echo $ac_n "checking size of long""... $ac_c" 1>&6
-echo "configure:1643: checking size of long" >&5
+echo "configure:1644: checking size of long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1647,7 +1648,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1651 "configure"
+#line 1652 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1658,7 +1659,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long=`cat conftestval`
else
@@ -1678,7 +1679,7 @@ EOF
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:1682: checking size of long long" >&5
+echo "configure:1683: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -1686,7 +1687,7 @@ else
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
else
cat > conftest.$ac_ext <<EOF
-#line 1690 "configure"
+#line 1691 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -1697,7 +1698,7 @@ main()
exit(0);
}
EOF
-if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:1702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@@ -1779,17 +1780,17 @@ fi
# We no longer use config.h
ac_safe=`echo "alloca.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for alloca.h""... $ac_c" 1>&6
-echo "configure:1783: checking for alloca.h" >&5
+echo "configure:1784: checking for alloca.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1788 "configure"
+#line 1789 "configure"
#include "confdefs.h"
#include <alloca.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1813,17 +1814,17 @@ fi
ac_safe=`echo "memory.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for memory.h""... $ac_c" 1>&6
-echo "configure:1817: checking for memory.h" >&5
+echo "configure:1818: checking for memory.h" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1822 "configure"
+#line 1823 "configure"
#include "confdefs.h"
#include <memory.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1827: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -1847,12 +1848,12 @@ fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:1851: checking for working const" >&5
+echo "configure:1852: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1856 "configure"
+#line 1857 "configure"
#include "confdefs.h"
int main() {
@@ -1901,7 +1902,7 @@ ccp = (char const *const *) p;
; return 0; }
EOF
-if { (eval echo configure:1905: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1906: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -1922,12 +1923,12 @@ EOF
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:1926: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:1927: checking whether time.h and sys/time.h may both be included" >&5
if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1931 "configure"
+#line 1932 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
@@ -1936,7 +1937,7 @@ int main() {
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:1940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
@@ -1957,12 +1958,12 @@ EOF
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:1961: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:1962: checking whether struct tm is in sys/time.h or time.h" >&5
if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 1966 "configure"
+#line 1967 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
@@ -1970,7 +1971,7 @@ int main() {
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:1974: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:1975: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
@@ -1992,7 +1993,7 @@ fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1996: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1997: checking whether ${MAKE-make} sets \${MAKE}" >&5
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
@@ -2019,7 +2020,7 @@ else
fi
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2023: checking for 8-bit clean memcmp" >&5
+echo "configure:2024: checking for 8-bit clean memcmp" >&5
if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -2027,7 +2028,7 @@ else
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 2031 "configure"
+#line 2032 "configure"
#include "confdefs.h"
main()
@@ -2037,7 +2038,7 @@ main()
}
EOF
-if { (eval echo configure:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2042: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
ac_cv_func_memcmp_clean=yes
else
@@ -2055,12 +2056,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2059: checking return type of signal handlers" >&5
+echo "configure:2060: checking return type of signal handlers" >&5
if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2064 "configure"
+#line 2065 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
@@ -2077,7 +2078,7 @@ int main() {
int i;
; return 0; }
EOF
-if { (eval echo configure:2081: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2082: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
@@ -2098,12 +2099,12 @@ EOF
for ac_func in gettimeofday select strcspn strerror strspn sigaction
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2102: checking for $ac_func" >&5
+echo "configure:2103: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 2107 "configure"
+#line 2108 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -2126,7 +2127,7 @@ $ac_func();
; return 0; }
EOF
-if { (eval echo configure:2130: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
diff --git a/lib/Makefile.in b/lib/Makefile.in
index c82532d3..79cd3981 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -1,5 +1,5 @@
# vorbis makefile configured for use with gcc on any platform
-# $Id: Makefile.in,v 1.33.4.1 2000/08/31 08:05:47 xiphmont Exp $
+# $Id: Makefile.in,v 1.33.4.2 2000/09/26 22:31:50 xiphmont Exp $
###############################################################################
# #
@@ -31,7 +31,7 @@ HFILES = ../include/vorbis/codec.h \
../include/vorbis/codebook.h \
bitwise.h envelope.h lpc.h lsp.h bookinternal.h misc.h\
psy.h smallft.h window.h scales.h os.h mdct.h registry.h\
- masking.h sharedbook.h iir.h
+ masking.h sharedbook.h iir.h lookup_data.h lookup.h
LFILES = framing.o mdct.o smallft.o block.o envelope.o window.o\
lsp.o lpc.o analysis.o synthesis.o psy.o info.o bitwise.o\
time0.o floor0.o res0.o mapping0.o registry.o\
@@ -75,7 +75,7 @@ selftest:
@./test_sharedbook
@./test_codebook
-libvorbis.a: $(LFILES)
+libvorbis.a: $(LFILES)
$(AR) -r libvorbis.a $(LFILES)
$(RANLIB) libvorbis.a
@@ -86,7 +86,7 @@ vorbisfile.a: $(VF_LFILES)
psytune: $(PSY_FILES)
$(CC) $(CFLAGS) $(LDFLAGS) $(PSY_FILES) -o $@ $(LIBS)
-$(LFILES): $(HFILES)
+$(LFILES): $(HFILES) lookup.c
$(VF_LFILES): $(VF_HFILES)
.c.o:
diff --git a/lib/bitwise.c b/lib/bitwise.c
index 305800e3..a60cd8d3 100644
--- a/lib/bitwise.c
+++ b/lib/bitwise.c
@@ -12,7 +12,7 @@
********************************************************************
function: packing variable sized words into an octet stream
- last mod: $Id: bitwise.c,v 1.12.4.1 2000/09/02 05:19:24 xiphmont Exp $
+ last mod: $Id: bitwise.c,v 1.12.4.2 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -126,21 +126,6 @@ long _oggpack_look1(oggpack_buffer *b){
return((b->ptr[0]>>b->endbit)&1);
}
-/* Read in bits without advancing the bitptr; bits <= 8 */
-/* we never return 'out of bits'; we'll handle it on _adv */
-long _oggpack_look_huff(oggpack_buffer *b,int bits){
- unsigned long ret;
- unsigned long m=mask[bits];
-
- bits+=b->endbit;
-
- ret=b->ptr[0]>>b->endbit;
- if(bits>8){
- ret|=b->ptr[1]<<(8-b->endbit);
- }
- return(m&ret);
-}
-
void _oggpack_adv(oggpack_buffer *b,int bits){
bits+=b->endbit;
b->ptr+=bits/8;
@@ -156,16 +141,6 @@ void _oggpack_adv1(oggpack_buffer *b){
}
}
-/* have to check for overflow now. return -1 on overflow */
-int _oggpack_adv_huff(oggpack_buffer *b,int bits){
- if(b->endbyte+(b->endbit+bits-1)/8>=b->storage)return(-1);
- bits+=b->endbit;
- b->ptr+=bits/8;
- b->endbyte+=bits/8;
- b->endbit=bits&7;
- return 0;
-}
-
/* bits <= 32 */
long _oggpack_read(oggpack_buffer *b,int bits){
unsigned long ret;
diff --git a/lib/bitwise.h b/lib/bitwise.h
index bf96e78b..dbb40847 100644
--- a/lib/bitwise.h
+++ b/lib/bitwise.h
@@ -12,7 +12,7 @@
********************************************************************
function: packing variable sized words into an octet stream
- last mod: $Id: bitwise.h,v 1.6.4.1 2000/09/02 05:19:24 xiphmont Exp $
+ last mod: $Id: bitwise.h,v 1.6.4.2 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -27,10 +27,8 @@ extern void _oggpack_writeclear(oggpack_buffer *b);
extern void _oggpack_readinit(oggpack_buffer *b,unsigned char *buf,int bytes);
extern void _oggpack_write(oggpack_buffer *b,unsigned long value,int bits);
extern long _oggpack_look(oggpack_buffer *b,int bits);
-extern long _oggpack_look_huff(oggpack_buffer *b,int bits);
extern long _oggpack_look1(oggpack_buffer *b);
extern void _oggpack_adv(oggpack_buffer *b,int bits);
-extern int _oggpack_adv_huff(oggpack_buffer *b,int bits);
extern void _oggpack_adv1(oggpack_buffer *b);
extern long _oggpack_read(oggpack_buffer *b,int bits);
extern long _oggpack_read1(oggpack_buffer *b);
diff --git a/lib/floor0.c b/lib/floor0.c
index b3006b54..731ea127 100644
--- a/lib/floor0.c
+++ b/lib/floor0.c
@@ -12,7 +12,7 @@
********************************************************************
function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.23.2.3 2000/09/02 05:19:25 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.23.2.4 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -160,13 +160,14 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi
the encoder may do what it wishes in filling them. They're
necessary in some mapping combinations to keep the scale spacing
accurate */
- look->linearmap=malloc(look->n*sizeof(int));
+ look->linearmap=malloc((look->n+1)*sizeof(int));
for(j=0;j<look->n;j++){
int val=floor( toBARK((info->rate/2.)/look->n*j)
*scale); /* bark numbers represent band edges */
if(val>look->ln)val=look->ln; /* guard against the approximation */
look->linearmap[j]=val;
}
+ look->linearmap[j]=-1;
look->lsp_look=malloc(look->ln*sizeof(float));
for(j=0;j<look->ln;j++)
@@ -179,7 +180,7 @@ static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi
not bottlenecked here anyway */
float _curve_to_lpc(float *curve,float *lpc,
- vorbis_look_floor0 *l,long frameno){
+ vorbis_look_floor0 *l){
/* map the input curve to a bark-scale curve for encoding */
int mapped=l->ln;
@@ -222,61 +223,11 @@ float _curve_to_lpc(float *curve,float *lpc,
for(i=bark+1;i<mapped;i++)
work[i]=work[i-1];
-#if 0
- { /******************/
- FILE *of;
- char buffer[80];
- int i;
-
- sprintf(buffer,"Fmask_%d.m",frameno);
- of=fopen(buffer,"w");
- for(i=0;i<mapped;i++)
- fprintf(of,"%g\n",work[i]);
- fclose(of);
- }
-#endif
-
return vorbis_lpc_from_curve(work,lpc,&(l->lpclook));
}
/* generate the whole freq response curve of an LSP IIR filter */
-void _lsp_to_curve(float *curve,float *lsp,float amp,
- vorbis_look_floor0 *l,char *name,long frameno){
- /* l->m+1 must be less than l->ln, but guard in case we get a bad stream */
- float *lcurve=alloca(sizeof(float)*l->ln);
- int i;
-
- if(amp==0){
- memset(curve,0,sizeof(float)*l->n);
- return;
- }
- vorbis_lsp_to_curve(lcurve,l->ln,lsp,l->m,amp,l->lsp_look);
-
- for(i=0;i<l->n;i++)curve[i]=lcurve[l->linearmap[i]];
-
-}
-
-void s_lsp_to_curve(float *curve,float *lsp,float amp,
- vorbis_look_floor0 *l,char *name,long frameno,
- float ampdB){
- /* l->m+1 must be less than l->ln, but guard in case we get a bad stream */
- float *lcurve=alloca(sizeof(double)*l->ln);
- int i;
-
- if(amp==0){
- memset(curve,0,sizeof(double)*l->n);
- return;
- }
- vorbis_lsp_to_curve(lcurve,l->ln,lsp,l->m,amp,l->lsp_look);
-
- for (i = 0; i < l->ln; i++)
- lcurve[i] = fromdB(lcurve[i]-ampdB);
- for(i=0;i<l->n;i++)curve[i]=lcurve[l->linearmap[i]];
-
-}
-
-static long seq=0;
static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
float *in,float *out){
long j;
@@ -308,7 +259,7 @@ static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
/* use 'out' as temp storage */
/* Convert our floor to a set of lpc coefficients */
- amp=sqrt(_curve_to_lpc(work,out,look,seq));
+ amp=sqrt(_curve_to_lpc(work,out,look));
/* amp is in the range (0. to ampdB]. Encode that range using
ampbits bits */
@@ -374,7 +325,6 @@ static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
last=work[j];
}
}
- _analysis_output("lsp",seq,out,look->m,0,0);
#endif
@@ -383,12 +333,12 @@ static int floor0_forward(vorbis_block *vb,vorbis_look_floor *i,
#endif
/* take the coefficients back to a spectral envelope curve */
- s_lsp_to_curve(out,work,amp,look,"Ffloor",seq++,info->ampdB);
+ vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
+ work,look->m,amp,info->ampdB);
return(1);
}
memset(out,0,sizeof(float)*look->n);
- seq++;
return(0);
}
@@ -402,22 +352,22 @@ static int floor0_inverse(vorbis_block *vb,vorbis_look_floor *i,float *out){
long maxval=(1<<info->ampbits)-1;
float amp=(float)ampraw/maxval*info->ampdB;
int booknum=_oggpack_read(&vb->opb,_ilog(info->numbooks));
+ float *lsp=alloca(sizeof(float)*look->m);
if(booknum!=-1){
codebook *b=vb->vd->fullbooks+info->books[booknum];
float last=0.;
- memset(out,0,sizeof(float)*look->m);
-
for(j=0;j<look->m;j+=b->dim)
- if(vorbis_book_decodevs(b,out+j,&vb->opb,1,-1)==-1)goto eop;
+ if(vorbis_book_decodevs(b,lsp+j,&vb->opb,1,-1)==-1)goto eop;
for(j=0;j<look->m;){
- for(k=0;k<b->dim;k++,j++)out[j]+=last;
- last=out[j-1];
+ for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
+ last=lsp[j-1];
}
/* take the coefficients back to a spectral envelope curve */
- s_lsp_to_curve(out,out,amp,look,"",0,info->ampdB);
+ vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
+ lsp,look->m,amp,info->ampdB);
return(1);
}
}
diff --git a/lib/lookup.c b/lib/lookup.c
new file mode 100644
index 00000000..e356f3f7
--- /dev/null
+++ b/lib/lookup.c
@@ -0,0 +1,92 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: lookup based functions
+ last mod: $Id: lookup.c,v 1.1.2.1 2000/09/26 22:31:50 xiphmont Exp $
+
+ ********************************************************************/
+
+#include <math.h>
+#include "lookup.h"
+#include "lookup_data.h"
+
+#ifdef FLOAT_LOOKUP
+
+/* interpolated lookup based cos function, domain 0 to PI only */
+float vorbis_coslook(float a){
+ float d=a*(.31830989*(float)COS_LOOKUP_SZ);
+ int i=d;
+ return COS_LOOKUP[i]+ (d-i)*(COS_LOOKUP[i+1]-COS_LOOKUP[i]);
+}
+
+/* interpolated 1./sqrt(p) where .5 <= p < 1. */
+float vorbis_invsqlook(float a){
+ float d=a*(2.*(float)INVSQ_LOOKUP_SZ)-(float)INVSQ_LOOKUP_SZ;
+ int i=d;
+ return INVSQ_LOOKUP[i]+ (d-i)*(INVSQ_LOOKUP[i+1]-INVSQ_LOOKUP[i]);
+}
+
+/* interpolated 1./sqrt(p) where .5 <= p < 1. */
+float vorbis_invsq2explook(int a){
+ return INVSQ2EXP_LOOKUP[a-INVSQ2EXP_LOOKUP_MIN];
+}
+
+#include <stdio.h>
+/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
+float vorbis_fromdBlook(float a){
+ int i=a*((float)(-(1<<FROMdB2_SHIFT)));
+ return (i<0)?1.:
+ ((i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))?0.:
+ FROMdB_LOOKUP[i>>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
+}
+
+#endif
+
+#ifdef INT_LOOKUP
+/* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
+ 16.16 format
+
+ returns in m.8 format */
+long vorbis_invsqlook_i(long a,long e){
+ long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
+ long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /* 0.16 */
+ long val=INVSQ_LOOKUP_I[i]- /* 1.16 */
+ (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])* /* 0.16 */
+ d)>>16); /* result 1.16 */
+
+ e+=32;
+ if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */
+ e=(e>>1)-8;
+
+ return(val>>e);
+}
+
+/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
+/* a is in n.12 format */
+float vorbis_fromdBlook_i(long a){
+ int i=(-a)>>(12-FROMdB2_SHIFT);
+ return (i<0)?1.:
+ ((i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))?0.:
+ FROMdB_LOOKUP[i>>FROMdB_SHIFT]*FROMdB2_LOOKUP[i&FROMdB2_MASK]);
+}
+
+/* interpolated lookup based cos function, domain 0 to PI only */
+/* a is in 0.16 format, where 0==0, 2^^16-1==PI, return 0.14 */
+long vorbis_coslook_i(long a){
+ int i=a>>COS_LOOKUP_I_SHIFT;
+ int d=a&COS_LOOKUP_I_MASK;
+ return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
+ COS_LOOKUP_I_SHIFT);
+}
+
+#endif
diff --git a/lib/lookup.h b/lib/lookup.h
new file mode 100644
index 00000000..368393f1
--- /dev/null
+++ b/lib/lookup.h
@@ -0,0 +1,33 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: lookup based functions
+ last mod: $Id: lookup.h,v 1.1.2.1 2000/09/26 22:31:50 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_LOOKUP_H_
+
+#ifdef FLOAT_LOOKUP
+extern float vorbis_coslook(float a);
+extern float vorbis_invsqlook(float a);
+extern float vorbis_invsq2explook(int a);
+extern float vorbis_fromdBlook(float a);
+#endif
+#ifdef INT_LOOKUP
+extern long vorbis_invsqlook_i(long a,long e);
+extern long vorbis_coslook_i(long a);
+extern float vorbis_fromdBlook_i(long a);
+#endif
+
+#endif
diff --git a/lib/lookup_data.h b/lib/lookup_data.h
new file mode 100644
index 00000000..9a5fd1d6
--- /dev/null
+++ b/lib/lookup_data.h
@@ -0,0 +1,190 @@
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: lookup data; generated by lookups.pl; edit there
+ last mod: $Id: lookup_data.h,v 1.1.2.1 2000/09/26 22:31:50 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_LOOKUP_DATA_H_
+
+#ifdef FLOAT_LOOKUP
+#define COS_LOOKUP_SZ 128
+static float COS_LOOKUP[COS_LOOKUP_SZ+1]={
+ +1.0000000000000,+0.9996988186962,+0.9987954562052,+0.9972904566787,
+ +0.9951847266722,+0.9924795345987,+0.9891765099648,+0.9852776423889,
+ +0.9807852804032,+0.9757021300385,+0.9700312531945,+0.9637760657954,
+ +0.9569403357322,+0.9495281805930,+0.9415440651830,+0.9329927988347,
+ +0.9238795325113,+0.9142097557035,+0.9039892931234,+0.8932243011955,
+ +0.8819212643484,+0.8700869911087,+0.8577286100003,+0.8448535652497,
+ +0.8314696123025,+0.8175848131516,+0.8032075314806,+0.7883464276266,
+ +0.7730104533627,+0.7572088465065,+0.7409511253550,+0.7242470829515,
+ +0.7071067811865,+0.6895405447371,+0.6715589548470,+0.6531728429538,
+ +0.6343932841636,+0.6152315905806,+0.5956993044924,+0.5758081914178,
+ +0.5555702330196,+0.5349976198871,+0.5141027441932,+0.4928981922298,
+ +0.4713967368260,+0.4496113296546,+0.4275550934303,+0.4052413140050,
+ +0.3826834323651,+0.3598950365350,+0.3368898533922,+0.3136817403989,
+ +0.2902846772545,+0.2667127574749,+0.2429801799033,+0.2191012401569,
+ +0.1950903220161,+0.1709618887603,+0.1467304744554,+0.1224106751992,
+ +0.0980171403296,+0.0735645635997,+0.0490676743274,+0.0245412285229,
+ +0.0000000000000,-0.0245412285229,-0.0490676743274,-0.0735645635997,
+ -0.0980171403296,-0.1224106751992,-0.1467304744554,-0.1709618887603,
+ -0.1950903220161,-0.2191012401569,-0.2429801799033,-0.2667127574749,
+ -0.2902846772545,-0.3136817403989,-0.3368898533922,-0.3598950365350,
+ -0.3826834323651,-0.4052413140050,-0.4275550934303,-0.4496113296546,
+ -0.4713967368260,-0.4928981922298,-0.5141027441932,-0.5349976198871,
+ -0.5555702330196,-0.5758081914178,-0.5956993044924,-0.6152315905806,
+ -0.6343932841636,-0.6531728429538,-0.6715589548470,-0.6895405447371,
+ -0.7071067811865,-0.7242470829515,-0.7409511253550,-0.7572088465065,
+ -0.7730104533627,-0.7883464276266,-0.8032075314806,-0.8175848131516,
+ -0.8314696123025,-0.8448535652497,-0.8577286100003,-0.8700869911087,
+ -0.8819212643484,-0.8932243011955,-0.9039892931234,-0.9142097557035,
+ -0.9238795325113,-0.9329927988347,-0.9415440651830,-0.9495281805930,
+ -0.9569403357322,-0.9637760657954,-0.9700312531945,-0.9757021300385,
+ -0.9807852804032,-0.9852776423889,-0.9891765099648,-0.9924795345987,
+ -0.9951847266722,-0.9972904566787,-0.9987954562052,-0.9996988186962,
+ -1.0000000000000,
+};
+
+#define INVSQ_LOOKUP_SZ 32
+static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={
+ 1.414213562373,1.392621247646,1.371988681140,1.352246807566,
+ 1.333333333333,1.315191898443,1.297771369046,1.281025230441,
+ 1.264911064067,1.249390095109,1.234426799697,1.219988562661,
+ 1.206045378311,1.192569588000,1.179535649239,1.166919931983,
+ 1.154700538379,1.142857142857,1.131370849898,1.120224067222,
+ 1.109400392450,1.098884511590,1.088662107904,1.078719779941,
+ 1.069044967650,1.059625885652,1.050451462878,1.041511287847,
+ 1.032795558989,1.024295039463,1.016001016002,1.007905261358,
+ 1.000000000000,
+};
+
+#define INVSQ2EXP_LOOKUP_MIN -32
+#define INVSQ2EXP_LOOKUP_MAX 32
+static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
+ INVSQ2EXP_LOOKUP_MIN+1]={
+ 65536, 46340.95001, 32768, 23170.47501,
+ 16384, 11585.2375, 8192, 5792.618751,
+ 4096, 2896.309376, 2048, 1448.154688,
+ 1024, 724.0773439, 512, 362.038672,
+ 256, 181.019336, 128, 90.50966799,
+ 64, 45.254834, 32, 22.627417,
+ 16, 11.3137085, 8, 5.656854249,
+ 4, 2.828427125, 2, 1.414213562,
+ 1, 0.7071067812, 0.5, 0.3535533906,
+ 0.25, 0.1767766953, 0.125, 0.08838834765,
+ 0.0625, 0.04419417382, 0.03125, 0.02209708691,
+ 0.015625, 0.01104854346, 0.0078125, 0.005524271728,
+ 0.00390625, 0.002762135864, 0.001953125, 0.001381067932,
+ 0.0009765625, 0.000690533966, 0.00048828125, 0.000345266983,
+ 0.000244140625,0.0001726334915,0.0001220703125,8.631674575e-05,
+ 6.103515625e-05,4.315837288e-05,3.051757812e-05,2.157918644e-05,
+ 1.525878906e-05,
+};
+
+#endif
+
+#define FROMdB_LOOKUP_SZ 35
+#define FROMdB2_LOOKUP_SZ 32
+#define FROMdB_SHIFT 5
+#define FROMdB2_SHIFT 3
+#define FROMdB2_MASK 31
+static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
+ 1, 0.6309573445, 0.3981071706, 0.2511886432,
+ 0.1584893192, 0.1, 0.06309573445, 0.03981071706,
+ 0.02511886432, 0.01584893192, 0.01, 0.006309573445,
+ 0.003981071706, 0.002511886432, 0.001584893192, 0.001,
+ 0.0006309573445,0.0003981071706,0.0002511886432,0.0001584893192,
+ 0.0001,6.309573445e-05,3.981071706e-05,2.511886432e-05,
+ 1.584893192e-05, 1e-05,6.309573445e-06,3.981071706e-06,
+ 2.511886432e-06,1.584893192e-06, 1e-06,6.309573445e-07,
+ 3.981071706e-07,2.511886432e-07,1.584893192e-07,
+};
+
+static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
+ 0.9928302478, 0.9786445908, 0.9646616199, 0.9508784391,
+ 0.9372921937, 0.92390007, 0.9106992942, 0.8976871324,
+ 0.8848608897, 0.8722179097, 0.8597555737, 0.8474713009,
+ 0.835362547, 0.8234268041, 0.8116616003, 0.8000644989,
+ 0.7886330981, 0.7773650302, 0.7662579617, 0.755309592,
+ 0.7445176537, 0.7338799116, 0.7233941627, 0.7130582353,
+ 0.7028699885, 0.6928273125, 0.6829281272, 0.6731703824,
+ 0.6635520573, 0.6540711597, 0.6447257262, 0.6355138211,
+};
+
+#ifdef INT_LOOKUP
+
+#define INVSQ_LOOKUP_I_SHIFT 10
+#define INVSQ_LOOKUP_I_MASK 1023
+static long INVSQ_LOOKUP_I[64+1]={
+ 92682, 91966, 91267, 90583,
+ 89915, 89261, 88621, 87995,
+ 87381, 86781, 86192, 85616,
+ 85051, 84497, 83953, 83420,
+ 82897, 82384, 81880, 81385,
+ 80899, 80422, 79953, 79492,
+ 79039, 78594, 78156, 77726,
+ 77302, 76885, 76475, 76072,
+ 75674, 75283, 74898, 74519,
+ 74146, 73778, 73415, 73058,
+ 72706, 72359, 72016, 71679,
+ 71347, 71019, 70695, 70376,
+ 70061, 69750, 69444, 69141,
+ 68842, 68548, 68256, 67969,
+ 67685, 67405, 67128, 66855,
+ 66585, 66318, 66054, 65794,
+ 65536,
+};
+
+#define COS_LOOKUP_I_SHIFT 9
+#define COS_LOOKUP_I_MASK 511
+#define COS_LOOKUP_I_SZ 128
+static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
+ 16384, 16379, 16364, 16340,
+ 16305, 16261, 16207, 16143,
+ 16069, 15986, 15893, 15791,
+ 15679, 15557, 15426, 15286,
+ 15137, 14978, 14811, 14635,
+ 14449, 14256, 14053, 13842,
+ 13623, 13395, 13160, 12916,
+ 12665, 12406, 12140, 11866,
+ 11585, 11297, 11003, 10702,
+ 10394, 10080, 9760, 9434,
+ 9102, 8765, 8423, 8076,
+ 7723, 7366, 7005, 6639,
+ 6270, 5897, 5520, 5139,
+ 4756, 4370, 3981, 3590,
+ 3196, 2801, 2404, 2006,
+ 1606, 1205, 804, 402,
+ 0, -401, -803, -1204,
+ -1605, -2005, -2403, -2800,
+ -3195, -3589, -3980, -4369,
+ -4755, -5138, -5519, -5896,
+ -6269, -6638, -7004, -7365,
+ -7722, -8075, -8422, -8764,
+ -9101, -9433, -9759, -10079,
+ -10393, -10701, -11002, -11296,
+ -11584, -11865, -12139, -12405,
+ -12664, -12915, -13159, -13394,
+ -13622, -13841, -14052, -14255,
+ -14448, -14634, -14810, -14977,
+ -15136, -15285, -15425, -15556,
+ -15678, -15790, -15892, -15985,
+ -16068, -16142, -16206, -16260,
+ -16304, -16339, -16363, -16378,
+ -16383,
+};
+
+#endif
+
+#endif
diff --git a/lib/lookups.pl b/lib/lookups.pl
new file mode 100755
index 00000000..5bc19c8d
--- /dev/null
+++ b/lib/lookups.pl
@@ -0,0 +1,143 @@
+#!/usr/bin/perl
+print <<'EOD';
+/********************************************************************
+ * *
+ * THIS FILE IS PART OF THE Ogg Vorbis SOFTWARE CODEC SOURCE CODE. *
+ * USE, DISTRIBUTION AND REPRODUCTION OF THIS SOURCE IS GOVERNED BY *
+ * THE GNU PUBLIC LICENSE 2, WHICH IS INCLUDED WITH THIS SOURCE. *
+ * PLEASE READ THESE TERMS DISTRIBUTING. *
+ * *
+ * THE OggSQUISH SOURCE CODE IS (C) COPYRIGHT 1994-2000 *
+ * by Monty <monty@xiph.org> and The XIPHOPHORUS Company *
+ * http://www.xiph.org/ *
+ * *
+ ********************************************************************
+
+ function: lookup data; generated by lookups.pl; edit there
+ last mod: $Id: lookups.pl,v 1.1.2.1 2000/09/26 22:31:50 xiphmont Exp $
+
+ ********************************************************************/
+
+#ifndef _V_LOOKUP_DATA_H_
+
+#ifdef FLOAT_LOOKUP
+EOD
+
+$cos_sz=128;
+$invsq_sz=32;
+$invsq2exp_min=-32;
+$invsq2exp_max=32;
+
+$fromdB_sz=35;
+$fromdB_shift=5;
+$fromdB2_shift=3;
+
+$invsq_i_shift=10;
+$cos_i_shift=9;
+$delta_shift=6;
+
+print "#define COS_LOOKUP_SZ $cos_sz\n";
+print "static float COS_LOOKUP[COS_LOOKUP_SZ+1]={\n";
+
+for($i=0;$i<=$cos_sz;){
+ print "\t";
+ for($j=0;$j<4 && $i<=$cos_sz;$j++){
+ printf "%+.13f,", cos(3.14159265358979323846*($i++)/$cos_sz) ;
+ }
+ print "\n";
+}
+print "};\n\n";
+
+print "#define INVSQ_LOOKUP_SZ $invsq_sz\n";
+print "static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={\n";
+
+for($i=0;$i<=$invsq_sz;){
+ print "\t";
+ for($j=0;$j<4 && $i<=$invsq_sz;$j++){
+ my$indexmap=$i++/$invsq_sz*.5+.5;
+ printf "%.12f,", 1./sqrt($indexmap);
+ }
+ print "\n";
+}
+print "};\n\n";
+
+print "#define INVSQ2EXP_LOOKUP_MIN $invsq2exp_min\n";
+print "#define INVSQ2EXP_LOOKUP_MAX $invsq2exp_max\n";
+print "static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\\\n".
+ " INVSQ2EXP_LOOKUP_MIN+1]={\n";
+
+for($i=$invsq2exp_min;$i<=$invsq2exp_max;){
+ print "\t";
+ for($j=0;$j<4 && $i<=$invsq2exp_max;$j++){
+ printf "%15.10g,", 2**($i++*-.5);
+ }
+ print "\n";
+}
+print "};\n\n#endif\n\n";
+
+
+# 0 to -140 dB
+$fromdB2_sz=1<<$fromdB_shift;
+$fromdB_gran=1<<($fromdB_shift-$fromdB2_shift);
+print "#define FROMdB_LOOKUP_SZ $fromdB_sz\n";
+print "#define FROMdB2_LOOKUP_SZ $fromdB2_sz\n";
+print "#define FROMdB_SHIFT $fromdB_shift\n";
+print "#define FROMdB2_SHIFT $fromdB2_shift\n";
+print "#define FROMdB2_MASK ".((1<<$fromdB_shift)-1)."\n";
+
+print "static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={\n";
+
+for($i=0;$i<$fromdB_sz;){
+ print "\t";
+ for($j=0;$j<4 && $i<$fromdB_sz;$j++){
+ printf "%15.10g,", 10**(.05*(-$fromdB_gran*$i++));
+ }
+ print "\n";
+}
+print "};\n\n";
+
+print "static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={\n";
+
+for($i=0;$i<$fromdB2_sz;){
+ print "\t";
+ for($j=0;$j<4 && $i<$fromdB_sz;$j++){
+ printf "%15.10g,", 10**(.05*(-$fromdB_gran/$fromdB2_sz*(.5+$i++)));
+ }
+ print "\n";
+}
+print "};\n\n#ifdef INT_LOOKUP\n\n";
+
+
+$iisz=0x10000>>$invsq_i_shift;
+print "#define INVSQ_LOOKUP_I_SHIFT $invsq_i_shift\n";
+print "#define INVSQ_LOOKUP_I_MASK ".(0x0ffff>>(16-$invsq_i_shift))."\n";
+print "static long INVSQ_LOOKUP_I[$iisz+1]={\n";
+for($i=0;$i<=$iisz;){
+ print "\t";
+ for($j=0;$j<4 && $i<=$iisz;$j++){
+ my$indexmap=$i++/$iisz*.5+.5;
+ printf "%8d,", int(1./sqrt($indexmap)*65536.+.5);
+ }
+ print "\n";
+}
+print "};\n\n";
+
+$cisz=0x10000>>$cos_i_shift;
+print "#define COS_LOOKUP_I_SHIFT $cos_i_shift\n";
+print "#define COS_LOOKUP_I_MASK ".(0x0ffff>>(16-$cos_i_shift))."\n";
+print "#define COS_LOOKUP_I_SZ $cisz\n";
+print "static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={\n";
+
+for($i=0;$i<=$cisz;){
+ print "\t";
+ for($j=0;$j<4 && $i<=$cisz;$j++){
+ printf "%8d,", int(cos(3.14159265358979323846*($i++)/$cos_sz)*16384.+.5) ;
+ }
+ print "\n";
+}
+print "};\n\n";
+
+
+print "#endif\n\n#endif\n";
+
+
diff --git a/lib/lpc.c b/lib/lpc.c
index 76d43bdc..5ceb0d52 100644
--- a/lib/lpc.c
+++ b/lib/lpc.c
@@ -12,7 +12,7 @@
********************************************************************
function: LPC low level routines
- last mod: $Id: lpc.c,v 1.25.2.1 2000/08/31 09:00:00 xiphmont Exp $
+ last mod: $Id: lpc.c,v 1.25.2.2 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -193,3 +193,8 @@ void vorbis_lpc_predict(float *coeff,float *prime,int m,
data[i]=work[o]=y;
}
}
+
+
+
+
+
diff --git a/lib/lpc.h b/lib/lpc.h
index e95712f4..d0bcf964 100644
--- a/lib/lpc.h
+++ b/lib/lpc.h
@@ -12,7 +12,7 @@
********************************************************************
function: LPC low level routines
- last mod: $Id: lpc.h,v 1.13.2.1 2000/08/31 09:00:00 xiphmont Exp $
+ last mod: $Id: lpc.h,v 1.13.2.2 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -41,5 +41,4 @@ extern float vorbis_lpc_from_curve(float *curve,float *lpc,lpc_lookup *l);
extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
float *data,long n);
-
#endif
diff --git a/lib/lsp.c b/lib/lsp.c
index 93fda5bb..1d6f572b 100644
--- a/lib/lsp.c
+++ b/lib/lsp.c
@@ -12,7 +12,7 @@
********************************************************************
function: LSP (also called LSF) conversion routines
- last mod: $Id: lsp.c,v 1.9.2.3 2000/09/02 09:39:19 xiphmont Exp $
+ last mod: $Id: lsp.c,v 1.9.2.4 2000/09/26 22:31:50 xiphmont Exp $
The LSP generation code is taken (with minimal modification) from
"On the Computation of the LSP Frequencies" by Joseph Rothweiler
@@ -38,24 +38,190 @@
#include "lsp.h"
#include "os.h"
#include "misc.h"
+#include "lookup.h"
+#include "scales.h"
-void vorbis_lsp_to_curve(float *curve,int n,float *lsp,int m,float amp,
- float *w){
- int i,j,k;
- float *coslsp=alloca(m*sizeof(float));
- for(i=0;i<m;i++)coslsp[i]=2*cos(lsp[i]);
+/* three possible LSP to f curve functions; the exact computation
+ (float), a lookup based float implementation, and an integer
+ implementation. The float lookup is likely the optimal choice on
+ any machine with an FPU. The integer implementation is *not* fixed
+ point (due to the need for a large dynamic range and thus a
+ seperately tracked exponent) and thus much more complex than the
+ relatively simple float implementations. It's mostly for future
+ work on a fully fixed point implementation for processors like the
+ ARM family. */
- for(k=0;k<n;k++){
- double p=.5;
- double q=.5;
+/* undefine both for the 'old' but more precise implementation */
+#define FLOAT_LOOKUP
+#undef INT_LOOKUP
+
+#ifdef FLOAT_LOOKUP
+#include "lookup.c" /* catch this in the build system; we #include for
+ compilers (like gcc) that can't inline across
+ modules */
+
+/* side effect: changes *lsp to cosines of lsp */
+void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
+ float amp,float ampoffset){
+ int i;
+ float wdel=M_PI/ln;
+ for(i=0;i<m;i++)lsp[i]=vorbis_coslook(lsp[i]);
+
+ i=0;
+ while(i<n){
+ int j,k=map[i];
+ int qexp;
+ float p=.7071067812;
+ float q=.7071067812;
+ float w=vorbis_coslook(wdel*k);
+
+ for(j=0;j<m;j+=2) p *= lsp[j]-w;
+ for(j=1;j<m;j+=2) q *= lsp[j]-w;
+
+ q=frexp(p*p*(1.+w)+q*q*(1.-w),&qexp);
+ q=vorbis_fromdBlook(amp*
+ vorbis_invsqlook(q)*
+ vorbis_invsq2explook(qexp+m)-
+ ampoffset);
+
+ curve[i++]=q;
+ while(map[i]==k)curve[i++]=q;
+ }
+}
+
+#else
+
+#ifdef INT_LOOKUP
+#include "lookup.c" /* catch this in the build system; we #include for
+ compilers (like gcc) that can't inline across
+ modules */
+
+static int MLOOP_1[64]={
+ 0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
+ 14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
+ 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+ 15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
+};
+
+static int MLOOP_2[64]={
+ 0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
+ 8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
+ 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
+ 9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
+};
+
+static int MLOOP_3[8]={0,1,2,2,3,3,3,3};
+
+
+/* side effect: changes *lsp to cosines of lsp */
+void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
+ float amp,float ampoffset){
+
+ /* 0 <= m < 256 */
+
+ /* set up for using all int later */
+ int i;
+ int ampoffseti=rint(ampoffset*4096.);
+ int ampi=rint(amp*16.);
+ long *ilsp=alloca(m*sizeof(long));
+ for(i=0;i<m;i++)ilsp[i]=vorbis_coslook_i(lsp[i]/M_PI*65536.+.5);
+
+ i=0;
+ while(i<n){
+ int j,k=map[i];
+ unsigned long pi=46341; /* 2**-.5 in 0.16 */
+ unsigned long qi=46341;
+ int qexp=0,shift;
+ long wi=vorbis_coslook_i(k*65536/ln);
+
+ pi*=labs(ilsp[0]-wi);
+ qi*=labs(ilsp[1]-wi);
+
+ for(j=2;j<m;j+=2){
+ if(!(shift=MLOOP_1[(pi|qi)>>25]))
+ if(!(shift=MLOOP_2[(pi|qi)>>19]))
+ shift=MLOOP_3[(pi|qi)>>16];
+ pi=(pi>>shift)*labs(ilsp[j]-wi);
+ qi=(qi>>shift)*labs(ilsp[j+1]-wi);
+ qexp+=shift;
+ }
+ if(!(shift=MLOOP_1[(pi|qi)>>25]))
+ if(!(shift=MLOOP_2[(pi|qi)>>19]))
+ shift=MLOOP_3[(pi|qi)>>16];
+ pi>>=shift;
+ qi>>=shift;
+ qexp+=shift-7*m;
+
+ /* pi,qi normalized collectively, both tracked using qexp */
+
+ /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
+ worth tracking step by step */
+
+ pi=((pi*pi)>>16);
+ qi=((qi*qi)>>16);
+ qexp=qexp*2+m;
+
+ qi*=(1<<14)-wi;
+ pi*=(1<<14)+wi;
+
+ qi=(qi+pi)>>14;
+
+ /* we've let the normalization drift because it wasn't important;
+ however, for the lookup, things must be normalized again. We
+ need at most one right shift or a number of left shifts */
+
+ if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
+ qi>>=1; qexp++;
+ }else
+ while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
+ qi<<=1; qexp--;
+ }
+
+ amp=vorbis_fromdBlook_i(ampi* /* n.4 */
+ vorbis_invsqlook_i(qi,qexp)-
+ /* m.8, m+n<=8 */
+ ampoffseti); /* 8.12[0] */
+
+ curve[i]=amp;
+ while(map[++i]==k)curve[i]=amp;
+ }
+}
+
+#else
+
+/* old, nonoptimized but simple version for any poor sap who needs to
+ figure out what the hell this code does, or wants the other tiny
+ fraction of a dB precision */
+
+/* side effect: changes *lsp to cosines of lsp */
+void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
+ float amp,float ampoffset){
+ int i;
+ float wdel=M_PI/ln;
+ for(i=0;i<m;i++)lsp[i]=2*cos(lsp[i]);
+
+ i=0;
+ while(i<n){
+ int j,k=map[i];
+ float p=.5;
+ float q=.5;
+ float w=2*cos(wdel*k);
for(j=0;j<m;j+=2){
- p*= w[k]-coslsp[j];
- q*= w[k]-coslsp[j+1];
+ p *= w-lsp[j];
+ q *= w-lsp[j+1];
}
- curve[k]=amp/sqrt(p*p*(2.+ w[k])+q*q*(2.- w[k]));
+ p*=p*(2.+w);
+ q*=q*(2.-w);
+ q=fromdB(amp/sqrt(p+q)-ampoffset);
+
+ curve[i]=q;
+ while(map[++i]==k)curve[i]=q;
}
}
+#endif
+#endif
+
static void cheby(float *g, int ord) {
int i, j;
@@ -76,13 +242,10 @@ static int comp(const void *a,const void *b){
}
/* CACM algorithm 283. */
-/* we require doubles here due to the huge spread between val/p and
- the required max error of 1.e-12, which is beyond the capabilities
- of floats */
static void cacm283(float *a,int ord,float *r){
int i, k;
- double val, p, delta, error;
- double rooti;
+ float val, p, delta, error;
+ float rooti;
for(i=0; i<ord;i++) r[i] = 2.0 * (i+0.5) / ord - 1.0;
diff --git a/lib/lsp.h b/lib/lsp.h
index 09589c75..589db25a 100644
--- a/lib/lsp.h
+++ b/lib/lsp.h
@@ -12,7 +12,7 @@
********************************************************************
function: LSP (also called LSF) conversion routines
- last mod: $Id: lsp.h,v 1.4.2.1 2000/08/31 09:00:00 xiphmont Exp $
+ last mod: $Id: lsp.h,v 1.4.2.2 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -21,8 +21,9 @@
#define _V_LSP_H_
extern void vorbis_lpc_to_lsp(float *lpc,float *lsp,int m);
-extern void vorbis_lsp_to_curve(float *curve,int n,
- float *lsp,int m,float amp,
- float *w);
+
+extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,
+ float *lsp,int m,
+ float amp,float ampoffset);
#endif
diff --git a/lib/psytune.c b/lib/psytune.c
index ecc83ff3..5c13bfba 100644
--- a/lib/psytune.c
+++ b/lib/psytune.c
@@ -13,7 +13,7 @@
function: simple utility that runs audio through the psychoacoustics
without encoding
- last mod: $Id: psytune.c,v 1.6.2.1 2000/08/31 09:00:01 xiphmont Exp $
+ last mod: $Id: psytune.c,v 1.6.2.2 2000/09/26 22:31:50 xiphmont Exp $
********************************************************************/
@@ -150,10 +150,6 @@ typedef struct {
lpc_lookup lpclook;
} vorbis_look_floor0;
-extern float _curve_to_lpc(float *curve,float *lpc,vorbis_look_floor0 *l,
- long frameno);
-extern void _lsp_to_curve(float *curve,float *lpc,float amp,
- vorbis_look_floor0 *l,char *name,long frameno);
long frameno=0;
@@ -295,16 +291,9 @@ int main(int argc,char *argv[]){
_vp_compute_mask(&p_look,pcm[i],floor,decay[i]);
- analysis("prefloor",frameno,floor,framesize/2,1,1);
+ analysis("floor",frameno,floor,framesize/2,1,1);
analysis("decay",frameno,decay[i],framesize/2,1,1);
- for(j=0;j<framesize/2;j++)floor[j]=todB(floor[j])+150;
- amp=_curve_to_lpc(floor,lpc,&floorlook,frameno);
- vorbis_lpc_to_lsp(lpc,lpc,order);
- _lsp_to_curve(floor,lpc,sqrt(amp),&floorlook,"Ffloor",frameno);
- for(j=0;j<framesize/2;j++)floor[j]=fromdB(floor[j]-150);
- analysis("floor",frameno,floor,framesize/2,1,1);
-
_vp_apply_floor(&p_look,pcm[i],floor);
/*r(j=0;j<framesize/2;j++)
if(fabs(pcm[i][j])<1.)pcm[i][j]=0;*/