diff options
author | Monty <xiphmont@xiph.org> | 2002-06-20 03:55:31 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2002-06-20 03:55:31 +0000 |
commit | 223786982390edbebc3e9f9b32857c52a725b952 (patch) | |
tree | ab0fa88bed7562530281fa207371a70ad7e47ee3 | |
parent | 9653c029cac6741e7119be3b425ceb5e21c410bd (diff) | |
download | libvorbis-git-223786982390edbebc3e9f9b32857c52a725b952.tar.gz |
Incremental commit
All code is in place and appears debugged. None of the tuning numbers
plugged in yet. This commit is to avoid losing work.
svn path=/branches/branch_monty_20020507/vorbis/; revision=3401
-rw-r--r-- | configure.in | 195 | ||||
-rw-r--r-- | examples/encoder_example.c | 6 | ||||
-rw-r--r-- | lib/analysis.c | 24 | ||||
-rw-r--r-- | lib/mapping0.c | 7 | ||||
-rw-r--r-- | lib/masking.h | 129 | ||||
-rw-r--r-- | lib/modes/psych_44.h | 833 | ||||
-rw-r--r-- | lib/modes/residue_44.h | 23 | ||||
-rw-r--r-- | lib/os.h | 141 | ||||
-rw-r--r-- | lib/psy.c | 576 | ||||
-rw-r--r-- | lib/psy.h | 23 | ||||
-rw-r--r-- | lib/vorbisenc.c | 239 |
11 files changed, 793 insertions, 1403 deletions
diff --git a/configure.in b/configure.in new file mode 100644 index 00000000..59ee6514 --- /dev/null +++ b/configure.in @@ -0,0 +1,195 @@ +dnl Process this file with autoconf to produce a configure script + +dnl ------------------------------------------------ +dnl Initialization and Versioning +dnl ------------------------------------------------ + +AC_INIT(lib/mdct.c) +AM_INIT_AUTOMAKE(libvorbis,1.0rc3) + +dnl Library versioning + +V_LIB_CURRENT=1 +V_LIB_REVISION=0 +V_LIB_AGE=1 +VF_LIB_CURRENT=3 +VF_LIB_REVISION=0 +VF_LIB_AGE=0 +VE_LIB_CURRENT=1 +VE_LIB_REVISION=0 +VE_LIB_AGE=1 +AC_SUBST(V_LIB_CURRENT) +AC_SUBST(V_LIB_REVISION) +AC_SUBST(V_LIB_AGE) +AC_SUBST(VF_LIB_CURRENT) +AC_SUBST(VF_LIB_REVISION) +AC_SUBST(VF_LIB_AGE) +AC_SUBST(VE_LIB_CURRENT) +AC_SUBST(VE_LIB_REVISION) +AC_SUBST(VE_LIB_AGE) + +dnl -------------------------------------------------- +dnl Check for programs +dnl -------------------------------------------------- + +dnl save $CFLAGS since AC_PROG_CC likes to insert "-g -O2" +dnl if $CFLAGS is blank +cflags_save="$CFLAGS" +AC_PROG_CC +AC_PROG_CPP +CFLAGS="$cflags_save" + +AM_PROG_LIBTOOL + +dnl -------------------------------------------------- +dnl Set build flags based on environment +dnl -------------------------------------------------- + +AC_CANONICAL_HOST + +dnl Set some target options + +cflags_save="$CFLAGS" +ldflags_save="$LDFLAGS" +if test -z "$GCC"; then + case $host in + *-*-irix*) + dnl If we're on IRIX, we wanna use cc even if gcc + dnl is there (unless the user has overriden us)... + if test -z "$CC"; then + CC=cc + fi + DEBUG="-g -signed" + CFLAGS="-O2 -w -signed" + PROFILE="-p -g3 -O2 -signed" ;; + sparc-sun-solaris*) + DEBUG="-v -g" + CFLAGS="-xO4 -fast -w -fsimple -native -xcg92" + PROFILE="-v -xpg -g -xO4 -fast -native -fsimple -xcg92 -Dsuncc" ;; + *) + DEBUG="-g" + CFLAGS="-O" + PROFILE="-g -p" ;; + esac +else + + case $host in + *86-*-linux*) + DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" + CFLAGS="-O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char" +# PROFILE="-Wall -W -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char -fno-inline -static" + PROFILE="-Wall -W -pg -g -O20 -ffast-math -mno-ieee-fp -D_REENTRANT -fsigned-char -fno-inline" + + # glibc < 2.1.3 has a serious FP bug in the math inline header + # that will cripple Vorbis. Look to see if the magic FP stack + # clobber is missing in the mathinline header, thus indicating + # the buggy version + + AC_EGREP_CPP(log10.*fldlg2.*fxch,[ + #define __LIBC_INTERNAL_MATH_INLINES 1 + #define __OPTIMIZE__ + #include <math.h> + ],bad=maybe,bad=no) + if test ${bad} = "maybe" ;then + AC_EGREP_CPP(log10.*fldlg2.*fxch.*st\([[0123456789]]*\), + [ + #define __LIBC_INTERNAL_MATH_INLINES 1 + #define __OPTIMIZE__ + #include <math.h> + ],bad=no,bad=yes) + fi + if test ${bad} = "yes" ;then + AC_MSG_WARN([ ]) + AC_MSG_WARN([********************************************************]) + AC_MSG_WARN([* The glibc headers on this machine have a serious bug *]) + AC_MSG_WARN([* in /usr/include/bits/mathinline.h This bug affects *]) + AC_MSG_WARN([* all floating point code, not just Ogg, built on this *]) + AC_MSG_WARN([* machine. Upgrading to glibc 2.1.3 is strongly urged *]) + AC_MSG_WARN([* to correct the problem. Note that upgrading glibc *]) + AC_MSG_WARN([* will not fix any previously built programs; this is *]) + AC_MSG_WARN([* a compile-time time bug. *]) + AC_MSG_WARN([* To work around the problem for this build of Ogg, *]) + AC_MSG_WARN([* autoconf is disabling all math inlining. This will *]) + AC_MSG_WARN([* hurt Ogg performace but is necessary for an Ogg that *]) + AC_MSG_WARN([* will actually work. Once glibc is upgraded, rerun *]) + AC_MSG_WARN([* configure and make to build with inlining. *]) + AC_MSG_WARN([********************************************************]) + AC_MSG_WARN([ ]) + + CFLAGS=${OPT}" -D__NO_MATH_INLINES" + PROFILE=${PROFILE}" -D__NO_MATH_INLINES" + fi;; + powerpc-*-linux*) + DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES" + CFLAGS="-O3 -ffast-math -mfused-madd -D_REENTRANT" + PROFILE="-pg -g -O3 -ffast-math -mfused-madd -D_REENTRANT";; + *-*-linux*) + DEBUG="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char" + CFLAGS="-O20 -ffast-math -D_REENTRANT -fsigned-char" + PROFILE="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char";; + sparc-sun-*) + DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char -mv8" + CFLAGS="-O20 -ffast-math -D__NO_MATH_INLINES -fsigned-char -mv8" + PROFILE="-pg -g -O20 -D__NO_MATH_INLINES -fsigned-char -mv8" ;; + *-*-darwin*) + DEBUG="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O0 -fsigned-char" + CFLAGS="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -O4 -ffast-math -fsigned-char" + PROFILE="-DDARWIN -fno-common -force_cpusubtype_ALL -Wall -g -pg -O4 -ffast-math -fsigned-char";; + *) + DEBUG="-g -Wall -W -D__NO_MATH_INLINES -fsigned-char" + CFLAGS="-O20 -D__NO_MATH_INLINES -fsigned-char" + PROFILE="-O20 -g -pg -D__NO_MATH_INLINES -fsigned-char" ;; + esac +fi +CFLAGS="$CFLAGS $cflags_save" +LDFLAGS="$LDFLAGS $ldflags_save" + +dnl -------------------------------------------------- +dnl Check for headers +dnl -------------------------------------------------- + +AC_CHECK_HEADER(memory.h,CFLAGS="$CFLAGS -DUSE_MEMORY_H",:) + +dnl -------------------------------------------------- +dnl Check for typedefs, structures, etc +dnl -------------------------------------------------- + +dnl none + +dnl -------------------------------------------------- +dnl Check for libraries +dnl -------------------------------------------------- + +AC_CHECK_LIB(m, cos, LIBS="-lm", LIBS="") +AC_CHECK_LIB(pthread, pthread_create, pthread_lib="-lpthread", :) + +AM_PATH_OGG(, AC_MSG_ERROR(must have Ogg installed!)) + +dnl -------------------------------------------------- +dnl Check for library functions +dnl -------------------------------------------------- + +AC_FUNC_ALLOCA +AC_FUNC_MEMCMP + +AC_CHECK_FUNCS(sqrtf) +AC_CHECK_FUNCS(logf) +AC_CHECK_FUNCS(expf) +AC_CHECK_FUNCS(acosf) +AC_CHECK_FUNCS(atanf) +AC_CHECK_FUNCS(frexpf) +AC_CHECK_FUNCS(rintf) +AC_CHECK_FUNCS(floorf) + +dnl -------------------------------------------------- +dnl Do substitutions +dnl -------------------------------------------------- + +LIBS="$LIBS $OGG_LIBS" + +AC_SUBST(LIBS) +AC_SUBST(DEBUG) +AC_SUBST(PROFILE) +AC_SUBST(pthread_lib) + +AC_OUTPUT(Makefile lib/Makefile lib/modes/Makefile lib/books/Makefile lib/books/coupled/Makefile lib/books/uncoupled/Makefile lib/books/floor/Makefile doc/Makefile doc/vorbisfile/Makefile doc/vorbisenc/Makefile include/Makefile include/vorbis/Makefile examples/Makefile win32/Makefile debian/Makefile vq/Makefile) diff --git a/examples/encoder_example.c b/examples/encoder_example.c index 16d3d1c3..b970bf94 100644 --- a/examples/encoder_example.c +++ b/examples/encoder_example.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple example encoder - last mod: $Id: encoder_example.c,v 1.40.2.3 2002/06/11 04:44:44 xiphmont Exp $ + last mod: $Id: encoder_example.c,v 1.40.2.4 2002/06/20 03:55:26 xiphmont Exp $ ********************************************************************/ @@ -97,8 +97,8 @@ int main(){ /* (quality mode .4: 44kHz stereo coupled, roughly 128kbps VBR) */ vorbis_info_init(&vi); - vorbis_encode_init(&vi,2,44100,-1,128000,-1); - //vorbis_encode_init_vbr(&vi,2,44100,.4); + //vorbis_encode_init(&vi,2,44100,-1,128000,-1); + vorbis_encode_init_vbr(&vi,2,44100,.4); /* add a comment */ vorbis_comment_init(&vc); diff --git a/lib/analysis.c b/lib/analysis.c index af56adb4..b9982d86 100644 --- a/lib/analysis.c +++ b/lib/analysis.c @@ -11,7 +11,7 @@ ******************************************************************** function: single-block PCM analysis mode dispatch - last mod: $Id: analysis.c,v 1.51.2.3 2002/05/18 01:39:27 xiphmont Exp $ + last mod: $Id: analysis.c,v 1.51.2.4 2002/06/20 03:55:27 xiphmont Exp $ ********************************************************************/ @@ -79,18 +79,20 @@ void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg if(dB && v[j]==0) fprintf(of,"\n\n"); else{ - if(bark) - fprintf(of,"%f ",toBARK(22050.f*j/n)); - else - if(off!=0) - fprintf(of,"%f ",(double)(j+off)/44100.); + if(v[j]>-900.){ + if(bark) + fprintf(of,"%f ",toBARK(22050.f*j/n)); else + if(off!=0) + fprintf(of,"%f ",(double)(j+off)/44100.); + else fprintf(of,"%f ",(double)j); - - if(dB){ - fprintf(of,"%f\n",todB(v+j)); - }else{ - fprintf(of,"%f\n",v[j]); + + if(dB){ + fprintf(of,"%f\n",todB(v+j)); + }else{ + fprintf(of,"%f\n",v[j]); + } } } } diff --git a/lib/mapping0.c b/lib/mapping0.c index 34068b54..1a3c0366 100644 --- a/lib/mapping0.c +++ b/lib/mapping0.c @@ -11,7 +11,7 @@ ******************************************************************** function: channel mapping 0 implementation - last mod: $Id: mapping0.c,v 1.49.2.5 2002/06/11 04:44:45 xiphmont Exp $ + last mod: $Id: mapping0.c,v 1.49.2.6 2002/06/20 03:55:27 xiphmont Exp $ ********************************************************************/ @@ -194,11 +194,12 @@ static int mapping0_forward(vorbis_block *vb){ int modenumber=vb->W; vorbis_info_mapping0 *info=ci->map_param[modenumber]; - vb->mode=modenumber; - vorbis_look_psy *psy_look= b->psy+blocktype+(vb->W?2:0); + vb->mode=modenumber; + + for(i=0;i<vi->channels;i++){ float scale=4.f/n; float scale_dB; diff --git a/lib/masking.h b/lib/masking.h index b41366e4..665e6476 100644 --- a/lib/masking.h +++ b/lib/masking.h @@ -11,7 +11,7 @@ ******************************************************************** function: masking curve data for psychoacoustics - last mod: $Id: masking.h,v 1.21.6.2 2002/06/17 05:12:45 xiphmont Exp $ + last mod: $Id: masking.h,v 1.21.6.3 2002/06/20 03:55:27 xiphmont Exp $ ********************************************************************/ @@ -20,6 +20,7 @@ /* more detailed ATH */ +#define MAX_ATH 88 static float ATH[]={ /*15*/ -20, -24, -26, -30, -34, -37, -40, -43, /*31*/ -46, -49, -53, -56, -58, -60, -62, -64, @@ -54,7 +55,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -75, -79, -79, -80, -83, -88, -93, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, -53, -61, -66, @@ -62,7 +62,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -75, -76, -78, -79, -83, -88, -93, -100, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -37, -37, -37, -37, -37, -37, -37, -37, -38, -40, -42, -46, -48, -53, -55, -62, @@ -70,7 +69,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -69, -71, -77, -77, -78, -80, -82, -84, -88, -93, -98, -106, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -25, -25, -25, -25, -25, -25, -25, -25, -25, -26, -27, -29, -32, -38, -48, -52, @@ -78,7 +76,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -67, -67, -66, -68, -69, -73, -73, -76, -80, -81, -81, -85, -85, -86, -88, -93, -100, -110, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -16, -16, -16, -16, -16, -16, -16, -16, -17, -19, -20, -22, -26, -28, -31, -40, @@ -86,7 +83,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -57, -52, -55, -55, -60, -58, -62, -63, -70, -67, -69, -72, -73, -77, -80, -82, -83, -87, -90, -94, -98, -104, -115, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -8, -8, -8, -8, -8, -8, -8, -8, -8, -8, -10, -11, -15, -19, -25, -30, @@ -94,8 +90,7 @@ static float tonemasks[17][6][EHMER_MAX]={ -48, -42, -44, -46, -50, -50, -51, -52, -59, -54, -55, -55, -58, -62, -63, -66, -72, -73, -76, -75, -78, -80, -80, -81, - -84, -88, -90, -94, -98, -101, -106, -110, - -999, -999, -999, -999, -999, -999, -999, -999}}, + -84, -88, -90, -94, -98, -101, -106, -110}}, /* 88Hz */ {{ -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -66, -67, -67, -67, @@ -103,7 +98,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -79, -79, -81, -83, -86, -89, -93, -97, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, -48, -51, -55, -59, -66, @@ -111,15 +105,13 @@ static float tonemasks[17][6][EHMER_MAX]={ -79, -77, -77, -78, -80, -81, -82, -84, -86, -88, -91, -95, -100, -108, -116, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -36, -36, -36, -36, -36, -36, -36, -36, -36, -37, -37, -41, -44, -48, -51, -58, -62, -60, -57, -59, -59, -60, -63, -65, -72, -71, -70, -72, -74, -77, -76, -78, -81, -81, -80, -83, -86, -91, -96, -100, - -105, -110, -90, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, + -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -28, -28, -28, -28, -28, -28, -28, -28, -28, -30, -32, -32, -33, -35, -41, -49, @@ -127,7 +119,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -65, -61, -59, -61, -64, -69, -70, -74, -77, -77, -78, -81, -84, -85, -87, -90, -92, -96, -100, -107, -112, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -19, -19, -19, -19, -19, -19, -19, -19, -20, -21, -23, -27, -30, -35, -36, -41, @@ -135,7 +126,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -55, -53, -52, -53, -56, -59, -58, -60, -67, -66, -69, -71, -72, -75, -79, -81, -84, -87, -90, -93, -97, -101, -107, -114, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -9, -9, -9, -9, -9, -9, -9, -9, -11, -12, -12, -15, -16, -20, -23, -30, @@ -143,8 +133,7 @@ static float tonemasks[17][6][EHMER_MAX]={ -47, -44, -41, -40, -47, -49, -46, -46, -58, -50, -50, -54, -58, -62, -64, -67, -67, -70, -72, -76, -79, -83, -87, -91, - -96, -100, -104, -110, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}}, + -96, -100, -104, -110, -999, -999, -999, -999}}, /* 125 Hz */ {{ -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, -63, -64, -66, -67, -66, -68, @@ -152,7 +141,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -84, -85, -90, -94, -101, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, -60, -60, -61, -63, -66, @@ -160,7 +148,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -81, -78, -79, -82, -83, -86, -90, -97, -103, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -53, -53, -53, -53, -53, -53, -53, -53, -53, -54, -55, -57, -56, -57, -55, -61, @@ -168,7 +155,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -74, -73, -75, -75, -78, -80, -80, -82, -85, -90, -96, -101, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -46, -46, -46, -46, -46, -46, -46, -46, -46, -46, -47, -47, -47, -47, -48, -51, @@ -176,7 +162,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -66, -60, -62, -67, -67, -70, -72, -75, -76, -78, -81, -85, -88, -94, -97, -104, -112, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -36, -36, -36, -36, -36, -36, -36, -36, -39, -41, -42, -42, -39, -38, -41, -43, @@ -184,16 +169,14 @@ static float tonemasks[17][6][EHMER_MAX]={ -54, -50, -48, -50, -55, -61, -59, -62, -66, -66, -66, -69, -69, -73, -74, -74, -75, -77, -79, -82, -87, -91, -95, -100, - -108, -115, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}, + -108, -115, -999, -999, -999, -999, -999, -999}, { -28, -26, -24, -22, -20, -20, -23, -29, -30, -31, -28, -27, -28, -28, -28, -35, -40, -33, -32, -29, -30, -30, -30, -37, -45, -41, -37, -38, -45, -47, -47, -48, -53, -49, -48, -50, -49, -49, -51, -52, -58, -56, -57, -56, -60, -61, -62, -70, - -72, -74, -78, -83, -88, -93, -100, -106, - -112, -999, -999, -999, -999, -999, -999, -999}}, + -72, -74, -78, -83, -88, -93, -100, -106}}, /* 177 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -105, -100, -95, -91, -87, -83, @@ -201,7 +184,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -86, -85, -86, -87, -90, -97, -107, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -110, -105, -100, -95, -90, -85, -81, -77, -73, -70, -67, -67, -68, @@ -209,7 +191,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -84, -83, -84, -86, -88, -89, -89, -93, -98, -105, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-105, -100, -95, -90, -85, -80, -76, -71, -68, -68, -65, -63, -63, -62, -62, -64, @@ -217,7 +198,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -73, -73, -74, -75, -76, -81, -83, -85, -88, -89, -92, -95, -100, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -80, -75, -71, -68, -65, -63, -62, -61, -61, -61, -61, -59, -56, -57, -53, -50, @@ -225,7 +205,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -67, -63, -67, -68, -72, -75, -78, -80, -81, -81, -82, -85, -89, -90, -93, -97, -101, -107, -114, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, { -65, -61, -59, -57, -56, -55, -55, -56, -56, -57, -55, -53, -52, -47, -44, -44, @@ -233,16 +212,14 @@ static float tonemasks[17][6][EHMER_MAX]={ -51, -49, -50, -53, -54, -63, -60, -61, -62, -66, -66, -66, -70, -73, -74, -75, -76, -75, -79, -85, -89, -91, -96, -102, - -110, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}, + -110, -999, -999, -999, -999, -999, -999, -999}, { -52, -50, -49, -49, -48, -48, -48, -49, -50, -50, -49, -46, -43, -39, -35, -33, -38, -36, -32, -29, -32, -32, -32, -35, -44, -39, -38, -38, -46, -50, -45, -46, -53, -50, -50, -50, -54, -54, -53, -53, -56, -57, -59, -66, -70, -72, -74, -79, - -83, -85, -90, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}}, + -83, -85, -90, -97, -114, -999, -999, -999}}, /* 250 Hz */ {{-999, -999, -999, -999, -999, -999, -110, -105, -100, -95, -90, -86, -80, -75, -75, -79, @@ -250,7 +227,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -108, -103, -98, -93, -88, -83, -79, -78, -75, -71, -67, -68, @@ -258,7 +234,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -88, -93, -100, -107, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -110, -105, -101, -96, -90, -86, -81, -77, -73, -69, -66, -61, -62, @@ -266,7 +241,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -81, -80, -84, -90, -95, -102, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -107, -103, -97, -92, -88, -83, -79, -74, -70, -66, -59, -53, -58, @@ -274,7 +248,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -72, -70, -72, -75, -78, -80, -81, -80, -83, -83, -88, -93, -100, -107, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -105, -100, -95, -90, -85, -80, -75, -70, -66, -62, -56, -48, -44, @@ -282,16 +255,14 @@ static float tonemasks[17][6][EHMER_MAX]={ -58, -58, -59, -60, -62, -62, -61, -61, -65, -64, -65, -68, -70, -74, -75, -78, -81, -86, -95, -110, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, - {-999, -54, -105, -100, -95, -90, -85, -80, + {-999, -999, -105, -100, -95, -90, -85, -80, -75, -70, -65, -61, -55, -49, -39, -33, -40, -35, -32, -38, -40, -33, -35, -37, -46, -41, -45, -44, -46, -42, -45, -46, -52, -50, -50, -50, -54, -54, -55, -57, -62, -64, -66, -68, -70, -76, -81, -90, - -100, -110, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}}, + -100, -110, -999, -999, -999, -999, -999, -999}}, /* 354 hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -90, -85, -82, -83, -80, -78, @@ -299,7 +270,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -99, -106, -117, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -90, -85, -80, -75, -70, -68, @@ -307,7 +277,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -92, -89, -91, -95, -100, -106, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -90, -83, -75, -71, -63, -64, @@ -315,7 +284,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -84, -83, -85, -89, -90, -93, -98, -104, -109, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -103, -96, -88, -81, -75, -68, -58, -54, @@ -323,7 +291,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -74, -69, -72, -72, -75, -74, -77, -81, -81, -82, -84, -87, -93, -96, -99, -104, -110, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -108, -102, -96, -91, -85, -80, -74, -68, -60, -51, -46, @@ -331,7 +298,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -56, -53, -55, -58, -57, -63, -58, -60, -66, -64, -67, -70, -70, -74, -77, -84, -86, -89, -91, -93, -94, -101, -109, -118, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -108, -103, -98, -93, -88, -83, -78, -73, -68, -60, -53, -44, -35, @@ -339,8 +305,7 @@ static float tonemasks[17][6][EHMER_MAX]={ -51, -45, -46, -47, -46, -54, -50, -49, -50, -50, -50, -51, -54, -57, -58, -60, -66, -66, -66, -64, -65, -68, -77, -82, - -87, -95, -110, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}}, + -87, -95, -110, -999, -999, -999, -999, -999}}, /* 500 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -107, -102, -97, -92, -87, -83, -78, -75, @@ -348,7 +313,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -101, -105, -109, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -106, -100, -95, -90, -86, -81, -78, -74, -69, @@ -356,7 +320,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -92, -97, -93, -100, -103, -107, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -106, -100, -95, -90, -87, -83, -80, -75, -69, -60, @@ -364,7 +327,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -81, -83, -84, -87, -93, -96, -99, -103, -107, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -108, -103, -98, -93, -89, -85, -82, -78, -71, -62, -55, @@ -372,7 +334,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -70, -66, -66, -67, -70, -72, -75, -78, -84, -84, -84, -88, -91, -90, -95, -98, -102, -103, -106, -110, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -108, -103, -98, -94, -90, -87, -82, -79, -73, -67, -58, -47, @@ -380,7 +341,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -54, -51, -48, -47, -49, -50, -51, -57, -58, -60, -63, -69, -70, -69, -71, -74, -78, -82, -90, -95, -101, -105, -110, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -105, -101, -97, -93, -90, -85, -80, -77, -72, -65, -56, -48, -37, @@ -388,8 +348,7 @@ static float tonemasks[17][6][EHMER_MAX]={ -47, -38, -35, -39, -38, -43, -40, -45, -50, -45, -44, -47, -50, -55, -48, -48, -52, -66, -70, -76, -82, -90, -97, -105, - -110, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999}}, + -110, -999, -999, -999, -999, -999, -999, -999}}, /* 707 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, -999, -108, -103, -98, -93, -86, -79, -76, @@ -397,7 +356,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -107, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -108, -103, -98, -93, -86, -79, -71, @@ -405,7 +363,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -92, -93, -92, -98, -101, -108, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -108, -103, -98, -93, -87, -78, -68, -65, @@ -413,7 +370,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -82, -82, -83, -84, -91, -93, -98, -102, -106, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -105, -100, -95, -90, -82, -74, -62, -57, @@ -421,7 +377,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -66, -59, -60, -63, -66, -69, -73, -79, -83, -84, -80, -81, -81, -82, -88, -92, -98, -105, -113, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -107, -102, -97, -92, -84, -79, -69, -57, -47, @@ -429,7 +384,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -53, -43, -43, -48, -51, -56, -55, -52, -57, -59, -61, -62, -67, -71, -78, -83, -86, -94, -98, -103, -110, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -105, -100, -95, -90, -84, -78, -70, -61, -51, -41, @@ -437,7 +391,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -46, -40, -38, -38, -41, -46, -41, -46, -47, -43, -43, -45, -41, -45, -56, -67, -68, -83, -87, -90, -95, -102, -107, -113, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 1000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -446,7 +399,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -106, -103, -98, -92, -85, -80, -71, @@ -454,7 +406,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -100, -107, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -107, -104, -101, -97, -92, -88, -84, -80, -64, @@ -462,7 +413,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -83, -86, -91, -98, -104, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -107, -104, -101, -97, -92, -90, -84, -74, -57, @@ -470,7 +420,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -63, -62, -69, -76, -77, -78, -78, -79, -82, -88, -94, -100, -106, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -106, -102, -98, -95, -90, -85, -83, -78, -70, -50, @@ -478,7 +427,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -55, -46, -47, -48, -48, -54, -49, -49, -58, -62, -71, -81, -87, -92, -97, -102, -108, -114, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -106, -102, -98, -95, -90, -85, -83, -78, -70, -45, @@ -486,7 +434,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -47, -41, -44, -41, -39, -43, -38, -37, -40, -41, -44, -50, -58, -65, -73, -79, -85, -92, -97, -101, -105, -109, -113, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 1414 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -495,7 +442,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -101, -95, -88, -83, -76, @@ -503,7 +449,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -110, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -104, -98, -92, -87, -81, -70, @@ -511,7 +456,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -95, -99, -103, -108, -111, -114, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -103, -97, -90, -85, -76, -60, @@ -519,7 +463,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -73, -74, -77, -75, -78, -81, -86, -87, -88, -91, -94, -98, -103, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -105, -100, -97, -92, -86, -81, -79, -70, -57, @@ -527,7 +470,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -58, -52, -50, -50, -53, -55, -64, -69, -71, -85, -82, -78, -81, -85, -95, -102, -112, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -105, -100, -97, -92, -85, -83, -79, -72, -49, @@ -535,7 +477,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -43, -38, -36, -35, -37, -38, -37, -44, -54, -60, -57, -60, -70, -75, -84, -92, -103, -112, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 2000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -544,7 +485,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -101, -95, -89, -83, -72, @@ -552,7 +492,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -105, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -109, -103, -97, -93, -87, -81, -70, @@ -560,7 +499,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -88, -89, -97, -103, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -107, -100, -94, -88, -83, -75, -63, @@ -568,7 +506,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -77, -76, -81, -88, -86, -92, -96, -102, -109, -116, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -105, -98, -92, -86, -81, -73, -56, @@ -576,7 +513,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -49, -50, -53, -54, -61, -71, -70, -69, -78, -79, -87, -90, -96, -104, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -103, -96, -90, -86, -78, -70, -51, @@ -584,7 +520,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -35, -28, -33, -38, -36, -43, -41, -43, -46, -60, -68, -78, -82, -89, -94, -99, -104, -109, -114, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 2828 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -593,7 +528,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -109, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -105, -97, -85, -72, @@ -601,7 +535,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -97, -103, -109, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -112, -93, -81, -68, @@ -609,7 +542,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -90, -93, -98, -104, -109, -113, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -113, -100, -93, -84, -63, @@ -617,7 +549,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -66, -72, -76, -71, -80, -75, -90, -95, -98, -101, -103, -106, -108, -111, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -105, -95, -86, -74, -53, @@ -625,7 +556,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -46, -49, -49, -46, -58, -61, -74, -81, -87, -92, -94, -97, -99, -102, -105, -108, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -108, -99, -90, -76, -66, -45, @@ -633,7 +563,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -31, -31, -39, -33, -40, -41, -43, -53, -59, -70, -73, -77, -79, -82, -84, -87, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 4000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -642,7 +571,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -91, -70, @@ -650,7 +578,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -95, -80, -60, @@ -658,7 +585,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -103, -107, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -95, -80, -58, @@ -666,7 +592,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -88, -85, -89, -97, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -95, -80, -53, @@ -674,7 +599,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -86, -79, -90, -93, -98, -103, -107, -112, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -97, -91, -73, -45, @@ -682,7 +606,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -60, -52, -67, -74, -81, -92, -96, -100, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 5657 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -691,7 +614,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -116, -109, -102, -95, -89, -74, @@ -699,7 +621,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -116, -109, -102, -95, -89, -75, @@ -707,7 +628,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -105, -115, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -115, -108, -101, -94, -88, -66, @@ -715,7 +635,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -93, -98, -105, -110, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -105, -95, -89, -82, -57, @@ -723,7 +642,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -88, -82, -82, -89, -94, -100, -108, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -101, -96, -90, -83, -77, -54, @@ -731,7 +649,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -51, -52, -53, -59, -65, -71, -78, -85, -95, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 8000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -740,7 +657,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -105, -86, -66, @@ -748,7 +664,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -105, -92, -80, -61, @@ -756,7 +671,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -120, -104, -91, -79, -52, @@ -764,7 +678,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -85, -87, -88, -90, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -118, -100, -87, -77, -49, @@ -772,7 +685,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -62, -62, -65, -68, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -115, -98, -84, -62, -49, @@ -780,7 +692,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -39, -40, -42, -43, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 11314 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -789,7 +700,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -88, -66, @@ -797,7 +707,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -88, -61, @@ -805,15 +714,13 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, - -97, -94, -93, -80, -87, -110, -86, -62, + -999, -999, -999, -999, -999, -110, -86, -62, -63, -62, -62, -58, -52, -50, -50, -52, -54, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -118, -108, -84, -53, @@ -821,7 +728,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -40, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -118, -100, -73, -43, @@ -829,7 +735,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -38, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}}, /* 16000 Hz */ {{-999, -999, -999, -999, -999, -999, -999, -999, @@ -838,7 +743,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -91, -84, -74, @@ -846,7 +750,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -86, -78, -70, @@ -854,7 +757,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -87, -78, -67, @@ -862,7 +764,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -86, -69, -56, @@ -870,7 +771,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}, {-999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -110, -100, -83, -71, -48, @@ -878,7 +778,6 @@ static float tonemasks[17][6][EHMER_MAX]={ -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, - -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999}} }; diff --git a/lib/modes/psych_44.h b/lib/modes/psych_44.h index 4eafa5d7..05488ad8 100644 --- a/lib/modes/psych_44.h +++ b/lib/modes/psych_44.h @@ -11,7 +11,7 @@ ******************************************************************** function: key psychoacoustic settings for 44.1/48kHz - last mod: $Id: psych_44.h,v 1.15.2.5 2002/06/11 04:44:49 xiphmont Exp $ + last mod: $Id: psych_44.h,v 1.15.2.6 2002/06/20 03:55:31 xiphmont Exp $ ********************************************************************/ @@ -107,722 +107,34 @@ static compandblock _psy_compand_44[6]={ /* tonal masking curve level adjustments *************************/ static vp_adjblock _vp_tonemask_adj_longblock[11]={ /* adjust for mode zero */ - {{ - { 10, 10, 5, }, /*63*/ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 125 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 250 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 500 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 1000 */ - { 10, 10, 5, }, - - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 2000 */ - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 4000 */ - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /* 8000 */ - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, - { 16, 16, 14, 12, 12, 15, 15, 15, 15, 15, 10}, /* 16000 */ - }}, - - /* adjust for mode one */ - {{ - { 10, 10, 5, }, /*63*/ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 125 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 250 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 500 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 1000 */ - { 10, 10, 5, }, - - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, /* 2000 */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, - { 10, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5}, /* 4000 */ - { 10, 10, 7, 5, 5, 5, 5, 5, 5, 5, 5}, - { 10, 10, 8, 7, 5, 5, 5, 5, 5, 5, 5}, /* 8000 */ - { 10, 10, 9, 8, 7, 7, 10, 10, 10, 7, 5}, - { 16, 16, 14, 10, 10, 11, 13, 13, 13, 10, 5}, /* 16000 */ - }}, - - /* adjust for mode two */ - {{ - { 10, 10, 5, }, /*63*/ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 125 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 250 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 500 */ - { 10, 10, 5, }, - { 10, 10, 5, }, /* 1000 */ - { 10, 10, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 10, 5, 5, }, /* 4000 */ - { 10, 10, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 7, 5, 5, 10, 10, 10, 5, }, - { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */ - }}, - - /* adjust for mode three */ - {{ - { 10, 5, 5, }, /*63*/ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 125 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 250 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 500 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 1000 */ - { 10, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 5, 3, 3, }, /* 4000 */ - { 10, 7, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 6, 5, 5, 10, 10, 10, 5, }, - { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */ - }}, - - /* adjust for mode four */ - {{ - { 10, 5, 5, }, /*63*/ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 125 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 250 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 500 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 1000 */ - { 10, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 5, 5, 5, 10, 10, 10, 5, }, - { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */ - }}, - - /* adjust for mode five */ - {{ - { 10, 5, 5, }, /*63*/ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 125 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 250 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 500 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 1000 */ - { 10, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 5, 5, 5, 10, 10, 10, 3, }, - { 14, 13, 12, 7, 6, 6, 8, 8, 8, 3, }, /* 16000 */ - }}, - - /* adjust for mode six */ - {{ - { 10, 5, 5, }, /*63*/ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 125 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 250 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 500 */ - { 10, 5, 5, }, - { 10, 5, 5, }, /* 1000 */ - { 10, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 5, 5, 5, 5, 5, 5, }, - { 12, 10, 10, 5, 5, 5, 5, 5, 5, }, /* 16000 */ - }}, - - /* adjust for mode seven */ - {{ - { 5, 3, 3, }, /*63*/ - { 5, 3, 3, }, - { 5, 3, 3, }, /* 125 */ - { 5, 3, 3, }, - { 5, 3, 3, }, /* 250 */ - { 5, 3, 3, }, - { 5, 3, 3, }, /* 500 */ - { 5, 3, 3, }, - { 5, 3, 3, }, /* 1000 */ - { 5, 3, 3, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 5, 3, 3, }, - { 5, 5, 4, 3, }, /* 8000 */ - { 5, 5, 4, 3, 2, 2, 2, 2, 2, }, - { 9, 7, 7, 5, 5, 5, 5, 3, 3, }, /* 16000 */ - }}, - - /* adjust for mode eight */ - {{ - { 0, }, /*63*/ - { 0, }, - { 0, }, /* 125 */ - { 0, }, - { 0, }, /* 250 */ - { 0, }, - { 0, }, /* 500 */ - { 0, }, - { 0, }, /* 1000 */ - { 0, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 0, }, - { 0, }, /* 8000 */ - { 0, }, - { 5, 5, 5, 5, 5, 5, 5, }, /* 16000 */ - }}, - - /* adjust for mode nine */ - {{ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*63*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*125*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*250*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*500*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*1000*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*2000*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*4000*/ - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -2, -7, -7, -7, -7, -7, -7, -7}, /*8000*/ - { 0, 0, 0, -2, -5, -5, -5, -7, -7, -7, -7}, - { 2, 2, 2, 2, 2, 0, 0, -5, -7, -7, -7}, /*16000*/ - }}, - - /* adjust for mode ten */ - {{ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*1000*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*2000*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*4000*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*8000*/ - { 0, 0, 0, -5,-10,-10,-10,-15,-15,-15,-15}, - { 0, 0, 0, 0, 0, -5, -5,-10,-15,-15,-15}, /*16000*/ - }}, + /* 63 125 250 500 1 2 4 8 16 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 1 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */ }; static vp_adjblock _vp_tonemask_adj_otherblock[11]={ /* adjust for mode zero */ - {{ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*63*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*125*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*250*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, /*500*/ - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, - - { 5, 5, 5, }, /*1000*/ - { 5, 5, 5, }, - - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*2000*/ - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*4000*/ - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, /*8000*/ - { 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}, - { 16, 16, 14, 12, 12, 15, 15, 15, 15, 15, 10}, /*16000*/ - }}, - - /* adjust for mode one */ - {{ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*63*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*125*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*250*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, /*500*/ - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, - - { 5, 5, 5, }, /* 1000 */ - { 5, 5, 5, }, - - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, /* 2000 */ - { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5}, - { 10, 7, 7, 5, 5, 5, 5, 5, 5, 5, 5}, /* 4000 */ - { 10, 10, 7, 5, 5, 5, 5, 5, 5, 5, 5}, - { 10, 10, 8, 7, 5, 5, 5, 5, 5, 5, 5}, /* 8000 */ - { 10, 10, 9, 8, 7, 7, 10, 10, 10, 7, 5}, - { 16, 16, 14, 10, 10, 11, 13, 13, 13, 10, 5}, /* 16000 */ - - }}, - - /* adjust for mode two */ - {{ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*63*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*125*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, /*250*/ - { 0, 0, 0, 0,-10,-10,-10,-10,-10,-10,-10}, - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, /*500*/ - { 5, 5, 5, 0, -5, -5, -5, -5, -5, -5, -5}, - - { 5, 5, 5, }, /* 1000 */ - { 5, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 7, 5, 5, 10, 10, 10, 5, }, - { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */ - }}, - - /* adjust for mode three */ - {{ - { 0, 0, 0, -3,-13,-13,-13,-13,-13,-13,-13}, /*63*/ - { 0, 0, 0, -3,-13,-13,-13,-13,-13,-13,-13}, - { 0, 0, 0, -3,-13,-13,-13,-13,-13,-13,-13}, /*125*/ - { 0, 0, 0, -3,-13,-13,-13,-13,-13,-13,-13}, - { 0, 0, 0, -3,-13,-13,-13,-13,-13,-13,-13}, /*250*/ - { 0, 0, 0, -3,-13,-13,-13,-13,-13,-13,-13}, - { 0, 0, 0, -5,-10,-10,-10,-10,-10,-10,-10}, /*500*/ - { 0, 0, 0, -3,-10,-10,-10,-10,-10,-10,-10}, - - { 5, 5, 5, }, /* 1000 */ - { 5, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 6, 5, 5, 10, 10, 10, 5, }, - { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */ - }}, - - /* adjust for mode four */ - {{ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - - { 5, 5, 5, }, /* 1000 */ - { 5, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 5, 5, 5, 10, 10, 10, 5, }, - { 16, 16, 14, 8, 8, 8, 10, 10, 10, 5, }, /* 16000 */ - }}, - - /* adjust for mode five */ - {{ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - - { 5, 5, 5, }, /* 1000 */ - { 5, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 5, 5, 5, 7, 7, 7, 3, }, - { 14, 13, 12, 6, 6, 6, 8, 8, 8, }, /* 16000 */ - }}, - - /* adjust for mode six */ - {{ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*63*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*125*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*250*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*500*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - - { 5, 5, 5, }, /* 1000 */ - { 5, 5, 5, }, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 10, 5, 5, }, - { 10, 10, 7, 5, }, /* 8000 */ - { 10, 10, 7, 5, 5, 5, 5, 5, 5, }, - { 12, 10, 10, 5, 5, 5, 5, 5, 5, }, /* 16000 */ - }}, - - /* adjust for mode seven */ - {{ - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, /*63*/ - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, /*125*/ - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, /*250*/ - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, /*500*/ - { -5, -5, -5,-10,-15,-15,-15,-17,-17,-17,-17}, - - { 2, -3, -3, -7, -7, -7, -7, -7, -7, -7, -7}, - { 2, -3, -3, -7, -7, -7, -7, -7, -7, -7, -7}, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 5, 2, 2, }, - { 5, 5, 3, 2, }, /* 8000 */ - { 5, 5, 3, 2, 2, 2, 2, 2, 2, }, - { 8, 7, 7, 5, 5, 5, 5, 2, 2, }, /* 16000 */ - }}, - - /* adjust for mode eight */ - {{ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*63*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*125*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*250*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*500*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - - { 0,-10,-10,-15,-15,-15,-15,-15,-15,-15,-15}, - { 0,-10,-10,-15,-15,-15,-15,-15,-15,-15,-15}, - - { 0, }, /* 2000 */ - { 0, }, - { 0, }, /* 4000 */ - { 0, }, - { 0, }, /* 8000 */ - { 0, }, - { 5, 5, 5, 5, 5, 5, 5, }, /* 16000 */ - }}, - - /* adjust for mode nine */ - {{ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*63*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*125*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*250*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*500*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - - { 0, -5, -5,-10,-15,-17,-17,-17,-17,-17,-17}, /*1000*/ - { 0, -5, -5,-10,-15,-17,-17,-17,-17,-17,-17}, - { 0, 0, 0, -3, -7, -7, -7, -7, -7, -7, -7}, /*2000*/ - { 0, 0, 0, -3, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -3, -7, -7, -7, -7, -7, -7, -7}, /*4000*/ - { 0, 0, 0, -3, -7, -7, -7, -7, -7, -7, -7}, - { 0, 0, 0, -3, -7, -7, -7, -7, -7, -7, -7}, /*8000*/ - { 0, 0, 0, -5, -5, -5, -5, -7, -7, -7, -7}, - { 0, 0, 0, 0, 0, -2, -3, -5, -7, -7, -7}, /*16000*/ - }}, - - /* adjust for mode ten */ - {{ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*63*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*125*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*250*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, /*500*/ - {-10,-10,-10,-15,-15,-15,-15,-20,-20,-20,-20}, - - { 0, -5, -5,-10,-15,-17,-17,-17,-17,-17,-17}, /*1000*/ - { 0, -5, -5,-10,-15,-17,-17,-17,-17,-17,-17}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*2000*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*4000*/ - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, - { 0, 0, 0, -5,-15,-15,-15,-15,-15,-15,-15}, /*8000*/ - { 0, 0, 0, -5,-10,-10,-10,-15,-15,-15,-15}, - { 0, 0, 0, 0, 0, -5, -5,-10,-15,-15,-15}, /*16000*/ - }}, - -}; - -static vp_adjblock _vp_peakguard[11]={ - /* zero */ - {{ - {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*63*/ - {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24}, - {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*125*/ - {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24}, - {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24},/*250*/ - {-14,-16,-18,-19,-24,-24,-24,-24,-24,-24,-24}, - {-10,-10,-10,-10,-16,-16,-18,-20,-22,-24,-24},/*500*/ - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},/*1000*/ - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-24,-24},/*2000*/ - {-10,-10,-10,-12,-16,-16,-16,-20,-22,-24,-24}, - {-10,-10,-10,-12,-16,-16,-16,-20,-22,-24,-24},/*4000*/ - {-10,-10,-10,-12,-12,-14,-16,-18,-22,-24,-24}, - {-10,-10,-10,-10,-10,-14,-16,-18,-22,-24,-24},/*8000*/ - {-10,-10,-10,-10,-10,-14,-16,-18,-22,-24,-24}, - {-10,-10,-10,-10,-10,-12,-16,-18,-22,-24,-24},/*16000*/ - }}, - /* one */ - {{ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*63*/ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30}, - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*125*/ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30}, - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*250*/ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30}, - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*500*/ - {-10,-10,-10,-10,-14,-14,-14,-20,-26,-30,-30}, - {-10,-10,-10,-10,-14,-14,-14,-20,-22,-30,-30},/*1000*/ - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*2000*/ - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*4000*/ - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30}, - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30},/*8000*/ - {-10,-10,-10,-10,-10,-10,-10,-11,-22,-30,-30}, - {-10,-10,-10,-10,-10,-10,-10,-10,-20,-30,-30},/*16000*/ - }}, - /* two */ - {{ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*63*/ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30}, - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*125*/ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30}, - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*250*/ - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30}, - {-14,-20,-20,-20,-26,-30,-30,-30,-30,-30,-30},/*500*/ - {-10,-10,-10,-10,-14,-14,-14,-20,-26,-30,-30}, - {-10,-10,-10,-10,-14,-14,-14,-20,-22,-30,-30},/*1000*/ - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*2000*/ - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-30,-30},/*4000*/ - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30}, - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-30,-30},/*8000*/ - {-10,-10,-10,-10,-10,-10,-10,-11,-22,-30,-30}, - {-10,-10,-10,-10,-10,-10,-10,-10,-20,-30,-30},/*16000*/ - }}, - /* three */ - {{ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/ - {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40}, - {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},/*250*/ - {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40}, - {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},/*500*/ - {-10,-10,-10,-10,-14,-16,-20,-24,-26,-32,-40}, - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*1000*/ - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40}, - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*2000*/ - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-32,-40},/*4000*/ - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40}, - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40},/*8000*/ - {-10,-10,-10,-10,-10,-10,-10,-11,-22,-32,-40}, - {-10,-10,-10,-10,-10,-10,-10,-10,-20,-32,-40},/*16000*/ - }}, - /* four */ - {{ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/ - {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40}, - {-14,-20,-20,-20,-20,-20,-20,-30,-32,-32,-40},/*250*/ - {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40}, - {-14,-20,-20,-20,-20,-20,-20,-24,-32,-32,-40},/*500*/ - {-10,-10,-10,-10,-14,-16,-20,-24,-26,-32,-40}, - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*1000*/ - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40}, - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40},/*2000*/ - {-10,-10,-10,-10,-14,-16,-20,-24,-22,-32,-40}, - {-10,-10,-10,-10,-14,-14,-16,-20,-22,-32,-40},/*4000*/ - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40}, - {-10,-10,-10,-10,-10,-11,-12,-13,-22,-32,-40},/*8000*/ - {-10,-10,-10,-10,-10,-10,-10,-11,-22,-32,-40}, - {-10,-10,-10,-10,-10,-10,-10,-10,-20,-32,-40},/*16000*/ - }}, - /* five */ - {{ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*250*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*500*/ - {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40}, - {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},/*1000*/ - {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40}, - {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*2000*/ - {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40}, - {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*4000*/ - {-14,-14,-14,-20,-22,-22,-24,-24,-26,-32,-40}, - {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40},/*8000*/ - {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40}, - {-14,-14,-14,-18,-20,-20,-22,-24,-24,-32,-40},/*16000*/ - }}, - /* six */ - {{ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*63*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*125*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*250*/ - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40}, - {-14,-20,-20,-20,-26,-32,-32,-32,-32,-32,-40},/*500*/ - {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40}, - {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40},/*1000*/ - {-14,-14,-14,-16,-20,-22,-24,-24,-28,-32,-40}, - {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*2000*/ - {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40}, - {-14,-14,-16,-20,-24,-26,-26,-28,-30,-32,-40},/*4000*/ - {-14,-14,-14,-20,-22,-22,-24,-24,-26,-32,-40}, - {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40},/*8000*/ - {-14,-14,-14,-18,-20,-20,-24,-24,-24,-32,-40}, - {-14,-14,-14,-18,-20,-20,-22,-24,-24,-32,-40},/*16000*/ - }}, - /* seven */ - {{ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*63*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*88*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*125*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*170*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*250*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*350*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*700*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1400*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2800*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*4000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*5600*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*8000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*11500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*16600*/ - }}, - /* eight */ - {{ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*63*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*88*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*125*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*170*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*250*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*350*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*700*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*1400*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*2800*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*4000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*5600*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*8000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*11500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-40,-40},/*16600*/ - }}, - /* nine */ - {{ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*63*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*88*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*125*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*170*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*250*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*350*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*700*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1400*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2800*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*4000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*5600*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*8000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*11500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*16600*/ - }}, - /* ten */ - {{ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*63*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*88*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*125*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*170*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*250*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*350*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*700*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*1400*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*2800*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*4000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*5600*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*8000*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*11500*/ - {-14,-20,-24,-26,-32,-34,-36,-38,-40,-44,-46},/*16600*/ - }} + /* 63 125 250 500 1 2 4 8 16 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 0 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 1 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 2 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 3 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 4 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 5 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 6 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 7 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 8 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 9 */ + {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}, /* 10 */ }; static noise3 _psy_noisebias_long[11]={ @@ -844,8 +156,10 @@ static noise3 _psy_noisebias_long[11]={ {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1, 0, 1, 2}, {-20,-20,-20,-20,-20,-20,-20,-10, -6, -2, -3, -3, -1, -1, 0, 1, 2}}}, /* 4 */ - {{{-20,-20,-18,-18,-18,-16,-14, -8, -6, -2, 0, 2, 3, 3, 4, 4, 10}, - {-20,-20,-20,-20,-20,-20,-20,-10, -6, -3, -4, -4, -2, -1, 0, 0, 2}, + {{ + {-20,-20,-18,-18,-18,-16,-14, -8, -6, -2, 0, 2, 3, 3, 4, 4, 10}, + {-20,-20,-18,-18,-18,-16,-14, -8, -6, 0, 4, 5, 6, 8, 8, 8, 10}, + //{-20,-20,-20,-20,-20,-20,-20,-10, -6, -3, -4, -4, -2, -1, 0, 0, 2}, {-30,-30,-30,-30,-30,-30,-30,-30,-26,-20,-20,-20,-20,-20,-16,-14,-10}}}, /* 5 */ {{{-20,-20,-20,-20,-20,-20,-20,-18,-10, -4, -6, -6, -3, -2, -2, -2, 0}, @@ -892,8 +206,10 @@ static noise3 _psy_noisebias_impulse[11]={ {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2}, {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -6, -6, -4, -4, -4, -2, -2}}}, /* 4 */ - {{{-20,-20,-20,-20,-20,-18,-14,-10,-10, -2, 2, 2, 2, 2, 2, 3, 6}, - {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}, + {{ + {-20,-20,-20,-20,-20,-18,-14,-10,-10, -2, 2, 2, 2, 2, 2, 3, 6}, + {-20,-20,-18,-18,-18,-16,-14, -8, -6, 0, 4, 5, 6, 8, 8, 8, 10}, + //{-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}, {-34,-34,-34,-34,-30,-30,-30,-30,-30,-26,-26,-26,-26,-22,-20,-20,-16}}}, /* 5 */ {{{-30,-30,-30,-30,-30,-30,-24,-20,-10,-12,-14,-14,-10, -9, -8, -6, -4}, @@ -940,8 +256,10 @@ static noise3 _psy_noisebias_other[11]={ {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1, 0, 1, 2}, {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -1, -1, 0, 1, 2}}}, /* 4 */ - {{{-20,-20,-20,-20,-20,-18,-14,-10, -6, -2, 2, 2, 3, 3, 4, 4, 10}, - {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -1, 0, 0, 2}, + {{ + {-20,-20,-20,-20,-20,-18,-14,-10, -6, -2, 2, 2, 3, 3, 4, 4, 10}, + {-20,-20,-18,-18,-18,-16,-14, -8, -6, 0, 4, 5, 6, 8, 8, 8, 10}, + //{-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -4, -4, -2, -1, 0, 0, 2}, {-34,-34,-34,-34,-30,-30,-30,-30,-26,-20,-20,-20,-20,-20,-16,-14,-10}}}, /* 5 */ {{{-30,-30,-30,-30,-30,-30,-24,-20,-10, -4, -6, -6, -3, -2, -2, -2, 0}, @@ -974,10 +292,6 @@ static noiseguard _psy_noiseguards_44[2]={ {10,10,100}, }; -static int _psy_tone_masterguard[11]={ - -18,-24,-24,-24,-26,-40,-40,-40,-45,-45,-45, -}; - static int _psy_tone_suppress[11]={ -10,-20,-20,-20,-30,-30,-40,-40,-45,-45,-45, }; @@ -992,45 +306,27 @@ static int _psy_noise_suppress[11]={ static vorbis_info_psy _psy_info_template={ -1, - {-1},-110.,-140., - /* tonemask att,guard,suppr,curves peakattp,peaksettings*/ - {0.f,0.f,0.f}, -40.f,-40.f, {{{0.}}}, 1, {{{0.}}}, + -110.,-140., + /* tonemask att boost/decay,suppr,curves */ + {0.f,0.f,0.f}, 0.,0., -40.f, {0.}, /*noisemaskp,supp, low/high window, low/hi guard, minimum */ 1, -0.f, .5f, .5f, 0,0,0, {{-1},{-1},{-1}},{-1},105.f, - 0,0,-1,-1, + 0,0,-1,-1,0., }; /* ath ****************/ static int _psy_ath_floater[11]={ - -100,-100,-100,-100,-100,-100,-105,-105,-105,-110,-120, + -100,-100,-100,-100,-90,-100,-105,-105,-105,-110,-120, }; static int _psy_ath_abs[11]={ -110,-110,-120,-140,-140,-140,-140,-140,-140,-140,-150, }; -static athcurve ATH_Bark_dB[]={ - {{ - 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f, - 6.f, 2.f, 0.f, 0.f, -2.f, -5.f, -6.f, -6.f, -4.f, 4.f, - 14.f, 20.f, 19.f, 17.f, 30.f, 60.f, 70.f, - }}, - {{ - 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f, - 6.f, 2.f, 0.f, 0.f, -2.f, -5.f, -6.f, -6.f, -4.f, 0.f, - 2.f, 6.f, 5.f, 5.f, 15.f, 30.f, 50.f, - }}, - {{ - 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f, - 6.f, 2.f, 0.f, 0.f, -3.f, -5.f, -6.f, -6.f, -4.5f, -4.f, - 2.f, 6.f, 5.f, 5.f, 15.f, 20.f, 40.f, - }} -}; - /* stereo setup. These don't map directly to quality level, there's an additional indirection as several of the below may be used in a single bitmanaged stream @@ -1049,8 +345,8 @@ static adjB _psy_stereo_modes_44[10]={ {{ 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}}, /* 2 */ /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14*/ {{ 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1}}, /* 3 */ - /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14*/ - {{ 3, 3, 3, 3, 3, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1}}, /* 4 */ + /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14*/ + {{ 3, 3, 3, 3, 3, 2, 1, 4, 1, 1, 1, 1, 1, 1, 1}}, /* 4 */ /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14*/ {{0}}, /* 5 */ /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14*/ @@ -1065,9 +361,9 @@ static adjB _psy_stereo_modes_44[10]={ }; static adjB _psy_stereo_pkHz_44[22]={ - /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 */ - {{0}}, - {{0}}, + /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 0 */ + {{ 4, 4, 4, 4, 4, 4, 4, 6, 10, 10, 10, 10, 10, 10, 10}}, + {{ 4, 5, 6, 6, 6, 6, 6, 6, 10, 10, 10, 10, 10, 10, 10}}, /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 */ {{0}}, {{0}}, @@ -1078,8 +374,8 @@ static adjB _psy_stereo_pkHz_44[22]={ {{ 4, 4, 4, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}, {{ 4, 5, 6, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}, /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 4 */ - {{ 4, 4, 4, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}, - {{ 4, 5, 6, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}, + {{ 4, 4, 4, 6, 8, 10, 10, 4, 10, 10, 10, 10, 10, 10, 10}}, + {{ 4, 5, 6, 6, 8, 10, 10, 4, 10, 10, 10, 10, 10, 10, 10}}, /*0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 5 */ {{ 4, 4, 4, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}, {{ 4, 5, 6, 6, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10}}, @@ -1100,23 +396,23 @@ static adjB _psy_stereo_pkHz_44[22]={ /* tone master attenuation by base quality mode and bitrate tweak */ -static adj3 _psy_tone_masteratt_44[11]={ - {{0}}, /* 0 */ - {{0}}, /* 1 */ - {{0}}, /* 2 */ - {{ 0, 0, -10}}, /* 3 */ - {{ 0, 0, -10}}, /* 4 */ - {{ 0, 0, -10}}, /* 5 */ - {{0}}, /* 6 */ - {{0}}, /* 7 */ - {{0}}, /* 8 */ - {{0}}, /* 9 */ - {{0}}, /* 10 */ +static att3 _psy_tone_masteratt_44[11]={ + {{0},0,0}, /* 0 */ + {{0},0,0}, /* 1 */ + {{0},0,0}, /* 2 */ + {{0},0,0}, /* 3 */ + {{ 10, 24, -10}, 10, .625}, /* 4 */ + {{0},0,0}, /* 5 */ + {{0},0,0}, /* 6 */ + {{0},0,0}, /* 7 */ + {{0},0,0}, /* 8 */ + {{0},0,0}, /* 9 */ + {{0},0,0}, /* 10 */ }; /* lowpass by mode **************/ static double _psy_lowpass_44[11]={ - 15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. + 15.1,15.8,16.5,17.9,15.9,48.,999.,999.,999.,999.,999. }; /* noise normalization **********/ @@ -1128,8 +424,11 @@ static int _noise_start_long_44[10]={ 128,128,128,128,128,128,128,128,128,128 }; static int _noise_part_short_44[10]={ - 16,16,16,16,16,16,16,16,16,16 + 8,8,8,8,8,8,8,8,8,8 }; static int _noise_part_long_44[10]={ 32,32,32,32,32,32,32,32,32,32 }; +static double _noise_thresh_44[10]={ + .0,.5,.5,.5,.2,.5,.5,.5,.5,.5, +}; diff --git a/lib/modes/residue_44.h b/lib/modes/residue_44.h index 937b064d..1086e2df 100644 --- a/lib/modes/residue_44.h +++ b/lib/modes/residue_44.h @@ -11,7 +11,7 @@ ******************************************************************** function: toplevel residue templates for 32/44.1/48kHz - last mod: $Id: residue_44.h,v 1.11.6.5 2002/06/11 04:44:49 xiphmont Exp $ + last mod: $Id: residue_44.h,v 1.11.6.6 2002/06/20 03:55:31 xiphmont Exp $ ********************************************************************/ @@ -39,8 +39,8 @@ static vorbis_info_residue0 _residue_44_low={ 0,-1, -1, 8,-1, {0}, {-1}, - { .5, 1.5, 4.5, 1.5, 2.5, 4.5, 26.5}, - { .5, .5, .5, 999., 999., 999., 999.}, + { .5, 1.0, 1.5, 2.5, 4.5, 1.5, 4.5, 26.5}, + { .5, .5, .5, .5, .5, 999., 999., 999.}, }; /* 26 doesn't cascade well; use 28 instead */ static vorbis_info_residue0 _residue_44_low_un={ @@ -288,15 +288,18 @@ static vorbis_info_residue0 _residue_44_high_un={ appropriate index adjustment */ static vorbis_residue_template _residue_template_44_stereo[10]={ /* mode 0; 64-ish */ - {{&_residue_44_low, &_residue_44_low}, - {&_huff_book__44c0_short,&_huff_book__44c0_long}, - {&_huff_book__44c0_short,&_huff_book__44c0_long}, - { - {0},{0,0,&_44c0_s0_p1_0},{0,0,&_44c0_s0_p2_0},{0,0,&_44c0_s0_p3_0}, - {&_44c0_s0_p4_0,&_44c0_s0_p4_1},{0,0,&_44c0_s0_p5_0},{0,0,&_44c0_s0_p6_0}, - {&_44c0_s0_p7_0,&_44c0_s0_p7_1,&_44c0_s0_p7_2} + /* XXXXX mode 4; 128-ish */ + {{&_residue_44_mid, &_residue_44_mid}, + {&_huff_book__44c4_s_short,&_huff_book__44c4_s_long}, + {&_huff_book__44c4_sm_short,&_huff_book__44c4_sm_long}, + { + {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0}, + {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0}, + {&_44c4_s_p7_0,&_44c4_s_p7_1},{&_44c4_s_p8_0,&_44c4_s_p8_1}, + {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2} }, }, + /* mode 1; 80-ish */ {{&_residue_44_low, &_residue_44_low}, {&_huff_book__44c1_short,&_huff_book__44c1_long}, diff --git a/lib/os.h b/lib/os.h new file mode 100644 index 00000000..f5fafd24 --- /dev/null +++ b/lib/os.h @@ -0,0 +1,141 @@ +#ifndef _OS_H +#define _OS_H +/******************************************************************** + * * + * THIS FILE IS PART OF THE OggVorbis 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 OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2001 * + * by the XIPHOPHORUS Company http://www.xiph.org/ * + * * + ******************************************************************** + + function: #ifdef jail to whip a few platforms into the UNIX ideal. + last mod: $Id: os.h,v 1.29.2.1 2002/06/20 03:55:27 xiphmont Exp $ + + ********************************************************************/ + +#include <math.h> +#include <ogg/os_types.h> + +#ifndef _V_IFDEFJAIL_H_ +# define _V_IFDEFJAIL_H_ + +# ifdef __GNUC__ +# define STIN static __inline__ +# elif _WIN32 +# define STIN static __inline +#else +# define STIN static +#endif + +#ifndef M_PI +# define M_PI (3.1415926536f) +#endif + +#ifdef _WIN32 +# include <malloc.h> +# define rint(x) (floor((x)+0.5f)) +# define NO_FLOAT_MATH_LIB +# define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b)) +#endif + +#ifndef FAST_HYPOT +# define FAST_HYPOT hypot +#endif + +#endif + +#ifdef HAVE_ALLOCA_H +# include <alloca.h> +#endif + +#ifdef USE_MEMORY_H +# include <memory.h> +#endif + +#ifndef min +# define min(x,y) ((x)>(y)?(y):(x)) +#endif + +#ifndef max +# define max(x,y) ((x)<(y)?(y):(x)) +#endif + +#if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__) +# define VORBIS_FPU_CONTROL +/* both GCC and MSVC are kinda stupid about rounding/casting to int. + Because of encapsulation constraints (GCC can't see inside the asm + block and so we end up doing stupid things like a store/load that + is collectively a noop), we do it this way */ + +/* we must set up the fpu before this works!! */ + +typedef ogg_int16_t vorbis_fpu_control; + +static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ + ogg_int16_t ret; + ogg_int16_t temp; + __asm__ __volatile__("fnstcw %0\n\t" + "movw %0,%%dx\n\t" + "orw $62463,%%dx\n\t" + "movw %%dx,%1\n\t" + "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx"); + *fpu=ret; +} + +static inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ + __asm__ __volatile__("fldcw %0":: "m"(fpu)); +} + +/* assumes the FPU is in round mode! */ +static inline int vorbis_ftoi(double f){ /* yes, double! Otherwise, + we get extra fst/fld to + truncate precision */ + int i; + __asm__("fistl %0": "=m"(i) : "t"(f)); + return(i); +} +#endif + + +#if defined(_WIN32) && !defined(__GNUC__) +# define VORBIS_FPU_CONTROL + +typedef ogg_int16_t vorbis_fpu_control; + +static __inline int vorbis_ftoi(double f){ + int i; + __asm{ + fld f + fistp i + } + return i; +} + +static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){ +} + +static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){ +} + +#endif + + +#ifndef VORBIS_FPU_CONTROL + +typedef int vorbis_fpu_control; + +static int vorbis_ftoi(double f){ + return (int)(f+.5); +} + +/* We don't have special code for this compiler/arch, so do it the slow way */ +# define vorbis_fpu_setround(vorbis_fpu_control) {} +# define vorbis_fpu_restore(vorbis_fpu_control) {} + +#endif + +#endif /* _OS_H */ @@ -11,7 +11,7 @@ ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c,v 1.67.2.6 2002/06/11 04:44:46 xiphmont Exp $ + last mod: $Id: psy.c,v 1.67.2.7 2002/06/20 03:55:27 xiphmont Exp $ ********************************************************************/ @@ -30,7 +30,7 @@ #include "misc.h" #define NEGINF -9999.f -static double stereo_threshholds[]={0.0, 2.5, 4.5, 8.5, 16.5}; +static double stereo_threshholds[]={0.0, 2.5, 4.5, 8.5, 16.5, 9e10}; vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){ codec_setup_info *ci=vi->codec_setup; @@ -65,31 +65,6 @@ void _vi_psy_free(vorbis_info_psy *i){ } } -vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i){ - vorbis_info_psy *ret=_ogg_malloc(sizeof(*ret)); - memcpy(ret,i,sizeof(*ret)); - return(ret); -} - -/* Set up decibel threshold slopes on a Bark frequency scale */ -/* ATH is the only bit left on a Bark scale. No reason to change it - right now */ -static void set_curve(float *ref,float *c,int n, float crate){ - int i,j=0; - - for(i=0;i<MAX_BARK-1;i++){ - int endpos=rint(fromBARK((float)(i+1))*2*n/crate); - float base=ref[i]; - if(j<endpos){ - float delta=(ref[i+1]-base)/(endpos-j); - for(;j<endpos && j<n;j++){ - c[j]=base; - base+=delta; - } - } - } -} - static void min_curve(float *c, float *c2){ int i; @@ -109,113 +84,204 @@ static void attenuate_curve(float *c,float att){ extern int analysis_noisy; -static void odd_decade_level_interpolate(float **c){ - int i,j; +#include <stdio.h> +extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off); + +static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n, + float center_boost, float center_decay_rate){ + int i,j,k,m; + float ath[EHMER_MAX]; + float workc[P_BANDS][P_LEVELS][EHMER_MAX]; + float athc[P_LEVELS][EHMER_MAX]; + float *brute_buffer=alloca(n*sizeof(*brute_buffer)); + + float ***ret=_ogg_malloc(sizeof(*ret)*P_BANDS); + + memset(workc,0,sizeof(workc)); + + for(i=0;i<P_BANDS;i++){ + /* we add back in the ATH to avoid low level curves falling off to + -infinity and unnecessarily cutting off high level curves in the + curve limiting (last step). */ + + /* A half-band's settings must be valid over the whole band, and + it's better to mask too little than too much */ + int ath_offset=i*4; + for(j=0;j<EHMER_MAX;j++){ + float min=999.; + for(k=0;k<4;k++) + if(j+k+ath_offset<MAX_ATH){ + if(min>ATH[j+k+ath_offset])min=ATH[j+k+ath_offset]; + }else{ + if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1]; + } + ath[j]=min; + } - for(i=1;i<P_LEVELS;i+=2) - for(j=0;j<EHMER_MAX;j++) - if(c[i-1][j+2]>-200 || c[i+1][j+2]>-200){ - c[i][j+2]=(c[i-1][j+2]+c[i+1][j+2])/2; - }else{ - c[i][j+2]=-900; + /* copy curves into working space, replicate the 50dB curve to 30 + and 40, replicate the 100dB curve to 110 */ + for(j=0;j<6;j++) + memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j])); + memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0])); + memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0])); + + for(j=0;j<P_LEVELS;j++){ + char buf[80]; + sprintf(buf,"m%d",i); + _analysis_output_always(buf,j,workc[i][j],EHMER_MAX,0,0,0); + } + + /* apply centered curve boost/decay */ + for(j=0;j<P_LEVELS;j++){ + for(k=0;k<EHMER_MAX;k++){ + float adj=center_boost-abs(EHMER_OFFSET-k)*center_decay_rate; + if(adj<0.)adj=0.; + workc[i][j][k]+=adj; } -} + } -static void setup_curve(float **c, - int band, - float *curveatt_dB){ - int i,j; - float ath[EHMER_MAX]; - float tempc[P_LEVELS][EHMER_MAX]; - float *ATH=ATH_Bark_dB_lspconservative; /* just for limiting here */ - - /* we add back in the ATH to avoid low level curves falling off to - -infinity and unnecessarily cutting off high level curves in the - curve limiting (last step). But again, remember... a half-band's - settings must be valid over the whole band, and it's better to - mask too little than too much, so be pessimistical. */ - - for(i=0;i<EHMER_MAX;i++){ - float oc_min=band*.5+(i-EHMER_OFFSET)*.125; - float oc_max=band*.5+(i-EHMER_OFFSET+1)*.125; - float bark=toBARK(fromOC(oc_min)); - int ibark=floor(bark); - float del=bark-ibark; - float ath_min,ath_max; - - if(ibark<26) - ath_min=ATH[ibark]*(1.f-del)+ATH[ibark+1]*del; - else - ath_min=ATH[25]; - - bark=toBARK(fromOC(oc_max)); - ibark=floor(bark); - del=bark-ibark; - - if(ibark<26) - ath_max=ATH[ibark]*(1.f-del)+ATH[ibark+1]*del; - else - ath_max=ATH[25]; - - ath[i]=min(ath_min,ath_max); - } + for(j=0;j<P_LEVELS;j++){ + char buf[80]; + sprintf(buf,"boost%d",i); + _analysis_output_always(buf,j,workc[i][j],EHMER_MAX,0,0,0); + } + + /* normalize curves so the driving amplitude is 0dB */ + /* make temp curves with the ATH overlayed */ + for(j=0;j<P_LEVELS;j++){ + attenuate_curve(workc[i][j],curveatt_dB[i]+100.-(j<2?2:j)*10.-P_LEVEL_0); + memcpy(athc[j],ath,EHMER_MAX*sizeof(**athc)); + attenuate_curve(athc[j],+100.-j*10.f-P_LEVEL_0); + max_curve(athc[j],workc[i][j]); + } + + /* Now limit the louder curves. + + the idea is this: We don't know what the playback attenuation + will be; 0dB SL moves every time the user twiddles the volume + knob. So that means we have to use a single 'most pessimal' curve + for all masking amplitudes, right? Wrong. The *loudest* sound + can be in (we assume) a range of ...+100dB] SL. However, sounds + 20dB down will be in a range ...+80], 40dB down is from ...+60], + etc... */ + + for(j=1;j<P_LEVELS;j++){ + min_curve(athc[j],athc[j-1]); + min_curve(workc[i][j],athc[j]); + } + + for(j=0;j<P_LEVELS;j++){ + char buf[80]; + sprintf(buf,"limited%d",i); + _analysis_output_always(buf,j,workc[i][j],EHMER_MAX,0,0,0); + } - /* normalize curves so the driving amplitude is 0dB */ - /* make temp curves with the ATH overlayed */ - for(i=0;i<P_LEVELS;i++){ - attenuate_curve(c[i]+2,curveatt_dB[i]); - memcpy(tempc[i],ath,EHMER_MAX*sizeof(*tempc[i])); - attenuate_curve(tempc[i],-i*10.f); - max_curve(tempc[i],c[i]+2); - } - - /* Now limit the louder curves. - - the idea is this: We don't know what the playback attenuation - will be; 0dB SL moves every time the user twiddles the volume - knob. So that means we have to use a single 'most pessimal' curve - for all masking amplitudes, right? Wrong. The *loudest* sound - can be in (we assume) a range of ...+100dB] SL. However, sounds - 20dB down will be in a range ...+80], 40dB down is from ...+60], - etc... */ - - for(j=1;j<P_LEVELS;j++){ - min_curve(tempc[j],tempc[j-1]); - min_curve(c[j]+2,tempc[j]); } - /* add fenceposts */ - for(j=0;j<P_LEVELS;j++){ + for(i=0;i<P_BANDS;i++){ + int hi_curve,lo_curve,bin; + ret[i]=_ogg_malloc(sizeof(**ret)*P_LEVELS); + + /* low frequency curves are measured with greater resolution than + the MDCT/FFT will actually give us; we want the curve applied + to the tone data to be pessimistic and thus apply the minimum + masking possible for a given bin. That means that a single bin + could span more than one octave and that the curve will be a + composite of multiple octaves. It also may mean that a single + bin may span > an eighth of an octave and that the eighth + octave values may also be composited. */ + + /* which octave curves will we be compositing? */ + bin=floor(fromOC(i*.5)/binHz); + lo_curve= ceil(toOC(bin*binHz+1)*2); + hi_curve= floor(toOC((bin+1)*binHz)*2); + + fprintf(stderr,"i=%d(%d) lo=%d hi=%d\n",i,bin,lo_curve,hi_curve); + + if(lo_curve<0)lo_curve=0; + if(hi_curve>=P_BANDS)hi_curve=P_BANDS-1; - for(i=0;i<EHMER_OFFSET;i++) - if(c[j][i+2]>-200.f)break; - c[j][0]=i; + for(m=0;m<P_LEVELS;m++){ + ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2)); + + for(j=0;j<n;j++)brute_buffer[j]=999.; + + /* render the curve into bins, then pull values back into curve. + The point is that any inherent subsampling aliasing results in + a safe minimum */ + for(k=lo_curve;k<=hi_curve;k++){ + int l=0; + + for(j=0;j<EHMER_MAX;j++){ + int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz; + int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1; + + if(lo_bin<0)lo_bin=0; + if(lo_bin>n)lo_bin=n; + if(lo_bin<l)l=lo_bin; + if(hi_bin<0)hi_bin=0; + if(hi_bin>n)hi_bin=n; + + for(;l<hi_bin && l<n;l++) + if(brute_buffer[l]>workc[k][m][j]) + brute_buffer[l]=workc[k][m][j]; + } + + for(;l<n;l++) + if(brute_buffer[l]>workc[k][m][EHMER_MAX-1]) + brute_buffer[l]=workc[k][m][EHMER_MAX-1]; + + } + + for(j=0;j<EHMER_MAX;j++){ + int bin=fromOC(j*.125+i*.5-2.)/binHz; + if(bin<0){ + ret[i][m][j+2]=-999.; + }else{ + if(bin>=n){ + ret[i][m][j+2]=-999.; + }else{ + ret[i][m][j+2]=brute_buffer[bin]; + } + } + } + + /* add fenceposts */ + for(j=0;j<EHMER_OFFSET;j++) + if(ret[i][m][j+2]>-200.f)break; + ret[i][m][0]=j; + + for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--) + if(ret[i][m][j+2]>-200.f) + break; + ret[i][m][1]=j; - for(i=EHMER_MAX-1;i>EHMER_OFFSET+1;i--) - if(c[j][i+2]>-200.f) - break; - c[j][1]=i; + } + for(j=0;j<P_LEVELS;j++){ + char buf[80]; + sprintf(buf,"fc%d",i); + _analysis_output_always(buf,j,ret[i][j]+2,EHMER_MAX,0,0,0); + } } + return(ret); } void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, vorbis_info_psy_global *gi,int n,long rate){ - long i,j,k,lo=-99,hi=0; + long i,j,lo=-99,hi=0; long maxoc; memset(p,0,sizeof(*p)); - p->eighth_octave_lines=gi->eighth_octave_lines; p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1; p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines; maxoc=toOC((n*.5f-.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f; p->total_octave_lines=maxoc-p->firstoc+1; + p->ath=_ogg_malloc(n*sizeof(*p->ath)); - if(vi->ath) - p->ath=_ogg_malloc(n*sizeof(*p->ath)); p->octave=_ogg_malloc(n*sizeof(*p->octave)); p->bark=_ogg_malloc(n*sizeof(*p->bark)); p->vi=vi; @@ -223,8 +289,19 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, p->rate=rate; /* set up the lookups for a given blocksize and sample rate */ - if(vi->ath) - set_curve(vi->ath, p->ath,n,(float)rate); + + for(i=0,j=0;i<MAX_ATH-1;i++){ + int endpos=rint(fromOC((i+1)*.125-2.)*2*n/rate); + float base=ATH[i]; + if(j<endpos){ + float delta=(ATH[i+1]-base)/(endpos-j); + for(;j<endpos && j<n;j++){ + p->ath[j]=base+100.; + base+=delta; + } + } + } + for(i=0;i<n;i++){ float bark=toBARK(rate/(2*n)*i); @@ -241,212 +318,9 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, for(i=0;i<n;i++) p->octave[i]=toOC((i*.5f+.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f; - p->tonecurves=_ogg_malloc(P_BANDS*sizeof(*p->tonecurves)); - for(i=0;i<P_BANDS;i++) - p->tonecurves[i]=_ogg_malloc(P_LEVELS*sizeof(*p->tonecurves[i])); - - for(i=0;i<P_BANDS;i++) - for(j=0;j<P_LEVELS;j++) - p->tonecurves[i][j]=_ogg_malloc((EHMER_MAX+2)*sizeof(*p->tonecurves[i][j])); + p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n, + vi->tone_centerboost,vi->tone_decay); - - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[0][i]+2,tone_125[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[2][i]+2,tone_125[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[4][i]+2,tone_250[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[6][i]+2,tone_500[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[8][i]+2,tone_1000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[10][i]+2,tone_2000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[12][i]+2,tone_4000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[14][i]+2,tone_8000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - for(i=0;i<P_LEVELS;i+=2) - memcpy(p->tonecurves[16][i]+2,tone_16000[i<4?0:i/2-2],sizeof(***p->tonecurves)*EHMER_MAX); - - for(i=0;i<P_BANDS;i+=2) - odd_decade_level_interpolate(p->tonecurves[i]); - - /* interpolate curves between */ - for(i=1;i<P_BANDS;i+=2) - for(j=0;j<P_LEVELS;j++){ - memcpy(p->tonecurves[i][j]+2,p->tonecurves[i-1][j]+2,EHMER_MAX*sizeof(***p->tonecurves)); - /*interp_curve(p->tonecurves[i][j], - p->tonecurves[i-1][j], - p->tonecurves[i+1][j],.5);*/ - min_curve(p->tonecurves[i][j]+2,p->tonecurves[i+1][j]+2); - } - - analysis_noisy=0; - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_1.4kHz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_2.8kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("precurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); - - analysis_noisy=0; - - - /* set up the final curves */ - for(i=0;i<P_BANDS;i++) - setup_curve(p->tonecurves[i],i,vi->toneatt.block[i]); - - analysis_noisy=0; - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("curve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); - analysis_noisy=0; - - if(vi->peakattp) /* we limit maximum depth only optionally */ - for(i=0;i<P_BANDS;i++) - for(j=0;j<P_LEVELS;j++) - if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->peakatt.block[i][j]) - p->tonecurves[i][j][EHMER_OFFSET+2]= vi->peakatt.block[i][j]; - - analysis_noisy=0; - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("pcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); - analysis_noisy=0; - - /* but guarding is mandatory */ - for(i=0;i<P_BANDS;i++) - for(j=0;j<P_LEVELS;j++) - if(p->tonecurves[i][j][EHMER_OFFSET+2]< vi->tone_guard) - p->tonecurves[i][j][EHMER_OFFSET+2]= vi->tone_guard; - - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_63Hz",i,p->tonecurves[0][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_88Hz",i,p->tonecurves[1][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_125Hz",i,p->tonecurves[2][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_170Hz",i,p->tonecurves[3][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_250Hz",i,p->tonecurves[4][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_350Hz",i,p->tonecurves[5][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_500Hz",i,p->tonecurves[6][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_700Hz",i,p->tonecurves[7][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_1kHz",i,p->tonecurves[8][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_1.4Hz",i,p->tonecurves[9][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_2kHz",i,p->tonecurves[10][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_2.4kHz",i,p->tonecurves[11][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_4kHz",i,p->tonecurves[12][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_5.6kHz",i,p->tonecurves[13][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_8kHz",i,p->tonecurves[14][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_11.5kHz",i,p->tonecurves[15][i]+2,EHMER_MAX,0,0); - for(i=0;i<P_LEVELS;i++) - _analysis_output("fcurve_16kHz",i,p->tonecurves[16][i]+2,EHMER_MAX,0,0); - analysis_noisy=0; - /* set up rolling noise median */ p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset)); for(i=0;i<P_NOISECURVES;i++) @@ -508,13 +382,13 @@ static void seed_curve(float *seed, int seedptr; const float *posts,*curve; - int choice=(int)((amp+dBoffset)*.1f); + int choice=(int)((amp+dBoffset-P_LEVEL_0)*.1f); choice=max(choice,0); choice=min(choice,P_LEVELS-1); posts=curves[choice]; curve=posts+2; post1=(int)posts[1]; - seedptr=oc+(posts[0]-16)*linesper-(linesper>>1); + seedptr=oc+(posts[0]-EHMER_OFFSET)*linesper-(linesper>>1); for(i=posts[0];i<post1;i++){ if(seedptr>0){ @@ -980,7 +854,6 @@ static float hypot_lookup[32]={ -0.229718, -0.249913, -0.271001, -0.292893}; static void precomputed_couple_point(float premag, - float A, float B, int floorA,int floorB, float *mag, float *ang){ @@ -990,17 +863,28 @@ static void precomputed_couple_point(float premag, floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))]; - if(fabs(A)>fabs(B)){ - *mag=unitnorm(A)*premag*floormag; - }else{ - *mag=unitnorm(B)*premag*floormag; - } + *mag=premag*floormag; + *ang=0.f; } /* just like below, this is currently set up to only do single-step-depth coupling. Otherwise, we'd have to do more copying (which will be inevitable later) */ + +/* doing the real circular magnitude calculation is audibly superior + to (A+B)/sqrt(2) */ +static float cardoid_hypot(float a, float b){ + if(a>0.){ + if(b>0.)return sqrt(a*a+b*b); + if(a>-b)return sqrt(a*a-b*b); + return -sqrt(b*b-a*a); + } + if(b<0.)return -sqrt(a*a+b*b); + if(-a>b)return -sqrt(a*a-b*b); + return sqrt(b*b-a*a); +} + float **_vp_quantize_couple_memo(vorbis_block *vb, vorbis_look_psy *p, vorbis_info_mapping0 *vi, @@ -1014,7 +898,7 @@ float **_vp_quantize_couple_memo(vorbis_block *vb, float *mdctA=mdct[vi->coupling_ang[i]]; ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret)); for(j=0;j<n;j++) - ret[i][j]=FAST_HYPOT(mdctM[j],mdctA[j]); + ret[i][j]=cardoid_hypot(mdctM[j],mdctA[j]); } return(ret); @@ -1031,6 +915,7 @@ int **_vp_quantize_couple_sort(vorbis_block *vb, vorbis_info_mapping0 *vi, float **mags){ + if(p->vi->normal_point_p){ int i,j,k,n=p->n; int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret)); @@ -1071,7 +956,7 @@ void _vp_noise_normalize_sort(vorbis_look_psy *p, void _vp_noise_normalize(vorbis_look_psy *p, float *in,float *out,int *sortedindex){ - int i,j=0,n=p->n; + int flag=0,i,j=0,n=p->n; vorbis_info_psy *vi=p->vi; int partition=vi->normal_partition; int start=vi->normal_start; @@ -1081,34 +966,34 @@ void _vp_noise_normalize(vorbis_look_psy *p, out[j]=rint(in[j]); for(;j+partition<=n;j+=partition){ - float acc=0.,qacc=0.; - int flag=0; - for(i=0;i<partition;i++) - acc+=in[i+j]*in[i+j]; + float acc=0.; + int k; + + for(i=j;i<j+partition;i++) + acc+=in[i]*in[i]; for(i=0;i<partition;i++){ - int k=sortedindex[i+j-start]; - float qval=rint(in[k]); + k=sortedindex[i+j-start]; - if(qval){ - qacc+=in[k]*in[k]; + if(in[k]*in[k]>=.25f){ + out[k]=rint(in[k]); + acc-=in[k]*in[k]; flag=1; - out[k]=qval; }else{ - if(qacc>acc)break; - qacc+=1.; + if(acc<vi->normal_thresh)break; out[k]=unitnorm(in[k]); + acc-=1.; } } - if(!flag && i<2)i=0; + //if(!flag && i<3)i=0; for(;i<partition;i++){ - int k=sortedindex[i+j-start]; + k=sortedindex[i+j-start]; out[k]=0.; } } } - + for(;j<n;j++) out[j]=rint(in[j]); @@ -1158,27 +1043,26 @@ void _vp_couple(int blobno, nonzero[vi->coupling_ang[i]]=1; for(j=0;j<p->n;j+=partition){ - float acc=0.f,qacc=0.f; + float acc=0.f; for(k=0;k<partition;k++){ int l=k+j; if(l>=limit && fabs(rM[l])<point && fabs(rA[l])<point){ - precomputed_couple_point(mag_memo[i][l],rM[l],rA[l], + precomputed_couple_point(mag_memo[i][l], floorM[l],floorA[l], qM+l,qA+l); - if(rint(qM[l])==0.f) - acc+=qM[l]*qM[l]; + if(rint(qM[l])==0.f)acc+=qM[l]*qM[l]; }else{ couple_lossless(rM[l],rA[l],qM+l,qA+l); } } if(p->vi->normal_point_p) - for(k=0;k<partition && qacc<acc;k++){ + for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){ int l=mag_sort[i][j+k]; if(l>=limit && rint(qM[l])==0.f){ qM[l]=unitnorm(qM[l]); - qacc+=1.f; + acc-=1.f; } } } @@ -11,7 +11,7 @@ ******************************************************************** function: random psychoacoustics (not including preecho) - last mod: $Id: psy.h,v 1.28.2.4 2002/06/11 04:44:46 xiphmont Exp $ + last mod: $Id: psy.h,v 1.28.2.5 2002/06/20 03:55:28 xiphmont Exp $ ********************************************************************/ @@ -27,31 +27,23 @@ #endif /* psychoacoustic setup ********************************************/ -#define MAX_BARK 27 -#define P_BANDS 17 -#define P_LEVELS 11 +#define P_BANDS 17 /* 62Hz to 16kHz */ +#define P_LEVELS 8 /* 30dB to 100dB */ +#define P_LEVEL_0 30. /* 30 dB */ #define P_NOISECURVES 3 -typedef struct vp_attenblock{ - float block[P_BANDS][P_LEVELS]; -} vp_attenblock; - #define NOISE_COMPAND_LEVELS 40 typedef struct vorbis_info_psy{ int blockflag; - float ath[27]; - float ath_adjatt; float ath_maxatt; float tone_masteratt[P_NOISECURVES]; - float tone_guard; + float tone_centerboost; + float tone_decay; float tone_abs_limit; - vp_attenblock toneatt; - - int peakattp; - vp_attenblock peakatt; + float toneatt[P_BANDS]; int noisemaskp; float noisemaxsupp; @@ -69,6 +61,7 @@ typedef struct vorbis_info_psy{ int normal_point_p; int normal_start; int normal_partition; + double normal_thresh; } vorbis_info_psy; typedef struct{ diff --git a/lib/vorbisenc.c b/lib/vorbisenc.c index 3e3b5e85..040c4e0f 100644 --- a/lib/vorbisenc.c +++ b/lib/vorbisenc.c @@ -11,7 +11,7 @@ ******************************************************************** function: simple programmatic interface for encoder mode setup - last mod: $Id: vorbisenc.c,v 1.39.2.5 2002/06/11 04:44:46 xiphmont Exp $ + last mod: $Id: vorbisenc.c,v 1.39.2.6 2002/06/20 03:55:28 xiphmont Exp $ ********************************************************************/ @@ -40,7 +40,7 @@ typedef struct { } vorbis_residue_template; typedef struct vp_adjblock{ - int block[P_BANDS][P_LEVELS]; + int block[P_BANDS]; } vp_adjblock; typedef struct { @@ -54,6 +54,11 @@ typedef struct { initialization; it's all stored (until full init) in this highlevel setup, then flushed out to the real codec setup structs later. */ +typedef struct { + int att[P_NOISECURVES]; + float boost; + float decay; +} att3; typedef struct { int data[P_NOISECURVES]; } adj3; typedef struct { int data[PACKETBLOBS]; } adjB; typedef struct { @@ -64,9 +69,6 @@ typedef struct { typedef struct { int data[P_NOISECURVES][17]; } noise3; -typedef struct { - float data[27]; -} athcurve; typedef struct { int mappings; @@ -80,15 +82,13 @@ typedef struct { int *blocksize_short; int *blocksize_long; - adj3 *psy_tone_masteratt; + att3 *psy_tone_masteratt; int *psy_tone_0dB; - int *psy_tone_masterdepth; // attempt to eliminate int *psy_tone_dBsuppress; vp_adjblock *psy_tone_adj_impulse; vp_adjblock *psy_tone_adj_long; vp_adjblock *psy_tone_adj_other; - vp_adjblock *psy_tone_depth; // attempt to eliminate noiseguard *psy_noiseguards; noise3 *psy_noise_bias_impulse; @@ -102,11 +102,10 @@ typedef struct { int *psy_noise_normal_start[2]; int *psy_noise_normal_partition[2]; + double *psy_noise_normal_thresh; int *psy_ath_float; int *psy_ath_abs; - athcurve *psy_ath; - double *psy_ath_mapping; double *psy_lowpass; @@ -265,6 +264,7 @@ static int vorbis_encode_global_stereo(vorbis_info *vi, static int vorbis_encode_psyset_setup(vorbis_info *vi,double s, int *nn_start, int *nn_partition, + double *nn_thresh, int block){ codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; @@ -286,32 +286,33 @@ static int vorbis_encode_psyset_setup(vorbis_info *vi,double s, p->normal_point_p=1; p->normal_start=nn_start[is]; p->normal_partition=nn_partition[is]; + p->normal_thresh=nn_thresh[is]; } return 0; } static int vorbis_encode_tonemask_setup(vorbis_info *vi,double s,int block, - adj3 *att, + att3 *att, int *max, vp_adjblock *in){ - int i,j,is=s; + int i,is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; /* 0 and 2 are only used by bitmanagement, but there's no harm to always filling the values in here */ - p->tone_masteratt[0]=att[is].data[0]*(1.-ds)+att[is+1].data[0]*ds; - p->tone_masteratt[1]=att[is].data[1]*(1.-ds)+att[is+1].data[1]*ds; - p->tone_masteratt[2]=att[is].data[2]*(1.-ds)+att[is+1].data[2]*ds; + p->tone_masteratt[0]=att[is].att[0]*(1.-ds)+att[is+1].att[0]*ds; + p->tone_masteratt[1]=att[is].att[1]*(1.-ds)+att[is+1].att[1]*ds; + p->tone_masteratt[2]=att[is].att[2]*(1.-ds)+att[is+1].att[2]*ds; + p->tone_centerboost=att[is].boost*(1.-ds)+att[is+1].boost*ds; + p->tone_decay=att[is].decay*(1.-ds)+att[is+1].decay*ds; p->max_curve_dB=max[is]*(1.-ds)+max[is+1]*ds; for(i=0;i<P_BANDS;i++) - for(j=0;j<P_LEVELS;j++) - p->toneatt.block[i][j]=(j<4?4:j)*-10.+ - in[is].block[i][j]*(1.-ds)+in[is+1].block[i][j]*ds; + p->toneatt[i]=in[is].block[i]*(1.-ds)+in[is+1].block[i]*ds; return(0); } @@ -338,22 +339,14 @@ static int vorbis_encode_compand_setup(vorbis_info *vi,double s,int block, } static int vorbis_encode_peak_setup(vorbis_info *vi,double s,int block, - int *guard, - int *suppress, - vp_adjblock *in){ - int i,j,is=s; + int *suppress){ + int is=s; double ds=s-is; codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; - p->peakattp=1; - p->tone_guard=guard[is]*(1.-ds)+guard[is+1]*ds; p->tone_abs_limit=suppress[is]*(1.-ds)+suppress[is+1]*ds; - for(i=0;i<P_BANDS;i++) - for(j=0;j<P_LEVELS;j++) - p->peakatt.block[i][j]=(j<4?4:j)*-10.+ - in[is].block[i][j]*(1.-ds)+in[is+1].block[i][j]*ds; return(0); } @@ -367,9 +360,9 @@ static int vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block, vorbis_info_psy *p=ci->psy_param[block]; p->noisemaxsupp=suppress[is]*(1.-ds)+suppress[is+1]*ds; - p->noisewindowlomin=guard[is].lo; - p->noisewindowhimin=guard[is].hi; - p->noisewindowfixed=guard[is].fixed; + p->noisewindowlomin=guard[block].lo; + p->noisewindowhimin=guard[block].hi; + p->noisewindowfixed=guard[block].fixed; for(j=0;j<P_NOISECURVES;j++) for(i=0;i<P_BANDS;i++) @@ -378,26 +371,12 @@ static int vorbis_encode_noisebias_setup(vorbis_info *vi,double s,int block, return(0); } -static int vorbis_encode_ath_setup(vorbis_info *vi,double s,int block, - athcurve *in, double *x){ - int i,is=s; - double ds; +static int vorbis_encode_ath_setup(vorbis_info *vi,int block){ codec_setup_info *ci=vi->codec_setup; vorbis_info_psy *p=ci->psy_param[block]; p->ath_adjatt=ci->hi.ath_floating_dB; p->ath_maxatt=ci->hi.ath_absolute_dB; - - ds=x[is]*(1.-ds)+x[is+1]*ds; - is=(int)ds; - ds-=is; - if(ds==0 && is>0){ - is--; - ds=1.; - } - - for(i=0;i<27;i++) - p->ath[i]=in[is].data[i]*(1.-ds)+in[is+1].data[i]*ds; return(0); } @@ -490,8 +469,15 @@ static int vorbis_encode_residue_setup(vorbis_info *vi,double s,int block, /* fill in all the books */ { int booklist=0,k; - r->groupbook=book_dup_or_new(ci,in[is].book_aux[block]); - ci->book_param[r->groupbook]=in[is].book_aux[block]; + + if(ci->hi.managed){ + r->groupbook=book_dup_or_new(ci,in[is].book_aux_managed[block]); + ci->book_param[r->groupbook]=in[is].book_aux_managed[block]; + }else{ + r->groupbook=book_dup_or_new(ci,in[is].book_aux[block]); + ci->book_param[r->groupbook]=in[is].book_aux[block]; + } + for(i=0;i<r->partitions;i++){ for(k=0;k<3;k++){ if(in[is].books_base[i][k]){ @@ -533,6 +519,63 @@ static int vorbis_encode_residue_setup(vorbis_info *vi,double s,int block, return(0); } +static double setting_to_approx_bitrate(vorbis_info *vi){ + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + ve_setup_data_template *setup=(ve_setup_data_template *)hi->setup; + int is=hi->base_setting; + double ds=hi->base_setting-is; + int ch=vi->channels; + double *r=setup->rate_mapping; + + if(r==NULL) + return(-1); + + return((r[is]*(1.-ds)+r[is+1]*ds)*ch); +} + +static void get_setup_template(vorbis_info *vi, + long ch,long srate, + double req,int q_or_bitrate){ + int i=0,j; + codec_setup_info *ci=vi->codec_setup; + highlevel_encode_setup *hi=&ci->hi; + + while(setup_list[i]){ + if(setup_list[i]->coupling_restriction==-1 || + setup_list[i]->coupling_restriction==ch){ + if(srate>=setup_list[i]->bitrate_min_restriction && + srate<=setup_list[i]->bitrate_max_restriction){ + int mappings=setup_list[i]->mappings; + double *map=(q_or_bitrate? + setup_list[i]->rate_mapping: + setup_list[i]->quality_mapping); + if(q_or_bitrate)req/=ch; + + /* the template matches. Does the requested quality mode + fall within this template's modes? */ + if(req<map[0])continue; + if(req>map[setup_list[i]->mappings])continue; + for(j=0;j<mappings;j++) + if(req>=map[j] && req<map[j+1])break; + /* an all-points match */ + hi->setup=setup_list[i]; + if(j==mappings) + hi->base_setting=j-.001; + else{ + float low=map[j]; + float high=map[j+1]; + float del=(req-low)/(high-low); + hi->base_setting=j+del; + } + return; + } + } + } + + hi->setup=NULL; +} + /* encoders will need to use vorbis_info_init beforehand and call vorbis_info clear when all done */ @@ -595,18 +638,22 @@ int vorbis_encode_setup_init(vorbis_info *vi){ ret|=vorbis_encode_psyset_setup(vi,hi->short_setting, setup->psy_noise_normal_start[0], setup->psy_noise_normal_partition[0], + setup->psy_noise_normal_thresh, 0); ret|=vorbis_encode_psyset_setup(vi,hi->short_setting, setup->psy_noise_normal_start[0], setup->psy_noise_normal_partition[0], + setup->psy_noise_normal_thresh, 1); ret|=vorbis_encode_psyset_setup(vi,hi->long_setting, setup->psy_noise_normal_start[1], setup->psy_noise_normal_partition[1], + setup->psy_noise_normal_thresh, 2); ret|=vorbis_encode_psyset_setup(vi,hi->long_setting, setup->psy_noise_normal_start[1], setup->psy_noise_normal_partition[1], + setup->psy_noise_normal_thresh, 3); /* tone masking setup */ @@ -641,23 +688,15 @@ int vorbis_encode_setup_init(vorbis_info *vi){ setup->psy_noise_compand, setup->psy_noise_compand_long_mapping); - /* peak guarding setup */ + /* peak guarding setup */ ret|=vorbis_encode_peak_setup(vi,hi->block[i0].tone_peaklimit_setting,0, - setup->psy_tone_masterdepth, - setup->psy_tone_dBsuppress, - setup->psy_tone_depth); + setup->psy_tone_dBsuppress); ret|=vorbis_encode_peak_setup(vi,hi->block[1].tone_peaklimit_setting,1, - setup->psy_tone_masterdepth, - setup->psy_tone_dBsuppress, - setup->psy_tone_depth); + setup->psy_tone_dBsuppress); ret|=vorbis_encode_peak_setup(vi,hi->block[2].tone_peaklimit_setting,2, - setup->psy_tone_masterdepth, - setup->psy_tone_dBsuppress, - setup->psy_tone_depth); + setup->psy_tone_dBsuppress); ret|=vorbis_encode_peak_setup(vi,hi->block[3].tone_peaklimit_setting,3, - setup->psy_tone_masterdepth, - setup->psy_tone_dBsuppress, - setup->psy_tone_depth); + setup->psy_tone_dBsuppress); /* noise bias setup */ ret|=vorbis_encode_noisebias_setup(vi,hi->block[i0].noise_bias_setting,0, @@ -677,18 +716,10 @@ int vorbis_encode_setup_init(vorbis_info *vi){ setup->psy_noise_bias_long, setup->psy_noiseguards); - ret|=vorbis_encode_ath_setup(vi,hi->ath_setting,0, - setup->psy_ath, - setup->psy_ath_mapping); - ret|=vorbis_encode_ath_setup(vi,hi->ath_setting,1, - setup->psy_ath, - setup->psy_ath_mapping); - ret|=vorbis_encode_ath_setup(vi,hi->ath_setting,2, - setup->psy_ath, - setup->psy_ath_mapping); - ret|=vorbis_encode_ath_setup(vi,hi->ath_setting,3, - setup->psy_ath, - setup->psy_ath_mapping); + ret|=vorbis_encode_ath_setup(vi,0); + ret|=vorbis_encode_ath_setup(vi,1); + ret|=vorbis_encode_ath_setup(vi,2); + ret|=vorbis_encode_ath_setup(vi,3); if(ret){ vorbis_info_clear(vi); @@ -719,7 +750,7 @@ int vorbis_encode_setup_init(vorbis_info *vi){ ci->bi.queue_hardmax=hi->bitrate_max; ci->bi.queue_avgmin=hi->bitrate_av_lo; ci->bi.queue_avgmax=hi->bitrate_av_hi; - ci->bi.avgfloat_downslew_max=999999.f; + ci->bi.avgfloat_downslew_max=-999999.f; ci->bi.avgfloat_upslew_max=999999.f; } @@ -727,63 +758,6 @@ int vorbis_encode_setup_init(vorbis_info *vi){ } -static double setting_to_approx_bitrate(vorbis_info *vi){ - codec_setup_info *ci=vi->codec_setup; - highlevel_encode_setup *hi=&ci->hi; - ve_setup_data_template *setup=(ve_setup_data_template *)hi->setup; - int is=hi->base_setting; - double ds=hi->base_setting-is; - int ch=vi->channels; - double *r=setup->rate_mapping; - - if(r==NULL) - return(-1); - - return((r[is]*(1.-ds)+r[is+1]*ds)*ch); -} - -static void get_setup_template(vorbis_info *vi, - long ch,long srate, - double req,int q_or_bitrate){ - int i=0,j; - codec_setup_info *ci=vi->codec_setup; - highlevel_encode_setup *hi=&ci->hi; - - while(setup_list[i]){ - if(setup_list[i]->coupling_restriction==-1 || - setup_list[i]->coupling_restriction==ch){ - if(srate>=setup_list[i]->bitrate_min_restriction && - srate<=setup_list[i]->bitrate_max_restriction){ - int mappings=setup_list[i]->mappings; - double *map=(q_or_bitrate? - setup_list[i]->rate_mapping: - setup_list[i]->quality_mapping); - if(q_or_bitrate)req/=ch; - - /* the template matches. Does the requested quality mode - fall within this template's modes? */ - if(req<map[0])continue; - if(req>map[setup_list[i]->mappings])continue; - for(j=0;j<mappings;j++) - if(req>=map[j] && req<map[j+1])break; - /* an all-points match */ - hi->setup=setup_list[i]; - if(j==mappings) - hi->base_setting=j-.001; - else{ - float low=map[j]; - float high=map[j+1]; - float del=(req-low)/(high-low); - hi->base_setting=j+del; - } - return; - } - } - } - - hi->setup=NULL; -} - static int vorbis_encode_setup_setting(vorbis_info *vi, long channels, long rate){ @@ -805,7 +779,7 @@ static int vorbis_encode_setup_setting(vorbis_info *vi, hi->managed=0; hi->impulse_block_p=1; - //hi->noise_normalize_p=1; + hi->noise_normalize_p=1; hi->stereo_point_setting=hi->base_setting; hi->lowpass_kHz[0]= @@ -819,7 +793,6 @@ static int vorbis_encode_setup_setting(vorbis_info *vi, hi->amplitude_track_dBpersec=-6.; hi->trigger_setting=hi->base_setting; - hi->ath_setting=hi->base_setting; for(i=0;i<4;i++){ hi->block[i].tone_mask_setting=hi->base_setting; |