[xiph-cvs] cvs commit: vorbis/vq bookutil.c huffbuild.c

Monty xiphmont at xiph.org
Fri Nov 3 02:06:09 PST 2000



xiphmont    00/11/03 02:06:08

  Modified:    .        Tag: branch_beta3 configure.in
               examples Tag: branch_beta3 Makefile.am encoder_example.c
               include/vorbis Tag: branch_beta3 Makefile.am codec.h
               lib      Tag: branch_beta3 Makefile.am analysis.c block.c
                        codebook.c envelope.c floor0.c info.c lsp.c
                        mapping0.c psy.c psy.h registry.h res0.c
                        sharedbook.c synthesis.c time0.c vorbisfile.c
               vq       Tag: branch_beta3 bookutil.c huffbuild.c
  Added:       lib      Tag: branch_beta3 backends.h codebook.h
                        codec_internal.h
               lib/books Tag: branch_beta3 lsp12_0.vqh lsp30_0.vqh
                        res0_1024a_128_1.vqh res0_1024a_128_2.vqh
                        res0_1024a_128_3.vqh res0_1024a_128_4.vqh
                        res0_1024a_128_5.vqh res0_1024a_128_6.vqh
                        res0_1024a_128_7.vqh res0_1024a_128_8.vqh
                        res0_1024a_128_9.vqh res0_1024a_160_1.vqh
                        res0_1024a_160_2.vqh res0_1024a_160_3.vqh
                        res0_1024a_160_4.vqh res0_1024a_160_5.vqh
                        res0_1024a_160_6.vqh res0_1024a_160_7.vqh
                        res0_1024a_160_8.vqh res0_1024a_160_9.vqh
                        res0_1024a_192_1.vqh res0_1024a_192_2.vqh
                        res0_1024a_192_3.vqh res0_1024a_192_4.vqh
                        res0_1024a_192_5.vqh res0_1024a_256_1.vqh
                        res0_1024a_256_2.vqh res0_1024a_256_3.vqh
                        res0_1024a_256_4.vqh res0_1024a_256_5.vqh
                        res0_1024a_350_1.vqh res0_1024a_350_2.vqh
                        res0_1024a_350_3.vqh res0_1024a_350_4.vqh
                        res0_1024a_350_5.vqh res0_128a_128_1.vqh
                        res0_128a_128_2.vqh res0_128a_128_3.vqh
                        res0_128a_128_4.vqh res0_128a_128_5.vqh
                        res0_128a_160_1.vqh res0_128a_160_2.vqh
                        res0_128a_160_3.vqh res0_128a_160_4.vqh
                        res0_128a_160_5.vqh res0_128a_192_1.vqh
                        res0_128a_192_2.vqh res0_128a_192_3.vqh
                        res0_128a_192_4.vqh res0_128a_192_5.vqh
                        res0_128a_256_1.vqh res0_128a_256_2.vqh
                        res0_128a_256_3.vqh res0_128a_256_4.vqh
                        res0_128a_256_5.vqh res0_128a_350_1.vqh
                        res0_128a_350_2.vqh res0_128a_350_3.vqh
                        res0_128a_350_4.vqh res0_128a_350_5.vqh
                        resaux0_1024a_128.vqh resaux0_1024a_160.vqh
                        resaux0_1024a_192.vqh resaux0_1024a_256.vqh
                        resaux0_1024a_350.vqh resaux0_128a_128.vqh
                        resaux0_128a_160.vqh resaux0_128a_192.vqh
                        resaux0_128a_256.vqh resaux0_128a_350.vqh
               lib/modes Tag: branch_beta3 mode_A.h mode_B.h mode_C.h
                        mode_D.h mode_E.h modes.h
  Removed:     include/vorbis Tag: branch_beta3 backends.h codebook.h
               include/vorbis/book Tag: branch_beta3 .cvsignore Makefile.am
                        lsp12_0.vqh lsp30_0.vqh res0_1024a_128_1.vqh
                        res0_1024a_128_2.vqh res0_1024a_128_3.vqh
                        res0_1024a_128_4.vqh res0_1024a_128_5.vqh
                        res0_1024a_128_6.vqh res0_1024a_128_7.vqh
                        res0_1024a_128_8.vqh res0_1024a_128_9.vqh
                        res0_1024a_160_1.vqh res0_1024a_160_2.vqh
                        res0_1024a_160_3.vqh res0_1024a_160_4.vqh
                        res0_1024a_160_5.vqh res0_1024a_160_6.vqh
                        res0_1024a_160_7.vqh res0_1024a_160_8.vqh
                        res0_1024a_160_9.vqh res0_1024a_192_1.vqh
                        res0_1024a_192_2.vqh res0_1024a_192_3.vqh
                        res0_1024a_192_4.vqh res0_1024a_192_5.vqh
                        res0_1024a_256_1.vqh res0_1024a_256_2.vqh
                        res0_1024a_256_3.vqh res0_1024a_256_4.vqh
                        res0_1024a_256_5.vqh res0_1024a_350_1.vqh
                        res0_1024a_350_2.vqh res0_1024a_350_3.vqh
                        res0_1024a_350_4.vqh res0_1024a_350_5.vqh
                        res0_128a_128_1.vqh res0_128a_128_2.vqh
                        res0_128a_128_3.vqh res0_128a_128_4.vqh
                        res0_128a_128_5.vqh res0_128a_160_1.vqh
                        res0_128a_160_2.vqh res0_128a_160_3.vqh
                        res0_128a_160_4.vqh res0_128a_160_5.vqh
                        res0_128a_192_1.vqh res0_128a_192_2.vqh
                        res0_128a_192_3.vqh res0_128a_192_4.vqh
                        res0_128a_192_5.vqh res0_128a_256_1.vqh
                        res0_128a_256_2.vqh res0_128a_256_3.vqh
                        res0_128a_256_4.vqh res0_128a_256_5.vqh
                        res0_128a_350_1.vqh res0_128a_350_2.vqh
                        res0_128a_350_3.vqh res0_128a_350_4.vqh
                        res0_128a_350_5.vqh resaux0_1024a_128.vqh
                        resaux0_1024a_160.vqh resaux0_1024a_192.vqh
                        resaux0_1024a_256.vqh resaux0_1024a_350.vqh
                        resaux0_128a_128.vqh resaux0_128a_160.vqh
                        resaux0_128a_192.vqh resaux0_128a_256.vqh
                        resaux0_128a_350.vqh
               lib      Tag: branch_beta3 bookinternal.h sharedbook.h
  Log:
  Hid all the formerly exposed modes and codebooks behind the
  libvorbisenc API.  Libvorbisenc now exists.  Caveats:
  
  It listens to bitrate_nominal, but only maps to one of the five modes
  we had before for now.  bitrate_max and min are ignored.
  
  Bitrate is handled properly with differing channels, but not with
  differing sample rate.
  
  Monty

Revision  Changes    Path
No                   revision

No                   revision

1.24.2.8  +1 -1      vorbis/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/vorbis/configure.in,v
retrieving revision 1.24.2.7
retrieving revision 1.24.2.8
diff -u -r1.24.2.7 -r1.24.2.8
--- configure.in	2000/10/31 18:57:38	1.24.2.7
+++ configure.in	2000/11/03 10:05:42	1.24.2.8
@@ -160,4 +160,4 @@
 AC_SUBST(PROFILE)
 AC_SUBST(pthread_lib)
 
-AC_OUTPUT(Makefile lib/Makefile doc/Makefile doc/vorbisfile/Makefile include/Makefile include/vorbis/Makefile include/vorbis/book/Makefile examples/Makefile)
+AC_OUTPUT(Makefile lib/Makefile doc/Makefile doc/vorbisfile/Makefile include/Makefile include/vorbis/Makefile examples/Makefile)

No                   revision

No                   revision

1.3.2.3   +1 -0      vorbis/examples/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/Makefile.am,v
retrieving revision 1.3.2.2
retrieving revision 1.3.2.3
diff -u -r1.3.2.2 -r1.3.2.3
--- Makefile.am	2000/11/02 20:13:06	1.3.2.2
+++ Makefile.am	2000/11/03 10:05:43	1.3.2.3
@@ -11,6 +11,7 @@
 
 decoder_example_SOURCES = decoder_example.c
 encoder_example_SOURCES = encoder_example.c
+encoder_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisenc.a $(top_srcdir)/lib/.libs/libvorbis.a $(OGG_LIBS)
 chaining_example_SOURCES = chaining_example.c
 chaining_example_LDADD = $(top_srcdir)/lib/.libs/libvorbisfile.a $(top_srcdir)/lib/.libs/libvorbis.a $(OGG_LIBS)
 vorbisfile_example_SOURCES = vorbisfile_example.c

1.14.2.1  +7 -5      vorbis/examples/encoder_example.c

Index: encoder_example.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/examples/encoder_example.c,v
retrieving revision 1.14
retrieving revision 1.14.2.1
diff -u -r1.14 -r1.14.2.1
--- encoder_example.c	2000/10/12 03:12:39	1.14
+++ encoder_example.c	2000/11/03 10:05:43	1.14.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: simple example encoder
- last mod: $Id: encoder_example.c,v 1.14 2000/10/12 03:12:39 xiphmont Exp $
+ last mod: $Id: encoder_example.c,v 1.14.2.1 2000/11/03 10:05:43 xiphmont Exp $
 
  ********************************************************************/
 
@@ -25,7 +25,7 @@
 #include <stdlib.h>
 #include <time.h>
 #include <math.h>
-#include <vorbis/mode_C.h>
+#include <vorbis/vorbisenc.h>
 
 #ifdef _WIN32 /* We need the following two to set stdin/stdout to binary */
 #include <io.h>
@@ -45,7 +45,7 @@
   ogg_page         og; /* one Ogg bitstream page.  Vorbis packets are inside */
   ogg_packet       op; /* one raw packet of data for decode */
   
-  vorbis_info     *vi; /* struct that stores all the static vorbis bitstream
+  vorbis_info      vi; /* struct that stores all the static vorbis bitstream
                           settings */
   vorbis_comment   vc; /* struct that stores all the user comments */
 
@@ -79,14 +79,15 @@
 
   /* choose an encoding mode */
   /* (mode 0: 44kHz stereo uncoupled, roughly 128kbps VBR) */
-  vi=&info_C;
+  vorbis_info_init(&vi);
+  vorbis_encode_init(&vi,2,44100, -1, 128, -1);
 
   /* add a comment */
   vorbis_comment_init(&vc);
   vorbis_comment_add(&vc,"Track encoded by encoder_example.c");
 
   /* set up the analysis state and auxiliary encoding storage */
-  vorbis_analysis_init(&vd,vi);
+  vorbis_analysis_init(&vd,&vi);
   vorbis_block_init(&vd,&vb);
   
   /* set up our packet->stream encoder */
@@ -187,6 +188,7 @@
   ogg_stream_clear(&os);
   vorbis_block_clear(&vb);
   vorbis_dsp_clear(&vd);
+  vorbis_info_clear(&vi);
   
   /* ogg_page and ogg_packet structs always point to storage in
      libvorbis.  They're never freed or manipulated directly */

No                   revision

No                   revision

1.2.2.1   +1 -3      vorbis/include/vorbis/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -u -r1.2 -r1.2.2.1
--- Makefile.am	2000/10/12 03:12:40	1.2
+++ Makefile.am	2000/11/03 10:05:43	1.2.2.1
@@ -4,8 +4,6 @@
 
 includedir = $(prefix)/include/vorbis
 
-include_HEADERS = backends.h codec.h mode_B.h mode_D.h modes.h\
-		codebook.h mode_A.h mode_C.h mode_E.h vorbisfile.h
+include_HEADERS = codec.h vorbisfile.h vorbisenc.h
 
-SUBDIRS = book
 

1.32.2.3  +14 -127   vorbis/include/vorbis/codec.h

Index: codec.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/include/vorbis/codec.h,v
retrieving revision 1.32.2.2
retrieving revision 1.32.2.3
diff -u -r1.32.2.2 -r1.32.2.3
--- codec.h	2000/10/31 00:10:36	1.32.2.2
+++ codec.h	2000/11/03 10:05:43	1.32.2.3
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec.h,v 1.32.2.2 2000/10/31 00:10:36 xiphmont Exp $
+ last mod: $Id: codec.h,v 1.32.2.3 2000/11/03 10:05:43 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,69 +24,7 @@
 {
 #endif /* __cplusplus */
 
-#define MAX_BARK 27
-
 #include <ogg/ogg.h>
-#include "vorbis/codebook.h"
-
-typedef void vorbis_look_transform;
-typedef void vorbis_info_time;
-typedef void vorbis_look_time;
-typedef void vorbis_info_floor;
-typedef void vorbis_look_floor;
-typedef void vorbis_echstate_floor;
-typedef void vorbis_info_residue;
-typedef void vorbis_look_residue;
-typedef void vorbis_info_mapping;
-typedef void vorbis_look_mapping;
-
-/* mode ************************************************************/
-typedef struct {
-  int blockflag;
-  int windowtype;
-  int transformtype;
-  int mapping;
-} vorbis_info_mode;
-
-/* psychoacoustic setup ********************************************/
-#define P_BANDS 17
-#define P_LEVELS 11
-typedef struct vorbis_info_psy{
-  int    athp;
-  int    decayp;
-  int    smoothp;
-
-  int    noisecullp;
-  float noisecull_barkwidth;
-
-  float ath_adjatt;
-  float ath_maxatt;
-
-  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
-  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
-  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
-
-  int tonemaskp;
-  float toneatt[P_BANDS][P_LEVELS];
-
-  int peakattp;
-  float peakatt[P_BANDS][P_LEVELS];
-
-  int noisemaskp;
-  float noiseatt[P_BANDS][P_LEVELS];
-
-  float max_curve_dB;
-
-  /* decay setup */
-  float attack_coeff;
-  float decay_coeff;
-} vorbis_info_psy;
-
-/* vorbis_info contains all the setup information specific to the
-   specific compression/decompression mode in progress (eg,
-   psychoacoustic settings, channel setup, options, codebook
-   etc).  
-*********************************************************************/
 
 typedef struct vorbis_info{
   int version;
@@ -111,51 +49,17 @@
   long bitrate_upper;
   long bitrate_nominal;
   long bitrate_lower;
-
-  /* Vorbis supports only short and long blocks, but allows the
-     encoder to choose the sizes */
-
-  long blocksizes[2];
+  long bitrate_window;
 
-  /* modes are the primary means of supporting on-the-fly different
-     blocksizes, different channel mappings (LR or mid-side),
-     different residue backends, etc.  Each mode consists of a
-     blocksize flag and a mapping (along with the mapping setup */
-
-  int        modes;
-  int        maps;
-  int        times;
-  int        floors;
-  int        residues;
-  int        books;
-  int        psys;     /* encode only */
-
-  vorbis_info_mode    *mode_param[64];
-  int                  map_type[64];
-  vorbis_info_mapping *map_param[64];
-  int                  time_type[64];
-  vorbis_info_time    *time_param[64];
-  int                  floor_type[64];
-  vorbis_info_floor   *floor_param[64];
-  int                  residue_type[64];
-  vorbis_info_residue *residue_param[64];
-  static_codebook     *book_param[256];
-  vorbis_info_psy     *psy_param[64]; /* encode only */
-  
-  /* for block long/sort tuning; encode only */
-  int        envelopesa;
-  float     preecho_thresh;
-  float     preecho_clamp;
-  float     preecho_minenergy;
+  void *codec_setup;
 } vorbis_info;
- 
+
 /* vorbis_dsp_state buffers the current vorbis audio
    analysis/synthesis state.  The DSP state belongs to a specific
    logical bitstream ****************************************************/
 typedef struct vorbis_dsp_state{
   int analysisp;
   vorbis_info *vi;
-  int    modebits;
 
   float **pcm;
   float **pcmret;
@@ -178,35 +82,10 @@
   ogg_int64_t time_bits;
   ogg_int64_t floor_bits;
   ogg_int64_t res_bits;
-
-  /* local lookup storage */
-  void                   *ve; /* envelope lookup */    
-  float                **window[2][2][2]; /* block, leadin, leadout, type */
-  vorbis_look_transform **transform[2];    /* block, type */
-  codebook               *fullbooks;
-  /* backend lookups are tied to the mode, not the backend or naked mapping */
-  vorbis_look_mapping   **mode;
-
-  /* local storage, only used on the encoding side.  This way the
-     application does not need to worry about freeing some packets'
-     memory and not others'; packet storage is always tracked.
-     Cleared next call to a _dsp_ function */
-  unsigned char *header;
-  unsigned char *header1;
-  unsigned char *header2;
 
+  void       *backend_state;
 } vorbis_dsp_state;
 
-/* vorbis_block is a single block of data to be processed as part of
-the analysis/synthesis stream; it belongs to a specific logical
-bitstream, but is independant from other vorbis_blocks belonging to
-that logical bitstream. *************************************************/
-
-struct alloc_chain{
-  void *ptr;
-  struct alloc_chain *next;
-};
-
 typedef struct vorbis_block{
   /* necessary stream state for linking to the framing abstraction */
   float  **pcm;       /* this is a pointer into local storage */ 
@@ -239,7 +118,15 @@
 
 } vorbis_block;
 
-#include "vorbis/backends.h"
+/* vorbis_block is a single block of data to be processed as part of
+the analysis/synthesis stream; it belongs to a specific logical
+bitstream, but is independant from other vorbis_blocks belonging to
+that logical bitstream. *************************************************/
+
+struct alloc_chain{
+  void *ptr;
+  struct alloc_chain *next;
+};
 
 /* vorbis_info contains all the setup information specific to the
    specific compression/decompression mode in progress (eg,

No                   revision

No                   revision

1.2.2.3   +45 -3     vorbis/lib/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/Makefile.am,v
retrieving revision 1.2.2.2
retrieving revision 1.2.2.3
diff -u -r1.2.2.2 -r1.2.2.3
--- Makefile.am	2000/11/02 20:13:07	1.2.2.2
+++ Makefile.am	2000/11/03 10:05:46	1.2.2.3
@@ -4,19 +4,61 @@
 
 INCLUDES = -I../include
 
-lib_LTLIBRARIES = libvorbis.la libvorbisfile.la
+lib_LTLIBRARIES = libvorbis.la libvorbisfile.la libvorbisenc.la
 
 libvorbis_la_SOURCES = mdct.c smallft.c block.c envelope.c window.c lsp.c lpc.c\
                         analysis.c synthesis.c psy.c info.c time0.c floor0.c\
                         res0.c mapping0.c registry.c codebook.c sharedbook.c\
                         iir.c lookup.c\
-			envelope.h lpc.h lsp.h bookinternal.h misc.h psy.h\
+			envelope.h lpc.h lsp.h codebook.h misc.h psy.h\
                         masking.h sharedbook.h iir.h os.h mdct.h smallft.h\
-			registry.h scales.h window.h lookup.h lookup_data.h
+			registry.h scales.h window.h lookup.h lookup_data.h\
+			codec_internal.h backends.h
 libvorbis_la_LDFLAGS = -version-info @V_LIB_CURRENT@:@V_LIB_REVISION@:@V_LIB_AGE@
 
 libvorbisfile_la_SOURCES = vorbisfile.c
 libvorbisfile_la_LDFLAGS = -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@
+
+libvorbisenc_la_SOURCES = vorbisenc.c\
+			os.h misc.h mode_A.h mode_B.h mode_C.h mode_D.h\
+			mode_E.h modes.h\
+			res0_1024a_192_4.vqh res0_128a_192_3.vqh\
+			lsp12_0.vqh res0_1024a_192_5.vqh\
+			res0_128a_192_4.vqh lsp30_0.vqh res0_1024a_256_1.vqh\
+			res0_128a_192_5.vqh res0_1024a_128_1.vqh\
+	 		res0_1024a_256_2.vqh res0_128a_256_1.vq\
+			res0_1024a_128_2.vqh res0_1024a_256_3.vqh\
+			res0_128a_256_2.vqh res0_1024a_128_3.vqh\
+			res0_1024a_256_4.vqh res0_128a_256_3.vqh\
+			res0_1024a_128_4.vqh res0_1024a_256_5.vqh\
+			res0_128a_256_4.vqh res0_1024a_128_5.vqh\
+			res0_1024a_350_1.vqh res0_128a_256_5.vqh\
+			res0_1024a_128_6.vqh res0_1024a_350_2.vqh\
+			res0_128a_350_1.vqh res0_1024a_128_7.vqh\
+			res0_1024a_350_3.vqh res0_128a_350_2.vqh\
+			res0_1024a_128_8.vqh res0_1024a_350_4.vqh\
+			res0_128a_350_3.vqh res0_1024a_128_9.vqh\
+			res0_1024a_350_5.vqh res0_128a_350_4.vqh\
+			res0_1024a_160_1.vqh res0_128a_128_1.vqh\
+			res0_128a_350_5.vqh res0_1024a_160_2.vqh\
+			res0_128a_128_2.vqh resaux0_1024a_128.vqh\
+			res0_1024a_160_3.vqh res0_128a_128_3.vqh\
+			resaux0_1024a_160.vqh res0_1024a_160_4.vqh\
+			res0_128a_128_4.vqh resaux0_1024a_192.vqh\
+			res0_1024a_160_5.vqh res0_128a_128_5.vqh\
+			resaux0_1024a_256.vqh res0_1024a_160_6.vqh\
+			res0_128a_160_1.vqh resaux0_1024a_350.vqh\
+			res0_1024a_160_7.vqh res0_128a_160_2.vqh\
+			resaux0_128a_128.vqh res0_1024a_160_8.vqh\
+			res0_128a_160_3.vqh resaux0_128a_160.vqh\
+			res0_1024a_160_9.vqh res0_128a_160_4.vqh\
+			resaux0_128a_192.vqh res0_1024a_192_1.vqh\
+			res0_128a_160_5.vqh resaux0_128a_256.vqh\
+			res0_1024a_192_2.vqh res0_128a_192_1.vqh\
+			resaux0_128a_350.vqh res0_1024a_192_3.vqh\
+			 res0_128a_192_2.vqh
+
+libvorbisenc_la_LDFLAGS = -version-info @VF_LIB_CURRENT@:@VF_LIB_REVISION@:@VF_LIB_AGE@
 
 debug:
         $(MAKE) all CFLAGS="@DEBUG@"

1.34.2.2  +11 -9     vorbis/lib/analysis.c

Index: analysis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/analysis.c,v
retrieving revision 1.34.2.1
retrieving revision 1.34.2.2
diff -u -r1.34.2.1 -r1.34.2.2
--- analysis.c	2000/10/14 03:14:06	1.34.2.1
+++ analysis.c	2000/11/03 10:05:46	1.34.2.2
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c,v 1.34.2.1 2000/10/14 03:14:06 xiphmont Exp $
+ last mod: $Id: analysis.c,v 1.34.2.2 2000/11/03 10:05:46 xiphmont Exp $
 
  ********************************************************************/
 
@@ -27,10 +27,12 @@
 
 /* decides between modes, dispatches to the appropriate mapping. */
 int vorbis_analysis(vorbis_block *vb,ogg_packet *op){
-  vorbis_dsp_state *vd=vb->vd;
-  vorbis_info      *vi=vd->vi;
-  int              type,ret;
-  int              mode=0;
+  vorbis_dsp_state     *vd=vb->vd;
+  backend_lookup_state *b=vd->backend_state;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  int                   type,ret;
+  int                   mode=0;
 
   vb->glue_bits=0;
   vb->time_bits=0;
@@ -44,12 +46,12 @@
 
   /* currently lazy.  Short block dispatches to 0, long to 1. */
 
-  if(vb->W &&vi->modes>1)mode=1;
-  type=vi->map_type[vi->mode_param[mode]->mapping];
+  if(vb->W &&ci->modes>1)mode=1;
+  type=ci->map_type[ci->mode_param[mode]->mapping];
   vb->mode=mode;
 
   /* Encode frame mode, pre,post windowsize, then dispatch */
-  oggpack_write(&vb->opb,mode,vd->modebits);
+  oggpack_write(&vb->opb,mode,b->modebits);
   if(vb->W){
     oggpack_write(&vb->opb,vb->lW,1);
     oggpack_write(&vb->opb,vb->nW,1);
@@ -58,7 +60,7 @@
     fprintf(stderr,".");
     }*/
 
-  if((ret=_mapping_P[type]->forward(vb,vd->mode[mode])))
+  if((ret=_mapping_P[type]->forward(vb,b->mode[mode])))
     return(ret);
   
   /* set up the packet wrapper */

1.39.2.3  +133 -112  vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.39.2.2
retrieving revision 1.39.2.3
diff -u -r1.39.2.2 -r1.39.2.3
--- block.c	2000/10/31 00:10:37	1.39.2.2
+++ block.c	2000/11/03 10:05:47	1.39.2.3
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.39.2.2 2000/10/31 00:10:37 xiphmont Exp $
+ last mod: $Id: block.c,v 1.39.2.3 2000/11/03 10:05:47 xiphmont Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -34,8 +34,7 @@
 #include "mdct.h"
 #include "lpc.h"
 #include "registry.h"
-#include "sharedbook.h"
-#include "bookinternal.h"
+#include "codebook.h"
 #include "misc.h"
 #include "os.h"
 
@@ -166,54 +165,58 @@
 
 static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
   int i;
+  codec_setup_info *ci=vi->codec_setup;
+  backend_lookup_state *b=NULL;
+
   memset(v,0,sizeof(vorbis_dsp_state));
+  b=v->backend_state=calloc(1,sizeof(backend_lookup_state));
 
   v->vi=vi;
-  v->modebits=ilog2(vi->modes);
+  b->modebits=ilog2(ci->modes);
 
-  v->transform[0]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
-  v->transform[1]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+  b->transform[0]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
+  b->transform[1]=calloc(VI_TRANSFORMB,sizeof(vorbis_look_transform *));
 
   /* MDCT is tranform 0 */
 
-  v->transform[0][0]=calloc(1,sizeof(mdct_lookup));
-  v->transform[1][0]=calloc(1,sizeof(mdct_lookup));
-  mdct_init(v->transform[0][0],vi->blocksizes[0]);
-  mdct_init(v->transform[1][0],vi->blocksizes[1]);
-
-  v->window[0][0][0]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[0][0][1]=v->window[0][0][0];
-  v->window[0][1][0]=v->window[0][0][0];
-  v->window[0][1][1]=v->window[0][0][0];
-  v->window[1][0][0]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[1][0][1]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[1][1][0]=calloc(VI_WINDOWB,sizeof(float *));
-  v->window[1][1][1]=calloc(VI_WINDOWB,sizeof(float *));
+  b->transform[0][0]=calloc(1,sizeof(mdct_lookup));
+  b->transform[1][0]=calloc(1,sizeof(mdct_lookup));
+  mdct_init(b->transform[0][0],ci->blocksizes[0]);
+  mdct_init(b->transform[1][0],ci->blocksizes[1]);
+
+  b->window[0][0][0]=calloc(VI_WINDOWB,sizeof(float *));
+  b->window[0][0][1]=b->window[0][0][0];
+  b->window[0][1][0]=b->window[0][0][0];
+  b->window[0][1][1]=b->window[0][0][0];
+  b->window[1][0][0]=calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][0][1]=calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][1][0]=calloc(VI_WINDOWB,sizeof(float *));
+  b->window[1][1][1]=calloc(VI_WINDOWB,sizeof(float *));
 
   for(i=0;i<VI_WINDOWB;i++){
-    v->window[0][0][0][i]=
-      _vorbis_window(i,vi->blocksizes[0],vi->blocksizes[0]/2,vi->blocksizes[0]/2);
-    v->window[1][0][0][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[0]/2,vi->blocksizes[0]/2);
-    v->window[1][0][1][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[0]/2,vi->blocksizes[1]/2);
-    v->window[1][1][0][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[1]/2,vi->blocksizes[0]/2);
-    v->window[1][1][1][i]=
-      _vorbis_window(i,vi->blocksizes[1],vi->blocksizes[1]/2,vi->blocksizes[1]/2);
+    b->window[0][0][0][i]=
+      _vorbis_window(i,ci->blocksizes[0],ci->blocksizes[0]/2,ci->blocksizes[0]/2);
+    b->window[1][0][0][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[0]/2,ci->blocksizes[0]/2);
+    b->window[1][0][1][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[0]/2,ci->blocksizes[1]/2);
+    b->window[1][1][0][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[1]/2,ci->blocksizes[0]/2);
+    b->window[1][1][1][i]=
+      _vorbis_window(i,ci->blocksizes[1],ci->blocksizes[1]/2,ci->blocksizes[1]/2);
   }
 
   if(encp){ /* encode/decode differ here */
     /* finish the codebooks */
-    v->fullbooks=calloc(vi->books,sizeof(codebook));
-    for(i=0;i<vi->books;i++)
-      vorbis_book_init_encode(v->fullbooks+i,vi->book_param[i]);
+    b->fullbooks=calloc(ci->books,sizeof(codebook));
+    for(i=0;i<ci->books;i++)
+      vorbis_book_init_encode(b->fullbooks+i,ci->book_param[i]);
     v->analysisp=1;
   }else{
     /* finish the codebooks */
-    v->fullbooks=calloc(vi->books,sizeof(codebook));
-    for(i=0;i<vi->books;i++)
-      vorbis_book_init_decode(v->fullbooks+i,vi->book_param[i]);
+    b->fullbooks=calloc(ci->books,sizeof(codebook));
+    for(i=0;i<ci->books;i++)
+      vorbis_book_init_decode(b->fullbooks+i,ci->book_param[i]);
   }
 
   /* initialize the storage vectors to a decent size greater than the
@@ -236,17 +239,17 @@
   v->W=0;  /* current window size */
 
   /* all vector indexes */
-  v->centerW=vi->blocksizes[1]/2;
+  v->centerW=ci->blocksizes[1]/2;
 
   v->pcm_current=v->centerW;
 
   /* initialize all the mapping/backend lookups */
-  v->mode=calloc(vi->modes,sizeof(vorbis_look_mapping *));
-  for(i=0;i<vi->modes;i++){
-    int mapnum=vi->mode_param[i]->mapping;
-    int maptype=vi->map_type[mapnum];
-    v->mode[i]=_mapping_P[maptype]->look(v,vi->mode_param[i],
-					 vi->map_param[mapnum]);
+  b->mode=calloc(ci->modes,sizeof(vorbis_look_mapping *));
+  for(i=0;i<ci->modes;i++){
+    int mapnum=ci->mode_param[i]->mapping;
+    int maptype=ci->map_type[mapnum];
+    b->mode[i]=_mapping_P[maptype]->look(v,ci->mode_param[i],
+					 ci->map_param[mapnum]);
   }
 
   return(0);
@@ -254,11 +257,14 @@
 
 /* arbitrary settings and spec-mandated numbers get filled in here */
 int vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi){
+  backend_lookup_state *b=NULL;
+
   _vds_shared_init(v,vi,1);
+  b=v->backend_state;
 
   /* Initialize the envelope state storage */
-  v->ve=calloc(1,sizeof(envelope_lookup));
-  _ve_envelope_init(v->ve,vi);
+  b->ve=calloc(1,sizeof(envelope_lookup));
+  _ve_envelope_init(b->ve,vi);
 
   return(0);
 }
@@ -267,18 +273,39 @@
   int i,j,k;
   if(v){
     vorbis_info *vi=v->vi;
+    codec_setup_info *ci=(vi?vi->codec_setup:NULL);
+    backend_lookup_state *b=v->backend_state;
+
+    if(b){
+      if(b->window[0][0][0]){
+	for(i=0;i<VI_WINDOWB;i++)
+	  if(b->window[0][0][0][i])free(b->window[0][0][0][i]);
+	free(b->window[0][0][0]);
+	
+	for(j=0;j<2;j++)
+	  for(k=0;k<2;k++){
+	    for(i=0;i<VI_WINDOWB;i++)
+	      if(b->window[1][j][k][i])free(b->window[1][j][k][i]);
+	    free(b->window[1][j][k]);
+	  }
+      }
+
+      if(b->ve){
+	_ve_envelope_clear(b->ve);
+	free(b->ve);
+      }
 
-    if(v->window[0][0][0]){
-      for(i=0;i<VI_WINDOWB;i++)
-	if(v->window[0][0][0][i])free(v->window[0][0][0][i]);
-      free(v->window[0][0][0]);
-
-      for(j=0;j<2;j++)
-	for(k=0;k<2;k++){
-	  for(i=0;i<VI_WINDOWB;i++)
-	    if(v->window[1][j][k][i])free(v->window[1][j][k][i]);
-	  free(v->window[1][j][k]);
-	}
+      if(b->transform[0]){
+	mdct_clear(b->transform[0][0]);
+	free(b->transform[0][0]);
+	free(b->transform[0]);
+      }
+      if(b->transform[1]){
+	mdct_clear(b->transform[1][0]);
+	free(b->transform[1][0]);
+	free(b->transform[1]);
+      }
+      
     }
     
     if(v->pcm){
@@ -288,42 +315,29 @@
       if(v->pcmret)free(v->pcmret);
     }
 
-    if(v->ve){
-      _ve_envelope_clear(v->ve);
-      free(v->ve);
-    }
-
-    if(v->transform[0]){
-      mdct_clear(v->transform[0][0]);
-      free(v->transform[0][0]);
-      free(v->transform[0]);
-    }
-    if(v->transform[1]){
-      mdct_clear(v->transform[1][0]);
-      free(v->transform[1][0]);
-      free(v->transform[1]);
-    }
-
     /* free mode lookups; these are actually vorbis_look_mapping structs */
-    if(vi){
-      for(i=0;i<vi->modes;i++){
-	int mapnum=vi->mode_param[i]->mapping;
-	int maptype=vi->map_type[mapnum];
-	_mapping_P[maptype]->free_look(v->mode[i]);
+    if(ci){
+      for(i=0;i<ci->modes;i++){
+	int mapnum=ci->mode_param[i]->mapping;
+	int maptype=ci->map_type[mapnum];
+	if(b && b->mode)_mapping_P[maptype]->free_look(b->mode[i]);
       }
       /* free codebooks */
-      for(i=0;i<vi->books;i++)
-	vorbis_book_clear(v->fullbooks+i);
+      for(i=0;i<ci->books;i++)
+	if(b && b->fullbooks)vorbis_book_clear(b->fullbooks+i);
     }
-
-    if(v->mode)free(v->mode);    
-    if(v->fullbooks)free(v->fullbooks);
-
-    /* free header, header1, header2 */
-    if(v->header)free(v->header);
-    if(v->header1)free(v->header1);
-    if(v->header2)free(v->header2);
 
+    if(b){
+      if(b->mode)free(b->mode);    
+      if(b->fullbooks)free(b->fullbooks);
+      
+      /* free header, header1, header2 */
+      if(b->header)free(b->header);
+      if(b->header1)free(b->header1);
+      if(b->header2)free(b->header2);
+      free(b);
+    }
+    
     memset(v,0,sizeof(vorbis_dsp_state));
   }
 }
@@ -331,11 +345,12 @@
 float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
   int i;
   vorbis_info *vi=v->vi;
+  backend_lookup_state *b=v->backend_state;
 
   /* free header, header1, header2 */
-  if(v->header)free(v->header);v->header=NULL;
-  if(v->header1)free(v->header1);v->header1=NULL;
-  if(v->header2)free(v->header2);v->header2=NULL;
+  if(b->header)free(b->header);b->header=NULL;
+  if(b->header1)free(b->header1);b->header1=NULL;
+  if(b->header2)free(b->header2);b->header2=NULL;
 
   /* Do we have enough storage space for the requested buffer? If not,
      expand the PCM (and envelope) storage */
@@ -388,6 +403,8 @@
 
 int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
   vorbis_info *vi=v->vi;
+  codec_setup_info *ci=vi->codec_setup;
+
   if(vals<=0){
     int order=32;
     int i;
@@ -403,9 +420,9 @@
        amplitude off a cliff, creating spread spectrum noise that will
        suck to encode.  Extrapolate for the sake of cleanliness. */
 
-    vorbis_analysis_buffer(v,v->vi->blocksizes[1]*2);
+    vorbis_analysis_buffer(v,ci->blocksizes[1]*2);
     v->eofflag=v->pcm_current;
-    v->pcm_current+=v->vi->blocksizes[1]*2;
+    v->pcm_current+=ci->blocksizes[1]*2;
 
     for(i=0;i<vi->channels;i++){
       if(v->eofflag>order*2){
@@ -414,7 +431,7 @@
 
         /* make a predictor filter */
         n=v->eofflag;
-	if(n>v->vi->blocksizes[1])n=v->vi->blocksizes[1];
+	if(n>ci->blocksizes[1])n=ci->blocksizes[1];
         vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
 
         /* run the predictor filter */
@@ -439,7 +456,7 @@
     /* we may want to reverse extrapolate the beginning of a stream
        too... in case we're beginning on a cliff! */
     /* clumsy, but simple.  It only runs once, so simple is good. */
-    if(!v->preextrapolate && v->pcm_current-v->centerW>v->vi->blocksizes[1])
+    if(!v->preextrapolate && v->pcm_current-v->centerW>ci->blocksizes[1])
       _preextrapolate_helper(v);
 
   }
@@ -451,7 +468,9 @@
 int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
   int i;
   vorbis_info *vi=v->vi;
-  long beginW=v->centerW-vi->blocksizes[v->W]/2,centerNext;
+  codec_setup_info *ci=vi->codec_setup;
+  backend_lookup_state *b=v->backend_state;
+  long beginW=v->centerW-ci->blocksizes[v->W]/2,centerNext;
 
   /* check to see if we're started... */
   if(!v->preextrapolate)return(0);
@@ -463,16 +482,16 @@
      the next boundary so we can determine nW (the next window size)
      which lets us compute the shape of the current block's window */
   
-  if(vi->blocksizes[0]<vi->blocksizes[1]){
+  if(ci->blocksizes[0]<ci->blocksizes[1]){
     long largebound;
     long bp;
 
     if(v->W)
       /* min boundary; nW large, next small */
-      largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]/4;
+      largebound=v->centerW+ci->blocksizes[1]*3/4+ci->blocksizes[0]/4;
     else
       /* min boundary; nW large, next small */
-      largebound=v->centerW+vi->blocksizes[1]*3/4+vi->blocksizes[0]*3/4;
+      largebound=v->centerW+ci->blocksizes[1]*3/4+ci->blocksizes[0]*3/4;
 
     bp=_ve_envelope_search(v,largebound);
     if(bp==-1)return(0); /* not enough data currently to search for a
@@ -482,12 +501,12 @@
   }else
     v->nW=0;
   
-  centerNext=v->centerW+vi->blocksizes[v->W]/4+vi->blocksizes[v->nW]/4;
+  centerNext=v->centerW+ci->blocksizes[v->W]/4+ci->blocksizes[v->nW]/4;
 
   {
     /* center of next block + next block maximum right side. */
 
-    long blockbound=centerNext+vi->blocksizes[v->nW]/2;
+    long blockbound=centerNext+ci->blocksizes[v->nW]/2;
     if(v->pcm_current<blockbound)return(0); /* not enough data yet;
                                                although this check is
                                                less strict that the
@@ -513,14 +532,14 @@
   vb->vd=v;
   vb->sequence=v->sequence;
   vb->granulepos=v->granulepos;
-  vb->pcmend=vi->blocksizes[v->W];
+  vb->pcmend=ci->blocksizes[v->W];
   
   /* copy the vectors; this uses the local storage in vb */
   {
     vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
     for(i=0;i<vi->channels;i++){
       vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
-      memcpy(vb->pcm[i],v->pcm[i]+beginW,vi->blocksizes[v->W]*sizeof(float));
+      memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(float));
     }
   }
   
@@ -538,10 +557,10 @@
 
   /* advance storage vectors and clean up */
   {
-    int new_centerNext=vi->blocksizes[1]/2;
+    int new_centerNext=ci->blocksizes[1]/2;
     int movementW=centerNext-new_centerNext;
 
-    _ve_envelope_shift(v->ve,movementW);
+    _ve_envelope_shift(b->ve,movementW);
     v->pcm_current-=movementW;
 
     for(i=0;i<vi->channels;i++)
@@ -573,11 +592,12 @@
 }
 
 int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
+  codec_setup_info *ci=vi->codec_setup;
   _vds_shared_init(v,vi,0);
 
   /* Adjust centerW to allow an easier mechanism for determining output */
   v->pcm_returned=v->centerW;
-  v->centerW-= vi->blocksizes[v->W]/4+vi->blocksizes[v->lW]/4;
+  v->centerW-= ci->blocksizes[v->W]/4+ci->blocksizes[v->lW]/4;
   v->granulepos=-1;
   v->sequence=-1;
 
@@ -590,15 +610,16 @@
 
 int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   vorbis_info *vi=v->vi;
+  codec_setup_info *ci=vi->codec_setup;
 
   /* Shift out any PCM that we returned previously */
   /* centerW is currently the center of the last block added */
-  if(v->pcm_returned  && v->centerW>vi->blocksizes[1]/2){
+  if(v->pcm_returned  && v->centerW>ci->blocksizes[1]/2){
 
     /* don't shift too much; we need to have a minimum PCM buffer of
        1/2 long block */
 
-    int shiftPCM=v->centerW-vi->blocksizes[1]/2;
+    int shiftPCM=v->centerW-ci->blocksizes[1]/2;
     shiftPCM=(v->pcm_returned<shiftPCM?v->pcm_returned:shiftPCM);
 
     v->pcm_current-=shiftPCM;
@@ -628,8 +649,8 @@
   v->sequence=vb->sequence;
 
   {
-    int sizeW=vi->blocksizes[v->W];
-    int centerW=v->centerW+vi->blocksizes[v->lW]/4+sizeW/4;
+    int sizeW=ci->blocksizes[v->W];
+    int centerW=v->centerW+ci->blocksizes[v->lW]/4+sizeW/4;
     int beginW=centerW-sizeW/2;
     int endW=beginW+sizeW;
     int beginSl;
@@ -639,7 +660,7 @@
     /* Do we have enough PCM/mult storage for the block? */
     if(endW>v->pcm_storage){
       /* expand the storage */
-      v->pcm_storage=endW+vi->blocksizes[1];
+      v->pcm_storage=endW+ci->blocksizes[1];
    
       for(i=0;i<vi->channels;i++)
         v->pcm[i]=realloc(v->pcm[i],v->pcm_storage*sizeof(float)); 
@@ -650,11 +671,11 @@
     switch(v->W){
     case 0:
       beginSl=0;
-      endSl=vi->blocksizes[0]/2;
+      endSl=ci->blocksizes[0]/2;
       break;
     case 1:
-      beginSl=vi->blocksizes[1]/4-vi->blocksizes[v->lW]/4;
-      endSl=beginSl+vi->blocksizes[v->lW]/2;
+      beginSl=ci->blocksizes[1]/4-ci->blocksizes[v->lW]/4;
+      endSl=beginSl+ci->blocksizes[v->lW]/2;
       break;
     }
 

1.18.2.2  +3 -4      vorbis/lib/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -r1.18.2.1 -r1.18.2.2
--- codebook.c	2000/10/20 06:19:40	1.18.2.1
+++ codebook.c	2000/11/03 10:05:47	1.18.2.2
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.18.2.1 2000/10/20 06:19:40 jack Exp $
+ last mod: $Id: codebook.c,v 1.18.2.2 2000/11/03 10:05:47 xiphmont Exp $
 
  ********************************************************************/
 
@@ -21,10 +21,8 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "vorbis/codebook.h"
+#include "codebook.h"
 #include "scales.h"
-#include "sharedbook.h"
-#include "bookinternal.h"
 #include "misc.h"
 #include "os.h"
 
@@ -150,6 +148,7 @@
 int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
   long i,j;
   memset(s,0,sizeof(static_codebook));
+  s->allocedp=1;
 
   /* make sure alignment is correct */
   if(oggpack_read(opb,24)!=0x564342)goto _eofout;

1.23.2.1  +10 -7     vorbis/lib/envelope.c

Index: envelope.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/envelope.c,v
retrieving revision 1.23
retrieving revision 1.23.2.1
diff -u -r1.23 -r1.23.2.1
--- envelope.c	2000/10/12 03:12:52	1.23
+++ envelope.c	2000/11/03 10:05:47	1.23.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.c,v 1.23 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: envelope.c,v 1.23.2.1 2000/11/03 10:05:47 xiphmont Exp $
 
  Preecho calculation.
 
@@ -24,6 +24,7 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 
 #include "os.h"
 #include "scales.h"
@@ -72,11 +73,12 @@
   2.3920318913};
 
 void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
+  codec_setup_info *ci=vi->codec_setup;
   int ch=vi->channels;
-  int window=vi->envelopesa;
+  int window=ci->envelopesa;
   int i;
   e->winlength=window;
-  e->minenergy=fromdB(vi->preecho_minenergy);
+  e->minenergy=fromdB(ci->preecho_minenergy);
   e->iir=calloc(ch,sizeof(IIR_state));
   e->filtered=calloc(ch,sizeof(float *));
   e->ch=ch;
@@ -156,7 +158,8 @@
 
 long _ve_envelope_search(vorbis_dsp_state *v,long searchpoint){
   vorbis_info *vi=v->vi;
-  envelope_lookup *ve=v->ve;
+  codec_setup_info *ci=vi->codec_setup;
+  envelope_lookup *ve=((backend_lookup_state *)(v->backend_state))->ve;
   long i,j;
   
   /* make sure we have enough storage to match the PCM */
@@ -180,7 +183,7 @@
   /* Now search through our cached highpass data for breaking points */
   /* starting point */
   if(v->W)
-    j=v->centerW+vi->blocksizes[1]/4-vi->blocksizes[0]/4;
+    j=v->centerW+ci->blocksizes[1]/4-ci->blocksizes[0]/4;
   else
     j=v->centerW;
 
@@ -190,14 +193,14 @@
       IIR_state *iir=ve->iir+i;
       float m=_ve_deltai(ve,iir,filtered-ve->winlength,filtered);
       
-      if(m>vi->preecho_thresh){
+      if(m>ci->preecho_thresh){
         /*granulepos++;*/
         return(0);
       }
       /*granulepos++;*/
     }
     
-    j+=vi->blocksizes[0]/2;
+    j+=ci->blocksizes[0]/2;
     if(j>=searchpoint)return(1);
   }
   

1.25.2.1  +23 -10    vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.25
retrieving revision 1.25.2.1
diff -u -r1.25 -r1.25.2.1
--- floor0.c	2000/10/12 03:12:52	1.25
+++ floor0.c	2000/11/03 10:05:47	1.25.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.25 2000/10/12 03:12:52 xiphmont Exp $
+ last mod: $Id: floor0.c,v 1.25.2.1 2000/11/03 10:05:47 xiphmont Exp $
 
  ********************************************************************/
 
@@ -21,11 +21,11 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
 #include "lpc.h"
 #include "lsp.h"
-#include "bookinternal.h"
-#include "sharedbook.h"
+#include "codebook.h"
 #include "scales.h"
 #include "misc.h"
 #include "os.h"
@@ -70,6 +70,13 @@
 
 /***********************************************/
 
+static vorbis_info_floor *floor0_copy_info (vorbis_info_floor *i){
+  vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
+  vorbis_info_floor0 *ret=malloc(sizeof(vorbis_info_floor0));
+  memcpy(ret,info,sizeof(vorbis_info_floor0));
+  return(ret);
+}
+
 static void floor0_free_info(vorbis_info_floor *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_floor0));
@@ -102,7 +109,9 @@
 }
 
 static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=vi->codec_setup;
   int j;
+
   vorbis_info_floor0 *info=malloc(sizeof(vorbis_info_floor0));
   info->order=oggpack_read(opb,8);
   info->rate=oggpack_read(opb,16);
@@ -115,12 +124,13 @@
   if(info->rate<1)goto err_out;
   if(info->barkmap<1)goto err_out;
   if(info->numbooks<1)goto err_out;
-
+    
   for(j=0;j<info->numbooks;j++){
     info->books[j]=oggpack_read(opb,8);
-    if(info->books[j]<0 || info->books[j]>=vi->books)goto err_out;
+    if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
   }
-  return(info);  
+  return(info);
+
  err_out:
   floor0_free_info(info);
   return(NULL);
@@ -139,10 +149,11 @@
   int j;
   float scale;
   vorbis_info        *vi=vd->vi;
+  codec_setup_info   *ci=vi->codec_setup;
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
   vorbis_look_floor0 *look=calloc(1,sizeof(vorbis_look_floor0));
   look->m=info->order;
-  look->n=vi->blocksizes[mi->blockflag]/2;
+  look->n=ci->blocksizes[mi->blockflag]/2;
   look->ln=info->barkmap;
   look->vi=info;
 
@@ -282,7 +293,8 @@
 
     /* the spec supports using one of a number of codebooks.  Right
        now, encode using this lib supports only one */
-    codebook *b=vb->vd->fullbooks+info->books[0];
+    backend_lookup_state *be=vb->vd->backend_state;
+    codebook *b=be->fullbooks+info->books[0];
     oggpack_write(&vb->opb,0,_ilog(info->numbooks));
 
     /* LSP <-> LPC is orthogonal and LSP quantizes more stably  */
@@ -354,7 +366,8 @@
     float *lsp=alloca(sizeof(float)*look->m);
 
     if(booknum!=-1){
-      codebook *b=vb->vd->fullbooks+info->books[booknum];
+      backend_lookup_state *be=vb->vd->backend_state;
+      codebook *b=be->fullbooks+info->books[booknum];
       float last=0.;
       
       memset(out,0,sizeof(double)*look->m);    
@@ -380,7 +393,7 @@
 
 /* export hooks */
 vorbis_func_floor floor0_exportbundle={
-  &floor0_pack,&floor0_unpack,&floor0_look,&floor0_free_info,
+  &floor0_pack,&floor0_unpack,&floor0_look,&floor0_copy_info,&floor0_free_info,
   &floor0_free_look,&floor0_forward,&floor0_inverse
 };
 

1.31.2.3  +148 -135  vorbis/lib/info.c

Index: info.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/info.c,v
retrieving revision 1.31.2.2
retrieving revision 1.31.2.3
diff -u -r1.31.2.2 -r1.31.2.3
--- info.c	2000/10/31 00:10:37	1.31.2.2
+++ info.c	2000/11/03 10:05:47	1.31.2.3
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c,v 1.31.2.2 2000/10/31 00:10:37 xiphmont Exp $
+ last mod: $Id: info.c,v 1.31.2.3 2000/11/03 10:05:47 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,9 +24,9 @@
 #include <ctype.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
-#include "sharedbook.h"
-#include "bookinternal.h"
+#include "backends.h"
+#include "codec_internal.h"
+#include "codebook.h"
 #include "registry.h"
 #include "window.h"
 #include "psy.h"
@@ -141,54 +141,52 @@
 /* used by synthesis, which has a full, alloced vi */
 void vorbis_info_init(vorbis_info *vi){
   memset(vi,0,sizeof(vorbis_info));
+  vi->codec_setup=calloc(1,sizeof(codec_setup_info));
 }
 
 void vorbis_info_clear(vorbis_info *vi){
+  codec_setup_info     *ci=vi->codec_setup;
   int i;
 
-  for(i=0;i<vi->modes;i++)
-    if(vi->mode_param[i])free(vi->mode_param[i]);
-  /*if(vi->mode_param)free(vi->mode_param);*/
- 
-  for(i=0;i<vi->maps;i++) /* unpack does the range checking */
-    _mapping_P[vi->map_type[i]]->free_info(vi->map_param[i]);
-  /*if(vi->map_param)free(vi->map_param);*/
-    
-  for(i=0;i<vi->times;i++) /* unpack does the range checking */
-    _time_P[vi->time_type[i]]->free_info(vi->time_param[i]);
-  /*if(vi->time_param)free(vi->time_param);*/
-    
-  for(i=0;i<vi->floors;i++) /* unpack does the range checking */
-    _floor_P[vi->floor_type[i]]->free_info(vi->floor_param[i]);
-  /*if(vi->floor_param)free(vi->floor_param);*/
+  if(ci){
+
+    for(i=0;i<ci->modes;i++)
+      if(ci->mode_param[i])free(ci->mode_param[i]);
+
+    for(i=0;i<ci->maps;i++) /* unpack does the range checking */
+      _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
+
+    for(i=0;i<ci->times;i++) /* unpack does the range checking */
+      _time_P[ci->time_type[i]]->free_info(ci->time_param[i]);
+
+    for(i=0;i<ci->floors;i++) /* unpack does the range checking */
+      _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
     
-  for(i=0;i<vi->residues;i++) /* unpack does the range checking */
-    _residue_P[vi->residue_type[i]]->free_info(vi->residue_param[i]);
-  /*if(vi->residue_param)free(vi->residue_param);*/
-
-  /* the static codebooks *are* freed if you call info_clear, because
-     decode side does alloc a 'static' codebook. Calling clear on the
-     full codebook does not clear the static codebook (that's our
-     responsibility) */
-  for(i=0;i<vi->books;i++){
-    /* just in case the decoder pre-cleared to save space */
-    if(vi->book_param[i]){
-      vorbis_staticbook_clear(vi->book_param[i]);
-      free(vi->book_param[i]);
+    for(i=0;i<ci->residues;i++) /* unpack does the range checking */
+      _residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
+
+    for(i=0;i<ci->books;i++){
+      if(ci->book_param[i]){
+	/* knows if the book was not alloced */
+	vorbis_staticbook_destroy(ci->book_param[i]);
+      }
     }
+    
+    for(i=0;i<ci->psys;i++)
+      _vi_psy_free(ci->psy_param[i]);
+
+    free(ci);
   }
-  /*if(vi->book_param)free(vi->book_param);*/
 
-  for(i=0;i<vi->psys;i++)
-    _vi_psy_free(vi->psy_param[i]);
-  /*if(vi->psy_param)free(vi->psy_param);*/
-  
   memset(vi,0,sizeof(vorbis_info));
 }
 
 /* Header packing/unpacking ********************************************/
 
 static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=vi->codec_setup;
+  if(!ci)return(OV_EFAULT);
+
   vi->version=oggpack_read(opb,32);
   if(vi->version!=0)return(OV_EVERSION);
 
@@ -199,13 +197,13 @@
   vi->bitrate_nominal=oggpack_read(opb,32);
   vi->bitrate_lower=oggpack_read(opb,32);
 
-  vi->blocksizes[0]=1<<oggpack_read(opb,4);
-  vi->blocksizes[1]=1<<oggpack_read(opb,4);
+  ci->blocksizes[0]=1<<oggpack_read(opb,4);
+  ci->blocksizes[1]=1<<oggpack_read(opb,4);
   
   if(vi->rate<1)goto err_out;
   if(vi->channels<1)goto err_out;
-  if(vi->blocksizes[0]<8)goto err_out; 
-  if(vi->blocksizes[1]<vi->blocksizes[0])goto err_out;
+  if(ci->blocksizes[0]<8)goto err_out; 
+  if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
   
   if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
 
@@ -244,73 +242,75 @@
 /* all of the real encoding details are here.  The modes, books,
    everything */
 static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
+  codec_setup_info     *ci=vi->codec_setup;
   int i;
+  if(!ci)return(OV_EFAULT);
 
   /* codebooks */
-  vi->books=oggpack_read(opb,8)+1;
-  /*vi->book_param=calloc(vi->books,sizeof(static_codebook *));*/
-  for(i=0;i<vi->books;i++){
-    vi->book_param[i]=calloc(1,sizeof(static_codebook));
-    if(vorbis_staticbook_unpack(opb,vi->book_param[i]))goto err_out;
+  ci->books=oggpack_read(opb,8)+1;
+  /*ci->book_param=calloc(ci->books,sizeof(static_codebook *));*/
+  for(i=0;i<ci->books;i++){
+    ci->book_param[i]=calloc(1,sizeof(static_codebook));
+    if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
   }
 
   /* time backend settings */
-  vi->times=oggpack_read(opb,6)+1;
-  /*vi->time_type=malloc(vi->times*sizeof(int));*/
-  /*vi->time_param=calloc(vi->times,sizeof(void *));*/
-  for(i=0;i<vi->times;i++){
-    vi->time_type[i]=oggpack_read(opb,16);
-    if(vi->time_type[i]<0 || vi->time_type[i]>=VI_TIMEB)goto err_out;
-    vi->time_param[i]=_time_P[vi->time_type[i]]->unpack(vi,opb);
-    if(!vi->time_param[i])goto err_out;
+  ci->times=oggpack_read(opb,6)+1;
+  /*ci->time_type=malloc(ci->times*sizeof(int));*/
+  /*ci->time_param=calloc(ci->times,sizeof(void *));*/
+  for(i=0;i<ci->times;i++){
+    ci->time_type[i]=oggpack_read(opb,16);
+    if(ci->time_type[i]<0 || ci->time_type[i]>=VI_TIMEB)goto err_out;
+    ci->time_param[i]=_time_P[ci->time_type[i]]->unpack(vi,opb);
+    if(!ci->time_param[i])goto err_out;
   }
 
   /* floor backend settings */
-  vi->floors=oggpack_read(opb,6)+1;
-  /*vi->floor_type=malloc(vi->floors*sizeof(int));*/
-  /*vi->floor_param=calloc(vi->floors,sizeof(void *));*/
-  for(i=0;i<vi->floors;i++){
-    vi->floor_type[i]=oggpack_read(opb,16);
-    if(vi->floor_type[i]<0 || vi->floor_type[i]>=VI_FLOORB)goto err_out;
-    vi->floor_param[i]=_floor_P[vi->floor_type[i]]->unpack(vi,opb);
-    if(!vi->floor_param[i])goto err_out;
+  ci->floors=oggpack_read(opb,6)+1;
+  /*ci->floor_type=malloc(ci->floors*sizeof(int));*/
+  /*ci->floor_param=calloc(ci->floors,sizeof(void *));*/
+  for(i=0;i<ci->floors;i++){
+    ci->floor_type[i]=oggpack_read(opb,16);
+    if(ci->floor_type[i]<0 || ci->floor_type[i]>=VI_FLOORB)goto err_out;
+    ci->floor_param[i]=_floor_P[ci->floor_type[i]]->unpack(vi,opb);
+    if(!ci->floor_param[i])goto err_out;
   }
 
   /* residue backend settings */
-  vi->residues=oggpack_read(opb,6)+1;
-  /*vi->residue_type=malloc(vi->residues*sizeof(int));*/
-  /*vi->residue_param=calloc(vi->residues,sizeof(void *));*/
-  for(i=0;i<vi->residues;i++){
-    vi->residue_type[i]=oggpack_read(opb,16);
-    if(vi->residue_type[i]<0 || vi->residue_type[i]>=VI_RESB)goto err_out;
-    vi->residue_param[i]=_residue_P[vi->residue_type[i]]->unpack(vi,opb);
-    if(!vi->residue_param[i])goto err_out;
+  ci->residues=oggpack_read(opb,6)+1;
+  /*ci->residue_type=malloc(ci->residues*sizeof(int));*/
+  /*ci->residue_param=calloc(ci->residues,sizeof(void *));*/
+  for(i=0;i<ci->residues;i++){
+    ci->residue_type[i]=oggpack_read(opb,16);
+    if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
+    ci->residue_param[i]=_residue_P[ci->residue_type[i]]->unpack(vi,opb);
+    if(!ci->residue_param[i])goto err_out;
   }
 
   /* map backend settings */
-  vi->maps=oggpack_read(opb,6)+1;
-  /*vi->map_type=malloc(vi->maps*sizeof(int));*/
-  /*vi->map_param=calloc(vi->maps,sizeof(void *));*/
-  for(i=0;i<vi->maps;i++){
-    vi->map_type[i]=oggpack_read(opb,16);
-    if(vi->map_type[i]<0 || vi->map_type[i]>=VI_MAPB)goto err_out;
-    vi->map_param[i]=_mapping_P[vi->map_type[i]]->unpack(vi,opb);
-    if(!vi->map_param[i])goto err_out;
+  ci->maps=oggpack_read(opb,6)+1;
+  /*ci->map_type=malloc(ci->maps*sizeof(int));*/
+  /*ci->map_param=calloc(ci->maps,sizeof(void *));*/
+  for(i=0;i<ci->maps;i++){
+    ci->map_type[i]=oggpack_read(opb,16);
+    if(ci->map_type[i]<0 || ci->map_type[i]>=VI_MAPB)goto err_out;
+    ci->map_param[i]=_mapping_P[ci->map_type[i]]->unpack(vi,opb);
+    if(!ci->map_param[i])goto err_out;
   }
   
   /* mode settings */
-  vi->modes=oggpack_read(opb,6)+1;
+  ci->modes=oggpack_read(opb,6)+1;
   /*vi->mode_param=calloc(vi->modes,sizeof(void *));*/
-  for(i=0;i<vi->modes;i++){
-    vi->mode_param[i]=calloc(1,sizeof(vorbis_info_mode));
-    vi->mode_param[i]->blockflag=oggpack_read(opb,1);
-    vi->mode_param[i]->windowtype=oggpack_read(opb,16);
-    vi->mode_param[i]->transformtype=oggpack_read(opb,16);
-    vi->mode_param[i]->mapping=oggpack_read(opb,8);
-
-    if(vi->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
-    if(vi->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
-    if(vi->mode_param[i]->mapping>=vi->maps)goto err_out;
+  for(i=0;i<ci->modes;i++){
+    ci->mode_param[i]=calloc(1,sizeof(vorbis_info_mode));
+    ci->mode_param[i]->blockflag=oggpack_read(opb,1);
+    ci->mode_param[i]->windowtype=oggpack_read(opb,16);
+    ci->mode_param[i]->transformtype=oggpack_read(opb,16);
+    ci->mode_param[i]->mapping=oggpack_read(opb,8);
+
+    if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
+    if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
+    if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
   }
   
   if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
@@ -385,6 +385,9 @@
 /* pack side **********************************************************/
 
 static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
+  codec_setup_info     *ci=vi->codec_setup;
+  if(!ci)return(OV_EFAULT);
+
   /* preamble */  
   oggpack_write(opb,0x01,8);
   _v_writestring(opb,"vorbis");
@@ -398,8 +401,8 @@
   oggpack_write(opb,vi->bitrate_nominal,32);
   oggpack_write(opb,vi->bitrate_lower,32);
 
-  oggpack_write(opb,ilog2(vi->blocksizes[0]),4);
-  oggpack_write(opb,ilog2(vi->blocksizes[1]),4);
+  oggpack_write(opb,ilog2(ci->blocksizes[0]),4);
+  oggpack_write(opb,ilog2(ci->blocksizes[1]),4);
   oggpack_write(opb,1,1);
 
   return(0);
@@ -436,50 +439,53 @@
 }
  
 static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
+  codec_setup_info     *ci=vi->codec_setup;
   int i;
+  if(!ci)return(OV_EFAULT);
+
   oggpack_write(opb,0x05,8);
   _v_writestring(opb,"vorbis");
 
   /* books */
-  oggpack_write(opb,vi->books-1,8);
-  for(i=0;i<vi->books;i++)
-    if(vorbis_staticbook_pack(vi->book_param[i],opb))goto err_out;
+  oggpack_write(opb,ci->books-1,8);
+  for(i=0;i<ci->books;i++)
+    if(vorbis_staticbook_pack(ci->book_param[i],opb))goto err_out;
 
   /* times */
-  oggpack_write(opb,vi->times-1,6);
-  for(i=0;i<vi->times;i++){
-    oggpack_write(opb,vi->time_type[i],16);
-    _time_P[vi->time_type[i]]->pack(vi->time_param[i],opb);
+  oggpack_write(opb,ci->times-1,6);
+  for(i=0;i<ci->times;i++){
+    oggpack_write(opb,ci->time_type[i],16);
+    _time_P[ci->time_type[i]]->pack(ci->time_param[i],opb);
   }
 
   /* floors */
-  oggpack_write(opb,vi->floors-1,6);
-  for(i=0;i<vi->floors;i++){
-    oggpack_write(opb,vi->floor_type[i],16);
-    _floor_P[vi->floor_type[i]]->pack(vi->floor_param[i],opb);
+  oggpack_write(opb,ci->floors-1,6);
+  for(i=0;i<ci->floors;i++){
+    oggpack_write(opb,ci->floor_type[i],16);
+    _floor_P[ci->floor_type[i]]->pack(ci->floor_param[i],opb);
   }
 
   /* residues */
-  oggpack_write(opb,vi->residues-1,6);
-  for(i=0;i<vi->residues;i++){
-    oggpack_write(opb,vi->residue_type[i],16);
-    _residue_P[vi->residue_type[i]]->pack(vi->residue_param[i],opb);
+  oggpack_write(opb,ci->residues-1,6);
+  for(i=0;i<ci->residues;i++){
+    oggpack_write(opb,ci->residue_type[i],16);
+    _residue_P[ci->residue_type[i]]->pack(ci->residue_param[i],opb);
   }
 
   /* maps */
-  oggpack_write(opb,vi->maps-1,6);
-  for(i=0;i<vi->maps;i++){
-    oggpack_write(opb,vi->map_type[i],16);
-    _mapping_P[vi->map_type[i]]->pack(vi,vi->map_param[i],opb);
+  oggpack_write(opb,ci->maps-1,6);
+  for(i=0;i<ci->maps;i++){
+    oggpack_write(opb,ci->map_type[i],16);
+    _mapping_P[ci->map_type[i]]->pack(vi,ci->map_param[i],opb);
   }
 
   /* modes */
-  oggpack_write(opb,vi->modes-1,6);
-  for(i=0;i<vi->modes;i++){
-    oggpack_write(opb,vi->mode_param[i]->blockflag,1);
-    oggpack_write(opb,vi->mode_param[i]->windowtype,16);
-    oggpack_write(opb,vi->mode_param[i]->transformtype,16);
-    oggpack_write(opb,vi->mode_param[i]->mapping,8);
+  oggpack_write(opb,ci->modes-1,6);
+  for(i=0;i<ci->modes;i++){
+    oggpack_write(opb,ci->mode_param[i]->blockflag,1);
+    oggpack_write(opb,ci->mode_param[i]->windowtype,16);
+    oggpack_write(opb,ci->mode_param[i]->transformtype,16);
+    oggpack_write(opb,ci->mode_param[i]->mapping,8);
   }
   oggpack_write(opb,1,1);
 
@@ -493,8 +499,15 @@
                               ogg_packet *op,
                               ogg_packet *op_comm,
                               ogg_packet *op_code){
+  int ret=OV_EIMPL;
   vorbis_info *vi=v->vi;
   oggpack_buffer opb;
+  backend_lookup_state *b=v->backend_state;
+
+  if(!b){
+    ret=OV_EFAULT;
+    goto err_out;
+  }
 
   /* first header packet **********************************************/
 
@@ -502,10 +515,10 @@
   if(_vorbis_pack_info(&opb,vi))goto err_out;
 
   /* build the packet */
-  if(v->header)free(v->header);
-  v->header=malloc(oggpack_bytes(&opb));
-  memcpy(v->header,opb.buffer,oggpack_bytes(&opb));
-  op->packet=v->header;
+  if(b->header)free(b->header);
+  b->header=malloc(oggpack_bytes(&opb));
+  memcpy(b->header,opb.buffer,oggpack_bytes(&opb));
+  op->packet=b->header;
   op->bytes=oggpack_bytes(&opb);
   op->b_o_s=1;
   op->e_o_s=0;
@@ -516,10 +529,10 @@
   oggpack_reset(&opb);
   if(_vorbis_pack_comment(&opb,vc))goto err_out;
 
-  if(v->header1)free(v->header1);
-  v->header1=malloc(oggpack_bytes(&opb));
-  memcpy(v->header1,opb.buffer,oggpack_bytes(&opb));
-  op_comm->packet=v->header1;
+  if(b->header1)free(b->header1);
+  b->header1=malloc(oggpack_bytes(&opb));
+  memcpy(b->header1,opb.buffer,oggpack_bytes(&opb));
+  op_comm->packet=b->header1;
   op_comm->bytes=oggpack_bytes(&opb);
   op_comm->b_o_s=0;
   op_comm->e_o_s=0;
@@ -530,10 +543,10 @@
   oggpack_reset(&opb);
   if(_vorbis_pack_books(&opb,vi))goto err_out;
 
-  if(v->header2)free(v->header2);
-  v->header2=malloc(oggpack_bytes(&opb));
-  memcpy(v->header2,opb.buffer,oggpack_bytes(&opb));
-  op_code->packet=v->header2;
+  if(b->header2)free(b->header2);
+  b->header2=malloc(oggpack_bytes(&opb));
+  memcpy(b->header2,opb.buffer,oggpack_bytes(&opb));
+  op_code->packet=b->header2;
   op_code->bytes=oggpack_bytes(&opb);
   op_code->b_o_s=0;
   op_code->e_o_s=0;
@@ -547,12 +560,12 @@
   memset(op_comm,0,sizeof(ogg_packet));
   memset(op_code,0,sizeof(ogg_packet));
 
-  if(v->header)free(v->header);
-  if(v->header1)free(v->header1);
-  if(v->header2)free(v->header2);
-  v->header=NULL;
-  v->header1=NULL;
-  v->header2=NULL;
-  return(OV_EIMPL);
+  if(b->header)free(b->header);
+  if(b->header1)free(b->header1);
+  if(b->header2)free(b->header2);
+  b->header=NULL;
+  b->header1=NULL;
+  b->header2=NULL;
+  return(ret);
 }
 

1.10.2.3  +2 -2      vorbis/lib/lsp.c

Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lsp.c,v
retrieving revision 1.10.2.2
retrieving revision 1.10.2.3
diff -u -r1.10.2.2 -r1.10.2.3
--- lsp.c	2000/10/19 21:56:40	1.10.2.2
+++ lsp.c	2000/11/03 10:05:47	1.10.2.3
@@ -12,7 +12,7 @@
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.c,v 1.10.2.2 2000/10/19 21:56:40 jack Exp $
+  last mod: $Id: lsp.c,v 1.10.2.3 2000/11/03 10:05:47 xiphmont Exp $
 
   The LSP generation code is taken (with minimal modification) from
   "On the Computation of the LSP Frequencies" by Joseph Rothweiler
@@ -72,7 +72,7 @@
 
   i=0;
   while(i<n){
-    int j,k=map[i];
+    int k=map[i];
     int qexp;
     float p=.7071067812;
     float q=.7071067812;

1.16.2.1  +38 -26    vorbis/lib/mapping0.c

Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.16
retrieving revision 1.16.2.1
diff -u -r1.16 -r1.16.2.1
--- mapping0.c	2000/10/12 03:12:53	1.16
+++ mapping0.c	2000/11/03 10:05:47	1.16.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.16 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.16.2.1 2000/11/03 10:05:47 xiphmont Exp $
 
  ********************************************************************/
 
@@ -21,8 +21,8 @@
 #include <math.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
-#include "vorbis/backends.h"
-#include "bookinternal.h"
+#include "codec_internal.h"
+#include "codebook.h"
 #include "registry.h"
 #include "psy.h"
 #include "misc.h"
@@ -56,6 +56,13 @@
                      invalidate decay */
 } vorbis_look_mapping0;
 
+static vorbis_info_mapping *mapping0_copy_info(vorbis_info_mapping *vm){
+  vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
+  vorbis_info_mapping0 *ret=malloc(sizeof(vorbis_info_mapping0));
+  memcpy(ret,info,sizeof(vorbis_info_mapping0));
+  return(ret);
+}
+
 static void mapping0_free_info(vorbis_info_mapping *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_mapping0));
@@ -96,7 +103,8 @@
 static vorbis_look_mapping *mapping0_look(vorbis_dsp_state *vd,vorbis_info_mode *vm,
                           vorbis_info_mapping *m){
   int i;
-  vorbis_info *vi=vd->vi;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
   vorbis_look_mapping0 *look=calloc(1,sizeof(vorbis_look_mapping0));
   vorbis_info_mapping0 *info=look->map=(vorbis_info_mapping0 *)m;
   look->mode=vm;
@@ -105,7 +113,7 @@
   look->floor_look=calloc(info->submaps,sizeof(vorbis_look_floor *));
 
   look->residue_look=calloc(info->submaps,sizeof(vorbis_look_residue *));
-  if(vi->psys)look->psy_look=calloc(info->submaps,sizeof(vorbis_look_psy));
+  if(ci->psys)look->psy_look=calloc(info->submaps,sizeof(vorbis_look_psy));
 
   look->time_func=calloc(info->submaps,sizeof(vorbis_func_time *));
   look->floor_func=calloc(info->submaps,sizeof(vorbis_func_floor *));
@@ -116,28 +124,28 @@
     int floornum=info->floorsubmap[i];
     int resnum=info->residuesubmap[i];
 
-    look->time_func[i]=_time_P[vi->time_type[timenum]];
+    look->time_func[i]=_time_P[ci->time_type[timenum]];
     look->time_look[i]=look->time_func[i]->
-      look(vd,vm,vi->time_param[timenum]);
-    look->floor_func[i]=_floor_P[vi->floor_type[floornum]];
+      look(vd,vm,ci->time_param[timenum]);
+    look->floor_func[i]=_floor_P[ci->floor_type[floornum]];
     look->floor_look[i]=look->floor_func[i]->
-      look(vd,vm,vi->floor_param[floornum]);
-    look->residue_func[i]=_residue_P[vi->residue_type[resnum]];
+      look(vd,vm,ci->floor_param[floornum]);
+    look->residue_func[i]=_residue_P[ci->residue_type[resnum]];
     look->residue_look[i]=look->residue_func[i]->
-      look(vd,vm,vi->residue_param[resnum]);
+      look(vd,vm,ci->residue_param[resnum]);
     
-    if(vi->psys && vd->analysisp){
+    if(ci->psys && vd->analysisp){
       int psynum=info->psysubmap[i];
-      _vp_psy_init(look->psy_look+i,vi->psy_param[psynum],
-		   vi->blocksizes[vm->blockflag]/2,vi->rate);
+      _vp_psy_init(look->psy_look+i,ci->psy_param[psynum],
+		   ci->blocksizes[vm->blockflag]/2,vi->rate);
     }
   }
 
   look->ch=vi->channels;
-  if(vi->psys){
+  if(ci->psys){
     look->decay=calloc(vi->channels,sizeof(float *));
     for(i=0;i<vi->channels;i++)
-      look->decay[i]=calloc(vi->blocksizes[vm->blockflag]/2,sizeof(float));
+      look->decay[i]=calloc(ci->blocksizes[vm->blockflag]/2,sizeof(float));
   }
 
   return(look);
@@ -164,6 +172,7 @@
 static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   int i;
   vorbis_info_mapping0 *info=calloc(1,sizeof(vorbis_info_mapping0));
+  codec_setup_info     *ci=vi->codec_setup;
   memset(info,0,sizeof(vorbis_info_mapping0));
 
   info->submaps=oggpack_read(opb,4)+1;
@@ -176,11 +185,11 @@
   }
   for(i=0;i<info->submaps;i++){
     info->timesubmap[i]=oggpack_read(opb,8);
-    if(info->timesubmap[i]>=vi->times)goto err_out;
+    if(info->timesubmap[i]>=ci->times)goto err_out;
     info->floorsubmap[i]=oggpack_read(opb,8);
-    if(info->floorsubmap[i]>=vi->floors)goto err_out;
+    if(info->floorsubmap[i]>=ci->floors)goto err_out;
     info->residuesubmap[i]=oggpack_read(opb,8);
-    if(info->residuesubmap[i]>=vi->residues)goto err_out;
+    if(info->residuesubmap[i]>=ci->residues)goto err_out;
   }
 
   return info;
@@ -203,12 +212,13 @@
 static int mapping0_forward(vorbis_block *vb,vorbis_look_mapping *l){
   vorbis_dsp_state     *vd=vb->vd;
   vorbis_info          *vi=vd->vi;
+  backend_lookup_state *b=vb->vd->backend_state;
   vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0 *info=look->map;
   vorbis_info_mode     *mode=look->mode;
   int                   n=vb->pcmend;
   int i,j;
-  float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+  float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
 
   float **pcmbundle=alloca(sizeof(float *)*vi->channels);
   int *nonzero=alloca(sizeof(int)*vi->channels);
@@ -229,7 +239,7 @@
   /* only MDCT right now.... */
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
-    mdct_forward(vd->transform[vb->W][0],pcm,pcm);
+    mdct_forward(b->transform[vb->W][0],pcm,pcm);
   }
 
   {
@@ -305,13 +315,15 @@
 static int mapping0_inverse(vorbis_block *vb,vorbis_look_mapping *l){
   vorbis_dsp_state     *vd=vb->vd;
   vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  backend_lookup_state *b=vd->backend_state;
   vorbis_look_mapping0 *look=(vorbis_look_mapping0 *)l;
   vorbis_info_mapping0 *info=look->map;
   vorbis_info_mode     *mode=look->mode;
   int                   i,j;
-  long                  n=vb->pcmend=vi->blocksizes[vb->W];
+  long                  n=vb->pcmend=ci->blocksizes[vb->W];
 
-  float *window=vd->window[vb->W][vb->lW][vb->nW][mode->windowtype];
+  float *window=b->window[vb->W][vb->lW][vb->nW][mode->windowtype];
   float **pcmbundle=alloca(sizeof(float *)*vi->channels);
   int *nonzero=alloca(sizeof(int)*vi->channels);
   
@@ -346,7 +358,7 @@
   for(i=0;i<vi->channels;i++){
     float *pcm=vb->pcm[i];
     _analysis_output("out",seq+i,pcm,n/2,0,1);
-    mdct_backward(vd->transform[vb->W][0],pcm,pcm);
+    mdct_backward(b->transform[vb->W][0],pcm,pcm);
   }
 
   /* now apply the decoded pre-window time information */
@@ -373,8 +385,8 @@
 
 /* export hooks */
 vorbis_func_mapping mapping0_exportbundle={
-  &mapping0_pack,&mapping0_unpack,&mapping0_look,&mapping0_free_info,
-  &mapping0_free_look,&mapping0_forward,&mapping0_inverse
+  &mapping0_pack,&mapping0_unpack,&mapping0_look,&mapping0_copy_info,
+  &mapping0_free_info,&mapping0_free_look,&mapping0_forward,&mapping0_inverse
 };
 
 

1.29.2.1  +7 -1      vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.29
retrieving revision 1.29.2.1
diff -u -r1.29 -r1.29.2.1
--- psy.c	2000/10/12 03:12:53	1.29
+++ psy.c	2000/11/03 10:05:48	1.29.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.29 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: psy.c,v 1.29.2.1 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -39,6 +39,12 @@
     memset(i,0,sizeof(vorbis_info_psy));
     free(i);
   }
+}
+
+vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i){
+  vorbis_info_psy *ret=malloc(sizeof(vorbis_info_psy));
+  memcpy(ret,i,sizeof(vorbis_info_psy));
+  return(ret);
 }
 
 /* Set up decibel threshhold slopes on a Bark frequency scale */

1.15.2.1  +39 -1     vorbis/lib/psy.h

Index: psy.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.h,v
retrieving revision 1.15
retrieving revision 1.15.2.1
diff -u -r1.15 -r1.15.2.1
--- psy.h	2000/10/12 03:12:53	1.15
+++ psy.h	2000/11/03 10:05:48	1.15.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h,v 1.15 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: psy.h,v 1.15.2.1 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,6 +24,41 @@
 #define EHMER_MAX 56
 #endif
 
+/* psychoacoustic setup ********************************************/
+#define MAX_BARK 27
+#define P_BANDS 17
+#define P_LEVELS 11
+typedef struct vorbis_info_psy{
+  int    athp;
+  int    decayp;
+  int    smoothp;
+
+  int    noisecullp;
+  float noisecull_barkwidth;
+
+  float ath_adjatt;
+  float ath_maxatt;
+
+  /*     0  1  2   3   4   5   6   7   8   9  10  11  12  13  14  15   16   */
+  /* x: 63 88 125 175 250 350 500 700 1k 1.4k 2k 2.8k 4k 5.6k 8k 11.5k 16k Hz */
+  /* y: 0 10 20 30 40 50 60 70 80 90 100 dB */
+
+  int tonemaskp;
+  float toneatt[P_BANDS][P_LEVELS];
+
+  int peakattp;
+  float peakatt[P_BANDS][P_LEVELS];
+
+  int noisemaskp;
+  float noiseatt[P_BANDS][P_LEVELS];
+
+  float max_curve_dB;
+
+  /* decay setup */
+  float attack_coeff;
+  float decay_coeff;
+} vorbis_info_psy;
+
 typedef struct {
   int n;
   struct vorbis_info_psy *vi;
@@ -41,7 +76,10 @@
 extern void   _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,int n,long rate);
 extern void   _vp_psy_clear(vorbis_look_psy *p);
 extern void  *_vi_psy_dup(void *source);
+
 extern void   _vi_psy_free(vorbis_info_psy *i);
+extern vorbis_info_psy *_vi_psy_copy(vorbis_info_psy *i);
+
 extern void   _vp_compute_mask(vorbis_look_psy *p,float *f, 
                                float *floor,
                                float *decay);

1.2.14.1  +3 -1      vorbis/lib/registry.h

Index: registry.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/registry.h,v
retrieving revision 1.2
retrieving revision 1.2.14.1
diff -u -r1.2 -r1.2.14.1
--- registry.h	2000/01/22 13:28:30	1.2
+++ registry.h	2000/11/03 10:05:48	1.2.14.1
@@ -12,12 +12,14 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h,v 1.2 2000/01/22 13:28:30 xiphmont Exp $
+ last mod: $Id: registry.h,v 1.2.14.1 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
 #ifndef _V_REG_H_
 #define _V_REG_H_
+
+#include "backends.h"
 
 #define VI_TRANSFORMB 1
 #define VI_WINDOWB 1

1.18.2.1  +18 -7     vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.18
retrieving revision 1.18.2.1
diff -u -r1.18 -r1.18.2.1
--- res0.c	2000/10/12 03:12:53	1.18
+++ res0.c	2000/11/03 10:05:48	1.18.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: residue backend 0 implementation
- last mod: $Id: res0.c,v 1.18 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: res0.c,v 1.18.2.1 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -27,9 +27,9 @@
 #include <stdio.h>
 #include <ogg/ogg.h>
 #include "vorbis/codec.h"
+#include "codec_internal.h"
 #include "registry.h"
-#include "bookinternal.h"
-#include "sharedbook.h"
+#include "codebook.h"
 #include "misc.h"
 #include "os.h"
 
@@ -45,6 +45,13 @@
   int       **decodemap;
 } vorbis_look_residue0;
 
+vorbis_info_residue *res0_copy_info(vorbis_info_residue *vr){
+  vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
+  vorbis_info_residue0 *ret=malloc(sizeof(vorbis_info_residue0));
+  memcpy(ret,info,sizeof(vorbis_info_residue0));
+  return(ret);
+}
+
 void res0_free_info(vorbis_info_residue *i){
   if(i){
     memset(i,0,sizeof(vorbis_info_residue0));
@@ -90,6 +97,7 @@
 vorbis_info_residue *res0_unpack(vorbis_info *vi,oggpack_buffer *opb){
   int j,acc=0;
   vorbis_info_residue0 *info=calloc(1,sizeof(vorbis_info_residue0));
+  codec_setup_info     *ci=vi->codec_setup;
 
   info->begin=oggpack_read(opb,24);
   info->end=oggpack_read(opb,24);
@@ -106,9 +114,9 @@
   for(j=0;j<acc;j++)
     info->booklist[j]=oggpack_read(opb,8);
 
-  if(info->groupbook>=vi->books)goto errout;
+  if(info->groupbook>=ci->books)goto errout;
   for(j=0;j<acc;j++)
-    if(info->booklist[j]>=vi->books)goto errout;
+    if(info->booklist[j]>=ci->books)goto errout;
 
   return(info);
  errout:
@@ -120,13 +128,15 @@
                           vorbis_info_residue *vr){
   vorbis_info_residue0 *info=(vorbis_info_residue0 *)vr;
   vorbis_look_residue0 *look=calloc(1,sizeof(vorbis_look_residue0));
+  backend_lookup_state *be=vd->backend_state;
+
   int j,k,acc=0;
   int dim;
   look->info=info;
   look->map=vm->mapping;
 
   look->parts=info->partitions;
-  look->phrasebook=vd->fullbooks+info->groupbook;
+  look->phrasebook=be->fullbooks+info->groupbook;
   dim=look->phrasebook->dim;
 
   look->partbooks=calloc(look->parts,sizeof(codebook **));
@@ -136,7 +146,7 @@
     if(stages){
       look->partbooks[j]=malloc(stages*sizeof(codebook *));
       for(k=0;k<stages;k++)
-	look->partbooks[j][k]=vd->fullbooks+info->booklist[acc++];
+	look->partbooks[j][k]=be->fullbooks+info->booklist[acc++];
     }
   }
 
@@ -380,6 +390,7 @@
   &res0_pack,
   &res0_unpack,
   &res0_look,
+  &res0_copy_info,
   &res0_free_info,
   &res0_free_look,
   &res0_forward,

1.9.2.1   +27 -18    vorbis/lib/sharedbook.c

Index: sharedbook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/sharedbook.c,v
retrieving revision 1.9
retrieving revision 1.9.2.1
diff -u -r1.9 -r1.9.2.1
--- sharedbook.c	2000/10/12 03:12:54	1.9
+++ sharedbook.c	2000/11/03 10:05:48	1.9.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.9 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: sharedbook.c,v 1.9.2.1 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -22,9 +22,8 @@
 #include <ogg/ogg.h>
 #include "os.h"
 #include "vorbis/codec.h"
-#include "vorbis/codebook.h"
+#include "codebook.h"
 #include "scales.h"
-#include "sharedbook.h"
 
 /**** pack/unpack helpers ******************************************/
 int _ilog(unsigned int v){
@@ -281,23 +280,33 @@
 }
 
 void vorbis_staticbook_clear(static_codebook *b){
-  if(b->quantlist)free(b->quantlist);
-  if(b->lengthlist)free(b->lengthlist);
-  if(b->nearest_tree){
-    free(b->nearest_tree->ptr0);
-    free(b->nearest_tree->ptr1);
-    free(b->nearest_tree->p);
-    free(b->nearest_tree->q);
-    memset(b->nearest_tree,0,sizeof(encode_aux_nearestmatch));
-    free(b->nearest_tree);
+  if(b->allocedp){
+    if(b->quantlist)free(b->quantlist);
+    if(b->lengthlist)free(b->lengthlist);
+    if(b->nearest_tree){
+      free(b->nearest_tree->ptr0);
+      free(b->nearest_tree->ptr1);
+      free(b->nearest_tree->p);
+      free(b->nearest_tree->q);
+      memset(b->nearest_tree,0,sizeof(encode_aux_nearestmatch));
+      free(b->nearest_tree);
+    }
+    if(b->thresh_tree){
+      free(b->thresh_tree->quantthresh);
+      free(b->thresh_tree->quantmap);
+      memset(b->thresh_tree,0,sizeof(encode_aux_threshmatch));
+      free(b->thresh_tree);
+    }
+
+    memset(b,0,sizeof(static_codebook));
   }
-  if(b->thresh_tree){
-    free(b->thresh_tree->quantthresh);
-    free(b->thresh_tree->quantmap);
-    memset(b->thresh_tree,0,sizeof(encode_aux_threshmatch));
-    free(b->thresh_tree);
+}
+
+void vorbis_staticbook_destroy(static_codebook *b){
+  if(b->allocedp){
+    vorbis_staticbook_clear(b);
+    free(b);
   }
-  memset(b,0,sizeof(static_codebook));
 }
 
 void vorbis_book_clear(codebook *b){

1.18.2.2  +12 -10    vorbis/lib/synthesis.c

Index: synthesis.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/synthesis.c,v
retrieving revision 1.18.2.1
retrieving revision 1.18.2.2
diff -u -r1.18.2.1 -r1.18.2.2
--- synthesis.c	2000/10/14 03:14:07	1.18.2.1
+++ synthesis.c	2000/11/03 10:05:48	1.18.2.2
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c,v 1.18.2.1 2000/10/14 03:14:07 xiphmont Exp $
+ last mod: $Id: synthesis.c,v 1.18.2.2 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -24,10 +24,12 @@
 #include "os.h"
 
 int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
-  vorbis_dsp_state *vd=vb->vd;
-  vorbis_info      *vi=vd->vi;
-  oggpack_buffer   *opb=&vb->opb;
-  int              type,mode,i;
+  vorbis_dsp_state     *vd=vb->vd;
+  backend_lookup_state *b=vd->backend_state;
+  vorbis_info          *vi=vd->vi;
+  codec_setup_info     *ci=vi->codec_setup;
+  oggpack_buffer       *opb=&vb->opb;
+  int                   type,mode,i;
  
   /* first things first.  Make sure decode is ready */
   _vorbis_block_ripcord(vb);
@@ -40,11 +42,11 @@
   }
 
   /* read our mode and pre/post windowsize */
-  mode=oggpack_read(opb,vd->modebits);
+  mode=oggpack_read(opb,b->modebits);
   if(mode==-1)return(OV_EBADPACKET);
   
   vb->mode=mode;
-  vb->W=vi->mode_param[mode]->blockflag;
+  vb->W=ci->mode_param[mode]->blockflag;
   if(vb->W){
     vb->lW=oggpack_read(opb,1);
     vb->nW=oggpack_read(opb,1);
@@ -60,15 +62,15 @@
   vb->eofflag=op->e_o_s;
 
   /* alloc pcm passback storage */
-  vb->pcmend=vi->blocksizes[vb->W];
+  vb->pcmend=ci->blocksizes[vb->W];
   vb->pcm=_vorbis_block_alloc(vb,sizeof(float *)*vi->channels);
   for(i=0;i<vi->channels;i++)
     vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(float));
 
   /* unpack_header enforces range checking */
-  type=vi->map_type[vi->mode_param[mode]->mapping];
+  type=ci->map_type[ci->mode_param[mode]->mapping];
 
-  return(_mapping_P[type]->inverse(vb,vd->mode[mode]));
+  return(_mapping_P[type]->inverse(vb,b->mode[mode]));
 }
 
 

1.6.2.1   +5 -2      vorbis/lib/time0.c

Index: time0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/time0.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -u -r1.6 -r1.6.2.1
--- time0.c	2000/10/12 03:12:54	1.6
+++ time0.c	2000/11/03 10:05:48	1.6.2.1
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: time backend 0 (dummy)
- last mod: $Id: time0.c,v 1.6 2000/10/12 03:12:54 xiphmont Exp $
+ last mod: $Id: time0.c,v 1.6.2.1 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -28,6 +28,9 @@
   return "";
 
 }
+static vorbis_info_time *time0_copy_info (vorbis_info_time *vi){
+  return "";
+}
 static vorbis_look_time *time0_look (vorbis_dsp_state *vd,vorbis_info_mode *mi,
                               vorbis_info_time *i){
   return "";
@@ -47,6 +50,6 @@
 
 /* export hooks */
 vorbis_func_time time0_exportbundle={
-  &time0_pack,&time0_unpack,&time0_look,&time0_free_info,
+  &time0_pack,&time0_unpack,&time0_look,&time0_copy_info,&time0_free_info,
   &time0_free_look,&time0_forward,&time0_inverse
 };

1.30.2.3  +1 -2      vorbis/lib/vorbisfile.c

Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.30.2.2
retrieving revision 1.30.2.3
diff -u -r1.30.2.2 -r1.30.2.3
--- vorbisfile.c	2000/10/19 10:21:02	1.30.2.2
+++ vorbisfile.c	2000/11/03 10:05:48	1.30.2.3
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.30.2.2 2000/10/19 10:21:02 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.30.2.3 2000/11/03 10:05:48 xiphmont Exp $
 
  ********************************************************************/
 
@@ -20,7 +20,6 @@
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
-#include <assert.h>
 
 #include "vorbis/codec.h"
 #include "vorbis/vorbisfile.h"

No                   revision

No                   revision

1.1.2.1   +146 -0    vorbis/lib/Attic/backends.h

1.1.2.1   +157 -0    vorbis/lib/Attic/codebook.h

1.1.2.1   +112 -0    vorbis/lib/Attic/codec_internal.h

No                   revision

No                   revision

1.1.2.1   +1157 -0   vorbis/lib/books/Attic/lsp12_0.vqh

1.1.2.1   +2073 -0   vorbis/lib/books/Attic/lsp30_0.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_1024a_128_1.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_1024a_128_2.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_128_3.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_128_4.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_1024a_128_5.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_1024a_128_6.vqh

1.1.2.1   +75 -0     vorbis/lib/books/Attic/res0_1024a_128_7.vqh

1.1.2.1   +86 -0     vorbis/lib/books/Attic/res0_1024a_128_8.vqh

1.1.2.1   +115 -0    vorbis/lib/books/Attic/res0_1024a_128_9.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_1024a_160_1.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_1024a_160_2.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_160_3.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_160_4.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_1024a_160_5.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_1024a_160_6.vqh

1.1.2.1   +75 -0     vorbis/lib/books/Attic/res0_1024a_160_7.vqh

1.1.2.1   +86 -0     vorbis/lib/books/Attic/res0_1024a_160_8.vqh

1.1.2.1   +115 -0    vorbis/lib/books/Attic/res0_1024a_160_9.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_1024a_192_1.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_192_2.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_1024a_192_3.vqh

1.1.2.1   +70 -0     vorbis/lib/books/Attic/res0_1024a_192_4.vqh

1.1.2.1   +115 -0    vorbis/lib/books/Attic/res0_1024a_192_5.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_256_1.vqh

1.1.2.1   +75 -0     vorbis/lib/books/Attic/res0_1024a_256_2.vqh

1.1.2.1   +86 -0     vorbis/lib/books/Attic/res0_1024a_256_3.vqh

1.1.2.1   +100 -0    vorbis/lib/books/Attic/res0_1024a_256_4.vqh

1.1.2.1   +133 -0    vorbis/lib/books/Attic/res0_1024a_256_5.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_1024a_350_1.vqh

1.1.2.1   +75 -0     vorbis/lib/books/Attic/res0_1024a_350_2.vqh

1.1.2.1   +86 -0     vorbis/lib/books/Attic/res0_1024a_350_3.vqh

1.1.2.1   +100 -0    vorbis/lib/books/Attic/res0_1024a_350_4.vqh

1.1.2.1   +133 -0    vorbis/lib/books/Attic/res0_1024a_350_5.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_128a_128_1.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_128a_128_2.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_128a_128_3.vqh

1.1.2.1   +70 -0     vorbis/lib/books/Attic/res0_128a_128_4.vqh

1.1.2.1   +115 -0    vorbis/lib/books/Attic/res0_128a_128_5.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_128a_160_1.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_128a_160_2.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_128a_160_3.vqh

1.1.2.1   +70 -0     vorbis/lib/books/Attic/res0_128a_160_4.vqh

1.1.2.1   +115 -0    vorbis/lib/books/Attic/res0_128a_160_5.vqh

1.1.2.1   +63 -0     vorbis/lib/books/Attic/res0_128a_192_1.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_128a_192_2.vqh

1.1.2.1   +212 -0    vorbis/lib/books/Attic/res0_128a_192_3.vqh

1.1.2.1   +70 -0     vorbis/lib/books/Attic/res0_128a_192_4.vqh

1.1.2.1   +115 -0    vorbis/lib/books/Attic/res0_128a_192_5.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_128a_256_1.vqh

1.1.2.1   +75 -0     vorbis/lib/books/Attic/res0_128a_256_2.vqh

1.1.2.1   +86 -0     vorbis/lib/books/Attic/res0_128a_256_3.vqh

1.1.2.1   +100 -0    vorbis/lib/books/Attic/res0_128a_256_4.vqh

1.1.2.1   +133 -0    vorbis/lib/books/Attic/res0_128a_256_5.vqh

1.1.2.1   +99 -0     vorbis/lib/books/Attic/res0_128a_350_1.vqh

1.1.2.1   +75 -0     vorbis/lib/books/Attic/res0_128a_350_2.vqh

1.1.2.1   +86 -0     vorbis/lib/books/Attic/res0_128a_350_3.vqh

1.1.2.1   +100 -0    vorbis/lib/books/Attic/res0_128a_350_4.vqh

1.1.2.1   +133 -0    vorbis/lib/books/Attic/res0_128a_350_5.vqh

1.1.2.1   +42 -0     vorbis/lib/books/Attic/resaux0_1024a_128.vqh

1.1.2.1   +42 -0     vorbis/lib/books/Attic/resaux0_1024a_160.vqh

1.1.2.1   +38 -0     vorbis/lib/books/Attic/resaux0_1024a_192.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_1024a_256.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_1024a_350.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_128a_128.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_128a_160.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_128a_192.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_128a_256.vqh

1.1.2.1   +116 -0    vorbis/lib/books/Attic/resaux0_128a_350.vqh

No                   revision

No                   revision

1.1.2.1   +205 -0    vorbis/lib/modes/Attic/mode_A.h

1.1.2.1   +204 -0    vorbis/lib/modes/Attic/mode_B.h

1.1.2.1   +195 -0    vorbis/lib/modes/Attic/mode_C.h

1.1.2.1   +178 -0    vorbis/lib/modes/Attic/mode_D.h

1.1.2.1   +162 -0    vorbis/lib/modes/Attic/mode_E.h

1.1.2.1   +28 -0     vorbis/lib/modes/Attic/modes.h

No                   revision

No                   revision

1.17.2.2  +2 -2      vorbis/vq/bookutil.c

Index: bookutil.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/bookutil.c,v
retrieving revision 1.17.2.1
retrieving revision 1.17.2.2
diff -u -r1.17.2.1 -r1.17.2.2
--- bookutil.c	2000/10/31 08:25:17	1.17.2.1
+++ bookutil.c	2000/11/03 10:06:07	1.17.2.2
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: utility functions for loading .vqh and .vqd files
- last mod: $Id: bookutil.c,v 1.17.2.1 2000/10/31 08:25:17 xiphmont Exp $
+ last mod: $Id: bookutil.c,v 1.17.2.2 2000/11/03 10:06:07 xiphmont Exp $
 
  ********************************************************************/
 
@@ -736,7 +736,7 @@
   else
     fprintf(out,"\tNULL,\n");
 
-  fprintf(out,"};\n\n");
+  fprintf(out,"\t0\n};\n\n");
 
   fprintf(out,"\n#endif\n");
 }

1.5.2.2   +2 -2      vorbis/vq/huffbuild.c

Index: huffbuild.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/huffbuild.c,v
retrieving revision 1.5.2.1
retrieving revision 1.5.2.2
diff -u -r1.5.2.1 -r1.5.2.2
--- huffbuild.c	2000/10/31 08:25:17	1.5.2.1
+++ huffbuild.c	2000/11/03 10:06:08	1.5.2.2
@@ -12,7 +12,7 @@
  ********************************************************************
 
  function: hufftree builder
- last mod: $Id: huffbuild.c,v 1.5.2.1 2000/10/31 08:25:17 xiphmont Exp $
+ last mod: $Id: huffbuild.c,v 1.5.2.2 2000/11/03 10:06:08 xiphmont Exp $
 
  ********************************************************************/
 
@@ -183,7 +183,7 @@
     fprintf(file,"\tNULL,\n");
     fprintf(file,"\tNULL,\n");
     fprintf(file,"\tNULL,\n");
-    fprintf(file,"};\n\n");
+    fprintf(file,"\t0\n};\n\n");
     
     fprintf(file,"\n#endif\n");
     fclose(file);

--- >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