[xiph-cvs] cvs commit: vorbis/lib/modes psych_44.h

Monty xiphmont at xiph.org
Sun Dec 16 21:39:27 PST 2001



xiphmont    01/12/16 21:39:26

  Modified:    .        Tag: branch_monty_20011217 configure.in
               lib      Tag: branch_monty_20011217 Makefile bitrate.c
                        codec_internal.h info.c mapping0.c os.h psy.h
                        vorbisenc.c
               lib/modes Tag: branch_monty_20011217 psych_44.h
  Log:
  rearrangement of vorbisenc.c into the proto-form of the two-tier
  detailed/high-level setup API
  
  Monty

Revision  Changes    Path
No                   revision

No                   revision

1.46.2.1  +4 -4      vorbis/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis/configure.in,v
retrieving revision 1.46
retrieving revision 1.46.2.1
diff -u -r1.46 -r1.46.2.1
--- configure.in	2001/12/16 04:15:45	1.46
+++ configure.in	2001/12/17 05:39:23	1.46.2.1
@@ -75,7 +75,7 @@
 
         case $host in 
         *86-*-linux*)
-		DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+		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 -static"
@@ -120,11 +120,11 @@
                   PROFILE=${PROFILE}" -D__NO_MATH_INLINES"
                   fi;;
         *-*-linux*)
-		DEBUG="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+		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 -D__NO_MATH_INLINES -fsigned-char -mv8"
+		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*)
@@ -132,7 +132,7 @@
                 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 -D__NO_MATH_INLINES -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

No                   revision

No                   revision

1.2.2.1   +4 -4      vorbis/lib/Makefile

Index: Makefile
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/Makefile,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- Makefile	2001/12/16 04:15:46	1.2
+++ Makefile	2001/12/17 05:39:23	1.2.2.1
@@ -62,7 +62,7 @@
 AS = @AS@
 CC = gcc
 CPP = gcc -E
-DEBUG = -g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char
+DEBUG = -g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char
 DLLTOOL = @DLLTOOL@
 ECHO = echo
 EXEEXT = 
@@ -78,7 +78,7 @@
 PROFILE = -pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char
 RANLIB = ranlib
 STRIP = strip
-VERSION = 1.0rc2
+VERSION = 1.0rc3
 VE_LIB_AGE = 0
 VE_LIB_CURRENT = 0
 VE_LIB_REVISION = 1
@@ -123,7 +123,7 @@
 LTLIBRARIES =  $(lib_LTLIBRARIES)
 
 
-DEFS =  -DPACKAGE=\"libvorbis\" -DVERSION=\"1.0rc2\" -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_SQRTF=1 -DHAVE_LOGF=1 -DHAVE_EXPF=1 -DHAVE_ACOSF=1 -DHAVE_ATANF=1 -DHAVE_FREXPF=1 -DHAVE_RINTF=1  -I. -I$(srcdir) -DTRAIN_RES
+DEFS =  -DPACKAGE=\"libvorbis\" -DVERSION=\"1.0rc3\" -DHAVE_DLFCN_H=1 -DHAVE_ALLOCA_H=1 -DHAVE_ALLOCA=1 -DHAVE_SQRTF=1 -DHAVE_LOGF=1 -DHAVE_EXPF=1 -DHAVE_ACOSF=1 -DHAVE_ATANF=1 -DHAVE_FREXPF=1 -DHAVE_RINTF=1  -I. -I$(srcdir) 
 CPPFLAGS = 
 LDFLAGS =  
 libvorbis_la_LIBADD = 
@@ -500,7 +500,7 @@
 
 
 debug:
-	$(MAKE) all CFLAGS="-g -Wall -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
+	$(MAKE) all CFLAGS="-g -Wall -W -D_REENTRANT -D__NO_MATH_INLINES -fsigned-char"
 
 profile:
         $(MAKE) all CFLAGS="-pg -g -O20 -ffast-math -D_REENTRANT -fsigned-char"

1.3.2.1   +1 -2      vorbis/lib/bitrate.c

Index: bitrate.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/bitrate.c,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- bitrate.c	2001/12/14 07:21:16	1.3
+++ bitrate.c	2001/12/17 05:39:23	1.3.2.1
@@ -11,13 +11,12 @@
  ********************************************************************
 
  function: bitrate tracking and management
- last mod: $Id: bitrate.c,v 1.3 2001/12/14 07:21:16 xiphmont Exp $
+ last mod: $Id: bitrate.c,v 1.3.2.1 2001/12/17 05:39:23 xiphmont Exp $
 
  ********************************************************************/
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <unistd.h>
 #include <string.h>
 #include <math.h>
 #include <ogg/ogg.h>

1.10.2.1  +45 -2     vorbis/lib/codec_internal.h

Index: codec_internal.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codec_internal.h,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -u -r1.10 -r1.10.2.1
--- codec_internal.h	2001/12/12 09:45:24	1.10
+++ codec_internal.h	2001/12/17 05:39:23	1.10.2.1
@@ -10,7 +10,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec_internal.h,v 1.10 2001/12/12 09:45:24 xiphmont Exp $
+ last mod: $Id: codec_internal.h,v 1.10.2.1 2001/12/17 05:39:23 xiphmont Exp $
 
  ********************************************************************/
 
@@ -79,7 +79,48 @@
 
 } backend_lookup_state;
 
-/* vorbis_info contains all the setup information specific to the
+/* high level configuration information for setting things up
+   step-by-step with the detaile vorbis_encode_ctl interface */
+
+typedef struct highlevel_block {
+  double tone_mask_quality;
+  double tone_peaklimit_quality;
+
+  double noise_bias_quality;
+  double noise_compand_quality;
+
+  double ath_quality;
+
+} highlevel_block;
+
+typedef struct highlevel_encode_setup {
+  double base_quality;       /* these have to be tracked by the ctl */
+  double base_quality_short; /* interface so that the right books get */
+  double base_quality_long;  /* chosen... */
+
+  int short_block_p;
+  int long_block_p;
+  int impulse_block_p;
+
+  int stereo_couple_p;
+  int stereo_backfill_p;
+  int residue_backfill_p;
+
+  int    stereo_point_dB;
+  double stereo_point_kHz[2];
+  double lowpass_kHz[2];
+
+  double ath_floating_dB;
+  double ath_absolute_dB;
+
+  double amplitude_track_dBpersec;
+  double trigger_quality;
+
+  highlevel_block blocktype[4]; /* impulse, padding, trans, long */
+  
+} highlevel_encode_setup;
+
+/* codec_setup_info contains all the setup information specific to the
    specific compression/decompression mode in progress (eg,
    psychoacoustic settings, channel setup, options, codebook
    etc).  
@@ -118,7 +159,9 @@
 
   vorbis_info_psy        *psy_param[64]; /* encode only */
   vorbis_info_psy_global psy_g_param;
+
   bitrate_manager_info   bi;
+  highlevel_encode_setup hi;
 
   int    passlimit[32];     /* iteration limit per couple/quant pass */
   int    coupling_passes;

1.49.2.1  +2 -2      vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.49
retrieving revision 1.49.2.1
diff -u -r1.49 -r1.49.2.1
--- info.c	2001/12/12 09:45:25	1.49
+++ info.c	2001/12/17 05:39:24	1.49.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.49 2001/12/12 09:45:25 xiphmont Exp $
+ last mod: $Id: info.c,v 1.49.2.1 2001/12/17 05:39:24 xiphmont Exp $
 
  ********************************************************************/
 
@@ -416,7 +416,7 @@
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiphophorus libVorbis I 20011212";
+  char temp[]="Xiphophorus libVorbis I 20011217";
   int bytes = strlen(temp);
 
   /* preamble */  

1.39.2.1  +1 -15     vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.39
retrieving revision 1.39.2.1
diff -u -r1.39 -r1.39.2.1
--- mapping0.c	2001/12/16 04:15:46	1.39
+++ mapping0.c	2001/12/17 05:39:24	1.39.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.39 2001/12/16 04:15:46 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.39.2.1 2001/12/17 05:39:24 xiphmont Exp $
 
  ********************************************************************/
 
@@ -555,8 +555,6 @@
               lqua[j]=lpcm[j]-lsof[j];
           }
         }else{
-	  char buf[80];
-	  
           _vp_quantize_couple(look->psy_look[blocktype],
                               info,
                               pcm,
@@ -565,10 +563,6 @@
                               nonzero,
                               i);
           
-	  //sprintf(buf,"quant%d",i);
-	  //for(j=0;j<vi->channels;j++)
-	  //_analysis_output(buf,seq+j,quantized[j],n/2,1,0);
-	  
         }
       }
     }
@@ -680,8 +674,6 @@
   /* only MDCT right now.... */
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
-    //_analysis_output("out",seq+i,pcm,n/2,1,1);
-    //_analysis_output("lout",seq+i,pcm,n/2,0,0);
     mdct_backward(b->transform[vb->W][0],pcm,pcm);
   }
 
@@ -695,14 +687,8 @@
       for(j=0;j<n;j++)
         pcm[j]=0.f;
 
-    //_analysis_output("final",seq,pcm,n,0,0);
   }
             
-  /* now apply the decoded post-window time information */
-  /* NOT IMPLEMENTED */
-
-  fprintf(stderr,"seq %d\r",seq);
-    
   /* all done! */
   return(0);
 }

1.27.6.1  +2 -2      vorbis/lib/os.h

Index: os.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/os.h,v
retrieving revision 1.27
retrieving revision 1.27.6.1
diff -u -r1.27 -r1.27.6.1
--- os.h	2001/08/13 01:36:57	1.27
+++ os.h	2001/12/17 05:39:24	1.27.6.1
@@ -13,7 +13,7 @@
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h,v 1.27 2001/08/13 01:36:57 xiphmont Exp $
+ last mod: $Id: os.h,v 1.27.6.1 2001/12/17 05:39:24 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,7 +24,7 @@
 #  define _V_IFDEFJAIL_H_
 
 #  ifdef __GNUC__
-#    define STIN static inline
+#    define STIN static __inline__
 #  elif _WIN32
 #    define STIN static __inline
 #else

1.25.2.1  +2 -2      vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.25
retrieving revision 1.25.2.1
diff -u -r1.25 -r1.25.2.1
--- psy.h	2001/12/12 09:45:25	1.25
+++ psy.h	2001/12/17 05:39:24	1.25.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.25 2001/12/12 09:45:25 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.25.2.1 2001/12/17 05:39:24 xiphmont Exp $
 
  ********************************************************************/
 
@@ -116,7 +116,7 @@
 
   float *ath;
   long  *octave;             /* in n.ocshift format */
-  unsigned long *bark;
+  long  *bark;
 
   long  firstoc;
   long  shiftoc;

1.23.2.1  +311 -221  vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -r1.23 -r1.23.2.1
--- vorbisenc.c	2001/12/16 04:15:47	1.23
+++ vorbisenc.c	2001/12/17 05:39:24	1.23.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.23 2001/12/16 04:15:47 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.23.2.1 2001/12/17 05:39:24 xiphmont Exp $
 
  ********************************************************************/
 
@@ -64,7 +64,7 @@
 static vorbis_info_mapping0 _mapping_set_long={
   1, {0,0}, {0}, {1}, {1}, {2,3}, 0,{0},{0}};
 
-static int vorbis_encode_toplevel_init(vorbis_info *vi,int small,int large,int ch,long rate){
+static int vorbis_encode_toplevel_setup(vorbis_info *vi,int small,int large,int ch,long rate){
   if(vi && vi->codec_setup){
     codec_setup_info *ci=vi->codec_setup;
 
@@ -104,7 +104,7 @@
   return(OV_EINVAL);
 }
 
-static int vorbis_encode_floor_init(vorbis_info *vi,double q,int block,
+static int vorbis_encode_floor_setup(vorbis_info *vi,double q,int block,
                                     static_codebook    ***books, 
                                     vorbis_info_floor1 *in, 
                                     ...){
@@ -150,7 +150,7 @@
   return(0);
 }
 
-static int vorbis_encode_global_psych_init(vorbis_info *vi,double q,
+static int vorbis_encode_global_psych_setup(vorbis_info *vi,double q,
                                            vorbis_info_psy_global *in, ...){
   int i,iq=q*10;
   double x[11],dq;
@@ -185,24 +185,14 @@
     g->preecho_thresh[i]=in[iq].preecho_thresh[i]*(1.-dq)+in[iq+1].preecho_thresh[i]*dq;
     g->postecho_thresh[i]=in[iq].postecho_thresh[i]*(1.-dq)+in[iq+1].postecho_thresh[i]*dq;
   }
-  g->ampmax_att_per_sec=in[iq].ampmax_att_per_sec*(1.-dq)+in[iq+1].ampmax_att_per_sec*dq;
+  g->ampmax_att_per_sec=ci->hi.amplitude_track_dBpersec;
   return(0);
 }
 
-static int vorbis_encode_psyset_init(vorbis_info *vi,double q,int block,
-					   vorbis_info_psy *in){
-  int iq=q*10;
-  double dq;
+static int vorbis_encode_psyset_setup(vorbis_info *vi,int block){
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
 
-  if(iq==10){
-    iq=9;
-    dq=1.;
-  }else{
-    dq=q*10.-iq;
-  }
-
   if(block>=ci->psys)
     ci->psys=block+1;
   if(!p){
@@ -210,22 +200,51 @@
     ci->psy_param[block]=p;
   }
 
-  memcpy(p,in+(int)(q*10.),sizeof(*p));
-  
-  p->ath_adjatt=in[iq].ath_adjatt*(1.-dq)+in[iq+1].ath_adjatt*dq;
-  p->ath_maxatt=in[iq].ath_maxatt*(1.-dq)+in[iq+1].ath_maxatt*dq;
+  memcpy(p,&_psy_info_template,sizeof(*p));
+
+  return 0;
+}
+
+static int vorbis_encode_tonemask_setup(vorbis_info *vi,double q,int block,
+				       double *att,
+				       double *max,
+				       int *peaklimit_bands,
+				       vp_adjblock *in){
+  int i,j,iq;
+  double dq;
+  codec_setup_info *ci=vi->codec_setup;
+  vorbis_info_psy *p=ci->psy_param[block];
 
-  p->tone_masteratt=in[iq].tone_masteratt*(1.-dq)+in[iq+1].tone_masteratt*dq;
-  p->tone_guard=in[iq].tone_guard*(1.-dq)+in[iq+1].tone_guard*dq;
-  p->tone_abs_limit=in[iq].tone_abs_limit*(1.-dq)+in[iq+1].tone_abs_limit*dq;
+  iq=q*10;
+  if(iq==10){
+    iq=9;
+    dq=1.;
+  }else{
+    dq=q*10.-iq;
+  }
 
-  p->noisemaxsupp=in[iq].noisemaxsupp*(1.-dq)+in[iq+1].noisemaxsupp*dq;
+  p->tone_masteratt=att[iq]*(1.-dq)+att[iq+1]*dq;
+  p->max_curve_dB=max[iq];
+  p->curvelimitp=peaklimit_bands[iq];
 
+  iq=q*5.;
+  if(iq==5){
+    iq=5;
+    dq=1.;
+  }else{
+    dq=q*5.-iq;
+  }
+  
+  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[iq].block[i][j]*(1.-dq)+in[iq+1].block[i][j]*dq;
   return(0);
 }
 
-static int vorbis_encode_compand_init(vorbis_info *vi,double q,int block,
-					   float in[][NOISE_COMPAND_LEVELS], ...){
+
+static int vorbis_encode_compand_setup(vorbis_info *vi,double q,int block,
+				      float in[][NOISE_COMPAND_LEVELS], ...){
   int i,iq=q*10;
   double x[11],dq;
   codec_setup_info *ci=vi->codec_setup;
@@ -258,34 +277,28 @@
   return(0);
 }
 
-static int vorbis_encode_tonemask_init(vorbis_info *vi,double q,int block,
-				       vp_adjblock *in){
-  int i,j,iq=q*5.;
+static int vorbis_encode_peak_setup(vorbis_info *vi,double q,int block,
+				    double *guard,
+				    double *suppress,
+				    vp_adjblock *in){
+  int i,j,iq;
   double dq;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_psy *p=ci->psy_param[block];
 
-  if(iq==5){
-    iq=5;
+  iq=q*10;
+  if(iq==10){
+    iq=9;
     dq=1.;
   }else{
-    dq=q*5.-iq;
+    dq=q*10.-iq;
   }
 
-  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[iq].block[i][j]*(1.-dq)+in[iq+1].block[i][j]*dq;
-  return(0);
-}
-
-static int vorbis_encode_peak_init(vorbis_info *vi,double q,int block,
-				   vp_adjblock *in){
-  int i,j,iq=q*5.;
-  double dq;
-  codec_setup_info *ci=vi->codec_setup;
-  vorbis_info_psy *p=ci->psy_param[block];
+  p->peakattp=1;
+  p->tone_guard=guard[iq]*(1.-dq)+guard[iq+1]*dq;
+  p->tone_abs_limit=suppress[iq]*(1.-dq)+suppress[iq+1]*dq;
 
+  iq=q*5.;
   if(iq==5){
     iq=5;
     dq=1.;
@@ -300,8 +313,9 @@
   return(0);
 }
 
-static int vorbis_encode_noisebias_init(vorbis_info *vi,double q,int block,
-					int in[][17],int guard[33]){
+static int vorbis_encode_noisebias_setup(vorbis_info *vi,double q,int block,
+					 double *suppress,
+					 int in[][17],int guard[33]){
   int i,iq=q*10;
   double dq;
   codec_setup_info *ci=vi->codec_setup;
@@ -314,17 +328,18 @@
     dq=q*10.-iq;
   }
 
+  p->noisemaxsupp=suppress[iq]*(1.-dq)+suppress[iq+1]*dq;
   p->noisewindowlomin=guard[iq*3];
   p->noisewindowhimin=guard[iq*3+1];
   p->noisewindowfixed=guard[iq*3+2];
-
+  
   for(i=0;i<P_BANDS;i++)
     p->noiseoff[i]=in[iq][i]*(1.-dq)+in[iq+1][i]*dq;
   return(0);
 }
 
-static int vorbis_encode_ath_init(vorbis_info *vi,double q,int block,
-				  float in[][27], ...){
+static int vorbis_encode_ath_setup(vorbis_info *vi,double q,int block,
+				   float in[][27], ...){
   int i,iq=q*10;
   double x[11],dq;
   codec_setup_info *ci=vi->codec_setup;
@@ -336,6 +351,9 @@
     x[i]=va_arg(ap,double);
   va_end(ap);
 
+  p->ath_adjatt=ci->hi.ath_floating_dB;
+  p->ath_maxatt=ci->hi.ath_absolute_dB;
+
   if(iq==10){
     iq=9;
     dq=1.;
@@ -365,15 +383,15 @@
   return(ci->books++);
 }
 
-static int vorbis_encode_residue_init(vorbis_info *vi,double q,int block,
-				      int coupled_p,
-				      int stereo_backfill_p,
-				      int residue_backfill_p,
-				      vorbis_residue_template *in, ...){
+static int vorbis_encode_residue_setup(vorbis_info *vi,double q,int block,
+				       int coupled_p,
+				       int stereo_backfill_p,
+				       int residue_backfill_p,
+				       vorbis_residue_template *in,
+				       int point_dB,
+				       double point_kHz){
 
   int i,iq=q*10;
-  int a[11];
-  double c[11];
   int n,k;
   int partition_position;
   int res_position;
@@ -383,15 +401,7 @@
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_residue0 *r;
   vorbis_info_psy *psy=ci->psy_param[block*2];
-  va_list ap;
   
-  va_start(ap,in);
-  for(i=0;i<11;i++)
-    a[i]=va_arg(ap,int);
-  for(i=0;i<11;i++)
-    c[i]=va_arg(ap,double);
-  va_end(ap);
-  
   /* may be re-called due to ctl */
   if(ci->residue_param[block])
     /* free preexisting instance */
@@ -417,12 +427,12 @@
   switch(ci->residue_type[block]){
   case 1:
     n=r->end=ci->blocksizes[block?1:0]>>1; /* to be adjusted by lowpass later */
-    partition_position=rint((double)c[iq]*1000/(vi->rate/2)*n/r->grouping);
+    partition_position=rint(point_kHz*1000./(vi->rate/2)*n/r->grouping);
     res_position=partition_position*r->grouping;
     break;
   case 2:
     n=r->end=(ci->blocksizes[block?1:0]>>1)*vi->channels; /* to be adjusted by lowpass later */
-    partition_position=rint((double)c[iq]*1000/(vi->rate/2)*n/r->grouping);
+    partition_position=rint(point_kHz*1000./(vi->rate/2)*n/r->grouping);
     res_position=partition_position*r->grouping/vi->channels;
     break;
   }
@@ -432,12 +442,11 @@
 
   for(i=0;i<r->partitions;i++)
     for(k=0;k<3;k++)
-      if(in[iq].books_base[a[iq]][i][k])
+      if(in[iq].books_base[point_dB][i][k])
         r->secondstages[i]|=(1<<k);
   
   ci->passlimit[0]=3;
     
-  
   if(coupled_p){
     vorbis_info_mapping0 *map=ci->map_param[block];
 
@@ -455,21 +464,22 @@
     psy->couple_pass[0].couple_pass[1].limit=9999;
     psy->couple_pass[0].couple_pass[1].outofphase_redundant_flip_p=1;
     psy->couple_pass[0].couple_pass[1].outofphase_requant_limit=9e10;
-    psy->couple_pass[0].couple_pass[1].amppost_point=stereo_threshholds[a[iq]];
-    amplitude_select=a[iq];
+    psy->couple_pass[0].couple_pass[1].amppost_point=
+      stereo_threshholds[point_dB];
+    amplitude_select=point_dB;
 
-    if(stereo_backfill_p && a[iq]){
+    if(stereo_backfill_p && amplitude_select){
       memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
              sizeof(*psy->couple_pass));
-      amplitude_select=a[iq]-1;
-      psy->couple_pass[1].couple_pass[1].amppost_point=stereo_threshholds[a[iq]-1];
+      amplitude_select=amplitude_select-1;
+      psy->couple_pass[1].couple_pass[1].amppost_point=stereo_threshholds[amplitude_select-1];
       ci->passlimit[1]=4;
       for(i=0;i<r->partitions;i++)
-	if(in[iq].books_stereo_backfill[a[iq]-1][i])
+	if(in[iq].books_stereo_backfill[amplitude_select-1][i])
           r->secondstages[i]|=8;
       iterations++;
     }
-
+    
     if(residue_backfill_p){
       memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
              sizeof(*psy->couple_pass));
@@ -480,7 +490,7 @@
           r->secondstages[i]|=(1<<(iterations+2));
       ci->passlimit[iterations]=ci->passlimit[iterations-1]+1;
       iterations++;
-
+      
       memcpy(psy->couple_pass+iterations,psy->couple_pass+iterations-1,
              sizeof(*psy->couple_pass));
       psy->couple_pass[iterations].granulem=.1111111111;
@@ -508,7 +518,7 @@
     }else
       ci->coupling_passes=1;
   }
-
+  
   memcpy(&ci->psy_param[block*2+1]->couple_pass,
          &ci->psy_param[block*2]->couple_pass,
          sizeof(psy->couple_pass[0]));
@@ -520,17 +530,17 @@
     ci->book_param[ci->books++]=in[iq].book_aux[block];
     for(i=0;i<r->partitions;i++){
       for(k=0;k<3;k++){
-	if(in[iq].books_base[a[iq]][i][k]){
-	  int bookid=book_dup_or_new(ci,in[iq].books_base[a[iq]][i][k]);
+	if(in[iq].books_base[point_dB][i][k]){
+	  int bookid=book_dup_or_new(ci,in[iq].books_base[point_dB][i][k]);
           r->booklist[booklist++]=bookid;
-	  ci->book_param[bookid]=in[iq].books_base[a[iq]][i][k];
+	  ci->book_param[bookid]=in[iq].books_base[point_dB][i][k];
         }
       }
-      if(coupled_p && stereo_backfill_p && a[iq] &&
-	 in[iq].books_stereo_backfill[a[iq]][i]){
-	int bookid=book_dup_or_new(ci,in[iq].books_stereo_backfill[a[iq]][i]);
+      if(coupled_p && stereo_backfill_p && point_dB &&
+	 in[iq].books_stereo_backfill[point_dB][i]){
+	int bookid=book_dup_or_new(ci,in[iq].books_stereo_backfill[point_dB][i]);
         r->booklist[booklist++]=bookid;
-	ci->book_param[bookid]=in[iq].books_stereo_backfill[a[iq]][i];
+	ci->book_param[bookid]=in[iq].books_stereo_backfill[point_dB][i];
       }
       if(residue_backfill_p){
         for(k=0;k<2;k++){
@@ -547,21 +557,15 @@
   return(0);
 }      
 
-static int vorbis_encode_lowpass_init(vorbis_info *vi,double q,int block,...){
-  int i,iq=q*10;
-  double x[11],dq;
+static int vorbis_encode_lowpass_setup(vorbis_info *vi,double q,int block){
+  int iq=q*10;
+  double dq;
   double freq;
   codec_setup_info *ci=vi->codec_setup;
   vorbis_info_floor1 *f=ci->floor_param[block];
   vorbis_info_residue0 *r=ci->residue_param[block];
   int blocksize=ci->blocksizes[block]>>1;
   double nyq=vi->rate/2.;
-  va_list ap;
-  
-  va_start(ap,block);
-  for(i=0;i<11;i++)
-    x[i]=va_arg(ap,double);
-  va_end(ap);
 
   if(iq==10){
     iq=9;
@@ -570,7 +574,7 @@
     dq=q*10.-iq;
   }
   
-  freq=(x[iq]*(1.-dq)+x[iq+1]*dq)*1000.;
+  freq=ci->hi.lowpass_kHz[block]*1000.;
   if(freq>vi->rate/2)freq=vi->rate/2;
   /* lowpass needs to be set in the floor and the residue. */
 
@@ -595,146 +599,232 @@
 /* encoders will need to use vorbis_info_init beforehand and call
    vorbis_info clear when all done */
 
-int vorbis_encode_init_vbr(vorbis_info *vi,
-			   long channels,
-			   long rate,
-			   
-			   float base_quality /* 0. to 1. */
-			   ){
-  int ret=0;
+/* two interfaces; this, more detailed one, and later a convenience
+   layer on top */
 
-  base_quality+=.001;
-  if(base_quality<0.)base_quality=0.;
-  if(base_quality>.999)base_quality=.999;
+/* the final setup call */
+int vorbis_encode_setup_init(vorbis_info *vi){
+  int ret=0;
+  long rate=vi->rate;
+  long channels=vi->channels;
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
 
-  if(rate>40000){
-    ret|=vorbis_encode_toplevel_init(vi,256,2048,channels,rate);
-    ret|=vorbis_encode_floor_init(vi,base_quality,0,_floor_44_128_books,_floor_44_128,
-				  0,1,1,2,2,2,2,2,2,2,2);
-    ret|=vorbis_encode_floor_init(vi,base_quality,1,_floor_44_1024_books,_floor_44_1024,
-				  0,0,0,0,0,0,0,0,0,0,0);
-    
-    ret|=vorbis_encode_global_psych_init(vi,base_quality,_psy_global_44,
-					 0., 1., 1.5, 2., 2., 2., 2., 2., 2., 2., 2.);
-    
-    ret|=vorbis_encode_psyset_init(vi,base_quality,0,_psy_settings);
-    ret|=vorbis_encode_psyset_init(vi,base_quality,1,_psy_settings);
-    ret|=vorbis_encode_psyset_init(vi,base_quality,2,_psy_settings);
-    ret|=vorbis_encode_psyset_init(vi,base_quality,3,_psy_settings);
-
-    ret|=vorbis_encode_tonemask_init(vi,base_quality,0,_vp_tonemask_adj_otherblock);
-    ret|=vorbis_encode_tonemask_init(vi,base_quality,1,_vp_tonemask_adj_otherblock);
-    ret|=vorbis_encode_tonemask_init(vi,base_quality,2,_vp_tonemask_adj_otherblock);
-    ret|=vorbis_encode_tonemask_init(vi,base_quality,3,_vp_tonemask_adj_longblock);
-
-    ret|=vorbis_encode_compand_init(vi,base_quality,0,_psy_compand_44_short,
-				    1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-    ret|=vorbis_encode_compand_init(vi,base_quality,1,_psy_compand_44_short,
-				    1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-    ret|=vorbis_encode_compand_init(vi,base_quality,2,_psy_compand_44,
-				    1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
-    ret|=vorbis_encode_compand_init(vi,base_quality,3,_psy_compand_44,
-				    1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
+  ret|=vorbis_encode_floor_setup(vi,hi->base_quality_short,0,
+				_floor_44_128_books,_floor_44_128,
+				0,1,1,2,2,2,2,2,2,2,2);
+  ret|=vorbis_encode_floor_setup(vi,hi->base_quality_long,1,
+				_floor_44_1024_books,_floor_44_1024,
+				0,0,0,0,0,0,0,0,0,0,0);
+  
+  ret|=vorbis_encode_global_psych_setup(vi,hi->trigger_quality,_psy_global_44,
+				       0., 1., 1.5, 2., 2., 2., 2., 2., 2., 2., 2.);
+
+  ret|=vorbis_encode_psyset_setup(vi,0);
+  ret|=vorbis_encode_psyset_setup(vi,1);
+  ret|=vorbis_encode_psyset_setup(vi,2);
+  ret|=vorbis_encode_psyset_setup(vi,3);
+  
+  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[0].tone_mask_quality,0,
+				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
+				    _vp_tonemask_adj_otherblock);
+  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[1].tone_mask_quality,1,
+				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
+				    _vp_tonemask_adj_otherblock);
+  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[2].tone_mask_quality,2,
+				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
+				    _vp_tonemask_adj_otherblock);
+  ret|=vorbis_encode_tonemask_setup(vi,hi->blocktype[3].tone_mask_quality,3,
+				    _psy_tone_masteratt,_psy_tone_0dB,_psy_ehmer_bandlimit,
+				    _vp_tonemask_adj_longblock);
+  
+  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[0].noise_compand_quality,
+				  0,_psy_compand_44_short,
+				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
+  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[1].noise_compand_quality,
+				  1,_psy_compand_44_short,
+				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
+  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[2].noise_compand_quality,
+				  2,_psy_compand_44,
+				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
+  ret|=vorbis_encode_compand_setup(vi,hi->blocktype[3].noise_compand_quality,
+				  3,_psy_compand_44,
+				  1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.);
     
-    ret|=vorbis_encode_peak_init(vi,base_quality,0,_vp_peakguard);
-    ret|=vorbis_encode_peak_init(vi,base_quality,1,_vp_peakguard);
-    ret|=vorbis_encode_peak_init(vi,base_quality,2,_vp_peakguard);
-    ret|=vorbis_encode_peak_init(vi,base_quality,3,_vp_peakguard);
+  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[0].tone_peaklimit_quality,
+				0,_psy_tone_masterguard,_psy_tone_suppress,
+				_vp_peakguard);
+  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[1].tone_peaklimit_quality,
+				1,_psy_tone_masterguard,_psy_tone_suppress,
+				_vp_peakguard);
+  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[2].tone_peaklimit_quality,
+				2,_psy_tone_masterguard,_psy_tone_suppress,
+				_vp_peakguard);
+  ret|=vorbis_encode_peak_setup(vi,hi->blocktype[3].tone_peaklimit_quality,
+				3,_psy_tone_masterguard,_psy_tone_suppress,
+				_vp_peakguard);
     
-    ret|=vorbis_encode_noisebias_init(vi,base_quality,0,_psy_noisebias_impulse,
+  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[0].noise_bias_quality,
+				    0,_psy_noise_suppress,_psy_noisebias_impulse,
+				    _psy_noiseguards_short);
+  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[1].noise_bias_quality,
+				    1,_psy_noise_suppress,_psy_noisebias_other,
                                       _psy_noiseguards_short);
-    ret|=vorbis_encode_noisebias_init(vi,base_quality,1,_psy_noisebias_other,
-				      _psy_noiseguards_short);
-    ret|=vorbis_encode_noisebias_init(vi,base_quality,2,_psy_noisebias_other,
-				      _psy_noiseguards_long);
-    ret|=vorbis_encode_noisebias_init(vi,base_quality,3,_psy_noisebias_long,
-				      _psy_noiseguards_long);
-
-    ret|=vorbis_encode_ath_init(vi,base_quality,0,ATH_Bark_dB,
-				0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-    ret|=vorbis_encode_ath_init(vi,base_quality,1,ATH_Bark_dB,
-				0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-    ret|=vorbis_encode_ath_init(vi,base_quality,2,ATH_Bark_dB,
-				0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-    ret|=vorbis_encode_ath_init(vi,base_quality,3,ATH_Bark_dB,
-				0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
-
-    if(ret){
-      vorbis_info_clear(vi);
-      return ret; 
-    }
+  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[2].noise_bias_quality,
+				      2,_psy_noise_suppress,_psy_noisebias_other,
+				    _psy_noiseguards_long);
+  ret|=vorbis_encode_noisebias_setup(vi,hi->blocktype[3].noise_bias_quality,
+				    3,_psy_noise_suppress,_psy_noisebias_long,
+				    _psy_noiseguards_long);
+
+  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[0].ath_quality,0,ATH_Bark_dB,
+			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
+  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[1].ath_quality,1,ATH_Bark_dB,
+			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
+  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[2].ath_quality,2,ATH_Bark_dB,
+			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
+  ret|=vorbis_encode_ath_setup(vi,hi->blocktype[3].ath_quality,3,ATH_Bark_dB,
+			      0., 0., 0., 0., .2, .5, 1., 1., 1.5, 2., 2.);
 
-    switch(channels){
-    case 2:
-      /* setup specific to stereo coupling */
-
-      /* unmanaged, one iteration residue setup */
-      ret|=vorbis_encode_residue_init(vi,base_quality,0,
-				      1, /* coupled */
-				      0, /* no mid stereo backfill */
-				      0, /* no residue backfill */
-				      _residue_template_44_stereo,
-				      4,  3,  2,  2,   1,  0,  0,  0,  0,  0,  0,
-				      4., 6., 6., 6., 10., 6., 6., 4., 4., 4., 4.);
-      
-      ret|=vorbis_encode_residue_init(vi,base_quality,1,
-				      1, /* coupled */
-				      0, /* no mid stereo backfill */
-				      0, /* no residue backfill */
-				      _residue_template_44_stereo,
-				      4,  3,  2,   2,   1,  0,  0,  0,  0,  0,  0,
-				      6., 6., 6., 10., 10., 6., 6., 4., 4., 4., 4.);      
-
-      ret|=vorbis_encode_lowpass_init(vi,base_quality,0,
-				      15.1,15.8,16.5,17.9,20.5,
-				      999.,999.,999.,999.,999.,999.);
-      ret|=vorbis_encode_lowpass_init(vi,base_quality,1,
-				      15.1,15.8,16.5,17.9,20.5,
-				      999.,999.,999.,999.,999.,999.);
-      
-      return(ret);
+  if(ret){
+    vorbis_info_clear(vi);
+    return ret; 
+  }
 
-      break;
-    default:
-      /* setup specific to non-stereo (mono or uncoupled polyphonic)
-         coupling */
-      
-      /* unmanaged, one iteration residue setup */
-      ret|=vorbis_encode_residue_init(vi,base_quality,0,
-				      0, /* uncoupled */
-				      0, /* no mid stereo backfill */
-				      0, /* residue backfill */
-				      _residue_template_44_uncoupled,
-				      0,0,0,0,0,0,0,0,0,0,0,
-				      4.,4.,4.,6.,6.,6.,6.,4.,4.,4.,4.);
+  if(channels==2 && hi->stereo_couple_p){
+    /* setup specific to stereo coupling */
+    
+    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0,
+				    1, /* coupled */
+				    hi->stereo_backfill_p,
+				    hi->residue_backfill_p, 
+				    _residue_template_44_stereo,
+				    hi->stereo_point_dB,
+				    hi->stereo_point_kHz[0]);
       
-      ret|=vorbis_encode_residue_init(vi,base_quality,1,
-				      0, /* uncoupled */
-				      0, /* no mid stereo backfill */
-				      0, /* residue backfill */
-				      _residue_template_44_uncoupled,
-				      0,0,0,0,0,0,0,0,0,0,0,
-				      4.,4.,4.,6.,6.,6.,6.,4.,4.,4.,4.);      
-
-      ret|=vorbis_encode_lowpass_init(vi,base_quality,0,
-				      15.1,15.8,16.5,17.9,20.5,
-				      999.,999.,999.,999.,999.,999.);
-      ret|=vorbis_encode_lowpass_init(vi,base_quality,1,
-				      15.1,15.8,16.5,17.9,20.5,
-				      999.,999.,999.,999.,999.,999.);
+    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1,
+				    1, /* coupled */
+				    hi->stereo_backfill_p,
+				    hi->residue_backfill_p, 
+				    _residue_template_44_stereo,
+				    hi->stereo_point_dB,
+				    hi->stereo_point_kHz[1]);
+
+  }else{
+    /* setup specific to non-stereo (mono or uncoupled polyphonic)
+       coupling */
+    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_short,0,
+				    0, /* uncoupled */
+				    0,
+				    hi->residue_backfill_p, 
+				    _residue_template_44_uncoupled,
+				    0,
+				    hi->stereo_point_kHz[0]); /* just
+				    used as an encoding partitioning
+				    point */
       
-      return(ret);
-      break;
-    }
-    return(0);
-  }else
-    return(OV_EIMPL);
-
+    ret|=vorbis_encode_residue_setup(vi,hi->base_quality_long,1,
+				    0, /* uncoupled */
+				    0,
+				    hi->residue_backfill_p, 
+				    _residue_template_44_uncoupled,
+				    0,
+				    hi->stereo_point_kHz[1]); /* just
+				    used as an encoding partitioning
+				    point */
+  }
+  ret|=vorbis_encode_lowpass_setup(vi,hi->lowpass_kHz[0],0);
+  ret|=vorbis_encode_lowpass_setup(vi,hi->lowpass_kHz[1],1);
+    
   if(ret)
     vorbis_info_clear(vi);
   return(ret);
+
+}
+
+/* only populates the high-level settings so that we can tweak with ctl before final setup */
+int vorbis_encode_setup_vbr(vorbis_info *vi,
+			    long channels,
+			    long rate,
+			    
+			    float base_quality){
+  int ret=0,i,iq;
+  double dq;
+  codec_setup_info *ci=vi->codec_setup;
+  highlevel_encode_setup *hi=&ci->hi;
+  
+  base_quality+=.0001;
+  if(base_quality<0.)base_quality=0.;
+  if(base_quality>.999)base_quality=.999;
+
+  iq=base_quality*10;
+  if(iq==10){
+    iq=9;
+    dq=1.;
+  }else{
+    dq=base_quality*10.-iq;
+  }
+
+  ret|=vorbis_encode_toplevel_setup(vi,256,2048,channels,rate);
+  hi->base_quality=base_quality;
+  hi->base_quality_short=base_quality;
+  hi->base_quality_long=base_quality;
+  hi->trigger_quality=base_quality;
+
+  for(i=0;i<4;i++){
+    hi->blocktype[i].tone_mask_quality=base_quality;
+    hi->blocktype[i].tone_peaklimit_quality=base_quality;
+    hi->blocktype[i].noise_bias_quality=base_quality;
+    hi->blocktype[i].noise_compand_quality=base_quality;
+    hi->blocktype[i].ath_quality=base_quality;
+  }
+
+  hi->short_block_p=1;
+  hi->long_block_p=1;
+  hi->impulse_block_p=1;
+  hi->amplitude_track_dBpersec=-6.;
+
+  hi->stereo_couple_p=1; /* only relevant if a two channel input */
+  hi->stereo_backfill_p=0;
+  hi->residue_backfill_p=0;
+
+  /* set the ATH floaters */
+  hi->ath_floating_dB=_psy_ath_floater[iq]*(1.-dq)+_psy_ath_floater[iq+1]*dq;
+  hi->ath_absolute_dB=_psy_ath_abs[iq]*(1.-dq)+_psy_ath_abs[iq+1]*dq;
+
+  /* set stereo dB and Hz */
+  hi->stereo_point_dB=_psy_stereo_point_dB_44[iq];
+  hi->stereo_point_kHz[0]=_psy_stereo_point_kHz_44[0][iq]*(1.-dq)+
+    _psy_stereo_point_kHz_44[0][iq+1]*dq;
+  hi->stereo_point_kHz[1]=_psy_stereo_point_kHz_44[1][iq]*(1.-dq)+
+    _psy_stereo_point_kHz_44[1][iq+1]*dq;
+  
+  /* set lowpass */
+  hi->lowpass_kHz[0]=
+    hi->lowpass_kHz[1]=
+    _psy_lowpass_44[iq]*(1.-dq)+_psy_lowpass_44[iq+1]*dq;
+
+  return(ret);
 }
 
+int vorbis_encode_init_vbr(vorbis_info *vi,
+			   long channels,
+			   long rate,
+			   
+			   float base_quality /* 0. to 1. */
+			   ){
+  int ret=0;
+
+  ret=vorbis_encode_setup_vbr(vi,channels,rate,base_quality);
+  if(ret){
+    vorbis_info_clear(vi);
+    return ret; 
+  }
+  ret=vorbis_encode_setup_init(vi);
+  if(ret)
+    vorbis_info_clear(vi);
+  return(ret);
+}
 
 int vorbis_encode_init(vorbis_info *vi,
                        long channels,

No                   revision

No                   revision

1.3.2.1   +48 -78    vorbis/lib/modes/psych_44.h

Index: psych_44.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/psych_44.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -u -r1.3 -r1.3.2.1
--- psych_44.h	2001/12/14 07:21:29	1.3
+++ psych_44.h	2001/12/17 05:39:26	1.3.2.1
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h,v 1.3 2001/12/14 07:21:29 xiphmont Exp $
+ last mod: $Id: psych_44.h,v 1.3.2.1 2001/12/17 05:39:26 xiphmont Exp $
 
  ********************************************************************/
 
@@ -566,92 +566,50 @@
   10,10,100,
 };
 
-static vorbis_info_psy _psy_settings[11]={
-  /* zero */
-  { /* ATH style              ,float,min */ 
-    {-1},-100.,-110.,
+static double _psy_tone_masteratt[11]={
+  3.,0.,0.,0.,0.,0.,0.,0.,0.,0.,0.,
+};
+
+static double _psy_tone_masterguard[11]={
+  -18.,-24.,-24.,-24.,-26.,-40.,-40.,-40.,-40.,-45.,-45.,-45.,
+};
+
+static double _psy_tone_suppress[11]={
+  -10.,-20.,-20.,-20.,-30.,-30.,-40.,-40.,-40.,-45.,-45.,-45.,
+};
+
+static double _psy_tone_0dB[11]={
+  95.,95.,95.,95.,95.,105.,105.,105.,105.,105.,105.,
+};
+
+static double _psy_noise_suppress[11]={
+   -0.,-24.,-24.,-24.,-24.,-30.,-40.,-40.,-40.,-45.,-45.,-45.,
+};
 
+static int _psy_ehmer_bandlimit[11]={
+  0,0,0,0,4,4,30,30,30,30,30,
+};
+
+static vorbis_info_psy _psy_info_template={
+    {-1},-110.,-140.,
     /* tonemask att,guard,suppr,curves  peakattp,curvelimitp,peaksettings*/
-    0.f,            -18.f,-10.f, {{{0.}}},         1,          0,        {{{0.}}},
+    0.f,            -40.f,-40.f, {{{0.}}},         1,          0,        {{{0.}}},
     
     /*noisemaskp,supp, low/high window, low/hi guard, minimum */
     1,          -0.f,         .5f, .5f,         0,0,0,
-    {-1},{-1},95.f,{{-1}}
-  },
-  /* one */
-  { 
-    {-1},-100.,-110.,
-    0.f,-24.f,-20.f, {{{0.}}},  1,0,{{{0.}}},
-    1,-24.f,.5f,.5f,0,0,0,
-    {-1},{-1},95.f,{{-1}}
-  },
-  /* two */
-  { 
-    {-1},-100.,-120.,
-    0.f,-24.f,-20.f, {{{0.}}},  1,0,{{{0.}}},
-    1,-24.f,.5f,.5f,0,0,0,
-    {-1},{-1},95.f,{{-1}}
-  },
-  /* three */
-  { 
-    {-1},-100.,-140.,
-    0.f,-24.f,-20.f, {{{0.}}},  1,0,{{{0.}}},
-    1,-24.f,.5f,.5f,0,0,0,
-    {-1},{-1},95.f,{{-1}}
-  },
-  /* four */
-  { 
-    {-1},-100.,-140.,
-    0.f,-26.f,-30.f, {{{0.}}},  1,4,{{{0.}}},
-    1,-24.f,.5f,.5f,0,0,0,
-    {-1},{-1},95.f,{{-1}}
-  },
-  /* five */
-  { 
-    {-1},-100.,-140.,
-    0.f,-40.f,-30.f, {{{0.}}},  1,4,{{{0.}}},
-    1,-30.f,.5f,.5f,0,0,0,
-    {-1},{-1},105.f,{{-1}}
-  },
-  /* six */
-  { 
-    {-1},-100.,-140.,
-    0.f,-40.f,-40.f, {{{0.}}},  1,30,{{{0.}}},
-    1,-40.f,.5f,.5f,0,0,0,
-    {-1},{-1},105.f,{{-1}}
-  },
-  /* seven */
-  { 
-    {-1},-100.,-140.,
-    0.f,-40.f,-40.f, {{{0.}}},  1,30,{{{0.}}},
-    1,-40.f,.5f,.5f,0,0,0,
-    {-1},{-1},105.f,{{-1}}
-  },
-  /* eight */
-  { 
-    {-1},-100.,-140.,
-    0.f,-45.f,-45.f, {{{0.}}},  1,30,{{{0.}}},
-    1,-45.f,.5f,.5f,0,0,0,
-    {-1},{-1},105.f,{{-1}}
-  },
-  /* nine */
-  { 
-    {-1},-110.,-140.,
-    0.f,-45.f,-45.f, {{{0.}}},  1,30,{{{0.}}},
-    1,-45.f,.5f,.5f,0,0,0,
-    {-1},{-1},105.f,{{-1}}
-  },
-  /* ten */
-  { 
-    {-1},-120.,-150.,
-    0.f,-45.f,-45.f, {{{0.}}},  1,30,{{{0.}}},
-    1,-45.f,.5f,.5f,0,0,0,
-    {-1},{-1},105.f,{{-1}}
-  }
+    {-1},{-1},105.f,{{-1,-1,{{-1,-1,-1,-1}}}}
 };
 
 /* ath ****************/
 
+static double _psy_ath_floater[11]={
+  -100.,-100.,-100.,-100.,-100.,-100.,-105.,-105.,-105.,-110.,-120.,
+};
+
+static double _psy_ath_abs[11]={
+  -110.,-110.,-120.,-140.,-140.,-140.,-140.,-140.,-140.,-140.,-150.,
+};
+
 static float ATH_Bark_dB[][27]={
   {
      0.f,  15.f,  15.f,   15.f,   11.f,       10.f,   8.f,  7.f,   7.f,  7.f,
@@ -668,4 +626,16 @@
     6.f,   2.f,   0.f,    0.f,   -3.f,       -5.f,  -6.f, -6.f,-4.5f, 0.f,
     2.f,   6.f,   5.f,    5.f,   15.f,       15.f,  15.f,
   }
+};
+
+/* stereo ****************/
+static int _psy_stereo_point_dB_44[11]={4,  3,  2,  2,   1,  0,  0,  0,  0,  0,  0};
+static double _psy_stereo_point_kHz_44[2][11]={
+  {4., 6., 6., 6., 10., 6., 6., 4., 4., 4., 4.},
+  {6., 6., 6., 10., 10., 6., 6., 4., 4., 4., 4.}
+};
+
+/* lowpass **************/
+static double _psy_lowpass_44[11]={
+  15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999.
 };

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list