From ce430766b7c16345edf7d1e19f0f9a194aee5474 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 12 Jan 2000 11:34:42 +0000 Subject: [PATCH] Incremental update toward VQ integration, vorbis_info rearrangement Monty svn path=/trunk/vorbis/; revision=234 --- configure | 298 +++++++++++++++++++++++++++++++++++++--------- configure.in | 34 +++--- include/vorbis/codebook.h | 7 +- include/vorbis/codec.h | 87 +++++++++----- include/vorbis/modes.h | 33 ++++- lib/Makefile.in | 10 +- lib/framing.c | 8 +- lib/synthesis.c | 4 +- vq/bookutil.c | 3 +- 9 files changed, 358 insertions(+), 126 deletions(-) diff --git a/configure b/configure index f4b47d8..71c1d7d 100755 --- a/configure +++ b/configure @@ -1224,10 +1224,8 @@ dummy="__noconf" # X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS" #fi -TYPESIZES="" - echo $ac_n "checking size of short""... $ac_c" 1>&6 -echo "configure:1231: checking size of short" >&5 +echo "configure:1229: 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 @@ -1235,7 +1233,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1246,7 +1244,7 @@ main() exit(0); } EOF -if { (eval echo configure:1250: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1248: \"$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 @@ -1266,7 +1264,7 @@ EOF echo $ac_n "checking size of int""... $ac_c" 1>&6 -echo "configure:1270: checking size of int" >&5 +echo "configure:1268: 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 @@ -1274,7 +1272,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1285,7 +1283,7 @@ main() exit(0); } EOF -if { (eval echo configure:1289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1287: \"$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 @@ -1305,7 +1303,7 @@ EOF echo $ac_n "checking size of long""... $ac_c" 1>&6 -echo "configure:1309: checking size of long" >&5 +echo "configure:1307: 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 @@ -1313,7 +1311,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1324,7 +1322,7 @@ main() exit(0); } EOF -if { (eval echo configure:1328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1326: \"$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 @@ -1344,7 +1342,7 @@ EOF echo $ac_n "checking size of long long""... $ac_c" 1>&6 -echo "configure:1348: checking size of long long" >&5 +echo "configure:1346: 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 @@ -1352,7 +1350,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext < main() @@ -1363,7 +1361,7 @@ main() exit(0); } EOF -if { (eval echo configure:1367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1365: \"$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 @@ -1384,30 +1382,220 @@ EOF case 2 in - $ac_cv_sizeof_short) TYPESIZES="$TYPESIZES -Dsize16='short'" - SIZE16=TRUE;; - $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize16='int'" - SIZE16=TRUE;; + $ac_cv_sizeof_short) SIZE16="short";; + $ac_cv_sizeof_int) SIZE16="int";; esac case 4 in - $ac_cv_sizeof_short) TYPESIZES="$TYPESIZES -Dsize32='short'" - SIZE32=TRUE;; - $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize32='int'" - SIZE32=TRUE;; - $ac_cv_sizeof_long) TYPESIZES="$TYPESIZES -Dsize32='long'" - SIZE32=TRUE;; + $ac_cv_sizeof_short) SIZE32="short";; + $ac_cv_sizeof_int) SIZE32="int";; + $ac_cv_sizeof_long) SIZE32="long";; esac case 8 in - $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize64='int'" - SIZE64=TRUE;; - $ac_cv_sizeof_long) TYPESIZES="$TYPESIZES -Dsize64='long'" - SIZE64=TRUE;; - $ac_cv_sizeof_long_long) TYPESIZES="$TYPESIZES -Dsize64='long long'" - SIZE64=TRUE;; + $ac_cv_sizeof_int) SIZE64="int";; + $ac_cv_sizeof_long) SIZE64="long";; + $ac_cv_sizeof_long_long) SIZE64="long long";; esac +echo $ac_n "checking for int16_t""... $ac_c" 1>&6 +echo "configure:1403: checking for int16_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])int16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_int16_t=yes +else + rm -rf conftest* + ac_cv_type_int16_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_int16_t" 1>&6 +if test $ac_cv_type_int16_t = no; then + cat >> confdefs.h <<\EOF +#define int16_t $SIZE16 +EOF + +fi + +echo $ac_n "checking for int32_t""... $ac_c" 1>&6 +echo "configure:1436: checking for int32_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_int32_t=yes +else + rm -rf conftest* + ac_cv_type_int32_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_int32_t" 1>&6 +if test $ac_cv_type_int32_t = no; then + cat >> confdefs.h <<\EOF +#define int32_t $SIZE32 +EOF + +fi + +echo $ac_n "checking for int64_t""... $ac_c" 1>&6 +echo "configure:1469: checking for int64_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_int64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])int64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_int64_t=yes +else + rm -rf conftest* + ac_cv_type_int64_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_int64_t" 1>&6 +if test $ac_cv_type_int64_t = no; then + cat >> confdefs.h <<\EOF +#define int64_t $SIZE64 +EOF + +fi + +echo $ac_n "checking for u_int16_t""... $ac_c" 1>&6 +echo "configure:1502: checking for u_int16_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_int16_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_int16_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_int16_t=yes +else + rm -rf conftest* + ac_cv_type_u_int16_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_int16_t" 1>&6 +if test $ac_cv_type_u_int16_t = no; then + cat >> confdefs.h <<\EOF +#define u_int16_t unsigned $SIZE16 +EOF + +fi + +echo $ac_n "checking for u_int32_t""... $ac_c" 1>&6 +echo "configure:1535: checking for u_int32_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_int32_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_int32_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_int32_t=yes +else + rm -rf conftest* + ac_cv_type_u_int32_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_int32_t" 1>&6 +if test $ac_cv_type_u_int32_t = no; then + cat >> confdefs.h <<\EOF +#define u_int32_t unsigned $SIZE32 +EOF + +fi + +echo $ac_n "checking for u_int64_t""... $ac_c" 1>&6 +echo "configure:1568: checking for u_int64_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_u_int64_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#if STDC_HEADERS +#include +#include +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "(^|[^a-zA-Z_0-9])u_int64_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_u_int64_t=yes +else + rm -rf conftest* + ac_cv_type_u_int64_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_u_int64_t" 1>&6 +if test $ac_cv_type_u_int64_t = no; then + cat >> confdefs.h <<\EOF +#define u_int64_t unsigned $SIZE64 +EOF + +fi + if test -z "$SIZE16"; then { echo "configure: error: No 16 bit type found on this platform!" 1>&2; exit 1; } @@ -1420,12 +1608,12 @@ if test -z "$SIZE64"; then fi echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:1424: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:1612: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1441,7 +1629,7 @@ wait (&s); s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:1445: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1633: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -1465,17 +1653,17 @@ for ac_hdr in fcntl.h limits.h sys/ioctl.h sys/time.h unistd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1469: checking for $ac_hdr" >&5 +echo "configure:1657: checking for $ac_hdr" >&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 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1479: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1667: \"$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* @@ -1503,12 +1691,12 @@ done echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1507: checking for working const" >&5 +echo "configure:1695: 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 <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1749: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1578,12 +1766,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:1582: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:1770: 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 < #include @@ -1592,7 +1780,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:1596: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -1613,12 +1801,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:1617: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:1805: 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 < #include @@ -1626,7 +1814,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:1630: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1818: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -1648,7 +1836,7 @@ fi echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:1652: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:1840: 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 @@ -1675,7 +1863,7 @@ else fi echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6 -echo "configure:1679: checking for 8-bit clean memcmp" >&5 +echo "configure:1867: 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 @@ -1683,7 +1871,7 @@ else ac_cv_func_memcmp_clean=no else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1885: \"$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 @@ -1711,12 +1899,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:1715: checking return type of signal handlers" >&5 +echo "configure:1903: 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 < #include @@ -1733,7 +1921,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1737: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1754,12 +1942,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:1758: checking for $ac_func" >&5 +echo "configure:1946: 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 <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1974: \"$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/configure.in b/configure.in index ce579a3..d330830 100644 --- a/configure.in +++ b/configure.in @@ -1,4 +1,4 @@ -# $Id: configure.in,v 1.8 1999/12/30 07:26:25 xiphmont Exp $ +# $Id: configure.in,v 1.9 2000/01/12 11:34:34 xiphmont Exp $ AC_INIT(lib/mdct.c) #AC_CONFIG_HEADER(config.h) @@ -119,38 +119,34 @@ dummy="__noconf" # X_LIBS="-L${srcdir}/libgtk/gtk/.libs -L${srcdir}/libgtk/gdk/.libs -L${srcdir}/libgtk/glib/.libs $X_LIBS" #fi -TYPESIZES="" - AC_CHECK_SIZEOF(short) AC_CHECK_SIZEOF(int) AC_CHECK_SIZEOF(long) AC_CHECK_SIZEOF(long long) case 2 in - $ac_cv_sizeof_short) TYPESIZES="$TYPESIZES -Dsize16='short'" - SIZE16=TRUE;; - $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize16='int'" - SIZE16=TRUE;; + $ac_cv_sizeof_short) SIZE16="short";; + $ac_cv_sizeof_int) SIZE16="int";; esac case 4 in - $ac_cv_sizeof_short) TYPESIZES="$TYPESIZES -Dsize32='short'" - SIZE32=TRUE;; - $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize32='int'" - SIZE32=TRUE;; - $ac_cv_sizeof_long) TYPESIZES="$TYPESIZES -Dsize32='long'" - SIZE32=TRUE;; + $ac_cv_sizeof_short) SIZE32="short";; + $ac_cv_sizeof_int) SIZE32="int";; + $ac_cv_sizeof_long) SIZE32="long";; esac case 8 in - $ac_cv_sizeof_int) TYPESIZES="$TYPESIZES -Dsize64='int'" - SIZE64=TRUE;; - $ac_cv_sizeof_long) TYPESIZES="$TYPESIZES -Dsize64='long'" - SIZE64=TRUE;; - $ac_cv_sizeof_long_long) TYPESIZES="$TYPESIZES -Dsize64='long long'" - SIZE64=TRUE;; + $ac_cv_sizeof_int) SIZE64="int";; + $ac_cv_sizeof_long) SIZE64="long";; + $ac_cv_sizeof_long_long) SIZE64="long long";; esac +AC_CHECK_TYPE(int16_t,$SIZE16) +AC_CHECK_TYPE(int32_t,$SIZE32) +AC_CHECK_TYPE(int64_t,$SIZE64) +AC_CHECK_TYPE(u_int16_t,unsigned $SIZE16) +AC_CHECK_TYPE(u_int32_t,unsigned $SIZE32) +AC_CHECK_TYPE(u_int64_t,unsigned $SIZE64) if test -z "$SIZE16"; then AC_MSG_ERROR(No 16 bit type found on this platform!) diff --git a/include/vorbis/codebook.h b/include/vorbis/codebook.h index 9132561..59d3bed 100644 --- a/include/vorbis/codebook.h +++ b/include/vorbis/codebook.h @@ -12,7 +12,7 @@ ******************************************************************** function: codebook types - last mod: $Id: codebook.h,v 1.1 2000/01/05 03:10:47 xiphmont Exp $ + last mod: $Id: codebook.h,v 1.2 2000/01/12 11:34:35 xiphmont Exp $ ********************************************************************/ @@ -59,8 +59,6 @@ typedef struct encode_aux{ long *ptr0; long *ptr1; - double *n; /* decision hyperplanes: sum(x_i*n_i)[0<=i /* get BSD style 16/32/64 bit types */ - -/* if no BSD width types, get them from the configure script */ -#ifndef int64_t -# define int64_t size64 -#endif -#ifndef int32_t -# define int32_t size32 -#endif -#ifndef int16_t -# define int16_t size16 -#endif - +#include #include "vorbis/codebook.h" #include "vorbis/internal.h" @@ -41,6 +29,32 @@ #define MAX_BARK 27 +/* not used yet */ +typedef struct vorbis_info_time{ +}vorbis_info_time; + +typedef struct vorbis_info_floor{ + int order; + long rate; + long barkmap; + int stages; + int *books; +} vorbis_info_floor; + +typedef struct vorbis_info_res{ + long begin; + long end; + + int stages; + int *books; +} vorbis_info_res; + +typedef struct vorbis_psysettings{ + double maskthresh[MAX_BARK]; + double lrolldB; + double hrolldB; +} vorbis_psysettings; + typedef struct vorbis_info{ int channels; long rate; @@ -65,38 +79,45 @@ typedef struct vorbis_info{ long bitrate_nominal; long bitrate_lower; + /* unlimited user comment fields. libvorbis writes 'libvorbis' + whatever vedor is set to in encode */ char **user_comments; int comments; char *vendor; + /* short and long block sizes */ int blocksize[2]; - int floororder[2]; - int floormap[2]; - int floorch; + /* no mapping so no balance yet */ + int channelmapping[2]; /* mapping type: 0 == (independant channel) */ - /* int smallblock; - int largeblock; - int floororder; - int flooroctaves; - int floorch;*/ + /* time domain setup */ + int timech; + vorbis_info_time *times[2]; - /* no mapping, coupling, balance yet. */ + /* mdct domain floor setup */ + int floorch; + vorbis_info_floor *floors[2]; /* [long,short][floorchannel] */ - /*int balanceorder; - int balanceoctaves; - this would likely need to be by channel and blocksize anyway*/ + /* mdct domain residue setup */ + int residuech; + vorbis_info_res *residues[2]; - /* Encode-side settings for analysis */ + /* Codebook storage for encode and decode. Encode side is submitted + by the client (and memory must be managed by the client), decode + side is allocated by header_in */ + codebook *booklist; + int books; - int envelopesa; + /* Encode-side settings for analysis. different mappings use them + differently. */ + vorbis_psysettings *psy; + + /* for block long/sort tuning */ + int envelopesa; double preecho_thresh; double preecho_clamp; - double maskthresh[MAX_BARK]; - double lrolldB; - double hrolldB; - /* local storage, only used on the encoding size. This way the application does not need to worry about freeing some packets' memory and not others'. Packet storage is always tracked */ @@ -104,6 +125,8 @@ typedef struct vorbis_info{ char *header1; char *header2; + int freeall; /* codebooks submitted or malloced? */ + } vorbis_info; /* ogg_page is used to encapsulate the data in one Ogg bitstream page *****/ diff --git a/include/vorbis/modes.h b/include/vorbis/modes.h index 62fc98c..dc3834c 100644 --- a/include/vorbis/modes.h +++ b/include/vorbis/modes.h @@ -12,7 +12,7 @@ ******************************************************************** function: predefined encoding modes - last mod: $Id: modes.h,v 1.1 2000/01/05 03:10:47 xiphmont Exp $ + last mod: $Id: modes.h,v 1.2 2000/01/12 11:34:38 xiphmont Exp $ ********************************************************************/ @@ -21,6 +21,14 @@ #include #include "vorbis/codec.h" +#include "vorbis/book/lsp20_0a.h" +#include "vorbis/book/lsp20_0b.h" +#include "vorbis/book/lsp32_0a.h" +#include "vorbis/book/lsp32_0b.h" + +static int _intvector_0_15[]={0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}; +static *codebook _bookvector0[4]={_vq_book_lsp20_0a,_vq_book_lsp20_0b, + _vq_book_lsp32_0a,_vq_book_lsp32_0b}; /* 0 1 2 3 4 5 6 7 8 9 @@ -38,11 +46,23 @@ vorbis_info predef_modes[]={ /* channels, sample rate, upperkbps, nominalkbps, lowerkbps */ { 2, 44100, 0,0,0, /* dummy, dummy, dummy, dummy */ - 0, NULL, 0, NULL, - /* smallblock, largeblock, LPC order (small, large) */ - {256, 2048}, {20,32}, - /* {bark mapping size}, spectral channels */ - {64,256}, 2, + NULL, 0, NULL, + /* smallblock, largeblock */ + {256, 2048}, + + /* LSP/LPC order (small, large), LPC bark mapping size, floor channels */ + {20,32}, {64,256}, 2, + /* LSP encoding */ + 2, _intvector_0_15, 2, _intvector_0_15+2, + + /* channel mapping. Right now, no balance, no coupling */ + {0,0}, + + /* residue encoding */ + + /* codebooks */ + _bookvector0, 4, + /* thresh sample period, preecho clamp trigger threshhold, range, dummy */ 64, 10, 2, /* tone masking curve dB attenuation levels [27] */ @@ -51,6 +71,7 @@ vorbis_info predef_modes[]={ -12, -10, -8, -6, -6, -6, -4}, /* tone masking rolloff settings (dB per octave), octave bias */ 24,10, + NULL,NULL,NULL}, }; diff --git a/lib/Makefile.in b/lib/Makefile.in index 784714c..2c54bee 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -1,6 +1,6 @@ # vorbis makefile configured for use with gcc on any platform -# $Id: Makefile.in,v 1.20 2000/01/05 03:10:52 xiphmont Exp $ +# $Id: Makefile.in,v 1.21 2000/01/12 11:34:39 xiphmont Exp $ ############################################################################### # # @@ -28,11 +28,11 @@ RANLIB=@RANLIB@ LIBS=@LIBS@ -lm HFILES = ../include/vorbis/codec.h ../include/vorbis/vorbisfile.h \ - bitwise.h envelope.h lpc.h lsp.h \ + bitwise.h envelope.h lpc.h lsp.h bookinternal.h\ psy.h smallft.h window.h scales.h os.h mdct.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\ - spectrum.o vorbisfile.o + spectrum.o codebook.o vorbisfile.o all: $(MAKE) target CFLAGS="$(OPT)" @@ -53,9 +53,13 @@ selftest: $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST framing.c -o test_framing $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST bitwise.c\ -o test_bitwise -lm + $(CC) $(DEBUG) $(LDFLAGS) -c bitwise.c + $(CC) $(DEBUG) $(LDFLAGS) -D_V_SELFTEST codebook.c bitwise.o\ + -o test_codebook -lm @echo @./test_framing @./test_bitwise + @./test_codebook libvorbis.a: $(LFILES) $(AR) -r libvorbis.a $^ diff --git a/lib/framing.c b/lib/framing.c index 2e8b828..30fe802 100644 --- a/lib/framing.c +++ b/lib/framing.c @@ -13,7 +13,7 @@ function: code raw [Vorbis] packets into framed OggSquish stream and decode Ogg streams back into raw packets - last mod: $Id: framing.c,v 1.13 2000/01/05 03:10:57 xiphmont Exp $ + last mod: $Id: framing.c,v 1.14 2000/01/12 11:34:40 xiphmont Exp $ note: The CRC code is directly derived from public domain code by Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html @@ -72,10 +72,10 @@ int ogg_page_pageno(ogg_page *og){ /* helper to initialize lookup for direct-table CRC */ -static unsigned int32_t crc_lookup[256]; +static u_int32_t crc_lookup[256]; static int crc_ready=0; -static unsigned int32_t _ogg_crc_entry(unsigned long index){ +static u_int32_t _ogg_crc_entry(unsigned long index){ int i; unsigned long r; @@ -169,7 +169,7 @@ static void _os_lacing_expand(ogg_stream_state *os,int needed){ perform the checksum silmultaneously with other copies */ static void _os_checksum(ogg_page *og){ - unsigned int32_t crc_reg=0; + u_int32_t crc_reg=0; int i; for(i=0;iheader_len;i++) diff --git a/lib/synthesis.c b/lib/synthesis.c index 91b045f..ccd13c1 100644 --- a/lib/synthesis.c +++ b/lib/synthesis.c @@ -12,7 +12,7 @@ ******************************************************************** function: single-block PCM synthesis - last mod: $Id: synthesis.c,v 1.11 2000/01/05 03:11:04 xiphmont Exp $ + last mod: $Id: synthesis.c,v 1.12 2000/01/12 11:34:41 xiphmont Exp $ ********************************************************************/ @@ -68,7 +68,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ n=vb->pcmend=vi->blocksize[vb->W]; /* No envelope encoding yet */ - _oggpack_write(opb,0,1); + _oggpack_read(opb,0,1); for(i=0;ichannels;i++){ double *lpc=vb->lpc[i]; diff --git a/vq/bookutil.c b/vq/bookutil.c index 21c4689..f3dc5ad 100644 --- a/vq/bookutil.c +++ b/vq/bookutil.c @@ -12,7 +12,7 @@ ******************************************************************** function: utility functions for loading .vqh and .vqd files - last mod: $Id: bookutil.c,v 1.4 2000/01/10 10:42:01 xiphmont Exp $ + last mod: $Id: bookutil.c,v 1.5 2000/01/12 11:34:42 xiphmont Exp $ ********************************************************************/ @@ -335,7 +335,6 @@ int codebook_entry(codebook *b,double *val){ /* 24 bit float (not IEEE; nonnormalized mantissa + biased exponent ): neeeeemm mmmmmmmm mmmmmmmm */ -#define VQ_FEXP_BIAS 20 /* bias toward values smaller than 1. */ long float24_pack(double val){ int sign=0; long exp; -- 2.7.4