Switch to the lowmem tremor branch
in addition to using slightly less memory, this branch also doesn't seem to have the same issues with `-O2` builds that the main branch has.
This commit is contained in:
@@ -2,9 +2,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
idf_component_register(
|
||||
SRCS block.c codebook.c floor0.c floor1.c info.c mapping0.c mdct.c registry.c
|
||||
res012.c sharedbook.c synthesis.c vorbisfile.c window.c
|
||||
INCLUDE_DIRS "."
|
||||
REQUIRES "ogg")
|
||||
|
||||
target_compile_options("${COMPONENT_LIB}" PRIVATE -Og)
|
||||
SRCS bitwise.c codebook.c dsp.c floor0.c floor1.c floor_lookup.c framing.c
|
||||
info.c mapping0.c mdct.c misc.c res012.c vorbisfile.c
|
||||
INCLUDE_DIRS ".")
|
||||
target_compile_options("${COMPONENT_LIB}" PRIVATE -Wno-error=misleading-indentation -Wno-error=maybe-uninitialized -Wno-error=char-subscripts -Wno-error=unused-label)
|
||||
|
||||
+12
-19
@@ -1,50 +1,43 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
INCLUDES = -I./ @OGG_CFLAGS@
|
||||
INCLUDES = -I./
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = vorbisidec.pc
|
||||
|
||||
lib_LTLIBRARIES = libvorbisidec.la
|
||||
|
||||
libvorbisidec_la_SOURCES = mdct.c block.c window.c \
|
||||
synthesis.c info.c \
|
||||
libvorbisidec_la_SOURCES = mdct.c dsp.c info.c misc.c \
|
||||
floor1.c floor0.c vorbisfile.c \
|
||||
res012.c mapping0.c registry.c codebook.c \
|
||||
sharedbook.c \
|
||||
res012.c mapping0.c codebook.c \
|
||||
framing.c bitwise.c \
|
||||
codebook.h misc.h mdct_lookup.h\
|
||||
os.h mdct.h block.h ivorbisfile.h lsp_lookup.h\
|
||||
registry.h window.h window_lookup.h\
|
||||
codec_internal.h backends.h \
|
||||
os.h mdct.h ivorbisfile.h lsp_lookup.h\
|
||||
window_lookup.h floor_lookup.c \
|
||||
codec_internal.h ogg.h \
|
||||
asm_arm.h ivorbiscodec.h
|
||||
libvorbisidec_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
|
||||
libvorbisidec_la_LIBADD = @OGG_LIBS@
|
||||
|
||||
EXTRA_PROGRAMS = ivorbisfile_example iseeking_example
|
||||
EXTRA_PROGRAMS = ivorbisfile_example
|
||||
CLEANFILES = $(EXTRA_PROGRAMS) $(lib_LTLIBRARIES)
|
||||
|
||||
ivorbisfile_example_SOURCES = ivorbisfile_example.c
|
||||
ivorbisfile_example_LDFLAGS = -static
|
||||
ivorbisfile_example_LDADD = libvorbisidec.la @OGG_LIBS@
|
||||
|
||||
iseeking_example_SOURCES = iseeking_example.c
|
||||
iseeking_example_LDFLAGS = -static
|
||||
iseeking_example_LDADD = libvorbisidec.la @OGG_LIBS@
|
||||
ivorbisfile_example_LDADD = libvorbisidec.la
|
||||
|
||||
includedir = $(prefix)/include/tremor
|
||||
|
||||
include_HEADERS = ivorbiscodec.h ivorbisfile.h config_types.h
|
||||
include_HEADERS = ivorbiscodec.h ivorbisfile.h ogg.h os_types.h config_types.h
|
||||
|
||||
EXTRA_DIST = vorbisidec.pc.in \
|
||||
$(srcdir)/doc/*.html $(srcdir)/win32/VS*/libtremor/*.vcproj
|
||||
$(srcdir)/doc/*.html
|
||||
|
||||
example:
|
||||
-ln -fs . vorbis
|
||||
$(MAKE) ivorbisfile_example
|
||||
$(MAKE) iseeking_example
|
||||
|
||||
debug:
|
||||
$(MAKE) all CFLAGS="@DEBUG@"
|
||||
$(MAKE) all CFLAGS="@DEBUG@"
|
||||
|
||||
profile:
|
||||
$(MAKE) all CFLAGS="@PROFILE@"
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
Add explicit 64 bit integer support rather than relying on compiler
|
||||
Roll in optional use of bounded heap memory manager
|
||||
@@ -51,7 +51,6 @@
|
||||
vorbis_synthesis_init;
|
||||
vorbis_synthesis_restart;
|
||||
vorbis_synthesis;
|
||||
vorbis_synthesis_trackonly;
|
||||
vorbis_synthesis_blockin;
|
||||
vorbis_synthesis_pcmout;
|
||||
vorbis_synthesis_read;
|
||||
|
||||
+28
-30
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -20,7 +20,7 @@
|
||||
#if !defined(_V_WIDE_MATH) && !defined(_LOW_ACCURACY_)
|
||||
#define _V_WIDE_MATH
|
||||
|
||||
static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT32(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
int lo,hi;
|
||||
asm volatile("smull\t%0, %1, %2, %3"
|
||||
: "=&r"(lo),"=&r"(hi)
|
||||
@@ -29,11 +29,11 @@ static inline ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
|
||||
return(hi);
|
||||
}
|
||||
|
||||
static inline ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT31(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
return MULT32(x,y)<<1;
|
||||
}
|
||||
|
||||
static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT31_SHIFT15(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
int lo,hi;
|
||||
asm volatile("smull %0, %1, %2, %3\n\t"
|
||||
"movs %0, %0, lsr #15\n\t"
|
||||
@@ -46,9 +46,9 @@ static inline ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
|
||||
|
||||
#define MB() asm volatile ("" : : : "memory")
|
||||
|
||||
static inline void XPROD32(ogg_int32_t a, ogg_int32_t b,
|
||||
ogg_int32_t t, ogg_int32_t v,
|
||||
ogg_int32_t *x, ogg_int32_t *y)
|
||||
static inline void XPROD32(tremor_ogg_int32_t a, tremor_ogg_int32_t b,
|
||||
tremor_ogg_int32_t t, tremor_ogg_int32_t v,
|
||||
tremor_ogg_int32_t *x, tremor_ogg_int32_t *y)
|
||||
{
|
||||
int x1, y1, l;
|
||||
asm( "smull %0, %1, %4, %6\n\t"
|
||||
@@ -64,9 +64,9 @@ static inline void XPROD32(ogg_int32_t a, ogg_int32_t b,
|
||||
*y = y1;
|
||||
}
|
||||
|
||||
static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
ogg_int32_t t, ogg_int32_t v,
|
||||
ogg_int32_t *x, ogg_int32_t *y)
|
||||
static inline void XPROD31(tremor_ogg_int32_t a, tremor_ogg_int32_t b,
|
||||
tremor_ogg_int32_t t, tremor_ogg_int32_t v,
|
||||
tremor_ogg_int32_t *x, tremor_ogg_int32_t *y)
|
||||
{
|
||||
int x1, y1, l;
|
||||
asm( "smull %0, %1, %4, %6\n\t"
|
||||
@@ -82,9 +82,9 @@ static inline void XPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
*y = y1 << 1;
|
||||
}
|
||||
|
||||
static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
ogg_int32_t t, ogg_int32_t v,
|
||||
ogg_int32_t *x, ogg_int32_t *y)
|
||||
static inline void XNPROD31(tremor_ogg_int32_t a, tremor_ogg_int32_t b,
|
||||
tremor_ogg_int32_t t, tremor_ogg_int32_t v,
|
||||
tremor_ogg_int32_t *x, tremor_ogg_int32_t *y)
|
||||
{
|
||||
int x1, y1, l;
|
||||
asm( "rsb %2, %4, #0\n\t"
|
||||
@@ -105,7 +105,7 @@ static inline void XNPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
#ifndef _V_CLIP_MATH
|
||||
#define _V_CLIP_MATH
|
||||
|
||||
static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
|
||||
static inline tremor_ogg_int32_t CLIP_TO_15(tremor_ogg_int32_t x) {
|
||||
int tmp;
|
||||
asm volatile("subs %1, %0, #32768\n\t"
|
||||
"movpl %0, #0x7f00\n\t"
|
||||
@@ -123,18 +123,17 @@ static inline ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
|
||||
#ifndef _V_LSP_MATH_ASM
|
||||
#define _V_LSP_MATH_ASM
|
||||
|
||||
static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
|
||||
ogg_int32_t *qexpp,
|
||||
ogg_int32_t *ilsp,ogg_int32_t wi,
|
||||
ogg_int32_t m){
|
||||
static inline void lsp_loop_asm(tremor_ogg_uint32_t *qip,tremor_ogg_uint32_t *pip,
|
||||
tremor_ogg_int32_t *qexpp,
|
||||
tremor_ogg_int32_t *ilsp,tremor_ogg_int32_t wi,
|
||||
tremor_ogg_int32_t m){
|
||||
|
||||
ogg_uint32_t qi=*qip,pi=*pip;
|
||||
ogg_int32_t qexp=*qexpp;
|
||||
tremor_ogg_uint32_t qi=*qip,pi=*pip;
|
||||
tremor_ogg_int32_t qexp=*qexpp;
|
||||
|
||||
asm("mov r0,%3;"
|
||||
"movs r1,%5,asr#1;"
|
||||
"mov r1,%5,asr#1;"
|
||||
"add r0,r0,r1,lsl#3;"
|
||||
"beq 2f;\n"
|
||||
"1:"
|
||||
|
||||
"ldmdb r0!,{r1,r3};"
|
||||
@@ -157,10 +156,9 @@ static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
|
||||
"cmp r0,%3;\n"
|
||||
"bhi 1b;\n"
|
||||
|
||||
"2:"
|
||||
// odd filter assymetry
|
||||
"ands r0,%5,#1;\n"
|
||||
"beq 3f;\n"
|
||||
"beq 2f;\n"
|
||||
"add r0,%3,%5,lsl#2;\n"
|
||||
|
||||
"ldr r1,[r0,#-4];\n"
|
||||
@@ -172,7 +170,7 @@ static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
|
||||
"umull %1,r3,r0,%1;\n" //pi*=labs(ilsp[j+1]-wi)
|
||||
|
||||
"cmn r2,r3;\n" // shift down 16?
|
||||
"beq 3f;\n"
|
||||
"beq 2f;\n"
|
||||
"add %2,%2,#16;\n"
|
||||
"mov %0,%0,lsr #16;\n"
|
||||
"orr %0,%0,r2,lsl #16;\n"
|
||||
@@ -186,7 +184,7 @@ static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
|
||||
//}
|
||||
|
||||
/* normalize to max 16 sig figs */
|
||||
"3:"
|
||||
"2:"
|
||||
"mov r2,#0;"
|
||||
"orr r1,%0,%1;"
|
||||
"tst r1,#0xff000000;"
|
||||
@@ -216,10 +214,10 @@ static inline void lsp_loop_asm(ogg_uint32_t *qip,ogg_uint32_t *pip,
|
||||
*qexpp=qexp;
|
||||
}
|
||||
|
||||
static inline void lsp_norm_asm(ogg_uint32_t *qip,ogg_int32_t *qexpp){
|
||||
static inline void lsp_norm_asm(tremor_ogg_uint32_t *qip,tremor_ogg_int32_t *qexpp){
|
||||
|
||||
ogg_uint32_t qi=*qip;
|
||||
ogg_int32_t qexp=*qexpp;
|
||||
tremor_ogg_uint32_t qi=*qip;
|
||||
tremor_ogg_int32_t qexp=*qexpp;
|
||||
|
||||
asm("tst %0,#0x0000ff00;"
|
||||
"moveq %0,%0,lsl #8;"
|
||||
|
||||
+15
-74
@@ -2,16 +2,14 @@
|
||||
# Run this to set up the build system: configure, makefiles, etc.
|
||||
# (based on the version in enlightenment's cvs)
|
||||
|
||||
package="vorbisdec"
|
||||
package="vorbisidec"
|
||||
|
||||
olddir=`pwd`
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
cd "$srcdir"
|
||||
DIE=0
|
||||
|
||||
echo "checking for autoconf... "
|
||||
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have autoconf installed to compile $package."
|
||||
@@ -20,72 +18,16 @@ echo "checking for autoconf... "
|
||||
DIE=1
|
||||
}
|
||||
|
||||
VERSIONGREP="sed -e s/.*[^0-9\.]\([0-9]\.[0-9]\).*/\1/"
|
||||
VERSIONMKINT="sed -e s/[^0-9]//"
|
||||
|
||||
# do we need automake?
|
||||
if test -r Makefile.am; then
|
||||
AM_OPTIONS=`fgrep AUTOMAKE_OPTIONS Makefile.am`
|
||||
AM_NEEDED=`echo $AM_OPTIONS | $VERSIONGREP`
|
||||
if test x"$AM_NEEDED" = "x$AM_OPTIONS"; then
|
||||
AM_NEEDED=""
|
||||
fi
|
||||
if test -z $AM_NEEDED; then
|
||||
echo -n "checking for automake... "
|
||||
AUTOMAKE=automake
|
||||
ACLOCAL=aclocal
|
||||
if ($AUTOMAKE --version < /dev/null > /dev/null 2>&1); then
|
||||
echo "yes"
|
||||
else
|
||||
echo "no"
|
||||
AUTOMAKE=
|
||||
fi
|
||||
else
|
||||
echo -n "checking for automake $AM_NEEDED or later... "
|
||||
for am in automake-$AM_NEEDED automake$AM_NEEDED automake; do
|
||||
($am --version < /dev/null > /dev/null 2>&1) || continue
|
||||
ver=`$am --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
|
||||
verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
|
||||
if test $ver -ge $verneeded; then
|
||||
AUTOMAKE=$am
|
||||
echo $AUTOMAKE
|
||||
break
|
||||
fi
|
||||
done
|
||||
test -z $AUTOMAKE && echo "no"
|
||||
echo -n "checking for aclocal $AM_NEEDED or later... "
|
||||
for ac in aclocal-$AM_NEEDED aclocal$AM_NEEDED aclocal; do
|
||||
($ac --version < /dev/null > /dev/null 2>&1) || continue
|
||||
ver=`$ac --version < /dev/null | head -n 1 | $VERSIONGREP | $VERSIONMKINT`
|
||||
verneeded=`echo $AM_NEEDED | $VERSIONMKINT`
|
||||
if test $ver -ge $verneeded; then
|
||||
ACLOCAL=$ac
|
||||
echo $ACLOCAL
|
||||
break
|
||||
fi
|
||||
done
|
||||
test -z $ACLOCAL && echo "no"
|
||||
fi
|
||||
test -z $AUTOMAKE || test -z $ACLOCAL && {
|
||||
(automake --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have automake installed to compile $package."
|
||||
echo "Download the appropriate package for your distribution,"
|
||||
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
echo "Download the appropriate package for your system,"
|
||||
echo "or get the source from one of the GNU ftp sites"
|
||||
echo "listed in http://www.gnu.org/order/ftp.html"
|
||||
DIE=1
|
||||
}
|
||||
|
||||
echo -n "checking for libtool... "
|
||||
for LIBTOOLIZE in libtoolize glibtoolize nope; do
|
||||
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 && break
|
||||
done
|
||||
if test x$LIBTOOLIZE = xnope; then
|
||||
echo "nope."
|
||||
LIBTOOLIZE=libtoolize
|
||||
else
|
||||
echo $LIBTOOLIZE
|
||||
fi
|
||||
($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
|
||||
(libtool --version) < /dev/null > /dev/null 2>&1 || {
|
||||
echo
|
||||
echo "You must have libtool installed to compile $package."
|
||||
echo "Download the appropriate package for your system,"
|
||||
@@ -105,16 +47,15 @@ fi
|
||||
|
||||
echo "Generating configuration files for $package, please wait...."
|
||||
|
||||
echo " $ACLOCAL $ACLOCAL_FLAGS"
|
||||
$ACLOCAL $ACLOCAL_FLAGS || exit 1
|
||||
echo " $LIBTOOLIZE --automake"
|
||||
$LIBTOOLIZE --automake || exit 1
|
||||
echo " aclocal $ACLOCAL_FLAGS"
|
||||
aclocal $ACLOCAL_FLAGS || exit 1
|
||||
echo " autoheader"
|
||||
autoheader || exit 1
|
||||
echo " $AUTOMAKE --add-missing $AUTOMAKE_FLAGS"
|
||||
$AUTOMAKE --add-missing $AUTOMAKE_FLAGS || exit 1
|
||||
echo " libtoolize --automake"
|
||||
libtoolize --automake || exit 1
|
||||
echo " automake --add-missing $AUTOMAKE_FLAGS"
|
||||
automake --add-missing $AUTOMAKE_FLAGS || exit 1
|
||||
echo " autoconf"
|
||||
autoconf || exit 1
|
||||
|
||||
cd $olddir
|
||||
$srcdir/configure --enable-maintainer-mode "$@" && echo
|
||||
$srcdir/configure "$@" && echo
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: backend and mapping structures
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* this is exposed up here because we need it for static modes.
|
||||
Lookups for each backend aren't exposed because there's no reason
|
||||
to do so */
|
||||
|
||||
#ifndef _vorbis_backend_h_
|
||||
#define _vorbis_backend_h_
|
||||
|
||||
#include "codec_internal.h"
|
||||
|
||||
/* this would all be simpler/shorter with templates, but.... */
|
||||
/* Transform backend generic *************************************/
|
||||
|
||||
/* only mdct right now. Flesh it out more if we ever transcend mdct
|
||||
in the transform domain */
|
||||
|
||||
/* Floor backend generic *****************************************/
|
||||
typedef struct{
|
||||
vorbis_info_floor *(*unpack)(vorbis_info *,oggpack_buffer *);
|
||||
vorbis_look_floor *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
|
||||
vorbis_info_floor *);
|
||||
void (*free_info) (vorbis_info_floor *);
|
||||
void (*free_look) (vorbis_look_floor *);
|
||||
void *(*inverse1) (struct vorbis_block *,vorbis_look_floor *);
|
||||
int (*inverse2) (struct vorbis_block *,vorbis_look_floor *,
|
||||
void *buffer,ogg_int32_t *);
|
||||
} vorbis_func_floor;
|
||||
|
||||
typedef struct{
|
||||
int order;
|
||||
long rate;
|
||||
long barkmap;
|
||||
|
||||
int ampbits;
|
||||
int ampdB;
|
||||
|
||||
int numbooks; /* <= 16 */
|
||||
int books[16];
|
||||
|
||||
} vorbis_info_floor0;
|
||||
|
||||
#define VIF_POSIT 63
|
||||
#define VIF_CLASS 16
|
||||
#define VIF_PARTS 31
|
||||
typedef struct{
|
||||
int partitions; /* 0 to 31 */
|
||||
int partitionclass[VIF_PARTS]; /* 0 to 15 */
|
||||
|
||||
int class_dim[VIF_CLASS]; /* 1 to 8 */
|
||||
int class_subs[VIF_CLASS]; /* 0,1,2,3 (bits: 1<<n poss) */
|
||||
int class_book[VIF_CLASS]; /* subs ^ dim entries */
|
||||
int class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
|
||||
|
||||
|
||||
int mult; /* 1 2 3 or 4 */
|
||||
int postlist[VIF_POSIT+2]; /* first two implicit */
|
||||
|
||||
} vorbis_info_floor1;
|
||||
|
||||
/* Residue backend generic *****************************************/
|
||||
typedef struct{
|
||||
vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
|
||||
vorbis_look_residue *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
|
||||
vorbis_info_residue *);
|
||||
void (*free_info) (vorbis_info_residue *);
|
||||
void (*free_look) (vorbis_look_residue *);
|
||||
int (*inverse) (struct vorbis_block *,vorbis_look_residue *,
|
||||
ogg_int32_t **,int *,int);
|
||||
} vorbis_func_residue;
|
||||
|
||||
typedef struct vorbis_info_residue0{
|
||||
/* block-partitioned VQ coded straight residue */
|
||||
long begin;
|
||||
long end;
|
||||
|
||||
/* first stage (lossless partitioning) */
|
||||
int grouping; /* group n vectors per partition */
|
||||
int partitions; /* possible codebooks for a partition */
|
||||
int partvals; /* partitions ^ groupbook dim */
|
||||
int groupbook; /* huffbook for partitioning */
|
||||
int secondstages[64]; /* expanded out to pointers in lookup */
|
||||
int booklist[512]; /* list of second stage books */
|
||||
} vorbis_info_residue0;
|
||||
|
||||
/* Mapping backend generic *****************************************/
|
||||
typedef struct{
|
||||
vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
|
||||
vorbis_look_mapping *(*look) (vorbis_dsp_state *,vorbis_info_mode *,
|
||||
vorbis_info_mapping *);
|
||||
void (*free_info) (vorbis_info_mapping *);
|
||||
void (*free_look) (vorbis_look_mapping *);
|
||||
int (*inverse) (struct vorbis_block *vb,vorbis_look_mapping *);
|
||||
} vorbis_func_mapping;
|
||||
|
||||
typedef struct vorbis_info_mapping0{
|
||||
int submaps; /* <= 16 */
|
||||
int chmuxlist[256]; /* up to 256 channels in a Vorbis stream */
|
||||
|
||||
int floorsubmap[16]; /* [mux] submap to floors */
|
||||
int residuesubmap[16]; /* [mux] submap to residue */
|
||||
|
||||
int psy[2]; /* by blocktype; impulse/padding for short,
|
||||
transition/normal for long */
|
||||
|
||||
int coupling_steps;
|
||||
int coupling_mag[256];
|
||||
int coupling_ang[256];
|
||||
} vorbis_info_mapping0;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,675 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: packing variable sized words into an octet stream
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* We're 'LSb' endian; if we write a word but read individual bits,
|
||||
then we'll read the lsb first */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "misc.h"
|
||||
#include "tremor_ogg.h"
|
||||
|
||||
static unsigned long mask[]=
|
||||
{0x00000000,0x00000001,0x00000003,0x00000007,0x0000000f,
|
||||
0x0000001f,0x0000003f,0x0000007f,0x000000ff,0x000001ff,
|
||||
0x000003ff,0x000007ff,0x00000fff,0x00001fff,0x00003fff,
|
||||
0x00007fff,0x0000ffff,0x0001ffff,0x0003ffff,0x0007ffff,
|
||||
0x000fffff,0x001fffff,0x003fffff,0x007fffff,0x00ffffff,
|
||||
0x01ffffff,0x03ffffff,0x07ffffff,0x0fffffff,0x1fffffff,
|
||||
0x3fffffff,0x7fffffff,0xffffffff };
|
||||
|
||||
/* spans forward, skipping as many bytes as headend is negative; if
|
||||
headend is zero, simply finds next byte. If we're up to the end
|
||||
of the buffer, leaves headend at zero. If we've read past the end,
|
||||
halt the decode process. */
|
||||
|
||||
static void _span(tremor_oggpack_buffer *b){
|
||||
while(b->headend-(b->headbit>>3)<1){
|
||||
b->headend-=b->headbit>>3;
|
||||
b->headbit&=0x7;
|
||||
|
||||
if(b->head->next){
|
||||
b->count+=b->head->length;
|
||||
b->head=b->head->next;
|
||||
|
||||
if(b->headend+b->head->length>0)
|
||||
b->headptr=b->head->buffer->data+b->head->begin-b->headend;
|
||||
|
||||
b->headend+=b->head->length;
|
||||
}else{
|
||||
/* we've either met the end of decode, or gone past it. halt
|
||||
only if we're past */
|
||||
if(b->headend*8<b->headbit)
|
||||
/* read has fallen off the end */
|
||||
b->headend=-1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tremor_oggpack_readinit(tremor_oggpack_buffer *b,tremor_ogg_reference *r){
|
||||
memset(b,0,sizeof(*b));
|
||||
|
||||
b->tail=b->head=r;
|
||||
b->count=0;
|
||||
b->headptr=b->head->buffer->data+b->head->begin;
|
||||
b->headend=b->head->length;
|
||||
_span(b);
|
||||
}
|
||||
|
||||
#define _lookspan() while(!end){\
|
||||
head=head->next;\
|
||||
if(!head) return -1;\
|
||||
ptr=head->buffer->data + head->begin;\
|
||||
end=head->length;\
|
||||
}
|
||||
|
||||
/* Read in bits without advancing the bitptr; bits <= 32 */
|
||||
long tremor_oggpack_look(tremor_oggpack_buffer *b,int bits){
|
||||
unsigned long m=mask[bits];
|
||||
unsigned long ret;
|
||||
|
||||
bits+=b->headbit;
|
||||
|
||||
if(bits >= b->headend<<3){
|
||||
int end=b->headend;
|
||||
unsigned char *ptr=b->headptr;
|
||||
tremor_ogg_reference *head=b->head;
|
||||
|
||||
if(end<0)return -1;
|
||||
|
||||
if(bits){
|
||||
_lookspan();
|
||||
ret=*ptr++>>b->headbit;
|
||||
if(bits>8){
|
||||
--end;
|
||||
_lookspan();
|
||||
ret|=*ptr++<<(8-b->headbit);
|
||||
if(bits>16){
|
||||
--end;
|
||||
_lookspan();
|
||||
ret|=*ptr++<<(16-b->headbit);
|
||||
if(bits>24){
|
||||
--end;
|
||||
_lookspan();
|
||||
ret|=*ptr++<<(24-b->headbit);
|
||||
if(bits>32 && b->headbit){
|
||||
--end;
|
||||
_lookspan();
|
||||
ret|=*ptr<<(32-b->headbit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
/* make this a switch jump-table */
|
||||
ret=b->headptr[0]>>b->headbit;
|
||||
if(bits>8){
|
||||
ret|=b->headptr[1]<<(8-b->headbit);
|
||||
if(bits>16){
|
||||
ret|=b->headptr[2]<<(16-b->headbit);
|
||||
if(bits>24){
|
||||
ret|=b->headptr[3]<<(24-b->headbit);
|
||||
if(bits>32 && b->headbit)
|
||||
ret|=b->headptr[4]<<(32-b->headbit);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ret&=m;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* limited to 32 at a time */
|
||||
void tremor_oggpack_adv(tremor_oggpack_buffer *b,int bits){
|
||||
bits+=b->headbit;
|
||||
b->headbit=bits&7;
|
||||
b->headend-=(bits>>3);
|
||||
b->headptr+=(bits>>3);
|
||||
if(b->headend<1)_span(b);
|
||||
}
|
||||
|
||||
int tremor_oggpack_eop(tremor_oggpack_buffer *b){
|
||||
if(b->headend<0)return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* bits <= 32 */
|
||||
long tremor_oggpack_read(tremor_oggpack_buffer *b,int bits){
|
||||
long ret=tremor_oggpack_look(b,bits);
|
||||
tremor_oggpack_adv(b,bits);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
long tremor_oggpack_bytes(tremor_oggpack_buffer *b){
|
||||
if(b->headend<0)return b->count+b->head->length;
|
||||
return b->count + b->head->length-b->headend +
|
||||
(b->headbit+7)/8;
|
||||
}
|
||||
|
||||
long tremor_oggpack_bits(tremor_oggpack_buffer *b){
|
||||
if(b->headend<0)return (b->count+b->head->length)*8;
|
||||
return (b->count + b->head->length-b->headend)*8 +
|
||||
b->headbit;
|
||||
}
|
||||
|
||||
/* Self test of the bitwise routines; everything else is based on
|
||||
them, so they damned well better be solid. */
|
||||
|
||||
#ifdef _V_BIT_TEST
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "framing.c"
|
||||
|
||||
static int ilog(unsigned long v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
tremor_oggpack_buffer r;
|
||||
tremor_oggpack_buffer o;
|
||||
tremor_ogg_buffer_state *bs;
|
||||
tremor_ogg_reference *or;
|
||||
#define TESTWORDS 256
|
||||
|
||||
void report(char *in){
|
||||
fprintf(stderr,"%s",in);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
int getbyte(tremor_ogg_reference *or,int position){
|
||||
while(or && position>=or->length){
|
||||
position-=or->length;
|
||||
or=or->next;
|
||||
if(or==NULL){
|
||||
fprintf(stderr,"\n\tERROR: getbyte ran off end of buffer.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if((position+or->begin)&1)
|
||||
return (or->buffer->data[(position+or->begin)>>1])&0xff;
|
||||
else
|
||||
return (or->buffer->data[(position+or->begin)>>1]>>8)&0xff;
|
||||
}
|
||||
|
||||
void cliptest(unsigned long *b,int vals,int bits,int *comp,int compsize){
|
||||
long i,bitcount=0;
|
||||
tremor_ogg_reference *or=tremor_ogg_buffer_alloc(bs,64);
|
||||
for(i=0;i<compsize;i++)
|
||||
or->buffer->data[i]= comp[i];
|
||||
or->length=i;
|
||||
|
||||
tremor_oggpack_readinit(&r,or);
|
||||
for(i=0;i<vals;i++){
|
||||
unsigned long test;
|
||||
int tbit=bits?bits:ilog(b[i]);
|
||||
if((test=tremor_oggpack_look(&r,tbit))==0xffffffff)
|
||||
report("out of data!\n");
|
||||
if(test!=(b[i]&mask[tbit])){
|
||||
fprintf(stderr,"%ld) %lx %lx\n",i,(b[i]&mask[tbit]),test);
|
||||
report("looked at incorrect value!\n");
|
||||
}
|
||||
if((test=tremor_oggpack_read(&r,tbit))==0xffffffff){
|
||||
report("premature end of data when reading!\n");
|
||||
}
|
||||
if(test!=(b[i]&mask[tbit])){
|
||||
fprintf(stderr,"%ld) %lx %lx\n",i,(b[i]&mask[tbit]),test);
|
||||
report("read incorrect value!\n");
|
||||
}
|
||||
bitcount+=tbit;
|
||||
|
||||
if(bitcount!=tremor_oggpack_bits(&r))
|
||||
report("wrong number of bits while reading!\n");
|
||||
if((bitcount+7)/8!=tremor_oggpack_bytes(&r))
|
||||
report("wrong number of bytes while reading!\n");
|
||||
|
||||
}
|
||||
if(tremor_oggpack_bytes(&r)!=(bitcount+7)/8)report("leftover bytes after read!\n");
|
||||
tremor_ogg_buffer_release(or);
|
||||
}
|
||||
|
||||
void _end_verify(int count){
|
||||
int i;
|
||||
|
||||
/* are the proper number of bits left over? */
|
||||
int leftover=count*8-tremor_oggpack_bits(&o);
|
||||
if(leftover>7)
|
||||
report("\nERROR: too many bits reported left over.\n");
|
||||
|
||||
/* does reading to exactly byte alignment *not* trip EOF? */
|
||||
if(tremor_oggpack_read(&o,leftover)==-1)
|
||||
report("\nERROR: read to but not past exact end tripped EOF.\n");
|
||||
if(tremor_oggpack_bits(&o)!=count*8)
|
||||
report("\nERROR: read to but not past exact end reported bad bitcount.\n");
|
||||
|
||||
/* does EOF trip properly after a single additional bit? */
|
||||
if(tremor_oggpack_read(&o,1)!=-1)
|
||||
report("\nERROR: read past exact end did not trip EOF.\n");
|
||||
if(tremor_oggpack_bits(&o)!=count*8)
|
||||
report("\nERROR: read past exact end reported bad bitcount.\n");
|
||||
|
||||
/* does EOF stay set over additional bit reads? */
|
||||
for(i=0;i<=32;i++){
|
||||
if(tremor_oggpack_read(&o,i)!=-1)
|
||||
report("\nERROR: EOF did not stay set on stream.\n");
|
||||
if(tremor_oggpack_bits(&o)!=count*8)
|
||||
report("\nERROR: read past exact end reported bad bitcount.\n");
|
||||
}
|
||||
}
|
||||
|
||||
void _end_verify2(int count){
|
||||
int i;
|
||||
|
||||
/* are the proper number of bits left over? */
|
||||
int leftover=count*8-tremor_oggpack_bits(&o);
|
||||
if(leftover>7)
|
||||
report("\nERROR: too many bits reported left over.\n");
|
||||
|
||||
/* does reading to exactly byte alignment *not* trip EOF? */
|
||||
tremor_oggpack_adv(&o,leftover);
|
||||
if(o.headend!=0)
|
||||
report("\nERROR: read to but not past exact end tripped EOF.\n");
|
||||
if(tremor_oggpack_bits(&o)!=count*8)
|
||||
report("\nERROR: read to but not past exact end reported bad bitcount.\n");
|
||||
|
||||
/* does EOF trip properly after a single additional bit? */
|
||||
tremor_oggpack_adv(&o,1);
|
||||
if(o.headend>=0)
|
||||
report("\nERROR: read past exact end did not trip EOF.\n");
|
||||
if(tremor_oggpack_bits(&o)!=count*8)
|
||||
report("\nERROR: read past exact end reported bad bitcount.\n");
|
||||
|
||||
/* does EOF stay set over additional bit reads? */
|
||||
for(i=0;i<=32;i++){
|
||||
tremor_oggpack_adv(&o,i);
|
||||
if(o.headend>=0)
|
||||
report("\nERROR: EOF did not stay set on stream.\n");
|
||||
if(tremor_oggpack_bits(&o)!=count*8)
|
||||
report("\nERROR: read past exact end reported bad bitcount.\n");
|
||||
}
|
||||
}
|
||||
|
||||
long tremor_ogg_buffer_length(tremor_ogg_reference *or){
|
||||
int count=0;
|
||||
while(or){
|
||||
count+=or->length;
|
||||
or=or->next;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
tremor_ogg_reference *tremor_ogg_buffer_extend(tremor_ogg_reference *or,long bytes){
|
||||
if(or){
|
||||
while(or->next){
|
||||
or=or->next;
|
||||
}
|
||||
or->next=tremor_ogg_buffer_alloc(or->buffer->ptr.owner,bytes);
|
||||
return(or->next);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tremor_ogg_buffer_posttruncate(tremor_ogg_reference *or,long pos){
|
||||
/* walk to the point where we want to begin truncate */
|
||||
while(or && pos>or->length){
|
||||
pos-=or->length;
|
||||
or=or->next;
|
||||
}
|
||||
if(or){
|
||||
tremor_ogg_buffer_release(or->next);
|
||||
or->next=0;
|
||||
or->length=pos;
|
||||
}
|
||||
}
|
||||
|
||||
int main(void){
|
||||
long i;
|
||||
static unsigned long testbuffer1[]=
|
||||
{18,12,103948,4325,543,76,432,52,3,65,4,56,32,42,34,21,1,23,32,546,456,7,
|
||||
567,56,8,8,55,3,52,342,341,4,265,7,67,86,2199,21,7,1,5,1,4};
|
||||
int test1size=43;
|
||||
|
||||
static unsigned long testbuffer2[]=
|
||||
{216531625L,1237861823,56732452,131,3212421,12325343,34547562,12313212,
|
||||
1233432,534,5,346435231,14436467,7869299,76326614,167548585,
|
||||
85525151,0,12321,1,349528352};
|
||||
int test2size=21;
|
||||
|
||||
static unsigned long testbuffer3[]=
|
||||
{1,0,14,0,1,0,12,0,1,0,0,0,1,1,0,1,0,1,0,1,0,1,0,1,0,1,0,0,1,1,1,1,1,0,0,1,
|
||||
0,1,30,1,1,1,0,0,1,0,0,0,12,0,11,0,1,0,0,1};
|
||||
int test3size=56;
|
||||
|
||||
static unsigned long large[]=
|
||||
{2136531625L,2137861823,56732452,131,3212421,12325343,34547562,12313212,
|
||||
1233432,534,5,2146435231,14436467,7869299,76326614,167548585,
|
||||
85525151,0,12321,1,2146528352};
|
||||
|
||||
int onesize=33;
|
||||
static int one[33]={146,25,44,151,195,15,153,176,233,131,196,65,85,172,47,40,
|
||||
34,242,223,136,35,222,211,86,171,50,225,135,214,75,172,
|
||||
223,4};
|
||||
|
||||
int twosize=6;
|
||||
static int two[6]={61,255,255,251,231,29};
|
||||
|
||||
int threesize=54;
|
||||
static int three[54]={169,2,232,252,91,132,156,36,89,13,123,176,144,32,254,
|
||||
142,224,85,59,121,144,79,124,23,67,90,90,216,79,23,83,
|
||||
58,135,196,61,55,129,183,54,101,100,170,37,127,126,10,
|
||||
100,52,4,14,18,86,77,1};
|
||||
|
||||
int foursize=38;
|
||||
static int four[38]={18,6,163,252,97,194,104,131,32,1,7,82,137,42,129,11,72,
|
||||
132,60,220,112,8,196,109,64,179,86,9,137,195,208,122,169,
|
||||
28,2,133,0,1};
|
||||
|
||||
int fivesize=45;
|
||||
static int five[45]={169,2,126,139,144,172,30,4,80,72,240,59,130,218,73,62,
|
||||
241,24,210,44,4,20,0,248,116,49,135,100,110,130,181,169,
|
||||
84,75,159,2,1,0,132,192,8,0,0,18,22};
|
||||
|
||||
int sixsize=7;
|
||||
static int six[7]={17,177,170,242,169,19,148};
|
||||
|
||||
/* Test read/write together */
|
||||
/* Later we test against pregenerated bitstreams */
|
||||
bs=tremor_ogg_buffer_create();
|
||||
|
||||
fprintf(stderr,"\nSmall preclipped packing (LSb): ");
|
||||
cliptest(testbuffer1,test1size,0,one,onesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nNull bit call (LSb): ");
|
||||
cliptest(testbuffer3,test3size,0,two,twosize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nLarge preclipped packing (LSb): ");
|
||||
cliptest(testbuffer2,test2size,0,three,threesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\n32 bit preclipped packing (LSb): ");
|
||||
|
||||
or=tremor_ogg_buffer_alloc(bs,128);
|
||||
for(i=0;i<test2size;i++){
|
||||
or->buffer->data[i*4] = large[i]&0xff;
|
||||
or->buffer->data[i*4+1] = (large[i]>>8)&0xff;
|
||||
or->buffer->data[i*4+2] = (large[i]>>16)&0xff;
|
||||
or->buffer->data[i*4+3] = (large[i]>>24)&0xff;
|
||||
}
|
||||
or->length=test2size*4;
|
||||
tremor_oggpack_readinit(&r,or);
|
||||
for(i=0;i<test2size;i++){
|
||||
unsigned long test;
|
||||
if((test=tremor_oggpack_look(&r,32))==0xffffffffUL)report("out of data. failed!");
|
||||
if(test!=large[i]){
|
||||
fprintf(stderr,"%ld != %ld (%lx!=%lx):",test,large[i],
|
||||
test,large[i]);
|
||||
report("read incorrect value!\n");
|
||||
}
|
||||
tremor_oggpack_adv(&r,32);
|
||||
}
|
||||
tremor_ogg_buffer_release(or);
|
||||
if(tremor_oggpack_bytes(&r)!=test2size*4)report("leftover bytes after read!\n");
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nSmall unclipped packing (LSb): ");
|
||||
cliptest(testbuffer1,test1size,7,four,foursize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nLarge unclipped packing (LSb): ");
|
||||
cliptest(testbuffer2,test2size,17,five,fivesize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nSingle bit unclipped packing (LSb): ");
|
||||
cliptest(testbuffer3,test3size,1,six,sixsize);
|
||||
fprintf(stderr,"ok.");
|
||||
|
||||
fprintf(stderr,"\nTesting read past end (LSb): ");
|
||||
{
|
||||
unsigned char dda[]={0,0,0,0};
|
||||
tremor_ogg_buffer lob={dda,8,0,{0}};
|
||||
tremor_ogg_reference lor={&lob,0,8,0};
|
||||
|
||||
tremor_oggpack_readinit(&r,&lor);
|
||||
for(i=0;i<64;i++){
|
||||
if(tremor_oggpack_read(&r,1)<0){
|
||||
fprintf(stderr,"failed; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if(tremor_oggpack_look(&r,1)!=-1 ||
|
||||
tremor_oggpack_read(&r,1)!=-1){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
{
|
||||
unsigned char dda[]={0,0,0,0};
|
||||
tremor_ogg_buffer lob={dda,8,0,{0}};
|
||||
tremor_ogg_reference lor={&lob,0,8,0};
|
||||
unsigned long test;
|
||||
|
||||
tremor_oggpack_readinit(&r,&lor);
|
||||
if((test=tremor_oggpack_read(&r,30))==0xffffffffUL ||
|
||||
(test=tremor_oggpack_read(&r,16))==0xffffffffUL){
|
||||
fprintf(stderr,"failed 2; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if((test=tremor_oggpack_look(&r,18))==0xffffffffUL){
|
||||
fprintf(stderr,"failed 3; got -1 prematurely.\n");
|
||||
exit(1);
|
||||
}
|
||||
if((test=tremor_oggpack_look(&r,19))!=0xffffffffUL){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
if((test=tremor_oggpack_look(&r,32))!=0xffffffffUL){
|
||||
fprintf(stderr,"failed; read past end without -1.\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
fprintf(stderr,"ok.\n");
|
||||
|
||||
/* now the scary shit: randomized testing */
|
||||
|
||||
for(i=0;i<10000;i++){
|
||||
long j,count=0,count2=0,bitcount=0;
|
||||
unsigned long values[TESTWORDS];
|
||||
int len[TESTWORDS];
|
||||
unsigned char flat[4*TESTWORDS]; /* max possible needed size */
|
||||
|
||||
memset(flat,0,sizeof(flat));
|
||||
fprintf(stderr,"\rRandomized testing (LSb)... (%ld) ",10000-i);
|
||||
|
||||
/* generate a list of words and lengths */
|
||||
/* write the required number of bits out to packbuffer */
|
||||
{
|
||||
long word=0;
|
||||
long bit=0;
|
||||
int k;
|
||||
|
||||
for(j=0;j<TESTWORDS;j++){
|
||||
values[j]=rand();
|
||||
len[j]=(rand()%33);
|
||||
|
||||
for(k=0;k<len[j];k++){
|
||||
flat[word] |= ((values[j]>>k)&0x1)<<bit;
|
||||
bit++;
|
||||
bitcount++;
|
||||
if(bit>7){
|
||||
bit=0;
|
||||
word++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
count2=(bitcount+7)>>3;
|
||||
|
||||
/* construct random-length buffer chain from flat vector; random
|
||||
byte starting offset within the length of the vector */
|
||||
{
|
||||
tremor_ogg_reference *or=NULL,*orl=NULL;
|
||||
long pos=0;
|
||||
|
||||
/* build buffer chain */
|
||||
while(count2){
|
||||
int ilen=(rand()%32),k;
|
||||
int ibegin=(rand()%32);
|
||||
|
||||
|
||||
if(ilen>count2)ilen=count2;
|
||||
|
||||
if(or)
|
||||
orl=tremor_ogg_buffer_extend(orl,64);
|
||||
else
|
||||
or=orl=tremor_ogg_buffer_alloc(bs,64);
|
||||
|
||||
orl->length=ilen;
|
||||
orl->begin=ibegin;
|
||||
|
||||
for(k=0;k<ilen;k++)
|
||||
orl->buffer->data[ibegin++]= flat[pos++];
|
||||
|
||||
count2-=ilen;
|
||||
}
|
||||
|
||||
if(tremor_ogg_buffer_length(or)!=(bitcount+7)/8){
|
||||
fprintf(stderr,"\nERROR: buffer length incorrect after build.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
int begin=0; //=(rand()%TESTWORDS);
|
||||
int ilen=(rand()%(TESTWORDS-begin));
|
||||
int bitoffset,bitcount=0;
|
||||
unsigned long temp;
|
||||
|
||||
for(j=0;j<begin;j++)
|
||||
bitcount+=len[j];
|
||||
or=tremor_ogg_buffer_pretruncate(or,bitcount/8);
|
||||
bitoffset=bitcount%=8;
|
||||
for(;j<begin+ilen;j++)
|
||||
bitcount+=len[j];
|
||||
tremor_ogg_buffer_posttruncate(or,((bitcount+7)/8));
|
||||
|
||||
if((count=tremor_ogg_buffer_length(or))!=(bitcount+7)/8){
|
||||
fprintf(stderr,"\nERROR: buffer length incorrect after truncate.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
tremor_oggpack_readinit(&o,or);
|
||||
|
||||
/* verify bit count */
|
||||
if(tremor_oggpack_bits(&o)!=0){
|
||||
fprintf(stderr,"\nERROR: Read bitcounter not zero!\n");
|
||||
exit(1);
|
||||
}
|
||||
if(tremor_oggpack_bytes(&o)!=0){
|
||||
fprintf(stderr,"\nERROR: Read bytecounter not zero!\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bitcount=bitoffset;
|
||||
tremor_oggpack_read(&o,bitoffset);
|
||||
|
||||
/* read and compare to original list */
|
||||
for(j=begin;j<begin+ilen;j++){
|
||||
temp=tremor_oggpack_read(&o,len[j]);
|
||||
if(temp==0xffffffffUL){
|
||||
fprintf(stderr,"\nERROR: End of stream too soon! word: %ld,%d\n",
|
||||
j-begin,ilen);
|
||||
exit(1);
|
||||
}
|
||||
if(temp!=(values[j]&mask[len[j]])){
|
||||
fprintf(stderr,"\nERROR: Incorrect read %lx != %lx, word %ld, len %d\n"
|
||||
,
|
||||
values[j]&mask[len[j]],temp,j-begin,len[j]);
|
||||
exit(1);
|
||||
}
|
||||
bitcount+=len[j];
|
||||
if(tremor_oggpack_bits(&o)!=bitcount){
|
||||
fprintf(stderr,"\nERROR: Read bitcounter %d != %ld!\n",
|
||||
bitcount,tremor_oggpack_bits(&o));
|
||||
exit(1);
|
||||
}
|
||||
if(tremor_oggpack_bytes(&o)!=(bitcount+7)/8){
|
||||
fprintf(stderr,"\nERROR: Read bytecounter %d != %ld!\n",
|
||||
(bitcount+7)/8,tremor_oggpack_bytes(&o));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
_end_verify(count);
|
||||
|
||||
/* look/adv version */
|
||||
tremor_oggpack_readinit(&o,or);
|
||||
bitcount=bitoffset;
|
||||
tremor_oggpack_adv(&o,bitoffset);
|
||||
|
||||
/* read and compare to original list */
|
||||
for(j=begin;j<begin+ilen;j++){
|
||||
temp=tremor_oggpack_look(&o,len[j]);
|
||||
|
||||
if(temp==0xffffffffUL){
|
||||
fprintf(stderr,"\nERROR: End of stream too soon! word: %ld\n",
|
||||
j-begin);
|
||||
exit(1);
|
||||
}
|
||||
if(temp!=(values[j]&mask[len[j]])){
|
||||
fprintf(stderr,"\nERROR: Incorrect look %lx != %lx, word %ld, len %d\n"
|
||||
,
|
||||
values[j]&mask[len[j]],temp,j-begin,len[j]);
|
||||
exit(1);
|
||||
}
|
||||
tremor_oggpack_adv(&o,len[j]);
|
||||
bitcount+=len[j];
|
||||
if(tremor_oggpack_bits(&o)!=bitcount){
|
||||
fprintf(stderr,"\nERROR: Look/Adv bitcounter %d != %ld!\n",
|
||||
bitcount,tremor_oggpack_bits(&o));
|
||||
exit(1);
|
||||
}
|
||||
if(tremor_oggpack_bytes(&o)!=(bitcount+7)/8){
|
||||
fprintf(stderr,"\nERROR: Look/Adv bytecounter %d != %ld!\n",
|
||||
(bitcount+7)/8,tremor_oggpack_bytes(&o));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
_end_verify2(count);
|
||||
|
||||
}
|
||||
tremor_ogg_buffer_release(or);
|
||||
}
|
||||
}
|
||||
fprintf(stderr,"\rRandomized testing (LSb)... ok. \n");
|
||||
|
||||
return(0);
|
||||
}
|
||||
#endif
|
||||
@@ -1,497 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: PCM data vector blocking, windowing and dis/reassembly
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
|
||||
#include "window.h"
|
||||
#include "registry.h"
|
||||
#include "misc.h"
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
if(v)--v;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* pcm accumulator examples (not exhaustive):
|
||||
|
||||
<-------------- lW ---------------->
|
||||
<--------------- W ---------------->
|
||||
: .....|..... _______________ |
|
||||
: .''' | '''_--- | |\ |
|
||||
:.....''' |_____--- '''......| | \_______|
|
||||
:.................|__________________|_______|__|______|
|
||||
|<------ Sl ------>| > Sr < |endW
|
||||
|beginSl |endSl | |endSr
|
||||
|beginW |endlW |beginSr
|
||||
|
||||
|
||||
|< lW >|
|
||||
<--------------- W ---------------->
|
||||
| | .. ______________ |
|
||||
| | ' `/ | ---_ |
|
||||
|___.'___/`. | ---_____|
|
||||
|_______|__|_______|_________________|
|
||||
| >|Sl|< |<------ Sr ----->|endW
|
||||
| | |endSl |beginSr |endSr
|
||||
|beginW | |endlW
|
||||
mult[0] |beginSl mult[n]
|
||||
|
||||
<-------------- lW ----------------->
|
||||
|<--W-->|
|
||||
: .............. ___ | |
|
||||
: .''' |`/ \ | |
|
||||
:.....''' |/`....\|...|
|
||||
:.........................|___|___|___|
|
||||
|Sl |Sr |endW
|
||||
| | |endSr
|
||||
| |beginSr
|
||||
| |endSl
|
||||
|beginSl
|
||||
|beginW
|
||||
*/
|
||||
|
||||
/* block abstraction setup *********************************************/
|
||||
|
||||
#ifndef WORD_ALIGN
|
||||
#define WORD_ALIGN 8
|
||||
#endif
|
||||
|
||||
int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
|
||||
memset(vb,0,sizeof(*vb));
|
||||
vb->vd=v;
|
||||
vb->localalloc=0;
|
||||
vb->localstore=NULL;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
void *_vorbis_block_alloc(vorbis_block *vb,long bytes){
|
||||
bytes=(bytes+(WORD_ALIGN-1)) & ~(WORD_ALIGN-1);
|
||||
if(bytes+vb->localtop>vb->localalloc){
|
||||
/* can't just _ogg_realloc... there are outstanding pointers */
|
||||
if(vb->localstore){
|
||||
struct alloc_chain *link=(struct alloc_chain *)_ogg_malloc(sizeof(*link));
|
||||
vb->totaluse+=vb->localtop;
|
||||
link->next=vb->reap;
|
||||
link->ptr=vb->localstore;
|
||||
vb->reap=link;
|
||||
}
|
||||
/* highly conservative */
|
||||
vb->localalloc=bytes;
|
||||
vb->localstore=_ogg_malloc(vb->localalloc);
|
||||
vb->localtop=0;
|
||||
}
|
||||
{
|
||||
void *ret=(void *)(((char *)vb->localstore)+vb->localtop);
|
||||
vb->localtop+=bytes;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
/* reap the chain, pull the ripcord */
|
||||
void _vorbis_block_ripcord(vorbis_block *vb){
|
||||
/* reap the chain */
|
||||
struct alloc_chain *reap=vb->reap;
|
||||
while(reap){
|
||||
struct alloc_chain *next=reap->next;
|
||||
_ogg_free(reap->ptr);
|
||||
memset(reap,0,sizeof(*reap));
|
||||
_ogg_free(reap);
|
||||
reap=next;
|
||||
}
|
||||
/* consolidate storage */
|
||||
if(vb->totaluse){
|
||||
vb->localstore=_ogg_realloc(vb->localstore,vb->totaluse+vb->localalloc);
|
||||
vb->localalloc+=vb->totaluse;
|
||||
vb->totaluse=0;
|
||||
}
|
||||
|
||||
/* pull the ripcord */
|
||||
vb->localtop=0;
|
||||
vb->reap=NULL;
|
||||
}
|
||||
|
||||
int vorbis_block_clear(vorbis_block *vb){
|
||||
_vorbis_block_ripcord(vb);
|
||||
if(vb->localstore)_ogg_free(vb->localstore);
|
||||
|
||||
memset(vb,0,sizeof(*vb));
|
||||
return(0);
|
||||
}
|
||||
|
||||
static int _vds_init(vorbis_dsp_state *v,vorbis_info *vi){
|
||||
int i;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
private_state *b=NULL;
|
||||
|
||||
if(ci==NULL) return 1;
|
||||
|
||||
memset(v,0,sizeof(*v));
|
||||
b=(private_state *)(v->backend_state=_ogg_calloc(1,sizeof(*b)));
|
||||
|
||||
v->vi=vi;
|
||||
b->modebits=ilog(ci->modes);
|
||||
|
||||
/* Vorbis I uses only window type 0 */
|
||||
b->window[0]=_vorbis_window(0,ci->blocksizes[0]/2);
|
||||
b->window[1]=_vorbis_window(0,ci->blocksizes[1]/2);
|
||||
|
||||
/* finish the codebooks */
|
||||
if(!ci->fullbooks){
|
||||
ci->fullbooks=(codebook *)_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
|
||||
for(i=0;i<ci->books;i++){
|
||||
if(ci->book_param[i]==NULL)
|
||||
goto abort_books;
|
||||
if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
|
||||
goto abort_books;
|
||||
/* decode codebooks are now standalone after init */
|
||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||
ci->book_param[i]=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
v->pcm_storage=ci->blocksizes[1];
|
||||
v->pcm=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcm));
|
||||
v->pcmret=(ogg_int32_t **)_ogg_malloc(vi->channels*sizeof(*v->pcmret));
|
||||
for(i=0;i<vi->channels;i++)
|
||||
v->pcm[i]=(ogg_int32_t *)_ogg_calloc(v->pcm_storage,sizeof(*v->pcm[i]));
|
||||
|
||||
/* all 1 (large block) or 0 (small block) */
|
||||
/* explicitly set for the sake of clarity */
|
||||
v->lW=0; /* previous window size */
|
||||
v->W=0; /* current window size */
|
||||
|
||||
/* initialize all the mapping/backend lookups */
|
||||
b->mode=(vorbis_look_mapping **)_ogg_calloc(ci->modes,sizeof(*b->mode));
|
||||
for(i=0;i<ci->modes;i++){
|
||||
int mapnum=ci->mode_param[i]->mapping;
|
||||
int maptype=ci->map_type[mapnum];
|
||||
b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
|
||||
ci->map_param[mapnum]);
|
||||
}
|
||||
return 0;
|
||||
abort_books:
|
||||
for(i=0;i<ci->books;i++){
|
||||
if(ci->book_param[i]!=NULL){
|
||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||
ci->book_param[i]=NULL;
|
||||
}
|
||||
}
|
||||
vorbis_dsp_clear(v);
|
||||
return -1;
|
||||
}
|
||||
|
||||
int vorbis_synthesis_restart(vorbis_dsp_state *v){
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci;
|
||||
|
||||
if(!v->backend_state)return -1;
|
||||
if(!vi)return -1;
|
||||
ci=vi->codec_setup;
|
||||
if(!ci)return -1;
|
||||
|
||||
v->centerW=ci->blocksizes[1]/2;
|
||||
v->pcm_current=v->centerW;
|
||||
|
||||
v->pcm_returned=-1;
|
||||
v->granulepos=-1;
|
||||
v->sequence=-1;
|
||||
((private_state *)(v->backend_state))->sample_count=-1;
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
|
||||
if(_vds_init(v,vi))return 1;
|
||||
vorbis_synthesis_restart(v);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void vorbis_dsp_clear(vorbis_dsp_state *v){
|
||||
int i;
|
||||
if(v){
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)(vi?vi->codec_setup:NULL);
|
||||
private_state *b=(private_state *)v->backend_state;
|
||||
|
||||
if(v->pcm){
|
||||
for(i=0;i<vi->channels;i++)
|
||||
if(v->pcm[i])_ogg_free(v->pcm[i]);
|
||||
_ogg_free(v->pcm);
|
||||
if(v->pcmret)_ogg_free(v->pcmret);
|
||||
}
|
||||
|
||||
/* free mode lookups; these are actually vorbis_look_mapping structs */
|
||||
if(ci){
|
||||
for(i=0;i<ci->modes;i++){
|
||||
int mapnum=ci->mode_param[i]->mapping;
|
||||
int maptype=ci->map_type[mapnum];
|
||||
if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
|
||||
}
|
||||
}
|
||||
|
||||
if(b){
|
||||
if(b->mode)_ogg_free(b->mode);
|
||||
_ogg_free(b);
|
||||
}
|
||||
|
||||
memset(v,0,sizeof(*v));
|
||||
}
|
||||
}
|
||||
|
||||
/* Unlike in analysis, the window is only partially applied for each
|
||||
block. The time domain envelope is not yet handled at the point of
|
||||
calling (as it relies on the previous block). */
|
||||
|
||||
int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
private_state *b=v->backend_state;
|
||||
int i,j;
|
||||
|
||||
if(v->pcm_current>v->pcm_returned && v->pcm_returned!=-1)return(OV_EINVAL);
|
||||
|
||||
v->lW=v->W;
|
||||
v->W=vb->W;
|
||||
v->nW=-1;
|
||||
|
||||
if((v->sequence==-1)||
|
||||
(v->sequence+1 != vb->sequence)){
|
||||
v->granulepos=-1; /* out of sequence; lose count */
|
||||
b->sample_count=-1;
|
||||
}
|
||||
|
||||
v->sequence=vb->sequence;
|
||||
|
||||
if(vb->pcm){ /* no pcm to process if vorbis_synthesis_trackonly
|
||||
was called on block */
|
||||
int n=ci->blocksizes[v->W]/2;
|
||||
int n0=ci->blocksizes[0]/2;
|
||||
int n1=ci->blocksizes[1]/2;
|
||||
|
||||
int thisCenter;
|
||||
int prevCenter;
|
||||
|
||||
if(v->centerW){
|
||||
thisCenter=n1;
|
||||
prevCenter=0;
|
||||
}else{
|
||||
thisCenter=0;
|
||||
prevCenter=n1;
|
||||
}
|
||||
|
||||
/* v->pcm is now used like a two-stage double buffer. We don't want
|
||||
to have to constantly shift *or* adjust memory usage. Don't
|
||||
accept a new block until the old is shifted out */
|
||||
|
||||
/* overlap/add PCM */
|
||||
|
||||
for(j=0;j<vi->channels;j++){
|
||||
/* the overlap/add section */
|
||||
if(v->lW){
|
||||
if(v->W){
|
||||
/* large/large */
|
||||
ogg_int32_t *pcm=v->pcm[j]+prevCenter;
|
||||
ogg_int32_t *p=vb->pcm[j];
|
||||
for(i=0;i<n1;i++)
|
||||
pcm[i]+=p[i];
|
||||
}else{
|
||||
/* large/small */
|
||||
ogg_int32_t *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
|
||||
ogg_int32_t *p=vb->pcm[j];
|
||||
for(i=0;i<n0;i++)
|
||||
pcm[i]+=p[i];
|
||||
}
|
||||
}else{
|
||||
if(v->W){
|
||||
/* small/large */
|
||||
ogg_int32_t *pcm=v->pcm[j]+prevCenter;
|
||||
ogg_int32_t *p=vb->pcm[j]+n1/2-n0/2;
|
||||
for(i=0;i<n0;i++)
|
||||
pcm[i]+=p[i];
|
||||
for(;i<n1/2+n0/2;i++)
|
||||
pcm[i]=p[i];
|
||||
}else{
|
||||
/* small/small */
|
||||
ogg_int32_t *pcm=v->pcm[j]+prevCenter;
|
||||
ogg_int32_t *p=vb->pcm[j];
|
||||
for(i=0;i<n0;i++)
|
||||
pcm[i]+=p[i];
|
||||
}
|
||||
}
|
||||
|
||||
/* the copy section */
|
||||
{
|
||||
ogg_int32_t *pcm=v->pcm[j]+thisCenter;
|
||||
ogg_int32_t *p=vb->pcm[j]+n;
|
||||
for(i=0;i<n;i++)
|
||||
pcm[i]=p[i];
|
||||
}
|
||||
}
|
||||
|
||||
if(v->centerW)
|
||||
v->centerW=0;
|
||||
else
|
||||
v->centerW=n1;
|
||||
|
||||
/* deal with initial packet state; we do this using the explicit
|
||||
pcm_returned==-1 flag otherwise we're sensitive to first block
|
||||
being short or long */
|
||||
|
||||
if(v->pcm_returned==-1){
|
||||
v->pcm_returned=thisCenter;
|
||||
v->pcm_current=thisCenter;
|
||||
}else{
|
||||
v->pcm_returned=prevCenter;
|
||||
v->pcm_current=prevCenter+
|
||||
ci->blocksizes[v->lW]/4+
|
||||
ci->blocksizes[v->W]/4;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* track the frame number... This is for convenience, but also
|
||||
making sure our last packet doesn't end with added padding. If
|
||||
the last packet is partial, the number of samples we'll have to
|
||||
return will be past the vb->granulepos.
|
||||
|
||||
This is not foolproof! It will be confused if we begin
|
||||
decoding at the last page after a seek or hole. In that case,
|
||||
we don't have a starting point to judge where the last frame
|
||||
is. For this reason, vorbisfile will always try to make sure
|
||||
it reads the last two marked pages in proper sequence */
|
||||
|
||||
if(b->sample_count==-1){
|
||||
b->sample_count=0;
|
||||
}else{
|
||||
b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
|
||||
}
|
||||
|
||||
if(v->granulepos==-1){
|
||||
if(vb->granulepos!=-1){ /* only set if we have a position to set to */
|
||||
|
||||
v->granulepos=vb->granulepos;
|
||||
|
||||
/* is this a short page? */
|
||||
if(b->sample_count>v->granulepos){
|
||||
/* corner case; if this is both the first and last audio page,
|
||||
then spec says the end is cut, not beginning */
|
||||
long extra=b->sample_count-vb->granulepos;
|
||||
|
||||
/* we use ogg_int64_t for granule positions because a
|
||||
uint64 isn't universally available. Unfortunately,
|
||||
that means granposes can be 'negative' and result in
|
||||
extra being negative */
|
||||
if(extra<0)
|
||||
extra=0;
|
||||
|
||||
if(vb->eofflag){
|
||||
/* trim the end */
|
||||
/* no preceeding granulepos; assume we started at zero (we'd
|
||||
have to in a short single-page stream) */
|
||||
/* granulepos could be -1 due to a seek, but that would result
|
||||
in a long coun`t, not short count */
|
||||
|
||||
/* Guard against corrupt/malicious frames that set EOP and
|
||||
a backdated granpos; don't rewind more samples than we
|
||||
actually have */
|
||||
if(extra > v->pcm_current - v->pcm_returned)
|
||||
extra = v->pcm_current - v->pcm_returned;
|
||||
|
||||
v->pcm_current-=extra;
|
||||
}else{
|
||||
/* trim the beginning */
|
||||
v->pcm_returned+=extra;
|
||||
if(v->pcm_returned>v->pcm_current)
|
||||
v->pcm_returned=v->pcm_current;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
|
||||
if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
|
||||
|
||||
if(v->granulepos>vb->granulepos){
|
||||
long extra=v->granulepos-vb->granulepos;
|
||||
|
||||
if(extra)
|
||||
if(vb->eofflag){
|
||||
/* partial last frame. Strip the extra samples off */
|
||||
|
||||
/* Guard against corrupt/malicious frames that set EOP and
|
||||
a backdated granpos; don't rewind more samples than we
|
||||
actually have */
|
||||
if(extra > v->pcm_current - v->pcm_returned)
|
||||
extra = v->pcm_current - v->pcm_returned;
|
||||
|
||||
/* we use ogg_int64_t for granule positions because a
|
||||
uint64 isn't universally available. Unfortunately,
|
||||
that means granposes can be 'negative' and result in
|
||||
extra being negative */
|
||||
if(extra<0)
|
||||
extra=0;
|
||||
|
||||
v->pcm_current-=extra;
|
||||
|
||||
} /* else {Shouldn't happen *unless* the bitstream is out of
|
||||
spec. Either way, believe the bitstream } */
|
||||
} /* else {Shouldn't happen *unless* the bitstream is out of
|
||||
spec. Either way, believe the bitstream } */
|
||||
v->granulepos=vb->granulepos;
|
||||
}
|
||||
}
|
||||
|
||||
/* Update, cleanup */
|
||||
|
||||
if(vb->eofflag)v->eofflag=1;
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* pcm==NULL indicates we just want the pending samples, no more */
|
||||
int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm){
|
||||
vorbis_info *vi=v->vi;
|
||||
if(v->pcm_returned>-1 && v->pcm_returned<v->pcm_current){
|
||||
if(pcm){
|
||||
int i;
|
||||
for(i=0;i<vi->channels;i++)
|
||||
v->pcmret[i]=v->pcm[i]+v->pcm_returned;
|
||||
*pcm=v->pcmret;
|
||||
}
|
||||
return(v->pcm_current-v->pcm_returned);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int vorbis_synthesis_read(vorbis_dsp_state *v,int bytes){
|
||||
if(bytes && v->pcm_returned+bytes>v->pcm_current)return(OV_EINVAL);
|
||||
v->pcm_returned+=bytes;
|
||||
return(0);
|
||||
}
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2008 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: shared block functions
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _V_BLOCK_
|
||||
#define _V_BLOCK_
|
||||
|
||||
extern void _vorbis_block_ripcord(vorbis_block *vb);
|
||||
extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
|
||||
|
||||
#endif
|
||||
+665
-259
File diff suppressed because it is too large
Load Diff
+32
-68
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,82 +18,46 @@
|
||||
#ifndef _V_CODEBOOK_H_
|
||||
#define _V_CODEBOOK_H_
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
|
||||
/* This structure encapsulates huffman and VQ style encoding books; it
|
||||
doesn't do anything specific to either.
|
||||
|
||||
valuelist/quantlist are nonNULL (and q_* significant) only if
|
||||
there's entry->value mapping to be done.
|
||||
|
||||
If encode-side mapping must be done (and thus the entry needs to be
|
||||
hunted), the auxiliary encode pointer will point to a decision
|
||||
tree. This is true of both VQ and huffman, but is mostly useful
|
||||
with VQ.
|
||||
|
||||
*/
|
||||
|
||||
typedef struct static_codebook{
|
||||
long dim; /* codebook dimensions (elements per vector) */
|
||||
long entries; /* codebook entries */
|
||||
long *lengthlist; /* codeword lengths in bits */
|
||||
|
||||
/* mapping ***************************************************************/
|
||||
int maptype; /* 0=none
|
||||
1=implicitly populated values from map column
|
||||
2=listed arbitrary values */
|
||||
|
||||
/* The below does a linear, single monotonic sequence mapping. */
|
||||
long q_min; /* packed 32 bit float; quant value 0 maps to minval */
|
||||
long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
|
||||
int q_quant; /* bits: 0 < quant <= 16 */
|
||||
int q_sequencep; /* bitflag */
|
||||
|
||||
long *quantlist; /* map == 1: (int)(entries^(1/dim)) element column map
|
||||
map == 2: list of dim*entries quantized entry vals
|
||||
*/
|
||||
} static_codebook;
|
||||
#include "tremor_ogg.h"
|
||||
|
||||
typedef struct codebook{
|
||||
long dim; /* codebook dimensions (elements per vector) */
|
||||
long entries; /* codebook entries */
|
||||
long used_entries; /* populated codebook entries */
|
||||
long dim; /* codebook dimensions (elements per vector) */
|
||||
long entries; /* codebook entries */
|
||||
long used_entries; /* populated codebook entries */
|
||||
|
||||
/* the below are ordered by bitreversed codeword and only used
|
||||
entries are populated */
|
||||
int binarypoint;
|
||||
ogg_int32_t *valuelist; /* list of dim*entries actual entry values */
|
||||
ogg_uint32_t *codelist; /* list of bitstream codewords for each entry */
|
||||
int dec_maxlength;
|
||||
void *dec_table;
|
||||
int dec_nodeb;
|
||||
int dec_leafw;
|
||||
int dec_type; /* 0 = entry number
|
||||
1 = packed vector of values
|
||||
2 = packed vector of column offsets, maptype 1
|
||||
3 = scalar offset into value array, maptype 2 */
|
||||
|
||||
int *dec_index;
|
||||
char *dec_codelengths;
|
||||
ogg_uint32_t *dec_firsttable;
|
||||
int dec_firsttablen;
|
||||
int dec_maxlength;
|
||||
|
||||
long q_min; /* packed 32 bit float; quant value 0 maps to minval */
|
||||
long q_delta; /* packed 32 bit float; val 1 - val 0 == delta */
|
||||
tremor_ogg_int32_t q_min;
|
||||
int q_minp;
|
||||
tremor_ogg_int32_t q_del;
|
||||
int q_delp;
|
||||
int q_seq;
|
||||
int q_bits;
|
||||
int q_pack;
|
||||
void *q_val;
|
||||
|
||||
} codebook;
|
||||
|
||||
extern void vorbis_staticbook_destroy(static_codebook *b);
|
||||
extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
|
||||
|
||||
extern void vorbis_book_clear(codebook *b);
|
||||
extern long _book_maptype1_quantvals(const static_codebook *b);
|
||||
extern int vorbis_book_unpack(tremor_oggpack_buffer *b,codebook *c);
|
||||
|
||||
extern static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b);
|
||||
|
||||
extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
|
||||
extern long vorbis_book_decodevs_add(codebook *book, ogg_int32_t *a,
|
||||
oggpack_buffer *b,int n,int point);
|
||||
extern long vorbis_book_decodev_set(codebook *book, ogg_int32_t *a,
|
||||
oggpack_buffer *b,int n,int point);
|
||||
extern long vorbis_book_decodev_add(codebook *book, ogg_int32_t *a,
|
||||
oggpack_buffer *b,int n,int point);
|
||||
extern long vorbis_book_decodevv_add(codebook *book, ogg_int32_t **a,
|
||||
extern long vorbis_book_decode(codebook *book, tremor_oggpack_buffer *b);
|
||||
extern long vorbis_book_decodevs_add(codebook *book, tremor_ogg_int32_t *a,
|
||||
tremor_oggpack_buffer *b,int n,int point);
|
||||
extern long vorbis_book_decodev_set(codebook *book, tremor_ogg_int32_t *a,
|
||||
tremor_oggpack_buffer *b,int n,int point);
|
||||
extern long vorbis_book_decodev_add(codebook *book, tremor_ogg_int32_t *a,
|
||||
tremor_oggpack_buffer *b,int n,int point);
|
||||
extern long vorbis_book_decodevv_add(codebook *book, tremor_ogg_int32_t **a,
|
||||
long off,int ch,
|
||||
oggpack_buffer *b,int n,int point);
|
||||
tremor_oggpack_buffer *b,int n,int point);
|
||||
|
||||
extern int _ilog(unsigned int v);
|
||||
|
||||
|
||||
+156
-35
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,36 +18,149 @@
|
||||
#ifndef _V_CODECI_H_
|
||||
#define _V_CODECI_H_
|
||||
|
||||
#include "codebook.h"
|
||||
#define CHUNKSIZE 1024
|
||||
|
||||
typedef void vorbis_look_mapping;
|
||||
typedef void vorbis_look_floor;
|
||||
typedef void vorbis_look_residue;
|
||||
typedef void vorbis_look_transform;
|
||||
#include "codebook.h"
|
||||
#include "ivorbiscodec.h"
|
||||
|
||||
#define VI_TRANSFORMB 1
|
||||
#define VI_WINDOWB 1
|
||||
#define VI_TIMEB 1
|
||||
#define VI_FLOORB 2
|
||||
#define VI_RESB 3
|
||||
#define VI_MAPB 1
|
||||
|
||||
typedef void vorbis_info_floor;
|
||||
|
||||
/* vorbis_dsp_state buffers the current vorbis audio
|
||||
analysis/synthesis state. The DSP state belongs to a specific
|
||||
logical bitstream ****************************************************/
|
||||
struct vorbis_dsp_state{
|
||||
vorbis_info *vi;
|
||||
tremor_oggpack_buffer opb;
|
||||
|
||||
tremor_ogg_int32_t **work;
|
||||
tremor_ogg_int32_t **mdctright;
|
||||
int out_begin;
|
||||
int out_end;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
|
||||
tremor_ogg_int64_t granulepos;
|
||||
tremor_ogg_int64_t sequence;
|
||||
tremor_ogg_int64_t sample_count;
|
||||
|
||||
};
|
||||
|
||||
|
||||
/* Floor backend generic *****************************************/
|
||||
|
||||
extern vorbis_info_floor *floor0_info_unpack(vorbis_info *,tremor_oggpack_buffer *);
|
||||
extern void floor0_free_info(vorbis_info_floor *);
|
||||
extern int floor0_memosize(vorbis_info_floor *);
|
||||
extern tremor_ogg_int32_t *floor0_inverse1(struct vorbis_dsp_state *,
|
||||
vorbis_info_floor *,tremor_ogg_int32_t *);
|
||||
extern int floor0_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *,
|
||||
tremor_ogg_int32_t *buffer,tremor_ogg_int32_t *);
|
||||
|
||||
extern vorbis_info_floor *floor1_info_unpack(vorbis_info *,tremor_oggpack_buffer *);
|
||||
extern void floor1_free_info(vorbis_info_floor *);
|
||||
extern int floor1_memosize(vorbis_info_floor *);
|
||||
extern tremor_ogg_int32_t *floor1_inverse1(struct vorbis_dsp_state *,
|
||||
vorbis_info_floor *,tremor_ogg_int32_t *);
|
||||
extern int floor1_inverse2 (struct vorbis_dsp_state *,vorbis_info_floor *,
|
||||
tremor_ogg_int32_t *buffer,tremor_ogg_int32_t *);
|
||||
|
||||
typedef struct{
|
||||
int order;
|
||||
long rate;
|
||||
long barkmap;
|
||||
|
||||
int ampbits;
|
||||
int ampdB;
|
||||
|
||||
int numbooks; /* <= 16 */
|
||||
char books[16];
|
||||
|
||||
} vorbis_info_floor0;
|
||||
|
||||
typedef struct{
|
||||
char class_dim; /* 1 to 8 */
|
||||
char class_subs; /* 0,1,2,3 (bits: 1<<n poss) */
|
||||
unsigned char class_book; /* subs ^ dim entries */
|
||||
unsigned char class_subbook[8]; /* [VIF_CLASS][subs] */
|
||||
} floor1class;
|
||||
|
||||
typedef struct{
|
||||
floor1class *class; /* [VIF_CLASS] */
|
||||
char *partitionclass; /* [VIF_PARTS]; 0 to 15 */
|
||||
tremor_ogg_uint16_t *postlist; /* [VIF_POSIT+2]; first two implicit */
|
||||
char *forward_index; /* [VIF_POSIT+2]; */
|
||||
char *hineighbor; /* [VIF_POSIT]; */
|
||||
char *loneighbor; /* [VIF_POSIT]; */
|
||||
|
||||
int partitions; /* 0 to 31 */
|
||||
int posts;
|
||||
int mult; /* 1 2 3 or 4 */
|
||||
|
||||
} vorbis_info_floor1;
|
||||
|
||||
/* Residue backend generic *****************************************/
|
||||
|
||||
typedef struct vorbis_info_residue{
|
||||
int type;
|
||||
unsigned char *stagemasks;
|
||||
unsigned char *stagebooks;
|
||||
|
||||
/* block-partitioned VQ coded straight residue */
|
||||
long begin;
|
||||
long end;
|
||||
|
||||
/* first stage (lossless partitioning) */
|
||||
int grouping; /* group n vectors per partition */
|
||||
char partitions; /* possible codebooks for a partition */
|
||||
unsigned char groupbook; /* huffbook for partitioning */
|
||||
char stages;
|
||||
} vorbis_info_residue;
|
||||
|
||||
extern void res_clear_info(vorbis_info_residue *info);
|
||||
extern int res_unpack(vorbis_info_residue *info,
|
||||
vorbis_info *vi,tremor_oggpack_buffer *opb);
|
||||
extern int res_inverse(vorbis_dsp_state *,vorbis_info_residue *info,
|
||||
tremor_ogg_int32_t **in,int *nonzero,int ch);
|
||||
|
||||
/* mode ************************************************************/
|
||||
typedef struct {
|
||||
int blockflag;
|
||||
int windowtype;
|
||||
int transformtype;
|
||||
int mapping;
|
||||
unsigned char blockflag;
|
||||
unsigned char mapping;
|
||||
} vorbis_info_mode;
|
||||
|
||||
typedef void vorbis_info_floor;
|
||||
typedef void vorbis_info_residue;
|
||||
typedef void vorbis_info_mapping;
|
||||
/* Mapping backend generic *****************************************/
|
||||
typedef struct coupling_step{
|
||||
unsigned char mag;
|
||||
unsigned char ang;
|
||||
} coupling_step;
|
||||
|
||||
typedef struct private_state {
|
||||
/* local lookup storage */
|
||||
const void *window[2];
|
||||
typedef struct submap{
|
||||
char floor;
|
||||
char residue;
|
||||
} submap;
|
||||
|
||||
/* backend lookups are tied to the mode, not the backend or naked mapping */
|
||||
int modebits;
|
||||
vorbis_look_mapping **mode;
|
||||
typedef struct vorbis_info_mapping{
|
||||
int submaps;
|
||||
|
||||
unsigned char *chmuxlist;
|
||||
submap *submaplist;
|
||||
|
||||
ogg_int64_t sample_count;
|
||||
int coupling_steps;
|
||||
coupling_step *coupling;
|
||||
} vorbis_info_mapping;
|
||||
|
||||
} private_state;
|
||||
extern int mapping_info_unpack(vorbis_info_mapping *,vorbis_info *,
|
||||
tremor_oggpack_buffer *);
|
||||
extern void mapping_clear_info(vorbis_info_mapping *);
|
||||
extern int mapping_inverse(struct vorbis_dsp_state *,vorbis_info_mapping *);
|
||||
|
||||
/* codec_setup_info contains all the setup information specific to the
|
||||
specific compression/decompression mode in progress (eg,
|
||||
@@ -69,24 +182,32 @@ typedef struct codec_setup_info {
|
||||
|
||||
int modes;
|
||||
int maps;
|
||||
int times;
|
||||
int floors;
|
||||
int residues;
|
||||
int books;
|
||||
|
||||
vorbis_info_mode *mode_param[64];
|
||||
int map_type[64];
|
||||
vorbis_info_mapping *map_param[64];
|
||||
int time_type[64];
|
||||
int floor_type[64];
|
||||
vorbis_info_floor *floor_param[64];
|
||||
int residue_type[64];
|
||||
vorbis_info_residue *residue_param[64];
|
||||
static_codebook *book_param[256];
|
||||
codebook *fullbooks;
|
||||
vorbis_info_mode *mode_param;
|
||||
vorbis_info_mapping *map_param;
|
||||
char *floor_type;
|
||||
vorbis_info_floor **floor_param;
|
||||
vorbis_info_residue *residue_param;
|
||||
codebook *book_param;
|
||||
|
||||
int passlimit[32]; /* iteration limit per couple/quant pass */
|
||||
int coupling_passes;
|
||||
} codec_setup_info;
|
||||
|
||||
extern vorbis_dsp_state *vorbis_dsp_create(vorbis_info *vi);
|
||||
extern void vorbis_dsp_destroy(vorbis_dsp_state *v);
|
||||
extern int vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,
|
||||
tremor_ogg_packet *op);
|
||||
|
||||
extern int vorbis_dsp_restart(vorbis_dsp_state *v);
|
||||
extern int vorbis_dsp_synthesis(vorbis_dsp_state *vd,
|
||||
tremor_ogg_packet *op,int decodep);
|
||||
extern int vorbis_dsp_pcmout(vorbis_dsp_state *v,
|
||||
tremor_ogg_int16_t *pcm,int samples);
|
||||
extern int vorbis_dsp_read(vorbis_dsp_state *v,int samples);
|
||||
extern long vorbis_packet_blocksize(vorbis_info *vi,tremor_ogg_packet *op);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -17,9 +17,10 @@
|
||||
#ifndef _OS_CVTYPES_H
|
||||
#define _OS_CVTYPES_H
|
||||
|
||||
typedef long long ogg_int64_t;
|
||||
typedef int ogg_int32_t;
|
||||
typedef unsigned int ogg_uint32_t;
|
||||
typedef short ogg_int16_t;
|
||||
typedef long long tremor_ogg_int64_t;
|
||||
typedef int tremor_ogg_int32_t;
|
||||
typedef unsigned int tremor_ogg_uint32_t;
|
||||
typedef short tremor_ogg_int16_t;
|
||||
typedef unsigned short tremor_ogg_uint16_t;
|
||||
|
||||
#endif
|
||||
|
||||
+11
-26
@@ -51,7 +51,7 @@ if test -z "$GCC"; then
|
||||
arm-*-*)
|
||||
DEBUG="-g -D_ARM_ASSEM_"
|
||||
CFLAGS="-O -D_ARM_ASSEM_"
|
||||
PROFILE="-p -g -O -D_ARM_ASSEM_" ;;
|
||||
PROFILE="-p -g -O -D_ARM_ASSEM" ;;
|
||||
*)
|
||||
DEBUG="-g"
|
||||
CFLAGS="-O"
|
||||
@@ -61,12 +61,12 @@ else
|
||||
|
||||
case $host in
|
||||
arm-*-*)
|
||||
DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char -D_ARM_ASSEM_"
|
||||
CFLAGS="-O2 -D_ARM_ASSEM_ -fsigned-char"
|
||||
PROFILE="-W -pg -g -O2 -D_ARM_ASSEM_ -fsigned-char -fno-inline-functions";;
|
||||
DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char -D_ARM_ASSEM_"
|
||||
CFLAGS="-O2 -Wall -D_ARM_ASSEM_ -fsigned-char"
|
||||
PROFILE="-Wall -pg -g -O2 -D_ARM_ASSEM_ -fsigned-char -fno-inline-functions";;
|
||||
|
||||
*)
|
||||
DEBUG="-g -Wall -D__NO_MATH_INLINES -fsigned-char"
|
||||
DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char"
|
||||
CFLAGS="-O2 -Wall -fsigned-char"
|
||||
PROFILE="-Wall -pg -g -O2 -fsigned-char -fno-inline-functions";;
|
||||
esac
|
||||
@@ -93,6 +93,12 @@ AC_ARG_ENABLE(
|
||||
CFLAGS="$CFLAGS -D_LOW_ACCURACY_"
|
||||
)
|
||||
|
||||
AC_ARG_ENABLE(
|
||||
64kHz-limit,
|
||||
[ --enable-64kHz-limit limit playback ability to <64kHz files],
|
||||
CFLAGS="$CFLAGS -DLIMIT_TO_64kHz"
|
||||
)
|
||||
|
||||
dnl --------------------------------------------------
|
||||
dnl Check for headers
|
||||
dnl --------------------------------------------------
|
||||
@@ -105,27 +111,6 @@ dnl --------------------------------------------------
|
||||
|
||||
dnl none
|
||||
|
||||
dnl --------------------------------------------------
|
||||
dnl Check for libraries
|
||||
dnl --------------------------------------------------
|
||||
|
||||
PKG_PROG_PKG_CONFIG
|
||||
|
||||
HAVE_OGG=no
|
||||
if test "x$PKG_CONFIG" != "x"
|
||||
then
|
||||
PKG_CHECK_MODULES(OGG, ogg >= 1.0, HAVE_OGG=yes, HAVE_OGG=no)
|
||||
fi
|
||||
if test "x$HAVE_OGG" = "xno"
|
||||
then
|
||||
dnl fall back to the old school test
|
||||
XIPH_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!))
|
||||
libs_save=$LIBS
|
||||
LIBS="$OGG_LIBS"
|
||||
AC_CHECK_FUNC(oggpack_writealign, , AC_MSG_ERROR(Ogg >= 1.0 required !))
|
||||
LIBS=$libs_save
|
||||
fi
|
||||
|
||||
dnl --------------------------------------------------
|
||||
dnl Check for library functions
|
||||
dnl --------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,298 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: PCM data vector blocking, windowing and dis/reassembly
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "tremor_ogg.h"
|
||||
#include "mdct.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "misc.h"
|
||||
#include "window_lookup.h"
|
||||
|
||||
int vorbis_dsp_restart(vorbis_dsp_state *v){
|
||||
if(!v)return -1;
|
||||
{
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci;
|
||||
|
||||
if(!vi)return -1;
|
||||
ci=vi->codec_setup;
|
||||
if(!ci)return -1;
|
||||
|
||||
v->out_end=-1;
|
||||
v->out_begin=-1;
|
||||
|
||||
v->granulepos=-1;
|
||||
v->sequence=-1;
|
||||
v->sample_count=-1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
vorbis_dsp_state *vorbis_dsp_create(vorbis_info *vi){
|
||||
int i;
|
||||
|
||||
vorbis_dsp_state *v=_tremor_ogg_calloc(1,sizeof(*v));
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
|
||||
v->vi=vi;
|
||||
|
||||
v->work=(tremor_ogg_int32_t **)_tremor_ogg_malloc(vi->channels*sizeof(*v->work));
|
||||
v->mdctright=(tremor_ogg_int32_t **)_tremor_ogg_malloc(vi->channels*sizeof(*v->mdctright));
|
||||
for(i=0;i<vi->channels;i++){
|
||||
v->work[i]=(tremor_ogg_int32_t *)_tremor_ogg_calloc(1,(ci->blocksizes[1]>>1)*
|
||||
sizeof(*v->work[i]));
|
||||
v->mdctright[i]=(tremor_ogg_int32_t *)_tremor_ogg_calloc(1,(ci->blocksizes[1]>>2)*
|
||||
sizeof(*v->mdctright[i]));
|
||||
}
|
||||
|
||||
v->lW=0; /* previous window size */
|
||||
v->W=0; /* current window size */
|
||||
|
||||
vorbis_dsp_restart(v);
|
||||
return v;
|
||||
}
|
||||
|
||||
void vorbis_dsp_destroy(vorbis_dsp_state *v){
|
||||
int i;
|
||||
if(v){
|
||||
vorbis_info *vi=v->vi;
|
||||
|
||||
if(v->work){
|
||||
for(i=0;i<vi->channels;i++)
|
||||
if(v->work[i])_tremor_ogg_free(v->work[i]);
|
||||
_tremor_ogg_free(v->work);
|
||||
}
|
||||
if(v->mdctright){
|
||||
for(i=0;i<vi->channels;i++)
|
||||
if(v->mdctright[i])_tremor_ogg_free(v->mdctright[i]);
|
||||
_tremor_ogg_free(v->mdctright);
|
||||
}
|
||||
|
||||
_tremor_ogg_free(v);
|
||||
}
|
||||
}
|
||||
|
||||
static LOOKUP_T *_vorbis_window(int left){
|
||||
switch(left){
|
||||
case 32:
|
||||
return vwin64;
|
||||
case 64:
|
||||
return vwin128;
|
||||
case 128:
|
||||
return vwin256;
|
||||
case 256:
|
||||
return vwin512;
|
||||
case 512:
|
||||
return vwin1024;
|
||||
case 1024:
|
||||
return vwin2048;
|
||||
case 2048:
|
||||
return vwin4096;
|
||||
#ifndef LIMIT_TO_64kHz
|
||||
case 4096:
|
||||
return vwin8192;
|
||||
#endif
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
/* pcm==0 indicates we just want the pending samples, no more */
|
||||
int vorbis_dsp_pcmout(vorbis_dsp_state *v,tremor_ogg_int16_t *pcm,int samples){
|
||||
vorbis_info *vi=v->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
if(v->out_begin>-1 && v->out_begin<v->out_end){
|
||||
int n=v->out_end-v->out_begin;
|
||||
if(pcm){
|
||||
int i;
|
||||
if(n>samples)n=samples;
|
||||
for(i=0;i<vi->channels;i++)
|
||||
mdct_unroll_lap(ci->blocksizes[0],ci->blocksizes[1],
|
||||
v->lW,v->W,v->work[i],v->mdctright[i],
|
||||
_vorbis_window(ci->blocksizes[0]>>1),
|
||||
_vorbis_window(ci->blocksizes[1]>>1),
|
||||
pcm+i,vi->channels,
|
||||
v->out_begin,v->out_begin+n);
|
||||
}
|
||||
return(n);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
int vorbis_dsp_read(vorbis_dsp_state *v,int s){
|
||||
if(s && v->out_begin+s>v->out_end)return(OV_EINVAL);
|
||||
v->out_begin+=s;
|
||||
return(0);
|
||||
}
|
||||
|
||||
long vorbis_packet_blocksize(vorbis_info *vi,tremor_ogg_packet *op){
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
tremor_oggpack_buffer opb;
|
||||
int mode;
|
||||
int modebits=0;
|
||||
int v=ci->modes;
|
||||
|
||||
tremor_oggpack_readinit(&opb,op->packet);
|
||||
|
||||
/* Check the packet type */
|
||||
if(tremor_oggpack_read(&opb,1)!=0){
|
||||
/* Oops. This is not an audio data packet */
|
||||
return(OV_ENOTAUDIO);
|
||||
}
|
||||
|
||||
while(v>1){
|
||||
modebits++;
|
||||
v>>=1;
|
||||
}
|
||||
|
||||
/* read our mode and pre/post windowsize */
|
||||
mode=tremor_oggpack_read(&opb,modebits);
|
||||
if(mode==-1)return(OV_EBADPACKET);
|
||||
return(ci->blocksizes[ci->mode_param[mode].blockflag]);
|
||||
}
|
||||
|
||||
|
||||
static int ilog(tremor_ogg_uint32_t v){
|
||||
int ret=0;
|
||||
if(v)--v;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
int vorbis_dsp_synthesis(vorbis_dsp_state *vd,tremor_ogg_packet *op,int decodep){
|
||||
vorbis_info *vi=vd->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
int mode,i;
|
||||
|
||||
tremor_oggpack_readinit(&vd->opb,op->packet);
|
||||
|
||||
/* Check the packet type */
|
||||
if(tremor_oggpack_read(&vd->opb,1)!=0){
|
||||
/* Oops. This is not an audio data packet */
|
||||
return OV_ENOTAUDIO ;
|
||||
}
|
||||
|
||||
/* read our mode and pre/post windowsize */
|
||||
mode=tremor_oggpack_read(&vd->opb,ilog(ci->modes));
|
||||
if(mode==-1 || mode>=ci->modes) return OV_EBADPACKET;
|
||||
|
||||
/* shift information we still need from last window */
|
||||
vd->lW=vd->W;
|
||||
vd->W=ci->mode_param[mode].blockflag;
|
||||
for(i=0;i<vi->channels;i++)
|
||||
mdct_shift_right(ci->blocksizes[vd->lW],vd->work[i],vd->mdctright[i]);
|
||||
|
||||
if(vd->W){
|
||||
int temp;
|
||||
tremor_oggpack_read(&vd->opb,1);
|
||||
temp=tremor_oggpack_read(&vd->opb,1);
|
||||
if(temp==-1) return OV_EBADPACKET;
|
||||
}
|
||||
|
||||
/* packet decode and portions of synthesis that rely on only this block */
|
||||
if(decodep){
|
||||
mapping_inverse(vd,ci->map_param+ci->mode_param[mode].mapping);
|
||||
|
||||
if(vd->out_begin==-1){
|
||||
vd->out_begin=0;
|
||||
vd->out_end=0;
|
||||
}else{
|
||||
vd->out_begin=0;
|
||||
vd->out_end=ci->blocksizes[vd->lW]/4+ci->blocksizes[vd->W]/4;
|
||||
}
|
||||
}
|
||||
|
||||
/* track the frame number... This is for convenience, but also
|
||||
making sure our last packet doesn't end with added padding.
|
||||
|
||||
This is not foolproof! It will be confused if we begin
|
||||
decoding at the last page after a seek or hole. In that case,
|
||||
we don't have a starting point to judge where the last frame
|
||||
is. For this reason, vorbisfile will always try to make sure
|
||||
it reads the last two marked pages in proper sequence */
|
||||
|
||||
/* if we're out of sequence, dump granpos tracking until we sync back up */
|
||||
if(vd->sequence==-1 || vd->sequence+1 != op->packetno-3){
|
||||
/* out of sequence; lose count */
|
||||
vd->granulepos=-1;
|
||||
vd->sample_count=-1;
|
||||
}
|
||||
|
||||
vd->sequence=op->packetno;
|
||||
vd->sequence=vd->sequence-3;
|
||||
|
||||
if(vd->sample_count==-1){
|
||||
vd->sample_count=0;
|
||||
}else{
|
||||
vd->sample_count+=
|
||||
ci->blocksizes[vd->lW]/4+ci->blocksizes[vd->W]/4;
|
||||
}
|
||||
|
||||
if(vd->granulepos==-1){
|
||||
if(op->granulepos!=-1){ /* only set if we have a
|
||||
position to set to */
|
||||
|
||||
vd->granulepos=op->granulepos;
|
||||
|
||||
/* is this a short page? */
|
||||
if(vd->sample_count>vd->granulepos){
|
||||
/* corner case; if this is both the first and last audio page,
|
||||
then spec says the end is cut, not beginning */
|
||||
if(op->e_o_s){
|
||||
/* trim the end */
|
||||
/* no preceeding granulepos; assume we started at zero (we'd
|
||||
have to in a short single-page stream) */
|
||||
/* granulepos could be -1 due to a seek, but that would result
|
||||
in a long coun t, not short count */
|
||||
|
||||
vd->out_end-=vd->sample_count-vd->granulepos;
|
||||
}else{
|
||||
/* trim the beginning */
|
||||
vd->out_begin+=vd->sample_count-vd->granulepos;
|
||||
if(vd->out_begin>vd->out_end)
|
||||
vd->out_begin=vd->out_end;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}else{
|
||||
vd->granulepos+=
|
||||
ci->blocksizes[vd->lW]/4+ci->blocksizes[vd->W]/4;
|
||||
if(op->granulepos!=-1 && vd->granulepos!=op->granulepos){
|
||||
|
||||
if(vd->granulepos>op->granulepos){
|
||||
long extra=vd->granulepos-op->granulepos;
|
||||
|
||||
if(extra)
|
||||
if(op->e_o_s){
|
||||
/* partial last frame. Strip the extra samples off */
|
||||
vd->out_end-=extra;
|
||||
} /* else {Shouldn't happen *unless* the bitstream is out of
|
||||
spec. Either way, believe the bitstream } */
|
||||
} /* else {Shouldn't happen *unless* the bitstream is out of
|
||||
spec. Either way, believe the bitstream } */
|
||||
vd->granulepos=op->granulepos;
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
+166
-178
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,26 +18,15 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "tremor_ogg.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "registry.h"
|
||||
#include "codebook.h"
|
||||
#include "misc.h"
|
||||
#include "block.h"
|
||||
#include "os.h"
|
||||
|
||||
#define LSP_FRACBITS 14
|
||||
|
||||
typedef struct {
|
||||
long n;
|
||||
int ln;
|
||||
int m;
|
||||
int *linearmap;
|
||||
|
||||
vorbis_info_floor0 *vi;
|
||||
ogg_int32_t *lsp_look;
|
||||
|
||||
} vorbis_look_floor0;
|
||||
extern const tremor_ogg_int32_t FLOOR_fromdB_LOOKUP[];
|
||||
|
||||
/*************** LSP decode ********************/
|
||||
|
||||
@@ -48,7 +37,7 @@ typedef struct {
|
||||
returns in m.8 format */
|
||||
|
||||
static long ADJUST_SQRT2[2]={8192,5792};
|
||||
STIN ogg_int32_t vorbis_invsqlook_i(long a,long e){
|
||||
static inline tremor_ogg_int32_t vorbis_invsqlook_i(long a,long e){
|
||||
long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
|
||||
long d=a&INVSQ_LOOKUP_I_MASK; /* 0.10 */
|
||||
long val=INVSQ_LOOKUP_I[i]- /* 1.16 */
|
||||
@@ -60,60 +49,60 @@ STIN ogg_int32_t vorbis_invsqlook_i(long a,long e){
|
||||
|
||||
/* interpolated lookup based fromdB function, domain -140dB to 0dB only */
|
||||
/* a is in n.12 format */
|
||||
STIN ogg_int32_t vorbis_fromdBlook_i(long a){
|
||||
int i=(-a)>>(12-FROMdB2_SHIFT);
|
||||
if(i<0) return 0x7fffffff;
|
||||
if(i>=(FROMdB_LOOKUP_SZ<<FROMdB_SHIFT))return 0;
|
||||
|
||||
return FROMdB_LOOKUP[i>>FROMdB_SHIFT] * FROMdB2_LOOKUP[i&FROMdB2_MASK];
|
||||
#ifdef _LOW_ACCURACY_
|
||||
static inline tremor_ogg_int32_t vorbis_fromdBlook_i(long a){
|
||||
if(a>0) return 0x7fffffff;
|
||||
if(a<(-140<<12)) return 0;
|
||||
return FLOOR_fromdB_LOOKUP[((a+140)*467)>>20]<<9;
|
||||
}
|
||||
#else
|
||||
static inline tremor_ogg_int32_t vorbis_fromdBlook_i(long a){
|
||||
if(a>0) return 0x7fffffff;
|
||||
if(a<(-140<<12)) return 0;
|
||||
return FLOOR_fromdB_LOOKUP[((a+(140<<12))*467)>>20];
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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 */
|
||||
STIN ogg_int32_t vorbis_coslook_i(long a){
|
||||
static inline tremor_ogg_int32_t 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);
|
||||
}
|
||||
|
||||
/* interpolated lookup based cos function */
|
||||
/* interpolated half-wave lookup based cos function */
|
||||
/* a is in 0.16 format, where 0==0, 2^^16==PI, return .LSP_FRACBITS */
|
||||
STIN ogg_int32_t vorbis_coslook2_i(long a){
|
||||
a=a&0x1ffff;
|
||||
|
||||
if(a>0x10000)a=0x20000-a;
|
||||
{
|
||||
int i=a>>COS_LOOKUP_I_SHIFT;
|
||||
int d=a&COS_LOOKUP_I_MASK;
|
||||
a=((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-
|
||||
d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
|
||||
(COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);
|
||||
}
|
||||
|
||||
return(a);
|
||||
static inline tremor_ogg_int32_t vorbis_coslook2_i(long a){
|
||||
int i=a>>COS_LOOKUP_I_SHIFT;
|
||||
int d=a&COS_LOOKUP_I_MASK;
|
||||
return ((COS_LOOKUP_I[i]<<COS_LOOKUP_I_SHIFT)-
|
||||
d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
|
||||
(COS_LOOKUP_I_SHIFT-LSP_FRACBITS+14);
|
||||
}
|
||||
|
||||
static const int barklook[28]={
|
||||
0,100,200,301, 405,516,635,766,
|
||||
912,1077,1263,1476, 1720,2003,2333,2721,
|
||||
3184,3742,4428,5285, 6376,7791,9662,12181,
|
||||
15624,20397,27087,36554
|
||||
static const tremor_ogg_uint16_t barklook[54]={
|
||||
0,51,102,154, 206,258,311,365,
|
||||
420,477,535,594, 656,719,785,854,
|
||||
926,1002,1082,1166, 1256,1352,1454,1564,
|
||||
1683,1812,1953,2107, 2276,2463,2670,2900,
|
||||
3155,3440,3756,4106, 4493,4919,5387,5901,
|
||||
6466,7094,7798,8599, 9528,10623,11935,13524,
|
||||
15453,17775,20517,23667, 27183,31004
|
||||
};
|
||||
|
||||
/* used in init only; interpolate the long way */
|
||||
STIN ogg_int32_t toBARK(int n){
|
||||
static inline tremor_ogg_int32_t toBARK(int n){
|
||||
int i;
|
||||
for(i=0;i<27;i++)
|
||||
for(i=0;i<54;i++)
|
||||
if(n>=barklook[i] && n<barklook[i+1])break;
|
||||
|
||||
if(i==27){
|
||||
return 27<<15;
|
||||
if(i==54){
|
||||
return 54<<14;
|
||||
}else{
|
||||
int gap=barklook[i+1]-barklook[i];
|
||||
int del=n-barklook[i];
|
||||
|
||||
return((i<<15)+((del<<15)/gap));
|
||||
return (i<<14)+(((n-barklook[i])*
|
||||
((1UL<<31)/(barklook[i+1]-barklook[i])))>>17);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,11 +122,11 @@ static const unsigned char MLOOP_2[64]={
|
||||
|
||||
static const unsigned char MLOOP_3[8]={0,1,2,2,3,3,3,3};
|
||||
|
||||
void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
|
||||
ogg_int32_t *lsp,int m,
|
||||
ogg_int32_t amp,
|
||||
ogg_int32_t ampoffset,
|
||||
ogg_int32_t *icos){
|
||||
void vorbis_lsp_to_curve(tremor_ogg_int32_t *curve,int n,int ln,
|
||||
tremor_ogg_int32_t *lsp,int m,
|
||||
tremor_ogg_int32_t amp,
|
||||
tremor_ogg_int32_t ampoffset,
|
||||
tremor_ogg_int32_t nyq){
|
||||
|
||||
/* 0 <= m < 256 */
|
||||
|
||||
@@ -145,13 +134,34 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
|
||||
int i;
|
||||
int ampoffseti=ampoffset*4096;
|
||||
int ampi=amp;
|
||||
ogg_int32_t *ilsp=(ogg_int32_t *)alloca(m*sizeof(*ilsp));
|
||||
tremor_ogg_int32_t *ilsp=(tremor_ogg_int32_t *)alloca(m*sizeof(*ilsp));
|
||||
|
||||
tremor_ogg_uint32_t inyq= (1UL<<31) / toBARK(nyq);
|
||||
tremor_ogg_uint32_t imap= (1UL<<31) / ln;
|
||||
tremor_ogg_uint32_t tBnyq1 = toBARK(nyq)<<1;
|
||||
|
||||
/* Besenham for frequency scale to avoid a division */
|
||||
int f=0;
|
||||
int fdx=n;
|
||||
int fbase=nyq/fdx;
|
||||
int ferr=0;
|
||||
int fdy=nyq-fbase*fdx;
|
||||
int map=0;
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
tremor_ogg_uint32_t nextbark=((tBnyq1<<11)/ln)>>12;
|
||||
#else
|
||||
tremor_ogg_uint32_t nextbark=MULT31(imap>>1,tBnyq1);
|
||||
#endif
|
||||
int nextf=barklook[nextbark>>14]+(((nextbark&0x3fff)*
|
||||
(barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);
|
||||
|
||||
/* lsp is in 8.24, range 0 to PI; coslook wants it in .16 0 to 1*/
|
||||
for(i=0;i<m;i++){
|
||||
#ifndef _LOW_ACCURACY_
|
||||
ogg_int32_t val=MULT32(lsp[i],0x517cc2);
|
||||
tremor_ogg_int32_t val=MULT32(lsp[i],0x517cc2);
|
||||
#else
|
||||
ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;
|
||||
tremor_ogg_int32_t val=((lsp[i]>>10)*0x517d)>>14;
|
||||
#endif
|
||||
|
||||
/* safeguard against a malicious stream */
|
||||
@@ -165,11 +175,14 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
|
||||
|
||||
i=0;
|
||||
while(i<n){
|
||||
int j,k=map[i];
|
||||
ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */
|
||||
ogg_uint32_t qi=46341;
|
||||
ogg_int32_t qexp=0,shift;
|
||||
ogg_int32_t wi=icos[k];
|
||||
int j;
|
||||
tremor_ogg_uint32_t pi=46341; /* 2**-.5 in 0.16 */
|
||||
tremor_ogg_uint32_t qi=46341;
|
||||
tremor_ogg_int32_t qexp=0,shift;
|
||||
tremor_ogg_int32_t wi;
|
||||
|
||||
wi=vorbis_coslook2_i((map*imap)>>15);
|
||||
|
||||
|
||||
#ifdef _V_LSP_MATH_ASM
|
||||
lsp_loop_asm(&qi,&pi,&qexp,ilsp,wi,m);
|
||||
@@ -197,24 +210,22 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
|
||||
|
||||
#else
|
||||
|
||||
j=1;
|
||||
if(m>1){
|
||||
qi*=labs(ilsp[0]-wi);
|
||||
pi*=labs(ilsp[1]-wi);
|
||||
qi*=labs(ilsp[0]-wi);
|
||||
pi*=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];
|
||||
qi=(qi>>shift)*labs(ilsp[j-1]-wi);
|
||||
pi=(pi>>shift)*labs(ilsp[j]-wi);
|
||||
qexp+=shift;
|
||||
}
|
||||
for(j=3;j<m;j+=2){
|
||||
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
||||
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
||||
shift=MLOOP_3[(pi|qi)>>16];
|
||||
|
||||
qi=(qi>>shift)*labs(ilsp[j-1]-wi);
|
||||
pi=(pi>>shift)*labs(ilsp[j]-wi);
|
||||
qexp+=shift;
|
||||
}
|
||||
if(!(shift=MLOOP_1[(pi|qi)>>25]))
|
||||
if(!(shift=MLOOP_2[(pi|qi)>>19]))
|
||||
shift=MLOOP_3[(pi|qi)>>16];
|
||||
|
||||
|
||||
/* pi,qi normalized collectively, both tracked using qexp */
|
||||
|
||||
if(m&1){
|
||||
@@ -282,54 +293,78 @@ void vorbis_lsp_to_curve(ogg_int32_t *curve,int *map,int n,int ln,
|
||||
amp>>=9;
|
||||
#endif
|
||||
curve[i]= MULT31_SHIFT15(curve[i],amp);
|
||||
while(map[++i]==k) curve[i]= MULT31_SHIFT15(curve[i],amp);
|
||||
|
||||
while(++i<n){
|
||||
|
||||
/* line plot to get new f */
|
||||
ferr+=fdy;
|
||||
if(ferr>=fdx){
|
||||
ferr-=fdx;
|
||||
f++;
|
||||
}
|
||||
f+=fbase;
|
||||
|
||||
if(f>=nextf)break;
|
||||
|
||||
curve[i]= MULT31_SHIFT15(curve[i],amp);
|
||||
}
|
||||
|
||||
while(1){
|
||||
map++;
|
||||
|
||||
if(map+1<ln){
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
nextbark=((tBnyq1<<11)/ln*(map+1))>>12;
|
||||
#else
|
||||
nextbark=MULT31((map+1)*(imap>>1),tBnyq1);
|
||||
#endif
|
||||
nextf=barklook[nextbark>>14]+
|
||||
(((nextbark&0x3fff)*
|
||||
(barklook[(nextbark>>14)+1]-barklook[nextbark>>14]))>>14);
|
||||
if(f<=nextf)break;
|
||||
|
||||
}else{
|
||||
nextf=9999999;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(map>=ln){
|
||||
map=ln-1; /* guard against the approximation */
|
||||
nextf=9999999;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*************** vorbis decode glue ************/
|
||||
|
||||
static void floor0_free_info(vorbis_info_floor *i){
|
||||
void floor0_free_info(vorbis_info_floor *i){
|
||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
|
||||
if(info){
|
||||
memset(info,0,sizeof(*info));
|
||||
_ogg_free(info);
|
||||
}
|
||||
if(info)_tremor_ogg_free(info);
|
||||
}
|
||||
|
||||
static void floor0_free_look(vorbis_look_floor *i){
|
||||
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
|
||||
if(look){
|
||||
|
||||
if(look->linearmap)_ogg_free(look->linearmap);
|
||||
if(look->lsp_look)_ogg_free(look->lsp_look);
|
||||
memset(look,0,sizeof(*look));
|
||||
_ogg_free(look);
|
||||
}
|
||||
}
|
||||
|
||||
static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||
vorbis_info_floor *floor0_info_unpack (vorbis_info *vi,tremor_oggpack_buffer *opb){
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
int j;
|
||||
|
||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)_ogg_malloc(sizeof(*info));
|
||||
info->order=oggpack_read(opb,8);
|
||||
info->rate=oggpack_read(opb,16);
|
||||
info->barkmap=oggpack_read(opb,16);
|
||||
info->ampbits=oggpack_read(opb,6);
|
||||
info->ampdB=oggpack_read(opb,8);
|
||||
info->numbooks=oggpack_read(opb,4)+1;
|
||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)_tremor_ogg_malloc(sizeof(*info));
|
||||
info->order=tremor_oggpack_read(opb,8);
|
||||
info->rate=tremor_oggpack_read(opb,16);
|
||||
info->barkmap=tremor_oggpack_read(opb,16);
|
||||
info->ampbits=tremor_oggpack_read(opb,6);
|
||||
info->ampdB=tremor_oggpack_read(opb,8);
|
||||
info->numbooks=tremor_oggpack_read(opb,4)+1;
|
||||
|
||||
if(info->order<1)goto err_out;
|
||||
if(info->rate<1)goto err_out;
|
||||
if(info->barkmap<1)goto err_out;
|
||||
if(info->numbooks<1)goto err_out;
|
||||
|
||||
for(j=0;j<info->numbooks;j++){
|
||||
info->books[j]=oggpack_read(opb,8);
|
||||
if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
|
||||
if(ci->book_param[info->books[j]]->maptype==0)goto err_out;
|
||||
if(ci->book_param[info->books[j]]->dim<1)goto err_out;
|
||||
info->books[j]=tremor_oggpack_read(opb,8);
|
||||
if(info->books[j]>=ci->books)goto err_out;
|
||||
}
|
||||
|
||||
if(tremor_oggpack_eop(opb))goto err_out;
|
||||
return(info);
|
||||
|
||||
err_out:
|
||||
@@ -337,74 +372,34 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
/* initialize Bark scale and normalization lookups. We could do this
|
||||
with static tables, but Vorbis allows a number of possible
|
||||
combinations, so it's best to do it computationally.
|
||||
|
||||
The below is authoritative in terms of defining scale mapping.
|
||||
Note that the scale depends on the sampling rate as well as the
|
||||
linear block and mapping sizes */
|
||||
|
||||
static vorbis_look_floor *floor0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
|
||||
vorbis_info_floor *i){
|
||||
int j;
|
||||
vorbis_info *vi=vd->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
int floor0_memosize(vorbis_info_floor *i){
|
||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
|
||||
vorbis_look_floor0 *look=(vorbis_look_floor0 *)_ogg_calloc(1,sizeof(*look));
|
||||
look->m=info->order;
|
||||
look->n=ci->blocksizes[mi->blockflag]/2;
|
||||
look->ln=info->barkmap;
|
||||
look->vi=info;
|
||||
|
||||
/* the mapping from a linear scale to a smaller bark scale is
|
||||
straightforward. We do *not* make sure that the linear mapping
|
||||
does not skip bark-scale bins; the decoder simply skips them and
|
||||
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=(int *)_ogg_malloc((look->n+1)*sizeof(*look->linearmap));
|
||||
for(j=0;j<look->n;j++){
|
||||
|
||||
int val=(look->ln*
|
||||
((toBARK(info->rate/2*j/look->n)<<11)/toBARK(info->rate/2)))>>11;
|
||||
|
||||
if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
|
||||
look->linearmap[j]=val;
|
||||
}
|
||||
look->linearmap[j]=-1;
|
||||
|
||||
look->lsp_look=(ogg_int32_t *)_ogg_malloc(look->ln*sizeof(*look->lsp_look));
|
||||
for(j=0;j<look->ln;j++)
|
||||
look->lsp_look[j]=vorbis_coslook2_i(0x10000*j/look->ln);
|
||||
|
||||
return look;
|
||||
return info->order+1;
|
||||
}
|
||||
|
||||
static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
||||
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
|
||||
vorbis_info_floor0 *info=look->vi;
|
||||
tremor_ogg_int32_t *floor0_inverse1(vorbis_dsp_state *vd,vorbis_info_floor *i,
|
||||
tremor_ogg_int32_t *lsp){
|
||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
|
||||
int j,k;
|
||||
|
||||
int ampraw=oggpack_read(&vb->opb,info->ampbits);
|
||||
int ampraw=tremor_oggpack_read(&vd->opb,info->ampbits);
|
||||
if(ampraw>0){ /* also handles the -1 out of data case */
|
||||
long maxval=(1<<info->ampbits)-1;
|
||||
int amp=((ampraw*info->ampdB)<<4)/maxval;
|
||||
int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
|
||||
int booknum=tremor_oggpack_read(&vd->opb,_ilog(info->numbooks));
|
||||
|
||||
if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
|
||||
codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
|
||||
codebook *b=ci->fullbooks+info->books[booknum];
|
||||
ogg_int32_t last=0;
|
||||
ogg_int32_t *lsp=(ogg_int32_t *)_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+1));
|
||||
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
|
||||
codebook *b=ci->book_param+info->books[booknum];
|
||||
tremor_ogg_int32_t last=0;
|
||||
|
||||
if(vorbis_book_decodev_set(b,lsp,&vb->opb,look->m,-24)==-1)goto eop;
|
||||
for(j=0;j<look->m;){
|
||||
for(k=0;j<look->m && k<b->dim;k++,j++)lsp[j]+=last;
|
||||
if(vorbis_book_decodev_set(b,lsp,&vd->opb,info->order,-24)==-1)goto eop;
|
||||
for(j=0;j<info->order;){
|
||||
for(k=0;j<info->order && k<b->dim;k++,j++)lsp[j]+=last;
|
||||
last=lsp[j-1];
|
||||
}
|
||||
|
||||
lsp[look->m]=amp;
|
||||
lsp[info->order]=amp;
|
||||
return(lsp);
|
||||
}
|
||||
}
|
||||
@@ -412,28 +407,21 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
|
||||
void *memo,ogg_int32_t *out){
|
||||
vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
|
||||
vorbis_info_floor0 *info=look->vi;
|
||||
int floor0_inverse2(vorbis_dsp_state *vd,vorbis_info_floor *i,
|
||||
tremor_ogg_int32_t *lsp,tremor_ogg_int32_t *out){
|
||||
vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
|
||||
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
|
||||
|
||||
if(memo){
|
||||
ogg_int32_t *lsp=(ogg_int32_t *)memo;
|
||||
ogg_int32_t amp=lsp[look->m];
|
||||
if(lsp){
|
||||
tremor_ogg_int32_t amp=lsp[info->order];
|
||||
|
||||
/* take the coefficients back to a spectral envelope curve */
|
||||
vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
|
||||
lsp,look->m,amp,info->ampdB,look->lsp_look);
|
||||
vorbis_lsp_to_curve(out,ci->blocksizes[vd->W]/2,info->barkmap,
|
||||
lsp,info->order,amp,info->ampdB,
|
||||
info->rate>>1);
|
||||
return(1);
|
||||
}
|
||||
memset(out,0,sizeof(*out)*look->n);
|
||||
memset(out,0,sizeof(*out)*ci->blocksizes[vd->W]/2);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* export hooks */
|
||||
vorbis_func_floor floor0_exportbundle={
|
||||
&floor0_unpack,&floor0_look,&floor0_free_info,
|
||||
&floor0_free_look,&floor0_inverse1,&floor0_inverse2
|
||||
};
|
||||
|
||||
|
||||
|
||||
+150
-258
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,44 +18,29 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "tremor_ogg.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "registry.h"
|
||||
#include "codebook.h"
|
||||
#include "misc.h"
|
||||
#include "block.h"
|
||||
|
||||
extern const tremor_ogg_int32_t FLOOR_fromdB_LOOKUP[];
|
||||
#define floor1_rangedB 140 /* floor 1 fixed at -140dB to 0dB range */
|
||||
|
||||
typedef struct {
|
||||
int forward_index[VIF_POSIT+2];
|
||||
|
||||
int hineighbor[VIF_POSIT];
|
||||
int loneighbor[VIF_POSIT];
|
||||
int posts;
|
||||
|
||||
int n;
|
||||
int quant_q;
|
||||
vorbis_info_floor1 *vi;
|
||||
|
||||
} vorbis_look_floor1;
|
||||
#define VIF_POSIT 63
|
||||
|
||||
/***********************************************/
|
||||
|
||||
static void floor1_free_info(vorbis_info_floor *i){
|
||||
void floor1_free_info(vorbis_info_floor *i){
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
|
||||
if(info){
|
||||
if(info->class)_tremor_ogg_free(info->class);
|
||||
if(info->partitionclass)_tremor_ogg_free(info->partitionclass);
|
||||
if(info->postlist)_tremor_ogg_free(info->postlist);
|
||||
if(info->forward_index)_tremor_ogg_free(info->forward_index);
|
||||
if(info->hineighbor)_tremor_ogg_free(info->hineighbor);
|
||||
if(info->loneighbor)_tremor_ogg_free(info->loneighbor);
|
||||
memset(info,0,sizeof(*info));
|
||||
_ogg_free(info);
|
||||
}
|
||||
}
|
||||
|
||||
static void floor1_free_look(vorbis_look_floor *i){
|
||||
vorbis_look_floor1 *look=(vorbis_look_floor1 *)i;
|
||||
if(look){
|
||||
memset(look,0,sizeof(*look));
|
||||
_ogg_free(look);
|
||||
_tremor_ogg_free(info);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,65 +53,124 @@ static int ilog(unsigned int v){
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int icomp(const void *a,const void *b){
|
||||
return(**(int **)a-**(int **)b);
|
||||
static void vorbis_mergesort(char *index,tremor_ogg_uint16_t *vals,tremor_ogg_uint16_t n){
|
||||
tremor_ogg_uint16_t i,j;
|
||||
char *temp,*A=index,*B=_tremor_ogg_malloc(n*sizeof(*B));
|
||||
|
||||
for(i=1;i<n;i<<=1){
|
||||
for(j=0;j+i<n;){
|
||||
int k1=j;
|
||||
int mid=j+i;
|
||||
int k2=mid;
|
||||
int end=(j+i*2<n?j+i*2:n);
|
||||
while(k1<mid && k2<end){
|
||||
if(vals[A[k1]]<vals[A[k2]])
|
||||
B[j++]=A[k1++];
|
||||
else
|
||||
B[j++]=A[k2++];
|
||||
}
|
||||
while(k1<mid) B[j++]=A[k1++];
|
||||
while(k2<end) B[j++]=A[k2++];
|
||||
}
|
||||
for(;j<n;j++)B[j]=A[j];
|
||||
temp=A;A=B;B=temp;
|
||||
}
|
||||
|
||||
if(B==index){
|
||||
for(j=0;j<n;j++)B[j]=A[j];
|
||||
_tremor_ogg_free(A);
|
||||
}else
|
||||
_tremor_ogg_free(B);
|
||||
}
|
||||
|
||||
static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||
|
||||
vorbis_info_floor *floor1_info_unpack (vorbis_info *vi,tremor_oggpack_buffer *opb){
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
int j,k,count=0,maxclass=-1,rangebits;
|
||||
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)_ogg_calloc(1,sizeof(*info));
|
||||
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)_tremor_ogg_calloc(1,sizeof(*info));
|
||||
/* read partitions */
|
||||
info->partitions=oggpack_read(opb,5); /* only 0 to 31 legal */
|
||||
info->partitions=tremor_oggpack_read(opb,5); /* only 0 to 31 legal */
|
||||
info->partitionclass=
|
||||
(char *)_tremor_ogg_malloc(info->partitions*sizeof(*info->partitionclass));
|
||||
for(j=0;j<info->partitions;j++){
|
||||
info->partitionclass[j]=oggpack_read(opb,4); /* only 0 to 15 legal */
|
||||
if(info->partitionclass[j]<0)goto err_out;
|
||||
info->partitionclass[j]=tremor_oggpack_read(opb,4); /* only 0 to 15 legal */
|
||||
if(maxclass<info->partitionclass[j])maxclass=info->partitionclass[j];
|
||||
}
|
||||
|
||||
/* read partition classes */
|
||||
info->class=
|
||||
(floor1class *)_tremor_ogg_malloc((maxclass+1)*sizeof(*info->class));
|
||||
for(j=0;j<maxclass+1;j++){
|
||||
info->class_dim[j]=oggpack_read(opb,3)+1; /* 1 to 8 */
|
||||
info->class_subs[j]=oggpack_read(opb,2); /* 0,1,2,3 bits */
|
||||
if(info->class_subs[j]<0)
|
||||
goto err_out;
|
||||
if(info->class_subs[j])info->class_book[j]=oggpack_read(opb,8);
|
||||
if(info->class_book[j]<0 || info->class_book[j]>=ci->books)
|
||||
goto err_out;
|
||||
for(k=0;k<(1<<info->class_subs[j]);k++){
|
||||
info->class_subbook[j][k]=oggpack_read(opb,8)-1;
|
||||
if(info->class_subbook[j][k]<-1 || info->class_subbook[j][k]>=ci->books)
|
||||
goto err_out;
|
||||
info->class[j].class_dim=tremor_oggpack_read(opb,3)+1; /* 1 to 8 */
|
||||
info->class[j].class_subs=tremor_oggpack_read(opb,2); /* 0,1,2,3 bits */
|
||||
if(tremor_oggpack_eop(opb)<0) goto err_out;
|
||||
if(info->class[j].class_subs)
|
||||
info->class[j].class_book=tremor_oggpack_read(opb,8);
|
||||
else
|
||||
info->class[j].class_book=0;
|
||||
if(info->class[j].class_book>=ci->books)goto err_out;
|
||||
for(k=0;k<(1<<info->class[j].class_subs);k++){
|
||||
info->class[j].class_subbook[k]=tremor_oggpack_read(opb,8)-1;
|
||||
if(info->class[j].class_subbook[k]>=ci->books &&
|
||||
info->class[j].class_subbook[k]!=0xff)goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
/* read the post list */
|
||||
info->mult=oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */
|
||||
rangebits=oggpack_read(opb,4);
|
||||
if(rangebits<0)goto err_out;
|
||||
info->mult=tremor_oggpack_read(opb,2)+1; /* only 1,2,3,4 legal now */
|
||||
rangebits=tremor_oggpack_read(opb,4);
|
||||
|
||||
for(j=0,k=0;j<info->partitions;j++)
|
||||
count+=info->class[info->partitionclass[j]].class_dim;
|
||||
info->postlist=
|
||||
(tremor_ogg_uint16_t *)_tremor_ogg_malloc((count+2)*sizeof(*info->postlist));
|
||||
info->forward_index=
|
||||
(char *)_tremor_ogg_malloc((count+2)*sizeof(*info->forward_index));
|
||||
info->loneighbor=
|
||||
(char *)_tremor_ogg_malloc(count*sizeof(*info->loneighbor));
|
||||
info->hineighbor=
|
||||
(char *)_tremor_ogg_malloc(count*sizeof(*info->hineighbor));
|
||||
|
||||
count=0;
|
||||
for(j=0,k=0;j<info->partitions;j++){
|
||||
count+=info->class_dim[info->partitionclass[j]];
|
||||
count+=info->class[info->partitionclass[j]].class_dim;
|
||||
if(count>VIF_POSIT)goto err_out;
|
||||
for(;k<count;k++){
|
||||
int t=info->postlist[k+2]=oggpack_read(opb,rangebits);
|
||||
if(t<0 || t>=(1<<rangebits))
|
||||
goto err_out;
|
||||
int t=info->postlist[k+2]=tremor_oggpack_read(opb,rangebits);
|
||||
if(t>=(1<<rangebits))goto err_out;
|
||||
}
|
||||
}
|
||||
if(tremor_oggpack_eop(opb))goto err_out;
|
||||
info->postlist[0]=0;
|
||||
info->postlist[1]=1<<rangebits;
|
||||
info->posts=count+2;
|
||||
|
||||
/* don't allow repeated values in post list as they'd result in
|
||||
zero-length segments */
|
||||
{
|
||||
int *sortpointer[VIF_POSIT+2];
|
||||
for(j=0;j<count+2;j++)sortpointer[j]=info->postlist+j;
|
||||
qsort(sortpointer,count+2,sizeof(*sortpointer),icomp);
|
||||
|
||||
for(j=1;j<count+2;j++)
|
||||
if(*sortpointer[j-1]==*sortpointer[j])goto err_out;
|
||||
/* also store a sorted position index */
|
||||
for(j=0;j<info->posts;j++)info->forward_index[j]=j;
|
||||
vorbis_mergesort(info->forward_index,info->postlist,info->posts);
|
||||
|
||||
/* discover our neighbors for decode where we don't use fit flags
|
||||
(that would push the neighbors outward) */
|
||||
for(j=0;j<info->posts-2;j++){
|
||||
int lo=0;
|
||||
int hi=1;
|
||||
int lx=0;
|
||||
int hx=info->postlist[1];
|
||||
int currentx=info->postlist[j+2];
|
||||
for(k=0;k<j+2;k++){
|
||||
int x=info->postlist[k];
|
||||
if(x>lx && x<currentx){
|
||||
lo=k;
|
||||
lx=x;
|
||||
}
|
||||
if(x<hx && x>currentx){
|
||||
hi=k;
|
||||
hx=x;
|
||||
}
|
||||
}
|
||||
info->loneighbor[j]=lo;
|
||||
info->hineighbor[j]=hi;
|
||||
}
|
||||
|
||||
return(info);
|
||||
@@ -136,77 +180,6 @@ static vorbis_info_floor *floor1_unpack (vorbis_info *vi,oggpack_buffer *opb){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
static vorbis_look_floor *floor1_look(vorbis_dsp_state *vd,vorbis_info_mode *mi,
|
||||
vorbis_info_floor *in){
|
||||
|
||||
int *sortpointer[VIF_POSIT+2];
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
|
||||
vorbis_look_floor1 *look=(vorbis_look_floor1 *)_ogg_calloc(1,sizeof(*look));
|
||||
int i,j,n=0;
|
||||
|
||||
look->vi=info;
|
||||
look->n=info->postlist[1];
|
||||
|
||||
/* we drop each position value in-between already decoded values,
|
||||
and use linear interpolation to predict each new value past the
|
||||
edges. The positions are read in the order of the position
|
||||
list... we precompute the bounding positions in the lookup. Of
|
||||
course, the neighbors can change (if a position is declined), but
|
||||
this is an initial mapping */
|
||||
|
||||
for(i=0;i<info->partitions;i++)n+=info->class_dim[info->partitionclass[i]];
|
||||
n+=2;
|
||||
look->posts=n;
|
||||
|
||||
/* also store a sorted position index */
|
||||
for(i=0;i<n;i++)sortpointer[i]=info->postlist+i;
|
||||
qsort(sortpointer,n,sizeof(*sortpointer),icomp);
|
||||
|
||||
/* points from sort order back to range number */
|
||||
for(i=0;i<n;i++)look->forward_index[i]=sortpointer[i]-info->postlist;
|
||||
|
||||
/* quantize values to multiplier spec */
|
||||
switch(info->mult){
|
||||
case 1: /* 1024 -> 256 */
|
||||
look->quant_q=256;
|
||||
break;
|
||||
case 2: /* 1024 -> 128 */
|
||||
look->quant_q=128;
|
||||
break;
|
||||
case 3: /* 1024 -> 86 */
|
||||
look->quant_q=86;
|
||||
break;
|
||||
case 4: /* 1024 -> 64 */
|
||||
look->quant_q=64;
|
||||
break;
|
||||
}
|
||||
|
||||
/* discover our neighbors for decode where we don't use fit flags
|
||||
(that would push the neighbors outward) */
|
||||
for(i=0;i<n-2;i++){
|
||||
int lo=0;
|
||||
int hi=1;
|
||||
int lx=0;
|
||||
int hx=look->n;
|
||||
int currentx=info->postlist[i+2];
|
||||
for(j=0;j<i+2;j++){
|
||||
int x=info->postlist[j];
|
||||
if(x>lx && x<currentx){
|
||||
lo=j;
|
||||
lx=x;
|
||||
}
|
||||
if(x<hx && x>currentx){
|
||||
hi=j;
|
||||
hx=x;
|
||||
}
|
||||
}
|
||||
look->loneighbor[i]=lo;
|
||||
look->hineighbor[i]=hi;
|
||||
}
|
||||
|
||||
return(look);
|
||||
}
|
||||
|
||||
static int render_point(int x0,int x1,int y0,int y1,int x){
|
||||
y0&=0x7fff; /* mask off flag */
|
||||
y1&=0x7fff;
|
||||
@@ -223,80 +196,7 @@ static int render_point(int x0,int x1,int y0,int y1,int x){
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
# define XdB(n) ((((n)>>8)+1)>>1)
|
||||
#else
|
||||
# define XdB(n) (n)
|
||||
#endif
|
||||
|
||||
static const ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
|
||||
XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
|
||||
XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
|
||||
XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
|
||||
XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
|
||||
XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
|
||||
XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
|
||||
XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
|
||||
XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
|
||||
XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
|
||||
XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
|
||||
XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
|
||||
XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
|
||||
XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
|
||||
XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
|
||||
XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
|
||||
XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
|
||||
XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
|
||||
XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
|
||||
XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
|
||||
XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
|
||||
XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
|
||||
XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
|
||||
XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
|
||||
XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
|
||||
XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
|
||||
XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
|
||||
XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
|
||||
XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
|
||||
XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
|
||||
XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
|
||||
XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
|
||||
XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
|
||||
XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
|
||||
XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
|
||||
XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
|
||||
XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
|
||||
XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
|
||||
XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
|
||||
XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
|
||||
XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
|
||||
XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
|
||||
XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
|
||||
XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
|
||||
XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
|
||||
XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
|
||||
XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
|
||||
XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
|
||||
XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
|
||||
XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
|
||||
XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
|
||||
XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
|
||||
XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
|
||||
XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
|
||||
XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
|
||||
XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
|
||||
XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
|
||||
XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
|
||||
XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
|
||||
XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
|
||||
XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
|
||||
XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
|
||||
XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
|
||||
XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
|
||||
XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
|
||||
};
|
||||
|
||||
static void render_line(int n, int x0,int x1,int y0,int y1,ogg_int32_t *d){
|
||||
static void render_line(int n,int x0,int x1,int y0,int y1,tremor_ogg_int32_t *d){
|
||||
int dy=y1-y0;
|
||||
int adx=x1-x0;
|
||||
int ady=abs(dy);
|
||||
@@ -324,42 +224,48 @@ static void render_line(int n, int x0,int x1,int y0,int y1,ogg_int32_t *d){
|
||||
}
|
||||
}
|
||||
|
||||
static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||
vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
|
||||
vorbis_info_floor1 *info=look->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
|
||||
int floor1_memosize(vorbis_info_floor *i){
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)i;
|
||||
return info->posts;
|
||||
}
|
||||
|
||||
static int quant_look[4]={256,128,86,64};
|
||||
|
||||
tremor_ogg_int32_t *floor1_inverse1(vorbis_dsp_state *vd,vorbis_info_floor *in,
|
||||
tremor_ogg_int32_t *fit_value){
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
|
||||
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
|
||||
|
||||
int i,j,k;
|
||||
codebook *books=ci->fullbooks;
|
||||
|
||||
codebook *books=ci->book_param;
|
||||
int quant_q=quant_look[info->mult-1];
|
||||
|
||||
/* unpack wrapped/predicted values from stream */
|
||||
if(oggpack_read(&vb->opb,1)==1){
|
||||
int *fit_value=(int *)_vorbis_block_alloc(vb,(look->posts)*sizeof(*fit_value));
|
||||
|
||||
fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
|
||||
fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
|
||||
if(tremor_oggpack_read(&vd->opb,1)==1){
|
||||
fit_value[0]=tremor_oggpack_read(&vd->opb,ilog(quant_q-1));
|
||||
fit_value[1]=tremor_oggpack_read(&vd->opb,ilog(quant_q-1));
|
||||
|
||||
/* partition by partition */
|
||||
/* partition by partition */
|
||||
for(i=0,j=2;i<info->partitions;i++){
|
||||
int classv=info->partitionclass[i];
|
||||
int cdim=info->class_dim[classv];
|
||||
int csubbits=info->class_subs[classv];
|
||||
int cdim=info->class[classv].class_dim;
|
||||
int csubbits=info->class[classv].class_subs;
|
||||
int csub=1<<csubbits;
|
||||
int cval=0;
|
||||
|
||||
/* decode the partition's first stage cascade value */
|
||||
if(csubbits){
|
||||
cval=vorbis_book_decode(books+info->class_book[classv],&vb->opb);
|
||||
cval=vorbis_book_decode(books+info->class[classv].class_book,&vd->opb);
|
||||
|
||||
if(cval==-1)goto eop;
|
||||
}
|
||||
|
||||
for(k=0;k<cdim;k++){
|
||||
int book=info->class_subbook[classv][cval&(csub-1)];
|
||||
int book=info->class[classv].class_subbook[cval&(csub-1)];
|
||||
cval>>=csubbits;
|
||||
if(book>=0){
|
||||
if((fit_value[j+k]=vorbis_book_decode(books+book,&vb->opb))==-1)
|
||||
if(book!=0xff){
|
||||
if((fit_value[j+k]=vorbis_book_decode(books+book,&vd->opb))==-1)
|
||||
goto eop;
|
||||
}else{
|
||||
fit_value[j+k]=0;
|
||||
@@ -369,13 +275,13 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||
}
|
||||
|
||||
/* unwrap positive values and reconsitute via linear interpolation */
|
||||
for(i=2;i<look->posts;i++){
|
||||
int predicted=render_point(info->postlist[look->loneighbor[i-2]],
|
||||
info->postlist[look->hineighbor[i-2]],
|
||||
fit_value[look->loneighbor[i-2]],
|
||||
fit_value[look->hineighbor[i-2]],
|
||||
for(i=2;i<info->posts;i++){
|
||||
int predicted=render_point(info->postlist[info->loneighbor[i-2]],
|
||||
info->postlist[info->hineighbor[i-2]],
|
||||
fit_value[info->loneighbor[i-2]],
|
||||
fit_value[info->hineighbor[i-2]],
|
||||
info->postlist[i]);
|
||||
int hiroom=look->quant_q-predicted;
|
||||
int hiroom=quant_q-predicted;
|
||||
int loroom=predicted;
|
||||
int room=(hiroom<loroom?hiroom:loroom)<<1;
|
||||
int val=fit_value[i];
|
||||
@@ -395,9 +301,9 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||
}
|
||||
}
|
||||
|
||||
fit_value[i]=(val+predicted)&0x7fff;;
|
||||
fit_value[look->loneighbor[i-2]]&=0x7fff;
|
||||
fit_value[look->hineighbor[i-2]]&=0x7fff;
|
||||
fit_value[i]=val+predicted;
|
||||
fit_value[info->loneighbor[i-2]]&=0x7fff;
|
||||
fit_value[info->hineighbor[i-2]]&=0x7fff;
|
||||
|
||||
}else{
|
||||
fit_value[i]=predicted|0x8000;
|
||||
@@ -411,34 +317,27 @@ static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
||||
ogg_int32_t *out){
|
||||
vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
|
||||
vorbis_info_floor1 *info=look->vi;
|
||||
int floor1_inverse2(vorbis_dsp_state *vd,vorbis_info_floor *in,
|
||||
tremor_ogg_int32_t *fit_value,tremor_ogg_int32_t *out){
|
||||
vorbis_info_floor1 *info=(vorbis_info_floor1 *)in;
|
||||
|
||||
codec_setup_info *ci=(codec_setup_info *)vb->vd->vi->codec_setup;
|
||||
int n=ci->blocksizes[vb->W]/2;
|
||||
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
|
||||
int n=ci->blocksizes[vd->W]/2;
|
||||
int j;
|
||||
|
||||
if(memo){
|
||||
if(fit_value){
|
||||
/* render the lines */
|
||||
int *fit_value=(int *)memo;
|
||||
int hx=0;
|
||||
int lx=0;
|
||||
int ly=fit_value[0]*info->mult;
|
||||
/* guard lookup against out-of-range values */
|
||||
ly=(ly<0?0:ly>255?255:ly);
|
||||
|
||||
for(j=1;j<look->posts;j++){
|
||||
int current=look->forward_index[j];
|
||||
for(j=1;j<info->posts;j++){
|
||||
int current=info->forward_index[j];
|
||||
int hy=fit_value[current]&0x7fff;
|
||||
if(hy==fit_value[current]){
|
||||
|
||||
hx=info->postlist[current];
|
||||
hy*=info->mult;
|
||||
/* guard lookup against out-of-range values */
|
||||
hy=(hy<0?0:hy>255?255:hy);
|
||||
|
||||
hx=info->postlist[current];
|
||||
|
||||
render_line(n,lx,hx,ly,hy,out);
|
||||
|
||||
lx=hx;
|
||||
@@ -451,10 +350,3 @@ static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
|
||||
memset(out,0,sizeof(*out)*n);
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* export hooks */
|
||||
vorbis_func_floor floor1_exportbundle={
|
||||
&floor1_unpack,&floor1_look,&floor1_free_info,
|
||||
&floor1_free_look,&floor1_inverse1,&floor1_inverse2
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: floor dB lookup
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include "os.h"
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
# define XdB(n) ((((n)>>8)+1)>>1)
|
||||
#else
|
||||
# define XdB(n) (n)
|
||||
#endif
|
||||
|
||||
const tremor_ogg_int32_t FLOOR_fromdB_LOOKUP[256]={
|
||||
XdB(0x000000e5), XdB(0x000000f4), XdB(0x00000103), XdB(0x00000114),
|
||||
XdB(0x00000126), XdB(0x00000139), XdB(0x0000014e), XdB(0x00000163),
|
||||
XdB(0x0000017a), XdB(0x00000193), XdB(0x000001ad), XdB(0x000001c9),
|
||||
XdB(0x000001e7), XdB(0x00000206), XdB(0x00000228), XdB(0x0000024c),
|
||||
XdB(0x00000272), XdB(0x0000029b), XdB(0x000002c6), XdB(0x000002f4),
|
||||
XdB(0x00000326), XdB(0x0000035a), XdB(0x00000392), XdB(0x000003cd),
|
||||
XdB(0x0000040c), XdB(0x00000450), XdB(0x00000497), XdB(0x000004e4),
|
||||
XdB(0x00000535), XdB(0x0000058c), XdB(0x000005e8), XdB(0x0000064a),
|
||||
XdB(0x000006b3), XdB(0x00000722), XdB(0x00000799), XdB(0x00000818),
|
||||
XdB(0x0000089e), XdB(0x0000092e), XdB(0x000009c6), XdB(0x00000a69),
|
||||
XdB(0x00000b16), XdB(0x00000bcf), XdB(0x00000c93), XdB(0x00000d64),
|
||||
XdB(0x00000e43), XdB(0x00000f30), XdB(0x0000102d), XdB(0x0000113a),
|
||||
XdB(0x00001258), XdB(0x0000138a), XdB(0x000014cf), XdB(0x00001629),
|
||||
XdB(0x0000179a), XdB(0x00001922), XdB(0x00001ac4), XdB(0x00001c82),
|
||||
XdB(0x00001e5c), XdB(0x00002055), XdB(0x0000226f), XdB(0x000024ac),
|
||||
XdB(0x0000270e), XdB(0x00002997), XdB(0x00002c4b), XdB(0x00002f2c),
|
||||
XdB(0x0000323d), XdB(0x00003581), XdB(0x000038fb), XdB(0x00003caf),
|
||||
XdB(0x000040a0), XdB(0x000044d3), XdB(0x0000494c), XdB(0x00004e10),
|
||||
XdB(0x00005323), XdB(0x0000588a), XdB(0x00005e4b), XdB(0x0000646b),
|
||||
XdB(0x00006af2), XdB(0x000071e5), XdB(0x0000794c), XdB(0x0000812e),
|
||||
XdB(0x00008993), XdB(0x00009283), XdB(0x00009c09), XdB(0x0000a62d),
|
||||
XdB(0x0000b0f9), XdB(0x0000bc79), XdB(0x0000c8b9), XdB(0x0000d5c4),
|
||||
XdB(0x0000e3a9), XdB(0x0000f274), XdB(0x00010235), XdB(0x000112fd),
|
||||
XdB(0x000124dc), XdB(0x000137e4), XdB(0x00014c29), XdB(0x000161bf),
|
||||
XdB(0x000178bc), XdB(0x00019137), XdB(0x0001ab4a), XdB(0x0001c70e),
|
||||
XdB(0x0001e4a1), XdB(0x0002041f), XdB(0x000225aa), XdB(0x00024962),
|
||||
XdB(0x00026f6d), XdB(0x000297f0), XdB(0x0002c316), XdB(0x0002f109),
|
||||
XdB(0x000321f9), XdB(0x00035616), XdB(0x00038d97), XdB(0x0003c8b4),
|
||||
XdB(0x000407a7), XdB(0x00044ab2), XdB(0x00049218), XdB(0x0004de23),
|
||||
XdB(0x00052f1e), XdB(0x0005855c), XdB(0x0005e135), XdB(0x00064306),
|
||||
XdB(0x0006ab33), XdB(0x00071a24), XdB(0x0007904b), XdB(0x00080e20),
|
||||
XdB(0x00089422), XdB(0x000922da), XdB(0x0009bad8), XdB(0x000a5cb6),
|
||||
XdB(0x000b091a), XdB(0x000bc0b1), XdB(0x000c8436), XdB(0x000d5471),
|
||||
XdB(0x000e3233), XdB(0x000f1e5f), XdB(0x001019e4), XdB(0x001125c1),
|
||||
XdB(0x00124306), XdB(0x001372d5), XdB(0x0014b663), XdB(0x00160ef7),
|
||||
XdB(0x00177df0), XdB(0x001904c1), XdB(0x001aa4f9), XdB(0x001c603d),
|
||||
XdB(0x001e384f), XdB(0x00202f0f), XdB(0x0022467a), XdB(0x002480b1),
|
||||
XdB(0x0026dff7), XdB(0x002966b3), XdB(0x002c1776), XdB(0x002ef4fc),
|
||||
XdB(0x0032022d), XdB(0x00354222), XdB(0x0038b828), XdB(0x003c67c2),
|
||||
XdB(0x004054ae), XdB(0x004482e8), XdB(0x0048f6af), XdB(0x004db488),
|
||||
XdB(0x0052c142), XdB(0x005821ff), XdB(0x005ddc33), XdB(0x0063f5b0),
|
||||
XdB(0x006a74a7), XdB(0x00715faf), XdB(0x0078bdce), XdB(0x0080967f),
|
||||
XdB(0x0088f1ba), XdB(0x0091d7f9), XdB(0x009b5247), XdB(0x00a56a41),
|
||||
XdB(0x00b02a27), XdB(0x00bb9ce2), XdB(0x00c7ce12), XdB(0x00d4ca17),
|
||||
XdB(0x00e29e20), XdB(0x00f15835), XdB(0x0101074b), XdB(0x0111bb4e),
|
||||
XdB(0x01238531), XdB(0x01367704), XdB(0x014aa402), XdB(0x016020a7),
|
||||
XdB(0x017702c3), XdB(0x018f6190), XdB(0x01a955cb), XdB(0x01c4f9cf),
|
||||
XdB(0x01e269a8), XdB(0x0201c33b), XdB(0x0223265a), XdB(0x0246b4ea),
|
||||
XdB(0x026c9302), XdB(0x0294e716), XdB(0x02bfda13), XdB(0x02ed9793),
|
||||
XdB(0x031e4e09), XdB(0x03522ee4), XdB(0x03896ed0), XdB(0x03c445e2),
|
||||
XdB(0x0402efd6), XdB(0x0445ac4b), XdB(0x048cbefc), XdB(0x04d87013),
|
||||
XdB(0x05290c67), XdB(0x057ee5ca), XdB(0x05da5364), XdB(0x063bb204),
|
||||
XdB(0x06a36485), XdB(0x0711d42b), XdB(0x0787710e), XdB(0x0804b299),
|
||||
XdB(0x088a17ef), XdB(0x0918287e), XdB(0x09af747c), XdB(0x0a50957e),
|
||||
XdB(0x0afc2f19), XdB(0x0bb2ef7f), XdB(0x0c759034), XdB(0x0d44d6ca),
|
||||
XdB(0x0e2195bc), XdB(0x0f0cad0d), XdB(0x10070b62), XdB(0x1111aeea),
|
||||
XdB(0x122da66c), XdB(0x135c120f), XdB(0x149e24d9), XdB(0x15f525b1),
|
||||
XdB(0x176270e3), XdB(0x18e7794b), XdB(0x1a85c9ae), XdB(0x1c3f06d1),
|
||||
XdB(0x1e14f07d), XdB(0x200963d7), XdB(0x221e5ccd), XdB(0x2455f870),
|
||||
XdB(0x26b2770b), XdB(0x29363e2b), XdB(0x2be3db5c), XdB(0x2ebe06b6),
|
||||
XdB(0x31c7a55b), XdB(0x3503ccd4), XdB(0x3875c5aa), XdB(0x3c210f44),
|
||||
XdB(0x4009632b), XdB(0x4432b8cf), XdB(0x48a149bc), XdB(0x4d59959e),
|
||||
XdB(0x52606733), XdB(0x57bad899), XdB(0x5d6e593a), XdB(0x6380b298),
|
||||
XdB(0x69f80e9a), XdB(0x70dafda8), XdB(0x78307d76), XdB(0x7fffffff),
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+108
-161
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -21,19 +21,17 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <limits.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "tremor_ogg.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "codebook.h"
|
||||
#include "registry.h"
|
||||
#include "window.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
|
||||
/* helpers */
|
||||
static void _v_readstring(oggpack_buffer *o,char *buf,int bytes){
|
||||
static void _v_readstring(tremor_oggpack_buffer *o,char *buf,int bytes){
|
||||
while(bytes--){
|
||||
*buf++=oggpack_read(o,8);
|
||||
*buf++=tremor_oggpack_read(o,8);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,15 +90,13 @@ int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
|
||||
void vorbis_comment_clear(vorbis_comment *vc){
|
||||
if(vc){
|
||||
long i;
|
||||
if(vc->user_comments){
|
||||
for(i=0;i<vc->comments;i++)
|
||||
if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
|
||||
_ogg_free(vc->user_comments);
|
||||
}
|
||||
if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
|
||||
if(vc->vendor)_ogg_free(vc->vendor);
|
||||
memset(vc,0,sizeof(*vc));
|
||||
for(i=0;i<vc->comments;i++)
|
||||
if(vc->user_comments[i])_tremor_ogg_free(vc->user_comments[i]);
|
||||
if(vc->user_comments)_tremor_ogg_free(vc->user_comments);
|
||||
if(vc->comment_lengths)_tremor_ogg_free(vc->comment_lengths);
|
||||
if(vc->vendor)_tremor_ogg_free(vc->vendor);
|
||||
}
|
||||
memset(vc,0,sizeof(*vc));
|
||||
}
|
||||
|
||||
/* blocksize 0 is guaranteed to be short, 1 is guarantted to be long.
|
||||
@@ -113,7 +109,7 @@ int vorbis_info_blocksize(vorbis_info *vi,int zo){
|
||||
/* used by synthesis, which has a full, alloced vi */
|
||||
void vorbis_info_init(vorbis_info *vi){
|
||||
memset(vi,0,sizeof(*vi));
|
||||
vi->codec_setup=(codec_setup_info *)_ogg_calloc(1,sizeof(codec_setup_info));
|
||||
vi->codec_setup=(codec_setup_info *)_tremor_ogg_calloc(1,sizeof(codec_setup_info));
|
||||
}
|
||||
|
||||
void vorbis_info_clear(vorbis_info *vi){
|
||||
@@ -122,33 +118,37 @@ void vorbis_info_clear(vorbis_info *vi){
|
||||
|
||||
if(ci){
|
||||
|
||||
for(i=0;i<ci->modes;i++)
|
||||
if(ci->mode_param[i])_ogg_free(ci->mode_param[i]);
|
||||
if(ci->mode_param)_tremor_ogg_free(ci->mode_param);
|
||||
|
||||
for(i=0;i<ci->maps;i++) /* unpack does the range checking */
|
||||
if(ci->map_param[i])
|
||||
_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
|
||||
if(ci->map_param){
|
||||
for(i=0;i<ci->maps;i++) /* unpack does the range checking */
|
||||
mapping_clear_info(ci->map_param+i);
|
||||
_tremor_ogg_free(ci->map_param);
|
||||
}
|
||||
|
||||
for(i=0;i<ci->floors;i++) /* unpack does the range checking */
|
||||
if(ci->floor_param[i])
|
||||
_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
|
||||
|
||||
for(i=0;i<ci->residues;i++) /* unpack does the range checking */
|
||||
if(ci->residue_param[i])
|
||||
_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
|
||||
if(ci->floor_param){
|
||||
for(i=0;i<ci->floors;i++) /* unpack does the range checking */
|
||||
if(ci->floor_type[i])
|
||||
floor1_free_info(ci->floor_param[i]);
|
||||
else
|
||||
floor0_free_info(ci->floor_param[i]);
|
||||
_tremor_ogg_free(ci->floor_param);
|
||||
_tremor_ogg_free(ci->floor_type);
|
||||
}
|
||||
|
||||
for(i=0;i<ci->books;i++){
|
||||
if(ci->book_param[i]){
|
||||
/* knows if the book was not alloced */
|
||||
vorbis_staticbook_destroy(ci->book_param[i]);
|
||||
}
|
||||
if(ci->fullbooks)
|
||||
vorbis_book_clear(ci->fullbooks+i);
|
||||
if(ci->residue_param){
|
||||
for(i=0;i<ci->residues;i++) /* unpack does the range checking */
|
||||
res_clear_info(ci->residue_param+i);
|
||||
_tremor_ogg_free(ci->residue_param);
|
||||
}
|
||||
|
||||
if(ci->book_param){
|
||||
for(i=0;i<ci->books;i++)
|
||||
vorbis_book_clear(ci->book_param+i);
|
||||
_tremor_ogg_free(ci->book_param);
|
||||
}
|
||||
if(ci->fullbooks)
|
||||
_ogg_free(ci->fullbooks);
|
||||
|
||||
_ogg_free(ci);
|
||||
_tremor_ogg_free(ci);
|
||||
}
|
||||
|
||||
memset(vi,0,sizeof(*vi));
|
||||
@@ -156,30 +156,36 @@ void vorbis_info_clear(vorbis_info *vi){
|
||||
|
||||
/* Header packing/unpacking ********************************************/
|
||||
|
||||
static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
|
||||
static int _vorbis_unpack_info(vorbis_info *vi,tremor_oggpack_buffer *opb){
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
if(!ci)return(OV_EFAULT);
|
||||
|
||||
vi->version=oggpack_read(opb,32);
|
||||
vi->version=tremor_oggpack_read(opb,32);
|
||||
if(vi->version!=0)return(OV_EVERSION);
|
||||
|
||||
vi->channels=oggpack_read(opb,8);
|
||||
vi->rate=oggpack_read(opb,32);
|
||||
vi->channels=tremor_oggpack_read(opb,8);
|
||||
vi->rate=tremor_oggpack_read(opb,32);
|
||||
|
||||
vi->bitrate_upper=oggpack_read(opb,32);
|
||||
vi->bitrate_nominal=oggpack_read(opb,32);
|
||||
vi->bitrate_lower=oggpack_read(opb,32);
|
||||
vi->bitrate_upper=tremor_oggpack_read(opb,32);
|
||||
vi->bitrate_nominal=tremor_oggpack_read(opb,32);
|
||||
vi->bitrate_lower=tremor_oggpack_read(opb,32);
|
||||
|
||||
ci->blocksizes[0]=1<<oggpack_read(opb,4);
|
||||
ci->blocksizes[1]=1<<oggpack_read(opb,4);
|
||||
ci->blocksizes[0]=1<<tremor_oggpack_read(opb,4);
|
||||
ci->blocksizes[1]=1<<tremor_oggpack_read(opb,4);
|
||||
|
||||
#ifdef LIMIT_TO_64kHz
|
||||
if(vi->rate>=64000 || ci->blocksizes[1]>4096)goto err_out;
|
||||
#else
|
||||
if(vi->rate<64000 && ci->blocksizes[1]>4096)goto err_out;
|
||||
#endif
|
||||
|
||||
if(vi->rate<1)goto err_out;
|
||||
if(vi->channels<1)goto err_out;
|
||||
if(ci->blocksizes[0]<64)goto err_out;
|
||||
if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
|
||||
if(ci->blocksizes[1]>8192)goto err_out;
|
||||
|
||||
if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
|
||||
if(tremor_oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
|
||||
|
||||
return(0);
|
||||
err_out:
|
||||
@@ -187,34 +193,25 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
|
||||
return(OV_EBADHEADER);
|
||||
}
|
||||
|
||||
static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
|
||||
static int _vorbis_unpack_comment(vorbis_comment *vc,tremor_oggpack_buffer *opb){
|
||||
int i;
|
||||
int vendorlen;
|
||||
vendorlen=oggpack_read(opb,32);
|
||||
int vendorlen=tremor_oggpack_read(opb,32);
|
||||
if(vendorlen<0)goto err_out;
|
||||
if(vendorlen>opb->storage-oggpack_bytes(opb))goto err_out;
|
||||
vc->vendor=(char *)_ogg_calloc(vendorlen+1,1);
|
||||
if(vc->vendor==NULL)goto err_out;
|
||||
vc->vendor=(char *)_tremor_ogg_calloc(vendorlen+1,1);
|
||||
_v_readstring(opb,vc->vendor,vendorlen);
|
||||
i=oggpack_read(opb,32);
|
||||
if(i<0||i>=INT_MAX||i>(opb->storage-oggpack_bytes(opb))>>2)goto err_out;
|
||||
vc->user_comments=(char **)_ogg_calloc(i+1,sizeof(*vc->user_comments));
|
||||
vc->comment_lengths=(int *)_ogg_calloc(i+1, sizeof(*vc->comment_lengths));
|
||||
if(vc->user_comments==NULL||vc->comment_lengths==NULL)goto err_out;
|
||||
vc->comments=i;
|
||||
|
||||
vc->comments=tremor_oggpack_read(opb,32);
|
||||
if(vc->comments<0)goto err_out;
|
||||
vc->user_comments=(char **)_tremor_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
|
||||
vc->comment_lengths=(int *)_tremor_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
|
||||
|
||||
for(i=0;i<vc->comments;i++){
|
||||
int len=oggpack_read(opb,32);
|
||||
if(len<0||len>opb->storage-oggpack_bytes(opb))goto err_out;
|
||||
vc->comment_lengths[i]=len;
|
||||
vc->user_comments[i]=(char *)_ogg_calloc(len+1,1);
|
||||
if(vc->user_comments[i]==NULL){
|
||||
vc->comments=i;
|
||||
goto err_out;
|
||||
}
|
||||
int len=tremor_oggpack_read(opb,32);
|
||||
if(len<0)goto err_out;
|
||||
vc->comment_lengths[i]=len;
|
||||
vc->user_comments[i]=(char *)_tremor_ogg_calloc(len+1,1);
|
||||
_v_readstring(opb,vc->user_comments[i],len);
|
||||
}
|
||||
if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
|
||||
}
|
||||
if(tremor_oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
|
||||
|
||||
return(0);
|
||||
err_out:
|
||||
@@ -224,76 +221,63 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
|
||||
|
||||
/* all of the real encoding details are here. The modes, books,
|
||||
everything */
|
||||
static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||
static int _vorbis_unpack_books(vorbis_info *vi,tremor_oggpack_buffer *opb){
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
int i;
|
||||
if(!ci)return(OV_EFAULT);
|
||||
|
||||
/* codebooks */
|
||||
ci->books=oggpack_read(opb,8)+1;
|
||||
if(ci->books<=0)goto err_out;
|
||||
for(i=0;i<ci->books;i++){
|
||||
ci->book_param[i]=vorbis_staticbook_unpack(opb);
|
||||
if(!ci->book_param[i])goto err_out;
|
||||
}
|
||||
ci->books=tremor_oggpack_read(opb,8)+1;
|
||||
ci->book_param=(codebook *)_tremor_ogg_calloc(ci->books,sizeof(*ci->book_param));
|
||||
for(i=0;i<ci->books;i++)
|
||||
if(vorbis_book_unpack(opb,ci->book_param+i))goto err_out;
|
||||
|
||||
/* time backend settings */
|
||||
ci->times=oggpack_read(opb,6)+1;
|
||||
if(ci->times<=0)goto err_out;
|
||||
for(i=0;i<ci->times;i++){
|
||||
ci->time_type[i]=oggpack_read(opb,16);
|
||||
if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
|
||||
/* ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
|
||||
Vorbis I has no time backend */
|
||||
/*if(!ci->time_param[i])goto err_out;*/
|
||||
}
|
||||
/* time backend settings, not actually used */
|
||||
i=tremor_oggpack_read(opb,6);
|
||||
for(;i>=0;i--)
|
||||
if(tremor_oggpack_read(opb,16)!=0)goto err_out;
|
||||
|
||||
/* floor backend settings */
|
||||
ci->floors=oggpack_read(opb,6)+1;
|
||||
if(ci->floors<=0)goto err_out;
|
||||
ci->floors=tremor_oggpack_read(opb,6)+1;
|
||||
ci->floor_param=_tremor_ogg_malloc(sizeof(*ci->floor_param)*ci->floors);
|
||||
ci->floor_type=_tremor_ogg_malloc(sizeof(*ci->floor_type)*ci->floors);
|
||||
for(i=0;i<ci->floors;i++){
|
||||
ci->floor_type[i]=oggpack_read(opb,16);
|
||||
ci->floor_type[i]=tremor_oggpack_read(opb,16);
|
||||
if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
|
||||
ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
|
||||
if(ci->floor_type[i])
|
||||
ci->floor_param[i]=floor1_info_unpack(vi,opb);
|
||||
else
|
||||
ci->floor_param[i]=floor0_info_unpack(vi,opb);
|
||||
if(!ci->floor_param[i])goto err_out;
|
||||
}
|
||||
|
||||
/* residue backend settings */
|
||||
ci->residues=oggpack_read(opb,6)+1;
|
||||
if(ci->residues<=0)goto err_out;
|
||||
for(i=0;i<ci->residues;i++){
|
||||
ci->residue_type[i]=oggpack_read(opb,16);
|
||||
if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
|
||||
ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
|
||||
if(!ci->residue_param[i])goto err_out;
|
||||
}
|
||||
ci->residues=tremor_oggpack_read(opb,6)+1;
|
||||
ci->residue_param=_tremor_ogg_malloc(sizeof(*ci->residue_param)*ci->residues);
|
||||
for(i=0;i<ci->residues;i++)
|
||||
if(res_unpack(ci->residue_param+i,vi,opb))goto err_out;
|
||||
|
||||
/* map backend settings */
|
||||
ci->maps=oggpack_read(opb,6)+1;
|
||||
if(ci->maps<=0)goto err_out;
|
||||
ci->maps=tremor_oggpack_read(opb,6)+1;
|
||||
ci->map_param=_tremor_ogg_malloc(sizeof(*ci->map_param)*ci->maps);
|
||||
for(i=0;i<ci->maps;i++){
|
||||
ci->map_type[i]=oggpack_read(opb,16);
|
||||
if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
|
||||
ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
|
||||
if(!ci->map_param[i])goto err_out;
|
||||
if(tremor_oggpack_read(opb,16)!=0)goto err_out;
|
||||
if(mapping_info_unpack(ci->map_param+i,vi,opb))goto err_out;
|
||||
}
|
||||
|
||||
/* mode settings */
|
||||
ci->modes=oggpack_read(opb,6)+1;
|
||||
if(ci->modes<=0)goto err_out;
|
||||
ci->modes=tremor_oggpack_read(opb,6)+1;
|
||||
ci->mode_param=
|
||||
(vorbis_info_mode *)_tremor_ogg_malloc(ci->modes*sizeof(*ci->mode_param));
|
||||
for(i=0;i<ci->modes;i++){
|
||||
ci->mode_param[i]=(vorbis_info_mode *)_ogg_calloc(1,sizeof(*ci->mode_param[i]));
|
||||
ci->mode_param[i]->blockflag=oggpack_read(opb,1);
|
||||
ci->mode_param[i]->windowtype=oggpack_read(opb,16);
|
||||
ci->mode_param[i]->transformtype=oggpack_read(opb,16);
|
||||
ci->mode_param[i]->mapping=oggpack_read(opb,8);
|
||||
|
||||
if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
|
||||
if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
|
||||
if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
|
||||
if(ci->mode_param[i]->mapping<0)goto err_out;
|
||||
ci->mode_param[i].blockflag=tremor_oggpack_read(opb,1);
|
||||
if(tremor_oggpack_read(opb,16))goto err_out;
|
||||
if(tremor_oggpack_read(opb,16))goto err_out;
|
||||
ci->mode_param[i].mapping=tremor_oggpack_read(opb,8);
|
||||
if(ci->mode_param[i].mapping>=ci->maps)goto err_out;
|
||||
}
|
||||
|
||||
if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
|
||||
if(tremor_oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
|
||||
|
||||
return(0);
|
||||
err_out:
|
||||
@@ -301,47 +285,22 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
|
||||
return(OV_EBADHEADER);
|
||||
}
|
||||
|
||||
/* Is this packet a vorbis ID header? */
|
||||
int vorbis_synthesis_idheader(ogg_packet *op){
|
||||
oggpack_buffer opb;
|
||||
char buffer[6];
|
||||
|
||||
if(op){
|
||||
oggpack_readinit(&opb,op->packet,op->bytes);
|
||||
|
||||
if(!op->b_o_s)
|
||||
return(0); /* Not the initial packet */
|
||||
|
||||
if(oggpack_read(&opb,8) != 1)
|
||||
return 0; /* not an ID header */
|
||||
|
||||
memset(buffer,0,6);
|
||||
_v_readstring(&opb,buffer,6);
|
||||
if(memcmp(buffer,"vorbis",6))
|
||||
return 0; /* not vorbis */
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The Vorbis header is in three packets; the initial small packet in
|
||||
the first page that identifies basic parameters, a second packet
|
||||
with bitstream comments and a third packet that holds the
|
||||
codebook. */
|
||||
|
||||
int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
|
||||
oggpack_buffer opb;
|
||||
int vorbis_dsp_headerin(vorbis_info *vi,vorbis_comment *vc,tremor_ogg_packet *op){
|
||||
tremor_oggpack_buffer opb;
|
||||
|
||||
if(op){
|
||||
oggpack_readinit(&opb,op->packet,op->bytes);
|
||||
tremor_oggpack_readinit(&opb,op->packet);
|
||||
|
||||
/* Which of the three types of header is this? */
|
||||
/* Also verify header-ness, vorbis */
|
||||
{
|
||||
char buffer[6];
|
||||
int packtype=oggpack_read(&opb,8);
|
||||
int packtype=tremor_oggpack_read(&opb,8);
|
||||
memset(buffer,0,6);
|
||||
_v_readstring(&opb,buffer,6);
|
||||
if(memcmp(buffer,"vorbis",6)){
|
||||
@@ -366,10 +325,6 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
|
||||
/* um... we didn't get the initial header */
|
||||
return(OV_EBADHEADER);
|
||||
}
|
||||
if(vc->vendor!=NULL){
|
||||
/* previously initialized comment header */
|
||||
return(OV_EBADHEADER);
|
||||
}
|
||||
|
||||
return(_vorbis_unpack_comment(vc,&opb));
|
||||
|
||||
@@ -378,14 +333,6 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
|
||||
/* um... we didn;t get the initial header or comments yet */
|
||||
return(OV_EBADHEADER);
|
||||
}
|
||||
if(vi->codec_setup==NULL){
|
||||
/* improperly initialized vorbis_info */
|
||||
return(OV_EFAULT);
|
||||
}
|
||||
if(((codec_setup_info *)vi->codec_setup)->books>0){
|
||||
/* previously initialized setup header */
|
||||
return(OV_EBADHEADER);
|
||||
}
|
||||
|
||||
return(_vorbis_unpack_books(vi,&opb));
|
||||
|
||||
|
||||
@@ -1,265 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2009 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: illustrate seeking, and test it too
|
||||
last mod: $Id$
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "ivorbisfile.h"
|
||||
|
||||
#ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
|
||||
# include <io.h>
|
||||
# include <fcntl.h>
|
||||
#endif
|
||||
|
||||
void _verify(OggVorbis_File *ov,
|
||||
ogg_int64_t val,
|
||||
ogg_int64_t pcmval,
|
||||
ogg_int64_t timeval,
|
||||
ogg_int64_t pcmlength,
|
||||
char *bigassbuffer){
|
||||
int j;
|
||||
long bread;
|
||||
char buffer[4096];
|
||||
int dummy;
|
||||
ogg_int64_t pos;
|
||||
|
||||
/* verify the raw position, the pcm position and position decode */
|
||||
if(val!=-1 && ov_raw_tell(ov)<val){
|
||||
fprintf(stderr,"raw position out of tolerance: requested %ld, got %ld\n",
|
||||
(long)val,(long)ov_raw_tell(ov));
|
||||
exit(1);
|
||||
}
|
||||
if(pcmval!=-1 && ov_pcm_tell(ov)>pcmval){
|
||||
fprintf(stderr,"pcm position out of tolerance: requested %ld, got %ld\n",
|
||||
(long)pcmval,(long)ov_pcm_tell(ov));
|
||||
exit(1);
|
||||
}
|
||||
if(timeval!=-1 && ov_time_tell(ov)>timeval){
|
||||
fprintf(stderr,"time position out of tolerance: requested %ld, got %ld\n",
|
||||
(long)timeval,(long)ov_time_tell(ov));
|
||||
exit(1);
|
||||
}
|
||||
pos=ov_pcm_tell(ov);
|
||||
if(pos<0 || pos>pcmlength){
|
||||
fprintf(stderr,"pcm position out of bounds: got %ld\n",(long)pos);
|
||||
exit(1);
|
||||
}
|
||||
bread=ov_read(ov,buffer,4096,&dummy);
|
||||
if(bigassbuffer){
|
||||
for(j=0;j<bread;j++){
|
||||
if(buffer[j]!=bigassbuffer[j+pos*4]){
|
||||
fprintf(stderr,"data position after seek doesn't match pcm position\n");
|
||||
|
||||
{
|
||||
FILE *f=fopen("a.m","w");
|
||||
for(j=0;j<bread;j++)fprintf(f,"%d\n",(int)buffer[j]);
|
||||
fclose(f);
|
||||
f=fopen("b.m","w");
|
||||
for(j=0;j<bread;j++)fprintf(f,"%d\n",(int)bigassbuffer[j+pos*2]);
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main(){
|
||||
OggVorbis_File ov;
|
||||
int i,ret;
|
||||
ogg_int64_t pcmlength;
|
||||
ogg_int64_t timelength;
|
||||
char *bigassbuffer;
|
||||
int dummy;
|
||||
|
||||
#ifdef _WIN32 /* We need to set stdin/stdout to binary mode. Damn windows. */
|
||||
_setmode( _fileno( stdin ), _O_BINARY );
|
||||
#endif
|
||||
|
||||
|
||||
/* open the file/pipe on stdin */
|
||||
if(ov_open(stdin, &ov, NULL, 0) < 0) {
|
||||
fprintf(stderr,"Could not open input as an OggVorbis file.\n\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if(ov_seekable(&ov)){
|
||||
|
||||
/* to simplify our own lives, we want to assume the whole file is
|
||||
stereo. Verify this to avoid potentially mystifying users
|
||||
(pissing them off is OK, just don't confuse them) */
|
||||
for(i=0;i<ov.links;i++){
|
||||
vorbis_info *vi=ov_info(&ov,i);
|
||||
if(vi->channels!=2){
|
||||
fprintf(stderr,"Sorry; right now seeking_test can only use Vorbis files\n"
|
||||
"that are entirely stereo.\n\n");
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
/* because we want to do sample-level verification that the seek
|
||||
does what it claimed, decode the entire file into memory */
|
||||
pcmlength=ov_pcm_total(&ov,-1);
|
||||
timelength=ov_time_total(&ov,-1);
|
||||
bigassbuffer=malloc(pcmlength*4); /* w00t */
|
||||
if(bigassbuffer){
|
||||
i=0;
|
||||
while(i<pcmlength*4){
|
||||
int ret=ov_read(&ov,bigassbuffer+i,pcmlength*4-i,&dummy);
|
||||
if(ret<0)continue;
|
||||
if(ret){
|
||||
i+=ret;
|
||||
}else{
|
||||
pcmlength=i/4;
|
||||
}
|
||||
fprintf(stderr,"\rloading.... [%ld left] ",
|
||||
(long)(pcmlength*4-i));
|
||||
}
|
||||
}else{
|
||||
fprintf(stderr,"\rfile too large to load into memory for read tests;\n\tonly verifying seek positioning...\n");
|
||||
}
|
||||
|
||||
{
|
||||
ogg_int64_t length=ov.end;
|
||||
fprintf(stderr,"\rtesting raw seeking to random places in %ld bytes....\n",
|
||||
(long)length);
|
||||
|
||||
for(i=0;i<1000;i++){
|
||||
ogg_int64_t val=rand()*length/RAND_MAX;
|
||||
fprintf(stderr,"\r\t%d [raw position %ld]... ",i,(long)val);
|
||||
ret=ov_raw_seek(&ov,val);
|
||||
if(ret<0){
|
||||
fprintf(stderr,"seek failed: %d\n",ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_verify(&ov,val,-1,-1.,pcmlength,bigassbuffer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,"\r");
|
||||
{
|
||||
fprintf(stderr,"testing pcm page seeking to random places in %ld samples....\n",
|
||||
(long)pcmlength);
|
||||
|
||||
for(i=0;i<1000;i++){
|
||||
ogg_int64_t val=i==0?0:(double)rand()*pcmlength/RAND_MAX;
|
||||
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
|
||||
ret=ov_pcm_seek_page(&ov,val);
|
||||
if(ret<0){
|
||||
fprintf(stderr,"seek failed: %d\n",ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,"\r");
|
||||
{
|
||||
fprintf(stderr,"testing pcm exact seeking to random places in %ld samples....\n",
|
||||
(long)pcmlength);
|
||||
|
||||
for(i=0;i<1000;i++){
|
||||
ogg_int64_t val=i==0?0:(double)rand()*pcmlength/RAND_MAX;
|
||||
fprintf(stderr,"\r\t%d [pcm position %ld]... ",i,(long)val);
|
||||
ret=ov_pcm_seek(&ov,val);
|
||||
if(ret<0){
|
||||
fprintf(stderr,"seek failed: %d\n",ret);
|
||||
exit(1);
|
||||
}
|
||||
if(ov_pcm_tell(&ov)!=val){
|
||||
fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
|
||||
(long)val,(long)ov_pcm_tell(&ov));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_verify(&ov,-1,val,-1.,pcmlength,bigassbuffer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,"\r");
|
||||
{
|
||||
fprintf(stderr,"testing time page seeking to random places in %ld milliseconds....\n",
|
||||
(long)timelength);
|
||||
|
||||
for(i=0;i<1000;i++){
|
||||
ogg_int64_t val=(double)rand()*timelength/RAND_MAX;
|
||||
fprintf(stderr,"\r\t%d [time position %ld]... ",i,(long)val);
|
||||
ret=ov_time_seek_page(&ov,val);
|
||||
if(ret<0){
|
||||
fprintf(stderr,"seek failed: %d\n",ret);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_verify(&ov,-1,-1,val,pcmlength,bigassbuffer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,"\r");
|
||||
{
|
||||
fprintf(stderr,"testing time exact seeking to random places in %ld milliseconds....\n",
|
||||
(long)timelength);
|
||||
|
||||
for(i=0;i<1000;i++){
|
||||
ogg_int64_t val=(double)rand()*timelength/RAND_MAX;
|
||||
fprintf(stderr,"\r\t%d [time position %ld]... ",i,(long)val);
|
||||
ret=ov_time_seek(&ov,val);
|
||||
if(ret<0){
|
||||
fprintf(stderr,"seek failed: %d\n",ret);
|
||||
exit(1);
|
||||
}
|
||||
if(ov_time_tell(&ov)<val-1 || ov_time_tell(&ov)>val+1){
|
||||
fprintf(stderr,"Declared position didn't perfectly match request: %ld != %ld\n",
|
||||
(long)val,(long)ov_time_tell(&ov));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
_verify(&ov,-1,-1,val,pcmlength,bigassbuffer);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr,"\r \nOK.\n\n");
|
||||
|
||||
|
||||
}else{
|
||||
fprintf(stderr,"Standard input was not seekable.\n");
|
||||
}
|
||||
|
||||
ov_clear(&ov);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+6
-106
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -23,7 +23,10 @@ extern "C"
|
||||
{
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <ogg/ogg.h>
|
||||
#include "tremor_ogg.h"
|
||||
|
||||
struct vorbis_dsp_state;
|
||||
typedef struct vorbis_dsp_state vorbis_dsp_state;
|
||||
|
||||
typedef struct vorbis_info{
|
||||
int version;
|
||||
@@ -53,80 +56,7 @@ typedef struct vorbis_info{
|
||||
void *codec_setup;
|
||||
} vorbis_info;
|
||||
|
||||
/* vorbis_dsp_state buffers the current vorbis audio
|
||||
analysis/synthesis state. The DSP state belongs to a specific
|
||||
logical bitstream ****************************************************/
|
||||
typedef struct vorbis_dsp_state{
|
||||
int analysisp;
|
||||
vorbis_info *vi;
|
||||
|
||||
ogg_int32_t **pcm;
|
||||
ogg_int32_t **pcmret;
|
||||
int pcm_storage;
|
||||
int pcm_current;
|
||||
int pcm_returned;
|
||||
|
||||
int preextrapolate;
|
||||
int eofflag;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
long centerW;
|
||||
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
|
||||
void *backend_state;
|
||||
} vorbis_dsp_state;
|
||||
|
||||
typedef struct vorbis_block{
|
||||
/* necessary stream state for linking to the framing abstraction */
|
||||
ogg_int32_t **pcm; /* this is a pointer into local storage */
|
||||
oggpack_buffer opb;
|
||||
|
||||
long lW;
|
||||
long W;
|
||||
long nW;
|
||||
int pcmend;
|
||||
int mode;
|
||||
|
||||
int eofflag;
|
||||
ogg_int64_t granulepos;
|
||||
ogg_int64_t sequence;
|
||||
vorbis_dsp_state *vd; /* For read-only access of configuration */
|
||||
|
||||
/* local storage to avoid remallocing; it's up to the mapping to
|
||||
structure it */
|
||||
void *localstore;
|
||||
long localtop;
|
||||
long localalloc;
|
||||
long totaluse;
|
||||
struct alloc_chain *reap;
|
||||
|
||||
} vorbis_block;
|
||||
|
||||
/* vorbis_block is a single block of data to be processed as part of
|
||||
the analysis/synthesis stream; it belongs to a specific logical
|
||||
bitstream, but is independant from other vorbis_blocks belonging to
|
||||
that logical bitstream. *************************************************/
|
||||
|
||||
struct alloc_chain{
|
||||
void *ptr;
|
||||
struct alloc_chain *next;
|
||||
};
|
||||
|
||||
/* vorbis_info contains all the setup information specific to the
|
||||
specific compression/decompression mode in progress (eg,
|
||||
psychoacoustic settings, channel setup, options, codebook
|
||||
etc). vorbis_info and substructures are in backends.h.
|
||||
*********************************************************************/
|
||||
|
||||
/* the comments are not part of vorbis_info so that vorbis_info can be
|
||||
static storage */
|
||||
typedef struct vorbis_comment{
|
||||
/* unlimited user comment fields. libvorbis writes 'libvorbis'
|
||||
whatever vendor is set to in encode */
|
||||
char **user_comments;
|
||||
int *comment_lengths;
|
||||
int comments;
|
||||
@@ -135,18 +65,6 @@ typedef struct vorbis_comment{
|
||||
} vorbis_comment;
|
||||
|
||||
|
||||
/* libvorbis encodes in two abstraction layers; first we perform DSP
|
||||
and produce a packet (see docs/analysis.txt). The packet is then
|
||||
coded into a framed OggSquish bitstream by the second layer (see
|
||||
docs/framing.txt). Decode is the reverse process; we sync/frame
|
||||
the bitstream and extract individual packets, then decode the
|
||||
packet back into PCM audio.
|
||||
|
||||
The extra framing/packetizing is used in streaming formats, such as
|
||||
files. Over the net (such as with UDP), the framing and
|
||||
packetization aren't necessary as they're provided by the transport
|
||||
and the streaming layer is not used */
|
||||
|
||||
/* Vorbis PRIMITIVES: general ***************************************/
|
||||
|
||||
extern void vorbis_info_init(vorbis_info *vi);
|
||||
@@ -160,24 +78,6 @@ extern char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
|
||||
extern int vorbis_comment_query_count(vorbis_comment *vc, char *tag);
|
||||
extern void vorbis_comment_clear(vorbis_comment *vc);
|
||||
|
||||
extern int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
|
||||
extern int vorbis_block_clear(vorbis_block *vb);
|
||||
extern void vorbis_dsp_clear(vorbis_dsp_state *v);
|
||||
|
||||
/* Vorbis PRIMITIVES: synthesis layer *******************************/
|
||||
extern int vorbis_synthesis_idheader(ogg_packet *op);
|
||||
extern int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
|
||||
ogg_packet *op);
|
||||
|
||||
extern int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
|
||||
extern int vorbis_synthesis_restart(vorbis_dsp_state *v);
|
||||
extern int vorbis_synthesis(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op);
|
||||
extern int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb);
|
||||
extern int vorbis_synthesis_pcmout(vorbis_dsp_state *v,ogg_int32_t ***pcm);
|
||||
extern int vorbis_synthesis_read(vorbis_dsp_state *v,int samples);
|
||||
extern long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op);
|
||||
|
||||
/* Vorbis ERRORS and return codes ***********************************/
|
||||
|
||||
#define OV_FALSE -1
|
||||
|
||||
+47
-56
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -26,8 +26,6 @@ extern "C"
|
||||
#include <stdio.h>
|
||||
#include "ivorbiscodec.h"
|
||||
|
||||
#define CHUNKSIZE 65535
|
||||
#define READSIZE 1024
|
||||
/* The function prototypes for the callbacks are basically the same as for
|
||||
* the stdio functions fread, fseek, fclose, ftell.
|
||||
* The one difference is that the FILE * arguments have been replaced with
|
||||
@@ -40,86 +38,79 @@ extern "C"
|
||||
*/
|
||||
typedef struct {
|
||||
size_t (*read_func) (void *ptr, size_t size, size_t nmemb, void *datasource);
|
||||
int (*seek_func) (void *datasource, ogg_int64_t offset, int whence);
|
||||
int (*seek_func) (void *datasource, tremor_ogg_int64_t offset, int whence);
|
||||
int (*close_func) (void *datasource);
|
||||
long (*tell_func) (void *datasource);
|
||||
} ov_callbacks;
|
||||
|
||||
#define NOTOPEN 0
|
||||
#define PARTOPEN 1
|
||||
#define OPENED 2
|
||||
#define STREAMSET 3
|
||||
#define INITSET 4
|
||||
|
||||
typedef struct OggVorbis_File {
|
||||
typedef struct TremorOggVorbis_File {
|
||||
void *datasource; /* Pointer to a FILE *, etc. */
|
||||
int seekable;
|
||||
ogg_int64_t offset;
|
||||
ogg_int64_t end;
|
||||
ogg_sync_state oy;
|
||||
tremor_ogg_int64_t offset;
|
||||
tremor_ogg_int64_t end;
|
||||
tremor_ogg_sync_state *oy;
|
||||
|
||||
/* If the FILE handle isn't seekable (eg, a pipe), only the current
|
||||
stream appears */
|
||||
int links;
|
||||
ogg_int64_t *offsets;
|
||||
ogg_int64_t *dataoffsets;
|
||||
ogg_uint32_t *serialnos;
|
||||
ogg_int64_t *pcmlengths;
|
||||
vorbis_info *vi;
|
||||
vorbis_comment *vc;
|
||||
tremor_ogg_int64_t *offsets;
|
||||
tremor_ogg_int64_t *dataoffsets;
|
||||
tremor_ogg_uint32_t *serialnos;
|
||||
tremor_ogg_int64_t *pcmlengths;
|
||||
vorbis_info vi;
|
||||
vorbis_comment vc;
|
||||
|
||||
/* Decoding working state local storage */
|
||||
ogg_int64_t pcm_offset;
|
||||
tremor_ogg_int64_t pcm_offset;
|
||||
int ready_state;
|
||||
ogg_uint32_t current_serialno;
|
||||
tremor_ogg_uint32_t current_serialno;
|
||||
int current_link;
|
||||
|
||||
ogg_int64_t bittrack;
|
||||
ogg_int64_t samptrack;
|
||||
tremor_ogg_int64_t bittrack;
|
||||
tremor_ogg_int64_t samptrack;
|
||||
|
||||
ogg_stream_state os; /* take physical pages, weld into a logical
|
||||
tremor_ogg_stream_state *os; /* take physical pages, weld into a logical
|
||||
stream of packets */
|
||||
vorbis_dsp_state vd; /* central working state for the packet->PCM decoder */
|
||||
vorbis_block vb; /* local working space for packet->PCM decode */
|
||||
vorbis_dsp_state *vd; /* central working state for the packet->PCM decoder */
|
||||
|
||||
ov_callbacks callbacks;
|
||||
|
||||
} OggVorbis_File;
|
||||
} TremorOggVorbis_File;
|
||||
|
||||
extern int ov_clear(OggVorbis_File *vf);
|
||||
extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
|
||||
extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
const char *initial, long ibytes, ov_callbacks callbacks);
|
||||
extern int ov_clear(TremorOggVorbis_File *vf);
|
||||
extern int ov_open(FILE *f,TremorOggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_open_callbacks(void *datasource, TremorOggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
|
||||
extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
|
||||
extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
|
||||
const char *initial, long ibytes, ov_callbacks callbacks);
|
||||
extern int ov_test_open(OggVorbis_File *vf);
|
||||
extern int ov_test(FILE *f,TremorOggVorbis_File *vf,char *initial,long ibytes);
|
||||
extern int ov_test_callbacks(void *datasource, TremorOggVorbis_File *vf,
|
||||
char *initial, long ibytes, ov_callbacks callbacks);
|
||||
extern int ov_test_open(TremorOggVorbis_File *vf);
|
||||
|
||||
extern long ov_bitrate(OggVorbis_File *vf,int i);
|
||||
extern long ov_bitrate_instant(OggVorbis_File *vf);
|
||||
extern long ov_streams(OggVorbis_File *vf);
|
||||
extern long ov_seekable(OggVorbis_File *vf);
|
||||
extern long ov_serialnumber(OggVorbis_File *vf,int i);
|
||||
extern long ov_bitrate(TremorOggVorbis_File *vf,int i);
|
||||
extern long ov_bitrate_instant(TremorOggVorbis_File *vf);
|
||||
extern long ov_streams(TremorOggVorbis_File *vf);
|
||||
extern long ov_seekable(TremorOggVorbis_File *vf);
|
||||
extern long ov_serialnumber(TremorOggVorbis_File *vf,int i);
|
||||
|
||||
extern ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i);
|
||||
extern ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i);
|
||||
extern ogg_int64_t ov_time_total(OggVorbis_File *vf,int i);
|
||||
extern tremor_ogg_int64_t ov_raw_total(TremorOggVorbis_File *vf,int i);
|
||||
extern tremor_ogg_int64_t ov_pcm_total(TremorOggVorbis_File *vf,int i);
|
||||
extern tremor_ogg_int64_t ov_time_total(TremorOggVorbis_File *vf,int i);
|
||||
|
||||
extern int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t pos);
|
||||
extern int ov_raw_seek(TremorOggVorbis_File *vf,tremor_ogg_int64_t pos);
|
||||
extern int ov_pcm_seek(TremorOggVorbis_File *vf,tremor_ogg_int64_t pos);
|
||||
extern int ov_pcm_seek_page(TremorOggVorbis_File *vf,tremor_ogg_int64_t pos);
|
||||
extern int ov_time_seek(TremorOggVorbis_File *vf,tremor_ogg_int64_t pos);
|
||||
extern int ov_time_seek_page(TremorOggVorbis_File *vf,tremor_ogg_int64_t pos);
|
||||
|
||||
extern ogg_int64_t ov_raw_tell(OggVorbis_File *vf);
|
||||
extern ogg_int64_t ov_pcm_tell(OggVorbis_File *vf);
|
||||
extern ogg_int64_t ov_time_tell(OggVorbis_File *vf);
|
||||
extern tremor_ogg_int64_t ov_raw_tell(TremorOggVorbis_File *vf);
|
||||
extern tremor_ogg_int64_t ov_pcm_tell(TremorOggVorbis_File *vf);
|
||||
extern tremor_ogg_int64_t ov_time_tell(TremorOggVorbis_File *vf);
|
||||
|
||||
extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
|
||||
extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
|
||||
extern vorbis_info *ov_info(TremorOggVorbis_File *vf,int link);
|
||||
extern vorbis_comment *ov_comment(TremorOggVorbis_File *vf,int link);
|
||||
|
||||
extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
|
||||
extern long ov_read(TremorOggVorbis_File *vf,void *buffer,int length,
|
||||
int *bitstream);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -32,7 +32,7 @@
|
||||
char pcmout[4096]; /* take 4k out of the data segment, not the stack */
|
||||
|
||||
int main(){
|
||||
OggVorbis_File vf;
|
||||
TremorOggVorbis_File vf;
|
||||
int eof=0;
|
||||
int current_section;
|
||||
|
||||
@@ -69,12 +69,7 @@ int main(){
|
||||
/* EOF */
|
||||
eof=1;
|
||||
} else if (ret < 0) {
|
||||
if(ret==OV_EBADLINK){
|
||||
fprintf(stderr,"Corrupt bitstream section! Exiting.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* some other error in the stream. Not a problem, just reporting it in
|
||||
/* error in the stream. Not a problem, just reporting it in
|
||||
case we (the app) cares. In this case, we don't. */
|
||||
} else {
|
||||
/* we don't bother dealing with sample rate changes, etc, but
|
||||
|
||||
+4
-32
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,35 +18,7 @@
|
||||
#ifndef _V_LOOKUP_DATA_H_
|
||||
#define _V_LOOKUP_DATA_H_
|
||||
|
||||
#include <ogg/os_types.h>
|
||||
|
||||
#define FROMdB_LOOKUP_SZ 35
|
||||
#define FROMdB2_LOOKUP_SZ 32
|
||||
#define FROMdB_SHIFT 5
|
||||
#define FROMdB2_SHIFT 3
|
||||
#define FROMdB2_MASK 31
|
||||
|
||||
static const ogg_int32_t FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
|
||||
0x003fffff, 0x0028619b, 0x00197a96, 0x0010137a,
|
||||
0x000a24b0, 0x00066666, 0x000409c3, 0x00028c42,
|
||||
0x00019b8c, 0x000103ab, 0x0000a3d7, 0x00006760,
|
||||
0x0000413a, 0x00002928, 0x000019f8, 0x00001062,
|
||||
0x00000a56, 0x00000686, 0x0000041e, 0x00000299,
|
||||
0x000001a3, 0x00000109, 0x000000a7, 0x00000069,
|
||||
0x00000042, 0x0000002a, 0x0000001a, 0x00000011,
|
||||
0x0000000b, 0x00000007, 0x00000004, 0x00000003,
|
||||
0x00000002, 0x00000001, 0x00000001};
|
||||
|
||||
static const ogg_int32_t FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
|
||||
0x000001fc, 0x000001f5, 0x000001ee, 0x000001e7,
|
||||
0x000001e0, 0x000001d9, 0x000001d2, 0x000001cc,
|
||||
0x000001c5, 0x000001bf, 0x000001b8, 0x000001b2,
|
||||
0x000001ac, 0x000001a6, 0x000001a0, 0x0000019a,
|
||||
0x00000194, 0x0000018e, 0x00000188, 0x00000183,
|
||||
0x0000017d, 0x00000178, 0x00000172, 0x0000016d,
|
||||
0x00000168, 0x00000163, 0x0000015e, 0x00000159,
|
||||
0x00000154, 0x0000014f, 0x0000014a, 0x00000145,
|
||||
};
|
||||
#include "os_types.h"
|
||||
|
||||
#define INVSQ_LOOKUP_I_SHIFT 10
|
||||
#define INVSQ_LOOKUP_I_MASK 1023
|
||||
@@ -92,7 +64,7 @@ static const long INVSQ_LOOKUP_IDel[64]={
|
||||
#define COS_LOOKUP_I_SHIFT 9
|
||||
#define COS_LOOKUP_I_MASK 511
|
||||
#define COS_LOOKUP_I_SZ 128
|
||||
static const ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
|
||||
static const tremor_ogg_int32_t COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
|
||||
16384, 16379, 16364, 16340,
|
||||
16305, 16261, 16207, 16143,
|
||||
16069, 15986, 15893, 15791,
|
||||
|
||||
+94
-181
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -19,101 +19,23 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "tremor_ogg.h"
|
||||
#include "os.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "mdct.h"
|
||||
#include "codec_internal.h"
|
||||
#include "codebook.h"
|
||||
#include "window.h"
|
||||
#include "registry.h"
|
||||
#include "misc.h"
|
||||
|
||||
/* simplistic, wasteful way of doing this (unique lookup for each
|
||||
mode/submapping); there should be a central repository for
|
||||
identical lookups. That will require minor work, so I'm putting it
|
||||
off as low priority.
|
||||
|
||||
Why a lookup for each backend in a given mode? Because the
|
||||
blocksize is set by the mode, and low backend lookups may require
|
||||
parameters from other areas of the mode/mapping */
|
||||
|
||||
typedef struct {
|
||||
vorbis_info_mode *mode;
|
||||
vorbis_info_mapping0 *map;
|
||||
|
||||
vorbis_look_floor **floor_look;
|
||||
|
||||
vorbis_look_residue **residue_look;
|
||||
|
||||
vorbis_func_floor **floor_func;
|
||||
vorbis_func_residue **residue_func;
|
||||
|
||||
int ch;
|
||||
long lastframe; /* if a different mode is called, we need to
|
||||
invalidate decay */
|
||||
} vorbis_look_mapping0;
|
||||
|
||||
static void mapping0_free_info(vorbis_info_mapping *i){
|
||||
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)i;
|
||||
void mapping_clear_info(vorbis_info_mapping *info){
|
||||
if(info){
|
||||
if(info->chmuxlist)_tremor_ogg_free(info->chmuxlist);
|
||||
if(info->submaplist)_tremor_ogg_free(info->submaplist);
|
||||
if(info->coupling)_tremor_ogg_free(info->coupling);
|
||||
memset(info,0,sizeof(*info));
|
||||
_ogg_free(info);
|
||||
}
|
||||
}
|
||||
|
||||
static void mapping0_free_look(vorbis_look_mapping *look){
|
||||
int i;
|
||||
vorbis_look_mapping0 *l=(vorbis_look_mapping0 *)look;
|
||||
if(l){
|
||||
|
||||
for(i=0;i<l->map->submaps;i++){
|
||||
l->floor_func[i]->free_look(l->floor_look[i]);
|
||||
l->residue_func[i]->free_look(l->residue_look[i]);
|
||||
}
|
||||
|
||||
_ogg_free(l->floor_func);
|
||||
_ogg_free(l->residue_func);
|
||||
_ogg_free(l->floor_look);
|
||||
_ogg_free(l->residue_look);
|
||||
memset(l,0,sizeof(*l));
|
||||
_ogg_free(l);
|
||||
}
|
||||
}
|
||||
|
||||
static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
|
||||
vorbis_info_mapping *m){
|
||||
int i;
|
||||
vorbis_info *vi=vd->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)_ogg_calloc(1,sizeof(*look));
|
||||
vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
|
||||
look->mode=vm;
|
||||
|
||||
look->floor_look=(vorbis_look_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_look));
|
||||
|
||||
look->residue_look=(vorbis_look_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_look));
|
||||
|
||||
look->floor_func=(vorbis_func_floor **)_ogg_calloc(info->submaps,sizeof(*look->floor_func));
|
||||
look->residue_func=(vorbis_func_residue **)_ogg_calloc(info->submaps,sizeof(*look->residue_func));
|
||||
|
||||
for(i=0;i<info->submaps;i++){
|
||||
int floornum=info->floorsubmap[i];
|
||||
int resnum=info->residuesubmap[i];
|
||||
|
||||
look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
|
||||
look->floor_look[i]=look->floor_func[i]->
|
||||
look(vd,vm,ci->floor_param[floornum]);
|
||||
look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
|
||||
look->residue_look[i]=look->residue_func[i]->
|
||||
look(vd,vm,ci->residue_param[resnum]);
|
||||
|
||||
}
|
||||
|
||||
look->ch=vi->channels;
|
||||
|
||||
return(look);
|
||||
}
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
if(v)--v;
|
||||
@@ -125,28 +47,25 @@ static int ilog(unsigned int v){
|
||||
}
|
||||
|
||||
/* also responsible for range checking */
|
||||
static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
||||
int i,b;
|
||||
vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)_ogg_calloc(1,sizeof(*info));
|
||||
int mapping_info_unpack(vorbis_info_mapping *info,vorbis_info *vi,
|
||||
tremor_oggpack_buffer *opb){
|
||||
int i;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
memset(info,0,sizeof(*info));
|
||||
|
||||
b=oggpack_read(opb,1);
|
||||
if(b<0)goto err_out;
|
||||
if(b){
|
||||
info->submaps=oggpack_read(opb,4)+1;
|
||||
if(info->submaps<=0)goto err_out;
|
||||
}else
|
||||
if(tremor_oggpack_read(opb,1))
|
||||
info->submaps=tremor_oggpack_read(opb,4)+1;
|
||||
else
|
||||
info->submaps=1;
|
||||
|
||||
b=oggpack_read(opb,1);
|
||||
if(b<0)goto err_out;
|
||||
if(b){
|
||||
info->coupling_steps=oggpack_read(opb,8)+1;
|
||||
if(info->coupling_steps<=0)goto err_out;
|
||||
if(tremor_oggpack_read(opb,1)){
|
||||
info->coupling_steps=tremor_oggpack_read(opb,8)+1;
|
||||
info->coupling=
|
||||
_tremor_ogg_malloc(info->coupling_steps*sizeof(*info->coupling));
|
||||
|
||||
for(i=0;i<info->coupling_steps;i++){
|
||||
int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
|
||||
int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
|
||||
int testM=info->coupling[i].mag=tremor_oggpack_read(opb,ilog(vi->channels));
|
||||
int testA=info->coupling[i].ang=tremor_oggpack_read(opb,ilog(vi->channels));
|
||||
|
||||
if(testM<0 ||
|
||||
testA<0 ||
|
||||
@@ -157,72 +76,82 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
|
||||
|
||||
}
|
||||
|
||||
if(oggpack_read(opb,2)!=0)goto err_out; /* 2,3:reserved */
|
||||
if(tremor_oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
|
||||
|
||||
if(info->submaps>1){
|
||||
info->chmuxlist=_tremor_ogg_malloc(sizeof(*info->chmuxlist)*vi->channels);
|
||||
for(i=0;i<vi->channels;i++){
|
||||
info->chmuxlist[i]=oggpack_read(opb,4);
|
||||
if(info->chmuxlist[i]>=info->submaps || info->chmuxlist[i]<0)goto err_out;
|
||||
info->chmuxlist[i]=tremor_oggpack_read(opb,4);
|
||||
if(info->chmuxlist[i]>=info->submaps)goto err_out;
|
||||
}
|
||||
}
|
||||
|
||||
info->submaplist=_tremor_ogg_malloc(sizeof(*info->submaplist)*info->submaps);
|
||||
for(i=0;i<info->submaps;i++){
|
||||
int temp=oggpack_read(opb,8);
|
||||
if(temp>=ci->times)goto err_out;
|
||||
info->floorsubmap[i]=oggpack_read(opb,8);
|
||||
if(info->floorsubmap[i]>=ci->floors || info->floorsubmap[i]<0)goto err_out;
|
||||
info->residuesubmap[i]=oggpack_read(opb,8);
|
||||
if(info->residuesubmap[i]>=ci->residues || info->residuesubmap[i]<0)
|
||||
goto err_out;
|
||||
int temp=tremor_oggpack_read(opb,8);
|
||||
info->submaplist[i].floor=tremor_oggpack_read(opb,8);
|
||||
if(info->submaplist[i].floor>=ci->floors)goto err_out;
|
||||
info->submaplist[i].residue=tremor_oggpack_read(opb,8);
|
||||
if(info->submaplist[i].residue>=ci->residues)goto err_out;
|
||||
}
|
||||
|
||||
return info;
|
||||
return 0;
|
||||
|
||||
err_out:
|
||||
mapping0_free_info(info);
|
||||
return(NULL);
|
||||
mapping_clear_info(info);
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int seq=0;
|
||||
static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
|
||||
vorbis_dsp_state *vd=vb->vd;
|
||||
int mapping_inverse(vorbis_dsp_state *vd,vorbis_info_mapping *info){
|
||||
vorbis_info *vi=vd->vi;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
private_state *b=(private_state *)vd->backend_state;
|
||||
vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
|
||||
vorbis_info_mapping0 *info=look->map;
|
||||
|
||||
int i,j;
|
||||
long n=vb->pcmend=ci->blocksizes[vb->W];
|
||||
long n=ci->blocksizes[vd->W];
|
||||
|
||||
ogg_int32_t **pcmbundle=(ogg_int32_t **)alloca(sizeof(*pcmbundle)*vi->channels);
|
||||
int *zerobundle=(int *)alloca(sizeof(*zerobundle)*vi->channels);
|
||||
tremor_ogg_int32_t **pcmbundle=
|
||||
alloca(sizeof(*pcmbundle)*vi->channels);
|
||||
int *zerobundle=
|
||||
alloca(sizeof(*zerobundle)*vi->channels);
|
||||
int *nonzero=
|
||||
alloca(sizeof(*nonzero)*vi->channels);
|
||||
tremor_ogg_int32_t **floormemo=
|
||||
alloca(sizeof(*floormemo)*vi->channels);
|
||||
|
||||
int *nonzero =(int *)alloca(sizeof(*nonzero)*vi->channels);
|
||||
void **floormemo=(void **)alloca(sizeof(*floormemo)*vi->channels);
|
||||
|
||||
/* time domain information decode (note that applying the
|
||||
information would have to happen later; we'll probably add a
|
||||
function entry to the harness for that later */
|
||||
/* NOT IMPLEMENTED */
|
||||
|
||||
/* recover the spectral envelope; store it in the PCM vector for now */
|
||||
for(i=0;i<vi->channels;i++){
|
||||
int submap=info->chmuxlist[i];
|
||||
floormemo[i]=look->floor_func[submap]->
|
||||
inverse1(vb,look->floor_look[submap]);
|
||||
int submap=0;
|
||||
int floorno;
|
||||
|
||||
if(info->submaps>1)
|
||||
submap=info->chmuxlist[i];
|
||||
floorno=info->submaplist[submap].floor;
|
||||
|
||||
if(ci->floor_type[floorno]){
|
||||
/* floor 1 */
|
||||
floormemo[i]=alloca(sizeof(*floormemo[i])*
|
||||
floor1_memosize(ci->floor_param[floorno]));
|
||||
floormemo[i]=floor1_inverse1(vd,ci->floor_param[floorno],floormemo[i]);
|
||||
}else{
|
||||
/* floor 0 */
|
||||
floormemo[i]=alloca(sizeof(*floormemo[i])*
|
||||
floor0_memosize(ci->floor_param[floorno]));
|
||||
floormemo[i]=floor0_inverse1(vd,ci->floor_param[floorno],floormemo[i]);
|
||||
}
|
||||
|
||||
if(floormemo[i])
|
||||
nonzero[i]=1;
|
||||
else
|
||||
nonzero[i]=0;
|
||||
memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
|
||||
memset(vd->work[i],0,sizeof(*vd->work[i])*n/2);
|
||||
}
|
||||
|
||||
/* channel coupling can 'dirty' the nonzero listing */
|
||||
for(i=0;i<info->coupling_steps;i++){
|
||||
if(nonzero[info->coupling_mag[i]] ||
|
||||
nonzero[info->coupling_ang[i]]){
|
||||
nonzero[info->coupling_mag[i]]=1;
|
||||
nonzero[info->coupling_ang[i]]=1;
|
||||
if(nonzero[info->coupling[i].mag] ||
|
||||
nonzero[info->coupling[i].ang]){
|
||||
nonzero[info->coupling[i].mag]=1;
|
||||
nonzero[info->coupling[i].ang]=1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -230,31 +159,30 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
|
||||
for(i=0;i<info->submaps;i++){
|
||||
int ch_in_bundle=0;
|
||||
for(j=0;j<vi->channels;j++){
|
||||
if(info->chmuxlist[j]==i){
|
||||
if(!info->chmuxlist || info->chmuxlist[j]==i){
|
||||
if(nonzero[j])
|
||||
zerobundle[ch_in_bundle]=1;
|
||||
else
|
||||
zerobundle[ch_in_bundle]=0;
|
||||
pcmbundle[ch_in_bundle++]=vb->pcm[j];
|
||||
pcmbundle[ch_in_bundle++]=vd->work[j];
|
||||
}
|
||||
}
|
||||
|
||||
look->residue_func[i]->inverse(vb,look->residue_look[i],
|
||||
pcmbundle,zerobundle,ch_in_bundle);
|
||||
res_inverse(vd,ci->residue_param+info->submaplist[i].residue,
|
||||
pcmbundle,zerobundle,ch_in_bundle);
|
||||
}
|
||||
|
||||
//for(j=0;j<vi->channels;j++)
|
||||
//_analysis_output("coupled",seq+j,vb->pcm[j],-8,n/2,0,0);
|
||||
|
||||
|
||||
/* channel coupling */
|
||||
for(i=info->coupling_steps-1;i>=0;i--){
|
||||
ogg_int32_t *pcmM=vb->pcm[info->coupling_mag[i]];
|
||||
ogg_int32_t *pcmA=vb->pcm[info->coupling_ang[i]];
|
||||
tremor_ogg_int32_t *pcmM=vd->work[info->coupling[i].mag];
|
||||
tremor_ogg_int32_t *pcmA=vd->work[info->coupling[i].ang];
|
||||
|
||||
for(j=0;j<n/2;j++){
|
||||
ogg_int32_t mag=pcmM[j];
|
||||
ogg_int32_t ang=pcmA[j];
|
||||
tremor_ogg_int32_t mag=pcmM[j];
|
||||
tremor_ogg_int32_t ang=pcmA[j];
|
||||
|
||||
if(mag>0)
|
||||
if(ang>0){
|
||||
@@ -280,10 +208,21 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
|
||||
|
||||
/* compute and apply spectral envelope */
|
||||
for(i=0;i<vi->channels;i++){
|
||||
ogg_int32_t *pcm=vb->pcm[i];
|
||||
int submap=info->chmuxlist[i];
|
||||
look->floor_func[submap]->
|
||||
inverse2(vb,look->floor_look[submap],floormemo[i],pcm);
|
||||
tremor_ogg_int32_t *pcm=vd->work[i];
|
||||
int submap=0;
|
||||
int floorno;
|
||||
|
||||
if(info->submaps>1)
|
||||
submap=info->chmuxlist[i];
|
||||
floorno=info->submaplist[submap].floor;
|
||||
|
||||
if(ci->floor_type[floorno]){
|
||||
/* floor 1 */
|
||||
floor1_inverse2(vd,ci->floor_param[floorno],floormemo[i],pcm);
|
||||
}else{
|
||||
/* floor 0 */
|
||||
floor0_inverse2(vd,ci->floor_param[floorno],floormemo[i],pcm);
|
||||
}
|
||||
}
|
||||
|
||||
//for(j=0;j<vi->channels;j++)
|
||||
@@ -291,38 +230,12 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
|
||||
|
||||
/* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
|
||||
/* only MDCT right now.... */
|
||||
for(i=0;i<vi->channels;i++){
|
||||
ogg_int32_t *pcm=vb->pcm[i];
|
||||
mdct_backward(n,pcm,pcm);
|
||||
}
|
||||
for(i=0;i<vi->channels;i++)
|
||||
mdct_backward(n,vd->work[i]);
|
||||
|
||||
//for(j=0;j<vi->channels;j++)
|
||||
//_analysis_output("imdct",seq+j,vb->pcm[j],-24,n,0,0);
|
||||
|
||||
/* window the data */
|
||||
for(i=0;i<vi->channels;i++){
|
||||
ogg_int32_t *pcm=vb->pcm[i];
|
||||
if(nonzero[i])
|
||||
_vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
|
||||
else
|
||||
for(j=0;j<n;j++)
|
||||
pcm[j]=0;
|
||||
|
||||
}
|
||||
|
||||
//for(j=0;j<vi->channels;j++)
|
||||
//_analysis_output("window",seq+j,vb->pcm[j],-24,n,0,0);
|
||||
|
||||
seq+=vi->channels;
|
||||
/* all done! */
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* export hooks */
|
||||
vorbis_func_mapping mapping0_exportbundle={
|
||||
&mapping0_unpack,
|
||||
&mapping0_look,
|
||||
&mapping0_free_info,
|
||||
&mapping0_free_look,
|
||||
&mapping0_inverse
|
||||
};
|
||||
|
||||
+346
-370
@@ -1,19 +1,19 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: normalized modified discrete cosine transform
|
||||
power of two length transform only [64 <= n ]
|
||||
last mod: $Id$
|
||||
last mod: $Id: mdct.c,v 1.9.6.5 2003/04/29 04:03:27 xiphmont Exp $
|
||||
|
||||
Original algorithm adapted long ago from _The use of multirate filter
|
||||
banks for coding of high quality digital audio_, by T. Sporer,
|
||||
@@ -33,23 +33,62 @@
|
||||
********************************************************************/
|
||||
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codebook.h"
|
||||
#include "os.h"
|
||||
#include "misc.h"
|
||||
#include "mdct.h"
|
||||
#include "mdct_lookup.h"
|
||||
|
||||
STIN void presymmetry(DATA_TYPE *in,int n2,int step){
|
||||
DATA_TYPE *aX;
|
||||
DATA_TYPE *bX;
|
||||
LOOKUP_T *T;
|
||||
int n4=n2>>1;
|
||||
|
||||
aX = in+n2-3;
|
||||
T = sincos_lookup0;
|
||||
|
||||
do{
|
||||
REG_TYPE r0= aX[0];
|
||||
REG_TYPE r2= aX[2];
|
||||
XPROD31( r0, r2, T[0], T[1], &aX[0], &aX[2] ); T+=step;
|
||||
aX-=4;
|
||||
}while(aX>=in+n4);
|
||||
do{
|
||||
REG_TYPE r0= aX[0];
|
||||
REG_TYPE r2= aX[2];
|
||||
XPROD31( r0, r2, T[1], T[0], &aX[0], &aX[2] ); T-=step;
|
||||
aX-=4;
|
||||
}while(aX>=in);
|
||||
|
||||
aX = in+n2-4;
|
||||
bX = in;
|
||||
T = sincos_lookup0;
|
||||
do{
|
||||
REG_TYPE ri0= aX[0];
|
||||
REG_TYPE ri2= aX[2];
|
||||
REG_TYPE ro0= bX[0];
|
||||
REG_TYPE ro2= bX[2];
|
||||
|
||||
XNPROD31( ro2, ro0, T[1], T[0], &aX[0], &aX[2] ); T+=step;
|
||||
XNPROD31( ri2, ri0, T[0], T[1], &bX[0], &bX[2] );
|
||||
|
||||
aX-=4;
|
||||
bX+=4;
|
||||
}while(aX>=in+n4);
|
||||
|
||||
}
|
||||
|
||||
/* 8 point butterfly (in place) */
|
||||
STIN void mdct_butterfly_8(DATA_TYPE *x){
|
||||
|
||||
REG_TYPE r0 = x[4] + x[0];
|
||||
REG_TYPE r1 = x[4] - x[0];
|
||||
REG_TYPE r2 = x[5] + x[1];
|
||||
REG_TYPE r3 = x[5] - x[1];
|
||||
REG_TYPE r4 = x[6] + x[2];
|
||||
REG_TYPE r5 = x[6] - x[2];
|
||||
REG_TYPE r6 = x[7] + x[3];
|
||||
REG_TYPE r7 = x[7] - x[3];
|
||||
REG_TYPE r0 = x[0] + x[1];
|
||||
REG_TYPE r1 = x[0] - x[1];
|
||||
REG_TYPE r2 = x[2] + x[3];
|
||||
REG_TYPE r3 = x[2] - x[3];
|
||||
REG_TYPE r4 = x[4] + x[5];
|
||||
REG_TYPE r5 = x[4] - x[5];
|
||||
REG_TYPE r6 = x[6] + x[7];
|
||||
REG_TYPE r7 = x[6] - x[7];
|
||||
|
||||
x[0] = r5 + r3;
|
||||
x[1] = r7 - r1;
|
||||
@@ -64,29 +103,25 @@ STIN void mdct_butterfly_8(DATA_TYPE *x){
|
||||
|
||||
/* 16 point butterfly (in place, 4 register) */
|
||||
STIN void mdct_butterfly_16(DATA_TYPE *x){
|
||||
|
||||
REG_TYPE r0, r1;
|
||||
|
||||
r0 = x[ 0] - x[ 8]; x[ 8] += x[ 0];
|
||||
r1 = x[ 1] - x[ 9]; x[ 9] += x[ 1];
|
||||
x[ 0] = MULT31((r0 + r1) , cPI2_8);
|
||||
x[ 1] = MULT31((r1 - r0) , cPI2_8);
|
||||
|
||||
REG_TYPE r0, r1, r2, r3;
|
||||
|
||||
r0 = x[ 8] - x[ 9]; x[ 8] += x[ 9];
|
||||
r1 = x[10] - x[11]; x[10] += x[11];
|
||||
r2 = x[ 1] - x[ 0]; x[ 9] = x[ 1] + x[0];
|
||||
r3 = x[ 3] - x[ 2]; x[11] = x[ 3] + x[2];
|
||||
x[ 0] = MULT31((r0 - r1) , cPI2_8);
|
||||
x[ 1] = MULT31((r2 + r3) , cPI2_8);
|
||||
x[ 2] = MULT31((r0 + r1) , cPI2_8);
|
||||
x[ 3] = MULT31((r3 - r2) , cPI2_8);
|
||||
MB();
|
||||
|
||||
r0 = x[10] - x[ 2]; x[10] += x[ 2];
|
||||
r1 = x[ 3] - x[11]; x[11] += x[ 3];
|
||||
x[ 2] = r1; x[ 3] = r0;
|
||||
MB();
|
||||
|
||||
r0 = x[12] - x[ 4]; x[12] += x[ 4];
|
||||
r1 = x[13] - x[ 5]; x[13] += x[ 5];
|
||||
x[ 4] = MULT31((r0 - r1) , cPI2_8);
|
||||
x[ 5] = MULT31((r0 + r1) , cPI2_8);
|
||||
MB();
|
||||
|
||||
r0 = x[14] - x[ 6]; x[14] += x[ 6];
|
||||
r1 = x[15] - x[ 7]; x[15] += x[ 7];
|
||||
x[ 6] = r0; x[ 7] = r1;
|
||||
r2 = x[12] - x[13]; x[12] += x[13];
|
||||
r3 = x[14] - x[15]; x[14] += x[15];
|
||||
r0 = x[ 4] - x[ 5]; x[13] = x[ 5] + x[ 4];
|
||||
r1 = x[ 7] - x[ 6]; x[15] = x[ 7] + x[ 6];
|
||||
x[ 4] = r2; x[ 5] = r1;
|
||||
x[ 6] = r3; x[ 7] = r0;
|
||||
MB();
|
||||
|
||||
mdct_butterfly_8(x);
|
||||
@@ -96,48 +131,40 @@ STIN void mdct_butterfly_16(DATA_TYPE *x){
|
||||
/* 32 point butterfly (in place, 4 register) */
|
||||
STIN void mdct_butterfly_32(DATA_TYPE *x){
|
||||
|
||||
REG_TYPE r0, r1;
|
||||
REG_TYPE r0, r1, r2, r3;
|
||||
|
||||
r0 = x[30] - x[14]; x[30] += x[14];
|
||||
r1 = x[31] - x[15]; x[31] += x[15];
|
||||
x[14] = r0; x[15] = r1;
|
||||
r0 = x[16] - x[17]; x[16] += x[17];
|
||||
r1 = x[18] - x[19]; x[18] += x[19];
|
||||
r2 = x[ 1] - x[ 0]; x[17] = x[ 1] + x[ 0];
|
||||
r3 = x[ 3] - x[ 2]; x[19] = x[ 3] + x[ 2];
|
||||
XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 0], &x[ 2] );
|
||||
XPROD31 ( r2, r3, cPI1_8, cPI3_8, &x[ 1], &x[ 3] );
|
||||
MB();
|
||||
|
||||
r0 = x[28] - x[12]; x[28] += x[12];
|
||||
r1 = x[29] - x[13]; x[29] += x[13];
|
||||
XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[12], &x[13] );
|
||||
r0 = x[20] - x[21]; x[20] += x[21];
|
||||
r1 = x[22] - x[23]; x[22] += x[23];
|
||||
r2 = x[ 5] - x[ 4]; x[21] = x[ 5] + x[ 4];
|
||||
r3 = x[ 7] - x[ 6]; x[23] = x[ 7] + x[ 6];
|
||||
x[ 4] = MULT31((r0 - r1) , cPI2_8);
|
||||
x[ 5] = MULT31((r3 + r2) , cPI2_8);
|
||||
x[ 6] = MULT31((r0 + r1) , cPI2_8);
|
||||
x[ 7] = MULT31((r3 - r2) , cPI2_8);
|
||||
MB();
|
||||
|
||||
r0 = x[26] - x[10]; x[26] += x[10];
|
||||
r1 = x[27] - x[11]; x[27] += x[11];
|
||||
x[10] = MULT31((r0 - r1) , cPI2_8);
|
||||
x[11] = MULT31((r0 + r1) , cPI2_8);
|
||||
r0 = x[24] - x[25]; x[24] += x[25];
|
||||
r1 = x[26] - x[27]; x[26] += x[27];
|
||||
r2 = x[ 9] - x[ 8]; x[25] = x[ 9] + x[ 8];
|
||||
r3 = x[11] - x[10]; x[27] = x[11] + x[10];
|
||||
XNPROD31( r0, r1, cPI1_8, cPI3_8, &x[ 8], &x[10] );
|
||||
XPROD31 ( r2, r3, cPI3_8, cPI1_8, &x[ 9], &x[11] );
|
||||
MB();
|
||||
|
||||
r0 = x[24] - x[ 8]; x[24] += x[ 8];
|
||||
r1 = x[25] - x[ 9]; x[25] += x[ 9];
|
||||
XNPROD31( r0, r1, cPI3_8, cPI1_8, &x[ 8], &x[ 9] );
|
||||
MB();
|
||||
|
||||
r0 = x[22] - x[ 6]; x[22] += x[ 6];
|
||||
r1 = x[ 7] - x[23]; x[23] += x[ 7];
|
||||
x[ 6] = r1; x[ 7] = r0;
|
||||
MB();
|
||||
|
||||
r0 = x[ 4] - x[20]; x[20] += x[ 4];
|
||||
r1 = x[ 5] - x[21]; x[21] += x[ 5];
|
||||
XPROD31 ( r0, r1, cPI3_8, cPI1_8, &x[ 4], &x[ 5] );
|
||||
MB();
|
||||
|
||||
r0 = x[ 2] - x[18]; x[18] += x[ 2];
|
||||
r1 = x[ 3] - x[19]; x[19] += x[ 3];
|
||||
x[ 2] = MULT31((r1 + r0) , cPI2_8);
|
||||
x[ 3] = MULT31((r1 - r0) , cPI2_8);
|
||||
MB();
|
||||
|
||||
r0 = x[ 0] - x[16]; x[16] += x[ 0];
|
||||
r1 = x[ 1] - x[17]; x[17] += x[ 1];
|
||||
XPROD31 ( r0, r1, cPI1_8, cPI3_8, &x[ 0], &x[ 1] );
|
||||
r0 = x[28] - x[29]; x[28] += x[29];
|
||||
r1 = x[30] - x[31]; x[30] += x[31];
|
||||
r2 = x[12] - x[13]; x[29] = x[13] + x[12];
|
||||
r3 = x[15] - x[14]; x[31] = x[15] + x[14];
|
||||
x[12] = r0; x[13] = r3;
|
||||
x[14] = r1; x[15] = r2;
|
||||
MB();
|
||||
|
||||
mdct_butterfly_16(x);
|
||||
@@ -147,87 +174,30 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
|
||||
/* N/stage point generic N stage butterfly (in place, 2 register) */
|
||||
STIN void mdct_butterfly_generic(DATA_TYPE *x,int points,int step){
|
||||
|
||||
LOOKUP_T *T = sincos_lookup0;
|
||||
DATA_TYPE *x1 = x + points - 8;
|
||||
DATA_TYPE *x2 = x + (points>>1) - 8;
|
||||
REG_TYPE r0;
|
||||
REG_TYPE r1;
|
||||
LOOKUP_T *T = sincos_lookup0;
|
||||
DATA_TYPE *x1 = x + points - 4;
|
||||
DATA_TYPE *x2 = x + (points>>1) - 4;
|
||||
REG_TYPE r0, r1, r2, r3;
|
||||
|
||||
do{
|
||||
r0 = x1[6] - x2[6]; x1[6] += x2[6];
|
||||
r1 = x2[7] - x1[7]; x1[7] += x2[7];
|
||||
XPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T+=step;
|
||||
|
||||
r0 = x1[4] - x2[4]; x1[4] += x2[4];
|
||||
r1 = x2[5] - x1[5]; x1[5] += x2[5];
|
||||
XPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T+=step;
|
||||
|
||||
r0 = x1[2] - x2[2]; x1[2] += x2[2];
|
||||
r1 = x2[3] - x1[3]; x1[3] += x2[3];
|
||||
XPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T+=step;
|
||||
|
||||
r0 = x1[0] - x2[0]; x1[0] += x2[0];
|
||||
r1 = x2[1] - x1[1]; x1[1] += x2[1];
|
||||
XPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T+=step;
|
||||
|
||||
x1-=8; x2-=8;
|
||||
r0 = x1[0] - x1[1]; x1[0] += x1[1];
|
||||
r1 = x1[3] - x1[2]; x1[2] += x1[3];
|
||||
r2 = x2[1] - x2[0]; x1[1] = x2[1] + x2[0];
|
||||
r3 = x2[3] - x2[2]; x1[3] = x2[3] + x2[2];
|
||||
XPROD31( r1, r0, T[0], T[1], &x2[0], &x2[2] );
|
||||
XPROD31( r2, r3, T[0], T[1], &x2[1], &x2[3] ); T+=step;
|
||||
x1-=4;
|
||||
x2-=4;
|
||||
}while(T<sincos_lookup0+1024);
|
||||
do{
|
||||
r0 = x1[6] - x2[6]; x1[6] += x2[6];
|
||||
r1 = x1[7] - x2[7]; x1[7] += x2[7];
|
||||
XNPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T-=step;
|
||||
|
||||
r0 = x1[4] - x2[4]; x1[4] += x2[4];
|
||||
r1 = x1[5] - x2[5]; x1[5] += x2[5];
|
||||
XNPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T-=step;
|
||||
|
||||
r0 = x1[2] - x2[2]; x1[2] += x2[2];
|
||||
r1 = x1[3] - x2[3]; x1[3] += x2[3];
|
||||
XNPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T-=step;
|
||||
|
||||
r0 = x1[0] - x2[0]; x1[0] += x2[0];
|
||||
r1 = x1[1] - x2[1]; x1[1] += x2[1];
|
||||
XNPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T-=step;
|
||||
|
||||
x1-=8; x2-=8;
|
||||
}while(T>sincos_lookup0);
|
||||
do{
|
||||
r0 = x2[6] - x1[6]; x1[6] += x2[6];
|
||||
r1 = x2[7] - x1[7]; x1[7] += x2[7];
|
||||
XPROD31( r0, r1, T[0], T[1], &x2[6], &x2[7] ); T+=step;
|
||||
|
||||
r0 = x2[4] - x1[4]; x1[4] += x2[4];
|
||||
r1 = x2[5] - x1[5]; x1[5] += x2[5];
|
||||
XPROD31( r0, r1, T[0], T[1], &x2[4], &x2[5] ); T+=step;
|
||||
|
||||
r0 = x2[2] - x1[2]; x1[2] += x2[2];
|
||||
r1 = x2[3] - x1[3]; x1[3] += x2[3];
|
||||
XPROD31( r0, r1, T[0], T[1], &x2[2], &x2[3] ); T+=step;
|
||||
|
||||
r0 = x2[0] - x1[0]; x1[0] += x2[0];
|
||||
r1 = x2[1] - x1[1]; x1[1] += x2[1];
|
||||
XPROD31( r0, r1, T[0], T[1], &x2[0], &x2[1] ); T+=step;
|
||||
|
||||
x1-=8; x2-=8;
|
||||
}while(T<sincos_lookup0+1024);
|
||||
do{
|
||||
r0 = x1[6] - x2[6]; x1[6] += x2[6];
|
||||
r1 = x2[7] - x1[7]; x1[7] += x2[7];
|
||||
XNPROD31( r1, r0, T[0], T[1], &x2[6], &x2[7] ); T-=step;
|
||||
|
||||
r0 = x1[4] - x2[4]; x1[4] += x2[4];
|
||||
r1 = x2[5] - x1[5]; x1[5] += x2[5];
|
||||
XNPROD31( r1, r0, T[0], T[1], &x2[4], &x2[5] ); T-=step;
|
||||
|
||||
r0 = x1[2] - x2[2]; x1[2] += x2[2];
|
||||
r1 = x2[3] - x1[3]; x1[3] += x2[3];
|
||||
XNPROD31( r1, r0, T[0], T[1], &x2[2], &x2[3] ); T-=step;
|
||||
|
||||
r0 = x1[0] - x2[0]; x1[0] += x2[0];
|
||||
r1 = x2[1] - x1[1]; x1[1] += x2[1];
|
||||
XNPROD31( r1, r0, T[0], T[1], &x2[0], &x2[1] ); T-=step;
|
||||
|
||||
x1-=8; x2-=8;
|
||||
r0 = x1[0] - x1[1]; x1[0] += x1[1];
|
||||
r1 = x1[2] - x1[3]; x1[2] += x1[3];
|
||||
r2 = x2[0] - x2[1]; x1[1] = x2[1] + x2[0];
|
||||
r3 = x2[3] - x2[2]; x1[3] = x2[3] + x2[2];
|
||||
XNPROD31( r0, r1, T[0], T[1], &x2[0], &x2[2] );
|
||||
XNPROD31( r3, r2, T[0], T[1], &x2[1], &x2[3] ); T-=step;
|
||||
x1-=4;
|
||||
x2-=4;
|
||||
}while(T>sincos_lookup0);
|
||||
}
|
||||
|
||||
@@ -235,15 +205,14 @@ STIN void mdct_butterflies(DATA_TYPE *x,int points,int shift){
|
||||
|
||||
int stages=8-shift;
|
||||
int i,j;
|
||||
|
||||
|
||||
for(i=0;--stages>0;i++){
|
||||
for(j=0;j<(1<<i);j++)
|
||||
mdct_butterfly_generic(x+(points>>i)*j,points>>i,4<<(i+shift));
|
||||
}
|
||||
|
||||
|
||||
for(j=0;j<points;j+=32)
|
||||
mdct_butterfly_32(x+j);
|
||||
|
||||
}
|
||||
|
||||
static unsigned char bitrev[16]={0,8,4,12,2,10,6,14,1,9,5,13,3,11,7,15};
|
||||
@@ -252,259 +221,266 @@ STIN int bitrev12(int x){
|
||||
return bitrev[x>>8]|(bitrev[(x&0x0f0)>>4]<<4)|(((int)bitrev[x&0x00f])<<8);
|
||||
}
|
||||
|
||||
STIN void mdct_bitreverse(DATA_TYPE *x,int n,int step,int shift){
|
||||
|
||||
STIN void mdct_bitreverse(DATA_TYPE *x,int n,int shift){
|
||||
int bit = 0;
|
||||
DATA_TYPE *w = x+(n>>1);
|
||||
|
||||
do{
|
||||
DATA_TYPE b = bitrev12(bit++);
|
||||
DATA_TYPE *xx = x + (b>>shift);
|
||||
REG_TYPE r;
|
||||
|
||||
w -= 2;
|
||||
|
||||
if(w>xx){
|
||||
|
||||
r = xx[0];
|
||||
xx[0] = w[0];
|
||||
w[0] = r;
|
||||
|
||||
r = xx[1];
|
||||
xx[1] = w[1];
|
||||
w[1] = r;
|
||||
}
|
||||
}while(w>x);
|
||||
}
|
||||
|
||||
STIN void mdct_step7(DATA_TYPE *x,int n,int step){
|
||||
DATA_TYPE *w0 = x;
|
||||
DATA_TYPE *w1 = x = w0+(n>>1);
|
||||
DATA_TYPE *w1 = x+(n>>1);
|
||||
LOOKUP_T *T = (step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
|
||||
LOOKUP_T *Ttop = T+1024;
|
||||
DATA_TYPE r2;
|
||||
|
||||
REG_TYPE r0, r1, r2, r3;
|
||||
|
||||
do{
|
||||
DATA_TYPE r3 = bitrev12(bit++);
|
||||
DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1;
|
||||
DATA_TYPE *x1 = x + (r3>>shift);
|
||||
w1 -= 2;
|
||||
|
||||
REG_TYPE r0 = x0[0] + x1[0];
|
||||
REG_TYPE r1 = x1[1] - x0[1];
|
||||
r0 = w0[0] + w1[0];
|
||||
r1 = w1[1] - w0[1];
|
||||
r2 = MULT32(r0, T[1]) + MULT32(r1, T[0]);
|
||||
r3 = MULT32(r1, T[1]) - MULT32(r0, T[0]);
|
||||
T+=step;
|
||||
|
||||
XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
|
||||
|
||||
w1 -= 4;
|
||||
|
||||
r0 = (x0[1] + x1[1])>>1;
|
||||
r1 = (x0[0] - x1[0])>>1;
|
||||
r0 = (w0[1] + w1[1])>>1;
|
||||
r1 = (w0[0] - w1[0])>>1;
|
||||
w0[0] = r0 + r2;
|
||||
w0[1] = r1 + r3;
|
||||
w1[2] = r0 - r2;
|
||||
w1[3] = r3 - r1;
|
||||
|
||||
r3 = bitrev12(bit++);
|
||||
x0 = x + ((r3 ^ 0xfff)>>shift) -1;
|
||||
x1 = x + (r3>>shift);
|
||||
|
||||
r0 = x0[0] + x1[0];
|
||||
r1 = x1[1] - x0[1];
|
||||
|
||||
XPROD32( r0, r1, T[1], T[0], &r2, &r3 ); T+=step;
|
||||
|
||||
r0 = (x0[1] + x1[1])>>1;
|
||||
r1 = (x0[0] - x1[0])>>1;
|
||||
w0[2] = r0 + r2;
|
||||
w0[3] = r1 + r3;
|
||||
w1[0] = r0 - r2;
|
||||
w1[1] = r3 - r1;
|
||||
|
||||
w0 += 4;
|
||||
w0 += 2;
|
||||
}while(T<Ttop);
|
||||
do{
|
||||
DATA_TYPE r3 = bitrev12(bit++);
|
||||
DATA_TYPE *x0 = x + ((r3 ^ 0xfff)>>shift) -1;
|
||||
DATA_TYPE *x1 = x + (r3>>shift);
|
||||
w1 -= 2;
|
||||
|
||||
REG_TYPE r0 = x0[0] + x1[0];
|
||||
REG_TYPE r1 = x1[1] - x0[1];
|
||||
r0 = w0[0] + w1[0];
|
||||
r1 = w1[1] - w0[1];
|
||||
T-=step;
|
||||
r2 = MULT32(r0, T[0]) + MULT32(r1, T[1]);
|
||||
r3 = MULT32(r1, T[0]) - MULT32(r0, T[1]);
|
||||
|
||||
T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
|
||||
|
||||
w1 -= 4;
|
||||
|
||||
r0 = (x0[1] + x1[1])>>1;
|
||||
r1 = (x0[0] - x1[0])>>1;
|
||||
r0 = (w0[1] + w1[1])>>1;
|
||||
r1 = (w0[0] - w1[0])>>1;
|
||||
w0[0] = r0 + r2;
|
||||
w0[1] = r1 + r3;
|
||||
w1[2] = r0 - r2;
|
||||
w1[3] = r3 - r1;
|
||||
|
||||
r3 = bitrev12(bit++);
|
||||
x0 = x + ((r3 ^ 0xfff)>>shift) -1;
|
||||
x1 = x + (r3>>shift);
|
||||
|
||||
r0 = x0[0] + x1[0];
|
||||
r1 = x1[1] - x0[1];
|
||||
|
||||
T-=step; XPROD32( r0, r1, T[0], T[1], &r2, &r3 );
|
||||
|
||||
r0 = (x0[1] + x1[1])>>1;
|
||||
r1 = (x0[0] - x1[0])>>1;
|
||||
w0[2] = r0 + r2;
|
||||
w0[3] = r1 + r3;
|
||||
w1[0] = r0 - r2;
|
||||
w1[1] = r3 - r1;
|
||||
|
||||
w0 += 4;
|
||||
w0 += 2;
|
||||
}while(w0<w1);
|
||||
}
|
||||
|
||||
void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out){
|
||||
int n2=n>>1;
|
||||
int n4=n>>2;
|
||||
DATA_TYPE *iX;
|
||||
DATA_TYPE *oX;
|
||||
STIN void mdct_step8(DATA_TYPE *x, int n, int step){
|
||||
LOOKUP_T *T;
|
||||
LOOKUP_T *V;
|
||||
int shift;
|
||||
int step;
|
||||
|
||||
for (shift=6;!(n&(1<<shift));shift++);
|
||||
shift=13-shift;
|
||||
step=2<<shift;
|
||||
|
||||
/* rotate */
|
||||
|
||||
iX = in+n2-7;
|
||||
oX = out+n2+n4;
|
||||
T = sincos_lookup0;
|
||||
|
||||
do{
|
||||
oX-=4;
|
||||
XPROD31( iX[4], iX[6], T[0], T[1], &oX[2], &oX[3] ); T+=step;
|
||||
XPROD31( iX[0], iX[2], T[0], T[1], &oX[0], &oX[1] ); T+=step;
|
||||
iX-=8;
|
||||
}while(iX>=in+n4);
|
||||
do{
|
||||
oX-=4;
|
||||
XPROD31( iX[4], iX[6], T[1], T[0], &oX[2], &oX[3] ); T-=step;
|
||||
XPROD31( iX[0], iX[2], T[1], T[0], &oX[0], &oX[1] ); T-=step;
|
||||
iX-=8;
|
||||
}while(iX>=in);
|
||||
|
||||
iX = in+n2-8;
|
||||
oX = out+n2+n4;
|
||||
T = sincos_lookup0;
|
||||
|
||||
do{
|
||||
T+=step; XNPROD31( iX[6], iX[4], T[0], T[1], &oX[0], &oX[1] );
|
||||
T+=step; XNPROD31( iX[2], iX[0], T[0], T[1], &oX[2], &oX[3] );
|
||||
iX-=8;
|
||||
oX+=4;
|
||||
}while(iX>=in+n4);
|
||||
do{
|
||||
T-=step; XNPROD31( iX[6], iX[4], T[1], T[0], &oX[0], &oX[1] );
|
||||
T-=step; XNPROD31( iX[2], iX[0], T[1], T[0], &oX[2], &oX[3] );
|
||||
iX-=8;
|
||||
oX+=4;
|
||||
}while(iX>=in);
|
||||
|
||||
mdct_butterflies(out+n2,n2,shift);
|
||||
mdct_bitreverse(out,n,step,shift);
|
||||
|
||||
/* rotate + window */
|
||||
|
||||
DATA_TYPE *iX =x+(n>>1);
|
||||
step>>=2;
|
||||
{
|
||||
DATA_TYPE *oX1=out+n2+n4;
|
||||
DATA_TYPE *oX2=out+n2+n4;
|
||||
DATA_TYPE *iX =out;
|
||||
|
||||
switch(step) {
|
||||
default: {
|
||||
T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
|
||||
do{
|
||||
oX1-=4;
|
||||
XPROD31( iX[0], -iX[1], T[0], T[1], &oX1[3], &oX2[0] ); T+=step;
|
||||
XPROD31( iX[2], -iX[3], T[0], T[1], &oX1[2], &oX2[1] ); T+=step;
|
||||
XPROD31( iX[4], -iX[5], T[0], T[1], &oX1[1], &oX2[2] ); T+=step;
|
||||
XPROD31( iX[6], -iX[7], T[0], T[1], &oX1[0], &oX2[3] ); T+=step;
|
||||
oX2+=4;
|
||||
iX+=8;
|
||||
}while(iX<oX1);
|
||||
break;
|
||||
}
|
||||
|
||||
case 1: {
|
||||
/* linear interpolation between table values: offset=0.5, step=1 */
|
||||
REG_TYPE t0,t1,v0,v1;
|
||||
T = sincos_lookup0;
|
||||
V = sincos_lookup1;
|
||||
t0 = (*T++)>>1;
|
||||
t1 = (*T++)>>1;
|
||||
do{
|
||||
oX1-=4;
|
||||
|
||||
t0 += (v0 = (*V++)>>1);
|
||||
t1 += (v1 = (*V++)>>1);
|
||||
XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
|
||||
v0 += (t0 = (*T++)>>1);
|
||||
v1 += (t1 = (*T++)>>1);
|
||||
XPROD31( iX[2], -iX[3], v0, v1, &oX1[2], &oX2[1] );
|
||||
t0 += (v0 = (*V++)>>1);
|
||||
t1 += (v1 = (*V++)>>1);
|
||||
XPROD31( iX[4], -iX[5], t0, t1, &oX1[1], &oX2[2] );
|
||||
v0 += (t0 = (*T++)>>1);
|
||||
v1 += (t1 = (*T++)>>1);
|
||||
XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
|
||||
|
||||
oX2+=4;
|
||||
iX+=8;
|
||||
}while(iX<oX1);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0: {
|
||||
/* linear interpolation between table values: offset=0.25, step=0.5 */
|
||||
REG_TYPE t0,t1,v0,v1,q0,q1;
|
||||
T = sincos_lookup0;
|
||||
V = sincos_lookup1;
|
||||
t0 = *T++;
|
||||
t1 = *T++;
|
||||
do{
|
||||
oX1-=4;
|
||||
|
||||
v0 = *V++;
|
||||
v1 = *V++;
|
||||
t0 += (q0 = (v0-t0)>>2);
|
||||
t1 += (q1 = (v1-t1)>>2);
|
||||
XPROD31( iX[0], -iX[1], t0, t1, &oX1[3], &oX2[0] );
|
||||
t0 = v0-q0;
|
||||
t1 = v1-q1;
|
||||
XPROD31( iX[2], -iX[3], t0, t1, &oX1[2], &oX2[1] );
|
||||
|
||||
t0 = *T++;
|
||||
t1 = *T++;
|
||||
v0 += (q0 = (t0-v0)>>2);
|
||||
v1 += (q1 = (t1-v1)>>2);
|
||||
XPROD31( iX[4], -iX[5], v0, v1, &oX1[1], &oX2[2] );
|
||||
v0 = t0-q0;
|
||||
v1 = t1-q1;
|
||||
XPROD31( iX[6], -iX[7], v0, v1, &oX1[0], &oX2[3] );
|
||||
|
||||
oX2+=4;
|
||||
iX+=8;
|
||||
}while(iX<oX1);
|
||||
break;
|
||||
}
|
||||
switch(step) {
|
||||
default:
|
||||
T=(step>=4)?(sincos_lookup0+(step>>1)):sincos_lookup1;
|
||||
do{
|
||||
REG_TYPE r0 = x[0];
|
||||
REG_TYPE r1 = -x[1];
|
||||
XPROD31( r0, r1, T[0], T[1], x, x+1); T+=step;
|
||||
x +=2;
|
||||
}while(x<iX);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
/* linear interpolation between table values: offset=0.5, step=1 */
|
||||
REG_TYPE t0,t1,v0,v1,r0,r1;
|
||||
T = sincos_lookup0;
|
||||
V = sincos_lookup1;
|
||||
t0 = (*T++)>>1;
|
||||
t1 = (*T++)>>1;
|
||||
do{
|
||||
r0 = x[0];
|
||||
r1 = -x[1];
|
||||
t0 += (v0 = (*V++)>>1);
|
||||
t1 += (v1 = (*V++)>>1);
|
||||
XPROD31( r0, r1, t0, t1, x, x+1 );
|
||||
|
||||
r0 = x[2];
|
||||
r1 = -x[3];
|
||||
v0 += (t0 = (*T++)>>1);
|
||||
v1 += (t1 = (*T++)>>1);
|
||||
XPROD31( r0, r1, v0, v1, x+2, x+3 );
|
||||
|
||||
x += 4;
|
||||
}while(x<iX);
|
||||
break;
|
||||
}
|
||||
|
||||
case 0:
|
||||
{
|
||||
/* linear interpolation between table values: offset=0.25, step=0.5 */
|
||||
REG_TYPE t0,t1,v0,v1,q0,q1,r0,r1;
|
||||
T = sincos_lookup0;
|
||||
V = sincos_lookup1;
|
||||
t0 = *T++;
|
||||
t1 = *T++;
|
||||
do{
|
||||
|
||||
iX=out+n2+n4;
|
||||
oX1=out+n4;
|
||||
oX2=oX1;
|
||||
|
||||
v0 = *V++;
|
||||
v1 = *V++;
|
||||
t0 += (q0 = (v0-t0)>>2);
|
||||
t1 += (q1 = (v1-t1)>>2);
|
||||
r0 = x[0];
|
||||
r1 = -x[1];
|
||||
XPROD31( r0, r1, t0, t1, x, x+1 );
|
||||
t0 = v0-q0;
|
||||
t1 = v1-q1;
|
||||
r0 = x[2];
|
||||
r1 = -x[3];
|
||||
XPROD31( r0, r1, t0, t1, x+2, x+3 );
|
||||
|
||||
t0 = *T++;
|
||||
t1 = *T++;
|
||||
v0 += (q0 = (t0-v0)>>2);
|
||||
v1 += (q1 = (t1-v1)>>2);
|
||||
r0 = x[4];
|
||||
r1 = -x[5];
|
||||
XPROD31( r0, r1, v0, v1, x+4, x+5 );
|
||||
v0 = t0-q0;
|
||||
v1 = t1-q1;
|
||||
r0 = x[6];
|
||||
r1 = -x[7];
|
||||
XPROD31( r0, r1, v0, v1, x+5, x+6 );
|
||||
|
||||
do{
|
||||
oX1-=4;
|
||||
iX-=4;
|
||||
|
||||
oX2[0] = -(oX1[3] = iX[3]);
|
||||
oX2[1] = -(oX1[2] = iX[2]);
|
||||
oX2[2] = -(oX1[1] = iX[1]);
|
||||
oX2[3] = -(oX1[0] = iX[0]);
|
||||
|
||||
oX2+=4;
|
||||
}while(oX2<iX);
|
||||
|
||||
iX=out+n2+n4;
|
||||
oX1=out+n2+n4;
|
||||
oX2=out+n2;
|
||||
|
||||
do{
|
||||
oX1-=4;
|
||||
oX1[0]= iX[3];
|
||||
oX1[1]= iX[2];
|
||||
oX1[2]= iX[1];
|
||||
oX1[3]= iX[0];
|
||||
iX+=4;
|
||||
}while(oX1>oX2);
|
||||
x+=8;
|
||||
}while(x<iX);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* partial; doesn't perform last-step deinterleave/unrolling. That
|
||||
can be done more efficiently during pcm output */
|
||||
void mdct_backward(int n, DATA_TYPE *in){
|
||||
int shift;
|
||||
int step;
|
||||
|
||||
for (shift=4;!(n&(1<<shift));shift++);
|
||||
shift=13-shift;
|
||||
step=2<<shift;
|
||||
|
||||
presymmetry(in,n>>1,step);
|
||||
mdct_butterflies(in,n>>1,shift);
|
||||
mdct_bitreverse(in,n,shift);
|
||||
mdct_step7(in,n,step);
|
||||
mdct_step8(in,n,step);
|
||||
}
|
||||
|
||||
void mdct_shift_right(int n, DATA_TYPE *in, DATA_TYPE *right){
|
||||
int i;
|
||||
n>>=2;
|
||||
in+=1;
|
||||
|
||||
for(i=0;i<n;i++)
|
||||
right[i]=in[i<<1];
|
||||
}
|
||||
|
||||
void mdct_unroll_lap(int n0,int n1,
|
||||
int lW,int W,
|
||||
DATA_TYPE *in,
|
||||
DATA_TYPE *right,
|
||||
LOOKUP_T *w0,
|
||||
LOOKUP_T *w1,
|
||||
tremor_ogg_int16_t *out,
|
||||
int step,
|
||||
int start, /* samples, this frame */
|
||||
int end /* samples, this frame */){
|
||||
|
||||
DATA_TYPE *l=in+(W&&lW ? n1>>1 : n0>>1);
|
||||
DATA_TYPE *r=right+(lW ? n1>>2 : n0>>2);
|
||||
DATA_TYPE *post;
|
||||
LOOKUP_T *wR=(W && lW ? w1+(n1>>1) : w0+(n0>>1));
|
||||
LOOKUP_T *wL=(W && lW ? w1 : w0 );
|
||||
|
||||
int preLap=(lW && !W ? (n1>>2)-(n0>>2) : 0 );
|
||||
int halfLap=(lW && W ? (n1>>2) : (n0>>2) );
|
||||
int postLap=(!lW && W ? (n1>>2)-(n0>>2) : 0 );
|
||||
int n,off;
|
||||
|
||||
/* preceeding direct-copy lapping from previous frame, if any */
|
||||
if(preLap){
|
||||
n = (end<preLap?end:preLap);
|
||||
off = (start<preLap?start:preLap);
|
||||
post = r-n;
|
||||
r -= off;
|
||||
start -= off;
|
||||
end -= n;
|
||||
while(r>post){
|
||||
*out = CLIP_TO_15((*--r)>>9);
|
||||
out+=step;
|
||||
}
|
||||
}
|
||||
|
||||
/* cross-lap; two halves due to wrap-around */
|
||||
n = (end<halfLap?end:halfLap);
|
||||
off = (start<halfLap?start:halfLap);
|
||||
post = r-n;
|
||||
r -= off;
|
||||
l -= off*2;
|
||||
start -= off;
|
||||
wR -= off;
|
||||
wL += off;
|
||||
end -= n;
|
||||
while(r>post){
|
||||
l-=2;
|
||||
*out = CLIP_TO_15((MULT31(*--r,*--wR) + MULT31(*l,*wL++))>>9);
|
||||
out+=step;
|
||||
}
|
||||
|
||||
n = (end<halfLap?end:halfLap);
|
||||
off = (start<halfLap?start:halfLap);
|
||||
post = r+n;
|
||||
r += off;
|
||||
l += off*2;
|
||||
start -= off;
|
||||
end -= n;
|
||||
wR -= off;
|
||||
wL += off;
|
||||
while(r<post){
|
||||
*out = CLIP_TO_15((MULT31(*r++,*--wR) - MULT31(*l,*wL++))>>9);
|
||||
out+=step;
|
||||
l+=2;
|
||||
}
|
||||
|
||||
/* preceeding direct-copy lapping from previous frame, if any */
|
||||
if(postLap){
|
||||
n = (end<postLap?end:postLap);
|
||||
off = (start<postLap?start:postLap);
|
||||
post = l+n*2;
|
||||
l += off*2;
|
||||
while(l<post){
|
||||
*out = CLIP_TO_15((-*l)>>9);
|
||||
out+=step;
|
||||
l+=2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+13
-6
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "ivorbiscodec.h"
|
||||
#include "misc.h"
|
||||
|
||||
#define DATA_TYPE ogg_int32_t
|
||||
#define REG_TYPE register ogg_int32_t
|
||||
#define DATA_TYPE tremor_ogg_int32_t
|
||||
#define REG_TYPE register tremor_ogg_int32_t
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
#define cPI3_8 (0x0062)
|
||||
@@ -34,8 +34,15 @@
|
||||
#define cPI1_8 (0x7641af3d)
|
||||
#endif
|
||||
|
||||
extern void mdct_forward(int n, DATA_TYPE *in, DATA_TYPE *out);
|
||||
extern void mdct_backward(int n, DATA_TYPE *in, DATA_TYPE *out);
|
||||
extern void mdct_backward(int n, DATA_TYPE *in);
|
||||
extern void mdct_shift_right(int n, DATA_TYPE *in, DATA_TYPE *right);
|
||||
extern void mdct_unroll_lap(int n0,int n1,
|
||||
int lW,int W,
|
||||
DATA_TYPE *in,DATA_TYPE *right,
|
||||
LOOKUP_T *w0,LOOKUP_T *w1,
|
||||
tremor_ogg_int16_t *out,
|
||||
int step,
|
||||
int start,int end /* samples, this frame */);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -15,10 +15,10 @@
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include "misc.h"
|
||||
#include "os_types.h"
|
||||
|
||||
/* {sin(2*i*PI/4096), cos(2*i*PI/4096)}, with i = 0 to 512 */
|
||||
static const LOOKUP_T sincos_lookup0[1026] = {
|
||||
static LOOKUP_T sincos_lookup0[1026] = {
|
||||
X(0x00000000), X(0x7fffffff), X(0x003243f5), X(0x7ffff621),
|
||||
X(0x006487e3), X(0x7fffd886), X(0x0096cbc1), X(0x7fffa72c),
|
||||
X(0x00c90f88), X(0x7fff6216), X(0x00fb5330), X(0x7fff0943),
|
||||
@@ -279,7 +279,7 @@ static const LOOKUP_T sincos_lookup0[1026] = {
|
||||
};
|
||||
|
||||
/* {sin((2*i+1)*PI/4096), cos((2*i+1)*PI/4096)}, with i = 0 to 511 */
|
||||
static const LOOKUP_T sincos_lookup1[1024] = {
|
||||
static LOOKUP_T sincos_lookup1[1024] = {
|
||||
X(0x001921fb), X(0x7ffffd88), X(0x004b65ee), X(0x7fffe9cb),
|
||||
X(0x007da9d4), X(0x7fffc251), X(0x00afeda8), X(0x7fff8719),
|
||||
X(0x00e23160), X(0x7fff3824), X(0x011474f6), X(0x7ffed572),
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis SOFTWARE CODEC SOURCE CODE. *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE TremorOggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* by the XIPHOPHORUS Company http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************/
|
||||
|
||||
#define HEAD_ALIGN 64
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#define MISC_C
|
||||
#include "misc.h"
|
||||
#include <sys/time.h>
|
||||
|
||||
static void **pointers=NULL;
|
||||
static long *insertlist=NULL; /* We can't embed this in the pointer list;
|
||||
a pointer can have any value... */
|
||||
|
||||
static char **files=NULL;
|
||||
static long *file_bytes=NULL;
|
||||
static int filecount=0;
|
||||
|
||||
static int ptop=0;
|
||||
static int palloced=0;
|
||||
static int pinsert=0;
|
||||
|
||||
typedef struct {
|
||||
char *file;
|
||||
long line;
|
||||
long ptr;
|
||||
long bytes;
|
||||
} head;
|
||||
|
||||
long global_bytes=0;
|
||||
long start_time=-1;
|
||||
|
||||
static void *_insert(void *ptr,long bytes,char *file,long line){
|
||||
((head *)ptr)->file=file;
|
||||
((head *)ptr)->line=line;
|
||||
((head *)ptr)->ptr=pinsert;
|
||||
((head *)ptr)->bytes=bytes-HEAD_ALIGN;
|
||||
|
||||
if(pinsert>=palloced){
|
||||
palloced+=64;
|
||||
if(pointers){
|
||||
pointers=(void **)realloc(pointers,sizeof(void **)*palloced);
|
||||
insertlist=(long *)realloc(insertlist,sizeof(long *)*palloced);
|
||||
}else{
|
||||
pointers=(void **)malloc(sizeof(void **)*palloced);
|
||||
insertlist=(long *)malloc(sizeof(long *)*palloced);
|
||||
}
|
||||
}
|
||||
|
||||
pointers[pinsert]=ptr;
|
||||
|
||||
if(pinsert==ptop)
|
||||
pinsert=++ptop;
|
||||
else
|
||||
pinsert=insertlist[pinsert];
|
||||
|
||||
#ifdef _VDBG_GRAPHFILE
|
||||
{
|
||||
FILE *out;
|
||||
struct timeval tv;
|
||||
static struct timezone tz;
|
||||
int i;
|
||||
char buffer[80];
|
||||
gettimeofday(&tv,&tz);
|
||||
|
||||
for(i=0;i<filecount;i++)
|
||||
if(!strcmp(file,files[i]))break;
|
||||
|
||||
if(i==filecount){
|
||||
filecount++;
|
||||
if(!files){
|
||||
files=malloc(filecount*sizeof(*files));
|
||||
file_bytes=malloc(filecount*sizeof(*file_bytes));
|
||||
}else{
|
||||
files=realloc(files,filecount*sizeof(*files));
|
||||
file_bytes=realloc(file_bytes,filecount*sizeof(*file_bytes));
|
||||
}
|
||||
files[i]=strdup(file);
|
||||
file_bytes[i]=0;
|
||||
}
|
||||
|
||||
file_bytes[i]+=bytes-HEAD_ALIGN;
|
||||
|
||||
if(start_time==-1)start_time=(tv.tv_sec*1000)+(tv.tv_usec/1000);
|
||||
|
||||
snprintf(buffer,80,"%s",file);
|
||||
if(strchr(buffer,'.'))strchr(buffer,'.')[0]=0;
|
||||
strcat(buffer,_VDBG_GRAPHFILE);
|
||||
out=fopen(buffer,"a");
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
file_bytes[i]-(bytes-HEAD_ALIGN));
|
||||
fprintf(out,"%ld, %ld # FILE %s LINE %ld\n",
|
||||
-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
file_bytes[i],file,line);
|
||||
fclose(out);
|
||||
|
||||
out=fopen("total"_VDBG_GRAPHFILE,"a");
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
global_bytes);
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
global_bytes+(bytes-HEAD_ALIGN));
|
||||
fclose(out);
|
||||
}
|
||||
#endif
|
||||
|
||||
global_bytes+=(bytes-HEAD_ALIGN);
|
||||
|
||||
return(ptr+HEAD_ALIGN);
|
||||
}
|
||||
|
||||
static void _ripremove(void *ptr){
|
||||
int insert;
|
||||
|
||||
#ifdef _VDBG_GRAPHFILE
|
||||
{
|
||||
FILE *out=fopen("total"_VDBG_GRAPHFILE,"a");
|
||||
struct timeval tv;
|
||||
static struct timezone tz;
|
||||
char buffer[80];
|
||||
char *file =((head *)ptr)->file;
|
||||
long bytes =((head *)ptr)->bytes;
|
||||
int i;
|
||||
|
||||
gettimeofday(&tv,&tz);
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
global_bytes);
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
global_bytes-((head *)ptr)->bytes);
|
||||
fclose(out);
|
||||
|
||||
for(i=0;i<filecount;i++)
|
||||
if(!strcmp(file,files[i]))break;
|
||||
|
||||
snprintf(buffer,80,"%s",file);
|
||||
if(strchr(buffer,'.'))strchr(buffer,'.')[0]=0;
|
||||
strcat(buffer,_VDBG_GRAPHFILE);
|
||||
out=fopen(buffer,"a");
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
file_bytes[i]);
|
||||
fprintf(out,"%ld, %ld\n",-start_time+(tv.tv_sec*1000)+(tv.tv_usec/1000),
|
||||
file_bytes[i]-bytes);
|
||||
fclose(out);
|
||||
|
||||
file_bytes[i]-=bytes;
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
global_bytes-=((head *)ptr)->bytes;
|
||||
|
||||
insert=((head *)ptr)->ptr;
|
||||
insertlist[insert]=pinsert;
|
||||
pinsert=insert;
|
||||
|
||||
if(pointers[insert]==NULL){
|
||||
fprintf(stderr,"DEBUGGING MALLOC ERROR: freeing previously freed memory\n");
|
||||
fprintf(stderr,"\t%s %ld\n",((head *)ptr)->file,((head *)ptr)->line);
|
||||
}
|
||||
|
||||
if(global_bytes<0){
|
||||
fprintf(stderr,"DEBUGGING MALLOC ERROR: freeing unmalloced memory\n");
|
||||
}
|
||||
|
||||
pointers[insert]=NULL;
|
||||
}
|
||||
|
||||
void _VDBG_dump(void){
|
||||
int i;
|
||||
for(i=0;i<ptop;i++){
|
||||
head *ptr=pointers[i];
|
||||
if(ptr)
|
||||
fprintf(stderr,"unfreed bytes from %s:%ld\n",
|
||||
ptr->file,ptr->line);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line){
|
||||
bytes+=HEAD_ALIGN;
|
||||
if(ptr){
|
||||
ptr-=HEAD_ALIGN;
|
||||
_ripremove(ptr);
|
||||
ptr=realloc(ptr,bytes);
|
||||
}else{
|
||||
ptr=malloc(bytes);
|
||||
memset(ptr,0,bytes);
|
||||
}
|
||||
return _insert(ptr,bytes,file,line);
|
||||
}
|
||||
|
||||
extern void _VDBG_free(void *ptr,char *file,long line){
|
||||
if(ptr){
|
||||
ptr-=HEAD_ALIGN;
|
||||
_ripremove(ptr);
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
+44
-104
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,18 +18,27 @@
|
||||
#ifndef _V_RANDOM_H_
|
||||
#define _V_RANDOM_H_
|
||||
#include "ivorbiscodec.h"
|
||||
#include "os.h"
|
||||
#include "os_types.h"
|
||||
|
||||
#ifdef _LOW_ACCURACY_
|
||||
# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
|
||||
# define LOOKUP_T const unsigned char
|
||||
#else
|
||||
# define X(n) (n)
|
||||
# define LOOKUP_T const ogg_int32_t
|
||||
/*#define _VDBG_GRAPHFILE "_0.m"*/
|
||||
|
||||
|
||||
#ifdef _VDBG_GRAPHFILE
|
||||
extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
|
||||
extern void _VDBG_free(void *ptr,char *file,long line);
|
||||
|
||||
#undef _tremor_ogg_malloc
|
||||
#undef _tremor_ogg_calloc
|
||||
#undef _tremor_ogg_realloc
|
||||
#undef _tremor_ogg_free
|
||||
|
||||
#define _tremor_ogg_malloc(x) _VDBG_malloc(NULL,(x),__FILE__,__LINE__)
|
||||
#define _tremor_ogg_calloc(x,y) _VDBG_malloc(NULL,(x)*(y),__FILE__,__LINE__)
|
||||
#define _tremor_ogg_realloc(x,y) _VDBG_malloc((x),(y),__FILE__,__LINE__)
|
||||
#define _tremor_ogg_free(x) _VDBG_free((x),__FILE__,__LINE__)
|
||||
#endif
|
||||
|
||||
#include "asm_arm.h"
|
||||
#include <stdlib.h> /* for abs() */
|
||||
|
||||
#ifndef _V_WIDE_MATH
|
||||
#define _V_WIDE_MATH
|
||||
@@ -37,44 +46,42 @@
|
||||
#ifndef _LOW_ACCURACY_
|
||||
/* 64 bit multiply */
|
||||
|
||||
#if !(defined WIN32 && defined WINCE)
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER==LITTLE_ENDIAN
|
||||
union magic {
|
||||
struct {
|
||||
ogg_int32_t lo;
|
||||
ogg_int32_t hi;
|
||||
tremor_ogg_int32_t lo;
|
||||
tremor_ogg_int32_t hi;
|
||||
} halves;
|
||||
ogg_int64_t whole;
|
||||
tremor_ogg_int64_t whole;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if BYTE_ORDER==BIG_ENDIAN
|
||||
union magic {
|
||||
struct {
|
||||
ogg_int32_t hi;
|
||||
ogg_int32_t lo;
|
||||
tremor_ogg_int32_t hi;
|
||||
tremor_ogg_int32_t lo;
|
||||
} halves;
|
||||
ogg_int64_t whole;
|
||||
tremor_ogg_int64_t whole;
|
||||
};
|
||||
#endif
|
||||
|
||||
STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT32(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
union magic magic;
|
||||
magic.whole = (ogg_int64_t)x * y;
|
||||
magic.whole = (tremor_ogg_int64_t)x * y;
|
||||
return magic.halves.hi;
|
||||
}
|
||||
|
||||
STIN ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT31(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
return MULT32(x,y)<<1;
|
||||
}
|
||||
|
||||
STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT31_SHIFT15(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
union magic magic;
|
||||
magic.whole = (ogg_int64_t)x * y;
|
||||
return ((ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);
|
||||
magic.whole = (tremor_ogg_int64_t)x * y;
|
||||
return ((tremor_ogg_uint32_t)(magic.halves.lo)>>15) | ((magic.halves.hi)<<17);
|
||||
}
|
||||
|
||||
#else
|
||||
@@ -93,15 +100,15 @@ STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
|
||||
* tables in this case.
|
||||
*/
|
||||
|
||||
STIN ogg_int32_t MULT32(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT32(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
return (x >> 9) * y; /* y preshifted >>23 */
|
||||
}
|
||||
|
||||
STIN ogg_int32_t MULT31(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT31(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
return (x >> 8) * y; /* y preshifted >>23 */
|
||||
}
|
||||
|
||||
STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
|
||||
static inline tremor_ogg_int32_t MULT31_SHIFT15(tremor_ogg_int32_t x, tremor_ogg_int32_t y) {
|
||||
return (x >> 6) * y; /* y preshifted >>9 */
|
||||
}
|
||||
|
||||
@@ -138,25 +145,25 @@ STIN ogg_int32_t MULT31_SHIFT15(ogg_int32_t x, ogg_int32_t y) {
|
||||
|
||||
#else
|
||||
|
||||
STIN void XPROD32(ogg_int32_t a, ogg_int32_t b,
|
||||
ogg_int32_t t, ogg_int32_t v,
|
||||
ogg_int32_t *x, ogg_int32_t *y)
|
||||
static inline void XPROD32(tremor_ogg_int32_t a, tremor_ogg_int32_t b,
|
||||
tremor_ogg_int32_t t, tremor_ogg_int32_t v,
|
||||
tremor_ogg_int32_t *x, tremor_ogg_int32_t *y)
|
||||
{
|
||||
*x = MULT32(a, t) + MULT32(b, v);
|
||||
*y = MULT32(b, t) - MULT32(a, v);
|
||||
}
|
||||
|
||||
STIN void XPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
ogg_int32_t t, ogg_int32_t v,
|
||||
ogg_int32_t *x, ogg_int32_t *y)
|
||||
static inline void XPROD31(tremor_ogg_int32_t a, tremor_ogg_int32_t b,
|
||||
tremor_ogg_int32_t t, tremor_ogg_int32_t v,
|
||||
tremor_ogg_int32_t *x, tremor_ogg_int32_t *y)
|
||||
{
|
||||
*x = MULT31(a, t) + MULT31(b, v);
|
||||
*y = MULT31(b, t) - MULT31(a, v);
|
||||
}
|
||||
|
||||
STIN void XNPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
ogg_int32_t t, ogg_int32_t v,
|
||||
ogg_int32_t *x, ogg_int32_t *y)
|
||||
static inline void XNPROD31(tremor_ogg_int32_t a, tremor_ogg_int32_t b,
|
||||
tremor_ogg_int32_t t, tremor_ogg_int32_t v,
|
||||
tremor_ogg_int32_t *x, tremor_ogg_int32_t *y)
|
||||
{
|
||||
*x = MULT31(a, t) - MULT31(b, v);
|
||||
*y = MULT31(b, t) + MULT31(a, v);
|
||||
@@ -169,7 +176,7 @@ STIN void XNPROD31(ogg_int32_t a, ogg_int32_t b,
|
||||
#ifndef _V_CLIP_MATH
|
||||
#define _V_CLIP_MATH
|
||||
|
||||
STIN ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
|
||||
static inline tremor_ogg_int32_t CLIP_TO_15(tremor_ogg_int32_t x) {
|
||||
int ret=x;
|
||||
ret-= ((x<=32767)-1)&(x-32767);
|
||||
ret-= ((x>=-32768)-1)&(x+32768);
|
||||
@@ -178,73 +185,6 @@ STIN ogg_int32_t CLIP_TO_15(ogg_int32_t x) {
|
||||
|
||||
#endif
|
||||
|
||||
STIN ogg_int32_t VFLOAT_MULT(ogg_int32_t a,ogg_int32_t ap,
|
||||
ogg_int32_t b,ogg_int32_t bp,
|
||||
ogg_int32_t *p){
|
||||
if(a && b){
|
||||
#ifndef _LOW_ACCURACY_
|
||||
*p=ap+bp+32;
|
||||
return MULT32(a,b);
|
||||
#else
|
||||
*p=ap+bp+31;
|
||||
return (a>>15)*(b>>16);
|
||||
#endif
|
||||
}else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int _ilog(unsigned int);
|
||||
|
||||
STIN ogg_int32_t VFLOAT_MULTI(ogg_int32_t a,ogg_int32_t ap,
|
||||
ogg_int32_t i,
|
||||
ogg_int32_t *p){
|
||||
|
||||
int ip=_ilog(abs(i))-31;
|
||||
return VFLOAT_MULT(a,ap,i<<-ip,ip,p);
|
||||
}
|
||||
|
||||
STIN ogg_int32_t VFLOAT_ADD(ogg_int32_t a,ogg_int32_t ap,
|
||||
ogg_int32_t b,ogg_int32_t bp,
|
||||
ogg_int32_t *p){
|
||||
|
||||
if(!a){
|
||||
*p=bp;
|
||||
return b;
|
||||
}else if(!b){
|
||||
*p=ap;
|
||||
return a;
|
||||
}
|
||||
|
||||
/* yes, this can leak a bit. */
|
||||
if(ap>bp){
|
||||
int shift=ap-bp+1;
|
||||
*p=ap+1;
|
||||
a>>=1;
|
||||
if(shift<32){
|
||||
b=(b+(1<<(shift-1)))>>shift;
|
||||
}else{
|
||||
b=0;
|
||||
}
|
||||
}else{
|
||||
int shift=bp-ap+1;
|
||||
*p=bp+1;
|
||||
b>>=1;
|
||||
if(shift<32){
|
||||
a=(a+(1<<(shift-1)))>>shift;
|
||||
}else{
|
||||
a=0;
|
||||
}
|
||||
}
|
||||
|
||||
a+=b;
|
||||
if((a&0xc0000000)==0xc0000000 ||
|
||||
(a&0xc0000000)==0){
|
||||
a<<=1;
|
||||
(*p)--;
|
||||
}
|
||||
return(a);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
+3
-5
@@ -2,13 +2,13 @@
|
||||
#define _OS_H
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,7 +18,7 @@
|
||||
********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <ogg/os_types.h>
|
||||
#include "os_types.h"
|
||||
|
||||
#ifndef _V_IFDEFJAIL_H_
|
||||
# define _V_IFDEFJAIL_H_
|
||||
@@ -41,8 +41,6 @@
|
||||
# define rint(x) (floor((x)+0.5f))
|
||||
# define NO_FLOAT_MATH_LIB
|
||||
# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
|
||||
# define LITTLE_ENDIAN 1
|
||||
# define BYTE_ORDER LITTLE_ENDIAN
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ALLOCA_H
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: #ifdef jail to whip a few platforms into the UNIX ideal.
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _TREMOR_OS_TYPES_H
|
||||
#define _TREMOR_OS_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#ifdef _LOW_ACCURACY_
|
||||
# define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
|
||||
# define LOOKUP_T const unsigned char
|
||||
#else
|
||||
# define X(n) (n)
|
||||
# define LOOKUP_T const tremor_ogg_int32_t
|
||||
#endif
|
||||
|
||||
/* make it easy on the folks that want to compile the libs with a
|
||||
different malloc than stdlib */
|
||||
#define _tremor_ogg_malloc malloc
|
||||
#define _tremor_ogg_calloc calloc
|
||||
#define _tremor_ogg_realloc realloc
|
||||
#define _tremor_ogg_free free
|
||||
|
||||
typedef int64_t tremor_ogg_int64_t;
|
||||
typedef int32_t tremor_ogg_int32_t;
|
||||
typedef uint32_t tremor_ogg_uint32_t;
|
||||
typedef int16_t tremor_ogg_int16_t;
|
||||
typedef uint16_t tremor_ogg_uint16_t;
|
||||
|
||||
#endif /* _TREMOR_OS_TYPES_H */
|
||||
@@ -1,50 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: registry for floor, res backends and channel mappings
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "registry.h"
|
||||
#include "misc.h"
|
||||
|
||||
|
||||
/* seems like major overkill now; the backend numbers will grow into
|
||||
the infrastructure soon enough */
|
||||
|
||||
extern vorbis_func_floor floor0_exportbundle;
|
||||
extern vorbis_func_floor floor1_exportbundle;
|
||||
extern vorbis_func_residue residue0_exportbundle;
|
||||
extern vorbis_func_residue residue1_exportbundle;
|
||||
extern vorbis_func_residue residue2_exportbundle;
|
||||
extern vorbis_func_mapping mapping0_exportbundle;
|
||||
|
||||
vorbis_func_floor *_floor_P[]={
|
||||
&floor0_exportbundle,
|
||||
&floor1_exportbundle,
|
||||
};
|
||||
|
||||
vorbis_func_residue *_residue_P[]={
|
||||
&residue0_exportbundle,
|
||||
&residue1_exportbundle,
|
||||
&residue2_exportbundle,
|
||||
};
|
||||
|
||||
vorbis_func_mapping *_mapping_P[]={
|
||||
&mapping0_exportbundle,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: registry for time, floor, res backends and channel mappings
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _V_REG_H_
|
||||
#define _V_REG_H_
|
||||
|
||||
#define VI_TRANSFORMB 1
|
||||
#define VI_WINDOWB 1
|
||||
#define VI_TIMEB 1
|
||||
#define VI_FLOORB 2
|
||||
#define VI_RESB 3
|
||||
#define VI_MAPB 1
|
||||
|
||||
#include "backends.h"
|
||||
|
||||
#if defined(_WIN32) && defined(VORBISDLL_IMPORT)
|
||||
# define EXTERN __declspec(dllimport) extern
|
||||
#else
|
||||
# define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN vorbis_func_floor *_floor_P[];
|
||||
EXTERN vorbis_func_residue *_residue_P[];
|
||||
EXTERN vorbis_func_mapping *_mapping_P[];
|
||||
|
||||
#endif
|
||||
+162
-311
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -18,357 +18,208 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "tremor_ogg.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "registry.h"
|
||||
#include "codebook.h"
|
||||
#include "misc.h"
|
||||
#include "os.h"
|
||||
#include "block.h"
|
||||
|
||||
typedef struct {
|
||||
vorbis_info_residue0 *info;
|
||||
int map;
|
||||
|
||||
int parts;
|
||||
int stages;
|
||||
codebook *fullbooks;
|
||||
codebook *phrasebook;
|
||||
codebook ***partbooks;
|
||||
|
||||
int partvals;
|
||||
int **decodemap;
|
||||
|
||||
} vorbis_look_residue0;
|
||||
|
||||
void res0_free_info(vorbis_info_residue *i){
|
||||
vorbis_info_residue0 *info=(vorbis_info_residue0 *)i;
|
||||
void res_clear_info(vorbis_info_residue *info){
|
||||
if(info){
|
||||
if(info->stagemasks)_tremor_ogg_free(info->stagemasks);
|
||||
if(info->stagebooks)_tremor_ogg_free(info->stagebooks);
|
||||
memset(info,0,sizeof(*info));
|
||||
_ogg_free(info);
|
||||
}
|
||||
}
|
||||
|
||||
void res0_free_look(vorbis_look_residue *i){
|
||||
int j;
|
||||
if(i){
|
||||
|
||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)i;
|
||||
|
||||
for(j=0;j<look->parts;j++)
|
||||
if(look->partbooks[j])_ogg_free(look->partbooks[j]);
|
||||
_ogg_free(look->partbooks);
|
||||
for(j=0;j<look->partvals;j++)
|
||||
_ogg_free(look->decodemap[j]);
|
||||
_ogg_free(look->decodemap);
|
||||
|
||||
memset(look,0,sizeof(*look));
|
||||
_ogg_free(look);
|
||||
}
|
||||
}
|
||||
|
||||
static int ilog(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
static int icount(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret+=v&1;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* vorbis_info is for range checking */
|
||||
vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
|
||||
int j,acc=0;
|
||||
vorbis_info_residue0 *info=(vorbis_info_residue0 *)_ogg_calloc(1,sizeof(*info));
|
||||
int res_unpack(vorbis_info_residue *info,
|
||||
vorbis_info *vi,tremor_oggpack_buffer *opb){
|
||||
int j,k;
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
memset(info,0,sizeof(*info));
|
||||
|
||||
info->begin=oggpack_read(opb,24);
|
||||
info->end=oggpack_read(opb,24);
|
||||
info->grouping=oggpack_read(opb,24)+1;
|
||||
info->partitions=oggpack_read(opb,6)+1;
|
||||
info->groupbook=oggpack_read(opb,8);
|
||||
info->type=tremor_oggpack_read(opb,16);
|
||||
if(info->type>2 || info->type<0)goto errout;
|
||||
info->begin=tremor_oggpack_read(opb,24);
|
||||
info->end=tremor_oggpack_read(opb,24);
|
||||
info->grouping=tremor_oggpack_read(opb,24)+1;
|
||||
info->partitions=tremor_oggpack_read(opb,6)+1;
|
||||
info->groupbook=tremor_oggpack_read(opb,8);
|
||||
if(info->groupbook>=ci->books)goto errout;
|
||||
|
||||
/* check for premature EOP */
|
||||
if(info->groupbook<0)goto errout;
|
||||
info->stagemasks=_tremor_ogg_malloc(info->partitions*sizeof(*info->stagemasks));
|
||||
info->stagebooks=_tremor_ogg_malloc(info->partitions*8*sizeof(*info->stagebooks));
|
||||
|
||||
for(j=0;j<info->partitions;j++){
|
||||
int cascade=oggpack_read(opb,3);
|
||||
int cflag=oggpack_read(opb,1);
|
||||
if(cflag<0) goto errout;
|
||||
if(cflag){
|
||||
int c=oggpack_read(opb,5);
|
||||
if(c<0) goto errout;
|
||||
cascade|=(c<<3);
|
||||
int cascade=tremor_oggpack_read(opb,3);
|
||||
if(tremor_oggpack_read(opb,1))
|
||||
cascade|=(tremor_oggpack_read(opb,5)<<3);
|
||||
info->stagemasks[j]=cascade;
|
||||
}
|
||||
|
||||
for(j=0;j<info->partitions;j++){
|
||||
for(k=0;k<8;k++){
|
||||
if((info->stagemasks[j]>>k)&1){
|
||||
unsigned char book=tremor_oggpack_read(opb,8);
|
||||
if(book>=ci->books)goto errout;
|
||||
info->stagebooks[j*8+k]=book;
|
||||
if(k+1>info->stages)info->stages=k+1;
|
||||
}else
|
||||
info->stagebooks[j*8+k]=0xff;
|
||||
}
|
||||
info->secondstages[j]=cascade;
|
||||
|
||||
acc+=icount(cascade);
|
||||
}
|
||||
for(j=0;j<acc;j++){
|
||||
int book=oggpack_read(opb,8);
|
||||
if(book<0) goto errout;
|
||||
info->booklist[j]=book;
|
||||
}
|
||||
|
||||
if(info->groupbook>=ci->books)goto errout;
|
||||
for(j=0;j<acc;j++){
|
||||
if(info->booklist[j]>=ci->books)goto errout;
|
||||
if(ci->book_param[info->booklist[j]]->maptype==0)goto errout;
|
||||
}
|
||||
if(tremor_oggpack_eop(opb))goto errout;
|
||||
|
||||
/* verify the phrasebook is not specifying an impossible or
|
||||
inconsistent partitioning scheme. */
|
||||
/* modify the phrasebook ranging check from r16327; an early beta
|
||||
encoder had a bug where it used an oversized phrasebook by
|
||||
accident. These files should continue to be playable, but don't
|
||||
allow an exploit */
|
||||
{
|
||||
int entries = ci->book_param[info->groupbook]->entries;
|
||||
int dim = ci->book_param[info->groupbook]->dim;
|
||||
int partvals = 1;
|
||||
if (dim<1) goto errout;
|
||||
while(dim>0){
|
||||
partvals *= info->partitions;
|
||||
if(partvals > entries) goto errout;
|
||||
dim--;
|
||||
}
|
||||
info->partvals = partvals;
|
||||
}
|
||||
|
||||
return(info);
|
||||
return 0;
|
||||
errout:
|
||||
res0_free_info(info);
|
||||
return(NULL);
|
||||
res_clear_info(info);
|
||||
return 1;
|
||||
}
|
||||
|
||||
vorbis_look_residue *res0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
|
||||
vorbis_info_residue *vr){
|
||||
vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
|
||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)_ogg_calloc(1,sizeof(*look));
|
||||
int res_inverse(vorbis_dsp_state *vd,vorbis_info_residue *info,
|
||||
tremor_ogg_int32_t **in,int *nonzero,int ch){
|
||||
|
||||
int i,j,k,s,used=0;
|
||||
codec_setup_info *ci=(codec_setup_info *)vd->vi->codec_setup;
|
||||
|
||||
int j,k,acc=0;
|
||||
int dim;
|
||||
int maxstage=0;
|
||||
look->info=info;
|
||||
look->map=vm->mapping;
|
||||
|
||||
look->parts=info->partitions;
|
||||
look->fullbooks=ci->fullbooks;
|
||||
look->phrasebook=ci->fullbooks+info->groupbook;
|
||||
dim=look->phrasebook->dim;
|
||||
|
||||
look->partbooks=(codebook ***)_ogg_calloc(look->parts,sizeof(*look->partbooks));
|
||||
|
||||
for(j=0;j<look->parts;j++){
|
||||
int stages=ilog(info->secondstages[j]);
|
||||
if(stages){
|
||||
if(stages>maxstage)maxstage=stages;
|
||||
look->partbooks[j]=(codebook **)_ogg_calloc(stages,sizeof(*look->partbooks[j]));
|
||||
for(k=0;k<stages;k++)
|
||||
if(info->secondstages[j]&(1<<k)){
|
||||
look->partbooks[j][k]=ci->fullbooks+info->booklist[acc++];
|
||||
#ifdef TRAIN_RES
|
||||
look->training_data[k][j]=calloc(look->partbooks[j][k]->entries,
|
||||
sizeof(***look->training_data));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
look->partvals=look->parts;
|
||||
for(j=1;j<dim;j++)look->partvals*=look->parts;
|
||||
look->stages=maxstage;
|
||||
look->decodemap=(int **)_ogg_malloc(look->partvals*sizeof(*look->decodemap));
|
||||
for(j=0;j<look->partvals;j++){
|
||||
long val=j;
|
||||
long mult=look->partvals/look->parts;
|
||||
look->decodemap[j]=(int *)_ogg_malloc(dim*sizeof(*look->decodemap[j]));
|
||||
for(k=0;k<dim;k++){
|
||||
long deco=val/mult;
|
||||
val-=deco*mult;
|
||||
mult/=look->parts;
|
||||
look->decodemap[j][k]=deco;
|
||||
}
|
||||
}
|
||||
|
||||
return(look);
|
||||
}
|
||||
|
||||
|
||||
/* a truncated packet here just means 'stop working'; it's not an error */
|
||||
static int _01inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||
ogg_int32_t **in,int ch,
|
||||
long (*decodepart)(codebook *, ogg_int32_t *,
|
||||
oggpack_buffer *,int,int)){
|
||||
|
||||
long i,j,k,l,s;
|
||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||
vorbis_info_residue0 *info=look->info;
|
||||
|
||||
/* move all this setup out later */
|
||||
codebook *phrasebook=ci->book_param+info->groupbook;
|
||||
int samples_per_partition=info->grouping;
|
||||
int partitions_per_word=look->phrasebook->dim;
|
||||
int max=vb->pcmend>>1;
|
||||
int end=(info->end<max?info->end:max);
|
||||
int n=end-info->begin;
|
||||
int partitions_per_word=phrasebook->dim;
|
||||
int pcmend=ci->blocksizes[vd->W];
|
||||
|
||||
if(n>0){
|
||||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
int ***partword=(int ***)alloca(ch*sizeof(*partword));
|
||||
if(info->type<2){
|
||||
int max=pcmend>>1;
|
||||
int end=(info->end<max?info->end:max);
|
||||
int n=end-info->begin;
|
||||
|
||||
for(j=0;j<ch;j++)
|
||||
partword[j]=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword[j]));
|
||||
|
||||
for(s=0;s<look->stages;s++){
|
||||
if(n>0){
|
||||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
|
||||
/* each loop decodes on partition codeword containing
|
||||
partitions_pre_word partitions */
|
||||
for(i=0,l=0;i<partvals;l++){
|
||||
if(s==0){
|
||||
/* fetch the partition word for each channel */
|
||||
for(j=0;j<ch;j++){
|
||||
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
||||
if(temp==-1 || temp>=info->partvals)goto eopbreak;
|
||||
partword[j][l]=look->decodemap[temp];
|
||||
if(partword[j][l]==NULL)goto errout;
|
||||
}
|
||||
}
|
||||
for(i=0;i<ch;i++)
|
||||
if(nonzero[i])
|
||||
in[used++]=in[i];
|
||||
ch=used;
|
||||
|
||||
if(used){
|
||||
|
||||
/* now we decode residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||
for(j=0;j<ch;j++){
|
||||
long offset=info->begin+i*samples_per_partition;
|
||||
if(info->secondstages[partword[j][l][k]]&(1<<s)){
|
||||
codebook *stagebook=look->partbooks[partword[j][l][k]][s];
|
||||
if(stagebook){
|
||||
if(decodepart(stagebook,in[j]+offset,&vb->opb,
|
||||
samples_per_partition,-8)==-1)goto eopbreak;
|
||||
char **partword=(char **)alloca(ch*sizeof(*partword));
|
||||
for(j=0;j<ch;j++)
|
||||
partword[j]=(char *)alloca(partwords*partitions_per_word*
|
||||
sizeof(*partword[j]));
|
||||
|
||||
for(s=0;s<info->stages;s++){
|
||||
|
||||
for(i=0;i<partvals;){
|
||||
if(s==0){
|
||||
/* fetch the partition word for each channel */
|
||||
|
||||
partword[0][i+partitions_per_word-1]=1;
|
||||
for(k=partitions_per_word-2;k>=0;k--)
|
||||
partword[0][i+k]=partword[0][i+k+1]*info->partitions;
|
||||
|
||||
for(j=1;j<ch;j++)
|
||||
for(k=partitions_per_word-1;k>=0;k--)
|
||||
partword[j][i+k]=partword[j-1][i+k];
|
||||
|
||||
for(j=0;j<ch;j++){
|
||||
int temp=vorbis_book_decode(phrasebook,&vd->opb);
|
||||
if(temp==-1)goto eopbreak;
|
||||
|
||||
/* this can be done quickly in assembly due to the quotient
|
||||
always being at most six bits */
|
||||
for(k=0;k<partitions_per_word;k++){
|
||||
tremor_ogg_uint32_t div=partword[j][i+k];
|
||||
partword[j][i+k]=temp/div;
|
||||
temp-=partword[j][i+k]*div;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
errout:
|
||||
eopbreak:
|
||||
return(0);
|
||||
}
|
||||
|
||||
int res0_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||
ogg_int32_t **in,int *nonzero,int ch){
|
||||
int i,used=0;
|
||||
for(i=0;i<ch;i++)
|
||||
if(nonzero[i])
|
||||
in[used++]=in[i];
|
||||
if(used)
|
||||
return(_01inverse(vb,vl,in,used,vorbis_book_decodevs_add));
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
int res1_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||
ogg_int32_t **in,int *nonzero,int ch){
|
||||
int i,used=0;
|
||||
for(i=0;i<ch;i++)
|
||||
if(nonzero[i])
|
||||
in[used++]=in[i];
|
||||
if(used)
|
||||
return(_01inverse(vb,vl,in,used,vorbis_book_decodev_add));
|
||||
else
|
||||
return(0);
|
||||
}
|
||||
|
||||
/* duplicate code here as speed is somewhat more important */
|
||||
int res2_inverse(vorbis_block *vb,vorbis_look_residue *vl,
|
||||
ogg_int32_t **in,int *nonzero,int ch){
|
||||
long i,k,l,s;
|
||||
vorbis_look_residue0 *look=(vorbis_look_residue0 *)vl;
|
||||
vorbis_info_residue0 *info=look->info;
|
||||
|
||||
/* move all this setup out later */
|
||||
int samples_per_partition=info->grouping;
|
||||
int partitions_per_word=look->phrasebook->dim;
|
||||
int max=(vb->pcmend*ch)>>1;
|
||||
int end=(info->end<max?info->end:max);
|
||||
int n=end-info->begin;
|
||||
|
||||
if(n>0){
|
||||
|
||||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
int **partword=(int **)_vorbis_block_alloc(vb,partwords*sizeof(*partword));
|
||||
int beginoff=info->begin/ch;
|
||||
|
||||
for(i=0;i<ch;i++)if(nonzero[i])break;
|
||||
if(i==ch)return(0); /* no nonzero vectors */
|
||||
|
||||
samples_per_partition/=ch;
|
||||
|
||||
for(s=0;s<look->stages;s++){
|
||||
for(i=0,l=0;i<partvals;l++){
|
||||
|
||||
if(s==0){
|
||||
/* fetch the partition word */
|
||||
int temp=vorbis_book_decode(look->phrasebook,&vb->opb);
|
||||
if(temp==-1 || temp>=info->partvals)goto eopbreak;
|
||||
partword[l]=look->decodemap[temp];
|
||||
if(partword[l]==NULL)goto errout;
|
||||
}
|
||||
|
||||
/* now we decode residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||
if(info->secondstages[partword[l][k]]&(1<<s)){
|
||||
codebook *stagebook=look->partbooks[partword[l][k]][s];
|
||||
|
||||
if(stagebook){
|
||||
/* now we decode residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||
for(j=0;j<ch;j++){
|
||||
long offset=info->begin+i*samples_per_partition;
|
||||
if(info->stagemasks[(int)partword[j][i]]&(1<<s)){
|
||||
codebook *stagebook=ci->book_param+
|
||||
info->stagebooks[(partword[j][i]<<3)+s];
|
||||
if(info->type){
|
||||
if(vorbis_book_decodev_add(stagebook,in[j]+offset,&vd->opb,
|
||||
samples_per_partition,-8)==-1)
|
||||
goto eopbreak;
|
||||
}else{
|
||||
if(vorbis_book_decodevs_add(stagebook,in[j]+offset,&vd->opb,
|
||||
samples_per_partition,-8)==-1)
|
||||
goto eopbreak;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
int max=(pcmend*ch)>>1;
|
||||
int end=(info->end<max?info->end:max);
|
||||
int n=end-info->begin;
|
||||
|
||||
if(n>0){
|
||||
int partvals=n/samples_per_partition;
|
||||
int partwords=(partvals+partitions_per_word-1)/partitions_per_word;
|
||||
|
||||
char *partword=
|
||||
(char *)alloca(partwords*partitions_per_word*sizeof(*partword));
|
||||
int beginoff=info->begin/ch;
|
||||
|
||||
for(i=0;i<ch;i++)if(nonzero[i])break;
|
||||
if(i==ch)return(0); /* no nonzero vectors */
|
||||
|
||||
samples_per_partition/=ch;
|
||||
|
||||
for(s=0;s<info->stages;s++){
|
||||
for(i=0;i<partvals;){
|
||||
|
||||
if(s==0){
|
||||
int temp;
|
||||
partword[i+partitions_per_word-1]=1;
|
||||
for(k=partitions_per_word-2;k>=0;k--)
|
||||
partword[i+k]=partword[i+k+1]*info->partitions;
|
||||
|
||||
/* fetch the partition word */
|
||||
temp=vorbis_book_decode(phrasebook,&vd->opb);
|
||||
if(temp==-1)goto eopbreak;
|
||||
|
||||
/* this can be done quickly in assembly due to the quotient
|
||||
always being at most six bits */
|
||||
for(k=0;k<partitions_per_word;k++){
|
||||
tremor_ogg_uint32_t div=partword[i+k];
|
||||
partword[i+k]=temp/div;
|
||||
temp-=partword[i+k]*div;
|
||||
}
|
||||
}
|
||||
|
||||
/* now we decode residual values for the partitions */
|
||||
for(k=0;k<partitions_per_word && i<partvals;k++,i++)
|
||||
if(info->stagemasks[(int)partword[i]]&(1<<s)){
|
||||
codebook *stagebook=ci->book_param+
|
||||
info->stagebooks[(partword[i]<<3)+s];
|
||||
if(vorbis_book_decodevv_add(stagebook,in,
|
||||
i*samples_per_partition+beginoff,ch,
|
||||
&vb->opb,
|
||||
&vd->opb,
|
||||
samples_per_partition,-8)==-1)
|
||||
goto eopbreak;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
errout:
|
||||
eopbreak:
|
||||
return(0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
vorbis_func_residue residue0_exportbundle={
|
||||
&res0_unpack,
|
||||
&res0_look,
|
||||
&res0_free_info,
|
||||
&res0_free_look,
|
||||
&res0_inverse
|
||||
};
|
||||
|
||||
vorbis_func_residue residue1_exportbundle={
|
||||
&res0_unpack,
|
||||
&res0_look,
|
||||
&res0_free_info,
|
||||
&res0_free_look,
|
||||
&res1_inverse
|
||||
};
|
||||
|
||||
vorbis_func_residue residue2_exportbundle={
|
||||
&res0_unpack,
|
||||
&res0_look,
|
||||
&res0_free_info,
|
||||
&res0_free_look,
|
||||
&res2_inverse
|
||||
};
|
||||
|
||||
@@ -1,447 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: basic shared codebook operations
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "misc.h"
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codebook.h"
|
||||
|
||||
/**** pack/unpack helpers ******************************************/
|
||||
int _ilog(unsigned int v){
|
||||
int ret=0;
|
||||
while(v){
|
||||
ret++;
|
||||
v>>=1;
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
/* 32 bit float (not IEEE; nonnormalized mantissa +
|
||||
biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
|
||||
Why not IEEE? It's just not that important here. */
|
||||
|
||||
#define VQ_FEXP 10
|
||||
#define VQ_FMAN 21
|
||||
#define VQ_FEXP_BIAS 768 /* bias toward values smaller than 1. */
|
||||
|
||||
static ogg_int32_t _float32_unpack(long val,int *point){
|
||||
long mant=val&0x1fffff;
|
||||
int sign=val&0x80000000;
|
||||
long exp =(val&0x7fe00000L)>>VQ_FMAN;
|
||||
|
||||
exp-=(VQ_FMAN-1)+VQ_FEXP_BIAS;
|
||||
|
||||
if(mant){
|
||||
while(!(mant&0x40000000)){
|
||||
mant<<=1;
|
||||
exp-=1;
|
||||
}
|
||||
|
||||
if(sign)mant= -mant;
|
||||
}else{
|
||||
sign=0;
|
||||
exp=-9999;
|
||||
}
|
||||
|
||||
*point=exp;
|
||||
return mant;
|
||||
}
|
||||
|
||||
/* given a list of word lengths, generate a list of codewords. Works
|
||||
for length ordered or unordered, always assigns the lowest valued
|
||||
codewords first. Extended to handle unused entries (length 0) */
|
||||
ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
|
||||
long i,j,count=0;
|
||||
ogg_uint32_t marker[33];
|
||||
ogg_uint32_t *r=(ogg_uint32_t *)_ogg_malloc((sparsecount?sparsecount:n)*sizeof(*r));
|
||||
memset(marker,0,sizeof(marker));
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
long length=l[i];
|
||||
if(length>0){
|
||||
ogg_uint32_t entry=marker[length];
|
||||
|
||||
/* when we claim a node for an entry, we also claim the nodes
|
||||
below it (pruning off the imagined tree that may have dangled
|
||||
from it) as well as blocking the use of any nodes directly
|
||||
above for leaves */
|
||||
|
||||
/* update ourself */
|
||||
if(length<32 && (entry>>length)){
|
||||
/* error condition; the lengths must specify an overpopulated tree */
|
||||
_ogg_free(r);
|
||||
return(NULL);
|
||||
}
|
||||
r[count++]=entry;
|
||||
|
||||
/* Look to see if the next shorter marker points to the node
|
||||
above. if so, update it and repeat. */
|
||||
{
|
||||
for(j=length;j>0;j--){
|
||||
|
||||
if(marker[j]&1){
|
||||
/* have to jump branches */
|
||||
if(j==1)
|
||||
marker[1]++;
|
||||
else
|
||||
marker[j]=marker[j-1]<<1;
|
||||
break; /* invariant says next upper marker would already
|
||||
have been moved if it was on the same path */
|
||||
}
|
||||
marker[j]++;
|
||||
}
|
||||
}
|
||||
|
||||
/* prune the tree; the implicit invariant says all the longer
|
||||
markers were dangling from our just-taken node. Dangle them
|
||||
from our *new* node. */
|
||||
for(j=length+1;j<33;j++)
|
||||
if((marker[j]>>1) == entry){
|
||||
entry=marker[j];
|
||||
marker[j]=marker[j-1]<<1;
|
||||
}else
|
||||
break;
|
||||
}else
|
||||
if(sparsecount==0)count++;
|
||||
}
|
||||
|
||||
/* sanity check the huffman tree; an underpopulated tree must be
|
||||
rejected. The only exception is the one-node pseudo-nil tree,
|
||||
which appears to be underpopulated because the tree doesn't
|
||||
really exist; there's only one possible 'codeword' or zero bits,
|
||||
but the above tree-gen code doesn't mark that. */
|
||||
if(sparsecount != 1){
|
||||
for(i=1;i<33;i++)
|
||||
if(marker[i] & (0xffffffffUL>>(32-i))){
|
||||
_ogg_free(r);
|
||||
return(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/* bitreverse the words because our bitwise packer/unpacker is LSb
|
||||
endian */
|
||||
for(i=0,count=0;i<n;i++){
|
||||
ogg_uint32_t temp=0;
|
||||
for(j=0;j<l[i];j++){
|
||||
temp<<=1;
|
||||
temp|=(r[count]>>j)&1;
|
||||
}
|
||||
|
||||
if(sparsecount){
|
||||
if(l[i])
|
||||
r[count++]=temp;
|
||||
}else
|
||||
r[count++]=temp;
|
||||
}
|
||||
|
||||
return(r);
|
||||
}
|
||||
|
||||
/* there might be a straightforward one-line way to do the below
|
||||
that's portable and totally safe against roundoff, but I haven't
|
||||
thought of it. Therefore, we opt on the side of caution */
|
||||
long _book_maptype1_quantvals(const static_codebook *b){
|
||||
/* get us a starting hint, we'll polish it below */
|
||||
int bits=_ilog(b->entries);
|
||||
int vals=b->entries>>((bits-1)*(b->dim-1)/b->dim);
|
||||
|
||||
while(1){
|
||||
long acc=1;
|
||||
long acc1=1;
|
||||
int i;
|
||||
for(i=0;i<b->dim;i++){
|
||||
acc*=vals;
|
||||
acc1*=vals+1;
|
||||
}
|
||||
if(acc<=b->entries && acc1>b->entries){
|
||||
return(vals);
|
||||
}else{
|
||||
if(acc>b->entries){
|
||||
vals--;
|
||||
}else{
|
||||
vals++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* different than what _book_unquantize does for mainline:
|
||||
we repack the book in a fixed point format that shares the same
|
||||
binary point. Upon first use, we can shift point if needed */
|
||||
|
||||
/* we need to deal with two map types: in map type 1, the values are
|
||||
generated algorithmically (each column of the vector counts through
|
||||
the values in the quant vector). in map type 2, all the values came
|
||||
in in an explicit list. Both value lists must be unpacked */
|
||||
|
||||
ogg_int32_t *_book_unquantize(const static_codebook *b,int n,int *sparsemap,
|
||||
int *maxpoint){
|
||||
long j,k,count=0;
|
||||
if(b->maptype==1 || b->maptype==2){
|
||||
int quantvals;
|
||||
int minpoint,delpoint;
|
||||
ogg_int32_t mindel=_float32_unpack(b->q_min,&minpoint);
|
||||
ogg_int32_t delta=_float32_unpack(b->q_delta,&delpoint);
|
||||
ogg_int32_t *r=(ogg_int32_t *)_ogg_calloc(n*b->dim,sizeof(*r));
|
||||
int *rp=(int *)_ogg_calloc(n*b->dim,sizeof(*rp));
|
||||
|
||||
*maxpoint=minpoint;
|
||||
|
||||
/* maptype 1 and 2 both use a quantized value vector, but
|
||||
different sizes */
|
||||
switch(b->maptype){
|
||||
case 1:
|
||||
/* most of the time, entries%dimensions == 0, but we need to be
|
||||
well defined. We define that the possible vales at each
|
||||
scalar is values == entries/dim. If entries%dim != 0, we'll
|
||||
have 'too few' values (values*dim<entries), which means that
|
||||
we'll have 'left over' entries; left over entries use zeroed
|
||||
values (and are wasted). So don't generate codebooks like
|
||||
that */
|
||||
quantvals=_book_maptype1_quantvals(b);
|
||||
for(j=0;j<b->entries;j++){
|
||||
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
||||
ogg_int32_t last=0;
|
||||
int lastpoint=0;
|
||||
int indexdiv=1;
|
||||
for(k=0;k<b->dim;k++){
|
||||
int index= (j/indexdiv)%quantvals;
|
||||
int point=0;
|
||||
int val=VFLOAT_MULTI(delta,delpoint,
|
||||
abs(b->quantlist[index]),&point);
|
||||
|
||||
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
|
||||
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
|
||||
|
||||
if(b->q_sequencep){
|
||||
last=val;
|
||||
lastpoint=point;
|
||||
}
|
||||
|
||||
if(sparsemap){
|
||||
r[sparsemap[count]*b->dim+k]=val;
|
||||
rp[sparsemap[count]*b->dim+k]=point;
|
||||
}else{
|
||||
r[count*b->dim+k]=val;
|
||||
rp[count*b->dim+k]=point;
|
||||
}
|
||||
if(*maxpoint<point)*maxpoint=point;
|
||||
indexdiv*=quantvals;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for(j=0;j<b->entries;j++){
|
||||
if((sparsemap && b->lengthlist[j]) || !sparsemap){
|
||||
ogg_int32_t last=0;
|
||||
int lastpoint=0;
|
||||
|
||||
for(k=0;k<b->dim;k++){
|
||||
int point=0;
|
||||
int val=VFLOAT_MULTI(delta,delpoint,
|
||||
abs(b->quantlist[j*b->dim+k]),&point);
|
||||
|
||||
val=VFLOAT_ADD(mindel,minpoint,val,point,&point);
|
||||
val=VFLOAT_ADD(last,lastpoint,val,point,&point);
|
||||
|
||||
if(b->q_sequencep){
|
||||
last=val;
|
||||
lastpoint=point;
|
||||
}
|
||||
|
||||
if(sparsemap){
|
||||
r[sparsemap[count]*b->dim+k]=val;
|
||||
rp[sparsemap[count]*b->dim+k]=point;
|
||||
}else{
|
||||
r[count*b->dim+k]=val;
|
||||
rp[count*b->dim+k]=point;
|
||||
}
|
||||
if(*maxpoint<point)*maxpoint=point;
|
||||
}
|
||||
count++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for(j=0;j<n*b->dim;j++)
|
||||
if(rp[j]<*maxpoint)
|
||||
r[j]>>=*maxpoint-rp[j];
|
||||
|
||||
_ogg_free(rp);
|
||||
return(r);
|
||||
}
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void vorbis_staticbook_destroy(static_codebook *b){
|
||||
if(b->quantlist)_ogg_free(b->quantlist);
|
||||
if(b->lengthlist)_ogg_free(b->lengthlist);
|
||||
memset(b,0,sizeof(*b));
|
||||
_ogg_free(b);
|
||||
}
|
||||
|
||||
void vorbis_book_clear(codebook *b){
|
||||
/* static book is not cleared; we're likely called on the lookup and
|
||||
the static codebook belongs to the info struct */
|
||||
if(b->valuelist)_ogg_free(b->valuelist);
|
||||
if(b->codelist)_ogg_free(b->codelist);
|
||||
|
||||
if(b->dec_index)_ogg_free(b->dec_index);
|
||||
if(b->dec_codelengths)_ogg_free(b->dec_codelengths);
|
||||
if(b->dec_firsttable)_ogg_free(b->dec_firsttable);
|
||||
|
||||
memset(b,0,sizeof(*b));
|
||||
}
|
||||
|
||||
static ogg_uint32_t bitreverse(ogg_uint32_t x){
|
||||
x= ((x>>16)&0x0000ffffUL) | ((x<<16)&0xffff0000UL);
|
||||
x= ((x>> 8)&0x00ff00ffUL) | ((x<< 8)&0xff00ff00UL);
|
||||
x= ((x>> 4)&0x0f0f0f0fUL) | ((x<< 4)&0xf0f0f0f0UL);
|
||||
x= ((x>> 2)&0x33333333UL) | ((x<< 2)&0xccccccccUL);
|
||||
return((x>> 1)&0x55555555UL) | ((x<< 1)&0xaaaaaaaaUL);
|
||||
}
|
||||
|
||||
static int sort32a(const void *a,const void *b){
|
||||
return (**(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
|
||||
(**(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
|
||||
}
|
||||
|
||||
/* decode codebook arrangement is more heavily optimized than encode */
|
||||
int vorbis_book_init_decode(codebook *c,const static_codebook *s){
|
||||
int i,j,n=0,tabn;
|
||||
int *sortindex;
|
||||
memset(c,0,sizeof(*c));
|
||||
|
||||
/* count actually used entries */
|
||||
for(i=0;i<s->entries;i++)
|
||||
if(s->lengthlist[i]>0)
|
||||
n++;
|
||||
|
||||
c->entries=s->entries;
|
||||
c->used_entries=n;
|
||||
c->dim=s->dim;
|
||||
|
||||
if(n>0){
|
||||
/* two different remappings go on here.
|
||||
|
||||
First, we collapse the likely sparse codebook down only to
|
||||
actually represented values/words. This collapsing needs to be
|
||||
indexed as map-valueless books are used to encode original entry
|
||||
positions as integers.
|
||||
|
||||
Second, we reorder all vectors, including the entry index above,
|
||||
by sorted bitreversed codeword to allow treeless decode. */
|
||||
|
||||
/* perform sort */
|
||||
ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
|
||||
ogg_uint32_t **codep=(ogg_uint32_t **)alloca(sizeof(*codep)*n);
|
||||
|
||||
if(codes==NULL)goto err_out;
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
codes[i]=bitreverse(codes[i]);
|
||||
codep[i]=codes+i;
|
||||
}
|
||||
|
||||
qsort(codep,n,sizeof(*codep),sort32a);
|
||||
|
||||
sortindex=(int *)alloca(n*sizeof(*sortindex));
|
||||
c->codelist=(ogg_uint32_t *)_ogg_malloc(n*sizeof(*c->codelist));
|
||||
/* the index is a reverse index */
|
||||
for(i=0;i<n;i++){
|
||||
int position=codep[i]-codes;
|
||||
sortindex[position]=i;
|
||||
}
|
||||
|
||||
for(i=0;i<n;i++)
|
||||
c->codelist[sortindex[i]]=codes[i];
|
||||
_ogg_free(codes);
|
||||
|
||||
|
||||
|
||||
c->valuelist=_book_unquantize(s,n,sortindex,&c->binarypoint);
|
||||
c->dec_index=(int *)_ogg_malloc(n*sizeof(*c->dec_index));
|
||||
|
||||
for(n=0,i=0;i<s->entries;i++)
|
||||
if(s->lengthlist[i]>0)
|
||||
c->dec_index[sortindex[n++]]=i;
|
||||
|
||||
c->dec_codelengths=(char *)_ogg_malloc(n*sizeof(*c->dec_codelengths));
|
||||
for(n=0,i=0;i<s->entries;i++)
|
||||
if(s->lengthlist[i]>0)
|
||||
c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
|
||||
|
||||
c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
|
||||
if(c->dec_firsttablen<5)c->dec_firsttablen=5;
|
||||
if(c->dec_firsttablen>8)c->dec_firsttablen=8;
|
||||
|
||||
tabn=1<<c->dec_firsttablen;
|
||||
c->dec_firsttable=(ogg_uint32_t *)_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
|
||||
c->dec_maxlength=0;
|
||||
|
||||
for(i=0;i<n;i++){
|
||||
if(c->dec_maxlength<c->dec_codelengths[i])
|
||||
c->dec_maxlength=c->dec_codelengths[i];
|
||||
if(c->dec_codelengths[i]<=c->dec_firsttablen){
|
||||
ogg_uint32_t orig=bitreverse(c->codelist[i]);
|
||||
for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
|
||||
c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
|
||||
}
|
||||
}
|
||||
|
||||
/* now fill in 'unused' entries in the firsttable with hi/lo search
|
||||
hints for the non-direct-hits */
|
||||
{
|
||||
ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
|
||||
long lo=0,hi=0;
|
||||
|
||||
for(i=0;i<tabn;i++){
|
||||
ogg_uint32_t word=i<<(32-c->dec_firsttablen);
|
||||
if(c->dec_firsttable[bitreverse(word)]==0){
|
||||
while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
|
||||
while( hi<n && word>=(c->codelist[hi]&mask))hi++;
|
||||
|
||||
/* we only actually have 15 bits per hint to play with here.
|
||||
In order to overflow gracefully (nothing breaks, efficiency
|
||||
just drops), encode as the difference from the extremes. */
|
||||
{
|
||||
unsigned long loval=lo;
|
||||
unsigned long hival=n-hi;
|
||||
|
||||
if(loval>0x7fff)loval=0x7fff;
|
||||
if(hival>0x7fff)hival=0x7fff;
|
||||
c->dec_firsttable[bitreverse(word)]=
|
||||
0x80000000UL | (loval<<15) | hival;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
err_out:
|
||||
vorbis_book_clear(c);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
@@ -1,131 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: single-block PCM synthesis
|
||||
last mod: $Id: synthesis.c,v 1.4 2003/03/29 03:07:21 xiphmont Exp $
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ogg/ogg.h>
|
||||
#include "ivorbiscodec.h"
|
||||
#include "codec_internal.h"
|
||||
#include "registry.h"
|
||||
#include "misc.h"
|
||||
#include "block.h"
|
||||
|
||||
static int _vorbis_synthesis1(vorbis_block *vb,ogg_packet *op,int decodep){
|
||||
vorbis_dsp_state *vd= vb ? vb->vd : 0;
|
||||
private_state *b= vd ? (private_state *)vd->backend_state: 0;
|
||||
vorbis_info *vi= vd ? vd->vi : 0;
|
||||
codec_setup_info *ci= vi ? (codec_setup_info *)vi->codec_setup : 0;
|
||||
oggpack_buffer *opb=vb ? &vb->opb : 0;
|
||||
int type,mode,i;
|
||||
|
||||
if (!vd || !b || !vi || !ci || !opb) {
|
||||
return OV_EBADPACKET;
|
||||
}
|
||||
|
||||
/* first things first. Make sure decode is ready */
|
||||
_vorbis_block_ripcord(vb);
|
||||
oggpack_readinit(opb,op->packet,op->bytes);
|
||||
|
||||
/* Check the packet type */
|
||||
if(oggpack_read(opb,1)!=0){
|
||||
/* Oops. This is not an audio data packet */
|
||||
return(OV_ENOTAUDIO);
|
||||
}
|
||||
|
||||
/* read our mode and pre/post windowsize */
|
||||
mode=oggpack_read(opb,b->modebits);
|
||||
if(mode==-1)return(OV_EBADPACKET);
|
||||
|
||||
vb->mode=mode;
|
||||
if(!ci->mode_param[mode]){
|
||||
return(OV_EBADPACKET);
|
||||
}
|
||||
|
||||
vb->W=ci->mode_param[mode]->blockflag;
|
||||
if(vb->W){
|
||||
vb->lW=oggpack_read(opb,1);
|
||||
vb->nW=oggpack_read(opb,1);
|
||||
if(vb->nW==-1) return(OV_EBADPACKET);
|
||||
}else{
|
||||
vb->lW=0;
|
||||
vb->nW=0;
|
||||
}
|
||||
|
||||
/* more setup */
|
||||
vb->granulepos=op->granulepos;
|
||||
vb->sequence=op->packetno; /* first block is third packet */
|
||||
vb->eofflag=op->e_o_s;
|
||||
|
||||
if(decodep){
|
||||
/* alloc pcm passback storage */
|
||||
vb->pcmend=ci->blocksizes[vb->W];
|
||||
vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
|
||||
for(i=0;i<vi->channels;i++)
|
||||
vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
|
||||
|
||||
/* unpack_header enforces range checking */
|
||||
type=ci->map_type[ci->mode_param[mode]->mapping];
|
||||
|
||||
return(_mapping_P[type]->inverse(vb,b->mode[mode]));
|
||||
}else{
|
||||
/* no pcm */
|
||||
vb->pcmend=0;
|
||||
vb->pcm=NULL;
|
||||
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
|
||||
return _vorbis_synthesis1(vb,op,1);
|
||||
}
|
||||
|
||||
/* used to track pcm position without actually performing decode.
|
||||
Useful for sequential 'fast forward' */
|
||||
int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
|
||||
return _vorbis_synthesis1(vb,op,0);
|
||||
}
|
||||
|
||||
long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
|
||||
codec_setup_info *ci=(codec_setup_info *)vi->codec_setup;
|
||||
oggpack_buffer opb;
|
||||
int mode;
|
||||
|
||||
oggpack_readinit(&opb,op->packet,op->bytes);
|
||||
|
||||
/* Check the packet type */
|
||||
if(oggpack_read(&opb,1)!=0){
|
||||
/* Oops. This is not an audio data packet */
|
||||
return(OV_ENOTAUDIO);
|
||||
}
|
||||
|
||||
{
|
||||
int modebits=0;
|
||||
int v=ci->modes;
|
||||
while(v>1){
|
||||
modebits++;
|
||||
v>>=1;
|
||||
}
|
||||
|
||||
/* read our mode and pre/post windowsize */
|
||||
mode=oggpack_read(&opb,modebits);
|
||||
}
|
||||
if(mode==-1 || !ci->mode_param[mode])return(OV_EBADPACKET);
|
||||
return(ci->blocksizes[ci->mode_param[mode]->blockflag]);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2003 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: subsumed libogg includes
|
||||
|
||||
********************************************************************/
|
||||
#ifndef _TREMOR_OGG_H
|
||||
#define _TREMOR_OGG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "os_types.h"
|
||||
|
||||
typedef struct tremor_ogg_buffer_state{
|
||||
struct tremor_ogg_buffer *unused_buffers;
|
||||
struct tremor_ogg_reference *unused_references;
|
||||
int outstanding;
|
||||
int shutdown;
|
||||
} tremor_ogg_buffer_state;
|
||||
|
||||
typedef struct tremor_ogg_buffer {
|
||||
unsigned char *data;
|
||||
long size;
|
||||
int refcount;
|
||||
|
||||
union {
|
||||
tremor_ogg_buffer_state *owner;
|
||||
struct tremor_ogg_buffer *next;
|
||||
} ptr;
|
||||
} tremor_ogg_buffer;
|
||||
|
||||
typedef struct tremor_ogg_reference {
|
||||
tremor_ogg_buffer *buffer;
|
||||
long begin;
|
||||
long length;
|
||||
|
||||
struct tremor_ogg_reference *next;
|
||||
} tremor_ogg_reference;
|
||||
|
||||
typedef struct tremor_oggpack_buffer {
|
||||
int headbit;
|
||||
unsigned char *headptr;
|
||||
long headend;
|
||||
|
||||
/* memory management */
|
||||
tremor_ogg_reference *head;
|
||||
tremor_ogg_reference *tail;
|
||||
|
||||
/* render the byte/bit counter API constant time */
|
||||
long count; /* doesn't count the tail */
|
||||
} tremor_oggpack_buffer;
|
||||
|
||||
typedef struct oggbyte_buffer {
|
||||
tremor_ogg_reference *baseref;
|
||||
|
||||
tremor_ogg_reference *ref;
|
||||
unsigned char *ptr;
|
||||
long pos;
|
||||
long end;
|
||||
} oggbyte_buffer;
|
||||
|
||||
typedef struct tremor_ogg_sync_state {
|
||||
/* decode memory management pool */
|
||||
tremor_ogg_buffer_state *bufferpool;
|
||||
|
||||
/* stream buffers */
|
||||
tremor_ogg_reference *fifo_head;
|
||||
tremor_ogg_reference *fifo_tail;
|
||||
long fifo_fill;
|
||||
|
||||
/* stream sync management */
|
||||
int unsynced;
|
||||
int headerbytes;
|
||||
int bodybytes;
|
||||
|
||||
} tremor_ogg_sync_state;
|
||||
|
||||
typedef struct tremor_ogg_stream_state {
|
||||
tremor_ogg_reference *header_head;
|
||||
tremor_ogg_reference *header_tail;
|
||||
tremor_ogg_reference *body_head;
|
||||
tremor_ogg_reference *body_tail;
|
||||
|
||||
int e_o_s; /* set when we have buffered the last
|
||||
packet in the logical bitstream */
|
||||
int b_o_s; /* set after we've written the initial page
|
||||
of a logical bitstream */
|
||||
long serialno;
|
||||
long pageno;
|
||||
tremor_ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a seperate abstraction
|
||||
layer) also knows about the gap */
|
||||
tremor_ogg_int64_t granulepos;
|
||||
|
||||
int lacing_fill;
|
||||
tremor_ogg_uint32_t body_fill;
|
||||
|
||||
/* decode-side state data */
|
||||
int holeflag;
|
||||
int spanflag;
|
||||
int clearflag;
|
||||
int laceptr;
|
||||
tremor_ogg_uint32_t body_fill_next;
|
||||
|
||||
} tremor_ogg_stream_state;
|
||||
|
||||
typedef struct {
|
||||
tremor_ogg_reference *packet;
|
||||
long bytes;
|
||||
long b_o_s;
|
||||
long e_o_s;
|
||||
tremor_ogg_int64_t granulepos;
|
||||
tremor_ogg_int64_t packetno; /* sequence number for decode; the framing
|
||||
knows where there's a hole in the data,
|
||||
but we need coupling so that the codec
|
||||
(which is in a seperate abstraction
|
||||
layer) also knows about the gap */
|
||||
} tremor_ogg_packet;
|
||||
|
||||
typedef struct {
|
||||
tremor_ogg_reference *header;
|
||||
int header_len;
|
||||
tremor_ogg_reference *body;
|
||||
long body_len;
|
||||
} tremor_ogg_page;
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: bitstream ************************/
|
||||
|
||||
extern void tremor_oggpack_readinit(tremor_oggpack_buffer *b,tremor_ogg_reference *r);
|
||||
extern long tremor_oggpack_look(tremor_oggpack_buffer *b,int bits);
|
||||
extern void tremor_oggpack_adv(tremor_oggpack_buffer *b,int bits);
|
||||
extern long tremor_oggpack_read(tremor_oggpack_buffer *b,int bits);
|
||||
extern long tremor_oggpack_bytes(tremor_oggpack_buffer *b);
|
||||
extern long tremor_oggpack_bits(tremor_oggpack_buffer *b);
|
||||
extern int tremor_oggpack_eop(tremor_oggpack_buffer *b);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: decoding **************************/
|
||||
|
||||
extern tremor_ogg_sync_state *tremor_ogg_sync_create(void);
|
||||
extern int tremor_ogg_sync_destroy(tremor_ogg_sync_state *oy);
|
||||
extern int tremor_ogg_sync_reset(tremor_ogg_sync_state *oy);
|
||||
|
||||
extern unsigned char *tremor_ogg_sync_bufferin(tremor_ogg_sync_state *oy, long size);
|
||||
extern int tremor_ogg_sync_wrote(tremor_ogg_sync_state *oy, long bytes);
|
||||
extern long tremor_ogg_sync_pageseek(tremor_ogg_sync_state *oy,tremor_ogg_page *og);
|
||||
extern int tremor_ogg_sync_pageout(tremor_ogg_sync_state *oy, tremor_ogg_page *og);
|
||||
extern int tremor_ogg_stream_pagein(tremor_ogg_stream_state *os, tremor_ogg_page *og);
|
||||
extern int tremor_ogg_stream_packetout(tremor_ogg_stream_state *os,tremor_ogg_packet *op);
|
||||
extern int tremor_ogg_stream_packetpeek(tremor_ogg_stream_state *os,tremor_ogg_packet *op);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: general ***************************/
|
||||
|
||||
extern tremor_ogg_stream_state *tremor_ogg_stream_create(int serialno);
|
||||
extern int tremor_ogg_stream_destroy(tremor_ogg_stream_state *os);
|
||||
extern int tremor_ogg_stream_reset(tremor_ogg_stream_state *os);
|
||||
extern int tremor_ogg_stream_reset_serialno(tremor_ogg_stream_state *os,int serialno);
|
||||
extern int tremor_ogg_stream_eos(tremor_ogg_stream_state *os);
|
||||
|
||||
extern int tremor_ogg_page_checksum_set(tremor_ogg_page *og);
|
||||
|
||||
extern int tremor_ogg_page_version(tremor_ogg_page *og);
|
||||
extern int tremor_ogg_page_continued(tremor_ogg_page *og);
|
||||
extern int tremor_ogg_page_bos(tremor_ogg_page *og);
|
||||
extern int tremor_ogg_page_eos(tremor_ogg_page *og);
|
||||
extern tremor_ogg_int64_t tremor_ogg_page_granulepos(tremor_ogg_page *og);
|
||||
extern tremor_ogg_uint32_t tremor_ogg_page_serialno(tremor_ogg_page *og);
|
||||
extern tremor_ogg_uint32_t tremor_ogg_page_pageno(tremor_ogg_page *og);
|
||||
extern int tremor_ogg_page_packets(tremor_ogg_page *og);
|
||||
extern int tremor_ogg_page_getbuffer(tremor_ogg_page *og, unsigned char **buffer);
|
||||
|
||||
extern int tremor_ogg_packet_release(tremor_ogg_packet *op);
|
||||
extern int tremor_ogg_page_release(tremor_ogg_page *og);
|
||||
|
||||
extern void tremor_ogg_page_dup(tremor_ogg_page *d, tremor_ogg_page *s);
|
||||
|
||||
/* Ogg BITSTREAM PRIMITIVES: return codes ***************************/
|
||||
|
||||
#define OGG_SUCCESS 0
|
||||
|
||||
#define OGG_HOLE -10
|
||||
#define OGG_SPAN -11
|
||||
#define OGG_EVERSION -12
|
||||
#define OGG_ESERIAL -13
|
||||
#define OGG_EINVAL -14
|
||||
#define OGG_EEOS -15
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TREMOR_OGG_H */
|
||||
+966
-1345
File diff suppressed because it is too large
Load Diff
@@ -8,7 +8,7 @@ includedir=@includedir@
|
||||
Name: vorbisidec
|
||||
Description: vorbisidec is the integer Ogg Vorbis library
|
||||
Version: @VERSION@
|
||||
Requires.private: ogg
|
||||
Requires: ogg
|
||||
Conflicts:
|
||||
Libs: -L${libdir} -lvorbisidec
|
||||
Libs: -L${libdir} -lvorbisidec -lm
|
||||
Cflags: -I${includedir}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1250"?>
|
||||
<VisualStudioPropertySheet
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libogg"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..\..\..\..\libogg-$(LIBOGG_VERSION)\include";..\..\..\..\ogg\include;..\..\..\..\..\..\..\core\ogg\libogg\include"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libogg-$(LIBOGG_VERSION)\win32\VS2005\$(PlatformName)\$(ConfigurationName)";"..\..\..\..\ogg\win32\VS2005\$(PlatformName)\$(ConfigurationName)";"..\..\..\..\..\..\..\core\ogg\libogg\win32\VS2005\$(PlatformName)\$(ConfigurationName)""
|
||||
/>
|
||||
<UserMacro
|
||||
Name="LIBOGG_VERSION"
|
||||
Value="1.1.4"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
@@ -1,865 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8,00"
|
||||
Name="libtremor"
|
||||
ProjectGUID="{7A8E774E-DD94-43B8-8758-6F9F656CC8D2}"
|
||||
RootNamespace="libtremor"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
<Platform
|
||||
Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
||||
/>
|
||||
<Platform
|
||||
Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
||||
/>
|
||||
<Platform
|
||||
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\block.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\codebook.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\floor0.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\floor1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\info.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mapping0.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mdct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\registry.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\res012.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\sharedbook.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\synthesis.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\window.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\backends.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\block.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\codebook.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\codec_internal.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\config_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ivorbiscodec.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ivorbisfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lsp_lookup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mdct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mdct_lookup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\misc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ogg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\os.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\os_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\registry.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\window.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\window_lookup.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="windows-1250"?>
|
||||
<VisualStudioPropertySheet
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="libogg"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""..\..\..\..\libogg-$(LIBOGG_VERSION)\include";..\..\..\..\ogg\include;..\..\..\..\..\..\..\core\ogg\libogg\include"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalLibraryDirectories=""..\..\..\..\libogg-$(LIBOGG_VERSION)\win32\VS2008\$(PlatformName)\$(ConfigurationName)";"..\..\..\..\ogg\win32\VS2008\$(PlatformName)\$(ConfigurationName)";"..\..\..\..\..\..\..\core\ogg\libogg\win32\VS2008\$(PlatformName)\$(ConfigurationName)""
|
||||
/>
|
||||
<UserMacro
|
||||
Name="LIBOGG_VERSION"
|
||||
Value="1.1.4"
|
||||
/>
|
||||
</VisualStudioPropertySheet>
|
||||
@@ -1,865 +0,0 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="9,00"
|
||||
Name="libtremor"
|
||||
ProjectGUID="{7A8E774E-DD94-43B8-8758-6F9F656CC8D2}"
|
||||
RootNamespace="libtremor"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
<Platform
|
||||
Name="x64"
|
||||
/>
|
||||
<Platform
|
||||
Name="Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
||||
/>
|
||||
<Platform
|
||||
Name="Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
||||
/>
|
||||
<Platform
|
||||
Name="Windows Mobile 6 Professional SDK (ARMV4I)"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Windows Mobile 6 Professional SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="_DEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="1"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|x64"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
CallingConvention="0"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCFxCopTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Windows Mobile 6 Professional SDK (ARMV4I)"
|
||||
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
|
||||
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
|
||||
ConfigurationType="4"
|
||||
InheritedPropertySheets="..\libogg.vsprops"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
TargetEnvironment="1"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ExecutionBucket="7"
|
||||
AdditionalIncludeDirectories="..\..\..\include;..\..\..\..\libogg\include"
|
||||
PreprocessorDefinitions="NDEBUG;_LIB;_WIN32_WCE=$(CEVER);UNDER_CE;WIN32;WINCE;$(ARCHFAM);$(_ARCHFAM_);$(PLATFORMDEFINES)"
|
||||
RuntimeLibrary="0"
|
||||
TreatWChar_tAsBuiltInType="false"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLibrarianTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCALinkTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXDCMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCBscMakeTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCodeSignTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"
|
||||
/>
|
||||
<DeploymentTool
|
||||
ForceDirty="-1"
|
||||
RemoteDirectory=""
|
||||
RegisterOutput="0"
|
||||
AdditionalFiles=""
|
||||
/>
|
||||
<DebuggerTool
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\block.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\codebook.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\floor0.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\floor1.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\info.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mapping0.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mdct.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\registry.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\res012.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\sharedbook.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\synthesis.c"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\window.c"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\..\backends.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\block.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\codebook.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\codec_internal.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\config_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ivorbiscodec.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ivorbisfile.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\lsp_lookup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mdct.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\mdct_lookup.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\misc.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\ogg.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\os.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\os_types.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\registry.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\window.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\..\window_lookup.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
||||
>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\ReadMe.txt"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -1,83 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: window functions
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#include "misc.h"
|
||||
#include "window.h"
|
||||
#include "window_lookup.h"
|
||||
|
||||
const void *_vorbis_window(int type, int left){
|
||||
|
||||
switch(type){
|
||||
case 0:
|
||||
|
||||
switch(left){
|
||||
case 32:
|
||||
return vwin64;
|
||||
case 64:
|
||||
return vwin128;
|
||||
case 128:
|
||||
return vwin256;
|
||||
case 256:
|
||||
return vwin512;
|
||||
case 512:
|
||||
return vwin1024;
|
||||
case 1024:
|
||||
return vwin2048;
|
||||
case 2048:
|
||||
return vwin4096;
|
||||
case 4096:
|
||||
return vwin8192;
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return(0);
|
||||
}
|
||||
}
|
||||
|
||||
void _vorbis_apply_window(ogg_int32_t *d,const void *window_p[2],
|
||||
long *blocksizes,
|
||||
int lW,int W,int nW){
|
||||
|
||||
LOOKUP_T *window[2]={window_p[0],window_p[1]};
|
||||
long n=blocksizes[W];
|
||||
long ln=blocksizes[lW];
|
||||
long rn=blocksizes[nW];
|
||||
|
||||
long leftbegin=n/4-ln/4;
|
||||
long leftend=leftbegin+ln/2;
|
||||
|
||||
long rightbegin=n/2+n/4-rn/4;
|
||||
long rightend=rightbegin+rn/2;
|
||||
|
||||
int i,p;
|
||||
|
||||
for(i=0;i<leftbegin;i++)
|
||||
d[i]=0;
|
||||
|
||||
for(p=0;i<leftend;i++,p++)
|
||||
d[i]=MULT31(d[i],window[lW][p]);
|
||||
|
||||
for(i=rightbegin,p=rn/2-1;i<rightend;i++,p--)
|
||||
d[i]=MULT31(d[i],window[nW][p]);
|
||||
|
||||
for(;i<n;i++)
|
||||
d[i]=0;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
|
||||
function: window functions
|
||||
|
||||
********************************************************************/
|
||||
|
||||
#ifndef _V_WINDOW_
|
||||
#define _V_WINDOW_
|
||||
|
||||
extern const void *_vorbis_window(int type,int left);
|
||||
extern void _vorbis_apply_window(ogg_int32_t *d,const void *window[2],
|
||||
long *blocksizes,
|
||||
int lW,int W,int nW);
|
||||
|
||||
|
||||
#endif
|
||||
+14
-11
@@ -1,12 +1,12 @@
|
||||
/********************************************************************
|
||||
* *
|
||||
* THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* THIS FILE IS PART OF THE TremorOggVorbis 'TREMOR' CODEC SOURCE CODE. *
|
||||
* *
|
||||
* USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS *
|
||||
* GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
|
||||
* IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. *
|
||||
* *
|
||||
* THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* THE TremorOggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 *
|
||||
* BY THE Xiph.Org FOUNDATION http://www.xiph.org/ *
|
||||
* *
|
||||
********************************************************************
|
||||
@@ -16,9 +16,9 @@
|
||||
********************************************************************/
|
||||
|
||||
|
||||
#include <ogg/os_types.h>
|
||||
#include "os_types.h"
|
||||
|
||||
static const LOOKUP_T vwin64[32] = {
|
||||
static LOOKUP_T vwin64[32] = {
|
||||
X(0x001f0003), X(0x01168c98), X(0x030333c8), X(0x05dfe3a4),
|
||||
X(0x09a49562), X(0x0e45df18), X(0x13b47ef2), X(0x19dcf676),
|
||||
X(0x20a74d83), X(0x27f7137c), X(0x2fabb05a), X(0x37a1105a),
|
||||
@@ -29,7 +29,7 @@ static const LOOKUP_T vwin64[32] = {
|
||||
X(0x7fdd78a5), X(0x7ff6ec6d), X(0x7ffed0e9), X(0x7ffffc3f),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin128[64] = {
|
||||
static LOOKUP_T vwin128[64] = {
|
||||
X(0x0007c04d), X(0x0045bb89), X(0x00c18b87), X(0x017ae294),
|
||||
X(0x02714a4e), X(0x03a4217a), X(0x05129952), X(0x06bbb24f),
|
||||
X(0x089e38a1), X(0x0ab8c073), X(0x0d09a228), X(0x0f8ef6bd),
|
||||
@@ -48,7 +48,7 @@ static const LOOKUP_T vwin128[64] = {
|
||||
X(0x7ffdcf39), X(0x7fff6dac), X(0x7fffed01), X(0x7fffffc4),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin256[128] = {
|
||||
static LOOKUP_T vwin256[128] = {
|
||||
X(0x0001f018), X(0x00117066), X(0x00306e9e), X(0x005ee5f1),
|
||||
X(0x009ccf26), X(0x00ea208b), X(0x0146cdea), X(0x01b2c87f),
|
||||
X(0x022dfedf), X(0x02b85ced), X(0x0351cbbd), X(0x03fa317f),
|
||||
@@ -83,7 +83,7 @@ static const LOOKUP_T vwin256[128] = {
|
||||
X(0x7fffdcd2), X(0x7ffff6d6), X(0x7ffffed0), X(0x7ffffffc),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin512[256] = {
|
||||
static LOOKUP_T vwin512[256] = {
|
||||
X(0x00007c06), X(0x00045c32), X(0x000c1c62), X(0x0017bc4c),
|
||||
X(0x00273b7a), X(0x003a9955), X(0x0051d51c), X(0x006cede7),
|
||||
X(0x008be2a9), X(0x00aeb22a), X(0x00d55b0d), X(0x00ffdbcc),
|
||||
@@ -150,7 +150,7 @@ static const LOOKUP_T vwin512[256] = {
|
||||
X(0x7ffffdcd), X(0x7fffff6d), X(0x7fffffed), X(0x7fffffff),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin1024[512] = {
|
||||
static LOOKUP_T vwin1024[512] = {
|
||||
X(0x00001f02), X(0x0001170e), X(0x00030724), X(0x0005ef40),
|
||||
X(0x0009cf59), X(0x000ea767), X(0x0014775e), X(0x001b3f2e),
|
||||
X(0x0022fec8), X(0x002bb618), X(0x00356508), X(0x00400b81),
|
||||
@@ -281,7 +281,7 @@ static const LOOKUP_T vwin1024[512] = {
|
||||
X(0x7fffffdd), X(0x7ffffff7), X(0x7fffffff), X(0x7fffffff),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin2048[1024] = {
|
||||
static LOOKUP_T vwin2048[1024] = {
|
||||
X(0x000007c0), X(0x000045c4), X(0x0000c1ca), X(0x00017bd3),
|
||||
X(0x000273de), X(0x0003a9eb), X(0x00051df9), X(0x0006d007),
|
||||
X(0x0008c014), X(0x000aee1e), X(0x000d5a25), X(0x00100428),
|
||||
@@ -540,7 +540,7 @@ static const LOOKUP_T vwin2048[1024] = {
|
||||
X(0x7ffffffe), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin4096[2048] = {
|
||||
static LOOKUP_T vwin4096[2048] = {
|
||||
X(0x000001f0), X(0x00001171), X(0x00003072), X(0x00005ef5),
|
||||
X(0x00009cf8), X(0x0000ea7c), X(0x00014780), X(0x0001b405),
|
||||
X(0x0002300b), X(0x0002bb91), X(0x00035698), X(0x0004011e),
|
||||
@@ -1055,7 +1055,9 @@ static const LOOKUP_T vwin4096[2048] = {
|
||||
X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
|
||||
};
|
||||
|
||||
static const LOOKUP_T vwin8192[4096] = {
|
||||
#ifndef LIMIT_TO_64kHz
|
||||
|
||||
static LOOKUP_T vwin8192[4096] = {
|
||||
X(0x0000007c), X(0x0000045c), X(0x00000c1d), X(0x000017bd),
|
||||
X(0x0000273e), X(0x00003a9f), X(0x000051e0), X(0x00006d02),
|
||||
X(0x00008c03), X(0x0000aee5), X(0x0000d5a7), X(0x00010049),
|
||||
@@ -2082,3 +2084,4 @@ static const LOOKUP_T vwin8192[4096] = {
|
||||
X(0x7fffffff), X(0x7fffffff), X(0x7fffffff), X(0x7fffffff),
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user