Browse Source

Merge pull request #238 from thecelloman/updatelibvorbis

Update libvorbis to v1.3.3
SilentMike 12 years ago
parent
commit
77505ee162
62 changed files with 12036 additions and 29440 deletions
  1. 89 0
      Engine/lib/libvorbis/CHANGES
  2. 15 13
      Engine/lib/libvorbis/include/vorbis/codec.h
  3. 371 47
      Engine/lib/libvorbis/include/vorbis/vorbisenc.h
  4. 72 11
      Engine/lib/libvorbis/include/vorbis/vorbisfile.h
  5. 34 35
      Engine/lib/libvorbis/lib/analysis.c
  6. 21 23
      Engine/lib/libvorbis/lib/backends.h
  7. 41 41
      Engine/lib/libvorbis/lib/bitrate.c
  8. 264 211
      Engine/lib/libvorbis/lib/block.c
  9. 1781 20021
      Engine/lib/libvorbis/lib/books/coupled/res_books_stereo.h
  10. 1526 1817
      Engine/lib/libvorbis/lib/books/floor/floor_books.h
  11. 942 67
      Engine/lib/libvorbis/lib/books/uncoupled/res_books_uncoupled.h
  12. 141 291
      Engine/lib/libvorbis/lib/codebook.c
  13. 20 61
      Engine/lib/libvorbis/lib/codebook.h
  14. 42 12
      Engine/lib/libvorbis/lib/codec_internal.h
  15. 73 80
      Engine/lib/libvorbis/lib/envelope.c
  16. 2 3
      Engine/lib/libvorbis/lib/envelope.h
  17. 25 27
      Engine/lib/libvorbis/lib/floor0.c
  18. 409 406
      Engine/lib/libvorbis/lib/floor1.c
  19. 12 11
      Engine/lib/libvorbis/lib/highlevel.h
  20. 121 97
      Engine/lib/libvorbis/lib/info.c
  21. 6 6
      Engine/lib/libvorbis/lib/lookup.c
  22. 3 3
      Engine/lib/libvorbis/lib/lookup.h
  23. 137 134
      Engine/lib/libvorbis/lib/lookup_data.h
  24. 31 20
      Engine/lib/libvorbis/lib/lpc.c
  25. 2 2
      Engine/lib/libvorbis/lib/lpc.h
  26. 58 57
      Engine/lib/libvorbis/lib/lsp.c
  27. 5 5
      Engine/lib/libvorbis/lib/lsp.h
  28. 325 353
      Engine/lib/libvorbis/lib/mapping0.c
  29. 712 712
      Engine/lib/libvorbis/lib/masking.h
  30. 172 173
      Engine/lib/libvorbis/lib/mdct.c
  31. 3 15
      Engine/lib/libvorbis/lib/mdct.h
  32. 13 8
      Engine/lib/libvorbis/lib/misc.h
  33. 71 59
      Engine/lib/libvorbis/lib/modes/floor_all.h
  34. 8 8
      Engine/lib/libvorbis/lib/modes/psych_11.h
  35. 16 19
      Engine/lib/libvorbis/lib/modes/psych_16.h
  36. 48 72
      Engine/lib/libvorbis/lib/modes/psych_44.h
  37. 14 15
      Engine/lib/libvorbis/lib/modes/psych_8.h
  38. 31 31
      Engine/lib/libvorbis/lib/modes/residue_16.h
  39. 65 67
      Engine/lib/libvorbis/lib/modes/residue_44.h
  40. 63 63
      Engine/lib/libvorbis/lib/modes/residue_44u.h
  41. 15 15
      Engine/lib/libvorbis/lib/modes/residue_8.h
  42. 22 20
      Engine/lib/libvorbis/lib/modes/setup_11.h
  43. 27 23
      Engine/lib/libvorbis/lib/modes/setup_16.h
  44. 21 21
      Engine/lib/libvorbis/lib/modes/setup_22.h
  45. 17 17
      Engine/lib/libvorbis/lib/modes/setup_32.h
  46. 28 18
      Engine/lib/libvorbis/lib/modes/setup_44.h
  47. 10 10
      Engine/lib/libvorbis/lib/modes/setup_44u.h
  48. 25 22
      Engine/lib/libvorbis/lib/modes/setup_8.h
  49. 25 26
      Engine/lib/libvorbis/lib/modes/setup_X.h
  50. 48 18
      Engine/lib/libvorbis/lib/os.h
  51. 550 571
      Engine/lib/libvorbis/lib/psy.c
  52. 32 64
      Engine/lib/libvorbis/lib/psy.h
  53. 11 12
      Engine/lib/libvorbis/lib/registry.c
  54. 4 4
      Engine/lib/libvorbis/lib/registry.h
  55. 326 355
      Engine/lib/libvorbis/lib/res0.c
  56. 11 7
      Engine/lib/libvorbis/lib/scales.h
  57. 163 319
      Engine/lib/libvorbis/lib/sharedbook.c
  58. 16 16
      Engine/lib/libvorbis/lib/smallft.c
  59. 34 20
      Engine/lib/libvorbis/lib/synthesis.c
  60. 306 304
      Engine/lib/libvorbis/lib/vorbisenc.c
  61. 510 431
      Engine/lib/libvorbis/lib/vorbisfile.c
  62. 2051 2051
      Engine/lib/libvorbis/lib/window.c

+ 89 - 0
Engine/lib/libvorbis/CHANGES

@@ -1,3 +1,92 @@
+libvorbis 1.3.3 (2012-02-03) -- "Xiph.Org libVorbis I 20120203 (Omnipresent)"
+
+* vorbis: additional proofing against invalid/malicious 
+  streams in decode (see SVN for details).  
+* vorbis: fix a memory leak in vorbis_commentheader_out().
+* updates, corrections and clarifications in the Vorbis I specification 
+  document
+* win32: fixed project configuration which referenced two CRT versions 
+  in output binaries.
+* build warning fixes
+
+libvorbis 1.3.2 (2010-11-01) -- "Xiph.Org libVorbis I 20101101 (Schaufenugget)"
+
+ * vorbis: additional proofing against invalid/malicious 
+   streams in floor, residue, and bos/eos packet trimming 
+   code (see SVN for details). 
+ * vorbis: Added programming documentation tree for the 
+   low-level calls
+ * vorbisfile: Correct handling of serial numbers array 
+   element [0] on non-seekable streams
+ * vorbisenc: Back out an [old] AoTuV HF weighting that was 
+   first enabled in 1.3.0; there are a few samples where I 
+   really don't like the effect it causes.
+ * vorbis: return correct timestamp for granule positions 
+   with high bit set.
+ * vorbisfile: the [undocumented] half-rate decode api made no 
+   attempt to keep the pcm offset tracking consistent in seeks. 
+   Fix and add a testing mode to seeking_example.c to torture 
+   test seeking in halfrate mode.  Also remove requirement that 
+   halfrate mode only work with seekable files.
+ * vorbisfile:  Fix a chaining bug in raw_seeks where seeking 
+   out of the current link would fail due to not 
+   reinitializing the decode machinery.  
+ * vorbisfile: improve seeking strategy. Reduces the 
+   necessary number of seek callbacks in an open or seek 
+   operation by well over 2/3.
+
+libvorbis 1.3.1 (2010-02-26) -- "Xiph.Org libVorbis I 20100325 (Everywhere)"
+
+ * tweak + minor arithmetic fix in floor1 fit
+ * revert noise norm to conservative 1.2.3 behavior pending 
+   more listening testing
+
+libvorbis 1.3.0 (2010-02-25) -- unreleased staging snapshot
+
+ * Optimized surround support for 5.1 encoding at 44.1/48kHz
+ * Added encoder control call to disable channel coupling
+ * Correct an overflow bug in very low-bitrate encoding on 32 bit 
+   machines that caused inflated bitrates
+ * Numerous API hardening, leak and build fixes 
+ * Correct bug in 22kHz compand setup that could cause a crash
+ * Correct bug in 16kHz codebooks that could cause unstable pure 
+   tones at high bitrates
+
+libvorbis 1.2.3 (2009-07-09) -- "Xiph.Org libVorbis I 20090709"
+
+ * correct a vorbisfile bug that prevented proper playback of
+   Vorbis files where all audio in a logical stream is in a
+   single page
+ * Additional decode setup hardening against malicious streams
+ * Add 'OV_EXCLUDE_STATIC_CALLBACKS' define for developers who 
+   wish to avoid unused symbol warnings from the static callbacks 
+   defined in vorbisfile.h
+
+libvorbis 1.2.2 (2009-06-24) -- "Xiph.Org libVorbis I 20090624"
+
+ * define VENDOR and ENCODER strings
+ * seek correctly in files bigger than 2 GB (Windows)
+ * fix regression from CVE-2008-1420; 1.0b1 files work again
+ * mark all tables as constant to reduce memory occupation
+ * additional decoder hardening against malicious streams
+ * substantially reduce amount of seeking performed by Vorbisfile
+ * Multichannel decode bugfix 
+ * build system updates
+ * minor specification clarifications/fixes
+
+libvorbis 1.2.1 (unreleased) -- "Xiph.Org libVorbis I 20080501"
+
+ * Improved robustness with corrupt streams.
+ * New ov_read_filter() vorbisfile call allows filtering decoded
+   audio as floats before converting to integer samples.
+ * Fix an encoder bug with multichannel streams.
+ * Replaced RTP payload format draft with RFC 5215.
+ * Bare bones self test under 'make check'.
+ * Fix a problem encoding some streams between 14 and 28 kHz.
+ * Fix a numerical instability in the edge extrapolation filter.
+ * Build system improvements.
+ * Specification correction.
+
 libvorbis 1.2.0 (2007-07-25) -- "Xiph.Org libVorbis I 20070622"
 
  * new ov_fopen() convenience call that avoids the common

+ 15 - 13
Engine/lib/libvorbis/include/vorbis/codec.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: codec.h 17021 2010-03-24 09:29:41Z xiphmont $
 
  ********************************************************************/
 
@@ -121,7 +121,7 @@ typedef struct vorbis_block{
 
 /* vorbis_block is a single block of data to be processed as part of
 the analysis/synthesis stream; it belongs to a specific logical
-bitstream, but is independant from other vorbis_blocks belonging to
+bitstream, but is independent from other vorbis_blocks belonging to
 that logical bitstream. *************************************************/
 
 struct alloc_chain{
@@ -166,28 +166,30 @@ extern void     vorbis_info_init(vorbis_info *vi);
 extern void     vorbis_info_clear(vorbis_info *vi);
 extern int      vorbis_info_blocksize(vorbis_info *vi,int zo);
 extern void     vorbis_comment_init(vorbis_comment *vc);
-extern void     vorbis_comment_add(vorbis_comment *vc, char *comment);
+extern void     vorbis_comment_add(vorbis_comment *vc, const char *comment);
 extern void     vorbis_comment_add_tag(vorbis_comment *vc,
-				       char *tag, char *contents);
-extern char    *vorbis_comment_query(vorbis_comment *vc, char *tag, int count);
-extern int      vorbis_comment_query_count(vorbis_comment *vc, char *tag);
+                                       const char *tag, const char *contents);
+extern char    *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count);
+extern int      vorbis_comment_query_count(vorbis_comment *vc, const char *tag);
 extern void     vorbis_comment_clear(vorbis_comment *vc);
 
 extern int      vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb);
 extern int      vorbis_block_clear(vorbis_block *vb);
 extern void     vorbis_dsp_clear(vorbis_dsp_state *v);
 extern double   vorbis_granule_time(vorbis_dsp_state *v,
-				    ogg_int64_t granulepos);
+                                    ogg_int64_t granulepos);
+
+extern const char *vorbis_version_string(void);
 
 /* Vorbis PRIMITIVES: analysis/DSP layer ****************************/
 
 extern int      vorbis_analysis_init(vorbis_dsp_state *v,vorbis_info *vi);
 extern int      vorbis_commentheader_out(vorbis_comment *vc, ogg_packet *op);
 extern int      vorbis_analysis_headerout(vorbis_dsp_state *v,
-					  vorbis_comment *vc,
-					  ogg_packet *op,
-					  ogg_packet *op_comm,
-					  ogg_packet *op_code);
+                                          vorbis_comment *vc,
+                                          ogg_packet *op,
+                                          ogg_packet *op_comm,
+                                          ogg_packet *op_code);
 extern float  **vorbis_analysis_buffer(vorbis_dsp_state *v,int vals);
 extern int      vorbis_analysis_wrote(vorbis_dsp_state *v,int vals);
 extern int      vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb);
@@ -195,12 +197,12 @@ extern int      vorbis_analysis(vorbis_block *vb,ogg_packet *op);
 
 extern int      vorbis_bitrate_addblock(vorbis_block *vb);
 extern int      vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,
-					   ogg_packet *op);
+                                           ogg_packet *op);
 
 /* Vorbis PRIMITIVES: synthesis layer *******************************/
 extern int      vorbis_synthesis_idheader(ogg_packet *op);
 extern int      vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,
-					  ogg_packet *op);
+                                          ogg_packet *op);
 
 extern int      vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi);
 extern int      vorbis_synthesis_restart(vorbis_dsp_state *v);

+ 371 - 47
Engine/lib/libvorbis/include/vorbis/vorbisenc.h

@@ -11,10 +11,16 @@
  ********************************************************************
 
  function: vorbis encode-engine setup
- last mod: $Id: vorbisenc.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: vorbisenc.h 17021 2010-03-24 09:29:41Z xiphmont $
 
  ********************************************************************/
 
+/** \file
+ * Libvorbisenc is a convenient API for setting up an encoding
+ * environment using libvorbis. Libvorbisenc encapsulates the
+ * actions needed to set up the encoder properly.
+ */
+
 #ifndef _OV_ENC_H_
 #define _OV_ENC_H_
 
@@ -25,88 +31,406 @@ extern "C"
 
 #include "codec.h"
 
+/**
+ * This is the primary function within libvorbisenc for setting up managed
+ * bitrate modes.
+ *
+ * Before this function is called, the \ref vorbis_info
+ * struct should be initialized by using vorbis_info_init() from the libvorbis
+ * API.  After encoding, vorbis_info_clear() should be called.
+ *
+ * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
+ * constraints for the encoded file.  This function uses these settings to
+ * select the appropriate encoding mode and set it up.
+ *
+ * \param vi               Pointer to an initialized \ref vorbis_info struct.
+ * \param channels         The number of channels to be encoded.
+ * \param rate             The sampling rate of the source audio.
+ * \param max_bitrate      Desired maximum bitrate (limit). -1 indicates unset.
+ * \param nominal_bitrate  Desired average, or central, bitrate. -1 indicates unset.
+ * \param min_bitrate      Desired minimum bitrate. -1 indicates unset.
+ *
+ * \return Zero for success, and negative values for failure.
+ *
+ * \retval 0          Success.
+ * \retval OV_EFAULT  Internal logic fault; indicates a bug or heap/stack corruption.
+ * \retval OV_EINVAL  Invalid setup request, eg, out of range argument.
+ * \retval OV_EIMPL   Unimplemented mode; unable to comply with bitrate request.
+ */
 extern int vorbis_encode_init(vorbis_info *vi,
-			      long channels,
-			      long rate,
-
-			      long max_bitrate,
-			      long nominal_bitrate,
-			      long min_bitrate);
-
+                              long channels,
+                              long rate,
+
+                              long max_bitrate,
+                              long nominal_bitrate,
+                              long min_bitrate);
+
+/**
+ * This function performs step-one of a three-step bitrate-managed encode
+ * setup.  It functions similarly to the one-step setup performed by \ref
+ * vorbis_encode_init but allows an application to make further encode setup
+ * tweaks using \ref vorbis_encode_ctl before finally calling \ref
+ * vorbis_encode_setup_init to complete the setup process.
+ *
+ * Before this function is called, the \ref vorbis_info struct should be
+ * initialized by using vorbis_info_init() from the libvorbis API.  After
+ * encoding, vorbis_info_clear() should be called.
+ *
+ * The max_bitrate, nominal_bitrate, and min_bitrate settings are used to set
+ * constraints for the encoded file.  This function uses these settings to
+ * select the appropriate encoding mode and set it up.
+ *
+ * \param vi                Pointer to an initialized vorbis_info struct.
+ * \param channels          The number of channels to be encoded.
+ * \param rate              The sampling rate of the source audio.
+ * \param max_bitrate       Desired maximum bitrate (limit). -1 indicates unset.
+ * \param nominal_bitrate   Desired average, or central, bitrate. -1 indicates unset.
+ * \param min_bitrate       Desired minimum bitrate. -1 indicates unset.
+ *
+ * \return Zero for success, and negative for failure.
+ *
+ * \retval 0           Success
+ * \retval OV_EFAULT   Internal logic fault; indicates a bug or heap/stack corruption.
+ * \retval OV_EINVAL   Invalid setup request, eg, out of range argument.
+ * \retval OV_EIMPL    Unimplemented mode; unable to comply with bitrate request.
+ */
 extern int vorbis_encode_setup_managed(vorbis_info *vi,
-				       long channels,
-				       long rate,
-
-				       long max_bitrate,
-				       long nominal_bitrate,
-				       long min_bitrate);
-
+                                       long channels,
+                                       long rate,
+
+                                       long max_bitrate,
+                                       long nominal_bitrate,
+                                       long min_bitrate);
+
+/**
+ * This function performs step-one of a three-step variable bitrate
+ * (quality-based) encode setup.  It functions similarly to the one-step setup
+ * performed by \ref vorbis_encode_init_vbr() but allows an application to
+ * make further encode setup tweaks using \ref vorbis_encode_ctl() before
+ * finally calling \ref vorbis_encode_setup_init to complete the setup
+ * process.
+ *
+ * Before this function is called, the \ref vorbis_info struct should be
+ * initialized by using \ref vorbis_info_init() from the libvorbis API.  After
+ * encoding, vorbis_info_clear() should be called.
+ *
+ * \param vi        Pointer to an initialized vorbis_info struct.
+ * \param channels  The number of channels to be encoded.
+ * \param rate      The sampling rate of the source audio.
+ * \param quality   Desired quality level, currently from -0.1 to 1.0 (lo to hi).
+ *
+ * \return Zero for success, and negative values for failure.
+ *
+ * \retval  0          Success
+ * \retval  OV_EFAULT  Internal logic fault; indicates a bug or heap/stack corruption.
+ * \retval  OV_EINVAL  Invalid setup request, eg, out of range argument.
+ * \retval  OV_EIMPL   Unimplemented mode; unable to comply with quality level request.
+ */
 extern int vorbis_encode_setup_vbr(vorbis_info *vi,
-				  long channels,
-				  long rate,
-
-				  float quality /* quality level from 0. (lo) to 1. (hi) */
-				  );
-
+                                  long channels,
+                                  long rate,
+
+                                  float quality
+                                  );
+
+/**
+ * This is the primary function within libvorbisenc for setting up variable
+ * bitrate ("quality" based) modes.
+ *
+ *
+ * Before this function is called, the vorbis_info struct should be
+ * initialized by using vorbis_info_init() from the libvorbis API. After
+ * encoding, vorbis_info_clear() should be called.
+ *
+ * \param vi           Pointer to an initialized vorbis_info struct.
+ * \param channels     The number of channels to be encoded.
+ * \param rate         The sampling rate of the source audio.
+ * \param base_quality Desired quality level, currently from -0.1 to 1.0 (lo to hi).
+ *
+ *
+ * \return Zero for success, or a negative number for failure.
+ *
+ * \retval 0           Success
+ * \retval OV_EFAULT   Internal logic fault; indicates a bug or heap/stack corruption.
+ * \retval OV_EINVAL   Invalid setup request, eg, out of range argument.
+ * \retval OV_EIMPL    Unimplemented mode; unable to comply with quality level request.
+ */
 extern int vorbis_encode_init_vbr(vorbis_info *vi,
-				  long channels,
-				  long rate,
-
-				  float base_quality /* quality level from 0. (lo) to 1. (hi) */
-				  );
-
+                                  long channels,
+                                  long rate,
+
+                                  float base_quality
+                                  );
+
+/**
+ * This function performs the last stage of three-step encoding setup, as
+ * described in the API overview under managed bitrate modes.
+ *
+ * Before this function is called, the \ref vorbis_info struct should be
+ * initialized by using vorbis_info_init() from the libvorbis API, one of
+ * \ref vorbis_encode_setup_managed() or \ref vorbis_encode_setup_vbr() called to
+ * initialize the high-level encoding setup, and \ref vorbis_encode_ctl()
+ * called if necessary to make encoding setup changes.
+ * vorbis_encode_setup_init() finalizes the highlevel encoding structure into
+ * a complete encoding setup after which the application may make no further
+ * setup changes.
+ *
+ * After encoding, vorbis_info_clear() should be called.
+ *
+ * \param vi Pointer to an initialized \ref vorbis_info struct.
+ *
+ * \return Zero for success, and negative values for failure.
+ *
+ * \retval  0           Success.
+ * \retval  OV_EFAULT  Internal logic fault; indicates a bug or heap/stack corruption.
+ *
+ * \retval OV_EINVAL   Attempt to use vorbis_encode_setup_init() without first
+ * calling one of vorbis_encode_setup_managed() or vorbis_encode_setup_vbr() to
+ * initialize the high-level encoding setup
+ *
+ */
 extern int vorbis_encode_setup_init(vorbis_info *vi);
 
+/**
+ * This function implements a generic interface to miscellaneous encoder
+ * settings similar to the classic UNIX 'ioctl()' system call.  Applications
+ * may use vorbis_encode_ctl() to query or set bitrate management or quality
+ * mode details by using one of several \e request arguments detailed below.
+ * vorbis_encode_ctl() must be called after one of
+ * vorbis_encode_setup_managed() or vorbis_encode_setup_vbr().  When used
+ * to modify settings, \ref vorbis_encode_ctl() must be called before \ref
+ * vorbis_encode_setup_init().
+ *
+ * \param vi      Pointer to an initialized vorbis_info struct.
+ *
+ * \param number Specifies the desired action; See \ref encctlcodes "the list
+ * of available requests".
+ *
+ * \param arg void * pointing to a data structure matching the request
+ * argument.
+ *
+ * \retval 0          Success. Any further return information (such as the result of a
+ * query) is placed into the storage pointed to by *arg.
+ *
+ * \retval OV_EINVAL  Invalid argument, or an attempt to modify a setting after
+ * calling vorbis_encode_setup_init().
+ *
+ * \retval OV_EIMPL   Unimplemented or unknown request
+ */
 extern int vorbis_encode_ctl(vorbis_info *vi,int number,void *arg);
 
-  /* deprecated rate management supported only for compatability */
-#define OV_ECTL_RATEMANAGE_GET       0x10
-#define OV_ECTL_RATEMANAGE_SET       0x11
-#define OV_ECTL_RATEMANAGE_AVG       0x12
-#define OV_ECTL_RATEMANAGE_HARD      0x13
-
+/**
+ * \deprecated This is a deprecated interface. Please use vorbis_encode_ctl()
+ * with the \ref ovectl_ratemanage2_arg struct and \ref
+ * OV_ECTL_RATEMANAGE2_GET and \ref OV_ECTL_RATEMANAGE2_SET calls in new code.
+ *
+ * The \ref ovectl_ratemanage_arg structure is used with vorbis_encode_ctl()
+ * and the \ref OV_ECTL_RATEMANAGE_GET, \ref OV_ECTL_RATEMANAGE_SET, \ref
+ * OV_ECTL_RATEMANAGE_AVG, \ref OV_ECTL_RATEMANAGE_HARD calls in order to
+ * query and modify specifics of the encoder's bitrate management
+ * configuration.
+*/
 struct ovectl_ratemanage_arg {
-  int    management_active;
-
+  int    management_active; /**< nonzero if bitrate management is active*/
+/** hard lower limit (in kilobits per second) below which the stream bitrate
+    will never be allowed for any given bitrate_hard_window seconds of time.*/
   long   bitrate_hard_min;
+/** hard upper limit (in kilobits per second) above which the stream bitrate
+    will never be allowed for any given bitrate_hard_window seconds of time.*/
   long   bitrate_hard_max;
+/** the window period (in seconds) used to regulate the hard bitrate minimum
+    and maximum*/
   double bitrate_hard_window;
-
+/** soft lower limit (in kilobits per second) below which the average bitrate
+    tracker will start nudging the bitrate higher.*/
   long   bitrate_av_lo;
+/** soft upper limit (in kilobits per second) above which the average bitrate
+    tracker will start nudging the bitrate lower.*/
   long   bitrate_av_hi;
+/** the window period (in seconds) used to regulate the average bitrate
+    minimum and maximum.*/
   double bitrate_av_window;
+/** Regulates the relative centering of the average and hard windows; in
+    libvorbis 1.0 and 1.0.1, the hard window regulation overlapped but
+    followed the average window regulation. In libvorbis 1.1 a bit-reservoir
+    interface replaces the old windowing interface; the older windowing
+    interface is simulated and this field has no effect.*/
   double bitrate_av_window_center;
 };
 
-
-  /* new rate setup */
-#define OV_ECTL_RATEMANAGE2_GET      0x14
-#define OV_ECTL_RATEMANAGE2_SET      0x15
-
+/**
+ * \name struct ovectl_ratemanage2_arg
+ *
+ * The ovectl_ratemanage2_arg structure is used with vorbis_encode_ctl() and
+ * the OV_ECTL_RATEMANAGE2_GET and OV_ECTL_RATEMANAGE2_SET calls in order to
+ * query and modify specifics of the encoder's bitrate management
+ * configuration.
+ *
+*/
 struct ovectl_ratemanage2_arg {
-  int    management_active;
-
+  int    management_active; /**< nonzero if bitrate management is active */
+/** Lower allowed bitrate limit in kilobits per second */
   long   bitrate_limit_min_kbps;
+/** Upper allowed bitrate limit in kilobits per second */
   long   bitrate_limit_max_kbps;
-  long   bitrate_limit_reservoir_bits;
+  long   bitrate_limit_reservoir_bits; /**<Size of the bitrate reservoir in bits */
+/** Regulates the bitrate reservoir's preferred fill level in a range from 0.0
+ * to 1.0; 0.0 tries to bank bits to buffer against future bitrate spikes, 1.0
+ * buffers against future sudden drops in instantaneous bitrate. Default is
+ * 0.1
+ */
   double bitrate_limit_reservoir_bias;
-
+/** Average bitrate setting in kilobits per second */
   long   bitrate_average_kbps;
+/** Slew rate limit setting for average bitrate adjustment; sets the minimum
+ *  time in seconds the bitrate tracker may swing from one extreme to the
+ *  other when boosting or damping average bitrate.
+ */
   double bitrate_average_damping;
 };
 
 
+/**
+ * \name vorbis_encode_ctl() codes
+ *
+ * \anchor encctlcodes
+ *
+ * These values are passed as the \c number parameter of vorbis_encode_ctl().
+ * The type of the referent of that function's \c arg pointer depends on these
+ * codes.
+ */
+/*@{*/
+
+/**
+ * Query the current encoder bitrate management setting.
+ *
+ *Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
+ *
+ * Used to query the current encoder bitrate management setting. Also used to
+ * initialize fields of an ovectl_ratemanage2_arg structure for use with
+ * \ref OV_ECTL_RATEMANAGE2_SET.
+ */
+#define OV_ECTL_RATEMANAGE2_GET      0x14
 
+/**
+ * Set the current encoder bitrate management settings.
+ *
+ * Argument: <tt>struct ovectl_ratemanage2_arg *</tt>
+ *
+ * Used to set the current encoder bitrate management settings to the values
+ * listed in the ovectl_ratemanage2_arg. Passing a NULL pointer will disable
+ * bitrate management.
+*/
+#define OV_ECTL_RATEMANAGE2_SET      0x15
+
+/**
+ * Returns the current encoder hard-lowpass setting (kHz) in the double
+ * pointed to by arg.
+ *
+ * Argument: <tt>double *</tt>
+*/
 #define OV_ECTL_LOWPASS_GET          0x20
+
+/**
+ *  Sets the encoder hard-lowpass to the value (kHz) pointed to by arg. Valid
+ *  lowpass settings range from 2 to 99.
+ *
+ * Argument: <tt>double *</tt>
+*/
 #define OV_ECTL_LOWPASS_SET          0x21
 
+/**
+ *  Returns the current encoder impulse block setting in the double pointed
+ *  to by arg.
+ *
+ * Argument: <tt>double *</tt>
+*/
 #define OV_ECTL_IBLOCK_GET           0x30
+
+/**
+ *  Sets the impulse block bias to the the value pointed to by arg.
+ *
+ * Argument: <tt>double *</tt>
+ *
+ *  Valid range is -15.0 to 0.0 [default]. A negative impulse block bias will
+ *  direct to encoder to use more bits when incoding short blocks that contain
+ *  strong impulses, thus improving the accuracy of impulse encoding.
+ */
 #define OV_ECTL_IBLOCK_SET           0x31
 
+/**
+ *  Returns the current encoder coupling setting in the int pointed
+ *  to by arg.
+ *
+ * Argument: <tt>int *</tt>
+*/
+#define OV_ECTL_COUPLING_GET         0x40
+
+/**
+ *  Enables/disables channel coupling in multichannel encoding according to arg.
+ *
+ * Argument: <tt>int *</tt>
+ *
+ *  Zero disables channel coupling for multichannel inputs, nonzer enables
+ *  channel coupling.  Setting has no effect on monophonic encoding or
+ *  multichannel counts that do not offer coupling.  At present, coupling is
+ *  available for stereo and 5.1 encoding.
+ */
+#define OV_ECTL_COUPLING_SET         0x41
+
+  /* deprecated rate management supported only for compatibility */
+
+/**
+ * Old interface to querying bitrate management settings.
+ *
+ * Deprecated after move to bit-reservoir style management in 1.1 rendered
+ * this interface partially obsolete.
+
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_GET instead.
+ *
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
+ */
+#define OV_ECTL_RATEMANAGE_GET       0x10
+/**
+ * Old interface to modifying bitrate management settings.
+ *
+ *  deprecated after move to bit-reservoir style management in 1.1 rendered
+ *  this interface partially obsolete.
+ *
+ * \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
+ *
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
+ */
+#define OV_ECTL_RATEMANAGE_SET       0x11
+/**
+ * Old interface to setting average-bitrate encoding mode.
+ *
+ * Deprecated after move to bit-reservoir style management in 1.1 rendered
+ * this interface partially obsolete.
+ *
+ *  \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
+ *
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
+ */
+#define OV_ECTL_RATEMANAGE_AVG       0x12
+/**
+ * Old interface to setting bounded-bitrate encoding modes.
+ *
+ * deprecated after move to bit-reservoir style management in 1.1 rendered
+ * this interface partially obsolete.
+ *
+ *  \deprecated Please use \ref OV_ECTL_RATEMANAGE2_SET instead.
+ *
+ * Argument: <tt>struct ovectl_ratemanage_arg *</tt>
+ */
+#define OV_ECTL_RATEMANAGE_HARD      0x13
+
+/*@}*/
+
+
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
 
 #endif
-
-

+ 72 - 11
Engine/lib/libvorbis/include/vorbis/vorbisfile.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: vorbisfile.h 17182 2010-04-29 03:48:32Z xiphmont $
 
  ********************************************************************/
 
@@ -43,6 +43,65 @@ typedef struct {
   long   (*tell_func)  (void *datasource);
 } ov_callbacks;
 
+#ifndef OV_EXCLUDE_STATIC_CALLBACKS
+
+/* a few sets of convenient callbacks, especially for use under
+ * Windows where ov_open_callbacks() should always be used instead of
+ * ov_open() to avoid problems with incompatible crt.o version linking
+ * issues. */
+
+static int _ov_header_fseek_wrap(FILE *f,ogg_int64_t off,int whence){
+  if(f==NULL)return(-1);
+
+#ifdef __MINGW32__
+  return fseeko64(f,off,whence);
+#elif defined (_WIN32)
+  return _fseeki64(f,off,whence);
+#else
+  return fseek(f,off,whence);
+#endif
+}
+
+/* These structs below (OV_CALLBACKS_DEFAULT etc) are defined here as
+ * static data. That means that every file which includes this header
+ * will get its own copy of these structs whether it uses them or
+ * not unless it #defines OV_EXCLUDE_STATIC_CALLBACKS.
+ * These static symbols are essential on platforms such as Windows on
+ * which several different versions of stdio support may be linked to
+ * by different DLLs, and we need to be certain we know which one
+ * we're using (the same one as the main application).
+ */
+
+static ov_callbacks OV_CALLBACKS_DEFAULT = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
+  (int (*)(void *))                             fclose,
+  (long (*)(void *))                            ftell
+};
+
+static ov_callbacks OV_CALLBACKS_NOCLOSE = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           _ov_header_fseek_wrap,
+  (int (*)(void *))                             NULL,
+  (long (*)(void *))                            ftell
+};
+
+static ov_callbacks OV_CALLBACKS_STREAMONLY = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           NULL,
+  (int (*)(void *))                             fclose,
+  (long (*)(void *))                            NULL
+};
+
+static ov_callbacks OV_CALLBACKS_STREAMONLY_NOCLOSE = {
+  (size_t (*)(void *, size_t, size_t, void *))  fread,
+  (int (*)(void *, ogg_int64_t, int))           NULL,
+  (int (*)(void *))                             NULL,
+  (long (*)(void *))                            NULL
+};
+
+#endif
+
 #define  NOTOPEN   0
 #define  PARTOPEN  1
 #define  OPENED    2
@@ -63,8 +122,8 @@ typedef struct OggVorbis_File {
   ogg_int64_t     *dataoffsets;
   long            *serialnos;
   ogg_int64_t     *pcmlengths; /* overloaded to maintain binary
-				  compatability; x2 size, stores both
-				  beginning and end values */
+                                  compatibility; x2 size, stores both
+                                  beginning and end values */
   vorbis_info     *vi;
   vorbis_comment  *vc;
 
@@ -88,14 +147,14 @@ typedef struct OggVorbis_File {
 
 
 extern int ov_clear(OggVorbis_File *vf);
-extern int ov_fopen(char *path,OggVorbis_File *vf);
-extern int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
+extern int ov_fopen(const char *path,OggVorbis_File *vf);
+extern int ov_open(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
 extern int ov_open_callbacks(void *datasource, OggVorbis_File *vf,
-		char *initial, long ibytes, ov_callbacks callbacks);
+                const char *initial, long ibytes, ov_callbacks callbacks);
 
-extern int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes);
+extern int ov_test(FILE *f,OggVorbis_File *vf,const char *initial,long ibytes);
 extern int ov_test_callbacks(void *datasource, OggVorbis_File *vf,
-		char *initial, long ibytes, ov_callbacks callbacks);
+                const char *initial, long ibytes, ov_callbacks callbacks);
 extern int ov_test_open(OggVorbis_File *vf);
 
 extern long ov_bitrate(OggVorbis_File *vf,int i);
@@ -128,9 +187,12 @@ extern vorbis_info *ov_info(OggVorbis_File *vf,int link);
 extern vorbis_comment *ov_comment(OggVorbis_File *vf,int link);
 
 extern long ov_read_float(OggVorbis_File *vf,float ***pcm_channels,int samples,
-			  int *bitstream);
+                          int *bitstream);
+extern long ov_read_filter(OggVorbis_File *vf,char *buffer,int length,
+                          int bigendianp,int word,int sgned,int *bitstream,
+                          void (*filter)(float **pcm,long channels,long samples,void *filter_param),void *filter_param);
 extern long ov_read(OggVorbis_File *vf,char *buffer,int length,
-		    int bigendianp,int word,int sgned,int *bitstream);
+                    int bigendianp,int word,int sgned,int *bitstream);
 extern int ov_crosslap(OggVorbis_File *vf1,OggVorbis_File *vf2);
 
 extern int ov_halfrate(OggVorbis_File *vf,int flag);
@@ -142,4 +204,3 @@ extern int ov_halfrate_p(OggVorbis_File *vf);
 
 #endif
 
-

+ 34 - 35
Engine/lib/libvorbis/lib/analysis.c

@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: single-block PCM analysis mode dispatch
- last mod: $Id: analysis.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: analysis.c 16226 2009-07-08 06:43:49Z xiphmont $
 
  ********************************************************************/
 
@@ -26,8 +26,6 @@
 #include "os.h"
 #include "misc.h"
 
-int analysis_noisy=1;
-
 /* decides between modes, dispatches to the appropriate mapping. */
 int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
   int ret,i;
@@ -41,7 +39,7 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
   /* first things first.  Make sure encode is ready */
   for(i=0;i<PACKETBLOBS;i++)
     oggpack_reset(vbi->packetblob[i]);
-  
+
   /* we only have one mapping type (0), and we let the mapping code
      itself figure out what soft mode to use.  This allows easier
      bitrate management */
@@ -54,7 +52,7 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
       /* The app is using a bitmanaged mode... but not using the
          bitrate management interface. */
       return(OV_EINVAL);
-    
+
     op->packet=oggpack_get_buffer(&vb->opb);
     op->bytes=oggpack_bytes(&vb->opb);
     op->b_o_s=0;
@@ -65,49 +63,50 @@ int vorbis_analysis(vorbis_block *vb, ogg_packet *op){
   return(0);
 }
 
+#ifdef ANALYSIS
+int analysis_noisy=1;
+
 /* there was no great place to put this.... */
 void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,ogg_int64_t off){
   int j;
   FILE *of;
   char buffer[80];
 
-  /*  if(i==5870){*/
-    sprintf(buffer,"%s_%d.m",base,i);
-    of=fopen(buffer,"w");
-    
-    if(!of)perror("failed to open data dump file");
-    
-    for(j=0;j<n;j++){
-      if(bark){
-	float b=toBARK((4000.f*j/n)+.25);
-	fprintf(of,"%f ",b);
-      }else
-	if(off!=0)
-	  fprintf(of,"%f ",(double)(j+off)/8000.);
-	else
-	  fprintf(of,"%f ",(double)j);
-      
-      if(dB){
-	float val;
-	if(v[j]==0.)
-	  val=-140.;
-	else
-	  val=todB(v+j);
-	fprintf(of,"%f\n",val);
-      }else{
-	fprintf(of,"%f\n",v[j]);
-      }
+  sprintf(buffer,"%s_%d.m",base,i);
+  of=fopen(buffer,"w");
+
+  if(!of)perror("failed to open data dump file");
+
+  for(j=0;j<n;j++){
+    if(bark){
+      float b=toBARK((4000.f*j/n)+.25);
+      fprintf(of,"%f ",b);
+    }else
+      if(off!=0)
+        fprintf(of,"%f ",(double)(j+off)/8000.);
+      else
+        fprintf(of,"%f ",(double)j);
+
+    if(dB){
+      float val;
+      if(v[j]==0.)
+        val=-140.;
+      else
+        val=todB(v+j);
+      fprintf(of,"%f\n",val);
+    }else{
+      fprintf(of,"%f\n",v[j]);
     }
-    fclose(of);
-    /*  } */
+  }
+  fclose(of);
 }
 
 void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
-		      ogg_int64_t off){
+                      ogg_int64_t off){
   if(analysis_noisy)_analysis_output_always(base,i,v,n,bark,dB,off);
 }
 
-
+#endif
 
 
 

+ 21 - 23
Engine/lib/libvorbis/lib/backends.h

@@ -5,14 +5,14 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: libvorbis backend and mapping structures; needed for 
+ function: libvorbis backend and mapping structures; needed for
            static mode headers
- last mod: $Id: backends.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: backends.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
@@ -35,7 +35,7 @@ typedef struct{
   void (*free_look) (vorbis_look_floor *);
   void *(*inverse1)  (struct vorbis_block *,vorbis_look_floor *);
   int   (*inverse2)  (struct vorbis_block *,vorbis_look_floor *,
-		     void *buffer,float *);
+                     void *buffer,float *);
 } vorbis_func_floor;
 
 typedef struct{
@@ -68,16 +68,16 @@ typedef struct{
   int   class_subbook[VIF_CLASS][8]; /* [VIF_CLASS][subs] */
 
 
-  int   mult;                      /* 1 2 3 or 4 */ 
-  int   postlist[VIF_POSIT+2];    /* first two implicit */ 
+  int   mult;                      /* 1 2 3 or 4 */
+  int   postlist[VIF_POSIT+2];    /* first two implicit */
 
 
   /* encode side analysis parameters */
-  float maxover;     
-  float maxunder;  
-  float maxerr;    
+  float maxover;
+  float maxunder;
+  float maxerr;
 
-  float twofitweight;  
+  float twofitweight;
   float twofitatten;
 
   int   n;
@@ -89,16 +89,16 @@ typedef struct{
   void                 (*pack)  (vorbis_info_residue *,oggpack_buffer *);
   vorbis_info_residue *(*unpack)(vorbis_info *,oggpack_buffer *);
   vorbis_look_residue *(*look)  (vorbis_dsp_state *,
-				 vorbis_info_residue *);
+                                 vorbis_info_residue *);
   void (*free_info)    (vorbis_info_residue *);
   void (*free_look)    (vorbis_look_residue *);
   long **(*class)      (struct vorbis_block *,vorbis_look_residue *,
-			float **,int *,int);
+                        int **,int *,int);
   int  (*forward)      (oggpack_buffer *,struct vorbis_block *,
-			vorbis_look_residue *,
-			float **,float **,int *,int,long **);
+                        vorbis_look_residue *,
+                        int **,int *,int,long **,int);
   int  (*inverse)      (struct vorbis_block *,vorbis_look_residue *,
-			float **,int *,int);
+                        float **,int *,int);
 } vorbis_func_residue;
 
 typedef struct vorbis_info_residue0{
@@ -109,19 +109,19 @@ typedef struct vorbis_info_residue0{
   /* first stage (lossless partitioning) */
   int    grouping;         /* group n vectors per partition */
   int    partitions;       /* possible codebooks for a partition */
+  int    partvals;         /* partitions ^ groupbook dim */
   int    groupbook;        /* huffbook for partitioning */
   int    secondstages[64]; /* expanded out to pointers in lookup */
-  int    booklist[256];    /* list of second stage books */
-
-  float  classmetric1[64];  
-  float  classmetric2[64];  
+  int    booklist[512];    /* list of second stage books */
 
+  const int classmetric1[64];
+  const int classmetric2[64];
 } vorbis_info_residue0;
 
 /* Mapping backend generic *****************************************/
 typedef struct{
   void                 (*pack)  (vorbis_info *,vorbis_info_mapping *,
-				 oggpack_buffer *);
+                                 oggpack_buffer *);
   vorbis_info_mapping *(*unpack)(vorbis_info *,oggpack_buffer *);
   void (*free_info)    (vorbis_info_mapping *);
   int  (*forward)      (struct vorbis_block *vb);
@@ -131,7 +131,7 @@ typedef struct{
 typedef struct vorbis_info_mapping0{
   int   submaps;  /* <= 16 */
   int   chmuxlist[256];   /* up to 256 channels in a Vorbis stream */
-  
+
   int   floorsubmap[16];   /* [mux] submap to floors */
   int   residuesubmap[16]; /* [mux] submap to residue */
 
@@ -142,5 +142,3 @@ typedef struct vorbis_info_mapping0{
 } vorbis_info_mapping0;
 
 #endif
-
-

+ 41 - 41
Engine/lib/libvorbis/lib/bitrate.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: bitrate tracking and management
- last mod: $Id: bitrate.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: bitrate.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -31,7 +31,7 @@ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
   bitrate_manager_info *bi=&ci->bi;
 
   memset(bm,0,sizeof(*bm));
-  
+
   if(bi && (bi->reservoir_bits>0)){
     long ratesamples=vi->rate;
     int  halfsamples=ci->blocksizes[0]>>1;
@@ -42,8 +42,8 @@ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
     bm->avg_bitsper= rint(1.*bi->avg_rate*halfsamples/ratesamples);
     bm->min_bitsper= rint(1.*bi->min_rate*halfsamples/ratesamples);
     bm->max_bitsper= rint(1.*bi->max_rate*halfsamples/ratesamples);
-    
-    bm->avgfloat=PACKETBLOBS/2;    
+
+    bm->avgfloat=PACKETBLOBS/2;
 
     /* not a necessary fix, but one that leads to a more balanced
        typical initialization */
@@ -53,7 +53,7 @@ void vorbis_bitrate_init(vorbis_info *vi,bitrate_manager_state *bm){
       bm->avg_reservoir=desired_fill;
     }
 
-  }    
+  }
 }
 
 void vorbis_bitrate_clear(bitrate_manager_state *bm){
@@ -63,7 +63,7 @@ void vorbis_bitrate_clear(bitrate_manager_state *bm){
 
 int vorbis_bitrate_managed(vorbis_block *vb){
   vorbis_dsp_state      *vd=vb->vd;
-  private_state         *b=vd->backend_state; 
+  private_state         *b=vd->backend_state;
   bitrate_manager_state *bm=&b->bms;
 
   if(bm && bm->managed)return(1);
@@ -74,7 +74,7 @@ int vorbis_bitrate_managed(vorbis_block *vb){
 int vorbis_bitrate_addblock(vorbis_block *vb){
   vorbis_block_internal *vbi=vb->internal;
   vorbis_dsp_state      *vd=vb->vd;
-  private_state         *b=vd->backend_state; 
+  private_state         *b=vd->backend_state;
   bitrate_manager_state *bm=&b->bms;
   vorbis_info           *vi=vd->vi;
   codec_setup_info      *ci=vi->codec_setup;
@@ -89,15 +89,15 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
   if(!bm->managed){
     /* not a bitrate managed stream, but for API simplicity, we'll
        buffer the packet to keep the code path clean */
-    
+
     if(bm->vb)return(-1); /* one has been submitted without
-			     being claimed */
+                             being claimed */
     bm->vb=vb;
     return(0);
   }
 
   bm->vb=vb;
-  
+
   /* look ahead for avg floater */
   if(bm->avg_bitsper>0){
     double slew=0.;
@@ -117,15 +117,15 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
 
     if(bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
       while(choice>0 && this_bits>avg_target_bits &&
-	    bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
-	choice--;
-	this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+            bm->avg_reservoir+(this_bits-avg_target_bits)>desired_fill){
+        choice--;
+        this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
       }
     }else if(bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
       while(choice+1<PACKETBLOBS && this_bits<avg_target_bits &&
-	    bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
-	choice++;
-	this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+            bm->avg_reservoir+(this_bits-avg_target_bits)<desired_fill){
+        choice++;
+        this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
       }
     }
 
@@ -143,21 +143,21 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
     /* do we need to force the bitrate up? */
     if(this_bits<min_target_bits){
       while(bm->minmax_reservoir-(min_target_bits-this_bits)<0){
-	choice++;
-	if(choice>=PACKETBLOBS)break;
-	this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+        choice++;
+        if(choice>=PACKETBLOBS)break;
+        this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
       }
     }
   }
-  
+
   /* enforce max (if used) on the current floater (if used) */
   if(bm->max_bitsper>0){
     /* do we need to force the bitrate down? */
     if(this_bits>max_target_bits){
       while(bm->minmax_reservoir+(this_bits-max_target_bits)>bi->reservoir_bits){
-	choice--;
-	if(choice<0)break;
-	this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
+        choice--;
+        if(choice<0)break;
+        this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
       }
     }
   }
@@ -170,9 +170,9 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
        frame will need to be truncated */
     long maxsize=(max_target_bits+(bi->reservoir_bits-bm->minmax_reservoir))/8;
     bm->choice=choice=0;
-    
+
     if(oggpack_bytes(vbi->packetblob[choice])>maxsize){
-      
+
       oggpack_writetrunc(vbi->packetblob[choice],maxsize*8);
       this_bits=oggpack_bytes(vbi->packetblob[choice])*8;
     }
@@ -201,26 +201,26 @@ int vorbis_bitrate_addblock(vorbis_block *vb){
     }else{
       /* inbetween; we want to take reservoir toward but not past desired_fill */
       if(bm->minmax_reservoir>desired_fill){
-	if(max_target_bits>0){ /* logical bulletproofing against initialization state */
-	  bm->minmax_reservoir+=(this_bits-max_target_bits);
-	  if(bm->minmax_reservoir<desired_fill)bm->minmax_reservoir=desired_fill;
-	}else{
-	  bm->minmax_reservoir=desired_fill;
-	}
+        if(max_target_bits>0){ /* logical bulletproofing against initialization state */
+          bm->minmax_reservoir+=(this_bits-max_target_bits);
+          if(bm->minmax_reservoir<desired_fill)bm->minmax_reservoir=desired_fill;
+        }else{
+          bm->minmax_reservoir=desired_fill;
+        }
       }else{
-	if(min_target_bits>0){ /* logical bulletproofing against initialization state */
-	  bm->minmax_reservoir+=(this_bits-min_target_bits);
-	  if(bm->minmax_reservoir>desired_fill)bm->minmax_reservoir=desired_fill;
-	}else{
-	  bm->minmax_reservoir=desired_fill;
-	}
+        if(min_target_bits>0){ /* logical bulletproofing against initialization state */
+          bm->minmax_reservoir+=(this_bits-min_target_bits);
+          if(bm->minmax_reservoir>desired_fill)bm->minmax_reservoir=desired_fill;
+        }else{
+          bm->minmax_reservoir=desired_fill;
+        }
       }
     }
   }
 
   /* avg reservoir */
   if(bm->avg_bitsper>0){
-    long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper);    
+    long avg_target_bits=(vb->W?bm->avg_bitsper*bm->short_per_long:bm->avg_bitsper);
     bm->avg_reservoir+=this_bits-avg_target_bits;
   }
 
@@ -236,7 +236,7 @@ int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){
 
   if(op){
     vorbis_block_internal *vbi=vb->internal;
-    
+
     if(vorbis_bitrate_managed(vb))
       choice=bm->choice;
 
@@ -247,7 +247,7 @@ int vorbis_bitrate_flushpacket(vorbis_dsp_state *vd,ogg_packet *op){
     op->granulepos=vb->granulepos;
     op->packetno=vb->sequence; /* for sake of completeness */
   }
-  
+
   bm->vb=0;
   return(1);
 }

+ 264 - 211
Engine/lib/libvorbis/lib/block.c

@@ -5,17 +5,17 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: block.c 17561 2010-10-23 10:34:24Z xiphmont $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
- 
+
  ********************************************************************/
 
 #include <stdio.h>
@@ -50,33 +50,33 @@ static int ilog2(unsigned int v){
 :.....'''         |_____--- '''......|       | \_______|
 :.................|__________________|_______|__|______|
                   |<------ Sl ------>|      > Sr <     |endW
-                  |beginSl           |endSl  |  |endSr   
+                  |beginSl           |endSl  |  |endSr
                   |beginW            |endlW  |beginSr
 
 
-                      |< lW >|       
+                      |< lW >|
                    <--------------- W ---------------->
                   |   |  ..  ______________            |
                   |   | '  `/        |     ---_        |
-                  |___.'___/`.       |         ---_____| 
+                  |___.'___/`.       |         ---_____|
                   |_______|__|_______|_________________|
                   |      >|Sl|<      |<------ Sr ----->|endW
                   |       |  |endSl  |beginSr          |endSr
-                  |beginW |  |endlW                     
+                  |beginW |  |endlW
                   mult[0] |beginSl                     mult[n]
 
  <-------------- lW ----------------->
-                          |<--W-->|                               
-:            ..............  ___  |   |                    
-:        .'''             |`/   \ |   |                       
-:.....'''                 |/`....\|...|                    
-:.........................|___|___|___|                  
-                          |Sl |Sr |endW    
+                          |<--W-->|
+:            ..............  ___  |   |
+:        .'''             |`/   \ |   |
+:.....'''                 |/`....\|...|
+:.........................|___|___|___|
+                          |Sl |Sr |endW
                           |   |   |endSr
                           |   |beginSr
                           |   |endSl
-			  |beginSl
-			  |beginW
+                          |beginSl
+                          |beginW
 */
 
 /* block abstraction setup *********************************************/
@@ -98,13 +98,13 @@ int vorbis_block_init(vorbis_dsp_state *v, vorbis_block *vb){
 
     for(i=0;i<PACKETBLOBS;i++){
       if(i==PACKETBLOBS/2){
-	vbi->packetblob[i]=&vb->opb;
+        vbi->packetblob[i]=&vb->opb;
       }else{
-	vbi->packetblob[i]=
-	  _ogg_calloc(1,sizeof(oggpack_buffer));
+        vbi->packetblob[i]=
+          _ogg_calloc(1,sizeof(oggpack_buffer));
       }
       oggpack_writeinit(vbi->packetblob[i]);
-    }    
+    }
   }
 
   return(0);
@@ -185,7 +185,7 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
   int hs;
 
   if(ci==NULL) return 1;
-  hs=ci->halfrate_flag; 
+  hs=ci->halfrate_flag;
 
   memset(v,0,sizeof(*v));
   b=v->backend_state=_ogg_calloc(1,sizeof(*b));
@@ -217,16 +217,16 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
     if(!ci->fullbooks){
       ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
       for(i=0;i<ci->books;i++)
-	vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]);
+        vorbis_book_init_encode(ci->fullbooks+i,ci->book_param[i]);
     }
 
     b->psy=_ogg_calloc(ci->psys,sizeof(*b->psy));
     for(i=0;i<ci->psys;i++){
       _vp_psy_init(b->psy+i,
-		   ci->psy_param[i],
-		   &ci->psy_g_param,
-		   ci->blocksizes[ci->psy_param[i]->blockflag]/2,
-		   vi->rate);
+                   ci->psy_param[i],
+                   &ci->psy_g_param,
+                   ci->blocksizes[ci->psy_param[i]->blockflag]/2,
+                   vi->rate);
     }
 
     v->analysisp=1;
@@ -235,10 +235,13 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
     if(!ci->fullbooks){
       ci->fullbooks=_ogg_calloc(ci->books,sizeof(*ci->fullbooks));
       for(i=0;i<ci->books;i++){
-	vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]);
-	/* decode codebooks are now standalone after init */
-	vorbis_staticbook_destroy(ci->book_param[i]);
-	ci->book_param[i]=NULL;
+        if(ci->book_param[i]==NULL)
+          goto abort_books;
+        if(vorbis_book_init_decode(ci->fullbooks+i,ci->book_param[i]))
+          goto abort_books;
+        /* decode codebooks are now standalone after init */
+        vorbis_staticbook_destroy(ci->book_param[i]);
+        ci->book_param[i]=NULL;
       }
     }
   }
@@ -274,9 +277,18 @@ static int _vds_shared_init(vorbis_dsp_state *v,vorbis_info *vi,int encp){
 
   for(i=0;i<ci->residues;i++)
     b->residue[i]=_residue_P[ci->residue_type[i]]->
-      look(v,ci->residue_param[i]);    
+      look(v,ci->residue_param[i]);
 
   return 0;
+ abort_books:
+  for(i=0;i<ci->books;i++){
+    if(ci->book_param[i]!=NULL){
+      vorbis_staticbook_destroy(ci->book_param[i]);
+      ci->book_param[i]=NULL;
+    }
+  }
+  vorbis_dsp_clear(v);
+  return -1;
 }
 
 /* arbitrary settings and spec-mandated numbers get filled in here */
@@ -308,42 +320,42 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
     private_state *b=v->backend_state;
 
     if(b){
-	
+
       if(b->ve){
-	_ve_envelope_clear(b->ve);
-	_ogg_free(b->ve);
+        _ve_envelope_clear(b->ve);
+        _ogg_free(b->ve);
       }
 
       if(b->transform[0]){
-	mdct_clear(b->transform[0][0]);
-	_ogg_free(b->transform[0][0]);
-	_ogg_free(b->transform[0]);
+        mdct_clear(b->transform[0][0]);
+        _ogg_free(b->transform[0][0]);
+        _ogg_free(b->transform[0]);
       }
       if(b->transform[1]){
-	mdct_clear(b->transform[1][0]);
-	_ogg_free(b->transform[1][0]);
-	_ogg_free(b->transform[1]);
+        mdct_clear(b->transform[1][0]);
+        _ogg_free(b->transform[1][0]);
+        _ogg_free(b->transform[1]);
       }
 
       if(b->flr){
-	if(ci)
-	  for(i=0;i<ci->floors;i++)
-	    _floor_P[ci->floor_type[i]]->
-	      free_look(b->flr[i]);
-	_ogg_free(b->flr);
+        if(ci)
+          for(i=0;i<ci->floors;i++)
+            _floor_P[ci->floor_type[i]]->
+              free_look(b->flr[i]);
+        _ogg_free(b->flr);
       }
       if(b->residue){
-	if(ci)
-	  for(i=0;i<ci->residues;i++)
-	    _residue_P[ci->residue_type[i]]->
-	      free_look(b->residue[i]);
-	_ogg_free(b->residue);
+        if(ci)
+          for(i=0;i<ci->residues;i++)
+            _residue_P[ci->residue_type[i]]->
+              free_look(b->residue[i]);
+        _ogg_free(b->residue);
       }
       if(b->psy){
-	if(ci)
-	  for(i=0;i<ci->psys;i++)
-	    _vp_psy_clear(b->psy+i);
-	_ogg_free(b->psy);
+        if(ci)
+          for(i=0;i<ci->psys;i++)
+            _vp_psy_clear(b->psy+i);
+        _ogg_free(b->psy);
       }
 
       if(b->psy_g_look)_vp_global_free(b->psy_g_look);
@@ -353,11 +365,11 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
       drft_clear(&b->fft_look[1]);
 
     }
-    
+
     if(v->pcm){
       if(vi)
-	for(i=0;i<vi->channels;i++)
-	  if(v->pcm[i])_ogg_free(v->pcm[i]);
+        for(i=0;i<vi->channels;i++)
+          if(v->pcm[i])_ogg_free(v->pcm[i]);
       _ogg_free(v->pcm);
       if(v->pcmret)_ogg_free(v->pcmret);
     }
@@ -369,7 +381,7 @@ void vorbis_dsp_clear(vorbis_dsp_state *v){
       if(b->header2)_ogg_free(b->header2);
       _ogg_free(b);
     }
-    
+
     memset(v,0,sizeof(*v));
   }
 }
@@ -386,10 +398,10 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
 
   /* Do we have enough storage space for the requested buffer? If not,
      expand the PCM (and envelope) storage */
-    
+
   if(v->pcm_current+vals>=v->pcm_storage){
     v->pcm_storage=v->pcm_current+vals*2;
-   
+
     for(i=0;i<vi->channels;i++){
       v->pcm[i]=_ogg_realloc(v->pcm[i],v->pcm_storage*sizeof(*v->pcm[i]));
     }
@@ -397,13 +409,13 @@ float **vorbis_analysis_buffer(vorbis_dsp_state *v, int vals){
 
   for(i=0;i<vi->channels;i++)
     v->pcmret[i]=v->pcm[i]+v->pcm_current;
-    
+
   return(v->pcmret);
 }
 
 static void _preextrapolate_helper(vorbis_dsp_state *v){
   int i;
-  int order=32;
+  int order=16;
   float *lpc=alloca(order*sizeof(*lpc));
   float *work=alloca(v->pcm_current*sizeof(*work));
   long j;
@@ -413,19 +425,30 @@ static void _preextrapolate_helper(vorbis_dsp_state *v){
     for(i=0;i<v->vi->channels;i++){
       /* need to run the extrapolation in reverse! */
       for(j=0;j<v->pcm_current;j++)
-	work[j]=v->pcm[i][v->pcm_current-j-1];
-      
+        work[j]=v->pcm[i][v->pcm_current-j-1];
+
       /* prime as above */
       vorbis_lpc_from_data(work,lpc,v->pcm_current-v->centerW,order);
-      
+
+#if 0
+      if(v->vi->channels==2){
+        if(i==0)
+          _analysis_output("predataL",0,work,v->pcm_current-v->centerW,0,0,0);
+        else
+          _analysis_output("predataR",0,work,v->pcm_current-v->centerW,0,0,0);
+      }else{
+        _analysis_output("predata",0,work,v->pcm_current-v->centerW,0,0,0);
+      }
+#endif
+
       /* run the predictor filter */
       vorbis_lpc_predict(lpc,work+v->pcm_current-v->centerW-order,
-			 order,
-			 work+v->pcm_current-v->centerW,
-			 v->centerW);
+                         order,
+                         work+v->pcm_current-v->centerW,
+                         v->centerW);
 
       for(j=0;j<v->pcm_current;j++)
-	v->pcm[i][v->pcm_current-j-1]=work[j];
+        v->pcm[i][v->pcm_current-j-1]=work[j];
 
     }
   }
@@ -453,29 +476,29 @@ int vorbis_analysis_wrote(vorbis_dsp_state *v, int vals){
        amplitude off a cliff, creating spread spectrum noise that will
        suck to encode.  Extrapolate for the sake of cleanliness. */
 
-    vorbis_analysis_buffer(v,ci->blocksizes[1]*3); 
+    vorbis_analysis_buffer(v,ci->blocksizes[1]*3);
     v->eofflag=v->pcm_current;
     v->pcm_current+=ci->blocksizes[1]*3;
 
     for(i=0;i<vi->channels;i++){
       if(v->eofflag>order*2){
-	/* extrapolate with LPC to fill in */
-	long n;
+        /* extrapolate with LPC to fill in */
+        long n;
 
-	/* make a predictor filter */
-	n=v->eofflag;
-	if(n>ci->blocksizes[1])n=ci->blocksizes[1];
-	vorbis_lpc_from_data(v->pcm[i]+v->eofflag-n,lpc,n,order);
+        /* make a predictor filter */
+        n=v->eofflag;
+        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 */
-	vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order,
-			   v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag);
+        /* run the predictor filter */
+        vorbis_lpc_predict(lpc,v->pcm[i]+v->eofflag-order,order,
+                           v->pcm[i]+v->eofflag,v->pcm_current-v->eofflag);
       }else{
-	/* not enough data to extrapolate (unlikely to happen due to
+        /* not enough data to extrapolate (unlikely to happen due to
            guarding the overlap, but bulletproof in case that
            assumtion goes away). zeroes will do. */
-	memset(v->pcm[i]+v->eofflag,0,
-	       (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i]));
+        memset(v->pcm[i]+v->eofflag,0,
+               (v->pcm_current-v->eofflag)*sizeof(*v->pcm[i]));
 
       }
     }
@@ -520,19 +543,19 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
   /* we do an envelope search even on a single blocksize; we may still
      be throwing more bits at impulses, and envelope search handles
      marking impulses too. */
-  {  
+  {
     long bp=_ve_envelope_search(v);
     if(bp==-1){
 
       if(v->eofflag==0)return(0); /* not enough data currently to search for a
-				     full long block */
+                                     full long block */
       v->nW=0;
     }else{
 
       if(ci->blocksizes[0]==ci->blocksizes[1])
-	v->nW=0;
+        v->nW=0;
       else
-	v->nW=bp;
+        v->nW=bp;
     }
   }
 
@@ -552,7 +575,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
 
 
   }
-  
+
   /* fill in the block.  Note that for a short window, lW and nW are *short*
      regardless of actual settings in the stream */
 
@@ -580,12 +603,12 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
 
     }
   }
- 
+
   vb->vd=v;
   vb->sequence=v->sequence++;
   vb->granulepos=v->granulepos;
   vb->pcmend=ci->blocksizes[v->W];
-  
+
   /* copy the vectors; this uses the local storage in vb */
 
   /* this tracks 'strongest peak' for later psychoacoustics */
@@ -593,7 +616,7 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
   if(vbi->ampmax>g->ampmax)g->ampmax=vbi->ampmax;
   g->ampmax=_vp_ampmax_decay(g->ampmax,v);
   vbi->ampmax=g->ampmax;
-  
+
   vb->pcm=_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels);
   vbi->pcmdelay=_vorbis_block_alloc(vb,sizeof(*vbi->pcmdelay)*vi->channels);
   for(i=0;i<vi->channels;i++){
@@ -601,14 +624,14 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
       _vorbis_block_alloc(vb,(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
     memcpy(vbi->pcmdelay[i],v->pcm[i],(vb->pcmend+beginW)*sizeof(*vbi->pcmdelay[i]));
     vb->pcm[i]=vbi->pcmdelay[i]+beginW;
-    
-    /* before we added the delay 
+
+    /* before we added the delay
        vb->pcm[i]=_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i]));
        memcpy(vb->pcm[i],v->pcm[i]+beginW,ci->blocksizes[v->W]*sizeof(*vb->pcm[i]));
     */
-    
+
   }
-  
+
   /* handle eof detection: eof==0 means that we've not yet received EOF
                            eof>0  marks the last 'real' sample in pcm[]
                            eof<0  'no more to do'; doesn't get here */
@@ -630,27 +653,27 @@ int vorbis_analysis_blockout(vorbis_dsp_state *v,vorbis_block *vb){
 
       _ve_envelope_shift(b->ve,movementW);
       v->pcm_current-=movementW;
-      
+
       for(i=0;i<vi->channels;i++)
-	memmove(v->pcm[i],v->pcm[i]+movementW,
-		v->pcm_current*sizeof(*v->pcm[i]));
-      
-      
+        memmove(v->pcm[i],v->pcm[i]+movementW,
+                v->pcm_current*sizeof(*v->pcm[i]));
+
+
       v->lW=v->W;
       v->W=v->nW;
       v->centerW=new_centerNext;
-      
+
       if(v->eofflag){
-	v->eofflag-=movementW;
-	if(v->eofflag<=0)v->eofflag=-1;
-	/* do not add padding to end of stream! */
-	if(v->centerW>=v->eofflag){
-	  v->granulepos+=movementW-(v->centerW-v->eofflag);
-	}else{
-	  v->granulepos+=movementW;
-	}
+        v->eofflag-=movementW;
+        if(v->eofflag<=0)v->eofflag=-1;
+        /* do not add padding to end of stream! */
+        if(v->centerW>=v->eofflag){
+          v->granulepos+=movementW-(v->centerW-v->eofflag);
+        }else{
+          v->granulepos+=movementW;
+        }
       }else{
-	v->granulepos+=movementW;
+        v->granulepos+=movementW;
       }
     }
   }
@@ -668,11 +691,11 @@ int vorbis_synthesis_restart(vorbis_dsp_state *v){
   if(!vi)return -1;
   ci=vi->codec_setup;
   if(!ci)return -1;
-  hs=ci->halfrate_flag; 
+  hs=ci->halfrate_flag;
 
   v->centerW=ci->blocksizes[1]>>(hs+1);
   v->pcm_current=v->centerW>>hs;
-  
+
   v->pcm_returned=-1;
   v->granulepos=-1;
   v->sequence=-1;
@@ -683,9 +706,11 @@ int vorbis_synthesis_restart(vorbis_dsp_state *v){
 }
 
 int vorbis_synthesis_init(vorbis_dsp_state *v,vorbis_info *vi){
-  if(_vds_shared_init(v,vi,0)) return 1;
+  if(_vds_shared_init(v,vi,0)){
+    vorbis_dsp_clear(v);
+    return 1;
+  }
   vorbis_synthesis_restart(v);
-
   return 0;
 }
 
@@ -697,16 +722,16 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   vorbis_info *vi=v->vi;
   codec_setup_info *ci=vi->codec_setup;
   private_state *b=v->backend_state;
-  int hs=ci->halfrate_flag; 
+  int hs=ci->halfrate_flag;
   int i,j;
 
   if(!vb)return(OV_EINVAL);
   if(v->pcm_current>v->pcm_returned  && v->pcm_returned!=-1)return(OV_EINVAL);
-    
+
   v->lW=v->W;
   v->W=vb->W;
   v->nW=-1;
-  
+
   if((v->sequence==-1)||
      (v->sequence+1 != vb->sequence)){
     v->granulepos=-1; /* out of sequence; lose count */
@@ -714,21 +739,21 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   }
 
   v->sequence=vb->sequence;
-  
-  if(vb->pcm){  /* no pcm to process if vorbis_synthesis_trackonly 
-		   was called on block */
+
+  if(vb->pcm){  /* no pcm to process if vorbis_synthesis_trackonly
+                   was called on block */
     int n=ci->blocksizes[v->W]>>(hs+1);
     int n0=ci->blocksizes[0]>>(hs+1);
     int n1=ci->blocksizes[1]>>(hs+1);
 
     int thisCenter;
     int prevCenter;
-    
+
     v->glue_bits+=vb->glue_bits;
     v->time_bits+=vb->time_bits;
     v->floor_bits+=vb->floor_bits;
     v->res_bits+=vb->res_bits;
-    
+
     if(v->centerW){
       thisCenter=n1;
       prevCenter=0;
@@ -736,84 +761,84 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
       thisCenter=0;
       prevCenter=n1;
     }
-    
+
     /* v->pcm is now used like a two-stage double buffer.  We don't want
        to have to constantly shift *or* adjust memory usage.  Don't
        accept a new block until the old is shifted out */
-    
+
     for(j=0;j<vi->channels;j++){
       /* the overlap/add section */
       if(v->lW){
-	if(v->W){
-	  /* large/large */
-	  float *w=_vorbis_window_get(b->window[1]-hs);
-	  float *pcm=v->pcm[j]+prevCenter;
-	  float *p=vb->pcm[j];
-	  for(i=0;i<n1;i++)
-	    pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i];
-	}else{
-	  /* large/small */
-	  float *w=_vorbis_window_get(b->window[0]-hs);
-	  float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
-	  float *p=vb->pcm[j];
-	  for(i=0;i<n0;i++)
-	    pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
-	}
+        if(v->W){
+          /* large/large */
+          float *w=_vorbis_window_get(b->window[1]-hs);
+          float *pcm=v->pcm[j]+prevCenter;
+          float *p=vb->pcm[j];
+          for(i=0;i<n1;i++)
+            pcm[i]=pcm[i]*w[n1-i-1] + p[i]*w[i];
+        }else{
+          /* large/small */
+          float *w=_vorbis_window_get(b->window[0]-hs);
+          float *pcm=v->pcm[j]+prevCenter+n1/2-n0/2;
+          float *p=vb->pcm[j];
+          for(i=0;i<n0;i++)
+            pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+        }
       }else{
-	if(v->W){
-	  /* small/large */
-	  float *w=_vorbis_window_get(b->window[0]-hs);
-	  float *pcm=v->pcm[j]+prevCenter;
-	  float *p=vb->pcm[j]+n1/2-n0/2;
-	  for(i=0;i<n0;i++)
-	    pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
-	  for(;i<n1/2+n0/2;i++)
-	    pcm[i]=p[i];
-	}else{
-	  /* small/small */
-	  float *w=_vorbis_window_get(b->window[0]-hs);
-	  float *pcm=v->pcm[j]+prevCenter;
-	  float *p=vb->pcm[j];
-	  for(i=0;i<n0;i++)
-	    pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
-	}
+        if(v->W){
+          /* small/large */
+          float *w=_vorbis_window_get(b->window[0]-hs);
+          float *pcm=v->pcm[j]+prevCenter;
+          float *p=vb->pcm[j]+n1/2-n0/2;
+          for(i=0;i<n0;i++)
+            pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+          for(;i<n1/2+n0/2;i++)
+            pcm[i]=p[i];
+        }else{
+          /* small/small */
+          float *w=_vorbis_window_get(b->window[0]-hs);
+          float *pcm=v->pcm[j]+prevCenter;
+          float *p=vb->pcm[j];
+          for(i=0;i<n0;i++)
+            pcm[i]=pcm[i]*w[n0-i-1] +p[i]*w[i];
+        }
       }
-      
+
       /* the copy section */
       {
-	float *pcm=v->pcm[j]+thisCenter;
-	float *p=vb->pcm[j]+n;
-	for(i=0;i<n;i++)
-	  pcm[i]=p[i];
+        float *pcm=v->pcm[j]+thisCenter;
+        float *p=vb->pcm[j]+n;
+        for(i=0;i<n;i++)
+          pcm[i]=p[i];
       }
     }
-    
+
     if(v->centerW)
       v->centerW=0;
     else
       v->centerW=n1;
-    
+
     /* deal with initial packet state; we do this using the explicit
        pcm_returned==-1 flag otherwise we're sensitive to first block
        being short or long */
-    
+
     if(v->pcm_returned==-1){
       v->pcm_returned=thisCenter;
       v->pcm_current=thisCenter;
     }else{
       v->pcm_returned=prevCenter;
       v->pcm_current=prevCenter+
-	((ci->blocksizes[v->lW]/4+
-	ci->blocksizes[v->W]/4)>>hs);
+        ((ci->blocksizes[v->lW]/4+
+        ci->blocksizes[v->W]/4)>>hs);
     }
-    
+
   }
 
   /* track the frame number... This is for convenience, but also
      making sure our last packet doesn't end with added padding.  If
      the last packet is partial, the number of samples we'll have to
      return will be past the vb->granulepos.
-     
+
      This is not foolproof!  It will be confused if we begin
      decoding at the last page after a seek or hole.  In that case,
      we don't have a starting point to judge where the last frame
@@ -825,7 +850,7 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   }else{
     b->sample_count+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
   }
-  
+
   if(v->granulepos==-1){
     if(vb->granulepos!=-1){ /* only set if we have a position to set to */
 
@@ -833,22 +858,37 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
 
       /* is this a short page? */
       if(b->sample_count>v->granulepos){
-	/* corner case; if this is both the first and last audio page,
-	   then spec says the end is cut, not beginning */
-	if(vb->eofflag){
-	  /* trim the end */
-	  /* no preceeding granulepos; assume we started at zero (we'd
-	     have to in a short single-page stream) */
-	  /* granulepos could be -1 due to a seek, but that would result
-	     in a long count, not short count */
-	  
-	  v->pcm_current-=(b->sample_count-v->granulepos)>>hs;
-	}else{
-	  /* trim the beginning */
-	  v->pcm_returned+=(b->sample_count-v->granulepos)>>hs;
-	  if(v->pcm_returned>v->pcm_current)
-	    v->pcm_returned=v->pcm_current;
-	}
+        /* corner case; if this is both the first and last audio page,
+           then spec says the end is cut, not beginning */
+       long extra=b->sample_count-vb->granulepos;
+
+        /* we use ogg_int64_t for granule positions because a
+           uint64 isn't universally available.  Unfortunately,
+           that means granposes can be 'negative' and result in
+           extra being negative */
+        if(extra<0)
+          extra=0;
+
+        if(vb->eofflag){
+          /* trim the end */
+          /* no preceding granulepos; assume we started at zero (we'd
+             have to in a short single-page stream) */
+          /* granulepos could be -1 due to a seek, but that would result
+             in a long count, not short count */
+
+          /* Guard against corrupt/malicious frames that set EOP and
+             a backdated granpos; don't rewind more samples than we
+             actually have */
+          if(extra > (v->pcm_current - v->pcm_returned)<<hs)
+            extra = (v->pcm_current - v->pcm_returned)<<hs;
+
+          v->pcm_current-=extra>>hs;
+        }else{
+          /* trim the beginning */
+          v->pcm_returned+=extra>>hs;
+          if(v->pcm_returned>v->pcm_current)
+            v->pcm_returned=v->pcm_current;
+        }
 
       }
 
@@ -856,27 +896,41 @@ int vorbis_synthesis_blockin(vorbis_dsp_state *v,vorbis_block *vb){
   }else{
     v->granulepos+=ci->blocksizes[v->lW]/4+ci->blocksizes[v->W]/4;
     if(vb->granulepos!=-1 && v->granulepos!=vb->granulepos){
-      
+
       if(v->granulepos>vb->granulepos){
-	long extra=v->granulepos-vb->granulepos;
-
-	if(extra)
-	  if(vb->eofflag){
-	    /* partial last frame.  Strip the extra samples off */
-	    v->pcm_current-=extra>>hs;
-	  } /* else {Shouldn't happen *unless* the bitstream is out of
-	       spec.  Either way, believe the bitstream } */
+        long extra=v->granulepos-vb->granulepos;
+
+        if(extra)
+          if(vb->eofflag){
+            /* partial last frame.  Strip the extra samples off */
+
+            /* Guard against corrupt/malicious frames that set EOP and
+               a backdated granpos; don't rewind more samples than we
+               actually have */
+            if(extra > (v->pcm_current - v->pcm_returned)<<hs)
+              extra = (v->pcm_current - v->pcm_returned)<<hs;
+
+            /* we use ogg_int64_t for granule positions because a
+               uint64 isn't universally available.  Unfortunately,
+               that means granposes can be 'negative' and result in
+               extra being negative */
+            if(extra<0)
+              extra=0;
+
+            v->pcm_current-=extra>>hs;
+          } /* else {Shouldn't happen *unless* the bitstream is out of
+               spec.  Either way, believe the bitstream } */
       } /* else {Shouldn't happen *unless* the bitstream is out of
-	   spec.  Either way, believe the bitstream } */
+           spec.  Either way, believe the bitstream } */
       v->granulepos=vb->granulepos;
     }
   }
-  
+
   /* Update, cleanup */
-  
+
   if(vb->eofflag)v->eofflag=1;
   return(0);
-  
+
 }
 
 /* pcm==NULL indicates we just want the pending samples, no more */
@@ -887,7 +941,7 @@ int vorbis_synthesis_pcmout(vorbis_dsp_state *v,float ***pcm){
     if(pcm){
       int i;
       for(i=0;i<vi->channels;i++)
-	v->pcmret[i]=v->pcm[i]+v->pcm_returned;
+        v->pcmret[i]=v->pcm[i]+v->pcm_returned;
       *pcm=v->pcmret;
     }
     return(v->pcm_current-v->pcm_returned);
@@ -909,8 +963,8 @@ int vorbis_synthesis_read(vorbis_dsp_state *v,int n){
 int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
   vorbis_info *vi=v->vi;
   codec_setup_info *ci=vi->codec_setup;
-  int hs=ci->halfrate_flag; 
-  
+  int hs=ci->halfrate_flag;
+
   int n=ci->blocksizes[v->W]>>(hs+1);
   int n0=ci->blocksizes[0]>>(hs+1);
   int n1=ci->blocksizes[1]>>(hs+1);
@@ -934,9 +988,9 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
     for(j=0;j<vi->channels;j++){
       float *p=v->pcm[j];
       for(i=0;i<n1;i++){
-	float temp=p[i];
-	p[i]=p[i+n1];
-	p[i+n1]=temp;
+        float temp=p[i];
+        p[i]=p[i+n1];
+        p[i+n1]=temp;
       }
     }
 
@@ -944,7 +998,7 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
     v->pcm_returned-=n1;
     v->centerW=0;
   }
-  
+
   /* solidify buffer into contiguous space */
   if((v->lW^v->W)==1){
     /* long/short or short/long */
@@ -952,7 +1006,7 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
       float *s=v->pcm[j];
       float *d=v->pcm[j]+(n1-n0)/2;
       for(i=(n1+n0)/2-1;i>=0;--i)
-	d[i]=s[i];
+        d[i]=s[i];
     }
     v->pcm_returned+=(n1-n0)/2;
     v->pcm_current+=(n1-n0)/2;
@@ -960,16 +1014,16 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
     if(v->lW==0){
       /* short/short */
       for(j=0;j<vi->channels;j++){
-	float *s=v->pcm[j];
-	float *d=v->pcm[j]+n1-n0;
-	for(i=n0-1;i>=0;--i)
-	  d[i]=s[i];
+        float *s=v->pcm[j];
+        float *d=v->pcm[j]+n1-n0;
+        for(i=n0-1;i>=0;--i)
+          d[i]=s[i];
       }
       v->pcm_returned+=n1-n0;
       v->pcm_current+=n1-n0;
     }
   }
-    
+
   if(pcm){
     int i;
     for(i=0;i<vi->channels;i++)
@@ -984,10 +1038,9 @@ int vorbis_synthesis_lapout(vorbis_dsp_state *v,float ***pcm){
 float *vorbis_window(vorbis_dsp_state *v,int W){
   vorbis_info *vi=v->vi;
   codec_setup_info *ci=vi->codec_setup;
-  int hs=ci->halfrate_flag; 
+  int hs=ci->halfrate_flag;
   private_state *b=v->backend_state;
 
   if(b->window[W]-1<0)return NULL;
   return _vorbis_window_get(b->window[W]-hs);
 }
-	

File diff suppressed because it is too large
+ 1781 - 20021
Engine/lib/libvorbis/lib/books/coupled/res_books_stereo.h


+ 1526 - 1817
Engine/lib/libvorbis/lib/books/floor/floor_books.h

@@ -11,1828 +11,1537 @@
  ********************************************************************
 
  function: static codebooks autogenerated by huff/huffbuld
- last modified: $Id: floor_books.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last modified: $Id: floor_books.h 16939 2010-03-01 08:38:14Z xiphmont $
 
  ********************************************************************/
 
 #include "codebook.h"
 
-static long _huff_lengthlist_line_256x7_0sub1[] = {
-	 0, 2, 3, 3, 3, 3, 4, 3, 4,
-};
+static const long _huff_lengthlist_line_256x7_0sub1[] = {
+         0, 2, 3, 3, 3, 3, 4, 3, 4,
+};
+
+static const static_codebook _huff_book_line_256x7_0sub1 = {
+        1, 9,
+        (long *)_huff_lengthlist_line_256x7_0sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_0sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 4, 3, 5, 3,
+         6, 3, 6, 4, 6, 4, 7, 5, 7,
+};
+
+static const static_codebook _huff_book_line_256x7_0sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_256x7_0sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_0sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 2, 5, 3, 5, 3,
+         6, 3, 6, 4, 7, 6, 7, 8, 7, 9, 8, 9, 9, 9,10, 9,
+        11,13,11,13,10,10,13,13,13,13,13,13,12,12,12,12,
+};
+
+static const static_codebook _huff_book_line_256x7_0sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_256x7_0sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_1sub1[] = {
+         0, 3, 3, 3, 3, 2, 4, 3, 4,
+};
+
+static const static_codebook _huff_book_line_256x7_1sub1 = {
+        1, 9,
+        (long *)_huff_lengthlist_line_256x7_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_1sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 4, 4,
+         5, 4, 6, 5, 6, 7, 6, 8, 8,
+};
+
+static const static_codebook _huff_book_line_256x7_1sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_256x7_1sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_1sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 4, 3, 6, 3, 7,
+         3, 8, 5, 8, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+         8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7,
+};
+
+static const static_codebook _huff_book_line_256x7_1sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_256x7_1sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_class0[] = {
+         7, 5, 5, 9, 9, 6, 6, 9,12, 8, 7, 8,11, 8, 9,15,
+         6, 3, 3, 7, 7, 4, 3, 6, 9, 6, 5, 6, 8, 6, 8,15,
+         8, 5, 5, 9, 8, 5, 4, 6,10, 7, 5, 5,11, 8, 7,15,
+        14,15,13,13,13,13, 8,11,15,10, 7, 6,11, 9,10,15,
+};
+
+static const static_codebook _huff_book_line_256x7_class0 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_256x7_class0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x7_class1[] = {
+         5, 6, 8,15, 6, 9,10,15,10,11,12,15,15,15,15,15,
+         4, 6, 7,15, 6, 7, 8,15, 9, 8, 9,15,15,15,15,15,
+         6, 8, 9,15, 7, 7, 8,15,10, 9,10,15,15,15,15,15,
+        15,13,15,15,15,10,11,15,15,13,13,15,15,15,15,15,
+         4, 6, 7,15, 6, 8, 9,15,10,10,12,15,15,15,15,15,
+         2, 5, 6,15, 5, 6, 7,15, 8, 6, 7,15,15,15,15,15,
+         5, 6, 8,15, 5, 6, 7,15, 9, 6, 7,15,15,15,15,15,
+        14,12,13,15,12,10,11,15,15,15,15,15,15,15,15,15,
+         7, 8, 9,15, 9,10,10,15,15,14,14,15,15,15,15,15,
+         5, 6, 7,15, 7, 8, 9,15,12, 9,10,15,15,15,15,15,
+         7, 7, 9,15, 7, 7, 8,15,12, 8, 9,15,15,15,15,15,
+        13,13,14,15,12,11,12,15,15,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,
+        15,12,13,15,15,12,13,15,15,14,15,15,15,15,15,15,
+        15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,
+};
+
+static const static_codebook _huff_book_line_256x7_class1 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_256x7_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_0sub0[] = {
+         4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+         5, 6, 5, 6, 6, 6, 6, 5, 6, 6, 7, 6, 7, 6, 7, 6,
+         7, 6, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 9, 7, 9, 7,
+         9, 7, 9, 8, 9, 8,10, 8,10, 8,10, 7,10, 6,10, 8,
+        10, 8,11, 7,10, 7,11, 8,11,11,12,12,11,11,12,11,
+        13,11,13,11,13,12,15,12,13,13,14,14,14,14,14,15,
+        15,15,16,14,17,19,19,18,18,18,18,18,18,18,18,18,
+        18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
+};
+
+static const static_codebook _huff_book_line_512x17_0sub0 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_512x17_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_1sub0[] = {
+         2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5,
+         6, 5, 6, 6, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 8, 7,
+};
+
+static const static_codebook _huff_book_line_512x17_1sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_512x17_1sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_1sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         4, 3, 5, 3, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 6, 5,
+         6, 5, 7, 5, 8, 6, 8, 6, 8, 6, 8, 6, 8, 7, 9, 7,
+         9, 7,11, 9,11,11,12,11,14,12,14,16,14,16,13,16,
+        14,16,12,15,13,16,14,16,13,14,12,15,13,15,13,13,
+        13,15,12,14,14,15,13,15,12,15,15,15,15,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
+};
+
+static const static_codebook _huff_book_line_512x17_1sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_512x17_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_2sub1[] = {
+         0, 4, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 5, 4, 5, 3,
+         5, 3,
+};
+
+static const static_codebook _huff_book_line_512x17_2sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_512x17_2sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_2sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 6, 4, 6, 5,
+         6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 7, 8, 7, 9, 7,
+         9, 8,
+};
+
+static const static_codebook _huff_book_line_512x17_2sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_512x17_2sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_2sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 3, 3, 3, 4, 3, 4, 4, 5, 5, 6, 6, 7, 7,
+         7, 8, 8,11, 8, 9, 9, 9,10,11,11,11, 9,10,10,11,
+        11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,
+        10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+        10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+};
+
+static const static_codebook _huff_book_line_512x17_2sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_512x17_2sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_3sub1[] = {
+         0, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 5, 4, 5,
+         5, 5,
+};
+
+static const static_codebook _huff_book_line_512x17_3sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_512x17_3sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_3sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 2, 3, 3, 4, 3, 5, 4, 6, 4, 6, 5, 7, 6, 7,
+         6, 8, 6, 8, 7, 9, 8,10, 8,12, 9,13,10,15,10,15,
+        11,14,
+};
+
+static const static_codebook _huff_book_line_512x17_3sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_512x17_3sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_3sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 4, 8, 4, 8, 4, 8, 4, 8, 5, 8, 5, 8, 6, 8,
+         4, 8, 4, 8, 5, 8, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+};
+
+static const static_codebook _huff_book_line_512x17_3sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_512x17_3sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_class1[] = {
+         1, 2, 3, 6, 5, 4, 7, 7,
+};
+
+static const static_codebook _huff_book_line_512x17_class1 = {
+        1, 8,
+        (long *)_huff_lengthlist_line_512x17_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_class2[] = {
+         3, 3, 3,14, 5, 4, 4,11, 8, 6, 6,10,17,12,11,17,
+         6, 5, 5,15, 5, 3, 4,11, 8, 5, 5, 8,16, 9,10,14,
+        10, 8, 9,17, 8, 6, 6,13,10, 7, 7,10,16,11,13,14,
+        17,17,17,17,17,16,16,16,16,15,16,16,16,16,16,16,
+};
+
+static const static_codebook _huff_book_line_512x17_class2 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_512x17_class2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_512x17_class3[] = {
+         2, 4, 6,17, 4, 5, 7,17, 8, 7,10,17,17,17,17,17,
+         3, 4, 6,15, 3, 3, 6,15, 7, 6, 9,17,17,17,17,17,
+         6, 8,10,17, 6, 6, 8,16, 9, 8,10,17,17,15,16,17,
+        17,17,17,17,12,15,15,16,12,15,15,16,16,16,16,16,
+};
+
+static const static_codebook _huff_book_line_512x17_class3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_512x17_class3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x4_class0[] = {
+         7, 7, 7,11, 6, 6, 7,11, 7, 6, 6,10,12,10,10,13,
+         7, 7, 8,11, 7, 7, 7,11, 7, 6, 7,10,11,10,10,13,
+        10,10, 9,12, 9, 9, 9,11, 8, 8, 8,11,13,11,10,14,
+        15,15,14,15,15,14,13,14,15,12,12,17,17,17,17,17,
+         7, 7, 6, 9, 6, 6, 6, 9, 7, 6, 6, 8,11,11,10,12,
+         7, 7, 7, 9, 7, 6, 6, 9, 7, 6, 6, 9,13,10,10,11,
+        10, 9, 8,10, 9, 8, 8,10, 8, 8, 7, 9,13,12,10,11,
+        17,14,14,13,15,14,12,13,17,13,12,15,17,17,14,17,
+         7, 6, 6, 7, 6, 6, 5, 7, 6, 6, 6, 6,11, 9, 9, 9,
+         7, 7, 6, 7, 7, 6, 6, 7, 6, 6, 6, 6,10, 9, 8, 9,
+        10, 9, 8, 8, 9, 8, 7, 8, 8, 7, 6, 8,11,10, 9,10,
+        17,17,12,15,15,15,12,14,14,14,10,12,15,13,12,13,
+        11,10, 8,10,11,10, 8, 8,10, 9, 7, 7,10, 9, 9,11,
+        11,11, 9,10,11,10, 8, 9,10, 8, 6, 8,10, 9, 9,11,
+        14,13,10,12,12,11,10,10, 8, 7, 8,10,10,11,11,12,
+        17,17,15,17,17,17,17,17,17,13,12,17,17,17,14,17,
+};
+
+static const static_codebook _huff_book_line_128x4_class0 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_128x4_class0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x4_0sub0[] = {
+         2, 2, 2, 2,
+};
+
+static const static_codebook _huff_book_line_128x4_0sub0 = {
+        1, 4,
+        (long *)_huff_lengthlist_line_128x4_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x4_0sub1[] = {
+         0, 0, 0, 0, 3, 2, 3, 2, 3, 3,
+};
+
+static const static_codebook _huff_book_line_128x4_0sub1 = {
+        1, 10,
+        (long *)_huff_lengthlist_line_128x4_0sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x4_0sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 4, 3, 4, 3,
+         4, 4, 5, 4, 5, 4, 6, 5, 6,
+};
+
+static const static_codebook _huff_book_line_128x4_0sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_128x4_0sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x4_0sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 5, 3, 5, 3,
+         5, 4, 6, 5, 6, 5, 7, 6, 6, 7, 7, 9, 9,11,11,16,
+        11,14,10,11,11,13,16,15,15,15,15,15,15,15,15,15,
+};
+
+static const static_codebook _huff_book_line_128x4_0sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x4_0sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4_class0[] = {
+         6, 7, 7,12, 6, 6, 7,12, 7, 6, 6,10,15,12,11,13,
+         7, 7, 8,13, 7, 7, 8,12, 7, 7, 7,11,12,12,11,13,
+        10, 9, 9,11, 9, 9, 9,10,10, 8, 8,12,14,12,12,14,
+        11,11,12,14,11,12,11,15,15,12,13,15,15,15,15,15,
+         6, 6, 7,10, 6, 6, 6,11, 7, 6, 6, 9,14,12,11,13,
+         7, 7, 7,10, 6, 6, 7, 9, 7, 7, 6,10,13,12,10,12,
+         9, 9, 9,11, 9, 9, 8, 9, 9, 8, 8,10,13,12,10,12,
+        12,12,11,13,12,12,11,12,15,13,12,15,15,15,14,14,
+         6, 6, 6, 8, 6, 6, 5, 6, 7, 7, 6, 5,11,10, 9, 8,
+         7, 6, 6, 7, 6, 6, 5, 6, 7, 7, 6, 6,11,10, 9, 8,
+         8, 8, 8, 9, 8, 8, 7, 8, 8, 8, 6, 7,11,10, 9, 9,
+        14,11,10,14,14,11,10,15,13,11, 9,11,15,12,12,11,
+        11, 9, 8, 8,10, 9, 8, 9,11,10, 9, 8,12,11,12,11,
+        13,10, 8, 9,11,10, 8, 9,10, 9, 8, 9,10, 8,12,12,
+        15,11,10,10,13,11,10,10, 8, 8, 7,12,10, 9,11,12,
+        15,12,11,15,13,11,11,15,12,14,11,13,15,15,13,13,
+};
+
+static const static_codebook _huff_book_line_256x4_class0 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_256x4_class0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4_0sub0[] = {
+         2, 2, 2, 2,
+};
+
+static const static_codebook _huff_book_line_256x4_0sub0 = {
+        1, 4,
+        (long *)_huff_lengthlist_line_256x4_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4_0sub1[] = {
+         0, 0, 0, 0, 2, 2, 3, 3, 3, 3,
+};
+
+static const static_codebook _huff_book_line_256x4_0sub1 = {
+        1, 10,
+        (long *)_huff_lengthlist_line_256x4_0sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4_0sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 3, 4, 3,
+         5, 3, 5, 4, 5, 4, 6, 4, 6,
+};
+
+static const static_codebook _huff_book_line_256x4_0sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_256x4_0sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4_0sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 5, 3, 5, 3,
+         6, 4, 7, 4, 7, 5, 7, 6, 7, 6, 7, 8,10,13,13,13,
+        13,13,13,13,13,13,13,13,13,13,13,12,12,12,12,12,
+};
+
+static const static_codebook _huff_book_line_256x4_0sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_256x4_0sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_class0[] = {
+        10, 7, 8,13, 9, 6, 7,11,10, 8, 8,12,17,17,17,17,
+         7, 5, 5, 9, 6, 4, 4, 8, 8, 5, 5, 8,16,14,13,16,
+         7, 5, 5, 7, 6, 3, 3, 5, 8, 5, 4, 7,14,12,12,15,
+        10, 7, 8, 9, 7, 5, 5, 6, 9, 6, 5, 5,15,12, 9,10,
+};
+
+static const static_codebook _huff_book_line_128x7_class0 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x7_class0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_class1[] = {
+         8,13,17,17, 8,11,17,17,11,13,17,17,17,17,17,17,
+         6,10,16,17, 6,10,15,17, 8,10,16,17,17,17,17,17,
+         9,13,15,17, 8,11,17,17,10,12,17,17,17,17,17,17,
+        17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
+         6,11,15,17, 7,10,15,17, 8,10,17,17,17,15,17,17,
+         4, 8,13,17, 4, 7,13,17, 6, 8,15,17,16,15,17,17,
+         6,11,15,17, 6, 9,13,17, 8,10,17,17,15,17,17,17,
+        16,17,17,17,12,14,15,17,13,14,15,17,17,17,17,17,
+         5,10,14,17, 5, 9,14,17, 7, 9,15,17,15,15,17,17,
+         3, 7,12,17, 3, 6,11,17, 5, 7,13,17,12,12,17,17,
+         5, 9,14,17, 3, 7,11,17, 5, 8,13,17,13,11,16,17,
+        12,17,17,17, 9,14,15,17,10,11,14,17,16,14,17,17,
+         8,12,17,17, 8,12,17,17,10,12,17,17,17,17,17,17,
+         5,10,17,17, 5, 9,15,17, 7, 9,17,17,13,13,17,17,
+         7,11,17,17, 6,10,15,17, 7, 9,15,17,12,11,17,17,
+        12,15,17,17,11,14,17,17,11,10,15,17,17,16,17,17,
+};
+
+static const static_codebook _huff_book_line_128x7_class1 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_128x7_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_0sub1[] = {
+         0, 3, 3, 3, 3, 3, 3, 3, 3,
+};
+
+static const static_codebook _huff_book_line_128x7_0sub1 = {
+        1, 9,
+        (long *)_huff_lengthlist_line_128x7_0sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_0sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 4,
+         5, 4, 5, 4, 5, 4, 6, 4, 6,
+};
+
+static const static_codebook _huff_book_line_128x7_0sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_128x7_0sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_0sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 3, 5, 3, 5, 4,
+         5, 4, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
+         7, 8, 9,11,13,13,13,13,13,13,13,13,13,13,13,13,
+};
+
+static const static_codebook _huff_book_line_128x7_0sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x7_0sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_1sub1[] = {
+         0, 3, 3, 2, 3, 3, 4, 3, 4,
+};
+
+static const static_codebook _huff_book_line_128x7_1sub1 = {
+        1, 9,
+        (long *)_huff_lengthlist_line_128x7_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_1sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 6, 3, 6, 3,
+         6, 3, 7, 3, 8, 4, 9, 4, 9,
+};
+
+static const static_codebook _huff_book_line_128x7_1sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_128x7_1sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x7_1sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 2, 7, 3, 8, 4,
+         9, 5, 9, 8,10,11,11,12,14,14,14,14,14,14,14,14,
+        14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13,
+};
+
+static const static_codebook _huff_book_line_128x7_1sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x7_1sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_class1[] = {
+         1, 6, 3, 7, 2, 4, 5, 7,
+};
+
+static const static_codebook _huff_book_line_128x11_class1 = {
+        1, 8,
+        (long *)_huff_lengthlist_line_128x11_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_class2[] = {
+         1, 6,12,16, 4,12,15,16, 9,15,16,16,16,16,16,16,
+         2, 5,11,16, 5,11,13,16, 9,13,16,16,16,16,16,16,
+         4, 8,12,16, 5, 9,12,16, 9,13,15,16,16,16,16,16,
+        15,16,16,16,11,14,13,16,12,15,16,16,16,16,16,15,
+};
+
+static const static_codebook _huff_book_line_128x11_class2 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x11_class2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_class3[] = {
+         7, 6, 9,17, 7, 6, 8,17,12, 9,11,16,16,16,16,16,
+         5, 4, 7,16, 5, 3, 6,14, 9, 6, 8,15,16,16,16,16,
+         5, 4, 6,13, 3, 2, 4,11, 7, 4, 6,13,16,11,10,14,
+        12,12,12,16, 9, 7,10,15,12, 9,11,16,16,15,15,16,
+};
+
+static const static_codebook _huff_book_line_128x11_class3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x11_class3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_0sub0[] = {
+         5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
+         6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 6, 7, 6,
+         7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6, 8, 7,
+         8, 7, 8, 7, 8, 7, 9, 7, 9, 8, 9, 8, 9, 8,10, 8,
+        10, 9,10, 9,10, 9,11, 9,11, 9,10,10,11,10,11,10,
+        11,11,11,11,11,11,12,13,14,14,14,15,15,16,16,16,
+        17,15,16,15,16,16,17,17,16,17,17,17,17,17,17,17,
+        17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
+};
+
+static const static_codebook _huff_book_line_128x11_0sub0 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x11_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_1sub0[] = {
+         2, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5,
+         6, 5, 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6,
+};
+
+static const static_codebook _huff_book_line_128x11_1sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_128x11_1sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_1sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         5, 3, 5, 3, 6, 4, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4,
+         8, 4, 9, 5, 9, 5, 9, 5, 9, 6,10, 6,10, 6,11, 7,
+        10, 7,10, 8,11, 9,11, 9,11,10,11,11,12,11,11,12,
+        15,15,12,14,11,14,12,14,11,14,13,14,12,14,11,14,
+        11,14,12,14,11,14,11,14,13,13,14,14,14,14,14,14,
+        14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
+};
+
+static const static_codebook _huff_book_line_128x11_1sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x11_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_2sub1[] = {
+         0, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4,
+         5, 5,
+};
+
+static const static_codebook _huff_book_line_128x11_2sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_128x11_2sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_2sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 3, 3, 4, 4, 4, 4, 5, 4, 5, 4, 6, 5, 7,
+         5, 7, 6, 8, 6, 8, 6, 9, 7, 9, 7,10, 7, 9, 8,11,
+         8,11,
+};
+
+static const static_codebook _huff_book_line_128x11_2sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_128x11_2sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_2sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 4, 8, 3, 8, 4, 8, 4, 8, 6, 8, 5, 8, 4, 8,
+         4, 8, 6, 8, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+};
+
+static const static_codebook _huff_book_line_128x11_2sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x11_2sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_3sub1[] = {
+         0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4,
+         5, 4,
+};
+
+static const static_codebook _huff_book_line_128x11_3sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_128x11_3sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_3sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 5, 3, 5, 4, 6, 4, 6, 4, 7, 4, 7, 4, 8, 4,
+         8, 4, 9, 4, 9, 4,10, 4,10, 5,10, 5,11, 5,12, 6,
+        12, 6,
+};
+
+static const static_codebook _huff_book_line_128x11_3sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_128x11_3sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x11_3sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 7, 1, 6, 3, 7, 3, 8, 4, 8, 5, 8, 8, 8, 9,
+         7, 8, 8, 7, 7, 7, 8, 9,10, 9, 9,10,10,10,10,10,
+        10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+        10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
+        10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9,
+};
+
+static const static_codebook _huff_book_line_128x11_3sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x11_3sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_class1[] = {
+         1, 3, 4, 7, 2, 5, 6, 7,
+};
+
+static const static_codebook _huff_book_line_128x17_class1 = {
+        1, 8,
+        (long *)_huff_lengthlist_line_128x17_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_class2[] = {
+         1, 4,10,19, 3, 8,13,19, 7,12,19,19,19,19,19,19,
+         2, 6,11,19, 8,13,19,19, 9,11,19,19,19,19,19,19,
+         6, 7,13,19, 9,13,19,19,10,13,18,18,18,18,18,18,
+        18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
+};
+
+static const static_codebook _huff_book_line_128x17_class2 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x17_class2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_class3[] = {
+         3, 6,10,17, 4, 8,11,20, 8,10,11,20,20,20,20,20,
+         2, 4, 8,18, 4, 6, 8,17, 7, 8,10,20,20,17,20,20,
+         3, 5, 8,17, 3, 4, 6,17, 8, 8,10,17,17,12,16,20,
+        13,13,15,20,10,10,12,20,15,14,15,20,20,20,19,19,
+};
+
+static const static_codebook _huff_book_line_128x17_class3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_128x17_class3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_0sub0[] = {
+         5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
+         7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 5,
+         8, 5, 8, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 9, 6,
+         9, 6, 9, 7, 9, 7, 9, 7, 9, 7,10, 7,10, 8,10, 8,
+        10, 8,10, 8,10, 8,11, 8,11, 8,11, 8,11, 8,11, 9,
+        12, 9,12, 9,12, 9,12, 9,12,10,12,10,13,11,13,11,
+        14,12,14,13,15,14,16,14,17,15,18,16,20,20,20,20,
+        20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
+};
+
+static const static_codebook _huff_book_line_128x17_0sub0 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x17_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_1sub0[] = {
+         2, 5, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5,
+         6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 9, 7, 9, 7,
+};
+
+static const static_codebook _huff_book_line_128x17_1sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_128x17_1sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_1sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         4, 3, 5, 3, 5, 3, 6, 3, 6, 4, 6, 4, 7, 4, 7, 5,
+         8, 5, 8, 6, 9, 7, 9, 7, 9, 8,10, 9,10, 9,11,10,
+        11,11,11,11,11,11,12,12,12,13,12,13,12,14,12,15,
+        12,14,12,16,13,17,13,17,14,17,14,16,13,17,14,17,
+        14,17,15,17,15,15,16,17,17,17,17,17,17,17,17,17,
+        17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16,
+};
+
+static const static_codebook _huff_book_line_128x17_1sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x17_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_2sub1[] = {
+         0, 4, 5, 4, 6, 4, 8, 3, 9, 3, 9, 2, 9, 3, 8, 4,
+         9, 4,
+};
+
+static const static_codebook _huff_book_line_128x17_2sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_128x17_2sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_2sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 5, 1, 5, 3, 5, 3, 5, 4, 7, 5,10, 7,10, 7,
+        12,10,14,10,14, 9,14,11,14,14,14,13,13,13,13,13,
+        13,13,
+};
+
+static const static_codebook _huff_book_line_128x17_2sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_128x17_2sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_2sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6,
+         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+         6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+};
+
+static const static_codebook _huff_book_line_128x17_2sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x17_2sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_3sub1[] = {
+         0, 4, 4, 4, 4, 4, 4, 4, 5, 3, 5, 3, 5, 4, 6, 4,
+         6, 4,
+};
+
+static const static_codebook _huff_book_line_128x17_3sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_128x17_3sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_3sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 5, 3, 6, 3, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4,
+         8, 4, 8, 4, 8, 4, 9, 4, 9, 5,10, 5,10, 7,10, 8,
+        10, 8,
+};
+
+static const static_codebook _huff_book_line_128x17_3sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_128x17_3sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_128x17_3sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 2, 4, 3, 4, 4, 4, 5, 4, 7, 5, 8, 5,11,
+         6,10, 6,12, 7,12, 7,12, 8,12, 8,12,10,12,12,12,
+        12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+        11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+        11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+};
+
+static const static_codebook _huff_book_line_128x17_3sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_128x17_3sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_class1[] = {
+         2,10, 8,14, 7,12,11,14, 1, 5, 3, 7, 4, 9, 7,13,
+};
+
+static const static_codebook _huff_book_line_1024x27_class1 = {
+        1, 16,
+        (long *)_huff_lengthlist_line_1024x27_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_class2[] = {
+         1, 4, 2, 6, 3, 7, 5, 7,
+};
+
+static const static_codebook _huff_book_line_1024x27_class2 = {
+        1, 8,
+        (long *)_huff_lengthlist_line_1024x27_class2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_class3[] = {
+         1, 5, 7,21, 5, 8, 9,21,10, 9,12,20,20,16,20,20,
+         4, 8, 9,20, 6, 8, 9,20,11,11,13,20,20,15,17,20,
+         9,11,14,20, 8,10,15,20,11,13,15,20,20,20,20,20,
+        20,20,20,20,13,20,20,20,18,18,20,20,20,20,20,20,
+         3, 6, 8,20, 6, 7, 9,20,10, 9,12,20,20,20,20,20,
+         5, 7, 9,20, 6, 6, 9,20,10, 9,12,20,20,20,20,20,
+         8,10,13,20, 8, 9,12,20,11,10,12,20,20,20,20,20,
+        18,20,20,20,15,17,18,20,18,17,18,20,20,20,20,20,
+         7,10,12,20, 8, 9,11,20,14,13,14,20,20,20,20,20,
+         6, 9,12,20, 7, 8,11,20,12,11,13,20,20,20,20,20,
+         9,11,15,20, 8,10,14,20,12,11,14,20,20,20,20,20,
+        20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
+        11,16,18,20,15,15,17,20,20,17,20,20,20,20,20,20,
+         9,14,16,20,12,12,15,20,17,15,18,20,20,20,20,20,
+        16,19,18,20,15,16,20,20,17,17,20,20,20,20,20,20,
+        20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
+};
+
+static const static_codebook _huff_book_line_1024x27_class3 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_1024x27_class3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_class4[] = {
+         2, 3, 7,13, 4, 4, 7,15, 8, 6, 9,17,21,16,15,21,
+         2, 5, 7,11, 5, 5, 7,14, 9, 7,10,16,17,15,16,21,
+         4, 7,10,17, 7, 7, 9,15,11, 9,11,16,21,18,15,21,
+        18,21,21,21,15,17,17,19,21,19,18,20,21,21,21,20,
+};
+
+static const static_codebook _huff_book_line_1024x27_class4 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_1024x27_class4,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_0sub0[] = {
+         5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
+         6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5,
+         8, 6, 8, 6, 8, 6, 9, 6, 9, 6,10, 6,10, 6,11, 6,
+        11, 7,11, 7,12, 7,12, 7,12, 7,12, 7,12, 7,12, 7,
+        12, 7,12, 8,13, 8,12, 8,12, 8,13, 8,13, 9,13, 9,
+        13, 9,13, 9,12,10,12,10,13,10,14,11,14,12,14,13,
+        14,13,14,14,15,16,15,15,15,14,15,17,21,22,22,21,
+        22,22,22,22,22,22,21,21,21,21,21,21,21,21,21,21,
+};
+
+static const static_codebook _huff_book_line_1024x27_0sub0 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_1024x27_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_1sub0[] = {
+         2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5,
+         6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6,
+};
+
+static const static_codebook _huff_book_line_1024x27_1sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_1024x27_1sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_1sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4,
+         9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5,
+         9, 5, 9, 6,10, 6,10, 7,10, 8,11, 9,11,11,12,13,
+        12,14,13,15,13,15,14,16,14,17,15,17,15,15,16,16,
+        15,16,16,16,15,18,16,15,17,17,19,19,19,19,19,19,
+        19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
+};
+
+static const static_codebook _huff_book_line_1024x27_1sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_1024x27_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_2sub0[] = {
+         1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5,
+         6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8,10, 9,10, 9,
+};
+
+static const static_codebook _huff_book_line_1024x27_2sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_1024x27_2sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_2sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5,
+         7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9,
+         9, 9,10,10,10,11, 9,12, 9,12, 9,15,10,14, 9,13,
+        10,13,10,12,10,12,10,13,10,12,11,13,11,14,12,13,
+        13,14,14,13,14,15,14,16,13,13,14,16,16,16,16,16,
+        16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,15,
+};
+
+static const static_codebook _huff_book_line_1024x27_2sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_1024x27_2sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_3sub1[] = {
+         0, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5,
+         5, 5,
+};
+
+static const static_codebook _huff_book_line_1024x27_3sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_1024x27_3sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_3sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6,
+         5, 7, 5, 8, 6, 8, 6, 9, 7,10, 7,10, 8,10, 8,11,
+         9,11,
+};
+
+static const static_codebook _huff_book_line_1024x27_3sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_1024x27_3sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_3sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 7, 3, 8, 3,10, 3, 8, 3, 9, 3, 8, 4, 9,
+         4, 9, 5, 9, 6,10, 6, 9, 7,11, 7,12, 9,13,10,13,
+        12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+        12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+        12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+};
+
+static const static_codebook _huff_book_line_1024x27_3sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_1024x27_3sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_4sub1[] = {
+         0, 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4,
+         5, 4,
+};
+
+static const static_codebook _huff_book_line_1024x27_4sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_1024x27_4sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_4sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8,
+         7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8,10, 8,11, 9,12,
+         9,12,
+};
+
+static const static_codebook _huff_book_line_1024x27_4sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_1024x27_4sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_1024x27_4sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5,11,
+         6,11, 6,11, 7,11, 6,11, 6,11, 9,11, 8,11,11,11,
+        11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+        11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
+        11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,
+};
+
+static const static_codebook _huff_book_line_1024x27_4sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_1024x27_4sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_class1[] = {
+         2, 6, 8, 9, 7,11,13,13, 1, 3, 5, 5, 6, 6,12,10,
+};
+
+static const static_codebook _huff_book_line_2048x27_class1 = {
+        1, 16,
+        (long *)_huff_lengthlist_line_2048x27_class1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_class2[] = {
+         1, 2, 3, 6, 4, 7, 5, 7,
+};
+
+static const static_codebook _huff_book_line_2048x27_class2 = {
+        1, 8,
+        (long *)_huff_lengthlist_line_2048x27_class2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_class3[] = {
+         3, 3, 6,16, 5, 5, 7,16, 9, 8,11,16,16,16,16,16,
+         5, 5, 8,16, 5, 5, 7,16, 8, 7, 9,16,16,16,16,16,
+         9, 9,12,16, 6, 8,11,16, 9,10,11,16,16,16,16,16,
+        16,16,16,16,13,16,16,16,15,16,16,16,16,16,16,16,
+         5, 4, 7,16, 6, 5, 8,16, 9, 8,10,16,16,16,16,16,
+         5, 5, 7,15, 5, 4, 6,15, 7, 6, 8,16,16,16,16,16,
+         9, 9,11,15, 7, 7, 9,16, 8, 8, 9,16,16,16,16,16,
+        16,16,16,16,15,15,15,16,15,15,14,16,16,16,16,16,
+         8, 8,11,16, 8, 9,10,16,11,10,14,16,16,16,16,16,
+         6, 8,10,16, 6, 7,10,16, 8, 8,11,16,14,16,16,16,
+        10,11,14,16, 9, 9,11,16,10,10,11,16,16,16,16,16,
+        16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+        16,16,16,16,15,16,16,16,16,16,16,16,16,16,16,16,
+        12,16,15,16,12,14,16,16,16,16,16,16,16,16,16,16,
+        16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+        16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
+};
+
+static const static_codebook _huff_book_line_2048x27_class3 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_2048x27_class3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_class4[] = {
+         2, 4, 7,13, 4, 5, 7,15, 8, 7,10,16,16,14,16,16,
+         2, 4, 7,16, 3, 4, 7,14, 8, 8,10,16,16,16,15,16,
+         6, 8,11,16, 7, 7, 9,16,11, 9,13,16,16,16,15,16,
+        16,16,16,16,14,16,16,16,16,16,16,16,16,16,16,16,
+};
+
+static const static_codebook _huff_book_line_2048x27_class4 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_2048x27_class4,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_0sub0[] = {
+         5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
+         6, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 5, 8, 5, 9, 5,
+         9, 6,10, 6,10, 6,11, 6,11, 6,11, 6,11, 6,11, 6,
+        11, 6,11, 6,12, 7,11, 7,11, 7,11, 7,11, 7,10, 7,
+        11, 7,11, 7,12, 7,11, 8,11, 8,11, 8,11, 8,13, 8,
+        12, 9,11, 9,11, 9,11,10,12,10,12, 9,12,10,12,11,
+        14,12,16,12,12,11,14,16,17,17,17,17,17,17,17,17,
+        17,17,17,17,17,17,17,17,17,17,17,17,16,16,16,16,
+};
+
+static const static_codebook _huff_book_line_2048x27_0sub0 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_2048x27_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_1sub0[] = {
+         4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
+         5, 5, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6,
+};
+
+static const static_codebook _huff_book_line_2048x27_1sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_2048x27_1sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_1sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         6, 5, 7, 5, 7, 4, 7, 4, 8, 4, 8, 4, 8, 4, 8, 3,
+         8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 9, 5, 9, 6,
+         9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,14, 9,15,10,15,
+        10,15,10,15,10,15,11,15,10,14,12,14,11,14,13,14,
+        13,15,15,15,12,15,15,15,13,15,13,15,13,15,15,15,
+        15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,
+};
+
+static const static_codebook _huff_book_line_2048x27_1sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_2048x27_1sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_2sub0[] = {
+         2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5,
+         6, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
+};
+
+static const static_codebook _huff_book_line_2048x27_2sub0 = {
+        1, 32,
+        (long *)_huff_lengthlist_line_2048x27_2sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_2sub1[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 5, 5, 6, 6, 6, 7,
+         6, 8, 6, 8, 6, 9, 7,10, 7,10, 7,10, 7,12, 7,12,
+         7,12, 9,12,11,12,10,12,10,12,11,12,12,12,10,12,
+        10,12,10,12, 9,12,11,12,12,12,12,12,11,12,11,12,
+        12,12,12,12,12,12,12,12,10,10,12,12,12,12,12,10,
+        12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
+};
+
+static const static_codebook _huff_book_line_2048x27_2sub1 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_2048x27_2sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_3sub1[] = {
+         0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+         5, 5,
+};
+
+static const static_codebook _huff_book_line_2048x27_3sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_2048x27_3sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_3sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6,
+         6, 7, 6, 7, 6, 8, 6, 9, 7, 9, 7, 9, 9,11, 9,12,
+        10,12,
+};
+
+static const static_codebook _huff_book_line_2048x27_3sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_2048x27_3sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_3sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 6, 3, 7, 3, 7, 5, 7, 7, 7, 7, 7, 6, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+};
+
+static const static_codebook _huff_book_line_2048x27_3sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_2048x27_3sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_4sub1[] = {
+         0, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4,
+         4, 5,
+};
+
+static const static_codebook _huff_book_line_2048x27_4sub1 = {
+        1, 18,
+        (long *)_huff_lengthlist_line_2048x27_4sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_4sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 2, 4, 3, 4, 4, 4, 5, 5, 6, 5, 6, 5, 7,
+         6, 6, 6, 7, 7, 7, 8, 9, 9, 9,12,10,11,10,10,12,
+        10,10,
+};
+
+static const static_codebook _huff_book_line_2048x27_4sub2 = {
+        1, 50,
+        (long *)_huff_lengthlist_line_2048x27_4sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_2048x27_4sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 3, 6, 5, 7, 5, 7, 7, 7, 7, 7, 5, 7, 5, 7,
+         5, 7, 5, 7, 7, 7, 7, 7, 4, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
+         7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
+};
+
+static const static_codebook _huff_book_line_2048x27_4sub3 = {
+        1, 128,
+        (long *)_huff_lengthlist_line_2048x27_4sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4low_class0[] = {
+         4, 5, 6,11, 5, 5, 6,10, 7, 7, 6, 6,14,13, 9, 9,
+         6, 6, 6,10, 6, 6, 6, 9, 8, 7, 7, 9,14,12, 8,11,
+         8, 7, 7,11, 8, 8, 7,11, 9, 9, 7, 9,13,11, 9,13,
+        19,19,18,19,15,16,16,19,11,11,10,13,10,10, 9,15,
+         5, 5, 6,13, 6, 6, 6,11, 8, 7, 6, 7,14,11,10,11,
+         6, 6, 6,12, 7, 6, 6,11, 8, 7, 7,11,13,11, 9,11,
+         9, 7, 6,12, 8, 7, 6,12, 9, 8, 8,11,13,10, 7,13,
+        19,19,17,19,17,14,14,19,12,10, 8,12,13,10, 9,16,
+         7, 8, 7,12, 7, 7, 7,11, 8, 7, 7, 8,12,12,11,11,
+         8, 8, 7,12, 8, 7, 6,11, 8, 7, 7,10,10,11,10,11,
+         9, 8, 8,13, 9, 8, 7,12,10, 9, 7,11, 9, 8, 7,11,
+        18,18,15,18,18,16,17,18,15,11,10,18,11, 9, 9,18,
+        16,16,13,16,12,11,10,16,12,11, 9, 6,15,12,11,13,
+        16,16,14,14,13,11,12,16,12, 9, 9,13,13,10,10,12,
+        17,18,17,17,14,15,14,16,14,12,14,15,12,10,11,12,
+        18,18,18,18,18,18,18,18,18,12,13,18,16,11, 9,18,
+};
+
+static const static_codebook _huff_book_line_256x4low_class0 = {
+        1, 256,
+        (long *)_huff_lengthlist_line_256x4low_class0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4low_0sub0[] = {
+         1, 3, 2, 3,
+};
+
+static const static_codebook _huff_book_line_256x4low_0sub0 = {
+        1, 4,
+        (long *)_huff_lengthlist_line_256x4low_0sub0,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4low_0sub1[] = {
+         0, 0, 0, 0, 2, 3, 2, 3, 3, 3,
+};
+
+static const static_codebook _huff_book_line_256x4low_0sub1 = {
+        1, 10,
+        (long *)_huff_lengthlist_line_256x4low_0sub1,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4low_0sub2[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 3, 4,
+         4, 4, 4, 4, 5, 5, 5, 6, 6,
+};
+
+static const static_codebook _huff_book_line_256x4low_0sub2 = {
+        1, 25,
+        (long *)_huff_lengthlist_line_256x4low_0sub2,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
+};
+
+static const long _huff_lengthlist_line_256x4low_0sub3[] = {
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+         0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 2, 4, 3, 5, 4,
+         5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 6, 9,
+         7,12,11,16,13,16,12,15,13,15,12,14,12,15,15,15,
+};
 
-static static_codebook _huff_book_line_256x7_0sub1 = {
-	1, 9,
-	_huff_lengthlist_line_256x7_0sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_0sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 4, 3, 5, 3,
-	 6, 3, 6, 4, 6, 4, 7, 5, 7,
-};
-
-static static_codebook _huff_book_line_256x7_0sub2 = {
-	1, 25,
-	_huff_lengthlist_line_256x7_0sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_0sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 2, 5, 3, 5, 3,
-	 6, 3, 6, 4, 7, 6, 7, 8, 7, 9, 8, 9, 9, 9,10, 9,
-	11,13,11,13,10,10,13,13,13,13,13,13,12,12,12,12,
-};
-
-static static_codebook _huff_book_line_256x7_0sub3 = {
-	1, 64,
-	_huff_lengthlist_line_256x7_0sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_1sub1[] = {
-	 0, 3, 3, 3, 3, 2, 4, 3, 4,
-};
-
-static static_codebook _huff_book_line_256x7_1sub1 = {
-	1, 9,
-	_huff_lengthlist_line_256x7_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_1sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3, 4, 3, 4, 4,
-	 5, 4, 6, 5, 6, 7, 6, 8, 8,
-};
-
-static static_codebook _huff_book_line_256x7_1sub2 = {
-	1, 25,
-	_huff_lengthlist_line_256x7_1sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_1sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 2, 4, 3, 6, 3, 7,
-	 3, 8, 5, 8, 6, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
-	 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7,
-};
-
-static static_codebook _huff_book_line_256x7_1sub3 = {
-	1, 64,
-	_huff_lengthlist_line_256x7_1sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_class0[] = {
-	 7, 5, 5, 9, 9, 6, 6, 9,12, 8, 7, 8,11, 8, 9,15,
-	 6, 3, 3, 7, 7, 4, 3, 6, 9, 6, 5, 6, 8, 6, 8,15,
-	 8, 5, 5, 9, 8, 5, 4, 6,10, 7, 5, 5,11, 8, 7,15,
-	14,15,13,13,13,13, 8,11,15,10, 7, 6,11, 9,10,15,
-};
-
-static static_codebook _huff_book_line_256x7_class0 = {
-	1, 64,
-	_huff_lengthlist_line_256x7_class0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x7_class1[] = {
-	 5, 6, 8,15, 6, 9,10,15,10,11,12,15,15,15,15,15,
-	 4, 6, 7,15, 6, 7, 8,15, 9, 8, 9,15,15,15,15,15,
-	 6, 8, 9,15, 7, 7, 8,15,10, 9,10,15,15,15,15,15,
-	15,13,15,15,15,10,11,15,15,13,13,15,15,15,15,15,
-	 4, 6, 7,15, 6, 8, 9,15,10,10,12,15,15,15,15,15,
-	 2, 5, 6,15, 5, 6, 7,15, 8, 6, 7,15,15,15,15,15,
-	 5, 6, 8,15, 5, 6, 7,15, 9, 6, 7,15,15,15,15,15,
-	14,12,13,15,12,10,11,15,15,15,15,15,15,15,15,15,
-	 7, 8, 9,15, 9,10,10,15,15,14,14,15,15,15,15,15,
-	 5, 6, 7,15, 7, 8, 9,15,12, 9,10,15,15,15,15,15,
-	 7, 7, 9,15, 7, 7, 8,15,12, 8, 9,15,15,15,15,15,
-	13,13,14,15,12,11,12,15,15,15,15,15,15,15,15,15,
-	15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
-	13,13,13,15,15,15,15,15,15,15,15,15,15,15,15,15,
-	15,12,13,15,15,12,13,15,15,14,15,15,15,15,15,15,
-	15,15,15,15,15,15,13,15,15,15,15,15,15,15,15,15,
-};
-
-static static_codebook _huff_book_line_256x7_class1 = {
-	1, 256,
-	_huff_lengthlist_line_256x7_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_0sub0[] = {
-	 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-	 5, 6, 5, 6, 6, 6, 6, 5, 6, 6, 7, 6, 7, 6, 7, 6,
-	 7, 6, 8, 7, 8, 7, 8, 7, 8, 7, 8, 7, 9, 7, 9, 7,
-	 9, 7, 9, 8, 9, 8,10, 8,10, 8,10, 7,10, 6,10, 8,
-	10, 8,11, 7,10, 7,11, 8,11,11,12,12,11,11,12,11,
-	13,11,13,11,13,12,15,12,13,13,14,14,14,14,14,15,
-	15,15,16,14,17,19,19,18,18,18,18,18,18,18,18,18,
-	18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
-};
-
-static static_codebook _huff_book_line_512x17_0sub0 = {
-	1, 128,
-	_huff_lengthlist_line_512x17_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_1sub0[] = {
-	 2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5,
-	 6, 5, 6, 6, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 8, 7,
-};
-
-static static_codebook _huff_book_line_512x17_1sub0 = {
-	1, 32,
-	_huff_lengthlist_line_512x17_1sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_1sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 4, 3, 5, 3, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 6, 5,
-	 6, 5, 7, 5, 8, 6, 8, 6, 8, 6, 8, 6, 8, 7, 9, 7,
-	 9, 7,11, 9,11,11,12,11,14,12,14,16,14,16,13,16,
-	14,16,12,15,13,16,14,16,13,14,12,15,13,15,13,13,
-	13,15,12,14,14,15,13,15,12,15,15,15,15,15,15,15,
-	15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
-};
-
-static static_codebook _huff_book_line_512x17_1sub1 = {
-	1, 128,
-	_huff_lengthlist_line_512x17_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_2sub1[] = {
-	 0, 4, 5, 4, 4, 4, 5, 4, 4, 4, 5, 4, 5, 4, 5, 3,
-	 5, 3,
-};
-
-static static_codebook _huff_book_line_512x17_2sub1 = {
-	1, 18,
-	_huff_lengthlist_line_512x17_2sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_2sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 6, 4, 6, 5,
-	 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 7, 8, 7, 9, 7,
-	 9, 8,
-};
-
-static static_codebook _huff_book_line_512x17_2sub2 = {
-	1, 50,
-	_huff_lengthlist_line_512x17_2sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_2sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 3, 3, 3, 4, 3, 4, 4, 5, 5, 6, 6, 7, 7,
-	 7, 8, 8,11, 8, 9, 9, 9,10,11,11,11, 9,10,10,11,
-	11,11,11,10,10,10,10,10,10,10,10,10,10,10,10,10,
-	10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
-	10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
-};
-
-static static_codebook _huff_book_line_512x17_2sub3 = {
-	1, 128,
-	_huff_lengthlist_line_512x17_2sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_3sub1[] = {
-	 0, 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 5, 4, 5,
-	 5, 5,
-};
-
-static static_codebook _huff_book_line_512x17_3sub1 = {
-	1, 18,
-	_huff_lengthlist_line_512x17_3sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_3sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 2, 3, 3, 4, 3, 5, 4, 6, 4, 6, 5, 7, 6, 7,
-	 6, 8, 6, 8, 7, 9, 8,10, 8,12, 9,13,10,15,10,15,
-	11,14,
-};
-
-static static_codebook _huff_book_line_512x17_3sub2 = {
-	1, 50,
-	_huff_lengthlist_line_512x17_3sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_3sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 4, 8, 4, 8, 4, 8, 4, 8, 5, 8, 5, 8, 6, 8,
-	 4, 8, 4, 8, 5, 8, 5, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-};
-
-static static_codebook _huff_book_line_512x17_3sub3 = {
-	1, 128,
-	_huff_lengthlist_line_512x17_3sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_class1[] = {
-	 1, 2, 3, 6, 5, 4, 7, 7,
-};
-
-static static_codebook _huff_book_line_512x17_class1 = {
-	1, 8,
-	_huff_lengthlist_line_512x17_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_class2[] = {
-	 3, 3, 3,14, 5, 4, 4,11, 8, 6, 6,10,17,12,11,17,
-	 6, 5, 5,15, 5, 3, 4,11, 8, 5, 5, 8,16, 9,10,14,
-	10, 8, 9,17, 8, 6, 6,13,10, 7, 7,10,16,11,13,14,
-	17,17,17,17,17,16,16,16,16,15,16,16,16,16,16,16,
-};
-
-static static_codebook _huff_book_line_512x17_class2 = {
-	1, 64,
-	_huff_lengthlist_line_512x17_class2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_512x17_class3[] = {
-	 2, 4, 6,17, 4, 5, 7,17, 8, 7,10,17,17,17,17,17,
-	 3, 4, 6,15, 3, 3, 6,15, 7, 6, 9,17,17,17,17,17,
-	 6, 8,10,17, 6, 6, 8,16, 9, 8,10,17,17,15,16,17,
-	17,17,17,17,12,15,15,16,12,15,15,16,16,16,16,16,
-};
-
-static static_codebook _huff_book_line_512x17_class3 = {
-	1, 64,
-	_huff_lengthlist_line_512x17_class3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x4_class0[] = {
-	 7, 7, 7,11, 6, 6, 7,11, 7, 6, 6,10,12,10,10,13,
-	 7, 7, 8,11, 7, 7, 7,11, 7, 6, 7,10,11,10,10,13,
-	10,10, 9,12, 9, 9, 9,11, 8, 8, 8,11,13,11,10,14,
-	15,15,14,15,15,14,13,14,15,12,12,17,17,17,17,17,
-	 7, 7, 6, 9, 6, 6, 6, 9, 7, 6, 6, 8,11,11,10,12,
-	 7, 7, 7, 9, 7, 6, 6, 9, 7, 6, 6, 9,13,10,10,11,
-	10, 9, 8,10, 9, 8, 8,10, 8, 8, 7, 9,13,12,10,11,
-	17,14,14,13,15,14,12,13,17,13,12,15,17,17,14,17,
-	 7, 6, 6, 7, 6, 6, 5, 7, 6, 6, 6, 6,11, 9, 9, 9,
-	 7, 7, 6, 7, 7, 6, 6, 7, 6, 6, 6, 6,10, 9, 8, 9,
-	10, 9, 8, 8, 9, 8, 7, 8, 8, 7, 6, 8,11,10, 9,10,
-	17,17,12,15,15,15,12,14,14,14,10,12,15,13,12,13,
-	11,10, 8,10,11,10, 8, 8,10, 9, 7, 7,10, 9, 9,11,
-	11,11, 9,10,11,10, 8, 9,10, 8, 6, 8,10, 9, 9,11,
-	14,13,10,12,12,11,10,10, 8, 7, 8,10,10,11,11,12,
-	17,17,15,17,17,17,17,17,17,13,12,17,17,17,14,17,
-};
-
-static static_codebook _huff_book_line_128x4_class0 = {
-	1, 256,
-	_huff_lengthlist_line_128x4_class0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x4_0sub0[] = {
-	 2, 2, 2, 2,
-};
-
-static static_codebook _huff_book_line_128x4_0sub0 = {
-	1, 4,
-	_huff_lengthlist_line_128x4_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x4_0sub1[] = {
-	 0, 0, 0, 0, 3, 2, 3, 2, 3, 3,
-};
-
-static static_codebook _huff_book_line_128x4_0sub1 = {
-	1, 10,
-	_huff_lengthlist_line_128x4_0sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x4_0sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 4, 3, 4, 3,
-	 4, 4, 5, 4, 5, 4, 6, 5, 6,
-};
-
-static static_codebook _huff_book_line_128x4_0sub2 = {
-	1, 25,
-	_huff_lengthlist_line_128x4_0sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x4_0sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 5, 3, 5, 3,
-	 5, 4, 6, 5, 6, 5, 7, 6, 6, 7, 7, 9, 9,11,11,16,
-	11,14,10,11,11,13,16,15,15,15,15,15,15,15,15,15,
-};
-
-static static_codebook _huff_book_line_128x4_0sub3 = {
-	1, 64,
-	_huff_lengthlist_line_128x4_0sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4_class0[] = {
-	 6, 7, 7,12, 6, 6, 7,12, 7, 6, 6,10,15,12,11,13,
-	 7, 7, 8,13, 7, 7, 8,12, 7, 7, 7,11,12,12,11,13,
-	10, 9, 9,11, 9, 9, 9,10,10, 8, 8,12,14,12,12,14,
-	11,11,12,14,11,12,11,15,15,12,13,15,15,15,15,15,
-	 6, 6, 7,10, 6, 6, 6,11, 7, 6, 6, 9,14,12,11,13,
-	 7, 7, 7,10, 6, 6, 7, 9, 7, 7, 6,10,13,12,10,12,
-	 9, 9, 9,11, 9, 9, 8, 9, 9, 8, 8,10,13,12,10,12,
-	12,12,11,13,12,12,11,12,15,13,12,15,15,15,14,14,
-	 6, 6, 6, 8, 6, 6, 5, 6, 7, 7, 6, 5,11,10, 9, 8,
-	 7, 6, 6, 7, 6, 6, 5, 6, 7, 7, 6, 6,11,10, 9, 8,
-	 8, 8, 8, 9, 8, 8, 7, 8, 8, 8, 6, 7,11,10, 9, 9,
-	14,11,10,14,14,11,10,15,13,11, 9,11,15,12,12,11,
-	11, 9, 8, 8,10, 9, 8, 9,11,10, 9, 8,12,11,12,11,
-	13,10, 8, 9,11,10, 8, 9,10, 9, 8, 9,10, 8,12,12,
-	15,11,10,10,13,11,10,10, 8, 8, 7,12,10, 9,11,12,
-	15,12,11,15,13,11,11,15,12,14,11,13,15,15,13,13,
-};
-
-static static_codebook _huff_book_line_256x4_class0 = {
-	1, 256,
-	_huff_lengthlist_line_256x4_class0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4_0sub0[] = {
-	 2, 2, 2, 2,
-};
-
-static static_codebook _huff_book_line_256x4_0sub0 = {
-	1, 4,
-	_huff_lengthlist_line_256x4_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4_0sub1[] = {
-	 0, 0, 0, 0, 2, 2, 3, 3, 3, 3,
-};
-
-static static_codebook _huff_book_line_256x4_0sub1 = {
-	1, 10,
-	_huff_lengthlist_line_256x4_0sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4_0sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 4, 3, 4, 3,
-	 5, 3, 5, 4, 5, 4, 6, 4, 6,
-};
-
-static static_codebook _huff_book_line_256x4_0sub2 = {
-	1, 25,
-	_huff_lengthlist_line_256x4_0sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4_0sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 4, 3, 5, 3, 5, 3,
-	 6, 4, 7, 4, 7, 5, 7, 6, 7, 6, 7, 8,10,13,13,13,
-	13,13,13,13,13,13,13,13,13,13,13,12,12,12,12,12,
-};
-
-static static_codebook _huff_book_line_256x4_0sub3 = {
-	1, 64,
-	_huff_lengthlist_line_256x4_0sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_class0[] = {
-	10, 7, 8,13, 9, 6, 7,11,10, 8, 8,12,17,17,17,17,
-	 7, 5, 5, 9, 6, 4, 4, 8, 8, 5, 5, 8,16,14,13,16,
-	 7, 5, 5, 7, 6, 3, 3, 5, 8, 5, 4, 7,14,12,12,15,
-	10, 7, 8, 9, 7, 5, 5, 6, 9, 6, 5, 5,15,12, 9,10,
-};
-
-static static_codebook _huff_book_line_128x7_class0 = {
-	1, 64,
-	_huff_lengthlist_line_128x7_class0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_class1[] = {
-	 8,13,17,17, 8,11,17,17,11,13,17,17,17,17,17,17,
-	 6,10,16,17, 6,10,15,17, 8,10,16,17,17,17,17,17,
-	 9,13,15,17, 8,11,17,17,10,12,17,17,17,17,17,17,
-	17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-	 6,11,15,17, 7,10,15,17, 8,10,17,17,17,15,17,17,
-	 4, 8,13,17, 4, 7,13,17, 6, 8,15,17,16,15,17,17,
-	 6,11,15,17, 6, 9,13,17, 8,10,17,17,15,17,17,17,
-	16,17,17,17,12,14,15,17,13,14,15,17,17,17,17,17,
-	 5,10,14,17, 5, 9,14,17, 7, 9,15,17,15,15,17,17,
-	 3, 7,12,17, 3, 6,11,17, 5, 7,13,17,12,12,17,17,
-	 5, 9,14,17, 3, 7,11,17, 5, 8,13,17,13,11,16,17,
-	12,17,17,17, 9,14,15,17,10,11,14,17,16,14,17,17,
-	 8,12,17,17, 8,12,17,17,10,12,17,17,17,17,17,17,
-	 5,10,17,17, 5, 9,15,17, 7, 9,17,17,13,13,17,17,
-	 7,11,17,17, 6,10,15,17, 7, 9,15,17,12,11,17,17,
-	12,15,17,17,11,14,17,17,11,10,15,17,17,16,17,17,
-};
-
-static static_codebook _huff_book_line_128x7_class1 = {
-	1, 256,
-	_huff_lengthlist_line_128x7_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_0sub1[] = {
-	 0, 3, 3, 3, 3, 3, 3, 3, 3,
-};
-
-static static_codebook _huff_book_line_128x7_0sub1 = {
-	1, 9,
-	_huff_lengthlist_line_128x7_0sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_0sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 4, 4, 4,
-	 5, 4, 5, 4, 5, 4, 6, 4, 6,
-};
-
-static static_codebook _huff_book_line_128x7_0sub2 = {
-	1, 25,
-	_huff_lengthlist_line_128x7_0sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_0sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 5, 3, 5, 3, 5, 4,
-	 5, 4, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
-	 7, 8, 9,11,13,13,13,13,13,13,13,13,13,13,13,13,
-};
-
-static static_codebook _huff_book_line_128x7_0sub3 = {
-	1, 64,
-	_huff_lengthlist_line_128x7_0sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_1sub1[] = {
-	 0, 3, 3, 2, 3, 3, 4, 3, 4,
-};
-
-static static_codebook _huff_book_line_128x7_1sub1 = {
-	1, 9,
-	_huff_lengthlist_line_128x7_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_1sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 3, 6, 3, 6, 3,
-	 6, 3, 7, 3, 8, 4, 9, 4, 9,
-};
-
-static static_codebook _huff_book_line_128x7_1sub2 = {
-	1, 25,
-	_huff_lengthlist_line_128x7_1sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x7_1sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 2, 7, 3, 8, 4,
-	 9, 5, 9, 8,10,11,11,12,14,14,14,14,14,14,14,14,
-	14,14,14,14,14,14,14,14,14,14,14,14,13,13,13,13,
-};
-
-static static_codebook _huff_book_line_128x7_1sub3 = {
-	1, 64,
-	_huff_lengthlist_line_128x7_1sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_class1[] = {
-	 1, 6, 3, 7, 2, 4, 5, 7,
-};
-
-static static_codebook _huff_book_line_128x11_class1 = {
-	1, 8,
-	_huff_lengthlist_line_128x11_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_class2[] = {
-	 1, 6,12,16, 4,12,15,16, 9,15,16,16,16,16,16,16,
-	 2, 5,11,16, 5,11,13,16, 9,13,16,16,16,16,16,16,
-	 4, 8,12,16, 5, 9,12,16, 9,13,15,16,16,16,16,16,
-	15,16,16,16,11,14,13,16,12,15,16,16,16,16,16,15,
-};
-
-static static_codebook _huff_book_line_128x11_class2 = {
-	1, 64,
-	_huff_lengthlist_line_128x11_class2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_class3[] = {
-	 7, 6, 9,17, 7, 6, 8,17,12, 9,11,16,16,16,16,16,
-	 5, 4, 7,16, 5, 3, 6,14, 9, 6, 8,15,16,16,16,16,
-	 5, 4, 6,13, 3, 2, 4,11, 7, 4, 6,13,16,11,10,14,
-	12,12,12,16, 9, 7,10,15,12, 9,11,16,16,15,15,16,
-};
-
-static static_codebook _huff_book_line_128x11_class3 = {
-	1, 64,
-	_huff_lengthlist_line_128x11_class3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_0sub0[] = {
-	 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
-	 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 6, 6, 6, 7, 6,
-	 7, 6, 7, 6, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6, 8, 7,
-	 8, 7, 8, 7, 8, 7, 9, 7, 9, 8, 9, 8, 9, 8,10, 8,
-	10, 9,10, 9,10, 9,11, 9,11, 9,10,10,11,10,11,10,
-	11,11,11,11,11,11,12,13,14,14,14,15,15,16,16,16,
-	17,15,16,15,16,16,17,17,16,17,17,17,17,17,17,17,
-	17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,
-};
-
-static static_codebook _huff_book_line_128x11_0sub0 = {
-	1, 128,
-	_huff_lengthlist_line_128x11_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_1sub0[] = {
-	 2, 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5, 5, 5,
-	 6, 5, 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 8, 6,
-};
-
-static static_codebook _huff_book_line_128x11_1sub0 = {
-	1, 32,
-	_huff_lengthlist_line_128x11_1sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_1sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 5, 3, 5, 3, 6, 4, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4,
-	 8, 4, 9, 5, 9, 5, 9, 5, 9, 6,10, 6,10, 6,11, 7,
-	10, 7,10, 8,11, 9,11, 9,11,10,11,11,12,11,11,12,
-	15,15,12,14,11,14,12,14,11,14,13,14,12,14,11,14,
-	11,14,12,14,11,14,11,14,13,13,14,14,14,14,14,14,
-	14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,
-};
-
-static static_codebook _huff_book_line_128x11_1sub1 = {
-	1, 128,
-	_huff_lengthlist_line_128x11_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_2sub1[] = {
-	 0, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4,
-	 5, 5,
-};
-
-static static_codebook _huff_book_line_128x11_2sub1 = {
-	1, 18,
-	_huff_lengthlist_line_128x11_2sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_2sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 3, 3, 4, 4, 4, 4, 5, 4, 5, 4, 6, 5, 7,
-	 5, 7, 6, 8, 6, 8, 6, 9, 7, 9, 7,10, 7, 9, 8,11,
-	 8,11,
-};
-
-static static_codebook _huff_book_line_128x11_2sub2 = {
-	1, 50,
-	_huff_lengthlist_line_128x11_2sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_2sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 4, 8, 3, 8, 4, 8, 4, 8, 6, 8, 5, 8, 4, 8,
-	 4, 8, 6, 8, 7, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-};
-
-static static_codebook _huff_book_line_128x11_2sub3 = {
-	1, 128,
-	_huff_lengthlist_line_128x11_2sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_3sub1[] = {
-	 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4,
-	 5, 4,
-};
-
-static static_codebook _huff_book_line_128x11_3sub1 = {
-	1, 18,
-	_huff_lengthlist_line_128x11_3sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_3sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 5, 3, 5, 4, 6, 4, 6, 4, 7, 4, 7, 4, 8, 4,
-	 8, 4, 9, 4, 9, 4,10, 4,10, 5,10, 5,11, 5,12, 6,
-	12, 6,
-};
-
-static static_codebook _huff_book_line_128x11_3sub2 = {
-	1, 50,
-	_huff_lengthlist_line_128x11_3sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x11_3sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 7, 1, 6, 3, 7, 3, 8, 4, 8, 5, 8, 8, 8, 9,
-	 7, 8, 8, 7, 7, 7, 8, 9,10, 9, 9,10,10,10,10,10,
-	10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
-	10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,
-	10,10,10,10,10,10,10,10,10,10,10,10,10,10, 9, 9,
-};
-
-static static_codebook _huff_book_line_128x11_3sub3 = {
-	1, 128,
-	_huff_lengthlist_line_128x11_3sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_class1[] = {
-	 1, 3, 4, 7, 2, 5, 6, 7,
-};
-
-static static_codebook _huff_book_line_128x17_class1 = {
-	1, 8,
-	_huff_lengthlist_line_128x17_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_class2[] = {
-	 1, 4,10,19, 3, 8,13,19, 7,12,19,19,19,19,19,19,
-	 2, 6,11,19, 8,13,19,19, 9,11,19,19,19,19,19,19,
-	 6, 7,13,19, 9,13,19,19,10,13,18,18,18,18,18,18,
-	18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,
-};
-
-static static_codebook _huff_book_line_128x17_class2 = {
-	1, 64,
-	_huff_lengthlist_line_128x17_class2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_class3[] = {
-	 3, 6,10,17, 4, 8,11,20, 8,10,11,20,20,20,20,20,
-	 2, 4, 8,18, 4, 6, 8,17, 7, 8,10,20,20,17,20,20,
-	 3, 5, 8,17, 3, 4, 6,17, 8, 8,10,17,17,12,16,20,
-	13,13,15,20,10,10,12,20,15,14,15,20,20,20,19,19,
-};
-
-static static_codebook _huff_book_line_128x17_class3 = {
-	1, 64,
-	_huff_lengthlist_line_128x17_class3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_0sub0[] = {
-	 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
-	 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 5,
-	 8, 5, 8, 5, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6, 9, 6,
-	 9, 6, 9, 7, 9, 7, 9, 7, 9, 7,10, 7,10, 8,10, 8,
-	10, 8,10, 8,10, 8,11, 8,11, 8,11, 8,11, 8,11, 9,
-	12, 9,12, 9,12, 9,12, 9,12,10,12,10,13,11,13,11,
-	14,12,14,13,15,14,16,14,17,15,18,16,20,20,20,20,
-	20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
-};
-
-static static_codebook _huff_book_line_128x17_0sub0 = {
-	1, 128,
-	_huff_lengthlist_line_128x17_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_1sub0[] = {
-	 2, 5, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5,
-	 6, 5, 6, 5, 7, 6, 7, 6, 7, 6, 8, 6, 9, 7, 9, 7,
-};
-
-static static_codebook _huff_book_line_128x17_1sub0 = {
-	1, 32,
-	_huff_lengthlist_line_128x17_1sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_1sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 4, 3, 5, 3, 5, 3, 6, 3, 6, 4, 6, 4, 7, 4, 7, 5,
-	 8, 5, 8, 6, 9, 7, 9, 7, 9, 8,10, 9,10, 9,11,10,
-	11,11,11,11,11,11,12,12,12,13,12,13,12,14,12,15,
-	12,14,12,16,13,17,13,17,14,17,14,16,13,17,14,17,
-	14,17,15,17,15,15,16,17,17,17,17,17,17,17,17,17,
-	17,17,17,17,17,17,16,16,16,16,16,16,16,16,16,16,
-};
-
-static static_codebook _huff_book_line_128x17_1sub1 = {
-	1, 128,
-	_huff_lengthlist_line_128x17_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_2sub1[] = {
-	 0, 4, 5, 4, 6, 4, 8, 3, 9, 3, 9, 2, 9, 3, 8, 4,
-	 9, 4,
-};
-
-static static_codebook _huff_book_line_128x17_2sub1 = {
-	1, 18,
-	_huff_lengthlist_line_128x17_2sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_2sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 5, 1, 5, 3, 5, 3, 5, 4, 7, 5,10, 7,10, 7,
-	12,10,14,10,14, 9,14,11,14,14,14,13,13,13,13,13,
-	13,13,
-};
-
-static static_codebook _huff_book_line_128x17_2sub2 = {
-	1, 50,
-	_huff_lengthlist_line_128x17_2sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_2sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6,
-	 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-	 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-	 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-};
-
-static static_codebook _huff_book_line_128x17_2sub3 = {
-	1, 128,
-	_huff_lengthlist_line_128x17_2sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_3sub1[] = {
-	 0, 4, 4, 4, 4, 4, 4, 4, 5, 3, 5, 3, 5, 4, 6, 4,
-	 6, 4,
-};
-
-static static_codebook _huff_book_line_128x17_3sub1 = {
-	1, 18,
-	_huff_lengthlist_line_128x17_3sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_3sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 5, 3, 6, 3, 6, 4, 7, 4, 7, 4, 7, 4, 8, 4,
-	 8, 4, 8, 4, 8, 4, 9, 4, 9, 5,10, 5,10, 7,10, 8,
-	10, 8,
-};
-
-static static_codebook _huff_book_line_128x17_3sub2 = {
-	1, 50,
-	_huff_lengthlist_line_128x17_3sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_128x17_3sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 2, 4, 3, 4, 4, 4, 5, 4, 7, 5, 8, 5,11,
-	 6,10, 6,12, 7,12, 7,12, 8,12, 8,12,10,12,12,12,
-	12,12,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
-	11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
-	11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
-};
-
-static static_codebook _huff_book_line_128x17_3sub3 = {
-	1, 128,
-	_huff_lengthlist_line_128x17_3sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_class1[] = {
-	 2,10, 8,14, 7,12,11,14, 1, 5, 3, 7, 4, 9, 7,13,
-};
-
-static static_codebook _huff_book_line_1024x27_class1 = {
-	1, 16,
-	_huff_lengthlist_line_1024x27_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_class2[] = {
-	 1, 4, 2, 6, 3, 7, 5, 7,
-};
-
-static static_codebook _huff_book_line_1024x27_class2 = {
-	1, 8,
-	_huff_lengthlist_line_1024x27_class2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_class3[] = {
-	 1, 5, 7,21, 5, 8, 9,21,10, 9,12,20,20,16,20,20,
-	 4, 8, 9,20, 6, 8, 9,20,11,11,13,20,20,15,17,20,
-	 9,11,14,20, 8,10,15,20,11,13,15,20,20,20,20,20,
-	20,20,20,20,13,20,20,20,18,18,20,20,20,20,20,20,
-	 3, 6, 8,20, 6, 7, 9,20,10, 9,12,20,20,20,20,20,
-	 5, 7, 9,20, 6, 6, 9,20,10, 9,12,20,20,20,20,20,
-	 8,10,13,20, 8, 9,12,20,11,10,12,20,20,20,20,20,
-	18,20,20,20,15,17,18,20,18,17,18,20,20,20,20,20,
-	 7,10,12,20, 8, 9,11,20,14,13,14,20,20,20,20,20,
-	 6, 9,12,20, 7, 8,11,20,12,11,13,20,20,20,20,20,
-	 9,11,15,20, 8,10,14,20,12,11,14,20,20,20,20,20,
-	20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
-	11,16,18,20,15,15,17,20,20,17,20,20,20,20,20,20,
-	 9,14,16,20,12,12,15,20,17,15,18,20,20,20,20,20,
-	16,19,18,20,15,16,20,20,17,17,20,20,20,20,20,20,
-	20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,
-};
-
-static static_codebook _huff_book_line_1024x27_class3 = {
-	1, 256,
-	_huff_lengthlist_line_1024x27_class3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_class4[] = {
-	 2, 3, 7,13, 4, 4, 7,15, 8, 6, 9,17,21,16,15,21,
-	 2, 5, 7,11, 5, 5, 7,14, 9, 7,10,16,17,15,16,21,
-	 4, 7,10,17, 7, 7, 9,15,11, 9,11,16,21,18,15,21,
-	18,21,21,21,15,17,17,19,21,19,18,20,21,21,21,20,
-};
-
-static static_codebook _huff_book_line_1024x27_class4 = {
-	1, 64,
-	_huff_lengthlist_line_1024x27_class4,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_0sub0[] = {
-	 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
-	 6, 5, 6, 5, 6, 5, 6, 5, 7, 5, 7, 5, 7, 5, 7, 5,
-	 8, 6, 8, 6, 8, 6, 9, 6, 9, 6,10, 6,10, 6,11, 6,
-	11, 7,11, 7,12, 7,12, 7,12, 7,12, 7,12, 7,12, 7,
-	12, 7,12, 8,13, 8,12, 8,12, 8,13, 8,13, 9,13, 9,
-	13, 9,13, 9,12,10,12,10,13,10,14,11,14,12,14,13,
-	14,13,14,14,15,16,15,15,15,14,15,17,21,22,22,21,
-	22,22,22,22,22,22,21,21,21,21,21,21,21,21,21,21,
-};
-
-static static_codebook _huff_book_line_1024x27_0sub0 = {
-	1, 128,
-	_huff_lengthlist_line_1024x27_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_1sub0[] = {
-	 2, 5, 5, 4, 5, 4, 5, 4, 5, 4, 6, 5, 6, 5, 6, 5,
-	 6, 5, 7, 5, 7, 6, 8, 6, 8, 6, 8, 6, 9, 6, 9, 6,
-};
-
-static static_codebook _huff_book_line_1024x27_1sub0 = {
-	1, 32,
-	_huff_lengthlist_line_1024x27_1sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_1sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 8, 5, 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 4,
-	 9, 4, 9, 4, 9, 4, 8, 4, 8, 4, 9, 5, 9, 5, 9, 5,
-	 9, 5, 9, 6,10, 6,10, 7,10, 8,11, 9,11,11,12,13,
-	12,14,13,15,13,15,14,16,14,17,15,17,15,15,16,16,
-	15,16,16,16,15,18,16,15,17,17,19,19,19,19,19,19,
-	19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,
-};
-
-static static_codebook _huff_book_line_1024x27_1sub1 = {
-	1, 128,
-	_huff_lengthlist_line_1024x27_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_2sub0[] = {
-	 1, 5, 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5,
-	 6, 6, 7, 7, 7, 7, 8, 7, 8, 8, 9, 8,10, 9,10, 9,
-};
-
-static static_codebook _huff_book_line_1024x27_2sub0 = {
-	1, 32,
-	_huff_lengthlist_line_1024x27_2sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_2sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 4, 3, 4, 3, 4, 4, 5, 4, 5, 4, 5, 5, 6, 5, 6, 5,
-	 7, 5, 7, 6, 7, 6, 8, 7, 8, 7, 8, 7, 9, 8, 9, 9,
-	 9, 9,10,10,10,11, 9,12, 9,12, 9,15,10,14, 9,13,
-	10,13,10,12,10,12,10,13,10,12,11,13,11,14,12,13,
-	13,14,14,13,14,15,14,16,13,13,14,16,16,16,16,16,
-	16,16,16,16,16,16,16,16,16,16,16,16,16,16,15,15,
-};
-
-static static_codebook _huff_book_line_1024x27_2sub1 = {
-	1, 128,
-	_huff_lengthlist_line_1024x27_2sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_3sub1[] = {
-	 0, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4, 4, 4, 4, 5,
-	 5, 5,
-};
-
-static static_codebook _huff_book_line_1024x27_3sub1 = {
-	1, 18,
-	_huff_lengthlist_line_1024x27_3sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_3sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 3, 4, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 6,
-	 5, 7, 5, 8, 6, 8, 6, 9, 7,10, 7,10, 8,10, 8,11,
-	 9,11,
-};
-
-static static_codebook _huff_book_line_1024x27_3sub2 = {
-	1, 50,
-	_huff_lengthlist_line_1024x27_3sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_3sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 7, 3, 8, 3,10, 3, 8, 3, 9, 3, 8, 4, 9,
-	 4, 9, 5, 9, 6,10, 6, 9, 7,11, 7,12, 9,13,10,13,
-	12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
-	12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
-	12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
-};
-
-static static_codebook _huff_book_line_1024x27_3sub3 = {
-	1, 128,
-	_huff_lengthlist_line_1024x27_3sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_4sub1[] = {
-	 0, 4, 5, 4, 5, 4, 5, 4, 5, 3, 5, 3, 5, 3, 5, 4,
-	 5, 4,
-};
-
-static static_codebook _huff_book_line_1024x27_4sub1 = {
-	1, 18,
-	_huff_lengthlist_line_1024x27_4sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_4sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 4, 2, 4, 2, 5, 3, 5, 4, 6, 6, 6, 7, 7, 8,
-	 7, 8, 7, 8, 7, 9, 8, 9, 8, 9, 8,10, 8,11, 9,12,
-	 9,12,
-};
-
-static static_codebook _huff_book_line_1024x27_4sub2 = {
-	1, 50,
-	_huff_lengthlist_line_1024x27_4sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_1024x27_4sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 2, 5, 2, 6, 3, 6, 4, 7, 4, 7, 5, 9, 5,11,
-	 6,11, 6,11, 7,11, 6,11, 6,11, 9,11, 8,11,11,11,
-	11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
-	11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,
-	11,11,11,11,11,11,11,11,11,11,10,10,10,10,10,10,
-};
-
-static static_codebook _huff_book_line_1024x27_4sub3 = {
-	1, 128,
-	_huff_lengthlist_line_1024x27_4sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_class1[] = {
-	 2, 6, 8, 9, 7,11,13,13, 1, 3, 5, 5, 6, 6,12,10,
-};
-
-static static_codebook _huff_book_line_2048x27_class1 = {
-	1, 16,
-	_huff_lengthlist_line_2048x27_class1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_class2[] = {
-	 1, 2, 3, 6, 4, 7, 5, 7,
-};
-
-static static_codebook _huff_book_line_2048x27_class2 = {
-	1, 8,
-	_huff_lengthlist_line_2048x27_class2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_class3[] = {
-	 3, 3, 6,16, 5, 5, 7,16, 9, 8,11,16,16,16,16,16,
-	 5, 5, 8,16, 5, 5, 7,16, 8, 7, 9,16,16,16,16,16,
-	 9, 9,12,16, 6, 8,11,16, 9,10,11,16,16,16,16,16,
-	16,16,16,16,13,16,16,16,15,16,16,16,16,16,16,16,
-	 5, 4, 7,16, 6, 5, 8,16, 9, 8,10,16,16,16,16,16,
-	 5, 5, 7,15, 5, 4, 6,15, 7, 6, 8,16,16,16,16,16,
-	 9, 9,11,15, 7, 7, 9,16, 8, 8, 9,16,16,16,16,16,
-	16,16,16,16,15,15,15,16,15,15,14,16,16,16,16,16,
-	 8, 8,11,16, 8, 9,10,16,11,10,14,16,16,16,16,16,
-	 6, 8,10,16, 6, 7,10,16, 8, 8,11,16,14,16,16,16,
-	10,11,14,16, 9, 9,11,16,10,10,11,16,16,16,16,16,
-	16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-	16,16,16,16,15,16,16,16,16,16,16,16,16,16,16,16,
-	12,16,15,16,12,14,16,16,16,16,16,16,16,16,16,16,
-	16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-	16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,
-};
-
-static static_codebook _huff_book_line_2048x27_class3 = {
-	1, 256,
-	_huff_lengthlist_line_2048x27_class3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_class4[] = {
-	 2, 4, 7,13, 4, 5, 7,15, 8, 7,10,16,16,14,16,16,
-	 2, 4, 7,16, 3, 4, 7,14, 8, 8,10,16,16,16,15,16,
-	 6, 8,11,16, 7, 7, 9,16,11, 9,13,16,16,16,15,16,
-	16,16,16,16,14,16,16,16,16,16,16,16,16,16,16,16,
-};
-
-static static_codebook _huff_book_line_2048x27_class4 = {
-	1, 64,
-	_huff_lengthlist_line_2048x27_class4,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_0sub0[] = {
-	 5, 5, 5, 5, 5, 5, 6, 5, 6, 5, 6, 5, 6, 5, 6, 5,
-	 6, 5, 7, 5, 7, 5, 7, 5, 8, 5, 8, 5, 8, 5, 9, 5,
-	 9, 6,10, 6,10, 6,11, 6,11, 6,11, 6,11, 6,11, 6,
-	11, 6,11, 6,12, 7,11, 7,11, 7,11, 7,11, 7,10, 7,
-	11, 7,11, 7,12, 7,11, 8,11, 8,11, 8,11, 8,13, 8,
-	12, 9,11, 9,11, 9,11,10,12,10,12, 9,12,10,12,11,
-	14,12,16,12,12,11,14,16,17,17,17,17,17,17,17,17,
-	17,17,17,17,17,17,17,17,17,17,17,17,16,16,16,16,
-};
-
-static static_codebook _huff_book_line_2048x27_0sub0 = {
-	1, 128,
-	_huff_lengthlist_line_2048x27_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_1sub0[] = {
-	 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5,
-	 5, 5, 6, 6, 6, 6, 6, 6, 7, 6, 7, 6, 7, 6, 7, 6,
-};
-
-static static_codebook _huff_book_line_2048x27_1sub0 = {
-	1, 32,
-	_huff_lengthlist_line_2048x27_1sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_1sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 6, 5, 7, 5, 7, 4, 7, 4, 8, 4, 8, 4, 8, 4, 8, 3,
-	 8, 4, 9, 4, 9, 4, 9, 4, 9, 4, 9, 5, 9, 5, 9, 6,
-	 9, 7, 9, 8, 9, 9, 9,10, 9,11, 9,14, 9,15,10,15,
-	10,15,10,15,10,15,11,15,10,14,12,14,11,14,13,14,
-	13,15,15,15,12,15,15,15,13,15,13,15,13,15,15,15,
-	15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,14,
-};
-
-static static_codebook _huff_book_line_2048x27_1sub1 = {
-	1, 128,
-	_huff_lengthlist_line_2048x27_1sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_2sub0[] = {
-	 2, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 5, 5, 6, 5,
-	 6, 5, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8,
-};
-
-static static_codebook _huff_book_line_2048x27_2sub0 = {
-	1, 32,
-	_huff_lengthlist_line_2048x27_2sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_2sub1[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 3, 4, 3, 4, 3, 4, 4, 5, 4, 5, 5, 5, 6, 6, 6, 7,
-	 6, 8, 6, 8, 6, 9, 7,10, 7,10, 7,10, 7,12, 7,12,
-	 7,12, 9,12,11,12,10,12,10,12,11,12,12,12,10,12,
-	10,12,10,12, 9,12,11,12,12,12,12,12,11,12,11,12,
-	12,12,12,12,12,12,12,12,10,10,12,12,12,12,12,10,
-	12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,
-};
-
-static static_codebook _huff_book_line_2048x27_2sub1 = {
-	1, 128,
-	_huff_lengthlist_line_2048x27_2sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_3sub1[] = {
-	 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
-	 5, 5,
-};
-
-static static_codebook _huff_book_line_2048x27_3sub1 = {
-	1, 18,
-	_huff_lengthlist_line_2048x27_3sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_3sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 3, 3, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6,
-	 6, 7, 6, 7, 6, 8, 6, 9, 7, 9, 7, 9, 9,11, 9,12,
-	10,12,
-};
-
-static static_codebook _huff_book_line_2048x27_3sub2 = {
-	1, 50,
-	_huff_lengthlist_line_2048x27_3sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_3sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 6, 3, 7, 3, 7, 5, 7, 7, 7, 7, 7, 6, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-};
-
-static static_codebook _huff_book_line_2048x27_3sub3 = {
-	1, 128,
-	_huff_lengthlist_line_2048x27_3sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_4sub1[] = {
-	 0, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 4, 5, 4, 5, 4,
-	 4, 5,
-};
-
-static static_codebook _huff_book_line_2048x27_4sub1 = {
-	1, 18,
-	_huff_lengthlist_line_2048x27_4sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_4sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 2, 4, 3, 4, 4, 4, 5, 5, 6, 5, 6, 5, 7,
-	 6, 6, 6, 7, 7, 7, 8, 9, 9, 9,12,10,11,10,10,12,
-	10,10,
-};
-
-static static_codebook _huff_book_line_2048x27_4sub2 = {
-	1, 50,
-	_huff_lengthlist_line_2048x27_4sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_2048x27_4sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 3, 6, 5, 7, 5, 7, 7, 7, 7, 7, 5, 7, 5, 7,
-	 5, 7, 5, 7, 7, 7, 7, 7, 4, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
-	 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6,
-};
-
-static static_codebook _huff_book_line_2048x27_4sub3 = {
-	1, 128,
-	_huff_lengthlist_line_2048x27_4sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4low_class0[] = {
-	 4, 5, 6,11, 5, 5, 6,10, 7, 7, 6, 6,14,13, 9, 9,
-	 6, 6, 6,10, 6, 6, 6, 9, 8, 7, 7, 9,14,12, 8,11,
-	 8, 7, 7,11, 8, 8, 7,11, 9, 9, 7, 9,13,11, 9,13,
-	19,19,18,19,15,16,16,19,11,11,10,13,10,10, 9,15,
-	 5, 5, 6,13, 6, 6, 6,11, 8, 7, 6, 7,14,11,10,11,
-	 6, 6, 6,12, 7, 6, 6,11, 8, 7, 7,11,13,11, 9,11,
-	 9, 7, 6,12, 8, 7, 6,12, 9, 8, 8,11,13,10, 7,13,
-	19,19,17,19,17,14,14,19,12,10, 8,12,13,10, 9,16,
-	 7, 8, 7,12, 7, 7, 7,11, 8, 7, 7, 8,12,12,11,11,
-	 8, 8, 7,12, 8, 7, 6,11, 8, 7, 7,10,10,11,10,11,
-	 9, 8, 8,13, 9, 8, 7,12,10, 9, 7,11, 9, 8, 7,11,
-	18,18,15,18,18,16,17,18,15,11,10,18,11, 9, 9,18,
-	16,16,13,16,12,11,10,16,12,11, 9, 6,15,12,11,13,
-	16,16,14,14,13,11,12,16,12, 9, 9,13,13,10,10,12,
-	17,18,17,17,14,15,14,16,14,12,14,15,12,10,11,12,
-	18,18,18,18,18,18,18,18,18,12,13,18,16,11, 9,18,
-};
-
-static static_codebook _huff_book_line_256x4low_class0 = {
-	1, 256,
-	_huff_lengthlist_line_256x4low_class0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4low_0sub0[] = {
-	 1, 3, 2, 3,
-};
-
-static static_codebook _huff_book_line_256x4low_0sub0 = {
-	1, 4,
-	_huff_lengthlist_line_256x4low_0sub0,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4low_0sub1[] = {
-	 0, 0, 0, 0, 2, 3, 2, 3, 3, 3,
-};
-
-static static_codebook _huff_book_line_256x4low_0sub1 = {
-	1, 10,
-	_huff_lengthlist_line_256x4low_0sub1,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4low_0sub2[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 4, 3, 4,
-	 4, 4, 4, 4, 5, 5, 5, 6, 6,
-};
-
-static static_codebook _huff_book_line_256x4low_0sub2 = {
-	1, 25,
-	_huff_lengthlist_line_256x4low_0sub2,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
-};
-
-static long _huff_lengthlist_line_256x4low_0sub3[] = {
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-	 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 4, 2, 4, 3, 5, 4,
-	 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 7, 7, 8, 6, 9,
-	 7,12,11,16,13,16,12,15,13,15,12,14,12,15,15,15,
-};
-
-static static_codebook _huff_book_line_256x4low_0sub3 = {
-	1, 64,
-	_huff_lengthlist_line_256x4low_0sub3,
-	0, 0, 0, 0, 0,
-	NULL,
-	NULL,
-	NULL,
-	NULL,
-	0
+static const static_codebook _huff_book_line_256x4low_0sub3 = {
+        1, 64,
+        (long *)_huff_lengthlist_line_256x4low_0sub3,
+        0, 0, 0, 0, 0,
+        NULL,
+        0
 };
 

File diff suppressed because it is too large
+ 942 - 67
Engine/lib/libvorbis/lib/books/uncoupled/res_books_uncoupled.h


+ 141 - 291
Engine/lib/libvorbis/lib/codebook.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: codebook.c 18183 2012-02-03 20:51:27Z xiphmont $
 
  ********************************************************************/
 
@@ -38,11 +38,11 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
 
   /* pack the codewords.  There are two packings; length ordered and
      length random.  Decide between the two now. */
-  
+
   for(i=1;i<c->entries;i++)
     if(c->lengthlist[i-1]==0 || c->lengthlist[i]<c->lengthlist[i-1])break;
   if(i==c->entries)ordered=1;
-  
+
   if(ordered){
     /* length ordered.  We only need to say how many codewords of
        each length.  The actual codewords are generated
@@ -56,19 +56,19 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
       long this=c->lengthlist[i];
       long last=c->lengthlist[i-1];
       if(this>last){
-	for(j=last;j<this;j++){
-	  oggpack_write(opb,i-count,_ilog(c->entries-count));
-	  count=i;
-	}
+        for(j=last;j<this;j++){
+          oggpack_write(opb,i-count,_ilog(c->entries-count));
+          count=i;
+        }
       }
     }
     oggpack_write(opb,i-count,_ilog(c->entries-count));
-    
+
   }else{
     /* length random.  Again, we don't code the codeword itself, just
        the length.  This time, though, we have to encode each length */
     oggpack_write(opb,0,1);   /* unordered */
-    
+
     /* algortihmic mapping has use for 'unused entries', which we tag
        here.  The algorithmic mapping happens as usual, but the unused
        entry has no codeword. */
@@ -78,16 +78,16 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
     if(i==c->entries){
       oggpack_write(opb,0,1); /* no unused entries */
       for(i=0;i<c->entries;i++)
-	oggpack_write(opb,c->lengthlist[i]-1,5);
+        oggpack_write(opb,c->lengthlist[i]-1,5);
     }else{
       oggpack_write(opb,1,1); /* we have unused entries; thus we tag */
       for(i=0;i<c->entries;i++){
-	if(c->lengthlist[i]==0){
-	  oggpack_write(opb,0,1);
-	}else{
-	  oggpack_write(opb,1,1);
-	  oggpack_write(opb,c->lengthlist[i]-1,5);
-	}
+        if(c->lengthlist[i]==0){
+          oggpack_write(opb,0,1);
+        }else{
+          oggpack_write(opb,1,1);
+          oggpack_write(opb,c->lengthlist[i]-1,5);
+        }
       }
     }
   }
@@ -102,37 +102,37 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
   case 1:case 2:
     /* implicitly populated value mapping */
     /* explicitly populated value mapping */
-    
+
     if(!c->quantlist){
       /* no quantlist?  error */
       return(-1);
     }
-    
+
     /* values that define the dequantization */
     oggpack_write(opb,c->q_min,32);
     oggpack_write(opb,c->q_delta,32);
     oggpack_write(opb,c->q_quant-1,4);
     oggpack_write(opb,c->q_sequencep,1);
-    
+
     {
       int quantvals;
       switch(c->maptype){
       case 1:
-	/* a single column of (c->entries/c->dim) quantized values for
-	   building a full value list algorithmically (square lattice) */
-	quantvals=_book_maptype1_quantvals(c);
-	break;
+        /* a single column of (c->entries/c->dim) quantized values for
+           building a full value list algorithmically (square lattice) */
+        quantvals=_book_maptype1_quantvals(c);
+        break;
       case 2:
-	/* every value (c->entries*c->dim total) specified explicitly */
-	quantvals=c->entries*c->dim;
-	break;
+        /* every value (c->entries*c->dim total) specified explicitly */
+        quantvals=c->entries*c->dim;
+        break;
       default: /* NOT_REACHABLE */
-	quantvals=-1;
+        quantvals=-1;
       }
 
       /* quantized values */
       for(i=0;i<quantvals;i++)
-	oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
+        oggpack_write(opb,labs(c->quantlist[i]),c->q_quant);
 
     }
     break;
@@ -146,9 +146,9 @@ int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *opb){
 
 /* unpacks a codebook from the packet buffer into the codebook struct,
    readies the codebook auxiliary structures for decode *************/
-int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
+static_codebook *vorbis_staticbook_unpack(oggpack_buffer *opb){
   long i,j;
-  memset(s,0,sizeof(*s));
+  static_codebook *s=_ogg_calloc(1,sizeof(*s));
   s->allocedp=1;
 
   /* make sure alignment is correct */
@@ -159,54 +159,68 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
   s->entries=oggpack_read(opb,24);
   if(s->entries==-1)goto _eofout;
 
+  if(_ilog(s->dim)+_ilog(s->entries)>24)goto _eofout;
+
   /* codeword ordering.... length ordered or unordered? */
   switch((int)oggpack_read(opb,1)){
-  case 0:
+  case 0:{
+    long unused;
+    /* allocated but unused entries? */
+    unused=oggpack_read(opb,1);
+    if((s->entries*(unused?1:5)+7)>>3>opb->storage-oggpack_bytes(opb))
+      goto _eofout;
     /* unordered */
     s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
 
     /* allocated but unused entries? */
-    if(oggpack_read(opb,1)){
+    if(unused){
       /* yes, unused entries */
 
       for(i=0;i<s->entries;i++){
-	if(oggpack_read(opb,1)){
-	  long num=oggpack_read(opb,5);
-	  if(num==-1)goto _eofout;
-	  s->lengthlist[i]=num+1;
-	}else
-	  s->lengthlist[i]=0;
+        if(oggpack_read(opb,1)){
+          long num=oggpack_read(opb,5);
+          if(num==-1)goto _eofout;
+          s->lengthlist[i]=num+1;
+        }else
+          s->lengthlist[i]=0;
       }
     }else{
       /* all entries used; no tagging */
       for(i=0;i<s->entries;i++){
-	long num=oggpack_read(opb,5);
-	if(num==-1)goto _eofout;
-	s->lengthlist[i]=num+1;
+        long num=oggpack_read(opb,5);
+        if(num==-1)goto _eofout;
+        s->lengthlist[i]=num+1;
       }
     }
-    
+
     break;
+  }
   case 1:
     /* ordered */
     {
       long length=oggpack_read(opb,5)+1;
+      if(length==0)goto _eofout;
       s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
 
       for(i=0;i<s->entries;){
-	long num=oggpack_read(opb,_ilog(s->entries-i));
-	if(num==-1)goto _eofout;
-	for(j=0;j<num && i<s->entries;j++,i++)
-	  s->lengthlist[i]=length;
-	length++;
+        long num=oggpack_read(opb,_ilog(s->entries-i));
+        if(num==-1)goto _eofout;
+        if(length>32 || num>s->entries-i ||
+           (num>0 && (num-1)>>(length-1)>1)){
+          goto _errout;
+        }
+        if(length>32)goto _errout;
+        for(j=0;j<num;j++,i++)
+          s->lengthlist[i]=length;
+        length++;
       }
     }
     break;
   default:
     /* EOF */
-    return(-1);
+    goto _eofout;
   }
-  
+
   /* Do we have a mapping to unpack? */
   switch((s->maptype=oggpack_read(opb,4))){
   case 0:
@@ -220,23 +234,26 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
     s->q_delta=oggpack_read(opb,32);
     s->q_quant=oggpack_read(opb,4)+1;
     s->q_sequencep=oggpack_read(opb,1);
+    if(s->q_sequencep==-1)goto _eofout;
 
     {
       int quantvals=0;
       switch(s->maptype){
       case 1:
-	quantvals=_book_maptype1_quantvals(s);
-	break;
+        quantvals=(s->dim==0?0:_book_maptype1_quantvals(s));
+        break;
       case 2:
-	quantvals=s->entries*s->dim;
-	break;
+        quantvals=s->entries*s->dim;
+        break;
       }
-      
+
       /* quantized values */
+      if(((quantvals*s->q_quant+7)>>3)>opb->storage-oggpack_bytes(opb))
+        goto _eofout;
       s->quantlist=_ogg_malloc(sizeof(*s->quantlist)*quantvals);
       for(i=0;i<quantvals;i++)
-	s->quantlist[i]=oggpack_read(opb,s->q_quant);
-      
+        s->quantlist[i]=oggpack_read(opb,s->q_quant);
+
       if(quantvals&&s->quantlist[quantvals-1]==-1)goto _eofout;
     }
     break;
@@ -245,12 +262,12 @@ int vorbis_staticbook_unpack(oggpack_buffer *opb,static_codebook *s){
   }
 
   /* all set */
-  return(0);
-  
+  return(s);
+
  _errout:
  _eofout:
-  vorbis_staticbook_clear(s);
-  return(-1); 
+  vorbis_staticbook_destroy(s);
+  return(NULL);
 }
 
 /* returns the number of bits ************************************************/
@@ -260,37 +277,6 @@ int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b){
   return(book->c->lengthlist[a]);
 }
 
-/* One the encode side, our vector writers are each designed for a
-specific purpose, and the encoder is not flexible without modification:
-
-The LSP vector coder uses a single stage nearest-match with no
-interleave, so no step and no error return.  This is specced by floor0
-and doesn't change.
-
-Residue0 encoding interleaves, uses multiple stages, and each stage
-peels of a specific amount of resolution from a lattice (thus we want
-to match by threshold, not nearest match).  Residue doesn't *have* to
-be encoded that way, but to change it, one will need to add more
-infrastructure on the encode side (decode side is specced and simpler) */
-
-/* floor0 LSP (single stage, non interleaved, nearest match) */
-/* returns entry number and *modifies a* to the quantization value *****/
-int vorbis_book_errorv(codebook *book,float *a){
-  int dim=book->dim,k;
-  int best=_best(book,a,1);
-  for(k=0;k<dim;k++)
-    a[k]=(book->valuelist+best*dim)[k];
-  return(best);
-}
-
-/* returns the number of bits and *modifies a* to the quantization value *****/
-int vorbis_book_encodev(codebook *book,int best,float *a,oggpack_buffer *b){
-  int k,dim=book->dim;
-  for(k=0;k<dim;k++)
-    a[k]=(book->valuelist+best*dim)[k];
-  return(vorbis_book_encode(book,best,b));
-}
-
 /* the 'eliminate the decode tree' optimization actually requires the
    codewords to be MSb first, not LSb.  This is an annoying inelegancy
    (and one of the first places where carefully thought out design
@@ -311,7 +297,7 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
   int  read=book->dec_maxlength;
   long lo,hi;
   long lok = oggpack_look(b,book->dec_firsttablen);
-  
+
   if (lok >= 0) {
     long entry = book->dec_firsttable[lok];
     if(entry&0x80000000UL){
@@ -325,30 +311,30 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
     lo=0;
     hi=book->used_entries;
   }
-  
+
   lok = oggpack_look(b, read);
-  
+
   while(lok<0 && read>1)
     lok = oggpack_look(b, --read);
   if(lok<0)return -1;
-  
+
   /* bisect search for the codeword in the ordered list */
   {
     ogg_uint32_t testword=bitreverse((ogg_uint32_t)lok);
-    
+
     while(hi-lo>1){
       long p=(hi-lo)>>1;
-      long test=book->codelist[lo+p]>testword;    
+      long test=book->codelist[lo+p]>testword;
       lo+=p&(test-1);
       hi-=p&(-test);
       }
-    
+
     if(book->dec_codelengths[lo]<=read){
       oggpack_adv(b, book->dec_codelengths[lo]);
       return(lo);
     }
   }
-  
+
   oggpack_adv(b, read);
 
   return(-1);
@@ -357,13 +343,13 @@ STIN long decode_packed_entry_number(codebook *book, oggpack_buffer *b){
 /* Decode side is specced and easier, because we don't need to find
    matches using different criteria; we simply read and map.  There are
    two things we need to do 'depending':
-   
+
    We may need to support interleave.  We don't really, but it's
    convenient to do it here rather than rebuild the vector later.
 
    Cascades may be additive or multiplicitive; this is not inherent in
    the codebook, but set in the code using the codebook.  Like
-   interleaving, it's easiest to do it here.  
+   interleaving, it's easiest to do it here.
    addmul==0 -> declarative (set the value)
    addmul==1 -> additive
    addmul==2 -> multiplicitive */
@@ -381,13 +367,14 @@ long vorbis_book_decode(codebook *book, oggpack_buffer *b){
 }
 
 /* returns 0 on OK or -1 on eof *************************************/
+/* decode vector / dim granularity gaurding is done in the upper layer */
 long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
   if(book->used_entries>0){
     int step=n/book->dim;
     long *entry = alloca(sizeof(*entry)*step);
     float **t = alloca(sizeof(*t)*step);
     int i,j,o;
-    
+
     for (i = 0; i < step; i++) {
       entry[i]=decode_packed_entry_number(book,b);
       if(entry[i]==-1)return(-1);
@@ -395,81 +382,85 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
     }
     for(i=0,o=0;i<book->dim;i++,o+=step)
       for (j=0;j<step;j++)
-	a[o+j]+=t[j][i];
+        a[o+j]+=t[j][i];
   }
   return(0);
 }
 
+/* decode vector / dim granularity gaurding is done in the upper layer */
 long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
   if(book->used_entries>0){
     int i,j,entry;
     float *t;
-    
+
     if(book->dim>8){
       for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;)
-	  a[i++]+=t[j++];
+        entry = decode_packed_entry_number(book,b);
+        if(entry==-1)return(-1);
+        t     = book->valuelist+entry*book->dim;
+        for (j=0;j<book->dim;)
+          a[i++]+=t[j++];
       }
     }else{
       for(i=0;i<n;){
-	entry = decode_packed_entry_number(book,b);
-	if(entry==-1)return(-1);
-	t     = book->valuelist+entry*book->dim;
-	j=0;
-	switch((int)book->dim){
-	case 8:
-	  a[i++]+=t[j++];
-	case 7:
-	  a[i++]+=t[j++];
-	case 6:
-	  a[i++]+=t[j++];
-	case 5:
-	  a[i++]+=t[j++];
-	case 4:
-	  a[i++]+=t[j++];
-	case 3:
-	  a[i++]+=t[j++];
-	case 2:
-	  a[i++]+=t[j++];
-	case 1:
-	  a[i++]+=t[j++];
-	case 0:
-	  break;
-	}
+        entry = decode_packed_entry_number(book,b);
+        if(entry==-1)return(-1);
+        t     = book->valuelist+entry*book->dim;
+        j=0;
+        switch((int)book->dim){
+        case 8:
+          a[i++]+=t[j++];
+        case 7:
+          a[i++]+=t[j++];
+        case 6:
+          a[i++]+=t[j++];
+        case 5:
+          a[i++]+=t[j++];
+        case 4:
+          a[i++]+=t[j++];
+        case 3:
+          a[i++]+=t[j++];
+        case 2:
+          a[i++]+=t[j++];
+        case 1:
+          a[i++]+=t[j++];
+        case 0:
+          break;
+        }
       }
-    }    
+    }
   }
   return(0);
 }
 
+/* unlike the others, we guard against n not being an integer number
+   of <dim> internally rather than in the upper layer (called only by
+   floor0) */
 long vorbis_book_decodev_set(codebook *book,float *a,oggpack_buffer *b,int n){
   if(book->used_entries>0){
     int i,j,entry;
     float *t;
-    
+
     for(i=0;i<n;){
       entry = decode_packed_entry_number(book,b);
       if(entry==-1)return(-1);
       t     = book->valuelist+entry*book->dim;
-      for (j=0;j<book->dim;)
-	a[i++]=t[j++];
+      for (j=0;i<n && j<book->dim;){
+        a[i++]=t[j++];
+      }
     }
   }else{
     int i,j;
-    
+
     for(i=0;i<n;){
-      for (j=0;j<book->dim;)
-	a[i++]=0.f;
+      a[i++]=0.f;
     }
   }
   return(0);
 }
 
 long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
-			      oggpack_buffer *b,int n){
+                              oggpack_buffer *b,int n){
 
   long i,j,entry;
   int chptr=0;
@@ -478,157 +469,16 @@ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
       entry = decode_packed_entry_number(book,b);
       if(entry==-1)return(-1);
       {
-	const float *t = book->valuelist+entry*book->dim;
-	for (j=0;j<book->dim;j++){
-	  a[chptr++][i]+=t[j];
-	  if(chptr==ch){
-	    chptr=0;
-	    i++;
-	  }
-	}
+        const float *t = book->valuelist+entry*book->dim;
+        for (j=0;j<book->dim;j++){
+          a[chptr++][i]+=t[j];
+          if(chptr==ch){
+            chptr=0;
+            i++;
+          }
+        }
       }
     }
   }
   return(0);
 }
-
-#ifdef _V_SELFTEST
-/* Simple enough; pack a few candidate codebooks, unpack them.  Code a
-   number of vectors through (keeping track of the quantized values),
-   and decode using the unpacked book.  quantized version of in should
-   exactly equal out */
-
-#include <stdio.h>
-
-#include "vorbis/book/lsp20_0.vqh"
-#include "vorbis/book/res0a_13.vqh"
-#define TESTSIZE 40
-
-float test1[TESTSIZE]={
-  0.105939f,
-  0.215373f,
-  0.429117f,
-  0.587974f,
-
-  0.181173f,
-  0.296583f,
-  0.515707f,
-  0.715261f,
-
-  0.162327f,
-  0.263834f,
-  0.342876f,
-  0.406025f,
-
-  0.103571f,
-  0.223561f,
-  0.368513f,
-  0.540313f,
-
-  0.136672f,
-  0.395882f,
-  0.587183f,
-  0.652476f,
-
-  0.114338f,
-  0.417300f,
-  0.525486f,
-  0.698679f,
-
-  0.147492f,
-  0.324481f,
-  0.643089f,
-  0.757582f,
-
-  0.139556f,
-  0.215795f,
-  0.324559f,
-  0.399387f,
-
-  0.120236f,
-  0.267420f,
-  0.446940f,
-  0.608760f,
-
-  0.115587f,
-  0.287234f,
-  0.571081f,
-  0.708603f,
-};
-
-float test3[TESTSIZE]={
-  0,1,-2,3,4,-5,6,7,8,9,
-  8,-2,7,-1,4,6,8,3,1,-9,
-  10,11,12,13,14,15,26,17,18,19,
-  30,-25,-30,-1,-5,-32,4,3,-2,0};
-
-static_codebook *testlist[]={&_vq_book_lsp20_0,
-			     &_vq_book_res0a_13,NULL};
-float   *testvec[]={test1,test3};
-
-int main(){
-  oggpack_buffer write;
-  oggpack_buffer read;
-  long ptr=0,i;
-  oggpack_writeinit(&write);
-  
-  fprintf(stderr,"Testing codebook abstraction...:\n");
-
-  while(testlist[ptr]){
-    codebook c;
-    static_codebook s;
-    float *qv=alloca(sizeof(*qv)*TESTSIZE);
-    float *iv=alloca(sizeof(*iv)*TESTSIZE);
-    memcpy(qv,testvec[ptr],sizeof(*qv)*TESTSIZE);
-    memset(iv,0,sizeof(*iv)*TESTSIZE);
-
-    fprintf(stderr,"\tpacking/coding %ld... ",ptr);
-
-    /* pack the codebook, write the testvector */
-    oggpack_reset(&write);
-    vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory
-                                                  we can write */
-    vorbis_staticbook_pack(testlist[ptr],&write);
-    fprintf(stderr,"Codebook size %ld bytes... ",oggpack_bytes(&write));
-    for(i=0;i<TESTSIZE;i+=c.dim){
-      int best=_best(&c,qv+i,1);
-      vorbis_book_encodev(&c,best,qv+i,&write);
-    }
-    vorbis_book_clear(&c);
-    
-    fprintf(stderr,"OK.\n");
-    fprintf(stderr,"\tunpacking/decoding %ld... ",ptr);
-
-    /* transfer the write data to a read buffer and unpack/read */
-    oggpack_readinit(&read,oggpack_get_buffer(&write),oggpack_bytes(&write));
-    if(vorbis_staticbook_unpack(&read,&s)){
-      fprintf(stderr,"Error unpacking codebook.\n");
-      exit(1);
-    }
-    if(vorbis_book_init_decode(&c,&s)){
-      fprintf(stderr,"Error initializing codebook.\n");
-      exit(1);
-    }
-
-    for(i=0;i<TESTSIZE;i+=c.dim)
-      if(vorbis_book_decodev_set(&c,iv+i,&read,c.dim)==-1){
-	fprintf(stderr,"Error reading codebook test data (EOP).\n");
-	exit(1);
-      }
-    for(i=0;i<TESTSIZE;i++)
-      if(fabs(qv[i]-iv[i])>.000001){
-	fprintf(stderr,"read (%g) != written (%g) at position (%ld)\n",
-		iv[i],qv[i],i);
-	exit(1);
-      }
-	  
-    fprintf(stderr,"OK\n");
-    ptr++;
-  }
-
-  /* The above is the trivial stuff; now try unquantizing a log scale codebook */
-
-  exit(0);
-}
-
-#endif

+ 20 - 61
Engine/lib/libvorbis/lib/codebook.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: codebook.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: codebook.h 17030 2010-03-25 06:52:55Z xiphmont $
 
  ********************************************************************/
 
@@ -40,8 +40,8 @@ typedef struct static_codebook{
 
   /* mapping ***************************************************************/
   int    maptype;        /* 0=none
-			    1=implicitly populated values from map column 
-			    2=listed arbitrary values */
+                            1=implicitly populated values from map column
+                            2=listed arbitrary values */
 
   /* The below does a linear, single monotonic sequence mapping. */
   long     q_min;       /* packed 32 bit float; quant value 0 maps to minval */
@@ -50,52 +50,11 @@ typedef struct static_codebook{
   int      q_sequencep; /* bitflag */
 
   long     *quantlist;  /* map == 1: (int)(entries^(1/dim)) element column map
-			   map == 2: list of dim*entries quantized entry vals
-			*/
-
-  /* encode helpers ********************************************************/
-  struct encode_aux_nearestmatch *nearest_tree;
-  struct encode_aux_threshmatch  *thresh_tree;
-  struct encode_aux_pigeonhole  *pigeon_tree;
-
+                           map == 2: list of dim*entries quantized entry vals
+                        */
   int allocedp;
 } static_codebook;
 
-/* this structures an arbitrary trained book to quickly find the
-   nearest cell match */
-typedef struct encode_aux_nearestmatch{
-  /* pre-calculated partitioning tree */
-  long   *ptr0;
-  long   *ptr1;
-
-  long   *p;         /* decision points (each is an entry) */
-  long   *q;         /* decision points (each is an entry) */
-  long   aux;        /* number of tree entries */
-  long   alloc;       
-} encode_aux_nearestmatch;
-
-/* assumes a maptype of 1; encode side only, so that's OK */
-typedef struct encode_aux_threshmatch{
-  float *quantthresh;
-  long   *quantmap;
-  int     quantvals; 
-  int     threshvals; 
-} encode_aux_threshmatch;
-
-typedef struct encode_aux_pigeonhole{
-  float min;
-  float del;
-
-  int  mapentries;
-  int  quantvals;
-  long *pigeonmap;
-
-  long fittotal;
-  long *fitlist;
-  long *fitmap;
-  long *fitlength;
-} encode_aux_pigeonhole;
-
 typedef struct codebook{
   long dim;           /* codebook dimensions (elements per vector) */
   long entries;       /* codebook entries */
@@ -105,7 +64,7 @@ typedef struct codebook{
   /* for encode, the below are entry-ordered, fully populated */
   /* for decode, the below are ordered by bitreversed codeword and only
      used entries are populated */
-  float        *valuelist;  /* list of dim*entries actual entry values */  
+  float        *valuelist;  /* list of dim*entries actual entry values */
   ogg_uint32_t *codelist;   /* list of bitstream codewords for each entry */
 
   int          *dec_index;  /* only used if sparseness collapsed */
@@ -114,9 +73,12 @@ typedef struct codebook{
   int           dec_firsttablen;
   int           dec_maxlength;
 
+  /* The current encoder uses only centered, integer-only lattice books. */
+  int           quantvals;
+  int           minval;
+  int           delta;
 } codebook;
 
-extern void vorbis_staticbook_clear(static_codebook *b);
 extern void vorbis_staticbook_destroy(static_codebook *b);
 extern int vorbis_book_init_encode(codebook *dest,const static_codebook *source);
 extern int vorbis_book_init_decode(codebook *dest,const static_codebook *source);
@@ -137,23 +99,20 @@ extern long vorbis_book_codelen(codebook *book,int entry);
 
 
 extern int vorbis_staticbook_pack(const static_codebook *c,oggpack_buffer *b);
-extern int vorbis_staticbook_unpack(oggpack_buffer *b,static_codebook *c);
+extern static_codebook *vorbis_staticbook_unpack(oggpack_buffer *b);
 
 extern int vorbis_book_encode(codebook *book, int a, oggpack_buffer *b);
-extern int vorbis_book_errorv(codebook *book, float *a);
-extern int vorbis_book_encodev(codebook *book, int best,float *a, 
-			       oggpack_buffer *b);
 
 extern long vorbis_book_decode(codebook *book, oggpack_buffer *b);
-extern long vorbis_book_decodevs_add(codebook *book, float *a, 
-				     oggpack_buffer *b,int n);
-extern long vorbis_book_decodev_set(codebook *book, float *a, 
-				    oggpack_buffer *b,int n);
-extern long vorbis_book_decodev_add(codebook *book, float *a, 
-				    oggpack_buffer *b,int n);
+extern long vorbis_book_decodevs_add(codebook *book, float *a,
+                                     oggpack_buffer *b,int n);
+extern long vorbis_book_decodev_set(codebook *book, float *a,
+                                    oggpack_buffer *b,int n);
+extern long vorbis_book_decodev_add(codebook *book, float *a,
+                                    oggpack_buffer *b,int n);
 extern long vorbis_book_decodevv_add(codebook *book, float **a,
-				     long off,int ch, 
-				    oggpack_buffer *b,int n);
+                                     long off,int ch,
+                                    oggpack_buffer *b,int n);
 
 
 

+ 42 - 12
Engine/lib/libvorbis/lib/codec_internal.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: libvorbis codec headers
- last mod: $Id: codec_internal.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: codec_internal.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -23,20 +23,20 @@
 
 #define BLOCKTYPE_IMPULSE    0
 #define BLOCKTYPE_PADDING    1
-#define BLOCKTYPE_TRANSITION 0 
+#define BLOCKTYPE_TRANSITION 0
 #define BLOCKTYPE_LONG       1
 
 #define PACKETBLOBS 15
 
 typedef struct vorbis_block_internal{
-  float  **pcmdelay;  /* this is a pointer into local storage */ 
+  float  **pcmdelay;  /* this is a pointer into local storage */
   float  ampmax;
   int    blocktype;
 
-  oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed; 
-					      blob [PACKETBLOBS/2] points to
-					      the oggpack_buffer in the 
-					      main vorbis_block */
+  oggpack_buffer *packetblob[PACKETBLOBS]; /* initialized, must be freed;
+                                              blob [PACKETBLOBS/2] points to
+                                              the oggpack_buffer in the
+                                              main vorbis_block */
 } vorbis_block_internal;
 
 typedef void vorbis_look_floor;
@@ -60,7 +60,7 @@ typedef void vorbis_info_mapping;
 
 typedef struct private_state {
   /* local lookup storage */
-  envelope_lookup        *ve; /* envelope lookup */    
+  envelope_lookup        *ve; /* envelope lookup */
   int                     window[2];
   vorbis_look_transform **transform[2];    /* block, type */
   drft_lookup             fft_look[2];
@@ -87,7 +87,7 @@ typedef struct private_state {
 /* 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).  
+   etc).
 *********************************************************************/
 
 #include "highlevel.h"
@@ -127,11 +127,41 @@ typedef struct codec_setup_info {
   highlevel_encode_setup hi; /* used only by vorbisenc.c.  It's a
                                 highly redundant structure, but
                                 improves clarity of program flow. */
-  int         halfrate_flag; /* painless downsample for decode */  
+  int         halfrate_flag; /* painless downsample for decode */
 } codec_setup_info;
 
 extern vorbis_look_psy_global *_vp_global_look(vorbis_info *vi);
 extern void _vp_global_free(vorbis_look_psy_global *look);
 
-#endif
 
+
+typedef struct {
+  int sorted_index[VIF_POSIT+2];
+  int forward_index[VIF_POSIT+2];
+  int reverse_index[VIF_POSIT+2];
+
+  int hineighbor[VIF_POSIT];
+  int loneighbor[VIF_POSIT];
+  int posts;
+
+  int n;
+  int quant_q;
+  vorbis_info_floor1 *vi;
+
+  long phrasebits;
+  long postbits;
+  long frames;
+} vorbis_look_floor1;
+
+
+
+extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+                          const float *logmdct,   /* in */
+                          const float *logmask);
+extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor1 *look,
+                          int *A,int *B,
+                          int del);
+extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
+                  vorbis_look_floor1 *look,
+                  int *post,int *ilogmask);
+#endif

+ 73 - 80
Engine/lib/libvorbis/lib/envelope.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: PCM data envelope analysis 
- last mod: $Id: envelope.c 13293 2007-07-24 00:09:47Z xiphmont $
+ function: PCM data envelope analysis
+ last mod: $Id: envelope.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -67,7 +67,7 @@ void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){
     }
     e->band[j].total=1./e->band[j].total;
   }
-  
+
   e->filter=_ogg_calloc(VE_BANDS*ch,sizeof(*e->filter));
   e->mark=_ogg_calloc(e->storage,sizeof(*e->mark));
 
@@ -88,11 +88,10 @@ void _ve_envelope_clear(envelope_lookup *e){
    that works better and isn't patented. */
 
 static int _ve_amp(envelope_lookup *ve,
-		   vorbis_info_psy_global *gi,
-		   float *data,
-		   envelope_band *bands,
-		   envelope_filter_state *filters,
-		   long pos){
+                   vorbis_info_psy_global *gi,
+                   float *data,
+                   envelope_band *bands,
+                   envelope_filter_state *filters){
   long n=ve->winlength;
   int ret=0;
   long i,j;
@@ -111,15 +110,15 @@ static int _ve_amp(envelope_lookup *ve,
   float penalty=gi->stretch_penalty-(ve->stretch/2-VE_MINSTRETCH);
   if(penalty<0.f)penalty=0.f;
   if(penalty>gi->stretch_penalty)penalty=gi->stretch_penalty;
-  
+
   /*_analysis_output_always("lpcm",seq2,data,n,0,0,
     totalshift+pos*ve->searchstep);*/
-  
+
  /* window and transform */
   for(i=0;i<n;i++)
     vec[i]=data[i]*ve->mdct_win[i];
   mdct_forward(&ve->mdct,vec,vec);
-  
+
   /*_analysis_output_always("mdct",seq2,vec,n/2,0,1,0); */
 
   /* near-DC spreading function; this has nothing to do with
@@ -145,7 +144,7 @@ static int _ve_amp(envelope_lookup *ve,
     if(filters->nearptr>=VE_NEARDC)filters->nearptr=0;
     decay=todB(&decay)*.5-15.f;
   }
-  
+
   /* perform spreading and limiting, also smooth the spectrum.  yes,
      the MDCT results in all real coefficients, but it still *behaves*
      like real/imaginary pairs */
@@ -159,7 +158,7 @@ static int _ve_amp(envelope_lookup *ve,
   }
 
   /*_analysis_output_always("spread",seq2++,vec,n/4,0,0,0);*/
-  
+
   /* perform preecho/postecho triggering by band */
   for(j=0;j<VE_BANDS;j++){
     float acc=0.;
@@ -168,27 +167,27 @@ static int _ve_amp(envelope_lookup *ve,
     /* accumulate amplitude */
     for(i=0;i<bands[j].end;i++)
       acc+=vec[i+bands[j].begin]*bands[j].window[i];
-   
+
     acc*=bands[j].total;
 
     /* convert amplitude to delta */
     {
       int p,this=filters[j].ampptr;
       float postmax,postmin,premax=-99999.f,premin=99999.f;
-      
+
       p=this;
       p--;
       if(p<0)p+=VE_AMP;
       postmax=max(acc,filters[j].ampbuf[p]);
       postmin=min(acc,filters[j].ampbuf[p]);
-      
+
       for(i=0;i<stretch;i++){
-	p--;
-	if(p<0)p+=VE_AMP;
-	premax=max(premax,filters[j].ampbuf[p]);
-	premin=min(premin,filters[j].ampbuf[p]);
+        p--;
+        if(p<0)p+=VE_AMP;
+        premax=max(premax,filters[j].ampbuf[p]);
+        premin=min(premin,filters[j].ampbuf[p]);
       }
-      
+
       valmin=postmin-premin;
       valmax=postmax-premax;
 
@@ -205,7 +204,7 @@ static int _ve_amp(envelope_lookup *ve,
     }
     if(valmin<gi->postecho_thresh[j]-penalty)ret|=2;
   }
- 
+
   return(ret);
 }
 
@@ -237,10 +236,10 @@ long _ve_envelope_search(vorbis_dsp_state *v){
     ve->stretch++;
     if(ve->stretch>VE_MAXSTRETCH*2)
       ve->stretch=VE_MAXSTRETCH*2;
-    
+
     for(i=0;i<ve->ch;i++){
       float *pcm=v->pcm[i]+ve->searchstep*(j);
-      ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS,j);
+      ret|=_ve_amp(ve,gi,pcm,ve->band,ve->filter+i*VE_BANDS);
     }
 
     ve->mark[j+VE_POST]=0;
@@ -266,65 +265,65 @@ long _ve_envelope_search(vorbis_dsp_state *v){
       ci->blocksizes[v->W]/4+
       ci->blocksizes[1]/2+
       ci->blocksizes[0]/4;
-    
+
     j=ve->cursor;
-    
+
     while(j<ve->current-(ve->searchstep)){/* account for postecho
                                              working back one window */
       if(j>=testW)return(1);
- 
+
       ve->cursor=j;
 
       if(ve->mark[j/ve->searchstep]){
-	if(j>centerW){
+        if(j>centerW){
 
 #if 0
-	  if(j>ve->curmark){
-	    float *marker=alloca(v->pcm_current*sizeof(*marker));
-	    int l,m;
-	    memset(marker,0,sizeof(*marker)*v->pcm_current);
-	    fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n",
-		    seq,
-		    (totalshift+ve->cursor)/44100.,
-		    (totalshift+j)/44100.);
-	    _analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift);
-	    _analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift);
-
-	    _analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
-	    _analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
-	    
-	    for(m=0;m<VE_BANDS;m++){
-	      char buf[80];
-	      sprintf(buf,"delL%d",m);
-	      for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1;
-	      _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
-	    }
-
-	    for(m=0;m<VE_BANDS;m++){
-	      char buf[80];
-	      sprintf(buf,"delR%d",m);
-	      for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1;
-	      _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
-	    }
-
-	    for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->mark[l]*.4;
-	    _analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift);
-	   
-	    
-	    seq++;
-	    
-	  }
+          if(j>ve->curmark){
+            float *marker=alloca(v->pcm_current*sizeof(*marker));
+            int l,m;
+            memset(marker,0,sizeof(*marker)*v->pcm_current);
+            fprintf(stderr,"mark! seq=%d, cursor:%fs time:%fs\n",
+                    seq,
+                    (totalshift+ve->cursor)/44100.,
+                    (totalshift+j)/44100.);
+            _analysis_output_always("pcmL",seq,v->pcm[0],v->pcm_current,0,0,totalshift);
+            _analysis_output_always("pcmR",seq,v->pcm[1],v->pcm_current,0,0,totalshift);
+
+            _analysis_output_always("markL",seq,v->pcm[0],j,0,0,totalshift);
+            _analysis_output_always("markR",seq,v->pcm[1],j,0,0,totalshift);
+
+            for(m=0;m<VE_BANDS;m++){
+              char buf[80];
+              sprintf(buf,"delL%d",m);
+              for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m].markers[l]*.1;
+              _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
+            }
+
+            for(m=0;m<VE_BANDS;m++){
+              char buf[80];
+              sprintf(buf,"delR%d",m);
+              for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->filter[m+VE_BANDS].markers[l]*.1;
+              _analysis_output_always(buf,seq,marker,v->pcm_current,0,0,totalshift);
+            }
+
+            for(l=0;l<last;l++)marker[l*ve->searchstep]=ve->mark[l]*.4;
+            _analysis_output_always("mark",seq,marker,v->pcm_current,0,0,totalshift);
+
+
+            seq++;
+
+          }
 #endif
 
-	  ve->curmark=j;
-	  if(j>=testW)return(1);
-	  return(0);
-	}
+          ve->curmark=j;
+          if(j>=testW)return(1);
+          return(0);
+        }
       }
       j+=ve->searchstep;
     }
   }
-  
+
   return(-1);
 }
 
@@ -356,27 +355,21 @@ int _ve_envelope_mark(vorbis_dsp_state *v){
 
 void _ve_envelope_shift(envelope_lookup *e,long shift){
   int smallsize=e->current/e->searchstep+VE_POST; /* adjust for placing marks
-						     ahead of ve->current */
+                                                     ahead of ve->current */
   int smallshift=shift/e->searchstep;
 
   memmove(e->mark,e->mark+smallshift,(smallsize-smallshift)*sizeof(*e->mark));
-  
+
 #if 0
   for(i=0;i<VE_BANDS*e->ch;i++)
     memmove(e->filter[i].markers,
-	    e->filter[i].markers+smallshift,
-	    (1024-smallshift)*sizeof(*(*e->filter).markers));
+            e->filter[i].markers+smallshift,
+            (1024-smallshift)*sizeof(*(*e->filter).markers));
   totalshift+=shift;
-#endif 
+#endif
 
   e->current-=shift;
   if(e->curmark>=0)
     e->curmark-=shift;
   e->cursor-=shift;
 }
-
-
-
-
-
-

+ 2 - 3
Engine/lib/libvorbis/lib/envelope.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: PCM data envelope analysis and manipulation
- last mod: $Id: envelope.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: envelope.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -78,4 +78,3 @@ extern int  _ve_envelope_mark(vorbis_dsp_state *v);
 
 
 #endif
-

+ 25 - 27
Engine/lib/libvorbis/lib/floor0.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: floor0.c 18184 2012-02-03 20:55:12Z xiphmont $
 
  ********************************************************************/
 
@@ -82,15 +82,17 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
   info->ampbits=oggpack_read(opb,6);
   info->ampdB=oggpack_read(opb,8);
   info->numbooks=oggpack_read(opb,4)+1;
-  
+
   if(info->order<1)goto err_out;
   if(info->rate<1)goto err_out;
   if(info->barkmap<1)goto err_out;
   if(info->numbooks<1)goto err_out;
-    
+
   for(j=0;j<info->numbooks;j++){
     info->books[j]=oggpack_read(opb,8);
     if(info->books[j]<0 || info->books[j]>=ci->books)goto err_out;
+    if(ci->book_param[info->books[j]]->maptype==0)goto err_out;
+    if(ci->book_param[info->books[j]]->dim<1)goto err_out;
   }
   return(info);
 
@@ -108,8 +110,8 @@ static vorbis_info_floor *floor0_unpack (vorbis_info *vi,oggpack_buffer *opb){
    linear block and mapping sizes */
 
 static void floor0_map_lazy_init(vorbis_block      *vb,
-				 vorbis_info_floor *infoX,
-				 vorbis_look_floor0 *look){
+                                 vorbis_info_floor *infoX,
+                                 vorbis_look_floor0 *look){
   if(!look->linearmap[vb->W]){
     vorbis_dsp_state   *vd=vb->vd;
     vorbis_info        *vi=vd->vi;
@@ -122,7 +124,7 @@ static void floor0_map_lazy_init(vorbis_block      *vb,
        floor(bark(rate/2-1)*C)=mapped-1
      floor(bark(rate/2)*C)=mapped */
     float scale=look->ln/toBARK(info->rate/2.f);
-    
+
     /* the mapping from a linear scale to a smaller bark scale is
        straightforward.  We do *not* make sure that the linear mapping
        does not skip bark-scale bins; the decoder simply skips them and
@@ -131,8 +133,8 @@ static void floor0_map_lazy_init(vorbis_block      *vb,
        accurate */
     look->linearmap[W]=_ogg_malloc((n+1)*sizeof(**look->linearmap));
     for(j=0;j<n;j++){
-      int val=floor( toBARK((info->rate/2.f)/n*j) 
-		     *scale); /* bark numbers represent band edges */
+      int val=floor( toBARK((info->rate/2.f)/n*j)
+                     *scale); /* bark numbers represent band edges */
       if(val>=look->ln)val=look->ln-1; /* guard against the approximation */
       look->linearmap[W][j]=val;
     }
@@ -142,7 +144,7 @@ static void floor0_map_lazy_init(vorbis_block      *vb,
 }
 
 static vorbis_look_floor *floor0_look(vorbis_dsp_state *vd,
-				      vorbis_info_floor *i){
+                                      vorbis_info_floor *i){
   vorbis_info_floor0 *info=(vorbis_info_floor0 *)i;
   vorbis_look_floor0 *look=_ogg_calloc(1,sizeof(*look));
   look->m=info->order;
@@ -164,7 +166,7 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
     long maxval=(1<<info->ampbits)-1;
     float amp=(float)ampraw/maxval*info->ampdB;
     int booknum=oggpack_read(&vb->opb,_ilog(info->numbooks));
-    
+
     if(booknum!=-1 && booknum<info->numbooks){ /* be paranoid */
       codec_setup_info  *ci=vb->vd->vi->codec_setup;
       codebook *b=ci->fullbooks+info->books[booknum];
@@ -174,14 +176,13 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
          smash; b->dim is provably more than we can overflow the
          vector */
       float *lsp=_vorbis_block_alloc(vb,sizeof(*lsp)*(look->m+b->dim+1));
-            
-      for(j=0;j<look->m;j+=b->dim)
-	if(vorbis_book_decodev_set(b,lsp+j,&vb->opb,b->dim)==-1)goto eop;
+
+      if(vorbis_book_decodev_set(b,lsp,&vb->opb,look->m)==-1)goto eop;
       for(j=0;j<look->m;){
-	for(k=0;k<b->dim;k++,j++)lsp[j]+=last;
-	last=lsp[j-1];
+        for(k=0;j<look->m && k<b->dim;k++,j++)lsp[j]+=last;
+        last=lsp[j-1];
       }
-      
+
       lsp[look->m]=amp;
       return(lsp);
     }
@@ -191,10 +192,10 @@ static void *floor0_inverse1(vorbis_block *vb,vorbis_look_floor *i){
 }
 
 static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
-			   void *memo,float *out){
+                           void *memo,float *out){
   vorbis_look_floor0 *look=(vorbis_look_floor0 *)i;
   vorbis_info_floor0 *info=look->vi;
-  
+
   floor0_map_lazy_init(vb,info,look);
 
   if(memo){
@@ -203,10 +204,10 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
 
     /* take the coefficients back to a spectral envelope curve */
     vorbis_lsp_to_curve(out,
-			look->linearmap[vb->W],
-			look->n[vb->W],
-			look->ln,
-			lsp,look->m,amp,(float)info->ampdB);
+                        look->linearmap[vb->W],
+                        look->n[vb->W],
+                        look->ln,
+                        lsp,look->m,amp,(float)info->ampdB);
     return(1);
   }
   memset(out,0,sizeof(*out)*look->n[vb->W]);
@@ -214,10 +215,7 @@ static int floor0_inverse2(vorbis_block *vb,vorbis_look_floor *i,
 }
 
 /* export hooks */
-vorbis_func_floor floor0_exportbundle={
+const vorbis_func_floor floor0_exportbundle={
   NULL,&floor0_unpack,&floor0_look,&floor0_free_info,
   &floor0_free_look,&floor0_inverse1,&floor0_inverse2
 };
-
-
-

File diff suppressed because it is too large
+ 409 - 406
Engine/lib/libvorbis/lib/floor1.c


+ 12 - 11
Engine/lib/libvorbis/lib/highlevel.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: highlevel encoder setup struct seperated out for vorbisenc clarity
- last mod: $Id: highlevel.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: highlevel encoder setup struct separated out for vorbisenc clarity
+ last mod: $Id: highlevel.h 17195 2010-05-05 21:49:51Z giles $
 
  ********************************************************************/
 
@@ -21,16 +21,16 @@ typedef struct highlevel_byblocktype {
   double noise_bias_setting;
   double noise_compand_setting;
 } highlevel_byblocktype;
-  
+
 typedef struct highlevel_encode_setup {
-  void *setup;
   int   set_in_stone;
-
+  const void *setup;
   double base_setting;
-  double long_setting;
-  double short_setting;
+
   double impulse_noisetune;
 
+  /* bitrate management below all settable */
+  float  req;
   int    managed;
   long   bitrate_min;
   long   bitrate_av;
@@ -38,20 +38,21 @@ typedef struct highlevel_encode_setup {
   long   bitrate_max;
   long   bitrate_reservoir;
   double bitrate_reservoir_bias;
-  
+
   int impulse_block_p;
   int noise_normalize_p;
+  int coupling_p;
 
   double stereo_point_setting;
   double lowpass_kHz;
+  int    lowpass_altered;
 
   double ath_floating_dB;
   double ath_absolute_dB;
 
   double amplitude_track_dBpersec;
   double trigger_setting;
-  
+
   highlevel_byblocktype block[4]; /* padding, impulse, transition, long */
 
 } highlevel_encode_setup;
-

+ 121 - 97
Engine/lib/libvorbis/lib/info.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: maintain the info structure, info <-> header packets
- last mod: $Id: info.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: info.c 18186 2012-02-03 22:08:44Z xiphmont $
 
  ********************************************************************/
 
@@ -31,6 +31,9 @@
 #include "misc.h"
 #include "os.h"
 
+#define GENERAL_VENDOR_STRING "Xiph.Org libVorbis 1.3.3"
+#define ENCODE_VENDOR_STRING "Xiph.Org libVorbis I 20120203 (Omnipresent)"
+
 /* helpers */
 static int ilog2(unsigned int v){
   int ret=0;
@@ -42,7 +45,7 @@ static int ilog2(unsigned int v){
   return(ret);
 }
 
-static void _v_writestring(oggpack_buffer *o,char *s, int bytes){
+static void _v_writestring(oggpack_buffer *o,const char *s, int bytes){
 
   while(bytes--){
     oggpack_write(o,*s++,8);
@@ -59,11 +62,11 @@ void vorbis_comment_init(vorbis_comment *vc){
   memset(vc,0,sizeof(*vc));
 }
 
-void vorbis_comment_add(vorbis_comment *vc,char *comment){
+void vorbis_comment_add(vorbis_comment *vc,const char *comment){
   vc->user_comments=_ogg_realloc(vc->user_comments,
-			    (vc->comments+2)*sizeof(*vc->user_comments));
+                            (vc->comments+2)*sizeof(*vc->user_comments));
   vc->comment_lengths=_ogg_realloc(vc->comment_lengths,
-      			    (vc->comments+2)*sizeof(*vc->comment_lengths));
+                                  (vc->comments+2)*sizeof(*vc->comment_lengths));
   vc->comment_lengths[vc->comments]=strlen(comment);
   vc->user_comments[vc->comments]=_ogg_malloc(vc->comment_lengths[vc->comments]+1);
   strcpy(vc->user_comments[vc->comments], comment);
@@ -71,7 +74,7 @@ void vorbis_comment_add(vorbis_comment *vc,char *comment){
   vc->user_comments[vc->comments]=NULL;
 }
 
-void vorbis_comment_add_tag(vorbis_comment *vc, char *tag, char *contents){
+void vorbis_comment_add_tag(vorbis_comment *vc, const char *tag, const char *contents){
   char *comment=alloca(strlen(tag)+strlen(contents)+2); /* +2 for = and \0 */
   strcpy(comment, tag);
   strcat(comment, "=");
@@ -91,7 +94,7 @@ static int tagcompare(const char *s1, const char *s2, int n){
   return 0;
 }
 
-char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
+char *vorbis_comment_query(vorbis_comment *vc, const char *tag, int count){
   long i;
   int found = 0;
   int taglen = strlen(tag)+1; /* +1 for the = we append */
@@ -99,20 +102,20 @@ char *vorbis_comment_query(vorbis_comment *vc, char *tag, int count){
 
   strcpy(fulltag, tag);
   strcat(fulltag, "=");
-  
+
   for(i=0;i<vc->comments;i++){
     if(!tagcompare(vc->user_comments[i], fulltag, taglen)){
       if(count == found)
-	/* We return a pointer to the data, not a copy */
-      	return vc->user_comments[i] + taglen;
+        /* We return a pointer to the data, not a copy */
+              return vc->user_comments[i] + taglen;
       else
-	found++;
+        found++;
     }
   }
   return NULL; /* didn't find anything */
 }
 
-int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
+int vorbis_comment_query_count(vorbis_comment *vc, const char *tag){
   int i,count=0;
   int taglen = strlen(tag)+1; /* +1 for the = we append */
   char *fulltag = alloca(taglen+1);
@@ -130,10 +133,12 @@ int vorbis_comment_query_count(vorbis_comment *vc, char *tag){
 void vorbis_comment_clear(vorbis_comment *vc){
   if(vc){
     long i;
-    for(i=0;i<vc->comments;i++)
-      if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
-    if(vc->user_comments)_ogg_free(vc->user_comments);
-	if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
+    if(vc->user_comments){
+      for(i=0;i<vc->comments;i++)
+        if(vc->user_comments[i])_ogg_free(vc->user_comments[i]);
+      _ogg_free(vc->user_comments);
+    }
+    if(vc->comment_lengths)_ogg_free(vc->comment_lengths);
     if(vc->vendor)_ogg_free(vc->vendor);
     memset(vc,0,sizeof(*vc));
   }
@@ -163,33 +168,33 @@ void vorbis_info_clear(vorbis_info *vi){
 
     for(i=0;i<ci->maps;i++) /* unpack does the range checking */
       if(ci->map_param[i]) /* this may be cleaning up an aborted
-			      unpack, in which case the below type
-			      cannot be trusted */
-	_mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
+                              unpack, in which case the below type
+                              cannot be trusted */
+        _mapping_P[ci->map_type[i]]->free_info(ci->map_param[i]);
 
     for(i=0;i<ci->floors;i++) /* unpack does the range checking */
       if(ci->floor_param[i]) /* this may be cleaning up an aborted
-				unpack, in which case the below type
-				cannot be trusted */
-	_floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
-    
+                                unpack, in which case the below type
+                                cannot be trusted */
+        _floor_P[ci->floor_type[i]]->free_info(ci->floor_param[i]);
+
     for(i=0;i<ci->residues;i++) /* unpack does the range checking */
       if(ci->residue_param[i]) /* this may be cleaning up an aborted
-				  unpack, in which case the below type
-				  cannot be trusted */
-	_residue_P[ci->residue_type[i]]->free_info(ci->residue_param[i]);
-    
+                                  unpack, in which case the below type
+                                  cannot be trusted */
+        _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]);
+        /* knows if the book was not alloced */
+        vorbis_staticbook_destroy(ci->book_param[i]);
       }
       if(ci->fullbooks)
-	vorbis_book_clear(ci->fullbooks+i);
+        vorbis_book_clear(ci->fullbooks+i);
     }
     if(ci->fullbooks)
-	_ogg_free(ci->fullbooks);
-    
+        _ogg_free(ci->fullbooks);
+
     for(i=0;i<ci->psys;i++)
       _vi_psy_free(ci->psy_param[i]);
 
@@ -217,10 +222,10 @@ static int _vorbis_unpack_info(vorbis_info *vi,oggpack_buffer *opb){
 
   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(ci->blocksizes[0]<64)goto err_out; 
+  if(ci->blocksizes[0]<64)goto err_out;
   if(ci->blocksizes[1]<ci->blocksizes[0])goto err_out;
   if(ci->blocksizes[1]>8192)goto err_out;
 
@@ -236,20 +241,24 @@ static int _vorbis_unpack_comment(vorbis_comment *vc,oggpack_buffer *opb){
   int i;
   int vendorlen=oggpack_read(opb,32);
   if(vendorlen<0)goto err_out;
+  if(vendorlen>opb->storage-8)goto err_out;
   vc->vendor=_ogg_calloc(vendorlen+1,1);
   _v_readstring(opb,vc->vendor,vendorlen);
-  vc->comments=oggpack_read(opb,32);
-  if(vc->comments<0)goto err_out;
+  i=oggpack_read(opb,32);
+  if(i<0)goto err_out;
+  if(i>((opb->storage-oggpack_bytes(opb))>>2))goto err_out;
+  vc->comments=i;
   vc->user_comments=_ogg_calloc(vc->comments+1,sizeof(*vc->user_comments));
   vc->comment_lengths=_ogg_calloc(vc->comments+1, sizeof(*vc->comment_lengths));
-	    
+
   for(i=0;i<vc->comments;i++){
     int len=oggpack_read(opb,32);
     if(len<0)goto err_out;
-	vc->comment_lengths[i]=len;
+    if(len>opb->storage-oggpack_bytes(opb))goto err_out;
+    vc->comment_lengths[i]=len;
     vc->user_comments[i]=_ogg_calloc(len+1,1);
     _v_readstring(opb,vc->user_comments[i],len);
-  }	  
+  }
   if(oggpack_read(opb,1)!=1)goto err_out; /* EOP check */
 
   return(0);
@@ -267,15 +276,16 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
 
   /* codebooks */
   ci->books=oggpack_read(opb,8)+1;
-  /*ci->book_param=_ogg_calloc(ci->books,sizeof(*ci->book_param));*/
+  if(ci->books<=0)goto err_out;
   for(i=0;i<ci->books;i++){
-    ci->book_param[i]=_ogg_calloc(1,sizeof(*ci->book_param[i]));
-    if(vorbis_staticbook_unpack(opb,ci->book_param[i]))goto err_out;
+    ci->book_param[i]=vorbis_staticbook_unpack(opb);
+    if(!ci->book_param[i])goto err_out;
   }
 
   /* time backend settings; hooks are unused */
   {
     int times=oggpack_read(opb,6)+1;
+    if(times<=0)goto err_out;
     for(i=0;i<times;i++){
       int test=oggpack_read(opb,16);
       if(test<0 || test>=VI_TIMEB)goto err_out;
@@ -284,8 +294,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
 
   /* floor backend settings */
   ci->floors=oggpack_read(opb,6)+1;
-  /*ci->floor_type=_ogg_malloc(ci->floors*sizeof(*ci->floor_type));*/
-  /*ci->floor_param=_ogg_calloc(ci->floors,sizeof(void *));*/
+  if(ci->floors<=0)goto err_out;
   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;
@@ -295,8 +304,7 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
 
   /* residue backend settings */
   ci->residues=oggpack_read(opb,6)+1;
-  /*ci->residue_type=_ogg_malloc(ci->residues*sizeof(*ci->residue_type));*/
-  /*ci->residue_param=_ogg_calloc(ci->residues,sizeof(void *));*/
+  if(ci->residues<=0)goto err_out;
   for(i=0;i<ci->residues;i++){
     ci->residue_type[i]=oggpack_read(opb,16);
     if(ci->residue_type[i]<0 || ci->residue_type[i]>=VI_RESB)goto err_out;
@@ -306,18 +314,17 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
 
   /* map backend settings */
   ci->maps=oggpack_read(opb,6)+1;
-  /*ci->map_type=_ogg_malloc(ci->maps*sizeof(*ci->map_type));*/
-  /*ci->map_param=_ogg_calloc(ci->maps,sizeof(void *));*/
+  if(ci->maps<=0)goto err_out;
   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 */
   ci->modes=oggpack_read(opb,6)+1;
-  /*vi->mode_param=_ogg_calloc(vi->modes,sizeof(void *));*/
+  if(ci->modes<=0)goto err_out;
   for(i=0;i<ci->modes;i++){
     ci->mode_param[i]=_ogg_calloc(1,sizeof(*ci->mode_param[i]));
     ci->mode_param[i]->blockflag=oggpack_read(opb,1);
@@ -328,8 +335,9 @@ static int _vorbis_unpack_books(vorbis_info *vi,oggpack_buffer *opb){
     if(ci->mode_param[i]->windowtype>=VI_WINDOWB)goto err_out;
     if(ci->mode_param[i]->transformtype>=VI_WINDOWB)goto err_out;
     if(ci->mode_param[i]->mapping>=ci->maps)goto err_out;
+    if(ci->mode_param[i]->mapping<0)goto err_out;
   }
-  
+
   if(oggpack_read(opb,1)!=1)goto err_out; /* top level EOP check */
 
   return(0);
@@ -370,7 +378,7 @@ int vorbis_synthesis_idheader(ogg_packet *op){
 
 int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op){
   oggpack_buffer opb;
-  
+
   if(op){
     oggpack_readinit(&opb,op->packet,op->bytes);
 
@@ -382,42 +390,42 @@ int vorbis_synthesis_headerin(vorbis_info *vi,vorbis_comment *vc,ogg_packet *op)
       memset(buffer,0,6);
       _v_readstring(&opb,buffer,6);
       if(memcmp(buffer,"vorbis",6)){
-	/* not a vorbis header */
-	return(OV_ENOTVORBIS);
+        /* not a vorbis header */
+        return(OV_ENOTVORBIS);
       }
       switch(packtype){
       case 0x01: /* least significant *bit* is read first */
-	if(!op->b_o_s){
-	  /* Not the initial packet */
-	  return(OV_EBADHEADER);
-	}
-	if(vi->rate!=0){
-	  /* previously initialized info header */
-	  return(OV_EBADHEADER);
-	}
+        if(!op->b_o_s){
+          /* Not the initial packet */
+          return(OV_EBADHEADER);
+        }
+        if(vi->rate!=0){
+          /* previously initialized info header */
+          return(OV_EBADHEADER);
+        }
 
-	return(_vorbis_unpack_info(vi,&opb));
+        return(_vorbis_unpack_info(vi,&opb));
 
       case 0x03: /* least significant *bit* is read first */
-	if(vi->rate==0){
-	  /* um... we didn't get the initial header */
-	  return(OV_EBADHEADER);
-	}
+        if(vi->rate==0){
+          /* um... we didn't get the initial header */
+          return(OV_EBADHEADER);
+        }
 
-	return(_vorbis_unpack_comment(vc,&opb));
+        return(_vorbis_unpack_comment(vc,&opb));
 
       case 0x05: /* least significant *bit* is read first */
-	if(vi->rate==0 || vc->vendor==NULL){
-	  /* um... we didn;t get the initial header or comments yet */
-	  return(OV_EBADHEADER);
-	}
+        if(vi->rate==0 || vc->vendor==NULL){
+          /* um... we didn;t get the initial header or comments yet */
+          return(OV_EBADHEADER);
+        }
 
-	return(_vorbis_unpack_books(vi,&opb));
+        return(_vorbis_unpack_books(vi,&opb));
 
       default:
-	/* Not a valid vorbis header type */
-	return(OV_EBADHEADER);
-	break;
+        /* Not a valid vorbis header type */
+        return(OV_EBADHEADER);
+        break;
       }
     }
   }
@@ -430,7 +438,7 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
   codec_setup_info     *ci=vi->codec_setup;
   if(!ci)return(OV_EFAULT);
 
-  /* preamble */  
+  /* preamble */
   oggpack_write(opb,0x01,8);
   _v_writestring(opb,"vorbis", 6);
 
@@ -451,17 +459,16 @@ static int _vorbis_pack_info(oggpack_buffer *opb,vorbis_info *vi){
 }
 
 static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
-  char temp[]="Xiph.Org libVorbis I 20070622";
-  int bytes = strlen(temp);
+  int bytes = strlen(ENCODE_VENDOR_STRING);
 
-  /* preamble */  
+  /* preamble */
   oggpack_write(opb,0x03,8);
   _v_writestring(opb,"vorbis", 6);
 
   /* vendor */
   oggpack_write(opb,bytes,32);
-  _v_writestring(opb,temp, bytes);
-  
+  _v_writestring(opb,ENCODE_VENDOR_STRING, bytes);
+
   /* comments */
 
   oggpack_write(opb,vc->comments,32);
@@ -469,10 +476,10 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
     int i;
     for(i=0;i<vc->comments;i++){
       if(vc->user_comments[i]){
-	oggpack_write(opb,vc->comment_lengths[i],32);
-	_v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
+        oggpack_write(opb,vc->comment_lengths[i],32);
+        _v_writestring(opb,vc->user_comments[i], vc->comment_lengths[i]);
       }else{
-	oggpack_write(opb,0,32);
+        oggpack_write(opb,0,32);
       }
     }
   }
@@ -480,7 +487,7 @@ static int _vorbis_pack_comment(oggpack_buffer *opb,vorbis_comment *vc){
 
   return(0);
 }
- 
+
 static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
   codec_setup_info     *ci=vi->codec_setup;
   int i;
@@ -535,15 +542,18 @@ static int _vorbis_pack_books(oggpack_buffer *opb,vorbis_info *vi){
   return(0);
 err_out:
   return(-1);
-} 
+}
 
 int vorbis_commentheader_out(vorbis_comment *vc,
-    				      ogg_packet *op){
+                                          ogg_packet *op){
 
   oggpack_buffer opb;
 
   oggpack_writeinit(&opb);
-  if(_vorbis_pack_comment(&opb,vc)) return OV_EIMPL;
+  if(_vorbis_pack_comment(&opb,vc)){
+    oggpack_writeclear(&opb);
+    return OV_EIMPL;
+  }
 
   op->packet = _ogg_malloc(oggpack_bytes(&opb));
   memcpy(op->packet, opb.buffer, oggpack_bytes(&opb));
@@ -554,14 +564,15 @@ int vorbis_commentheader_out(vorbis_comment *vc,
   op->granulepos=0;
   op->packetno=1;
 
+  oggpack_writeclear(&opb);
   return 0;
 }
 
 int vorbis_analysis_headerout(vorbis_dsp_state *v,
-			      vorbis_comment *vc,
-			      ogg_packet *op,
-			      ogg_packet *op_comm,
-			      ogg_packet *op_code){
+                              vorbis_comment *vc,
+                              ogg_packet *op,
+                              ogg_packet *op_comm,
+                              ogg_packet *op_code){
   int ret=OV_EIMPL;
   vorbis_info *vi=v->vi;
   oggpack_buffer opb;
@@ -621,12 +632,12 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
   oggpack_writeclear(&opb);
   return(0);
  err_out:
-  oggpack_writeclear(&opb);
   memset(op,0,sizeof(*op));
   memset(op_comm,0,sizeof(*op_comm));
   memset(op_code,0,sizeof(*op_code));
 
   if(b){
+    oggpack_writeclear(&opb);
     if(b->header)_ogg_free(b->header);
     if(b->header1)_ogg_free(b->header1);
     if(b->header2)_ogg_free(b->header2);
@@ -638,7 +649,20 @@ int vorbis_analysis_headerout(vorbis_dsp_state *v,
 }
 
 double vorbis_granule_time(vorbis_dsp_state *v,ogg_int64_t granulepos){
-  if(granulepos>=0)
+  if(granulepos == -1) return -1;
+
+  /* We're not guaranteed a 64 bit unsigned type everywhere, so we
+     have to put the unsigned granpo in a signed type. */
+  if(granulepos>=0){
     return((double)granulepos/v->vi->rate);
-  return(-1);
+  }else{
+    ogg_int64_t granuleoff=0xffffffff;
+    granuleoff<<=31;
+    granuleoff|=0x7ffffffff;
+    return(((double)granulepos+2+granuleoff+granuleoff)/v->vi->rate);
+  }
+}
+
+const char *vorbis_version_string(void){
+  return GENERAL_VENDOR_STRING;
 }

+ 6 - 6
Engine/lib/libvorbis/lib/lookup.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: lookup based functions
-  last mod: $Id: lookup.c 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lookup.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -56,16 +56,16 @@ float vorbis_fromdBlook(float a){
 
 #ifdef INT_LOOKUP
 /* interpolated 1./sqrt(p) where .5 <= a < 1. (.100000... to .111111...) in
-   16.16 format 
+   16.16 format
 
    returns in m.8 format */
 long vorbis_invsqlook_i(long a,long e){
-  long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1); 
+  long i=(a&0x7fff)>>(INVSQ_LOOKUP_I_SHIFT-1);
   long d=(a&INVSQ_LOOKUP_I_MASK)<<(16-INVSQ_LOOKUP_I_SHIFT); /*  0.16 */
   long val=INVSQ_LOOKUP_I[i]-                                /*  1.16 */
     (((INVSQ_LOOKUP_I[i]-INVSQ_LOOKUP_I[i+1])*               /*  0.16 */
       d)>>16);                                               /* result 1.16 */
-  
+
   e+=32;
   if(e&1)val=(val*5792)>>13; /* multiply val by 1/sqrt(2) */
   e=(e>>1)-8;
@@ -88,7 +88,7 @@ long vorbis_coslook_i(long a){
   int i=a>>COS_LOOKUP_I_SHIFT;
   int d=a&COS_LOOKUP_I_MASK;
   return COS_LOOKUP_I[i]- ((d*(COS_LOOKUP_I[i]-COS_LOOKUP_I[i+1]))>>
-			   COS_LOOKUP_I_SHIFT);
+                           COS_LOOKUP_I_SHIFT);
 }
 
 #endif

+ 3 - 3
Engine/lib/libvorbis/lib/lookup.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: lookup based functions
-  last mod: $Id: lookup.h 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lookup.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -27,6 +27,6 @@ extern float vorbis_fromdBlook(float a);
 extern long vorbis_invsqlook_i(long a,long e);
 extern long vorbis_coslook_i(long a);
 extern float vorbis_fromdBlook_i(long a);
-#endif 
+#endif
 
 #endif

+ 137 - 134
Engine/lib/libvorbis/lib/lookup_data.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: lookup data; generated by lookups.pl; edit there
-  last mod: $Id: lookup_data.h 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lookup_data.h 16037 2009-05-26 21:10:58Z xiphmont $
 
  ********************************************************************/
 
@@ -19,76 +19,76 @@
 
 #ifdef FLOAT_LOOKUP
 #define COS_LOOKUP_SZ 128
-static float COS_LOOKUP[COS_LOOKUP_SZ+1]={
-	+1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f,
-	+0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f,
-	+0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f,
-	+0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f,
-	+0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f,
-	+0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f,
-	+0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f,
-	+0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f,
-	+0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f,
-	+0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f,
-	+0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f,
-	+0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f,
-	+0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f,
-	+0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f,
-	+0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f,
-	+0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f,
-	+0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f,
-	-0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f,
-	-0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f,
-	-0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f,
-	-0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f,
-	-0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f,
-	-0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f,
-	-0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f,
-	-0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f,
-	-0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f,
-	-0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f,
-	-0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f,
-	-0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f,
-	-0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f,
-	-0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f,
-	-0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f,
-	-1.0000000000000f,
+static const float COS_LOOKUP[COS_LOOKUP_SZ+1]={
+        +1.0000000000000f,+0.9996988186962f,+0.9987954562052f,+0.9972904566787f,
+        +0.9951847266722f,+0.9924795345987f,+0.9891765099648f,+0.9852776423889f,
+        +0.9807852804032f,+0.9757021300385f,+0.9700312531945f,+0.9637760657954f,
+        +0.9569403357322f,+0.9495281805930f,+0.9415440651830f,+0.9329927988347f,
+        +0.9238795325113f,+0.9142097557035f,+0.9039892931234f,+0.8932243011955f,
+        +0.8819212643484f,+0.8700869911087f,+0.8577286100003f,+0.8448535652497f,
+        +0.8314696123025f,+0.8175848131516f,+0.8032075314806f,+0.7883464276266f,
+        +0.7730104533627f,+0.7572088465065f,+0.7409511253550f,+0.7242470829515f,
+        +0.7071067811865f,+0.6895405447371f,+0.6715589548470f,+0.6531728429538f,
+        +0.6343932841636f,+0.6152315905806f,+0.5956993044924f,+0.5758081914178f,
+        +0.5555702330196f,+0.5349976198871f,+0.5141027441932f,+0.4928981922298f,
+        +0.4713967368260f,+0.4496113296546f,+0.4275550934303f,+0.4052413140050f,
+        +0.3826834323651f,+0.3598950365350f,+0.3368898533922f,+0.3136817403989f,
+        +0.2902846772545f,+0.2667127574749f,+0.2429801799033f,+0.2191012401569f,
+        +0.1950903220161f,+0.1709618887603f,+0.1467304744554f,+0.1224106751992f,
+        +0.0980171403296f,+0.0735645635997f,+0.0490676743274f,+0.0245412285229f,
+        +0.0000000000000f,-0.0245412285229f,-0.0490676743274f,-0.0735645635997f,
+        -0.0980171403296f,-0.1224106751992f,-0.1467304744554f,-0.1709618887603f,
+        -0.1950903220161f,-0.2191012401569f,-0.2429801799033f,-0.2667127574749f,
+        -0.2902846772545f,-0.3136817403989f,-0.3368898533922f,-0.3598950365350f,
+        -0.3826834323651f,-0.4052413140050f,-0.4275550934303f,-0.4496113296546f,
+        -0.4713967368260f,-0.4928981922298f,-0.5141027441932f,-0.5349976198871f,
+        -0.5555702330196f,-0.5758081914178f,-0.5956993044924f,-0.6152315905806f,
+        -0.6343932841636f,-0.6531728429538f,-0.6715589548470f,-0.6895405447371f,
+        -0.7071067811865f,-0.7242470829515f,-0.7409511253550f,-0.7572088465065f,
+        -0.7730104533627f,-0.7883464276266f,-0.8032075314806f,-0.8175848131516f,
+        -0.8314696123025f,-0.8448535652497f,-0.8577286100003f,-0.8700869911087f,
+        -0.8819212643484f,-0.8932243011955f,-0.9039892931234f,-0.9142097557035f,
+        -0.9238795325113f,-0.9329927988347f,-0.9415440651830f,-0.9495281805930f,
+        -0.9569403357322f,-0.9637760657954f,-0.9700312531945f,-0.9757021300385f,
+        -0.9807852804032f,-0.9852776423889f,-0.9891765099648f,-0.9924795345987f,
+        -0.9951847266722f,-0.9972904566787f,-0.9987954562052f,-0.9996988186962f,
+        -1.0000000000000f,
 };
 
 #define INVSQ_LOOKUP_SZ 32
-static float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={
-	1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f,
-	1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f,
-	1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f,
-	1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f,
-	1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f,
-	1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f,
-	1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f,
-	1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f,
-	1.000000000000f,
+static const float INVSQ_LOOKUP[INVSQ_LOOKUP_SZ+1]={
+        1.414213562373f,1.392621247646f,1.371988681140f,1.352246807566f,
+        1.333333333333f,1.315191898443f,1.297771369046f,1.281025230441f,
+        1.264911064067f,1.249390095109f,1.234426799697f,1.219988562661f,
+        1.206045378311f,1.192569588000f,1.179535649239f,1.166919931983f,
+        1.154700538379f,1.142857142857f,1.131370849898f,1.120224067222f,
+        1.109400392450f,1.098884511590f,1.088662107904f,1.078719779941f,
+        1.069044967650f,1.059625885652f,1.050451462878f,1.041511287847f,
+        1.032795558989f,1.024295039463f,1.016001016002f,1.007905261358f,
+        1.000000000000f,
 };
 
 #define INVSQ2EXP_LOOKUP_MIN (-32)
 #define INVSQ2EXP_LOOKUP_MAX 32
-static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
+static const float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
                               INVSQ2EXP_LOOKUP_MIN+1]={
-	         65536.f,    46340.95001f,         32768.f,    23170.47501f,
-	         16384.f,     11585.2375f,          8192.f,    5792.618751f,
-	          4096.f,    2896.309376f,          2048.f,    1448.154688f,
-	          1024.f,    724.0773439f,           512.f,     362.038672f,
-	           256.f,     181.019336f,           128.f,    90.50966799f,
-	            64.f,      45.254834f,            32.f,      22.627417f,
-	            16.f,     11.3137085f,             8.f,    5.656854249f,
-	             4.f,    2.828427125f,             2.f,    1.414213562f,
-	             1.f,   0.7071067812f,            0.5f,   0.3535533906f,
-	           0.25f,   0.1767766953f,          0.125f,  0.08838834765f,
-	         0.0625f,  0.04419417382f,        0.03125f,  0.02209708691f,
-	       0.015625f,  0.01104854346f,      0.0078125f, 0.005524271728f,
-	     0.00390625f, 0.002762135864f,    0.001953125f, 0.001381067932f,
-	   0.0009765625f, 0.000690533966f,  0.00048828125f, 0.000345266983f,
-	 0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f,
-	6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f,
-	1.525878906e-05f,
+                 65536.f,    46340.95001f,         32768.f,    23170.47501f,
+                 16384.f,     11585.2375f,          8192.f,    5792.618751f,
+                  4096.f,    2896.309376f,          2048.f,    1448.154688f,
+                  1024.f,    724.0773439f,           512.f,     362.038672f,
+                   256.f,     181.019336f,           128.f,    90.50966799f,
+                    64.f,      45.254834f,            32.f,      22.627417f,
+                    16.f,     11.3137085f,             8.f,    5.656854249f,
+                     4.f,    2.828427125f,             2.f,    1.414213562f,
+                     1.f,   0.7071067812f,            0.5f,   0.3535533906f,
+                   0.25f,   0.1767766953f,          0.125f,  0.08838834765f,
+                 0.0625f,  0.04419417382f,        0.03125f,  0.02209708691f,
+               0.015625f,  0.01104854346f,      0.0078125f, 0.005524271728f,
+             0.00390625f, 0.002762135864f,    0.001953125f, 0.001381067932f,
+           0.0009765625f, 0.000690533966f,  0.00048828125f, 0.000345266983f,
+         0.000244140625f,0.0001726334915f,0.0001220703125f,8.631674575e-05f,
+        6.103515625e-05f,4.315837288e-05f,3.051757812e-05f,2.157918644e-05f,
+        1.525878906e-05f,
 };
 
 #endif
@@ -98,90 +98,93 @@ static float INVSQ2EXP_LOOKUP[INVSQ2EXP_LOOKUP_MAX-\
 #define FROMdB_SHIFT 5
 #define FROMdB2_SHIFT 3
 #define FROMdB2_MASK 31
-static float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
-	             1.f,   0.6309573445f,   0.3981071706f,   0.2511886432f,
-	   0.1584893192f,            0.1f,  0.06309573445f,  0.03981071706f,
-	  0.02511886432f,  0.01584893192f,           0.01f, 0.006309573445f,
-	 0.003981071706f, 0.002511886432f, 0.001584893192f,          0.001f,
-	0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f,
-	         0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f,
-	1.584893192e-05f,          1e-05f,6.309573445e-06f,3.981071706e-06f,
-	2.511886432e-06f,1.584893192e-06f,          1e-06f,6.309573445e-07f,
-	3.981071706e-07f,2.511886432e-07f,1.584893192e-07f,
+
+#ifdef FLOAT_LOOKUP
+static const float FROMdB_LOOKUP[FROMdB_LOOKUP_SZ]={
+                     1.f,   0.6309573445f,   0.3981071706f,   0.2511886432f,
+           0.1584893192f,            0.1f,  0.06309573445f,  0.03981071706f,
+          0.02511886432f,  0.01584893192f,           0.01f, 0.006309573445f,
+         0.003981071706f, 0.002511886432f, 0.001584893192f,          0.001f,
+        0.0006309573445f,0.0003981071706f,0.0002511886432f,0.0001584893192f,
+                 0.0001f,6.309573445e-05f,3.981071706e-05f,2.511886432e-05f,
+        1.584893192e-05f,          1e-05f,6.309573445e-06f,3.981071706e-06f,
+        2.511886432e-06f,1.584893192e-06f,          1e-06f,6.309573445e-07f,
+        3.981071706e-07f,2.511886432e-07f,1.584893192e-07f,
 };
 
-static float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
-	   0.9928302478f,   0.9786445908f,   0.9646616199f,   0.9508784391f,
-	   0.9372921937f,     0.92390007f,   0.9106992942f,   0.8976871324f,
-	   0.8848608897f,   0.8722179097f,   0.8597555737f,   0.8474713009f,
-	    0.835362547f,   0.8234268041f,   0.8116616003f,   0.8000644989f,
-	   0.7886330981f,   0.7773650302f,   0.7662579617f,    0.755309592f,
-	   0.7445176537f,   0.7338799116f,   0.7233941627f,   0.7130582353f,
-	   0.7028699885f,   0.6928273125f,   0.6829281272f,   0.6731703824f,
-	   0.6635520573f,   0.6540711597f,   0.6447257262f,   0.6355138211f,
+static const float FROMdB2_LOOKUP[FROMdB2_LOOKUP_SZ]={
+           0.9928302478f,   0.9786445908f,   0.9646616199f,   0.9508784391f,
+           0.9372921937f,     0.92390007f,   0.9106992942f,   0.8976871324f,
+           0.8848608897f,   0.8722179097f,   0.8597555737f,   0.8474713009f,
+            0.835362547f,   0.8234268041f,   0.8116616003f,   0.8000644989f,
+           0.7886330981f,   0.7773650302f,   0.7662579617f,    0.755309592f,
+           0.7445176537f,   0.7338799116f,   0.7233941627f,   0.7130582353f,
+           0.7028699885f,   0.6928273125f,   0.6829281272f,   0.6731703824f,
+           0.6635520573f,   0.6540711597f,   0.6447257262f,   0.6355138211f,
 };
+#endif
 
 #ifdef INT_LOOKUP
 
 #define INVSQ_LOOKUP_I_SHIFT 10
 #define INVSQ_LOOKUP_I_MASK 1023
-static long INVSQ_LOOKUP_I[64+1]={
-	   92682l,   91966l,   91267l,   90583l,
-	   89915l,   89261l,   88621l,   87995l,
-	   87381l,   86781l,   86192l,   85616l,
-	   85051l,   84497l,   83953l,   83420l,
-	   82897l,   82384l,   81880l,   81385l,
-	   80899l,   80422l,   79953l,   79492l,
-	   79039l,   78594l,   78156l,   77726l,
-	   77302l,   76885l,   76475l,   76072l,
-	   75674l,   75283l,   74898l,   74519l,
-	   74146l,   73778l,   73415l,   73058l,
-	   72706l,   72359l,   72016l,   71679l,
-	   71347l,   71019l,   70695l,   70376l,
-	   70061l,   69750l,   69444l,   69141l,
-	   68842l,   68548l,   68256l,   67969l,
-	   67685l,   67405l,   67128l,   66855l,
-	   66585l,   66318l,   66054l,   65794l,
-	   65536l,
+static const long INVSQ_LOOKUP_I[64+1]={
+           92682l,   91966l,   91267l,   90583l,
+           89915l,   89261l,   88621l,   87995l,
+           87381l,   86781l,   86192l,   85616l,
+           85051l,   84497l,   83953l,   83420l,
+           82897l,   82384l,   81880l,   81385l,
+           80899l,   80422l,   79953l,   79492l,
+           79039l,   78594l,   78156l,   77726l,
+           77302l,   76885l,   76475l,   76072l,
+           75674l,   75283l,   74898l,   74519l,
+           74146l,   73778l,   73415l,   73058l,
+           72706l,   72359l,   72016l,   71679l,
+           71347l,   71019l,   70695l,   70376l,
+           70061l,   69750l,   69444l,   69141l,
+           68842l,   68548l,   68256l,   67969l,
+           67685l,   67405l,   67128l,   66855l,
+           66585l,   66318l,   66054l,   65794l,
+           65536l,
 };
 
 #define COS_LOOKUP_I_SHIFT 9
 #define COS_LOOKUP_I_MASK 511
 #define COS_LOOKUP_I_SZ 128
-static long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
-	   16384l,   16379l,   16364l,   16340l,
-	   16305l,   16261l,   16207l,   16143l,
-	   16069l,   15986l,   15893l,   15791l,
-	   15679l,   15557l,   15426l,   15286l,
-	   15137l,   14978l,   14811l,   14635l,
-	   14449l,   14256l,   14053l,   13842l,
-	   13623l,   13395l,   13160l,   12916l,
-	   12665l,   12406l,   12140l,   11866l,
-	   11585l,   11297l,   11003l,   10702l,
-	   10394l,   10080l,    9760l,    9434l,
-	    9102l,    8765l,    8423l,    8076l,
-	    7723l,    7366l,    7005l,    6639l,
-	    6270l,    5897l,    5520l,    5139l,
-	    4756l,    4370l,    3981l,    3590l,
-	    3196l,    2801l,    2404l,    2006l,
-	    1606l,    1205l,     804l,     402l,
-	       0l,    -401l,    -803l,   -1204l,
-	   -1605l,   -2005l,   -2403l,   -2800l,
-	   -3195l,   -3589l,   -3980l,   -4369l,
-	   -4755l,   -5138l,   -5519l,   -5896l,
-	   -6269l,   -6638l,   -7004l,   -7365l,
-	   -7722l,   -8075l,   -8422l,   -8764l,
-	   -9101l,   -9433l,   -9759l,  -10079l,
-	  -10393l,  -10701l,  -11002l,  -11296l,
-	  -11584l,  -11865l,  -12139l,  -12405l,
-	  -12664l,  -12915l,  -13159l,  -13394l,
-	  -13622l,  -13841l,  -14052l,  -14255l,
-	  -14448l,  -14634l,  -14810l,  -14977l,
-	  -15136l,  -15285l,  -15425l,  -15556l,
-	  -15678l,  -15790l,  -15892l,  -15985l,
-	  -16068l,  -16142l,  -16206l,  -16260l,
-	  -16304l,  -16339l,  -16363l,  -16378l,
-	  -16383l,
+static const long COS_LOOKUP_I[COS_LOOKUP_I_SZ+1]={
+           16384l,   16379l,   16364l,   16340l,
+           16305l,   16261l,   16207l,   16143l,
+           16069l,   15986l,   15893l,   15791l,
+           15679l,   15557l,   15426l,   15286l,
+           15137l,   14978l,   14811l,   14635l,
+           14449l,   14256l,   14053l,   13842l,
+           13623l,   13395l,   13160l,   12916l,
+           12665l,   12406l,   12140l,   11866l,
+           11585l,   11297l,   11003l,   10702l,
+           10394l,   10080l,    9760l,    9434l,
+            9102l,    8765l,    8423l,    8076l,
+            7723l,    7366l,    7005l,    6639l,
+            6270l,    5897l,    5520l,    5139l,
+            4756l,    4370l,    3981l,    3590l,
+            3196l,    2801l,    2404l,    2006l,
+            1606l,    1205l,     804l,     402l,
+               0l,    -401l,    -803l,   -1204l,
+           -1605l,   -2005l,   -2403l,   -2800l,
+           -3195l,   -3589l,   -3980l,   -4369l,
+           -4755l,   -5138l,   -5519l,   -5896l,
+           -6269l,   -6638l,   -7004l,   -7365l,
+           -7722l,   -8075l,   -8422l,   -8764l,
+           -9101l,   -9433l,   -9759l,  -10079l,
+          -10393l,  -10701l,  -11002l,  -11296l,
+          -11584l,  -11865l,  -12139l,  -12405l,
+          -12664l,  -12915l,  -13159l,  -13394l,
+          -13622l,  -13841l,  -14052l,  -14255l,
+          -14448l,  -14634l,  -14810l,  -14977l,
+          -15136l,  -15285l,  -15425l,  -15556l,
+          -15678l,  -15790l,  -15892l,  -15985l,
+          -16068l,  -16142l,  -16206l,  -16260l,
+          -16304l,  -16339l,  -16363l,  -16378l,
+          -16383l,
 };
 
 #endif

+ 31 - 20
Engine/lib/libvorbis/lib/lpc.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.c 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lpc.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -62,6 +62,7 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
   double *aut=alloca(sizeof(*aut)*(m+1));
   double *lpc=alloca(sizeof(*lpc)*(m));
   double error;
+  double epsilon;
   int i,j;
 
   /* autocorrelation, p+1 lag coefficients */
@@ -71,17 +72,19 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
     for(i=j;i<n;i++)d+=(double)data[i]*data[i-j];
     aut[j]=d;
   }
-  
+
   /* Generate lpc coefficients from autocorr values */
 
-  error=aut[0];
-  
+  /* set our noise floor to about -100dB */
+  error=aut[0] * (1. + 1e-10);
+  epsilon=1e-9*aut[0]+1e-10;
+
   for(i=0;i<m;i++){
     double r= -aut[i+1];
 
-    if(error==0){
-      memset(lpci,0,m*sizeof(*lpci));
-      return 0;
+    if(error<epsilon){
+      memset(lpc+i,0,(m-i)*sizeof(*lpc));
+      goto done;
     }
 
     /* Sum up this iteration's reflection coefficient; note that in
@@ -90,10 +93,10 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
        each iteration. */
 
     for(j=0;j<i;j++)r-=lpc[j]*aut[i-j];
-    r/=error; 
+    r/=error;
 
     /* Update LPC coefficients and total error */
-    
+
     lpc[i]=r;
     for(j=0;j<i/2;j++){
       double tmp=lpc[j];
@@ -101,23 +104,36 @@ float vorbis_lpc_from_data(float *data,float *lpci,int n,int m){
       lpc[j]+=r*lpc[i-1-j];
       lpc[i-1-j]+=r*tmp;
     }
-    if(i%2)lpc[j]+=lpc[j]*r;
+    if(i&1)lpc[j]+=lpc[j]*r;
+
+    error*=1.-r*r;
 
-    error*=1.f-r*r;
+  }
+
+ done:
+
+  /* slightly damp the filter */
+  {
+    double g = .99;
+    double damp = g;
+    for(j=0;j<m;j++){
+      lpc[j]*=damp;
+      damp*=g;
+    }
   }
 
   for(j=0;j<m;j++)lpci[j]=(float)lpc[j];
 
   /* we need the error value to know how big an impulse to hit the
      filter with later */
-  
+
   return error;
 }
 
 void vorbis_lpc_predict(float *coeff,float *prime,int m,
                      float *data,long n){
 
-  /* in: coeff[0...m-1] LPC coefficients 
+  /* in: coeff[0...m-1] LPC coefficients
          prime[0...m-1] initial values (allocated size of n+m-1)
     out: data[0...n-1] data samples */
 
@@ -138,12 +154,7 @@ void vorbis_lpc_predict(float *coeff,float *prime,int m,
     p=m;
     for(j=0;j<m;j++)
       y-=work[o++]*coeff[--p];
-    
+
     data[i]=work[o]=y;
   }
 }
-
-
-
-
-

+ 2 - 2
Engine/lib/libvorbis/lib/lpc.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: LPC low level routines
-  last mod: $Id: lpc.h 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lpc.h 16037 2009-05-26 21:10:58Z xiphmont $
 
  ********************************************************************/
 
@@ -24,6 +24,6 @@
 extern float vorbis_lpc_from_data(float *data,float *lpc,int n,int m);
 
 extern void vorbis_lpc_predict(float *coeff,float *prime,int m,
-			       float *data,long n);
+                               float *data,long n);
 
 #endif

+ 58 - 57
Engine/lib/libvorbis/lib/lsp.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.c 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lsp.c 17538 2010-10-15 02:52:29Z tterribe $
 
   The LSP generation code is taken (with minimal modification and a
   few bugfixes) from "On the Computation of the LSP Frequencies" by
@@ -46,14 +46,15 @@
    implementation.  The float lookup is likely the optimal choice on
    any machine with an FPU.  The integer implementation is *not* fixed
    point (due to the need for a large dynamic range and thus a
-   seperately tracked exponent) and thus much more complex than the
+   separately tracked exponent) and thus much more complex than the
    relatively simple float implementations. It's mostly for future
    work on a fully fixed point implementation for processors like the
    ARM family. */
 
-/* undefine both for the 'old' but more precise implementation */
-#define   FLOAT_LOOKUP
-#undef    INT_LOOKUP
+/* define either of these (preferably FLOAT_LOOKUP) to have faster
+   but less precise implementation. */
+#undef FLOAT_LOOKUP
+#undef INT_LOOKUP
 
 #ifdef FLOAT_LOOKUP
 #include "lookup.c" /* catch this in the build system; we #include for
@@ -62,11 +63,11 @@
 
 /* side effect: changes *lsp to cosines of lsp */
 void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
-			    float amp,float ampoffset){
+                            float amp,float ampoffset){
   int i;
   float wdel=M_PI/ln;
   vorbis_fpu_control fpu;
-  
+
   vorbis_fpu_setround(&fpu);
   for(i=0;i<m;i++)lsp[i]=vorbis_coslook(lsp[i]);
 
@@ -80,11 +81,11 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
     float *ftmp=lsp;
     int c=m>>1;
 
-    do{
+    while(c--){
       q*=ftmp[0]-w;
       p*=ftmp[1]-w;
       ftmp+=2;
-    }while(--c);
+    }
 
     if(m&1){
       /* odd order filter; slightly assymetric */
@@ -99,10 +100,10 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
     }
 
     q=frexp(p+q,&qexp);
-    q=vorbis_fromdBlook(amp*             
-			vorbis_invsqlook(q)*
-			vorbis_invsq2explook(qexp+m)- 
-			ampoffset);
+    q=vorbis_fromdBlook(amp*
+                        vorbis_invsqlook(q)*
+                        vorbis_invsq2explook(qexp+m)-
+                        ampoffset);
 
     do{
       curve[i++]*=q;
@@ -118,26 +119,26 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
                        compilers (like gcc) that can't inline across
                        modules */
 
-static int MLOOP_1[64]={
+static const int MLOOP_1[64]={
    0,10,11,11, 12,12,12,12, 13,13,13,13, 13,13,13,13,
   14,14,14,14, 14,14,14,14, 14,14,14,14, 14,14,14,14,
   15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
   15,15,15,15, 15,15,15,15, 15,15,15,15, 15,15,15,15,
 };
 
-static int MLOOP_2[64]={
+static const int MLOOP_2[64]={
   0,4,5,5, 6,6,6,6, 7,7,7,7, 7,7,7,7,
   8,8,8,8, 8,8,8,8, 8,8,8,8, 8,8,8,8,
   9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
   9,9,9,9, 9,9,9,9, 9,9,9,9, 9,9,9,9,
 };
 
-static int MLOOP_3[8]={0,1,2,2,3,3,3,3};
+static const int MLOOP_3[8]={0,1,2,2,3,3,3,3};
 
 
 /* side effect: changes *lsp to cosines of lsp */
 void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
-			    float amp,float ampoffset){
+                            float amp,float ampoffset){
 
   /* 0 <= m < 256 */
 
@@ -161,15 +162,15 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
 
     for(j=3;j<m;j+=2){
       if(!(shift=MLOOP_1[(pi|qi)>>25]))
-	if(!(shift=MLOOP_2[(pi|qi)>>19]))
-	  shift=MLOOP_3[(pi|qi)>>16];
+        if(!(shift=MLOOP_2[(pi|qi)>>19]))
+          shift=MLOOP_3[(pi|qi)>>16];
       qi=(qi>>shift)*labs(ilsp[j-1]-wi);
       pi=(pi>>shift)*labs(ilsp[j]-wi);
       qexp+=shift;
     }
     if(!(shift=MLOOP_1[(pi|qi)>>25]))
       if(!(shift=MLOOP_2[(pi|qi)>>19]))
-	shift=MLOOP_3[(pi|qi)>>16];
+        shift=MLOOP_3[(pi|qi)>>16];
 
     /* pi,qi normalized collectively, both tracked using qexp */
 
@@ -181,9 +182,9 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
       qexp+=shift;
 
       if(!(shift=MLOOP_1[(pi|qi)>>25]))
-	if(!(shift=MLOOP_2[(pi|qi)>>19]))
-	  shift=MLOOP_3[(pi|qi)>>16];
-      
+        if(!(shift=MLOOP_2[(pi|qi)>>19]))
+          shift=MLOOP_3[(pi|qi)>>16];
+
       pi>>=shift;
       qi>>=shift;
       qexp+=shift-14*((m+1)>>1);
@@ -199,8 +200,8 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
       /* even order filter; still symmetric */
 
       /* p*=p(1-w), q*=q(1+w), let normalization drift because it isn't
-	 worth tracking step by step */
-      
+         worth tracking step by step */
+
       pi>>=shift;
       qi>>=shift;
       qexp+=shift-7*m;
@@ -208,36 +209,36 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
       pi=((pi*pi)>>16);
       qi=((qi*qi)>>16);
       qexp=qexp*2+m;
-      
+
       pi*=(1<<14)-wi;
       qi*=(1<<14)+wi;
       qi=(qi+pi)>>14;
-      
+
     }
-    
+
 
     /* we've let the normalization drift because it wasn't important;
        however, for the lookup, things must be normalized again.  We
        need at most one right shift or a number of left shifts */
 
     if(qi&0xffff0000){ /* checks for 1.xxxxxxxxxxxxxxxx */
-      qi>>=1; qexp++; 
+      qi>>=1; qexp++;
     }else
       while(qi && !(qi&0x8000)){ /* checks for 0.0xxxxxxxxxxxxxxx or less*/
-	qi<<=1; qexp--; 
+        qi<<=1; qexp--;
       }
 
     amp=vorbis_fromdBlook_i(ampi*                     /*  n.4         */
-			    vorbis_invsqlook_i(qi,qexp)- 
-			                              /*  m.8, m+n<=8 */
-			    ampoffseti);              /*  8.12[0]     */
+                            vorbis_invsqlook_i(qi,qexp)-
+                                                      /*  m.8, m+n<=8 */
+                            ampoffseti);              /*  8.12[0]     */
 
     curve[i]*=amp;
     while(map[++i]==k)curve[i]*=amp;
   }
 }
 
-#else 
+#else
 
 /* old, nonoptimized but simple version for any poor sap who needs to
    figure out what the hell this code does, or wants the other
@@ -245,7 +246,7 @@ void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
 
 /* side effect: changes *lsp to cosines of lsp */
 void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,float *lsp,int m,
-			    float amp,float ampoffset){
+                            float amp,float ampoffset){
   int i;
   float wdel=M_PI/ln;
   for(i=0;i<m;i++)lsp[i]=2.f*cos(lsp[i]);
@@ -289,7 +290,7 @@ static void cheby(float *g, int ord) {
   for(i=2; i<= ord; i++) {
     for(j=ord; j >= i; j--) {
       g[j-2] -= g[j];
-      g[j] += g[j]; 
+      g[j] += g[j];
     }
   }
 }
@@ -318,25 +319,25 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
     /* iterate a root */
     while(1){
       double p=defl[m],pp=0.f,ppp=0.f,denom;
-      
+
       /* eval the polynomial and its first two derivatives */
       for(i=m;i>0;i--){
-	ppp = new*ppp + pp;
-	pp  = new*pp  + p;
-	p   = new*p   + defl[i-1];
+        ppp = new*ppp + pp;
+        pp  = new*pp  + p;
+        p   = new*p   + defl[i-1];
       }
-      
+
       /* Laguerre's method */
       denom=(m-1) * ((m-1)*pp*pp - m*p*ppp);
       if(denom<0)
-	return(-1);  /* complex root!  The LPC generator handed us a bad filter */
+        return(-1);  /* complex root!  The LPC generator handed us a bad filter */
 
       if(pp>0){
-	denom = pp + sqrt(denom);
-	if(denom<EPSILON)denom=EPSILON;
+        denom = pp + sqrt(denom);
+        if(denom<EPSILON)denom=EPSILON;
       }else{
-	denom = pp - sqrt(denom);
-	if(denom>-(EPSILON))denom=-(EPSILON);
+        denom = pp - sqrt(denom);
+        if(denom>-(EPSILON))denom=-(EPSILON);
       }
 
       delta  = m*p/denom;
@@ -344,14 +345,14 @@ static int Laguerre_With_Deflation(float *a,int ord,float *r){
 
       if(delta<0.f)delta*=-1;
 
-      if(fabs(delta/new)<10e-12)break; 
+      if(fabs(delta/new)<10e-12)break;
       lastdelta=delta;
     }
 
     r[m-1]=new;
 
     /* forward deflation */
-    
+
     for(i=m;i>0;i--)
       defl[i-1]+=new*defl[i];
     defl++;
@@ -368,27 +369,27 @@ static int Newton_Raphson(float *a,int ord,float *r){
   double *root=alloca(ord*sizeof(*root));
 
   for(i=0; i<ord;i++) root[i] = r[i];
-  
+
   while(error>1e-20){
     error=0;
-    
+
     for(i=0; i<ord; i++) { /* Update each point. */
       double pp=0.,delta;
       double rooti=root[i];
       double p=a[ord];
       for(k=ord-1; k>= 0; k--) {
 
-	pp= pp* rooti + p;
-	p = p * rooti + a[k];
+        pp= pp* rooti + p;
+        p = p * rooti + a[k];
       }
 
       delta = p/pp;
       root[i] -= delta;
       error+= delta*delta;
     }
-    
+
     if(count>40)return(-1);
-     
+
     count++;
   }
 
@@ -418,12 +419,12 @@ int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m){
   /* Compute the first half of K & R F1 & F2 polynomials. */
   /* Compute half of the symmetric and antisymmetric polynomials. */
   /* Remove the roots at +1 and -1. */
-  
+
   g1[g1_order] = 1.f;
   for(i=1;i<=g1_order;i++) g1[g1_order-i] = lpc[i-1]+lpc[m-i];
   g2[g2_order] = 1.f;
   for(i=1;i<=g2_order;i++) g2[g2_order-i] = lpc[i-1]-lpc[m-i];
-  
+
   if(g1_order>g2_order){
     for(i=2; i<=g2_order;i++) g2[g2_order-i] += g2[g2_order-i+2];
   }else{

+ 5 - 5
Engine/lib/libvorbis/lib/lsp.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
   function: LSP (also called LSF) conversion routines
-  last mod: $Id: lsp.h 13293 2007-07-24 00:09:47Z xiphmont $
+  last mod: $Id: lsp.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -22,7 +22,7 @@
 extern int vorbis_lpc_to_lsp(float *lpc,float *lsp,int m);
 
 extern void vorbis_lsp_to_curve(float *curve,int *map,int n,int ln,
-				float *lsp,int m,
-				float amp,float ampoffset);
-  
+                                float *lsp,int m,
+                                float amp,float ampoffset);
+
 #endif

+ 325 - 353
Engine/lib/libvorbis/lib/mapping0.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: channel mapping 0 implementation
- last mod: $Id: mapping0.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: mapping0.c 17022 2010-03-25 03:45:42Z xiphmont $
 
  ********************************************************************/
 
@@ -56,7 +56,7 @@ static int ilog(unsigned int v){
 }
 
 static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
-			  oggpack_buffer *opb){
+                          oggpack_buffer *opb){
   int i;
   vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)vm;
 
@@ -76,14 +76,14 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
   if(info->coupling_steps>0){
     oggpack_write(opb,1,1);
     oggpack_write(opb,info->coupling_steps-1,8);
-    
+
     for(i=0;i<info->coupling_steps;i++){
       oggpack_write(opb,info->coupling_mag[i],ilog(vi->channels));
       oggpack_write(opb,info->coupling_ang[i],ilog(vi->channels));
     }
   }else
     oggpack_write(opb,0,1);
-  
+
   oggpack_write(opb,0,2); /* 2,3:reserved */
 
   /* we don't write the channel submappings if we only have one... */
@@ -100,46 +100,51 @@ static void mapping0_pack(vorbis_info *vi,vorbis_info_mapping *vm,
 
 /* also responsible for range checking */
 static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb){
-  int i;
+  int i,b;
   vorbis_info_mapping0 *info=_ogg_calloc(1,sizeof(*info));
   codec_setup_info     *ci=vi->codec_setup;
   memset(info,0,sizeof(*info));
 
-  if(oggpack_read(opb,1))
+  b=oggpack_read(opb,1);
+  if(b<0)goto err_out;
+  if(b){
     info->submaps=oggpack_read(opb,4)+1;
-  else
+    if(info->submaps<=0)goto err_out;
+  }else
     info->submaps=1;
 
-  if(oggpack_read(opb,1)){
+  b=oggpack_read(opb,1);
+  if(b<0)goto err_out;
+  if(b){
     info->coupling_steps=oggpack_read(opb,8)+1;
-
+    if(info->coupling_steps<=0)goto err_out;
     for(i=0;i<info->coupling_steps;i++){
       int testM=info->coupling_mag[i]=oggpack_read(opb,ilog(vi->channels));
       int testA=info->coupling_ang[i]=oggpack_read(opb,ilog(vi->channels));
 
-      if(testM<0 || 
-	 testA<0 || 
-	 testM==testA || 
-	 testM>=vi->channels ||
-	 testA>=vi->channels) goto err_out;
+      if(testM<0 ||
+         testA<0 ||
+         testM==testA ||
+         testM>=vi->channels ||
+         testA>=vi->channels) goto err_out;
     }
 
   }
 
-  if(oggpack_read(opb,2)>0)goto err_out; /* 2,3:reserved */
-    
+  if(oggpack_read(opb,2)!=0)goto err_out; /* 2,3:reserved */
+
   if(info->submaps>1){
     for(i=0;i<vi->channels;i++){
       info->chmuxlist[i]=oggpack_read(opb,4);
-      if(info->chmuxlist[i]>=info->submaps)goto err_out;
+      if(info->chmuxlist[i]>=info->submaps || info->chmuxlist[i]<0)goto err_out;
     }
   }
   for(i=0;i<info->submaps;i++){
     oggpack_read(opb,8); /* time submap unused */
     info->floorsubmap[i]=oggpack_read(opb,8);
-    if(info->floorsubmap[i]>=ci->floors)goto err_out;
+    if(info->floorsubmap[i]>=ci->floors || info->floorsubmap[i]<0)goto err_out;
     info->residuesubmap[i]=oggpack_read(opb,8);
-    if(info->residuesubmap[i]>=ci->residues)goto err_out;
+    if(info->residuesubmap[i]>=ci->residues || info->residuesubmap[i]<0)goto err_out;
   }
 
   return info;
@@ -161,83 +166,73 @@ static vorbis_info_mapping *mapping0_unpack(vorbis_info *vi,oggpack_buffer *opb)
 static long seq=0;
 static ogg_int64_t total=0;
 static float FLOOR1_fromdB_LOOKUP[256]={
-  1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F, 
-  1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F, 
-  1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F, 
-  2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F, 
-  2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F, 
-  3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F, 
-  4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F, 
-  6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F, 
-  7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F, 
-  1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F, 
-  1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F, 
-  1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F, 
-  2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F, 
-  2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F, 
-  3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F, 
-  4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F, 
-  5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F, 
-  7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F, 
-  9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F, 
-  1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F, 
-  1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F, 
-  2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F, 
-  2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F, 
-  3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F, 
-  4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F, 
-  5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F, 
-  7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F, 
-  9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F, 
-  0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F, 
-  0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F, 
-  0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F, 
-  0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F, 
-  0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F, 
-  0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F, 
-  0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F, 
-  0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F, 
-  0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F, 
-  0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F, 
-  0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F, 
-  0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F, 
-  0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F, 
-  0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F, 
-  0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F, 
-  0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F, 
-  0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F, 
-  0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F, 
-  0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F, 
-  0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F, 
-  0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F, 
-  0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F, 
-  0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F, 
-  0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F, 
-  0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F, 
-  0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F, 
-  0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F, 
-  0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F, 
-  0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F, 
-  0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F, 
-  0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F, 
-  0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F, 
-  0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F, 
-  0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F, 
-  0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F, 
-  0.82788260F, 0.88168307F, 0.9389798F, 1.F, 
+  1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
+  1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
+  1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
+  2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
+  2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
+  3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
+  4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
+  6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
+  7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
+  1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
+  1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
+  1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
+  2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
+  2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
+  3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
+  4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
+  5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
+  7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
+  9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
+  1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
+  1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
+  2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
+  2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
+  3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
+  4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
+  5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
+  7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
+  9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
+  0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
+  0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
+  0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
+  0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
+  0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
+  0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
+  0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
+  0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
+  0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
+  0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
+  0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
+  0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
+  0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
+  0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
+  0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
+  0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
+  0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
+  0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
+  0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
+  0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
+  0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
+  0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
+  0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
+  0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
+  0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
+  0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
+  0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
+  0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
+  0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
+  0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
+  0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
+  0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
+  0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
+  0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
+  0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
+  0.82788260F, 0.88168307F, 0.9389798F, 1.F,
 };
 
-#endif 
-
-extern int *floor1_fit(vorbis_block *vb,vorbis_look_floor *look,
-		       const float *logmdct,   /* in */
-		       const float *logmask);
-extern int *floor1_interpolate_fit(vorbis_block *vb,vorbis_look_floor *look,
-				   int *A,int *B,
-				   int del);
-extern int floor1_encode(oggpack_buffer *opb,vorbis_block *vb,
-			 vorbis_look_floor *look,
-			 int *post,int *ilogmask);
+#endif
 
 
 static int mapping0_forward(vorbis_block *vb){
@@ -251,17 +246,16 @@ static int mapping0_forward(vorbis_block *vb){
 
   int    *nonzero    = alloca(sizeof(*nonzero)*vi->channels);
   float  **gmdct     = _vorbis_block_alloc(vb,vi->channels*sizeof(*gmdct));
-  int    **ilogmaskch= _vorbis_block_alloc(vb,vi->channels*sizeof(*ilogmaskch));
+  int    **iwork      = _vorbis_block_alloc(vb,vi->channels*sizeof(*iwork));
   int ***floor_posts = _vorbis_block_alloc(vb,vi->channels*sizeof(*floor_posts));
-  
+
   float global_ampmax=vbi->ampmax;
   float *local_ampmax=alloca(sizeof(*local_ampmax)*vi->channels);
   int blocktype=vbi->blocktype;
 
   int modenumber=vb->W;
   vorbis_info_mapping0 *info=ci->map_param[modenumber];
-  vorbis_look_psy *psy_look=
-    b->psy+blocktype+(vb->W?2:0);
+  vorbis_look_psy *psy_look=b->psy+blocktype+(vb->W?2:0);
 
   vb->mode=modenumber;
 
@@ -269,9 +263,10 @@ static int mapping0_forward(vorbis_block *vb){
     float scale=4.f/n;
     float scale_dB;
 
-    float *pcm     =vb->pcm[i]; 
+    float *pcm     =vb->pcm[i];
     float *logfft  =pcm;
 
+    iwork[i]=_vorbis_block_alloc(vb,n/2*sizeof(**iwork));
     gmdct[i]=_vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
 
     scale_dB=todB(&scale) + .345; /* + .345 is a hack; the original
@@ -290,28 +285,34 @@ static int mapping0_forward(vorbis_block *vb){
                                      next major model upgrade. */
 
 #if 0
-    if(vi->channels==2)
+    if(vi->channels==2){
       if(i==0)
-	_analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
+        _analysis_output("pcmL",seq,pcm,n,0,0,total-n/2);
       else
-	_analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
+        _analysis_output("pcmR",seq,pcm,n,0,0,total-n/2);
+    }else{
+      _analysis_output("pcm",seq,pcm,n,0,0,total-n/2);
+    }
 #endif
-  
+
     /* window the PCM data */
     _vorbis_apply_window(pcm,b->window,ci->blocksizes,vb->lW,vb->W,vb->nW);
 
 #if 0
-    if(vi->channels==2)
+    if(vi->channels==2){
       if(i==0)
-	_analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
+        _analysis_output("windowedL",seq,pcm,n,0,0,total-n/2);
       else
-	_analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
+        _analysis_output("windowedR",seq,pcm,n,0,0,total-n/2);
+    }else{
+      _analysis_output("windowed",seq,pcm,n,0,0,total-n/2);
+    }
 #endif
 
     /* transform the PCM data */
     /* only MDCT right now.... */
     mdct_forward(b->transform[vb->W][0],pcm,gmdct[i]);
-    
+
     /* FFT yields more accurate tonal estimation (not phase sensitive) */
     drft_forward(&b->fft_look[vb->W],pcm);
     logfft[0]=scale_dB+todB(pcm)  + .345; /* + .345 is a hack; the
@@ -355,29 +356,31 @@ static int mapping0_forward(vorbis_block *vb){
 #if 0
     if(vi->channels==2){
       if(i==0){
-	_analysis_output("fftL",seq,logfft,n/2,1,0,0);
+        _analysis_output("fftL",seq,logfft,n/2,1,0,0);
       }else{
-	_analysis_output("fftR",seq,logfft,n/2,1,0,0);
+        _analysis_output("fftR",seq,logfft,n/2,1,0,0);
       }
+    }else{
+      _analysis_output("fft",seq,logfft,n/2,1,0,0);
     }
 #endif
 
   }
-  
+
   {
     float   *noise        = _vorbis_block_alloc(vb,n/2*sizeof(*noise));
     float   *tone         = _vorbis_block_alloc(vb,n/2*sizeof(*tone));
-    
+
     for(i=0;i<vi->channels;i++){
       /* the encoder setup assumes that all the modes used by any
-	 specific bitrate tweaking use the same floor */
-      
+         specific bitrate tweaking use the same floor */
+
       int submap=info->chmuxlist[i];
-      
+
       /* the following makes things clearer to *me* anyway */
       float *mdct    =gmdct[i];
       float *logfft  =vb->pcm[i];
-      
+
       float *logmdct =logfft+n/2;
       float *logmask =logfft;
 
@@ -385,9 +388,9 @@ static int mapping0_forward(vorbis_block *vb){
 
       floor_posts[i]=_vorbis_block_alloc(vb,PACKETBLOBS*sizeof(**floor_posts));
       memset(floor_posts[i],0,sizeof(**floor_posts)*PACKETBLOBS);
-      
+
       for(j=0;j<n/2;j++)
-	logmdct[j]=todB(mdct+j)  + .345; /* + .345 is a hack; the original
+        logmdct[j]=todB(mdct+j)  + .345; /* + .345 is a hack; the original
                                      todB estimation used on IEEE 754
                                      compliant machines had a bug that
                                      returned dB values about a third
@@ -404,15 +407,15 @@ static int mapping0_forward(vorbis_block *vb){
 
 #if 0
       if(vi->channels==2){
-	if(i==0)
-	  _analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
-	else
-	  _analysis_output("mdctR",seq,logmdct,n/2,1,0,0);
+        if(i==0)
+          _analysis_output("mdctL",seq,logmdct,n/2,1,0,0);
+        else
+          _analysis_output("mdctR",seq,logmdct,n/2,1,0,0);
       }else{
-	_analysis_output("mdct",seq,logmdct,n/2,1,0,0);
+        _analysis_output("mdct",seq,logmdct,n/2,1,0,0);
       }
-#endif 
-      
+#endif
+
       /* first step; noise masking.  Not only does 'noise masking'
          give us curves from which we can decide how much resolution
          to give noise parts of the spectrum, it also implicitly hands
@@ -420,15 +423,17 @@ static int mapping0_forward(vorbis_block *vb){
          'noise_depth' vector, the more tonal that area is) */
 
       _vp_noisemask(psy_look,
-		    logmdct,
-		    noise); /* noise does not have by-frequency offset
+                    logmdct,
+                    noise); /* noise does not have by-frequency offset
                                bias applied yet */
 #if 0
       if(vi->channels==2){
-	if(i==0)
-	  _analysis_output("noiseL",seq,noise,n/2,1,0,0);
-	else
-	  _analysis_output("noiseR",seq,noise,n/2,1,0,0);
+        if(i==0)
+          _analysis_output("noiseL",seq,noise,n/2,1,0,0);
+        else
+          _analysis_output("noiseR",seq,noise,n/2,1,0,0);
+      }else{
+        _analysis_output("noise",seq,noise,n/2,1,0,0);
       }
 #endif
 
@@ -437,55 +442,61 @@ static int mapping0_forward(vorbis_block *vb){
          vector.  This includes tone masking, peak limiting and ATH */
 
       _vp_tonemask(psy_look,
-		   logfft,
-		   tone,
-		   global_ampmax,
-		   local_ampmax[i]);
+                   logfft,
+                   tone,
+                   global_ampmax,
+                   local_ampmax[i]);
 
 #if 0
       if(vi->channels==2){
-	if(i==0)
-	  _analysis_output("toneL",seq,tone,n/2,1,0,0);
-	else
-	  _analysis_output("toneR",seq,tone,n/2,1,0,0);
+        if(i==0)
+          _analysis_output("toneL",seq,tone,n/2,1,0,0);
+        else
+          _analysis_output("toneR",seq,tone,n/2,1,0,0);
+      }else{
+        _analysis_output("tone",seq,tone,n/2,1,0,0);
       }
 #endif
 
       /* third step; we offset the noise vectors, overlay tone
-	 masking.  We then do a floor1-specific line fit.  If we're
-	 performing bitrate management, the line fit is performed
-	 multiple times for up/down tweakage on demand. */
+         masking.  We then do a floor1-specific line fit.  If we're
+         performing bitrate management, the line fit is performed
+         multiple times for up/down tweakage on demand. */
 
 #if 0
       {
       float aotuv[psy_look->n];
 #endif
 
-	_vp_offset_and_mix(psy_look,
-			   noise,
-			   tone,
-			   1,
-			   logmask,
-			   mdct,
-			   logmdct);
-	
+        _vp_offset_and_mix(psy_look,
+                           noise,
+                           tone,
+                           1,
+                           logmask,
+                           mdct,
+                           logmdct);
+
 #if 0
-	if(vi->channels==2){
-	  if(i==0)
-	    _analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0);
-	  else
-	    _analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0);
-	}
+        if(vi->channels==2){
+          if(i==0)
+            _analysis_output("aotuvM1_L",seq,aotuv,psy_look->n,1,1,0);
+          else
+            _analysis_output("aotuvM1_R",seq,aotuv,psy_look->n,1,1,0);
+        }else{
+          _analysis_output("aotuvM1",seq,aotuv,psy_look->n,1,1,0);
+        }
       }
 #endif
 
 
 #if 0
       if(vi->channels==2){
-	if(i==0)
-	  _analysis_output("mask1L",seq,logmask,n/2,1,0,0);
-	else
-	  _analysis_output("mask1R",seq,logmask,n/2,1,0,0);
+        if(i==0)
+          _analysis_output("mask1L",seq,logmask,n/2,1,0,0);
+        else
+          _analysis_output("mask1R",seq,logmask,n/2,1,0,0);
+      }else{
+        _analysis_output("mask1",seq,logmask,n/2,1,0,0);
       }
 #endif
 
@@ -495,73 +506,78 @@ static int mapping0_forward(vorbis_block *vb){
       if(ci->floor_type[info->floorsubmap[submap]]!=1)return(-1);
 
       floor_posts[i][PACKETBLOBS/2]=
-	floor1_fit(vb,b->flr[info->floorsubmap[submap]],
-		   logmdct,
-		   logmask);
-      
+        floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+                   logmdct,
+                   logmask);
+
       /* are we managing bitrate?  If so, perform two more fits for
          later rate tweaking (fits represent hi/lo) */
       if(vorbis_bitrate_managed(vb) && floor_posts[i][PACKETBLOBS/2]){
-	/* higher rate by way of lower noise curve */
+        /* higher rate by way of lower noise curve */
 
-	_vp_offset_and_mix(psy_look,
-			   noise,
-			   tone,
-			   2,
-			   logmask,
-			   mdct,
-			   logmdct);
+        _vp_offset_and_mix(psy_look,
+                           noise,
+                           tone,
+                           2,
+                           logmask,
+                           mdct,
+                           logmdct);
 
 #if 0
-	if(vi->channels==2){
-	  if(i==0)
-	    _analysis_output("mask2L",seq,logmask,n/2,1,0,0);
-	  else
-	    _analysis_output("mask2R",seq,logmask,n/2,1,0,0);
-	}
+        if(vi->channels==2){
+          if(i==0)
+            _analysis_output("mask2L",seq,logmask,n/2,1,0,0);
+          else
+            _analysis_output("mask2R",seq,logmask,n/2,1,0,0);
+        }else{
+          _analysis_output("mask2",seq,logmask,n/2,1,0,0);
+        }
 #endif
-	
-	floor_posts[i][PACKETBLOBS-1]=
-	  floor1_fit(vb,b->flr[info->floorsubmap[submap]],
-		     logmdct,
-		     logmask);
-      
-	/* lower rate by way of higher noise curve */
-	_vp_offset_and_mix(psy_look,
-			   noise,
-			   tone,
-			   0,
-			   logmask,
-			   mdct,
-			   logmdct);
+
+        floor_posts[i][PACKETBLOBS-1]=
+          floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+                     logmdct,
+                     logmask);
+
+        /* lower rate by way of higher noise curve */
+        _vp_offset_and_mix(psy_look,
+                           noise,
+                           tone,
+                           0,
+                           logmask,
+                           mdct,
+                           logmdct);
 
 #if 0
-	if(vi->channels==2)
-	  if(i==0)
-	    _analysis_output("mask0L",seq,logmask,n/2,1,0,0);
-	  else
-	    _analysis_output("mask0R",seq,logmask,n/2,1,0,0);
+        if(vi->channels==2){
+          if(i==0)
+            _analysis_output("mask0L",seq,logmask,n/2,1,0,0);
+          else
+            _analysis_output("mask0R",seq,logmask,n/2,1,0,0);
+        }else{
+          _analysis_output("mask0",seq,logmask,n/2,1,0,0);
+        }
 #endif
 
-	floor_posts[i][0]=
-	  floor1_fit(vb,b->flr[info->floorsubmap[submap]],
-		     logmdct,
-		     logmask);
-	
-	/* we also interpolate a range of intermediate curves for
+        floor_posts[i][0]=
+          floor1_fit(vb,b->flr[info->floorsubmap[submap]],
+                     logmdct,
+                     logmask);
+
+        /* we also interpolate a range of intermediate curves for
            intermediate rates */
-	for(k=1;k<PACKETBLOBS/2;k++)
-	  floor_posts[i][k]=
-	    floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
-				   floor_posts[i][0],
-				   floor_posts[i][PACKETBLOBS/2],
-				   k*65536/(PACKETBLOBS/2));
-	for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
-	  floor_posts[i][k]=
-	    floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
-				   floor_posts[i][PACKETBLOBS/2],
-				   floor_posts[i][PACKETBLOBS-1],
-				   (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
+        for(k=1;k<PACKETBLOBS/2;k++)
+          floor_posts[i][k]=
+            floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
+                                   floor_posts[i][0],
+                                   floor_posts[i][PACKETBLOBS/2],
+                                   k*65536/(PACKETBLOBS/2));
+        for(k=PACKETBLOBS/2+1;k<PACKETBLOBS-1;k++)
+          floor_posts[i][k]=
+            floor1_interpolate_fit(vb,b->flr[info->floorsubmap[submap]],
+                                   floor_posts[i][PACKETBLOBS/2],
+                                   floor_posts[i][PACKETBLOBS-1],
+                                   (k-PACKETBLOBS/2)*65536/(PACKETBLOBS/2));
       }
     }
   }
@@ -570,55 +586,24 @@ static int mapping0_forward(vorbis_block *vb){
   /*
     the next phases are performed once for vbr-only and PACKETBLOB
     times for bitrate managed modes.
-    
+
     1) encode actual mode being used
     2) encode the floor for each channel, compute coded mask curve/res
     3) normalize and couple.
     4) encode residue
     5) save packet bytes to the packetblob vector
-    
+
   */
 
   /* iterate over the many masking curve fits we've created */
 
   {
-    float **res_bundle=alloca(sizeof(*res_bundle)*vi->channels);
-    float **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
+    int **couple_bundle=alloca(sizeof(*couple_bundle)*vi->channels);
     int *zerobundle=alloca(sizeof(*zerobundle)*vi->channels);
-    int **sortindex=alloca(sizeof(*sortindex)*vi->channels);
-    float **mag_memo;
-    int **mag_sort;
-
-    if(info->coupling_steps){
-      mag_memo=_vp_quantize_couple_memo(vb,
-					&ci->psy_g_param,
-					psy_look,
-					info,
-					gmdct);    
-      
-      mag_sort=_vp_quantize_couple_sort(vb,
-					psy_look,
-					info,
-					mag_memo);    
-
-      hf_reduction(&ci->psy_g_param,
-		   psy_look,
-		   info,
-		   mag_memo);
-    }
-
-    memset(sortindex,0,sizeof(*sortindex)*vi->channels);
-    if(psy_look->vi->normal_channel_p){
-      for(i=0;i<vi->channels;i++){
-	float *mdct    =gmdct[i];
-	sortindex[i]=alloca(sizeof(**sortindex)*n/2);
-	_vp_noise_normalize_sort(psy_look,mdct,sortindex[i]);
-      }
-    }
 
     for(k=(vorbis_bitrate_managed(vb)?0:PACKETBLOBS/2);
-	k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
-	k++){
+        k<=(vorbis_bitrate_managed(vb)?PACKETBLOBS-1:PACKETBLOBS/2);
+        k++){
       oggpack_buffer *opb=vbi->packetblob[k];
 
       /* start out our new packet blob with packet type and mode */
@@ -628,98 +613,87 @@ static int mapping0_forward(vorbis_block *vb){
       /* Encode frame mode, pre,post windowsize, then dispatch */
       oggpack_write(opb,modenumber,b->modebits);
       if(vb->W){
-	oggpack_write(opb,vb->lW,1);
-	oggpack_write(opb,vb->nW,1);
+        oggpack_write(opb,vb->lW,1);
+        oggpack_write(opb,vb->nW,1);
       }
 
       /* encode floor, compute masking curve, sep out residue */
       for(i=0;i<vi->channels;i++){
-	int submap=info->chmuxlist[i];
-	float *mdct    =gmdct[i];
-	float *res     =vb->pcm[i];
-	int   *ilogmask=ilogmaskch[i]=
-	  _vorbis_block_alloc(vb,n/2*sizeof(**gmdct));
-      
-	nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]],
-				 floor_posts[i][k],
-				 ilogmask);
-#if 0
-	{
-	  char buf[80];
-	  sprintf(buf,"maskI%c%d",i?'R':'L',k);
-	  float work[n/2];
-	  for(j=0;j<n/2;j++)
-	    work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]];
-	  _analysis_output(buf,seq,work,n/2,1,1,0);
-	}
-#endif
-	_vp_remove_floor(psy_look,
-			 mdct,
-			 ilogmask,
-			 res,
-			 ci->psy_g_param.sliding_lowpass[vb->W][k]);
-
-	_vp_noise_normalize(psy_look,res,res+n/2,sortindex[i]);
+        int submap=info->chmuxlist[i];
+        int *ilogmask=iwork[i];
 
-	
+        nonzero[i]=floor1_encode(opb,vb,b->flr[info->floorsubmap[submap]],
+                                 floor_posts[i][k],
+                                 ilogmask);
 #if 0
-	{
-	  char buf[80];
-	  float work[n/2];
-	  for(j=0;j<n/2;j++)
-	    work[j]=FLOOR1_fromdB_LOOKUP[ilogmask[j]]*(res+n/2)[j];
-	  sprintf(buf,"resI%c%d",i?'R':'L',k);
-	  _analysis_output(buf,seq,work,n/2,1,1,0);
-
-	}
+        {
+          char buf[80];
+          sprintf(buf,"maskI%c%d",i?'R':'L',k);
+          float work[n/2];
+          for(j=0;j<n/2;j++)
+            work[j]=FLOOR1_fromdB_LOOKUP[iwork[i][j]];
+          _analysis_output(buf,seq,work,n/2,1,1,0);
+        }
 #endif
       }
-      
+
       /* our iteration is now based on masking curve, not prequant and
-	 coupling.  Only one prequant/coupling step */
-      
+         coupling.  Only one prequant/coupling step */
+
       /* quantize/couple */
       /* incomplete implementation that assumes the tree is all depth
          one, or no tree at all */
-      if(info->coupling_steps){
-	_vp_couple(k,
-		   &ci->psy_g_param,
-		   psy_look,
-		   info,
-		   vb->pcm,
-		   mag_memo,
-		   mag_sort,
-		   ilogmaskch,
-		   nonzero,
-		   ci->psy_g_param.sliding_lowpass[vb->W][k]);
+      _vp_couple_quantize_normalize(k,
+                                    &ci->psy_g_param,
+                                    psy_look,
+                                    info,
+                                    gmdct,
+                                    iwork,
+                                    nonzero,
+                                    ci->psy_g_param.sliding_lowpass[vb->W][k],
+                                    vi->channels);
+
+#if 0
+      for(i=0;i<vi->channels;i++){
+        char buf[80];
+        sprintf(buf,"res%c%d",i?'R':'L',k);
+        float work[n/2];
+        for(j=0;j<n/2;j++)
+          work[j]=iwork[i][j];
+        _analysis_output(buf,seq,work,n/2,1,0,0);
       }
-      
+#endif
+
       /* classify and encode by submap */
       for(i=0;i<info->submaps;i++){
-	int ch_in_bundle=0;
-	long **classifications;
-	int resnum=info->residuesubmap[i];
-
-	for(j=0;j<vi->channels;j++){
-	  if(info->chmuxlist[j]==i){
-	    zerobundle[ch_in_bundle]=0;
-	    if(nonzero[j])zerobundle[ch_in_bundle]=1;
-	    res_bundle[ch_in_bundle]=vb->pcm[j];
-	    couple_bundle[ch_in_bundle++]=vb->pcm[j]+n/2;
-	  }
-	}
-	
-	classifications=_residue_P[ci->residue_type[resnum]]->
-	  class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
-	
-	_residue_P[ci->residue_type[resnum]]->
-	  forward(opb,vb,b->residue[resnum],
-		  couple_bundle,NULL,zerobundle,ch_in_bundle,classifications);
+        int ch_in_bundle=0;
+        long **classifications;
+        int resnum=info->residuesubmap[i];
+
+        for(j=0;j<vi->channels;j++){
+          if(info->chmuxlist[j]==i){
+            zerobundle[ch_in_bundle]=0;
+            if(nonzero[j])zerobundle[ch_in_bundle]=1;
+            couple_bundle[ch_in_bundle++]=iwork[j];
+          }
+        }
+
+        classifications=_residue_P[ci->residue_type[resnum]]->
+          class(vb,b->residue[resnum],couple_bundle,zerobundle,ch_in_bundle);
+
+        ch_in_bundle=0;
+        for(j=0;j<vi->channels;j++)
+          if(info->chmuxlist[j]==i)
+            couple_bundle[ch_in_bundle++]=iwork[j];
+
+        _residue_P[ci->residue_type[resnum]]->
+          forward(opb,vb,b->residue[resnum],
+                  couple_bundle,zerobundle,ch_in_bundle,classifications,i);
       }
-      
+
       /* ok, done encoding.  Next protopacket. */
     }
-    
+
   }
 
 #if 0
@@ -735,7 +709,6 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
   codec_setup_info     *ci=vi->codec_setup;
   private_state        *b=vd->backend_state;
   vorbis_info_mapping0 *info=(vorbis_info_mapping0 *)l;
-  int hs=ci->halfrate_flag; 
 
   int                   i,j;
   long                  n=vb->pcmend=ci->blocksizes[vb->W];
@@ -745,7 +718,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
 
   int   *nonzero  =alloca(sizeof(*nonzero)*vi->channels);
   void **floormemo=alloca(sizeof(*floormemo)*vi->channels);
-  
+
   /* recover the spectral envelope; store it in the PCM vector for now */
   for(i=0;i<vi->channels;i++){
     int submap=info->chmuxlist[i];
@@ -754,7 +727,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
     if(floormemo[i])
       nonzero[i]=1;
     else
-      nonzero[i]=0;      
+      nonzero[i]=0;
     memset(vb->pcm[i],0,sizeof(*vb->pcm[i])*n/2);
   }
 
@@ -762,8 +735,8 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
   for(i=0;i<info->coupling_steps;i++){
     if(nonzero[info->coupling_mag[i]] ||
        nonzero[info->coupling_ang[i]]){
-      nonzero[info->coupling_mag[i]]=1; 
-      nonzero[info->coupling_ang[i]]=1; 
+      nonzero[info->coupling_mag[i]]=1;
+      nonzero[info->coupling_ang[i]]=1;
     }
   }
 
@@ -772,17 +745,17 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
     int ch_in_bundle=0;
     for(j=0;j<vi->channels;j++){
       if(info->chmuxlist[j]==i){
-	if(nonzero[j])
-	  zerobundle[ch_in_bundle]=1;
-	else
-	  zerobundle[ch_in_bundle]=0;
-	pcmbundle[ch_in_bundle++]=vb->pcm[j];
+        if(nonzero[j])
+          zerobundle[ch_in_bundle]=1;
+        else
+          zerobundle[ch_in_bundle]=0;
+        pcmbundle[ch_in_bundle++]=vb->pcm[j];
       }
     }
 
     _residue_P[ci->residue_type[info->residuesubmap[i]]]->
       inverse(vb,b->residue[info->residuesubmap[i]],
-	      pcmbundle,zerobundle,ch_in_bundle);
+              pcmbundle,zerobundle,ch_in_bundle);
   }
 
   /* channel coupling */
@@ -795,21 +768,21 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
       float ang=pcmA[j];
 
       if(mag>0)
-	if(ang>0){
-	  pcmM[j]=mag;
-	  pcmA[j]=mag-ang;
-	}else{
-	  pcmA[j]=mag;
-	  pcmM[j]=mag+ang;
-	}
+        if(ang>0){
+          pcmM[j]=mag;
+          pcmA[j]=mag-ang;
+        }else{
+          pcmA[j]=mag;
+          pcmM[j]=mag+ang;
+        }
       else
-	if(ang>0){
-	  pcmM[j]=mag;
-	  pcmA[j]=mag+ang;
-	}else{
-	  pcmA[j]=mag;
-	  pcmM[j]=mag-ang;
-	}
+        if(ang>0){
+          pcmM[j]=mag;
+          pcmA[j]=mag+ang;
+        }else{
+          pcmA[j]=mag;
+          pcmM[j]=mag-ang;
+        }
     }
   }
 
@@ -819,7 +792,7 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
     int submap=info->chmuxlist[i];
     _floor_P[ci->floor_type[info->floorsubmap[submap]]]->
       inverse2(vb,b->flr[info->floorsubmap[submap]],
-	       floormemo[i],pcm);
+               floormemo[i],pcm);
   }
 
   /* transform the PCM data; takes PCM vector, vb; modifies PCM vector */
@@ -834,11 +807,10 @@ static int mapping0_inverse(vorbis_block *vb,vorbis_info_mapping *l){
 }
 
 /* export hooks */
-vorbis_func_mapping mapping0_exportbundle={
+const vorbis_func_mapping mapping0_exportbundle={
   &mapping0_pack,
   &mapping0_unpack,
   &mapping0_free_info,
   &mapping0_forward,
   &mapping0_inverse
 };
-

+ 712 - 712
Engine/lib/libvorbis/lib/masking.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: masking curve data for psychoacoustics
- last mod: $Id: masking.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: masking.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -22,12 +22,12 @@
    overly for only a bin or two of savings. */
 
 #define MAX_ATH 88
-static float ATH[]={
-  /*15*/  -51, -52, -53, -54, -55, -56, -57, -58,  
+static const float ATH[]={
+  /*15*/  -51, -52, -53, -54, -55, -56, -57, -58,
   /*31*/  -59, -60, -61, -62, -63, -64, -65, -66,
-  /*63*/  -67, -68, -69, -70, -71, -72, -73, -74, 
+  /*63*/  -67, -68, -69, -70, -71, -72, -73, -74,
   /*125*/ -75, -76, -77, -78, -80, -81, -82, -83,
-  /*250*/ -84, -85, -86, -87, -88, -88, -89, -89, 
+  /*250*/ -84, -85, -86, -87, -88, -88, -89, -89,
   /*500*/ -90, -91, -91, -92, -93, -94, -95, -96,
   /*1k*/  -96, -97, -98, -98, -99, -99,-100,-100,
   /*2k*/ -101,-102,-103,-104,-106,-107,-107,-107,
@@ -48,738 +48,738 @@ static float ATH[]={
 /* (Vorbis 0dB, the loudest possible tone, is assumed to be ~100dB SPL
    for collection of these curves) */
 
-static float tonemasks[P_BANDS][6][EHMER_MAX]={
+static const float tonemasks[P_BANDS][6][EHMER_MAX]={
   /* 62.5 Hz */
-  {{ -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60, 
-     -60,  -60,  -60,  -60,  -62,  -62,  -65,  -73, 
-     -69,  -68,  -68,  -67,  -70,  -70,  -72,  -74, 
-     -75,  -79,  -79,  -80,  -83,  -88,  -93, -100, 
-     -110, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
+  {{ -60,  -60,  -60,  -60,  -60,  -60,  -60,  -60,
+     -60,  -60,  -60,  -60,  -62,  -62,  -65,  -73,
+     -69,  -68,  -68,  -67,  -70,  -70,  -72,  -74,
+     -75,  -79,  -79,  -80,  -83,  -88,  -93, -100,
+     -110, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48, 
-     -48,  -48,  -48,  -48,  -48,  -53,  -61,  -66, 
-     -66,  -68,  -67,  -70,  -76,  -76,  -72,  -73, 
-     -75,  -76,  -78,  -79,  -83,  -88,  -93, -100, 
-     -110, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
+   { -48,  -48,  -48,  -48,  -48,  -48,  -48,  -48,
+     -48,  -48,  -48,  -48,  -48,  -53,  -61,  -66,
+     -66,  -68,  -67,  -70,  -76,  -76,  -72,  -73,
+     -75,  -76,  -78,  -79,  -83,  -88,  -93, -100,
+     -110, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37, 
-     -38,  -40,  -42,  -46,  -48,  -53,  -55,  -62, 
-     -65,  -58,  -56,  -56,  -61,  -60,  -65,  -67, 
-     -69,  -71,  -77,  -77,  -78,  -80,  -82,  -84, 
-     -88,  -93,  -98, -106, -112, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
+   { -37,  -37,  -37,  -37,  -37,  -37,  -37,  -37,
+     -38,  -40,  -42,  -46,  -48,  -53,  -55,  -62,
+     -65,  -58,  -56,  -56,  -61,  -60,  -65,  -67,
+     -69,  -71,  -77,  -77,  -78,  -80,  -82,  -84,
+     -88,  -93,  -98, -106, -112, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25, 
-     -25,  -26,  -27,  -29,  -32,  -38,  -48,  -52, 
-     -52,  -50,  -48,  -48,  -51,  -52,  -54,  -60, 
-     -67,  -67,  -66,  -68,  -69,  -73,  -73,  -76, 
-     -80,  -81,  -81,  -85,  -85,  -86,  -88,  -93, 
-     -100, -110, -999, -999, -999, -999, -999, -999, 
+   { -25,  -25,  -25,  -25,  -25,  -25,  -25,  -25,
+     -25,  -26,  -27,  -29,  -32,  -38,  -48,  -52,
+     -52,  -50,  -48,  -48,  -51,  -52,  -54,  -60,
+     -67,  -67,  -66,  -68,  -69,  -73,  -73,  -76,
+     -80,  -81,  -81,  -85,  -85,  -86,  -88,  -93,
+     -100, -110, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16, 
-     -17,  -19,  -20,  -22,  -26,  -28,  -31,  -40, 
-     -47,  -39,  -39,  -40,  -42,  -43,  -47,  -51, 
-     -57,  -52,  -55,  -55,  -60,  -58,  -62,  -63, 
-     -70,  -67,  -69,  -72,  -73,  -77,  -80,  -82, 
-     -83,  -87,  -90,  -94,  -98, -104, -115, -999, 
+   { -16,  -16,  -16,  -16,  -16,  -16,  -16,  -16,
+     -17,  -19,  -20,  -22,  -26,  -28,  -31,  -40,
+     -47,  -39,  -39,  -40,  -42,  -43,  -47,  -51,
+     -57,  -52,  -55,  -55,  -60,  -58,  -62,  -63,
+     -70,  -67,  -69,  -72,  -73,  -77,  -80,  -82,
+     -83,  -87,  -90,  -94,  -98, -104, -115, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   {  -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8, 
-      -8,   -8,  -10,  -11,  -15,  -19,  -25,  -30, 
-      -34,  -31,  -30,  -31,  -29,  -32,  -35,  -42, 
-      -48,  -42,  -44,  -46,  -50,  -50,  -51,  -52, 
-      -59,  -54,  -55,  -55,  -58,  -62,  -63,  -66, 
-      -72,  -73,  -76,  -75,  -78,  -80,  -80,  -81, 
-      -84,  -88,  -90,  -94,  -98, -101, -106, -110}}, 
+   {  -8,   -8,   -8,   -8,   -8,   -8,   -8,   -8,
+      -8,   -8,  -10,  -11,  -15,  -19,  -25,  -30,
+      -34,  -31,  -30,  -31,  -29,  -32,  -35,  -42,
+      -48,  -42,  -44,  -46,  -50,  -50,  -51,  -52,
+      -59,  -54,  -55,  -55,  -58,  -62,  -63,  -66,
+      -72,  -73,  -76,  -75,  -78,  -80,  -80,  -81,
+      -84,  -88,  -90,  -94,  -98, -101, -106, -110}},
   /* 88Hz */
-  {{ -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66, 
-     -66,  -66,  -66,  -66,  -66,  -67,  -67,  -67, 
-     -76,  -72,  -71,  -74,  -76,  -76,  -75,  -78, 
-     -79,  -79,  -81,  -83,  -86,  -89,  -93,  -97, 
-     -100, -105, -110, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
+  {{ -66,  -66,  -66,  -66,  -66,  -66,  -66,  -66,
+     -66,  -66,  -66,  -66,  -66,  -67,  -67,  -67,
+     -76,  -72,  -71,  -74,  -76,  -76,  -75,  -78,
+     -79,  -79,  -81,  -83,  -86,  -89,  -93,  -97,
+     -100, -105, -110, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47, 
-     -47,  -47,  -47,  -48,  -51,  -55,  -59,  -66, 
-     -66,  -66,  -67,  -66,  -68,  -69,  -70,  -74, 
-     -79,  -77,  -77,  -78,  -80,  -81,  -82,  -84, 
-     -86,  -88,  -91,  -95, -100, -108, -116, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36, 
-     -36,  -37,  -37,  -41,  -44,  -48,  -51,  -58, 
-     -62,  -60,  -57,  -59,  -59,  -60,  -63,  -65, 
-     -72,  -71,  -70,  -72,  -74,  -77,  -76,  -78, 
-     -81,  -81,  -80,  -83,  -86,  -91,  -96, -100, 
-     -105, -110, -999, -999, -999, -999, -999, -999, 
+   { -47,  -47,  -47,  -47,  -47,  -47,  -47,  -47,
+     -47,  -47,  -47,  -48,  -51,  -55,  -59,  -66,
+     -66,  -66,  -67,  -66,  -68,  -69,  -70,  -74,
+     -79,  -77,  -77,  -78,  -80,  -81,  -82,  -84,
+     -86,  -88,  -91,  -95, -100, -108, -116, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28, 
-     -28,  -30,  -32,  -32,  -33,  -35,  -41,  -49, 
-     -50,  -49,  -47,  -48,  -48,  -52,  -51,  -57, 
-     -65,  -61,  -59,  -61,  -64,  -69,  -70,  -74, 
-     -77,  -77,  -78,  -81,  -84,  -85,  -87,  -90, 
-     -92,  -96, -100, -107, -112, -999, -999, -999, 
+   { -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
+     -36,  -37,  -37,  -41,  -44,  -48,  -51,  -58,
+     -62,  -60,  -57,  -59,  -59,  -60,  -63,  -65,
+     -72,  -71,  -70,  -72,  -74,  -77,  -76,  -78,
+     -81,  -81,  -80,  -83,  -86,  -91,  -96, -100,
+     -105, -110, -999, -999, -999, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   { -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19, 
-     -20,  -21,  -23,  -27,  -30,  -35,  -36,  -41, 
-     -46,  -44,  -42,  -40,  -41,  -41,  -43,  -48, 
-     -55,  -53,  -52,  -53,  -56,  -59,  -58,  -60, 
-     -67,  -66,  -69,  -71,  -72,  -75,  -79,  -81, 
-     -84,  -87,  -90,  -93,  -97, -101, -107, -114, 
+   { -28,  -28,  -28,  -28,  -28,  -28,  -28,  -28,
+     -28,  -30,  -32,  -32,  -33,  -35,  -41,  -49,
+     -50,  -49,  -47,  -48,  -48,  -52,  -51,  -57,
+     -65,  -61,  -59,  -61,  -64,  -69,  -70,  -74,
+     -77,  -77,  -78,  -81,  -84,  -85,  -87,  -90,
+     -92,  -96, -100, -107, -112, -999, -999, -999,
      -999, -999, -999, -999, -999, -999, -999, -999},
-   {  -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9, 
-      -11,  -12,  -12,  -15,  -16,  -20,  -23,  -30, 
-      -37,  -34,  -33,  -34,  -31,  -32,  -32,  -38, 
-      -47,  -44,  -41,  -40,  -47,  -49,  -46,  -46, 
-      -58,  -50,  -50,  -54,  -58,  -62,  -64,  -67, 
-      -67,  -70,  -72,  -76,  -79,  -83,  -87,  -91, 
-      -96, -100, -104, -110, -999, -999, -999, -999}}, 
+   { -19,  -19,  -19,  -19,  -19,  -19,  -19,  -19,
+     -20,  -21,  -23,  -27,  -30,  -35,  -36,  -41,
+     -46,  -44,  -42,  -40,  -41,  -41,  -43,  -48,
+     -55,  -53,  -52,  -53,  -56,  -59,  -58,  -60,
+     -67,  -66,  -69,  -71,  -72,  -75,  -79,  -81,
+     -84,  -87,  -90,  -93,  -97, -101, -107, -114,
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   {  -9,   -9,   -9,   -9,   -9,   -9,   -9,   -9,
+      -11,  -12,  -12,  -15,  -16,  -20,  -23,  -30,
+      -37,  -34,  -33,  -34,  -31,  -32,  -32,  -38,
+      -47,  -44,  -41,  -40,  -47,  -49,  -46,  -46,
+      -58,  -50,  -50,  -54,  -58,  -62,  -64,  -67,
+      -67,  -70,  -72,  -76,  -79,  -83,  -87,  -91,
+      -96, -100, -104, -110, -999, -999, -999, -999}},
   /* 125 Hz */
-  {{ -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62, 
-     -62,  -62,  -63,  -64,  -66,  -67,  -66,  -68, 
-     -75,  -72,  -76,  -75,  -76,  -78,  -79,  -82, 
-     -84,  -85,  -90,  -94, -101, -110, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59, 
-     -59,  -59,  -59,  -60,  -60,  -61,  -63,  -66, 
-     -71,  -68,  -70,  -70,  -71,  -72,  -72,  -75, 
-     -81,  -78,  -79,  -82,  -83,  -86,  -90,  -97, 
-     -103, -113, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53, 
-     -53,  -54,  -55,  -57,  -56,  -57,  -55,  -61, 
-     -65,  -60,  -60,  -62,  -63,  -63,  -66,  -68, 
-     -74,  -73,  -75,  -75,  -78,  -80,  -80,  -82, 
-     -85,  -90,  -96, -101, -108, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46, 
-     -46,  -46,  -47,  -47,  -47,  -47,  -48,  -51, 
-     -57,  -51,  -49,  -50,  -51,  -53,  -54,  -59, 
-     -66,  -60,  -62,  -67,  -67,  -70,  -72,  -75, 
-     -76,  -78,  -81,  -85,  -88,  -94,  -97, -104, 
-     -112, -999, -999, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36, 
-     -39,  -41,  -42,  -42,  -39,  -38,  -41,  -43, 
-     -52,  -44,  -40,  -39,  -37,  -37,  -40,  -47, 
-     -54,  -50,  -48,  -50,  -55,  -61,  -59,  -62, 
-     -66,  -66,  -66,  -69,  -69,  -73,  -74,  -74, 
-     -75,  -77,  -79,  -82,  -87,  -91,  -95, -100, 
-     -108, -115, -999, -999, -999, -999, -999, -999}, 
-   { -28,  -26,  -24,  -22,  -20,  -20,  -23,  -29, 
-     -30,  -31,  -28,  -27,  -28,  -28,  -28,  -35, 
-     -40,  -33,  -32,  -29,  -30,  -30,  -30,  -37, 
-     -45,  -41,  -37,  -38,  -45,  -47,  -47,  -48, 
-     -53,  -49,  -48,  -50,  -49,  -49,  -51,  -52, 
-     -58,  -56,  -57,  -56,  -60,  -61,  -62,  -70, 
-     -72,  -74,  -78,  -83,  -88,  -93, -100, -106}}, 
+  {{ -62,  -62,  -62,  -62,  -62,  -62,  -62,  -62,
+     -62,  -62,  -63,  -64,  -66,  -67,  -66,  -68,
+     -75,  -72,  -76,  -75,  -76,  -78,  -79,  -82,
+     -84,  -85,  -90,  -94, -101, -110, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -59,  -59,  -59,  -59,  -59,  -59,  -59,  -59,
+     -59,  -59,  -59,  -60,  -60,  -61,  -63,  -66,
+     -71,  -68,  -70,  -70,  -71,  -72,  -72,  -75,
+     -81,  -78,  -79,  -82,  -83,  -86,  -90,  -97,
+     -103, -113, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -53,  -53,  -53,  -53,  -53,  -53,  -53,  -53,
+     -53,  -54,  -55,  -57,  -56,  -57,  -55,  -61,
+     -65,  -60,  -60,  -62,  -63,  -63,  -66,  -68,
+     -74,  -73,  -75,  -75,  -78,  -80,  -80,  -82,
+     -85,  -90,  -96, -101, -108, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -46,  -46,  -46,  -46,  -46,  -46,  -46,  -46,
+     -46,  -46,  -47,  -47,  -47,  -47,  -48,  -51,
+     -57,  -51,  -49,  -50,  -51,  -53,  -54,  -59,
+     -66,  -60,  -62,  -67,  -67,  -70,  -72,  -75,
+     -76,  -78,  -81,  -85,  -88,  -94,  -97, -104,
+     -112, -999, -999, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -36,  -36,  -36,  -36,  -36,  -36,  -36,  -36,
+     -39,  -41,  -42,  -42,  -39,  -38,  -41,  -43,
+     -52,  -44,  -40,  -39,  -37,  -37,  -40,  -47,
+     -54,  -50,  -48,  -50,  -55,  -61,  -59,  -62,
+     -66,  -66,  -66,  -69,  -69,  -73,  -74,  -74,
+     -75,  -77,  -79,  -82,  -87,  -91,  -95, -100,
+     -108, -115, -999, -999, -999, -999, -999, -999},
+   { -28,  -26,  -24,  -22,  -20,  -20,  -23,  -29,
+     -30,  -31,  -28,  -27,  -28,  -28,  -28,  -35,
+     -40,  -33,  -32,  -29,  -30,  -30,  -30,  -37,
+     -45,  -41,  -37,  -38,  -45,  -47,  -47,  -48,
+     -53,  -49,  -48,  -50,  -49,  -49,  -51,  -52,
+     -58,  -56,  -57,  -56,  -60,  -61,  -62,  -70,
+     -72,  -74,  -78,  -83,  -88,  -93, -100, -106}},
   /* 177 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -110, -105, -100,  -95,  -91,  -87,  -83, 
-    -80,  -78,  -76,  -78,  -78,  -81,  -83,  -85, 
-    -86,  -85,  -86,  -87,  -90,  -97, -107, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -110, -105, -100,  -95,  -90, 
-    -85,  -81,  -77,  -73,  -70,  -67,  -67,  -68, 
-    -75,  -73,  -70,  -69,  -70,  -72,  -75,  -79, 
-    -84,  -83,  -84,  -86,  -88,  -89,  -89,  -93, 
-    -98, -105, -112, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-105, -100,  -95,  -90,  -85,  -80,  -76,  -71, 
-    -68,  -68,  -65,  -63,  -63,  -62,  -62,  -64, 
-    -65,  -64,  -61,  -62,  -63,  -64,  -66,  -68, 
-    -73,  -73,  -74,  -75,  -76,  -81,  -83,  -85, 
-    -88,  -89,  -92,  -95, -100, -108, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -80,  -75,  -71,  -68,  -65,  -63,  -62,  -61, 
-     -61,  -61,  -61,  -59,  -56,  -57,  -53,  -50, 
-     -58,  -52,  -50,  -50,  -52,  -53,  -54,  -58, 
-     -67,  -63,  -67,  -68,  -72,  -75,  -78,  -80, 
-     -81,  -81,  -82,  -85,  -89,  -90,  -93,  -97, 
-     -101, -107, -114, -999, -999, -999, -999, -999, 
-     -999, -999, -999, -999, -999, -999, -999, -999}, 
-   { -65,  -61,  -59,  -57,  -56,  -55,  -55,  -56, 
-     -56,  -57,  -55,  -53,  -52,  -47,  -44,  -44, 
-     -50,  -44,  -41,  -39,  -39,  -42,  -40,  -46, 
-     -51,  -49,  -50,  -53,  -54,  -63,  -60,  -61, 
-     -62,  -66,  -66,  -66,  -70,  -73,  -74,  -75, 
-     -76,  -75,  -79,  -85,  -89,  -91,  -96, -102, 
-     -110, -999, -999, -999, -999, -999, -999, -999}, 
-   { -52,  -50,  -49,  -49,  -48,  -48,  -48,  -49, 
-     -50,  -50,  -49,  -46,  -43,  -39,  -35,  -33, 
-     -38,  -36,  -32,  -29,  -32,  -32,  -32,  -35, 
-     -44,  -39,  -38,  -38,  -46,  -50,  -45,  -46, 
-     -53,  -50,  -50,  -50,  -54,  -54,  -53,  -53, 
-     -56,  -57,  -59,  -66,  -70,  -72,  -74,  -79, 
-     -83,  -85,  -90, -97, -114, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -110, -105, -100,  -95,  -91,  -87,  -83,
+    -80,  -78,  -76,  -78,  -78,  -81,  -83,  -85,
+    -86,  -85,  -86,  -87,  -90,  -97, -107, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -110, -105, -100,  -95,  -90,
+    -85,  -81,  -77,  -73,  -70,  -67,  -67,  -68,
+    -75,  -73,  -70,  -69,  -70,  -72,  -75,  -79,
+    -84,  -83,  -84,  -86,  -88,  -89,  -89,  -93,
+    -98, -105, -112, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-105, -100,  -95,  -90,  -85,  -80,  -76,  -71,
+    -68,  -68,  -65,  -63,  -63,  -62,  -62,  -64,
+    -65,  -64,  -61,  -62,  -63,  -64,  -66,  -68,
+    -73,  -73,  -74,  -75,  -76,  -81,  -83,  -85,
+    -88,  -89,  -92,  -95, -100, -108, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   { -80,  -75,  -71,  -68,  -65,  -63,  -62,  -61,
+     -61,  -61,  -61,  -59,  -56,  -57,  -53,  -50,
+     -58,  -52,  -50,  -50,  -52,  -53,  -54,  -58,
+     -67,  -63,  -67,  -68,  -72,  -75,  -78,  -80,
+     -81,  -81,  -82,  -85,  -89,  -90,  -93,  -97,
+     -101, -107, -114, -999, -999, -999, -999, -999,
+     -999, -999, -999, -999, -999, -999, -999, -999},
+   { -65,  -61,  -59,  -57,  -56,  -55,  -55,  -56,
+     -56,  -57,  -55,  -53,  -52,  -47,  -44,  -44,
+     -50,  -44,  -41,  -39,  -39,  -42,  -40,  -46,
+     -51,  -49,  -50,  -53,  -54,  -63,  -60,  -61,
+     -62,  -66,  -66,  -66,  -70,  -73,  -74,  -75,
+     -76,  -75,  -79,  -85,  -89,  -91,  -96, -102,
+     -110, -999, -999, -999, -999, -999, -999, -999},
+   { -52,  -50,  -49,  -49,  -48,  -48,  -48,  -49,
+     -50,  -50,  -49,  -46,  -43,  -39,  -35,  -33,
+     -38,  -36,  -32,  -29,  -32,  -32,  -32,  -35,
+     -44,  -39,  -38,  -38,  -46,  -50,  -45,  -46,
+     -53,  -50,  -50,  -50,  -54,  -54,  -53,  -53,
+     -56,  -57,  -59,  -66,  -70,  -72,  -74,  -79,
+     -83,  -85,  -90, -97, -114, -999, -999, -999}},
   /* 250 Hz */
-  {{-999, -999, -999, -999, -999, -999, -110, -105, 
-    -100,  -95,  -90,  -86,  -80,  -75,  -75,  -79, 
-    -80,  -79,  -80,  -81,  -82,  -88,  -95, -103, 
-    -110, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -108, -103,  -98,  -93, 
-    -88,  -83,  -79,  -78,  -75,  -71,  -67,  -68, 
-    -73,  -73,  -72,  -73,  -75,  -77,  -80,  -82, 
-    -88,  -93, -100, -107, -114, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -110, -105, -101,  -96,  -90, 
-    -86,  -81,  -77,  -73,  -69,  -66,  -61,  -62, 
-    -66,  -64,  -62,  -65,  -66,  -70,  -72,  -76, 
-    -81,  -80,  -84,  -90,  -95, -102, -110, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -107, -103,  -97,  -92,  -88, 
-    -83,  -79,  -74,  -70,  -66,  -59,  -53,  -58, 
-    -62,  -55,  -54,  -54,  -54,  -58,  -61,  -62, 
-    -72,  -70,  -72,  -75,  -78,  -80,  -81,  -80, 
-    -83,  -83,  -88,  -93, -100, -107, -115, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -105, -100,  -95,  -90,  -85, 
-    -80,  -75,  -70,  -66,  -62,  -56,  -48,  -44, 
-    -48,  -46,  -46,  -43,  -46,  -48,  -48,  -51, 
-    -58,  -58,  -59,  -60,  -62,  -62,  -61,  -61, 
-    -65,  -64,  -65,  -68,  -70,  -74,  -75,  -78, 
-    -81,  -86,  -95, -110, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999,  -999, -105, -100,  -95,  -90,  -85,  -80, 
-    -75,  -70,  -65,  -61,  -55,  -49,  -39,  -33, 
-    -40,  -35,  -32,  -38,  -40,  -33,  -35,  -37, 
-    -46,  -41,  -45,  -44,  -46,  -42,  -45,  -46, 
-    -52,  -50,  -50,  -50,  -54,  -54,  -55,  -57, 
-    -62,  -64,  -66,  -68,  -70,  -76,  -81,  -90, 
-    -100, -110, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -110, -105,
+    -100,  -95,  -90,  -86,  -80,  -75,  -75,  -79,
+    -80,  -79,  -80,  -81,  -82,  -88,  -95, -103,
+    -110, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -108, -103,  -98,  -93,
+    -88,  -83,  -79,  -78,  -75,  -71,  -67,  -68,
+    -73,  -73,  -72,  -73,  -75,  -77,  -80,  -82,
+    -88,  -93, -100, -107, -114, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -110, -105, -101,  -96,  -90,
+    -86,  -81,  -77,  -73,  -69,  -66,  -61,  -62,
+    -66,  -64,  -62,  -65,  -66,  -70,  -72,  -76,
+    -81,  -80,  -84,  -90,  -95, -102, -110, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -107, -103,  -97,  -92,  -88,
+    -83,  -79,  -74,  -70,  -66,  -59,  -53,  -58,
+    -62,  -55,  -54,  -54,  -54,  -58,  -61,  -62,
+    -72,  -70,  -72,  -75,  -78,  -80,  -81,  -80,
+    -83,  -83,  -88,  -93, -100, -107, -115, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -105, -100,  -95,  -90,  -85,
+    -80,  -75,  -70,  -66,  -62,  -56,  -48,  -44,
+    -48,  -46,  -46,  -43,  -46,  -48,  -48,  -51,
+    -58,  -58,  -59,  -60,  -62,  -62,  -61,  -61,
+    -65,  -64,  -65,  -68,  -70,  -74,  -75,  -78,
+    -81,  -86,  -95, -110, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999,  -999, -105, -100,  -95,  -90,  -85,  -80,
+    -75,  -70,  -65,  -61,  -55,  -49,  -39,  -33,
+    -40,  -35,  -32,  -38,  -40,  -33,  -35,  -37,
+    -46,  -41,  -45,  -44,  -46,  -42,  -45,  -46,
+    -52,  -50,  -50,  -50,  -54,  -54,  -55,  -57,
+    -62,  -64,  -66,  -68,  -70,  -76,  -81,  -90,
+    -100, -110, -999, -999, -999, -999, -999, -999}},
   /* 354 hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -105,  -98,  -90,  -85,  -82,  -83,  -80,  -78, 
-    -84,  -79,  -80,  -83,  -87,  -89,  -91,  -93, 
-    -99, -106, -117, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -105,  -98,  -90,  -85,  -80,  -75,  -70,  -68, 
-    -74,  -72,  -74,  -77,  -80,  -82,  -85,  -87, 
-    -92,  -89,  -91,  -95, -100, -106, -112, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -105,  -98,  -90,  -83,  -75,  -71,  -63,  -64, 
-    -67,  -62,  -64,  -67,  -70,  -73,  -77,  -81, 
-    -84,  -83,  -85,  -89,  -90,  -93,  -98, -104, 
-    -109, -114, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -103,  -96,  -88,  -81,  -75,  -68,  -58,  -54, 
-    -56,  -54,  -56,  -56,  -58,  -60,  -63,  -66, 
-    -74,  -69,  -72,  -72,  -75,  -74,  -77,  -81, 
-    -81,  -82,  -84,  -87,  -93,  -96,  -99, -104, 
-    -110, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -108, -102,  -96, 
-    -91,  -85,  -80,  -74,  -68,  -60,  -51,  -46, 
-    -48,  -46,  -43,  -45,  -47,  -47,  -49,  -48, 
-    -56,  -53,  -55,  -58,  -57,  -63,  -58,  -60, 
-    -66,  -64,  -67,  -70,  -70,  -74,  -77,  -84, 
-    -86,  -89,  -91,  -93,  -94, -101, -109, -118, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -108, -103,  -98,  -93,  -88, 
-    -83,  -78,  -73,  -68,  -60,  -53,  -44,  -35, 
-    -38,  -38,  -34,  -34,  -36,  -40,  -41,  -44, 
-    -51,  -45,  -46,  -47,  -46,  -54,  -50,  -49, 
-    -50,  -50,  -50,  -51,  -54,  -57,  -58,  -60, 
-    -66,  -66,  -66,  -64,  -65,  -68,  -77,  -82, 
-    -87,  -95, -110, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -105,  -98,  -90,  -85,  -82,  -83,  -80,  -78,
+    -84,  -79,  -80,  -83,  -87,  -89,  -91,  -93,
+    -99, -106, -117, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -105,  -98,  -90,  -85,  -80,  -75,  -70,  -68,
+    -74,  -72,  -74,  -77,  -80,  -82,  -85,  -87,
+    -92,  -89,  -91,  -95, -100, -106, -112, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -105,  -98,  -90,  -83,  -75,  -71,  -63,  -64,
+    -67,  -62,  -64,  -67,  -70,  -73,  -77,  -81,
+    -84,  -83,  -85,  -89,  -90,  -93,  -98, -104,
+    -109, -114, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -103,  -96,  -88,  -81,  -75,  -68,  -58,  -54,
+    -56,  -54,  -56,  -56,  -58,  -60,  -63,  -66,
+    -74,  -69,  -72,  -72,  -75,  -74,  -77,  -81,
+    -81,  -82,  -84,  -87,  -93,  -96,  -99, -104,
+    -110, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -108, -102,  -96,
+    -91,  -85,  -80,  -74,  -68,  -60,  -51,  -46,
+    -48,  -46,  -43,  -45,  -47,  -47,  -49,  -48,
+    -56,  -53,  -55,  -58,  -57,  -63,  -58,  -60,
+    -66,  -64,  -67,  -70,  -70,  -74,  -77,  -84,
+    -86,  -89,  -91,  -93,  -94, -101, -109, -118,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -108, -103,  -98,  -93,  -88,
+    -83,  -78,  -73,  -68,  -60,  -53,  -44,  -35,
+    -38,  -38,  -34,  -34,  -36,  -40,  -41,  -44,
+    -51,  -45,  -46,  -47,  -46,  -54,  -50,  -49,
+    -50,  -50,  -50,  -51,  -54,  -57,  -58,  -60,
+    -66,  -66,  -66,  -64,  -65,  -68,  -77,  -82,
+    -87,  -95, -110, -999, -999, -999, -999, -999}},
   /* 500 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -107, -102,  -97,  -92,  -87,  -83,  -78,  -75, 
-    -82,  -79,  -83,  -85,  -89,  -92,  -95,  -98, 
-    -101, -105, -109, -113, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -106, 
-    -100,  -95,  -90,  -86,  -81,  -78,  -74,  -69, 
-    -74,  -74,  -76,  -79,  -83,  -84,  -86,  -89, 
-    -92,  -97,  -93, -100, -103, -107, -110, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -106, -100, 
-    -95, -90, -87, -83, -80, -75, -69, -60, 
-    -66, -66, -68, -70, -74, -78, -79, -81, 
-    -81, -83, -84, -87, -93, -96, -99, -103, 
-    -107, -110, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -108, -103, -98, 
-    -93, -89, -85, -82, -78, -71, -62, -55, 
-    -58, -58, -54, -54, -55, -59, -61, -62, 
-    -70, -66, -66, -67, -70, -72, -75, -78, 
-    -84, -84, -84, -88, -91, -90, -95, -98, 
-    -102, -103, -106, -110, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -108, -103,  -98,  -94, 
-    -90,  -87,  -82,  -79,  -73,  -67,  -58,  -47, 
-    -50,  -45,  -41,  -45,  -48,  -44,  -44,  -49, 
-    -54,  -51,  -48,  -47,  -49,  -50,  -51,  -57, 
-    -58,  -60,  -63,  -69,  -70,  -69,  -71,  -74, 
-    -78,  -82,  -90,  -95, -101, -105, -110, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -105, -101, -97, -93, -90, 
-    -85, -80, -77, -72, -65, -56, -48, -37, 
-    -40, -36, -34, -40, -50, -47, -38, -41, 
-    -47, -38, -35, -39, -38, -43, -40, -45, 
-    -50, -45, -44, -47, -50, -55, -48, -48, 
-    -52, -66, -70, -76, -82, -90, -97, -105, 
-    -110, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -107, -102,  -97,  -92,  -87,  -83,  -78,  -75,
+    -82,  -79,  -83,  -85,  -89,  -92,  -95,  -98,
+    -101, -105, -109, -113, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -106,
+    -100,  -95,  -90,  -86,  -81,  -78,  -74,  -69,
+    -74,  -74,  -76,  -79,  -83,  -84,  -86,  -89,
+    -92,  -97,  -93, -100, -103, -107, -110, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -106, -100,
+    -95, -90, -87, -83, -80, -75, -69, -60,
+    -66, -66, -68, -70, -74, -78, -79, -81,
+    -81, -83, -84, -87, -93, -96, -99, -103,
+    -107, -110, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -108, -103, -98,
+    -93, -89, -85, -82, -78, -71, -62, -55,
+    -58, -58, -54, -54, -55, -59, -61, -62,
+    -70, -66, -66, -67, -70, -72, -75, -78,
+    -84, -84, -84, -88, -91, -90, -95, -98,
+    -102, -103, -106, -110, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -108, -103,  -98,  -94,
+    -90,  -87,  -82,  -79,  -73,  -67,  -58,  -47,
+    -50,  -45,  -41,  -45,  -48,  -44,  -44,  -49,
+    -54,  -51,  -48,  -47,  -49,  -50,  -51,  -57,
+    -58,  -60,  -63,  -69,  -70,  -69,  -71,  -74,
+    -78,  -82,  -90,  -95, -101, -105, -110, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -105, -101, -97, -93, -90,
+    -85, -80, -77, -72, -65, -56, -48, -37,
+    -40, -36, -34, -40, -50, -47, -38, -41,
+    -47, -38, -35, -39, -38, -43, -40, -45,
+    -50, -45, -44, -47, -50, -55, -48, -48,
+    -52, -66, -70, -76, -82, -90, -97, -105,
+    -110, -999, -999, -999, -999, -999, -999, -999}},
   /* 707 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -108, -103,  -98,  -93,  -86,  -79,  -76, 
-    -83,  -81,  -85,  -87,  -89,  -93,  -98, -102, 
-    -107, -112, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -108, -103,  -98,  -93,  -86,  -79,  -71, 
-    -77,  -74,  -77,  -79,  -81,  -84,  -85,  -90, 
-    -92,  -93,  -92,  -98, -101, -108, -112, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -108, -103,  -98,  -93,  -87,  -78,  -68,  -65, 
-    -66,  -62,  -65,  -67,  -70,  -73,  -75,  -78, 
-    -82,  -82,  -83,  -84,  -91,  -93,  -98, -102, 
-    -106, -110, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -105, -100, -95, -90, -82, -74, -62, -57, 
-    -58, -56, -51, -52, -52, -54, -54, -58, 
-    -66, -59, -60, -63, -66, -69, -73, -79, 
-    -83, -84, -80, -81, -81, -82, -88, -92, 
-    -98, -105, -113, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -107, 
-    -102,  -97,  -92,  -84,  -79,  -69,  -57,  -47, 
-    -52,  -47,  -44,  -45,  -50,  -52,  -42,  -42, 
-    -53,  -43,  -43,  -48,  -51,  -56,  -55,  -52, 
-    -57,  -59,  -61,  -62,  -67,  -71,  -78,  -83, 
-    -86,  -94,  -98, -103, -110, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -105, -100, 
-    -95,  -90,  -84,  -78,  -70,  -61,  -51,  -41, 
-    -40,  -38,  -40,  -46,  -52,  -51,  -41,  -40, 
-    -46,  -40,  -38,  -38,  -41,  -46,  -41,  -46, 
-    -47,  -43,  -43,  -45,  -41,  -45,  -56,  -67, 
-    -68,  -83,  -87,  -90,  -95, -102, -107, -113, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -108, -103,  -98,  -93,  -86,  -79,  -76,
+    -83,  -81,  -85,  -87,  -89,  -93,  -98, -102,
+    -107, -112, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -108, -103,  -98,  -93,  -86,  -79,  -71,
+    -77,  -74,  -77,  -79,  -81,  -84,  -85,  -90,
+    -92,  -93,  -92,  -98, -101, -108, -112, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -108, -103,  -98,  -93,  -87,  -78,  -68,  -65,
+    -66,  -62,  -65,  -67,  -70,  -73,  -75,  -78,
+    -82,  -82,  -83,  -84,  -91,  -93,  -98, -102,
+    -106, -110, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -105, -100, -95, -90, -82, -74, -62, -57,
+    -58, -56, -51, -52, -52, -54, -54, -58,
+    -66, -59, -60, -63, -66, -69, -73, -79,
+    -83, -84, -80, -81, -81, -82, -88, -92,
+    -98, -105, -113, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -107,
+    -102,  -97,  -92,  -84,  -79,  -69,  -57,  -47,
+    -52,  -47,  -44,  -45,  -50,  -52,  -42,  -42,
+    -53,  -43,  -43,  -48,  -51,  -56,  -55,  -52,
+    -57,  -59,  -61,  -62,  -67,  -71,  -78,  -83,
+    -86,  -94,  -98, -103, -110, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -105, -100,
+    -95,  -90,  -84,  -78,  -70,  -61,  -51,  -41,
+    -40,  -38,  -40,  -46,  -52,  -51,  -41,  -40,
+    -46,  -40,  -38,  -38,  -41,  -46,  -41,  -46,
+    -47,  -43,  -43,  -45,  -41,  -45,  -56,  -67,
+    -68,  -83,  -87,  -90,  -95, -102, -107, -113,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 1000 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -109, -105, -101,  -96,  -91,  -84,  -77, 
-    -82,  -82,  -85,  -89,  -94, -100, -106, -110, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -106, -103,  -98,  -92,  -85,  -80,  -71, 
-    -75,  -72,  -76,  -80,  -84,  -86,  -89,  -93, 
-    -100, -107, -113, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -107, 
-    -104, -101,  -97,  -92,  -88,  -84,  -80,  -64, 
-    -66,  -63,  -64,  -66,  -69,  -73,  -77,  -83, 
-    -83,  -86,  -91,  -98, -104, -111, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -107, 
-    -104, -101,  -97,  -92,  -90,  -84,  -74,  -57, 
-    -58,  -52,  -55,  -54,  -50,  -52,  -50,  -52, 
-    -63,  -62,  -69,  -76,  -77,  -78,  -78,  -79, 
-    -82,  -88,  -94, -100, -106, -111, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -106, -102, 
-    -98,  -95,  -90,  -85,  -83,  -78,  -70,  -50, 
-    -50,  -41,  -44,  -49,  -47,  -50,  -50,  -44, 
-    -55,  -46,  -47,  -48,  -48,  -54,  -49,  -49, 
-    -58,  -62,  -71,  -81,  -87,  -92,  -97, -102, 
-    -108, -114, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -106, -102, 
-    -98,  -95,  -90,  -85,  -83,  -78,  -70,  -45, 
-    -43,  -41,  -47,  -50,  -51,  -50,  -49,  -45, 
-    -47,  -41,  -44,  -41,  -39,  -43,  -38,  -37, 
-    -40,  -41,  -44,  -50,  -58,  -65,  -73,  -79, 
-    -85,  -92,  -97, -101, -105, -109, -113, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -109, -105, -101,  -96,  -91,  -84,  -77,
+    -82,  -82,  -85,  -89,  -94, -100, -106, -110,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -106, -103,  -98,  -92,  -85,  -80,  -71,
+    -75,  -72,  -76,  -80,  -84,  -86,  -89,  -93,
+    -100, -107, -113, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -107,
+    -104, -101,  -97,  -92,  -88,  -84,  -80,  -64,
+    -66,  -63,  -64,  -66,  -69,  -73,  -77,  -83,
+    -83,  -86,  -91,  -98, -104, -111, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -107,
+    -104, -101,  -97,  -92,  -90,  -84,  -74,  -57,
+    -58,  -52,  -55,  -54,  -50,  -52,  -50,  -52,
+    -63,  -62,  -69,  -76,  -77,  -78,  -78,  -79,
+    -82,  -88,  -94, -100, -106, -111, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -106, -102,
+    -98,  -95,  -90,  -85,  -83,  -78,  -70,  -50,
+    -50,  -41,  -44,  -49,  -47,  -50,  -50,  -44,
+    -55,  -46,  -47,  -48,  -48,  -54,  -49,  -49,
+    -58,  -62,  -71,  -81,  -87,  -92,  -97, -102,
+    -108, -114, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -106, -102,
+    -98,  -95,  -90,  -85,  -83,  -78,  -70,  -45,
+    -43,  -41,  -47,  -50,  -51,  -50,  -49,  -45,
+    -47,  -41,  -44,  -41,  -39,  -43,  -38,  -37,
+    -40,  -41,  -44,  -50,  -58,  -65,  -73,  -79,
+    -85,  -92,  -97, -101, -105, -109, -113, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 1414 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -107, -100,  -95,  -87,  -81, 
-    -85,  -83,  -88,  -93, -100, -107, -114, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -107, -101,  -95,  -88,  -83,  -76, 
-    -73,  -72,  -79,  -84,  -90,  -95, -100, -105, 
-    -110, -115, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -104,  -98,  -92,  -87,  -81,  -70, 
-    -65,  -62,  -67,  -71,  -74,  -80,  -85,  -91, 
-    -95,  -99, -103, -108, -111, -114, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -103,  -97,  -90,  -85,  -76,  -60, 
-    -56,  -54,  -60,  -62,  -61,  -56,  -63,  -65, 
-    -73,  -74,  -77,  -75,  -78,  -81,  -86,  -87, 
-    -88,  -91,  -94,  -98, -103, -110, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -105, 
-    -100,  -97,  -92,  -86,  -81,  -79,  -70,  -57, 
-    -51,  -47,  -51,  -58,  -60,  -56,  -53,  -50, 
-    -58,  -52,  -50,  -50,  -53,  -55,  -64,  -69, 
-    -71,  -85,  -82,  -78,  -81,  -85,  -95, -102, 
-    -112, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -105, 
-    -100,  -97,  -92,  -85,  -83,  -79,  -72,  -49, 
-    -40,  -43,  -43,  -54,  -56,  -51,  -50,  -40, 
-    -43,  -38,  -36,  -35,  -37,  -38,  -37,  -44, 
-    -54,  -60,  -57,  -60,  -70,  -75,  -84,  -92, 
-    -103, -112, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -107, -100,  -95,  -87,  -81,
+    -85,  -83,  -88,  -93, -100, -107, -114, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -107, -101,  -95,  -88,  -83,  -76,
+    -73,  -72,  -79,  -84,  -90,  -95, -100, -105,
+    -110, -115, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -104,  -98,  -92,  -87,  -81,  -70,
+    -65,  -62,  -67,  -71,  -74,  -80,  -85,  -91,
+    -95,  -99, -103, -108, -111, -114, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -103,  -97,  -90,  -85,  -76,  -60,
+    -56,  -54,  -60,  -62,  -61,  -56,  -63,  -65,
+    -73,  -74,  -77,  -75,  -78,  -81,  -86,  -87,
+    -88,  -91,  -94,  -98, -103, -110, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -105,
+    -100,  -97,  -92,  -86,  -81,  -79,  -70,  -57,
+    -51,  -47,  -51,  -58,  -60,  -56,  -53,  -50,
+    -58,  -52,  -50,  -50,  -53,  -55,  -64,  -69,
+    -71,  -85,  -82,  -78,  -81,  -85,  -95, -102,
+    -112, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -105,
+    -100,  -97,  -92,  -85,  -83,  -79,  -72,  -49,
+    -40,  -43,  -43,  -54,  -56,  -51,  -50,  -40,
+    -43,  -38,  -36,  -35,  -37,  -38,  -37,  -44,
+    -54,  -60,  -57,  -60,  -70,  -75,  -84,  -92,
+    -103, -112, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 2000 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -102,  -95,  -89,  -82, 
-    -83,  -84,  -90,  -92,  -99, -107, -113, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -107, -101,  -95,  -89,  -83,  -72, 
-    -74,  -78,  -85,  -88,  -88,  -90,  -92,  -98, 
-    -105, -111, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -109, -103, -97, -93, -87, -81, -70, 
-    -70, -67, -75, -73, -76, -79, -81, -83, 
-    -88, -89, -97, -103, -110, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -107, -100,  -94,  -88,  -83,  -75,  -63, 
-    -59,  -59,  -63,  -66,  -60,  -62,  -67,  -67, 
-    -77,  -76,  -81,  -88,  -86,  -92,  -96, -102, 
-    -109, -116, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -105,  -98,  -92,  -86,  -81,  -73,  -56, 
-    -52,  -47,  -55,  -60,  -58,  -52,  -51,  -45, 
-    -49,  -50,  -53,  -54,  -61,  -71,  -70,  -69, 
-    -78,  -79,  -87,  -90,  -96, -104, -112, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -103,  -96,  -90,  -86,  -78,  -70,  -51, 
-    -42,  -47,  -48,  -55,  -54,  -54,  -53,  -42, 
-    -35,  -28,  -33,  -38,  -37,  -44,  -47,  -49, 
-    -54,  -63,  -68,  -78,  -82,  -89,  -94,  -99, 
-    -104, -109, -114, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -102,  -95,  -89,  -82,
+    -83,  -84,  -90,  -92,  -99, -107, -113, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -107, -101,  -95,  -89,  -83,  -72,
+    -74,  -78,  -85,  -88,  -88,  -90,  -92,  -98,
+    -105, -111, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -109, -103, -97, -93, -87, -81, -70,
+    -70, -67, -75, -73, -76, -79, -81, -83,
+    -88, -89, -97, -103, -110, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -107, -100,  -94,  -88,  -83,  -75,  -63,
+    -59,  -59,  -63,  -66,  -60,  -62,  -67,  -67,
+    -77,  -76,  -81,  -88,  -86,  -92,  -96, -102,
+    -109, -116, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -105,  -98,  -92,  -86,  -81,  -73,  -56,
+    -52,  -47,  -55,  -60,  -58,  -52,  -51,  -45,
+    -49,  -50,  -53,  -54,  -61,  -71,  -70,  -69,
+    -78,  -79,  -87,  -90,  -96, -104, -112, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -103,  -96,  -90,  -86,  -78,  -70,  -51,
+    -42,  -47,  -48,  -55,  -54,  -54,  -53,  -42,
+    -35,  -28,  -33,  -38,  -37,  -44,  -47,  -49,
+    -54,  -63,  -68,  -78,  -82,  -89,  -94,  -99,
+    -104, -109, -114, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 2828 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -110, -100,  -90,  -79, 
-    -85,  -81,  -82,  -82,  -89,  -94,  -99, -103, 
-    -109, -115, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -105,  -97,  -85,  -72, 
-    -74,  -70,  -70,  -70,  -76,  -85,  -91,  -93, 
-    -97, -103, -109, -115, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -112,  -93,  -81,  -68, 
-    -62,  -60,  -60,  -57,  -63,  -70,  -77,  -82, 
-    -90,  -93,  -98, -104, -109, -113, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -113, -100,  -93,  -84,  -63, 
-    -58,  -48,  -53,  -54,  -52,  -52,  -57,  -64, 
-    -66,  -76,  -83,  -81,  -85,  -85,  -90,  -95, 
-    -98, -101, -103, -106, -108, -111, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -105,  -95,  -86,  -74,  -53, 
-    -50,  -38,  -43,  -49,  -43,  -42,  -39,  -39, 
-    -46,  -52,  -57,  -56,  -72,  -69,  -74,  -81, 
-    -87,  -92,  -94,  -97,  -99, -102, -105, -108, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -108,  -99,  -90,  -76,  -66,  -45, 
-    -43,  -41,  -44,  -47,  -43,  -47,  -40,  -30, 
-    -31,  -31,  -39,  -33,  -40,  -41,  -43,  -53, 
-    -59,  -70,  -73,  -77,  -79,  -82,  -84,  -87, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -110, -100,  -90,  -79,
+    -85,  -81,  -82,  -82,  -89,  -94,  -99, -103,
+    -109, -115, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -105,  -97,  -85,  -72,
+    -74,  -70,  -70,  -70,  -76,  -85,  -91,  -93,
+    -97, -103, -109, -115, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -112,  -93,  -81,  -68,
+    -62,  -60,  -60,  -57,  -63,  -70,  -77,  -82,
+    -90,  -93,  -98, -104, -109, -113, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -113, -100,  -93,  -84,  -63,
+    -58,  -48,  -53,  -54,  -52,  -52,  -57,  -64,
+    -66,  -76,  -83,  -81,  -85,  -85,  -90,  -95,
+    -98, -101, -103, -106, -108, -111, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -105,  -95,  -86,  -74,  -53,
+    -50,  -38,  -43,  -49,  -43,  -42,  -39,  -39,
+    -46,  -52,  -57,  -56,  -72,  -69,  -74,  -81,
+    -87,  -92,  -94,  -97,  -99, -102, -105, -108,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -108,  -99,  -90,  -76,  -66,  -45,
+    -43,  -41,  -44,  -47,  -43,  -47,  -40,  -30,
+    -31,  -31,  -39,  -33,  -40,  -41,  -43,  -53,
+    -59,  -70,  -73,  -77,  -79,  -82,  -84,  -87,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 4000 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -110,  -91,  -76, 
-    -75,  -85,  -93,  -98, -104, -110, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999},
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -110,  -91,  -70, 
-    -70,  -75,  -86,  -89,  -94,  -98, -101, -106, 
-    -110, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -110,  -95,  -80,  -60, 
-    -65,  -64,  -74,  -83,  -88,  -91,  -95,  -99, 
-    -103, -107, -110, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -110,  -95,  -80,  -58, 
-    -55,  -49,  -66,  -68,  -71,  -78,  -78,  -80, 
-    -88,  -85,  -89,  -97, -100, -105, -110, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -110,  -95,  -80,  -53, 
-    -52,  -41,  -59,  -59,  -49,  -58,  -56,  -63, 
-    -86,  -79,  -90,  -93,  -98, -103, -107, -112, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110,  -97,  -91,  -73,  -45, 
-    -40,  -33,  -53,  -61,  -49,  -54,  -50,  -50, 
-    -60,  -52,  -67,  -74,  -81,  -92,  -96, -100, 
-    -105, -110, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -110,  -91,  -76,
+    -75,  -85,  -93,  -98, -104, -110, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -110,  -91,  -70,
+    -70,  -75,  -86,  -89,  -94,  -98, -101, -106,
+    -110, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -110,  -95,  -80,  -60,
+    -65,  -64,  -74,  -83,  -88,  -91,  -95,  -99,
+    -103, -107, -110, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -110,  -95,  -80,  -58,
+    -55,  -49,  -66,  -68,  -71,  -78,  -78,  -80,
+    -88,  -85,  -89,  -97, -100, -105, -110, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -110,  -95,  -80,  -53,
+    -52,  -41,  -59,  -59,  -49,  -58,  -56,  -63,
+    -86,  -79,  -90,  -93,  -98, -103, -107, -112,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110,  -97,  -91,  -73,  -45,
+    -40,  -33,  -53,  -61,  -49,  -54,  -50,  -50,
+    -60,  -52,  -67,  -74,  -81,  -92,  -96, -100,
+    -105, -110, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 5657 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -113, -106,  -99,  -92,  -77, 
-    -80,  -88,  -97, -106, -115, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -116, -109, -102,  -95,  -89,  -74, 
-    -72,  -88,  -87,  -95, -102, -109, -116, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -116, -109, -102,  -95,  -89,  -75, 
-    -66,  -74,  -77,  -78,  -86,  -87,  -90,  -96, 
-    -105, -115, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -115, -108, -101,  -94,  -88,  -66, 
-    -56,  -61,  -70,  -65,  -78,  -72,  -83,  -84, 
-    -93,  -98, -105, -110, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -110, -105,  -95,  -89,  -82,  -57, 
-    -52,  -52,  -59,  -56,  -59,  -58,  -69,  -67, 
-    -88,  -82,  -82,  -89,  -94, -100, -108, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -110, -101,  -96,  -90,  -83,  -77,  -54, 
-    -43,  -38,  -50,  -48,  -52,  -48,  -42,  -42, 
-    -51,  -52,  -53,  -59,  -65,  -71,  -78,  -85, 
-    -95, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -113, -106,  -99,  -92,  -77,
+    -80,  -88,  -97, -106, -115, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -116, -109, -102,  -95,  -89,  -74,
+    -72,  -88,  -87,  -95, -102, -109, -116, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -116, -109, -102,  -95,  -89,  -75,
+    -66,  -74,  -77,  -78,  -86,  -87,  -90,  -96,
+    -105, -115, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -115, -108, -101,  -94,  -88,  -66,
+    -56,  -61,  -70,  -65,  -78,  -72,  -83,  -84,
+    -93,  -98, -105, -110, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -110, -105,  -95,  -89,  -82,  -57,
+    -52,  -52,  -59,  -56,  -59,  -58,  -69,  -67,
+    -88,  -82,  -82,  -89,  -94, -100, -108, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -110, -101,  -96,  -90,  -83,  -77,  -54,
+    -43,  -38,  -50,  -48,  -52,  -48,  -42,  -42,
+    -51,  -52,  -53,  -59,  -65,  -71,  -78,  -85,
+    -95, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 8000 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -120, -105,  -86,  -68, 
-    -78,  -79,  -90, -100, -110, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -120, -105,  -86,  -66, 
-    -73,  -77,  -88,  -96, -105, -115, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -120, -105,  -92,  -80,  -61, 
-    -64,  -68,  -80,  -87,  -92, -100, -110, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -120, -104,  -91,  -79,  -52, 
-    -60,  -54,  -64,  -69,  -77,  -80,  -82,  -84, 
-    -85,  -87,  -88,  -90, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -118, -100,  -87,  -77,  -49, 
-    -50,  -44,  -58,  -61,  -61,  -67,  -65,  -62, 
-    -62,  -62,  -65,  -68, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -115,  -98,  -84,  -62,  -49, 
-    -44,  -38,  -46,  -49,  -49,  -46,  -39,  -37, 
-    -39,  -40,  -42,  -43, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -120, -105,  -86,  -68,
+    -78,  -79,  -90, -100, -110, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -120, -105,  -86,  -66,
+    -73,  -77,  -88,  -96, -105, -115, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -120, -105,  -92,  -80,  -61,
+    -64,  -68,  -80,  -87,  -92, -100, -110, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -120, -104,  -91,  -79,  -52,
+    -60,  -54,  -64,  -69,  -77,  -80,  -82,  -84,
+    -85,  -87,  -88,  -90, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -118, -100,  -87,  -77,  -49,
+    -50,  -44,  -58,  -61,  -61,  -67,  -65,  -62,
+    -62,  -62,  -65,  -68, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -115,  -98,  -84,  -62,  -49,
+    -44,  -38,  -46,  -49,  -49,  -46,  -39,  -37,
+    -39,  -40,  -42,  -43, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 11314 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -110,  -88,  -74, 
-    -77,  -82,  -82,  -85,  -90,  -94,  -99, -104, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -110,  -88,  -66, 
-    -70,  -81,  -80,  -81,  -84,  -88,  -91,  -93, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -110,  -88,  -61, 
-    -63,  -70,  -71,  -74,  -77,  -80,  -83,  -85, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -110, -86, -62, 
-    -63,  -62,  -62,  -58,  -52,  -50,  -50,  -52, 
-    -54, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -118, -108,  -84,  -53, 
-    -50,  -50,  -50,  -55,  -47,  -45,  -40,  -40, 
-    -40, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -118, -100,  -73,  -43, 
-    -37,  -42,  -43,  -53,  -38,  -37,  -35,  -35, 
-    -38, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}}, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -110,  -88,  -74,
+    -77,  -82,  -82,  -85,  -90,  -94,  -99, -104,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -110,  -88,  -66,
+    -70,  -81,  -80,  -81,  -84,  -88,  -91,  -93,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -110,  -88,  -61,
+    -63,  -70,  -71,  -74,  -77,  -80,  -83,  -85,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -110, -86, -62,
+    -63,  -62,  -62,  -58,  -52,  -50,  -50,  -52,
+    -54, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -118, -108,  -84,  -53,
+    -50,  -50,  -50,  -55,  -47,  -45,  -40,  -40,
+    -40, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -118, -100,  -73,  -43,
+    -37,  -42,  -43,  -53,  -38,  -37,  -35,  -35,
+    -38, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999}},
   /* 16000 Hz */
-  {{-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -100,  -91,  -84,  -74, 
-    -80,  -80,  -80,  -80,  -80, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -100,  -91,  -84,  -74, 
-    -68,  -68,  -68,  -68,  -68, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -100,  -86,  -78,  -70, 
-    -60,  -45,  -30,  -21, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -100,  -87,  -78,  -67, 
-    -48,  -38,  -29,  -21, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -100,  -86,  -69,  -56, 
-    -45,  -35,  -33,  -29, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999}, 
-   {-999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -110, -100,  -83,  -71,  -48, 
-    -27,  -38,  -37,  -34, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
-    -999, -999, -999, -999, -999, -999, -999, -999, 
+  {{-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -100,  -91,  -84,  -74,
+    -80,  -80,  -80,  -80,  -80, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -100,  -91,  -84,  -74,
+    -68,  -68,  -68,  -68,  -68, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -100,  -86,  -78,  -70,
+    -60,  -45,  -30,  -21, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -100,  -87,  -78,  -67,
+    -48,  -38,  -29,  -21, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -100,  -86,  -69,  -56,
+    -45,  -35,  -33,  -29, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999},
+   {-999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -110, -100,  -83,  -71,  -48,
+    -27,  -38,  -37,  -34, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
+    -999, -999, -999, -999, -999, -999, -999, -999,
     -999, -999, -999, -999, -999, -999, -999, -999}}
-}; 
+};
 
 #endif

+ 172 - 173
Engine/lib/libvorbis/lib/mdct.c

@@ -5,14 +5,14 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: mdct.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,
@@ -52,7 +52,7 @@
 void mdct_init(mdct_lookup *lookup,int n){
   int   *bitrev=_ogg_malloc(sizeof(*bitrev)*(n/4));
   DATA_TYPE *T=_ogg_malloc(sizeof(*T)*(n+n/4));
-  
+
   int i;
   int n2=n>>1;
   int log2n=lookup->log2n=rint(log((float)n)/log(2.f));
@@ -81,7 +81,7 @@ void mdct_init(mdct_lookup *lookup,int n){
     for(i=0;i<n/8;i++){
       int acc=0;
       for(j=0;msb>>j;j++)
-	if((msb>>j)&i)acc|=1<<j;
+        if((msb>>j)&i)acc|=1<<j;
       bitrev[i*2]=((~acc)&mask)-1;
       bitrev[i*2+1]=acc;
 
@@ -97,21 +97,21 @@ STIN void mdct_butterfly_8(DATA_TYPE *x){
   REG_TYPE r2   = x[4] + x[0];
   REG_TYPE r3   = x[4] - x[0];
 
-	   x[6] = r0   + r2;
-	   x[4] = r0   - r2;
-	   
-	   r0   = x[5] - x[1];
-	   r2   = x[7] - x[3];
-	   x[0] = r1   + r0;
-	   x[2] = r1   - r0;
-	   
-	   r0   = x[5] + x[1];
-	   r1   = x[7] + x[3];
-	   x[3] = r2   + r3;
-	   x[1] = r2   - r3;
-	   x[7] = r1   + r0;
-	   x[5] = r1   - r0;
-	   
+           x[6] = r0   + r2;
+           x[4] = r0   - r2;
+
+           r0   = x[5] - x[1];
+           r2   = x[7] - x[3];
+           x[0] = r1   + r0;
+           x[2] = r1   - r0;
+
+           r0   = x[5] + x[1];
+           r1   = x[7] + x[3];
+           x[3] = r2   + r3;
+           x[1] = r2   - r3;
+           x[7] = r1   + r0;
+           x[5] = r1   - r0;
+
 }
 
 /* 16 point butterfly (in place, 4 register) */
@@ -145,8 +145,8 @@ STIN void mdct_butterfly_16(DATA_TYPE *x){
            x[6]  = r0;
            x[7]  = r1;
 
-	   mdct_butterfly_8(x);
-	   mdct_butterfly_8(x+8);
+           mdct_butterfly_8(x);
+           mdct_butterfly_8(x+8);
 }
 
 /* 32 point butterfly (in place, 4 register) */
@@ -154,105 +154,105 @@ STIN void mdct_butterfly_32(DATA_TYPE *x){
   REG_TYPE r0     = x[30] - x[14];
   REG_TYPE r1     = x[31] - x[15];
 
-           x[30] +=         x[14];           
-	   x[31] +=         x[15];
-           x[14]  =         r0;              
-	   x[15]  =         r1;
+           x[30] +=         x[14];
+           x[31] +=         x[15];
+           x[14]  =         r0;
+           x[15]  =         r1;
 
-           r0     = x[28] - x[12];   
-	   r1     = x[29] - x[13];
-           x[28] +=         x[12];           
-	   x[29] +=         x[13];
+           r0     = x[28] - x[12];
+           r1     = x[29] - x[13];
+           x[28] +=         x[12];
+           x[29] +=         x[13];
            x[12]  = MULT_NORM( r0 * cPI1_8  -  r1 * cPI3_8 );
-	   x[13]  = MULT_NORM( r0 * cPI3_8  +  r1 * cPI1_8 );
+           x[13]  = MULT_NORM( r0 * cPI3_8  +  r1 * cPI1_8 );
 
            r0     = x[26] - x[10];
-	   r1     = x[27] - x[11];
-	   x[26] +=         x[10];
-	   x[27] +=         x[11];
-	   x[10]  = MULT_NORM(( r0  - r1 ) * cPI2_8);
-	   x[11]  = MULT_NORM(( r0  + r1 ) * cPI2_8);
-
-	   r0     = x[24] - x[8];
-	   r1     = x[25] - x[9];
-	   x[24] += x[8];
-	   x[25] += x[9];
-	   x[8]   = MULT_NORM( r0 * cPI3_8  -  r1 * cPI1_8 );
-	   x[9]   = MULT_NORM( r1 * cPI3_8  +  r0 * cPI1_8 );
-
-	   r0     = x[22] - x[6];
-	   r1     = x[7]  - x[23];
-	   x[22] += x[6];
-	   x[23] += x[7];
-	   x[6]   = r1;
-	   x[7]   = r0;
-
-	   r0     = x[4]  - x[20];
-	   r1     = x[5]  - x[21];
-	   x[20] += x[4];
-	   x[21] += x[5];
-	   x[4]   = MULT_NORM( r1 * cPI1_8  +  r0 * cPI3_8 );
-	   x[5]   = MULT_NORM( r1 * cPI3_8  -  r0 * cPI1_8 );
-
-	   r0     = x[2]  - x[18];
-	   r1     = x[3]  - x[19];
-	   x[18] += x[2];
-	   x[19] += x[3];
-	   x[2]   = MULT_NORM(( r1  + r0 ) * cPI2_8);
-	   x[3]   = MULT_NORM(( r1  - r0 ) * cPI2_8);
-
-	   r0     = x[0]  - x[16];
-	   r1     = x[1]  - x[17];
-	   x[16] += x[0];
-	   x[17] += x[1];
-	   x[0]   = MULT_NORM( r1 * cPI3_8  +  r0 * cPI1_8 );
-	   x[1]   = MULT_NORM( r1 * cPI1_8  -  r0 * cPI3_8 );
-
-	   mdct_butterfly_16(x);
-	   mdct_butterfly_16(x+16);
+           r1     = x[27] - x[11];
+           x[26] +=         x[10];
+           x[27] +=         x[11];
+           x[10]  = MULT_NORM(( r0  - r1 ) * cPI2_8);
+           x[11]  = MULT_NORM(( r0  + r1 ) * cPI2_8);
+
+           r0     = x[24] - x[8];
+           r1     = x[25] - x[9];
+           x[24] += x[8];
+           x[25] += x[9];
+           x[8]   = MULT_NORM( r0 * cPI3_8  -  r1 * cPI1_8 );
+           x[9]   = MULT_NORM( r1 * cPI3_8  +  r0 * cPI1_8 );
+
+           r0     = x[22] - x[6];
+           r1     = x[7]  - x[23];
+           x[22] += x[6];
+           x[23] += x[7];
+           x[6]   = r1;
+           x[7]   = r0;
+
+           r0     = x[4]  - x[20];
+           r1     = x[5]  - x[21];
+           x[20] += x[4];
+           x[21] += x[5];
+           x[4]   = MULT_NORM( r1 * cPI1_8  +  r0 * cPI3_8 );
+           x[5]   = MULT_NORM( r1 * cPI3_8  -  r0 * cPI1_8 );
+
+           r0     = x[2]  - x[18];
+           r1     = x[3]  - x[19];
+           x[18] += x[2];
+           x[19] += x[3];
+           x[2]   = MULT_NORM(( r1  + r0 ) * cPI2_8);
+           x[3]   = MULT_NORM(( r1  - r0 ) * cPI2_8);
+
+           r0     = x[0]  - x[16];
+           r1     = x[1]  - x[17];
+           x[16] += x[0];
+           x[17] += x[1];
+           x[0]   = MULT_NORM( r1 * cPI3_8  +  r0 * cPI1_8 );
+           x[1]   = MULT_NORM( r1 * cPI1_8  -  r0 * cPI3_8 );
+
+           mdct_butterfly_16(x);
+           mdct_butterfly_16(x+16);
 
 }
 
 /* N point first stage butterfly (in place, 2 register) */
 STIN void mdct_butterfly_first(DATA_TYPE *T,
-					DATA_TYPE *x,
-					int points){
-  
+                                        DATA_TYPE *x,
+                                        int points){
+
   DATA_TYPE *x1        = x          + points      - 8;
   DATA_TYPE *x2        = x          + (points>>1) - 8;
   REG_TYPE   r0;
   REG_TYPE   r1;
 
   do{
-    
+
                r0      = x1[6]      -  x2[6];
-	       r1      = x1[7]      -  x2[7];
-	       x1[6]  += x2[6];
-	       x1[7]  += x2[7];
-	       x2[6]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
-	       x2[7]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
-	       
-	       r0      = x1[4]      -  x2[4];
-	       r1      = x1[5]      -  x2[5];
-	       x1[4]  += x2[4];
-	       x1[5]  += x2[5];
-	       x2[4]   = MULT_NORM(r1 * T[5]  +  r0 * T[4]);
-	       x2[5]   = MULT_NORM(r1 * T[4]  -  r0 * T[5]);
-	       
-	       r0      = x1[2]      -  x2[2];
-	       r1      = x1[3]      -  x2[3];
-	       x1[2]  += x2[2];
-	       x1[3]  += x2[3];
-	       x2[2]   = MULT_NORM(r1 * T[9]  +  r0 * T[8]);
-	       x2[3]   = MULT_NORM(r1 * T[8]  -  r0 * T[9]);
-	       
-	       r0      = x1[0]      -  x2[0];
-	       r1      = x1[1]      -  x2[1];
-	       x1[0]  += x2[0];
-	       x1[1]  += x2[1];
-	       x2[0]   = MULT_NORM(r1 * T[13] +  r0 * T[12]);
-	       x2[1]   = MULT_NORM(r1 * T[12] -  r0 * T[13]);
-	       
+               r1      = x1[7]      -  x2[7];
+               x1[6]  += x2[6];
+               x1[7]  += x2[7];
+               x2[6]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
+               x2[7]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
+
+               r0      = x1[4]      -  x2[4];
+               r1      = x1[5]      -  x2[5];
+               x1[4]  += x2[4];
+               x1[5]  += x2[5];
+               x2[4]   = MULT_NORM(r1 * T[5]  +  r0 * T[4]);
+               x2[5]   = MULT_NORM(r1 * T[4]  -  r0 * T[5]);
+
+               r0      = x1[2]      -  x2[2];
+               r1      = x1[3]      -  x2[3];
+               x1[2]  += x2[2];
+               x1[3]  += x2[3];
+               x2[2]   = MULT_NORM(r1 * T[9]  +  r0 * T[8]);
+               x2[3]   = MULT_NORM(r1 * T[8]  -  r0 * T[9]);
+
+               r0      = x1[0]      -  x2[0];
+               r1      = x1[1]      -  x2[1];
+               x1[0]  += x2[0];
+               x1[1]  += x2[1];
+               x2[0]   = MULT_NORM(r1 * T[13] +  r0 * T[12]);
+               x2[1]   = MULT_NORM(r1 * T[12] -  r0 * T[13]);
+
     x1-=8;
     x2-=8;
     T+=16;
@@ -262,52 +262,52 @@ STIN void mdct_butterfly_first(DATA_TYPE *T,
 
 /* N/stage point generic N stage butterfly (in place, 2 register) */
 STIN void mdct_butterfly_generic(DATA_TYPE *T,
-					  DATA_TYPE *x,
-					  int points,
-					  int trigint){
-  
+                                          DATA_TYPE *x,
+                                          int points,
+                                          int trigint){
+
   DATA_TYPE *x1        = x          + points      - 8;
   DATA_TYPE *x2        = x          + (points>>1) - 8;
   REG_TYPE   r0;
   REG_TYPE   r1;
 
   do{
-    
+
                r0      = x1[6]      -  x2[6];
-	       r1      = x1[7]      -  x2[7];
-	       x1[6]  += x2[6];
-	       x1[7]  += x2[7];
-	       x2[6]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
-	       x2[7]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
-	       
-	       T+=trigint;
-	       
-	       r0      = x1[4]      -  x2[4];
-	       r1      = x1[5]      -  x2[5];
-	       x1[4]  += x2[4];
-	       x1[5]  += x2[5];
-	       x2[4]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
-	       x2[5]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
-	       
-	       T+=trigint;
-	       
-	       r0      = x1[2]      -  x2[2];
-	       r1      = x1[3]      -  x2[3];
-	       x1[2]  += x2[2];
-	       x1[3]  += x2[3];
-	       x2[2]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
-	       x2[3]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
-	       
-	       T+=trigint;
-	       
-	       r0      = x1[0]      -  x2[0];
-	       r1      = x1[1]      -  x2[1];
-	       x1[0]  += x2[0];
-	       x1[1]  += x2[1];
-	       x2[0]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
-	       x2[1]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
-
-	       T+=trigint;
+               r1      = x1[7]      -  x2[7];
+               x1[6]  += x2[6];
+               x1[7]  += x2[7];
+               x2[6]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
+               x2[7]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
+
+               T+=trigint;
+
+               r0      = x1[4]      -  x2[4];
+               r1      = x1[5]      -  x2[5];
+               x1[4]  += x2[4];
+               x1[5]  += x2[5];
+               x2[4]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
+               x2[5]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
+
+               T+=trigint;
+
+               r0      = x1[2]      -  x2[2];
+               r1      = x1[3]      -  x2[3];
+               x1[2]  += x2[2];
+               x1[3]  += x2[3];
+               x2[2]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
+               x2[3]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
+
+               T+=trigint;
+
+               r0      = x1[0]      -  x2[0];
+               r1      = x1[1]      -  x2[1];
+               x1[0]  += x2[0];
+               x1[1]  += x2[1];
+               x2[0]   = MULT_NORM(r1 * T[1]  +  r0 * T[0]);
+               x2[1]   = MULT_NORM(r1 * T[0]  -  r0 * T[1]);
+
+               T+=trigint;
     x1-=8;
     x2-=8;
 
@@ -315,13 +315,13 @@ STIN void mdct_butterfly_generic(DATA_TYPE *T,
 }
 
 STIN void mdct_butterflies(mdct_lookup *init,
-			     DATA_TYPE *x,
-			     int points){
-  
+                             DATA_TYPE *x,
+                             int points){
+
   DATA_TYPE *T=init->trig;
   int stages=init->log2n-5;
   int i,j;
-  
+
   if(--stages>0){
     mdct_butterfly_first(T,x,points);
   }
@@ -344,8 +344,8 @@ void mdct_clear(mdct_lookup *l){
   }
 }
 
-STIN void mdct_bitreverse(mdct_lookup *init, 
-			    DATA_TYPE *x){
+STIN void mdct_bitreverse(mdct_lookup *init,
+                            DATA_TYPE *x){
   int        n       = init->n;
   int       *bit     = init->bitrev;
   DATA_TYPE *w0      = x;
@@ -361,15 +361,15 @@ STIN void mdct_bitreverse(mdct_lookup *init,
     REG_TYPE  r2     = MULT_NORM(r1     * T[0]   + r0 * T[1]);
     REG_TYPE  r3     = MULT_NORM(r1     * T[1]   - r0 * T[0]);
 
-	      w1    -= 4;
+              w1    -= 4;
 
               r0     = HALVE(x0[1] + x1[1]);
               r1     = HALVE(x0[0] - x1[0]);
-      
-	      w0[0]  = r0     + r2;
-	      w1[2]  = r0     - r2;
-	      w0[1]  = r1     + r3;
-	      w1[3]  = r3     - r1;
+
+              w0[0]  = r0     + r2;
+              w1[2]  = r0     - r2;
+              w0[1]  = r1     + r3;
+              w1[3]  = r3     - r1;
 
               x0     = x+bit[2];
               x1     = x+bit[3];
@@ -381,15 +381,15 @@ STIN void mdct_bitreverse(mdct_lookup *init,
 
               r0     = HALVE(x0[1] + x1[1]);
               r1     = HALVE(x0[0] - x1[0]);
-      
-	      w0[2]  = r0     + r2;
-	      w1[0]  = r0     - r2;
-	      w0[3]  = r1     + r3;
-	      w1[1]  = r3     - r1;
 
-	      T     += 4;
-	      bit   += 4;
-	      w0    += 4;
+              w0[2]  = r0     + r2;
+              w1[0]  = r0     - r2;
+              w0[3]  = r1     + r3;
+              w1[1]  = r3     - r1;
+
+              T     += 4;
+              bit   += 4;
+              w0    += 4;
 
   }while(w0<w1);
 }
@@ -439,7 +439,7 @@ void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
     DATA_TYPE *oX2=out+n2+n4;
     DATA_TYPE *iX =out;
     T             =init->trig+n2;
-    
+
     do{
       oX1-=4;
 
@@ -501,44 +501,44 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
   /* rotate */
 
   /* window + rotate + step 1 */
-  
+
   REG_TYPE r0;
   REG_TYPE r1;
   DATA_TYPE *x0=in+n2+n4;
   DATA_TYPE *x1=x0+1;
   DATA_TYPE *T=init->trig+n2;
-  
+
   int i=0;
-  
+
   for(i=0;i<n8;i+=2){
     x0 -=4;
     T-=2;
     r0= x0[2] + x1[0];
-    r1= x0[0] + x1[2];       
+    r1= x0[0] + x1[2];
     w2[i]=   MULT_NORM(r1*T[1] + r0*T[0]);
     w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
     x1 +=4;
   }
 
   x1=in+1;
-  
+
   for(;i<n2-n8;i+=2){
     T-=2;
     x0 -=4;
     r0= x0[2] - x1[0];
-    r1= x0[0] - x1[2];       
+    r1= x0[0] - x1[2];
     w2[i]=   MULT_NORM(r1*T[1] + r0*T[0]);
     w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
     x1 +=4;
   }
-    
+
   x0=in+n;
 
   for(;i<n2;i+=2){
     T-=2;
     x0 -=4;
     r0= -x0[2] - x1[0];
-    r1= -x0[0] - x1[2];       
+    r1= -x0[0] - x1[2];
     w2[i]=   MULT_NORM(r1*T[1] + r0*T[0]);
     w2[i+1]= MULT_NORM(r1*T[0] - r0*T[1]);
     x1 +=4;
@@ -561,4 +561,3 @@ void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out){
     T+=2;
   }
 }
-

+ 3 - 15
Engine/lib/libvorbis/lib/mdct.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: modified discrete cosine transform prototypes
- last mod: $Id: mdct.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: mdct.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -56,7 +56,7 @@
 typedef struct {
   int n;
   int log2n;
-  
+
   DATA_TYPE *trig;
   int       *bitrev;
 
@@ -69,15 +69,3 @@ extern void mdct_forward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
 extern void mdct_backward(mdct_lookup *init, DATA_TYPE *in, DATA_TYPE *out);
 
 #endif
-
-
-
-
-
-
-
-
-
-
-
-

+ 13 - 8
Engine/lib/libvorbis/lib/misc.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: miscellaneous prototypes
- last mod: $Id: misc.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: misc.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -19,20 +19,25 @@
 #define _V_RANDOM_H_
 #include "vorbis/codec.h"
 
-extern int analysis_noisy;
-
 extern void *_vorbis_block_alloc(vorbis_block *vb,long bytes);
 extern void _vorbis_block_ripcord(vorbis_block *vb);
+
+#ifdef ANALYSIS
+extern int analysis_noisy;
 extern void _analysis_output(char *base,int i,float *v,int n,int bark,int dB,
-			     ogg_int64_t off);
+                             ogg_int64_t off);
+extern void _analysis_output_always(char *base,int i,float *v,int n,int bark,int dB,
+                             ogg_int64_t off);
+#endif
 
 #ifdef DEBUG_MALLOC
 
 #define _VDBG_GRAPHFILE "malloc.m"
-extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line); 
-extern void _VDBG_free(void *ptr,char *file,long line); 
+#undef _VDBG_GRAPHFILE
+extern void *_VDBG_malloc(void *ptr,long bytes,char *file,long line);
+extern void _VDBG_free(void *ptr,char *file,long line);
 
-#ifndef MISC_C 
+#ifndef MISC_C
 #undef _ogg_malloc
 #undef _ogg_calloc
 #undef _ogg_realloc

+ 71 - 59
Engine/lib/libvorbis/lib/modes/floor_all.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: key floor settings
- last mod: $Id: floor_all.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: floor_all.h 17050 2010-03-26 01:34:42Z xiphmont $
 
  ********************************************************************/
 
@@ -19,85 +19,85 @@
 #include "backends.h"
 #include "books/floor/floor_books.h"
 
-static static_codebook *_floor_128x4_books[]={
+static const static_codebook*const _floor_128x4_books[]={
   &_huff_book_line_128x4_class0,
   &_huff_book_line_128x4_0sub0,
   &_huff_book_line_128x4_0sub1,
   &_huff_book_line_128x4_0sub2,
   &_huff_book_line_128x4_0sub3,
 };
-static static_codebook *_floor_256x4_books[]={
+static const static_codebook*const _floor_256x4_books[]={
   &_huff_book_line_256x4_class0,
   &_huff_book_line_256x4_0sub0,
   &_huff_book_line_256x4_0sub1,
   &_huff_book_line_256x4_0sub2,
   &_huff_book_line_256x4_0sub3,
 };
-static static_codebook *_floor_128x7_books[]={
+static const static_codebook*const _floor_128x7_books[]={
   &_huff_book_line_128x7_class0,
   &_huff_book_line_128x7_class1,
-  
+
   &_huff_book_line_128x7_0sub1,
   &_huff_book_line_128x7_0sub2,
   &_huff_book_line_128x7_0sub3,
   &_huff_book_line_128x7_1sub1,
   &_huff_book_line_128x7_1sub2,
-  &_huff_book_line_128x7_1sub3, 
+  &_huff_book_line_128x7_1sub3,
 };
-static static_codebook *_floor_256x7_books[]={
+static const static_codebook*const _floor_256x7_books[]={
   &_huff_book_line_256x7_class0,
   &_huff_book_line_256x7_class1,
-  
+
   &_huff_book_line_256x7_0sub1,
   &_huff_book_line_256x7_0sub2,
   &_huff_book_line_256x7_0sub3,
   &_huff_book_line_256x7_1sub1,
   &_huff_book_line_256x7_1sub2,
-  &_huff_book_line_256x7_1sub3, 
+  &_huff_book_line_256x7_1sub3,
 };
-static static_codebook *_floor_128x11_books[]={
+static const static_codebook*const _floor_128x11_books[]={
   &_huff_book_line_128x11_class1,
   &_huff_book_line_128x11_class2,
   &_huff_book_line_128x11_class3,
-  
+
   &_huff_book_line_128x11_0sub0,
   &_huff_book_line_128x11_1sub0,
   &_huff_book_line_128x11_1sub1,
   &_huff_book_line_128x11_2sub1,
   &_huff_book_line_128x11_2sub2,
-  &_huff_book_line_128x11_2sub3, 
+  &_huff_book_line_128x11_2sub3,
   &_huff_book_line_128x11_3sub1,
   &_huff_book_line_128x11_3sub2,
-  &_huff_book_line_128x11_3sub3, 
+  &_huff_book_line_128x11_3sub3,
 };
-static static_codebook *_floor_128x17_books[]={
+static const static_codebook*const _floor_128x17_books[]={
   &_huff_book_line_128x17_class1,
   &_huff_book_line_128x17_class2,
   &_huff_book_line_128x17_class3,
-  
+
   &_huff_book_line_128x17_0sub0,
   &_huff_book_line_128x17_1sub0,
   &_huff_book_line_128x17_1sub1,
   &_huff_book_line_128x17_2sub1,
   &_huff_book_line_128x17_2sub2,
-  &_huff_book_line_128x17_2sub3, 
+  &_huff_book_line_128x17_2sub3,
   &_huff_book_line_128x17_3sub1,
   &_huff_book_line_128x17_3sub2,
-  &_huff_book_line_128x17_3sub3, 
+  &_huff_book_line_128x17_3sub3,
 };
-static static_codebook *_floor_256x4low_books[]={
+static const static_codebook*const _floor_256x4low_books[]={
   &_huff_book_line_256x4low_class0,
   &_huff_book_line_256x4low_0sub0,
   &_huff_book_line_256x4low_0sub1,
   &_huff_book_line_256x4low_0sub2,
   &_huff_book_line_256x4low_0sub3,
 };
-static static_codebook *_floor_1024x27_books[]={
+static const static_codebook*const _floor_1024x27_books[]={
   &_huff_book_line_1024x27_class1,
   &_huff_book_line_1024x27_class2,
   &_huff_book_line_1024x27_class3,
   &_huff_book_line_1024x27_class4,
-  
+
   &_huff_book_line_1024x27_0sub0,
   &_huff_book_line_1024x27_1sub0,
   &_huff_book_line_1024x27_1sub1,
@@ -110,12 +110,12 @@ static static_codebook *_floor_1024x27_books[]={
   &_huff_book_line_1024x27_4sub2,
   &_huff_book_line_1024x27_4sub3,
 };
-static static_codebook *_floor_2048x27_books[]={
+static const static_codebook*const _floor_2048x27_books[]={
   &_huff_book_line_2048x27_class1,
   &_huff_book_line_2048x27_class2,
   &_huff_book_line_2048x27_class3,
   &_huff_book_line_2048x27_class4,
-  
+
   &_huff_book_line_2048x27_0sub0,
   &_huff_book_line_2048x27_1sub0,
   &_huff_book_line_2048x27_1sub1,
@@ -129,23 +129,27 @@ static static_codebook *_floor_2048x27_books[]={
   &_huff_book_line_2048x27_4sub3,
 };
 
-static static_codebook *_floor_512x17_books[]={
+static const static_codebook*const _floor_512x17_books[]={
   &_huff_book_line_512x17_class1,
   &_huff_book_line_512x17_class2,
   &_huff_book_line_512x17_class3,
-  
+
   &_huff_book_line_512x17_0sub0,
   &_huff_book_line_512x17_1sub0,
   &_huff_book_line_512x17_1sub1,
   &_huff_book_line_512x17_2sub1,
   &_huff_book_line_512x17_2sub2,
-  &_huff_book_line_512x17_2sub3, 
+  &_huff_book_line_512x17_2sub3,
   &_huff_book_line_512x17_3sub1,
   &_huff_book_line_512x17_3sub2,
-  &_huff_book_line_512x17_3sub3, 
+  &_huff_book_line_512x17_3sub3,
+};
+
+static const static_codebook*const _floor_Xx0_books[]={
+  0
 };
 
-static static_codebook **_floor_books[10]={
+static const static_codebook*const *const _floor_books[11]={
   _floor_128x4_books,
   _floor_256x4_books,
   _floor_128x7_books,
@@ -156,93 +160,101 @@ static static_codebook **_floor_books[10]={
   _floor_1024x27_books,
   _floor_2048x27_books,
   _floor_512x17_books,
+  _floor_Xx0_books,
 };
 
-static vorbis_info_floor1 _floor[10]={
-  /* 128 x 4 */
+static const vorbis_info_floor1 _floor[11]={
+  /* 0: 128 x 4 */
   {
     1,{0},{4},{2},{0},
     {{1,2,3,4}},
     4,{0,128, 33,8,16,70},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  128
   },
-  /* 256 x 4 */
+  /* 1: 256 x 4 */
   {
     1,{0},{4},{2},{0},
     {{1,2,3,4}},
     4,{0,256, 66,16,32,140},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  256
   },
-  /* 128 x 7 */
+  /* 2: 128 x 7 */
   {
     2,{0,1},{3,4},{2,2},{0,1},
     {{-1,2,3,4},{-1,5,6,7}},
     4,{0,128, 14,4,58, 2,8,28,90},
-    
-    60,30,500,   1.,18.,  -1
+
+    60,30,500,   1.,18.,  128
   },
-  /* 256 x 7 */
+  /* 3: 256 x 7 */
   {
     2,{0,1},{3,4},{2,2},{0,1},
     {{-1,2,3,4},{-1,5,6,7}},
     4,{0,256, 28,8,116, 4,16,56,180},
-    
-    60,30,500,   1.,18.,  -1
+
+    60,30,500,   1.,18.,  256
   },
-  /* 128 x 11 */
+  /* 4: 128 x 11 */
   {
     4,{0,1,2,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
     {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
-    
+
     2,{0,128,  8,33,  4,16,70,  2,6,12,  23,46,90},
-    
-     60,30,500,   1,18.,  -1
+
+     60,30,500,   1,18.,  128
   },
-  /* 128 x 17 */
+  /* 5: 128 x 17 */
   {
     6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
     {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
     2,{0,128,  12,46,  4,8,16,  23,33,70,  2,6,10,  14,19,28,  39,58,90},
-    
-    60,30,500,    1,18.,  -1 
+
+    60,30,500,    1,18.,  128
   },
-  /* 256 x 4 (low bitrate version) */
+  /* 6: 256 x 4 (low bitrate version) */
   {
     1,{0},{4},{2},{0},
     {{1,2,3,4}},
     4,{0,256, 66,16,32,140},
 
-    60,30,500,   1.,18.,  -1
+    60,30,500,   1.,18.,  256
   },
-  /* 1024 x 27 */
+  /* 7: 1024 x 27 */
   {
     8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
     {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
     2,{0,1024,   93,23,372, 6,46,186,750,  14,33,65, 130,260,556,
        3,10,18,28,  39,55,79,111,  158,220,312,  464,650,850},
-    
-    60,30,500,    3,18.,  -1 /* lowpass */
+
+    60,30,500,    3,18.,  1024
   },
-  /* 2048 x 27 */
+  /* 8: 2048 x 27 */
   {
     8,{0,1,2,2,3,3,4,4},{3,4,3,4,3},{0,1,1,2,2},{-1,0,1,2,3},
     {{4},{5,6},{7,8},{-1,9,10,11},{-1,12,13,14}},
     2,{0,2048,   186,46,744, 12,92,372,1500,  28,66,130, 260,520,1112,
        6,20,36,56,  78,110,158,222,  316,440,624,  928,1300,1700},
-    
-    60,30,500,    3,18.,  -1 /* lowpass */
+
+    60,30,500,    3,18.,  2048
   },
-  /* 512 x 17 */
+  /* 9: 512 x 17 */
   {
     6,{0,1,1,2,3,3},{2,3,3,3},{0,1,2,2},{-1,0,1,2},
     {{3},{4,5},{-1,6,7,8},{-1,9,10,11}},
-    2,{0,512,  46,186,  16,33,65,  93,130,278,  
+    2,{0,512,  46,186,  16,33,65,  93,130,278,
        7,23,39,  55,79,110,  156,232,360},
-    
-    60,30,500,    1,18.,  -1 /* lowpass! */
+
+    60,30,500,    1,18.,  512
   },
 
-};
+  /* 10: X x 0 (LFE floor; edge posts only) */
+  {
+    0,{0}, {0},{0},{-1},
+    {{-1}},
+    2,{0,12},
+    60,30,500,   1.,18.,  10
+  },
 
+};

+ 8 - 8
Engine/lib/libvorbis/lib/modes/psych_11.h

@@ -5,25 +5,25 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 11kHz settings 
- last mod: $Id: psych_11.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 11kHz settings
+ last mod: $Id: psych_11.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
-static double _psy_lowpass_11[3]={4.5,5.5,30.,};
+static const double _psy_lowpass_11[3]={4.5,5.5,30.,};
 
-static att3 _psy_tone_masteratt_11[3]={
+static const att3 _psy_tone_masteratt_11[3]={
   {{ 30,  25,  12},  0,   0},  /* 0 */
   {{ 30,  25,  12},  0,   0},  /* 0 */
   {{ 20,   0, -14},  0,   0}, /* 0 */
 };
 
-static vp_adjblock _vp_tonemask_adj_11[3]={
+static const vp_adjblock _vp_tonemask_adj_11[3]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
   {{-20,-20,-20,-20,-20,-16,-10, 0, 0, 0, 0,10, 2, 0,99,99,99}}, /* 0 */
@@ -32,7 +32,7 @@ static vp_adjblock _vp_tonemask_adj_11[3]={
 };
 
 
-static noise3 _psy_noisebias_11[3]={
+static const noise3 _psy_noisebias_11[3]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -5,  0,  4, 10, 10, 12, 12, 12, 99, 99, 99},
     {-15,-15,-15,-15,-10,-10, -5,  0,  0,  4,  4,  5,  5, 10, 99, 99, 99},
@@ -47,5 +47,5 @@ static noise3 _psy_noisebias_11[3]={
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24, 99, 99, 99}}},
 };
 
-static double _noise_thresh_11[3]={ .3,.5,.5 };
+static const double _noise_thresh_11[3]={ .3,.5,.5 };
 

+ 16 - 19
Engine/lib/libvorbis/lib/modes/psych_16.h

@@ -5,18 +5,18 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 16kHz settings 
- last mod: $Id: psych_16.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 16kHz settings
+ last mod: $Id: psych_16.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_16[4]={
+static const adj_stereo _psy_stereo_modes_16[4]={
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
   {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
    {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
@@ -36,16 +36,16 @@ static adj_stereo _psy_stereo_modes_16[4]={
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
 };
 
-static double _psy_lowpass_16[4]={6.5,8,30.,99.};
+static const double _psy_lowpass_16[4]={6.5,8,30.,99.};
 
-static att3 _psy_tone_masteratt_16[4]={
+static const att3 _psy_tone_masteratt_16[4]={
   {{ 30,  25,  12},  0,   0},  /* 0 */
   {{ 25,  22,  12},  0,   0},  /* 0 */
   {{ 20,  12,   0},  0,   0},  /* 0 */
   {{ 15,   0, -14},  0,   0}, /* 0 */
 };
 
-static vp_adjblock _vp_tonemask_adj_16[4]={
+static const vp_adjblock _vp_tonemask_adj_16[4]={
   /* adjust for mode zero */
   /* 63     125     250     500       1     2     4     8    16 */
   {{-20,-20,-20,-20,-20,-16,-10,  0,  0, 0, 0,10, 0, 0, 0, 0, 0}}, /* 0 */
@@ -55,7 +55,7 @@ static vp_adjblock _vp_tonemask_adj_16[4]={
 };
 
 
-static noise3 _psy_noisebias_16_short[4]={
+static const noise3 _psy_noisebias_16_short[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-15,-15,-15,-15,-15,-10,-10,-5,   4, 10, 10, 10, 10, 12, 12, 14, 20},
     {-15,-15,-15,-15,-15,-10,-10, -5,  0,  0,  4,  5,  5,  6,  8,  8, 15},
@@ -74,7 +74,7 @@ static noise3 _psy_noisebias_16_short[4]={
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static noise3 _psy_noisebias_16_impulse[4]={
+static const noise3 _psy_noisebias_16_impulse[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-15,-15,-15,-15,-15,-10,-10,-5,   4, 10, 10, 10, 10, 12, 12, 14, 20},
     {-15,-15,-15,-15,-15,-10,-10, -5,  0,  0,  4,  5,  5,  6,  8,  8, 15},
@@ -93,7 +93,7 @@ static noise3 _psy_noisebias_16_impulse[4]={
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static noise3 _psy_noisebias_16[4]={
+static const noise3 _psy_noisebias_16[4]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -5,  0,  4,  6,  8,  8, 10, 10, 10, 14, 20},
     {-10,-10,-10,-10,-10, -5, -2, -2,  0,  0,  0,  4,  5,  6,  8,  8, 15},
@@ -112,25 +112,22 @@ static noise3 _psy_noisebias_16[4]={
     {-30,-30,-30,-30,-26,-26,-26,-26,-26,-26,-26,-26,-26,-24,-20,-20,-20}}},
 };
 
-static noiseguard _psy_noiseguards_16[4]={
+static const noiseguard _psy_noiseguards_16[4]={
   {10,10,-1},
   {10,10,-1},
   {20,20,-1},
   {20,20,-1},
 };
 
-static double _noise_thresh_16[4]={ .3,.5,.5,.5 };
+static const double _noise_thresh_16[4]={ .3,.5,.5,.5 };
 
-static int _noise_start_16[3]={ 256,256,9999 };
-static int _noise_part_16[4]={ 8,8,8,8 };
+static const int _noise_start_16[3]={ 256,256,9999 };
+static const int _noise_part_16[4]={ 8,8,8,8 };
 
-static int _psy_ath_floater_16[4]={
+static const int _psy_ath_floater_16[4]={
   -100,-100,-100,-105,
 };
 
-static int _psy_ath_abs_16[4]={
+static const int _psy_ath_abs_16[4]={
   -130,-130,-130,-140,
 };
-
-
-

+ 48 - 72
Engine/lib/libvorbis/lib/modes/psych_44.h

@@ -5,47 +5,47 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: key psychoacoustic settings for 44.1/48kHz
- last mod: $Id: psych_44.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: psych_44.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
 
 /* preecho trigger settings *****************************************/
 
-static vorbis_info_psy_global _psy_global_44[5]={
+static const vorbis_info_psy_global _psy_global_44[5]={
 
   {8,   /* lines per eighth octave */
-   {20.f,14.f,12.f,12.f,12.f,12.f,12.f}, 
+   {20.f,14.f,12.f,12.f,12.f,12.f,12.f},
    {-60.f,-30.f,-40.f,-40.f,-40.f,-40.f,-40.f}, 2,-75.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
-   {14.f,10.f,10.f,10.f,10.f,10.f,10.f}, 
+   {14.f,10.f,10.f,10.f,10.f,10.f,10.f},
    {-40.f,-30.f,-25.f,-25.f,-25.f,-25.f,-25.f}, 2,-80.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
-   {12.f,10.f,10.f,10.f,10.f,10.f,10.f}, 
+   {12.f,10.f,10.f,10.f,10.f,10.f,10.f},
    {-20.f,-20.f,-15.f,-15.f,-15.f,-15.f,-15.f}, 0,-80.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
-   {10.f,8.f,8.f,8.f,8.f,8.f,8.f}, 
+   {10.f,8.f,8.f,8.f,8.f,8.f,8.f},
    {-20.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-80.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
   },
   {8,   /* lines per eighth octave */
-   {10.f,6.f,6.f,6.f,6.f,6.f,6.f}, 
+   {10.f,6.f,6.f,6.f,6.f,6.f,6.f},
    {-15.f,-15.f,-12.f,-12.f,-12.f,-12.f,-12.f}, 0,-85.f,
    -6.f,
    {99.},{{99.},{99.}},{0},{0},{{0.},{0.}}
@@ -53,7 +53,7 @@ static vorbis_info_psy_global _psy_global_44[5]={
 };
 
 /* noise compander lookups * low, mid, high quality ****************/
-static compandblock _psy_compand_44[6]={
+static const compandblock _psy_compand_44[6]={
   /* sub-mode Z short */
   {{
     0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
@@ -106,7 +106,7 @@ static compandblock _psy_compand_44[6]={
 
 /* tonal masking curve level adjustments *************************/
 
-static vp_adjblock _vp_tonemask_adj_longblock[12]={
+static const vp_adjblock _vp_tonemask_adj_longblock[12]={
 
    /* 63     125     250     500       1       2       4       8      16 */
 
@@ -146,7 +146,7 @@ static vp_adjblock _vp_tonemask_adj_longblock[12]={
    {{-16,-16,-16,-16,-16,-16,-16,-15,-14,-14,-14,-12, -9, -4, -2, -2,  0}}, /* 10 */
 };
 
-static vp_adjblock _vp_tonemask_adj_otherblock[12]={
+static const vp_adjblock _vp_tonemask_adj_otherblock[12]={
    /* 63     125     250     500       1       2       4       8      16 */
 
    {{ -3, -8,-13,-15,-10,-10, -9, -9, -9, -9, -9,  1,  1,  1,  1,  1,  1}}, /* -1 */
@@ -186,76 +186,76 @@ static vp_adjblock _vp_tonemask_adj_otherblock[12]={
 };
 
 /* noise bias (transition block) */
-static noise3 _psy_noisebias_trans[12]={
+static const noise3 _psy_noisebias_trans[12]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   /* -1 */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
     {-30,-30,-30,-30,-30,-24,-20,-14,-10, -6, -8, -8, -6, -6, -6, -4, -2}}},
-  /* 0 
+  /* 0
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4,  0,  0,  0,  0,  2,  4,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},*/
   {{{-15,-15,-15,-15,-15,-12, -6, -4,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14, -8, -4,  0,  0,  0,  0,  2,  3,   6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -6, -6, -6, -6, -4, -4, -4,  -2}}},
-  /* 1 
+  /* 1
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6, -4}}},*/
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  4,  4,  5,  5,  5,  8,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  1,   4},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -8, -8, -8, -8, -6, -6, -6,  -4}}},
-  /* 2 
+  /* 2
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -2, -2, -2, -2,  0,  2,  6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}}, */
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  5,  6,  10},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -2, -1,  0,  3},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -7, -4}}},
-  /* 3 
+  /* 3
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  6},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-15,-15,-15,-15,-15,-12,-10, -8,  0,  2,  2,  2,  4,  4,  4,  5,  8},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2,  0,  2},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
-  /* 4 
+  /* 4
   {{{-20,-20,-20,-20,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -1,  1,  5},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},*/
   {{{-20,-20,-20,-20,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10, -4, -3, -3, -3, -3, -2, -1,  1},
     {-30,-30,-30,-30,-26,-22,-20,-14,-10,-10,-10,-10,-10, -8, -8, -8, -4}}},
-  /* 5 
+  /* 5
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -2, -1,  2},
     {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}}, */
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-22,-16,-12, -6, -4, -4, -4, -4, -3, -1,  0},
     {-34,-34,-34,-34,-30,-24,-24,-18,-14,-12,-12,-12,-12,-10,-10, -9, -5}}},
-  /* 6 
+  /* 6
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-24,-18,-14, -8, -6, -6, -6, -6, -4, -2,  1},
     {-34,-34,-34,-34,-30,-26,-24,-18,-17,-15,-15,-15,-15,-13,-13,-12, -8}}},*/
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-24,-18,-14, -8, -6, -6, -6, -6, -5, -2,  0},
     {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},
-  /* 7 
+  /* 7
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-24,-18,-14,-12,-10, -8, -8, -8, -6, -4,  0},
     {-34,-34,-34,-34,-30,-26,-26,-24,-22,-19,-19,-19,-19,-18,-17,-16,-12}}},*/
   {{{-24,-24,-24,-24,-20,-18,-14, -8, -1,  1,  1,  1,  2,  3,  3,  4,  7},
     {-32,-32,-32,-32,-28,-24,-24,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2},
     {-34,-34,-34,-34,-30,-26,-26,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},
-  /* 8 
+  /* 8
   {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
     {-36,-36,-36,-36,-30,-30,-30,-24,-18,-14,-12,-10,-10,-10, -8, -6, -2},
     {-36,-36,-36,-36,-34,-30,-28,-26,-24,-24,-24,-24,-24,-24,-24,-20,-16}}},*/
-  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7}, 
+  {{{-24,-24,-24,-24,-22,-20,-15,-10, -8, -2,  0,  0,  0,  1,  2,  3,  7},
     {-36,-36,-36,-36,-30,-30,-30,-24,-20,-16,-16,-16,-16,-14,-12,-10, -7},
     {-36,-36,-36,-36,-34,-30,-28,-26,-24,-30,-30,-30,-30,-30,-30,-24,-20}}},
-  /* 9 
+  /* 9
   {{{-28,-28,-28,-28,-28,-28,-28,-20,-14, -8, -4, -4, -4, -4, -4, -2,  2},
     {-36,-36,-36,-36,-34,-32,-32,-28,-20,-16,-16,-16,-16,-14,-12,-10, -7},
     {-40,-40,-40,-40,-40,-40,-40,-32,-30,-30,-30,-30,-30,-30,-30,-24,-20}}},*/
@@ -269,7 +269,7 @@ static noise3 _psy_noisebias_trans[12]={
 };
 
 /*  noise bias (long block) */
-static noise3 _psy_noisebias_long[12]={
+static const noise3 _psy_noisebias_long[12]={
   /*63     125     250     500      1k       2k      4k      8k     16k*/
   /* -1 */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  0,  6,  6,  6,  6, 10, 10, 12,  20},
@@ -344,7 +344,7 @@ static noise3 _psy_noisebias_long[12]={
 };
 
 /* noise bias (impulse block) */
-static noise3 _psy_noisebias_impulse[12]={
+static const noise3 _psy_noisebias_impulse[12]={
   /*  63     125     250     500      1k      2k      4k      8k     16k*/
   /* -1 */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
@@ -378,7 +378,7 @@ static noise3 _psy_noisebias_impulse[12]={
   {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
     {-32,-32,-32,-32,-28,-24,-22,-16,-10, -6, -8, -8, -6, -6, -6, -4, -2},
     {-34,-34,-34,-34,-30,-26,-24,-18,-14,-12,-12,-12,-12,-12,-10, -9, -5}}},
-  /* 6 
+  /* 6
   {{{-20,-20,-20,-20,-20,-18,-14,-10, -4,  0,  0,  0,  0,  4,  4,  6, 11},
       {-34,-34,-34,-34,-30,-30,-24,-20,-12,-12,-14,-14,-10, -9, -8, -6, -4},
       {-34,-34,-34,-34,-34,-30,-26,-20,-16,-15,-15,-15,-15,-15,-13,-12, -8}}},*/
@@ -413,9 +413,9 @@ static noise3 _psy_noisebias_impulse[12]={
 };
 
 /* noise bias (padding block) */
-static noise3 _psy_noisebias_padding[12]={
+static const noise3 _psy_noisebias_padding[12]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
-  
+
   /* -1 */
   {{{-10,-10,-10,-10,-10, -4,  0,  0,  4,  8,  8,  8,  8, 10, 12, 14, 20},
     {-30,-30,-30,-30,-26,-20,-16, -8, -6, -6, -2,  2,  2,  3,  6,  6, 15},
@@ -471,45 +471,45 @@ static noise3 _psy_noisebias_padding[12]={
 };
 
 
-static noiseguard _psy_noiseguards_44[4]={
+static const noiseguard _psy_noiseguards_44[4]={
   {3,3,15},
   {3,3,15},
   {10,10,100},
   {10,10,100},
 };
 
-static int _psy_tone_suppress[12]={
+static const int _psy_tone_suppress[12]={
   -20,-20,-20,-20,-20,-24,-30,-40,-40,-45,-45,-45,
 };
-static int _psy_tone_0dB[12]={
+static const int _psy_tone_0dB[12]={
   90,90,95,95,95,95,105,105,105,105,105,105,
 };
-static int _psy_noise_suppress[12]={
+static const int _psy_noise_suppress[12]={
   -20,-20,-24,-24,-24,-24,-30,-40,-40,-45,-45,-45,
 };
 
-static vorbis_info_psy _psy_info_template={
+static const vorbis_info_psy _psy_info_template={
   /* blockflag */
   -1,
   /* ath_adjatt, ath_maxatt */
   -140.,-140.,
   /* tonemask att boost/decay,suppr,curves */
-  {0.f,0.f,0.f},     0.,0.,    -40.f, {0.},  
-  
+  {0.f,0.f,0.f},     0.,0.,    -40.f, {0.},
+
   /*noisemaskp,supp, low/high window, low/hi guard, minimum */
   1,          -0.f,           .5f, .5f,         0,0,0,
   /* noiseoffset*3, noisecompand, max_curve_dB */
   {{-1},{-1},{-1}},{-1},105.f,
-  /* noise normalization - channel_p, point_p, start, partition, thresh. */
-  0,0,-1,-1,0.,
+  /* noise normalization - noise_p, start, partition, thresh. */
+  0,-1,-1,0.,
 };
 
 /* ath ****************/
 
-static int _psy_ath_floater[12]={
+static const int _psy_ath_floater[12]={
   -100,-100,-100,-100,-100,-100,-105,-105,-105,-105,-110,-120,
 };
-static int _psy_ath_abs[12]={
+static const int _psy_ath_abs[12]={
   -130,-130,-130,-130,-140,-140,-140,-140,-140,-140,-140,-150,
 };
 
@@ -522,7 +522,7 @@ static int _psy_ath_abs[12]={
 /* various stereo possibilities */
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_44[12]={
+static const adj_stereo _psy_stereo_modes_44[12]={
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         -1  */
   {{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
    {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  5,  4,  3},
@@ -530,10 +530,6 @@ static adj_stereo _psy_stereo_modes_44[12]={
    { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},
 
 /*    0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         0  */
-/*{{  4,  4,  4,  4,  4,  4,  4,  3,  2,  2,  1,  0,  0,  0,  0},
-   {  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  5,  4,  3},
-   {  1,  2,  3,  4,  5,  5,  6,  6,  6,  6,  6,  7,  8,  8,  8},
-   { 12,12.5, 13,13.5, 14,14.5, 15, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  4,  4,  4,  4,  4,  4,  4,  3,  2,  1,  0,  0,  0,  0,  0},
    {  8,  8,  8,  8,  6,  6,  5,  5,  5,  5,  5,  5,  5,  4,  3},
    {  1,  2,  3,  4,  4,  5,  6,  6,  6,  6,  6,  8,  8,  8,  8},
@@ -548,10 +544,6 @@ static adj_stereo _psy_stereo_modes_44[12]={
 
 
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         2  */
-  /*  {{  3,  3,  3,  3,  3,  3,  2,  2,  2,  1,  0,  0,  0,  0,  0},
-      {  8,  8,  8,  6,  5,  5,  5,  5,  5,  5,  5,  4,  3,  2,  1},
-      {  3,  4,  4,  4,  5,  6,  6,  6,  6,  6,  6,  8,  8,  8,  8},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
   {{  3,  3,  3,  3,  3,  3,  3,  2,  1,  1,  0,  0,  0,  0,  0},
    {  8,  8,  6,  6,  5,  5,  4,  4,  4,  4,  4,  4,  3,  2,  1},
    {  3,  4,  4,  5,  5,  6,  6,  6,  6,  6,  6,  8,  8,  8,  8},
@@ -567,37 +559,21 @@ static adj_stereo _psy_stereo_modes_44[12]={
    {  6,  6,  6,  8,  8,  8,  8,  8,  8,  8, 10, 10, 10, 10, 10},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         5  */
-  /*  {{  2,  2,  2,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  0,  0,  0,  0},
-      {  6,  6,  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  2,  2,  2,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  0,  0,  0,  0},
    {  6,  7,  8,  8,  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         6  */
-  /*  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  3,  3,  3,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}}, */
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  3,  3,  3,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  8,  8,  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         7  */
-  /*  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  3,  3,  3,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  8,  8,  8,  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  3,  3,  3,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  8,  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14         8  */
-  /*  {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
-      {  8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10},
-      { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},*/
   {{  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0},
    {  8, 10, 10, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12},
@@ -615,7 +591,7 @@ static adj_stereo _psy_stereo_modes_44[12]={
 };
 
 /* tone master attenuation by base quality mode and bitrate tweak */
-static att3 _psy_tone_masteratt_44[12]={
+static const att3 _psy_tone_masteratt_44[12]={
   {{ 35,  21,   9},  0,    0}, /* -1 */
   {{ 30,  20,   8}, -2, 1.25}, /* 0 */
   /*  {{ 25,  14,   4},  0,    0}, *//* 1 */
@@ -633,34 +609,34 @@ static att3 _psy_tone_masteratt_44[12]={
 };
 
 /* lowpass by mode **************/
-static double _psy_lowpass_44[12]={
+static const double _psy_lowpass_44[12]={
   /*  15.1,15.8,16.5,17.9,20.5,48.,999.,999.,999.,999.,999. */
   13.9,15.1,15.8,16.5,17.2,18.9,20.1,48.,999.,999.,999.,999.
 };
 
 /* noise normalization **********/
 
-static int _noise_start_short_44[11]={
+static const int _noise_start_short_44[11]={
   /*  16,16,16,16,32,32,9999,9999,9999,9999 */
   32,16,16,16,32,9999,9999,9999,9999,9999,9999
 };
-static int _noise_start_long_44[11]={
+static const int _noise_start_long_44[11]={
   /*  128,128,128,256,512,512,9999,9999,9999,9999 */
   256,128,128,256,512,9999,9999,9999,9999,9999,9999
 };
 
-static int _noise_part_short_44[11]={
+static const int _noise_part_short_44[11]={
     8,8,8,8,8,8,8,8,8,8,8
 };
-static int _noise_part_long_44[11]={
+static const int _noise_part_long_44[11]={
     32,32,32,32,32,32,32,32,32,32,32
 };
 
-static double _noise_thresh_44[11]={
+static const double _noise_thresh_44[11]={
   /*  .2,.2,.3,.4,.5,.5,9999.,9999.,9999.,9999., */
    .2,.2,.2,.4,.6,9999.,9999.,9999.,9999.,9999.,9999.,
 };
 
-static double _noise_thresh_5only[2]={
+static const double _noise_thresh_5only[2]={
  .5,.5,
 };

+ 14 - 15
Engine/lib/libvorbis/lib/modes/psych_8.h

@@ -5,23 +5,23 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 8kHz psychoacoustic settings 
- last mod: $Id: psych_8.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 8kHz psychoacoustic settings
+ last mod: $Id: psych_8.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
-static att3 _psy_tone_masteratt_8[3]={
+static const att3 _psy_tone_masteratt_8[3]={
   {{ 32,  25,  12},  0,   0},  /* 0 */
   {{ 30,  25,  12},  0,   0},  /* 0 */
   {{ 20,   0, -14},  0,   0}, /* 0 */
 };
 
-static vp_adjblock _vp_tonemask_adj_8[3]={
+static const vp_adjblock _vp_tonemask_adj_8[3]={
   /* adjust for mode zero */
   /* 63     125     250     500     1     2     4     8    16 */
   {{-15,-15,-15,-15,-10,-10, -6, 0, 0, 0, 0,10, 0, 0,99,99,99}}, /* 1 */
@@ -30,7 +30,7 @@ static vp_adjblock _vp_tonemask_adj_8[3]={
 };
 
 
-static noise3 _psy_noisebias_8[3]={
+static const noise3 _psy_noisebias_8[3]={
   /*  63     125     250     500      1k       2k      4k      8k     16k*/
   {{{-10,-10,-10,-10, -5, -5, -5,  0,  4,  8,  8,  8, 10, 10, 99, 99, 99},
     {-10,-10,-10,-10, -5, -5, -5,  0,  0,  4,  4,  4,  4,  4, 99, 99, 99},
@@ -46,7 +46,7 @@ static noise3 _psy_noisebias_8[3]={
 };
 
 /* stereo mode by base quality level */
-static adj_stereo _psy_stereo_modes_8[3]={
+static const adj_stereo _psy_stereo_modes_8[3]={
   /*  0   1   2   3   4   5   6   7   8   9  10  11  12  13  14  */
   {{  4,  4,  4,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3},
    {  6,  5,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4},
@@ -62,12 +62,12 @@ static adj_stereo _psy_stereo_modes_8[3]={
    { 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99}},
 };
 
-static noiseguard _psy_noiseguards_8[2]={
+static const noiseguard _psy_noiseguards_8[2]={
   {10,10,-1},
   {10,10,-1},
 };
 
-static compandblock _psy_compand_8[2]={
+static const compandblock _psy_compand_8[2]={
   {{
      0, 1, 2, 3, 4, 5, 6,  7,     /* 7dB */
      8, 8, 9, 9,10,10,11, 11,     /* 15dB */
@@ -84,19 +84,18 @@ static compandblock _psy_compand_8[2]={
   }},
 };
 
-static double _psy_lowpass_8[3]={3.,4.,4.};
-static int _noise_start_8[2]={
+static const double _psy_lowpass_8[3]={3.,4.,4.};
+static const int _noise_start_8[2]={
   64,64,
 };
-static int _noise_part_8[2]={
+static const int _noise_part_8[2]={
   8,8,
 };
 
-static int _psy_ath_floater_8[3]={
+static const int _psy_ath_floater_8[3]={
   -100,-100,-105,
 };
 
-static int _psy_ath_abs_8[3]={
+static const int _psy_ath_abs_8[3]={
   -130,-130,-140,
 };
-

+ 31 - 31
Engine/lib/libvorbis/lib/modes/residue_16.h

@@ -1,23 +1,23 @@
 /********************************************************************
  *                                                                  *
- * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
+ * This FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE.   *
  * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: toplevel residue templates 16/22kHz
- last mod: $Id: residue_16.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: residue_16.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
 /***** residue backends *********************************************/
 
-static static_bookblock _resbook_16s_0={
+static const static_bookblock _resbook_16s_0={
   {
     {0},
     {0,0,&_16c0_s_p1_0},
@@ -31,7 +31,7 @@ static static_bookblock _resbook_16s_0={
     {&_16c0_s_p9_0,&_16c0_s_p9_1,&_16c0_s_p9_2}
    }
 };
-static static_bookblock _resbook_16s_1={
+static const static_bookblock _resbook_16s_1={
   {
     {0},
     {0,0,&_16c1_s_p1_0},
@@ -45,7 +45,7 @@ static static_bookblock _resbook_16s_1={
     {&_16c1_s_p9_0,&_16c1_s_p9_1,&_16c1_s_p9_2}
    }
 };
-static static_bookblock _resbook_16s_2={
+static const static_bookblock _resbook_16s_2={
   {
     {0},
     {0,0,&_16c2_s_p1_0},
@@ -60,37 +60,37 @@ static static_bookblock _resbook_16s_2={
    }
 };
 
-static vorbis_residue_template _res_16s_0[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_16s_0[]={
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__16c0_s_single,&_huff_book__16c0_s_single,
    &_resbook_16s_0,&_resbook_16s_0},
 };
-static vorbis_residue_template _res_16s_1[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_16s_1[]={
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__16c1_s_short,&_huff_book__16c1_s_short,
    &_resbook_16s_1,&_resbook_16s_1},
-  
-  {2,0,  &_residue_44_mid,
+
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__16c1_s_long,&_huff_book__16c1_s_long,
    &_resbook_16s_1,&_resbook_16s_1}
 };
-static vorbis_residue_template _res_16s_2[]={
-  {2,0,  &_residue_44_high,
+static const vorbis_residue_template _res_16s_2[]={
+  {2,0,32,  &_residue_44_high,
    &_huff_book__16c2_s_short,&_huff_book__16c2_s_short,
    &_resbook_16s_2,&_resbook_16s_2},
-  
-  {2,0,  &_residue_44_high,
+
+  {2,0,32,  &_residue_44_high,
    &_huff_book__16c2_s_long,&_huff_book__16c2_s_long,
    &_resbook_16s_2,&_resbook_16s_2}
 };
 
-static vorbis_mapping_template _mapres_template_16_stereo[3]={
+static const vorbis_mapping_template _mapres_template_16_stereo[3]={
   { _map_nominal, _res_16s_0 }, /* 0 */
   { _map_nominal, _res_16s_1 }, /* 1 */
   { _map_nominal, _res_16s_2 }, /* 2 */
 };
 
-static static_bookblock _resbook_16u_0={
+static const static_bookblock _resbook_16u_0={
   {
     {0},
     {0,0,&_16u0__p1_0},
@@ -102,7 +102,7 @@ static static_bookblock _resbook_16u_0={
     {&_16u0__p7_0,&_16u0__p7_1,&_16u0__p7_2}
    }
 };
-static static_bookblock _resbook_16u_1={
+static const static_bookblock _resbook_16u_1={
   {
     {0},
     {0,0,&_16u1__p1_0},
@@ -116,7 +116,7 @@ static static_bookblock _resbook_16u_1={
     {&_16u1__p9_0,&_16u1__p9_1,&_16u1__p9_2}
    }
 };
-static static_bookblock _resbook_16u_2={
+static const static_bookblock _resbook_16u_2={
   {
     {0},
     {0,0,&_16u2_p1_0},
@@ -131,32 +131,32 @@ static static_bookblock _resbook_16u_2={
    }
 };
 
-static vorbis_residue_template _res_16u_0[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_16u_0[]={
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__16u0__single,&_huff_book__16u0__single,
    &_resbook_16u_0,&_resbook_16u_0},
 };
-static vorbis_residue_template _res_16u_1[]={
-  {1,0,  &_residue_44_mid_un,
+static const vorbis_residue_template _res_16u_1[]={
+  {1,0,32,  &_residue_44_mid_un,
    &_huff_book__16u1__short,&_huff_book__16u1__short,
    &_resbook_16u_1,&_resbook_16u_1},
-  
-  {1,0,  &_residue_44_mid_un,
+
+  {1,0,32,  &_residue_44_mid_un,
    &_huff_book__16u1__long,&_huff_book__16u1__long,
    &_resbook_16u_1,&_resbook_16u_1}
 };
-static vorbis_residue_template _res_16u_2[]={
-  {1,0,  &_residue_44_hi_un,
+static const vorbis_residue_template _res_16u_2[]={
+  {1,0,32,  &_residue_44_hi_un,
    &_huff_book__16u2__short,&_huff_book__16u2__short,
    &_resbook_16u_2,&_resbook_16u_2},
-  
-  {1,0,  &_residue_44_hi_un,
+
+  {1,0,32,  &_residue_44_hi_un,
    &_huff_book__16u2__long,&_huff_book__16u2__long,
    &_resbook_16u_2,&_resbook_16u_2}
 };
 
 
-static vorbis_mapping_template _mapres_template_16_uncoupled[3]={
+static const vorbis_mapping_template _mapres_template_16_uncoupled[3]={
   { _map_nominal_u, _res_16u_0 }, /* 0 */
   { _map_nominal_u, _res_16u_1 }, /* 1 */
   { _map_nominal_u, _res_16u_2 }, /* 2 */

+ 65 - 67
Engine/lib/libvorbis/lib/modes/residue_44.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: toplevel residue templates for 32/44.1/48kHz
- last mod: $Id: residue_44.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: residue_44.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
@@ -21,34 +21,34 @@
 
 /***** residue backends *********************************************/
 
-static vorbis_info_residue0 _residue_44_low={
-  0,-1, -1, 9,-1,
-  /*  0     1     2     3     4     5     6     7  */
+static const vorbis_info_residue0 _residue_44_low={
+  0,-1, -1, 9,-1,-1,
+  /* 0   1   2   3   4   5   6   7  */
   {0},
   {-1},
-  {  .5,  1.5,  2.5,  2.5,  4.5,  8.5,  16.5, 32.5},
-  {  .5,   .5,   .5,  999., 4.5,  8.5,  16.5, 32.5},
+  {  0,  1,  2,  2,  4,  8, 16, 32},
+  {  0,  0,  0,999,  4,  8, 16, 32},
 };
 
-static vorbis_info_residue0 _residue_44_mid={
-  0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8  */
+static const vorbis_info_residue0 _residue_44_mid={
+  0,-1, -1, 10,-1,-1,
+  /* 0   1   2   3   4   5   6   7   8  */
   {0},
   {-1},
-  {  .5,  1.5,  1.5,  2.5,  2.5,  4.5,  8.5,  16.5, 32.5},
-  {  .5,   .5, 999.,   .5,  999., 4.5,  8.5,  16.5, 32.5},
+  {  0,  1,  1,  2,  2,  4,  8, 16, 32},
+  {  0,  0,999,  0,999,  4,  8, 16, 32},
 };
 
-static vorbis_info_residue0 _residue_44_high={
-  0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8  */
+static const vorbis_info_residue0 _residue_44_high={
+  0,-1, -1, 10,-1,-1,
+  /* 0   1   2   3   4   5   6   7   8  */
   {0},
   {-1},
-  {  .5,  1.5,  2.5,  4.5,  8.5, 16.5, 32.5, 71.5,157.5},
-  {  .5,  1.5,  2.5,  3.5,  4.5,  8.5, 16.5, 71.5,157.5},
+  {  0,  1,  2,  4,  8, 16, 32, 71,157},
+  {  0,  1,  2,  3,  4,  8, 16, 71,157},
 };
 
-static static_bookblock _resbook_44s_n1={
+static const static_bookblock _resbook_44s_n1={
   {
     {0},{0,0,&_44cn1_s_p1_0},{0,0,&_44cn1_s_p2_0},
     {0,0,&_44cn1_s_p3_0},{0,0,&_44cn1_s_p4_0},{0,0,&_44cn1_s_p5_0},
@@ -56,7 +56,7 @@ static static_bookblock _resbook_44s_n1={
     {&_44cn1_s_p8_0,&_44cn1_s_p8_1,&_44cn1_s_p8_2}
    }
 };
-static static_bookblock _resbook_44sm_n1={
+static const static_bookblock _resbook_44sm_n1={
   {
     {0},{0,0,&_44cn1_sm_p1_0},{0,0,&_44cn1_sm_p2_0},
     {0,0,&_44cn1_sm_p3_0},{0,0,&_44cn1_sm_p4_0},{0,0,&_44cn1_sm_p5_0},
@@ -65,7 +65,7 @@ static static_bookblock _resbook_44sm_n1={
    }
 };
 
-static static_bookblock _resbook_44s_0={
+static const static_bookblock _resbook_44s_0={
   {
     {0},{0,0,&_44c0_s_p1_0},{0,0,&_44c0_s_p2_0},
     {0,0,&_44c0_s_p3_0},{0,0,&_44c0_s_p4_0},{0,0,&_44c0_s_p5_0},
@@ -73,7 +73,7 @@ static static_bookblock _resbook_44s_0={
     {&_44c0_s_p8_0,&_44c0_s_p8_1,&_44c0_s_p8_2}
    }
 };
-static static_bookblock _resbook_44sm_0={
+static const static_bookblock _resbook_44sm_0={
   {
     {0},{0,0,&_44c0_sm_p1_0},{0,0,&_44c0_sm_p2_0},
     {0,0,&_44c0_sm_p3_0},{0,0,&_44c0_sm_p4_0},{0,0,&_44c0_sm_p5_0},
@@ -82,7 +82,7 @@ static static_bookblock _resbook_44sm_0={
    }
 };
 
-static static_bookblock _resbook_44s_1={
+static const static_bookblock _resbook_44s_1={
   {
     {0},{0,0,&_44c1_s_p1_0},{0,0,&_44c1_s_p2_0},
     {0,0,&_44c1_s_p3_0},{0,0,&_44c1_s_p4_0},{0,0,&_44c1_s_p5_0},
@@ -90,7 +90,7 @@ static static_bookblock _resbook_44s_1={
     {&_44c1_s_p8_0,&_44c1_s_p8_1,&_44c1_s_p8_2}
    }
 };
-static static_bookblock _resbook_44sm_1={
+static const static_bookblock _resbook_44sm_1={
   {
     {0},{0,0,&_44c1_sm_p1_0},{0,0,&_44c1_sm_p2_0},
     {0,0,&_44c1_sm_p3_0},{0,0,&_44c1_sm_p4_0},{0,0,&_44c1_sm_p5_0},
@@ -99,7 +99,7 @@ static static_bookblock _resbook_44sm_1={
    }
 };
 
-static static_bookblock _resbook_44s_2={
+static const static_bookblock _resbook_44s_2={
   {
     {0},{0,0,&_44c2_s_p1_0},{0,0,&_44c2_s_p2_0},{0,0,&_44c2_s_p3_0},
     {0,0,&_44c2_s_p4_0},{0,0,&_44c2_s_p5_0},{0,0,&_44c2_s_p6_0},
@@ -107,7 +107,7 @@ static static_bookblock _resbook_44s_2={
     {&_44c2_s_p9_0,&_44c2_s_p9_1,&_44c2_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_3={
+static const static_bookblock _resbook_44s_3={
   {
     {0},{0,0,&_44c3_s_p1_0},{0,0,&_44c3_s_p2_0},{0,0,&_44c3_s_p3_0},
     {0,0,&_44c3_s_p4_0},{0,0,&_44c3_s_p5_0},{0,0,&_44c3_s_p6_0},
@@ -115,7 +115,7 @@ static static_bookblock _resbook_44s_3={
     {&_44c3_s_p9_0,&_44c3_s_p9_1,&_44c3_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_4={
+static const static_bookblock _resbook_44s_4={
   {
     {0},{0,0,&_44c4_s_p1_0},{0,0,&_44c4_s_p2_0},{0,0,&_44c4_s_p3_0},
     {0,0,&_44c4_s_p4_0},{0,0,&_44c4_s_p5_0},{0,0,&_44c4_s_p6_0},
@@ -123,7 +123,7 @@ static static_bookblock _resbook_44s_4={
     {&_44c4_s_p9_0,&_44c4_s_p9_1,&_44c4_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_5={
+static const static_bookblock _resbook_44s_5={
   {
     {0},{0,0,&_44c5_s_p1_0},{0,0,&_44c5_s_p2_0},{0,0,&_44c5_s_p3_0},
     {0,0,&_44c5_s_p4_0},{0,0,&_44c5_s_p5_0},{0,0,&_44c5_s_p6_0},
@@ -131,7 +131,7 @@ static static_bookblock _resbook_44s_5={
     {&_44c5_s_p9_0,&_44c5_s_p9_1,&_44c5_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_6={
+static const static_bookblock _resbook_44s_6={
   {
     {0},{0,0,&_44c6_s_p1_0},{0,0,&_44c6_s_p2_0},{0,0,&_44c6_s_p3_0},
     {0,0,&_44c6_s_p4_0},
@@ -142,7 +142,7 @@ static static_bookblock _resbook_44s_6={
     {&_44c6_s_p9_0,&_44c6_s_p9_1,&_44c6_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_7={
+static const static_bookblock _resbook_44s_7={
   {
     {0},{0,0,&_44c7_s_p1_0},{0,0,&_44c7_s_p2_0},{0,0,&_44c7_s_p3_0},
     {0,0,&_44c7_s_p4_0},
@@ -153,7 +153,7 @@ static static_bookblock _resbook_44s_7={
     {&_44c7_s_p9_0,&_44c7_s_p9_1,&_44c7_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_8={
+static const static_bookblock _resbook_44s_8={
   {
     {0},{0,0,&_44c8_s_p1_0},{0,0,&_44c8_s_p2_0},{0,0,&_44c8_s_p3_0},
     {0,0,&_44c8_s_p4_0},
@@ -164,7 +164,7 @@ static static_bookblock _resbook_44s_8={
     {&_44c8_s_p9_0,&_44c8_s_p9_1,&_44c8_s_p9_2}
    }
 };
-static static_bookblock _resbook_44s_9={
+static const static_bookblock _resbook_44s_9={
   {
     {0},{0,0,&_44c9_s_p1_0},{0,0,&_44c9_s_p2_0},{0,0,&_44c9_s_p3_0},
     {0,0,&_44c9_s_p4_0},
@@ -176,108 +176,108 @@ static static_bookblock _resbook_44s_9={
    }
 };
 
-static vorbis_residue_template _res_44s_n1[]={
-  {2,0,  &_residue_44_low,
+static const vorbis_residue_template _res_44s_n1[]={
+  {2,0,32,  &_residue_44_low,
    &_huff_book__44cn1_s_short,&_huff_book__44cn1_sm_short,
    &_resbook_44s_n1,&_resbook_44sm_n1},
 
-  {2,0,  &_residue_44_low,
+  {2,0,32,  &_residue_44_low,
    &_huff_book__44cn1_s_long,&_huff_book__44cn1_sm_long,
    &_resbook_44s_n1,&_resbook_44sm_n1}
 };
-static vorbis_residue_template _res_44s_0[]={
-  {2,0,  &_residue_44_low,
+static const vorbis_residue_template _res_44s_0[]={
+  {2,0,16,  &_residue_44_low,
    &_huff_book__44c0_s_short,&_huff_book__44c0_sm_short,
    &_resbook_44s_0,&_resbook_44sm_0},
 
-  {2,0,  &_residue_44_low,
+  {2,0,32,  &_residue_44_low,
    &_huff_book__44c0_s_long,&_huff_book__44c0_sm_long,
    &_resbook_44s_0,&_resbook_44sm_0}
 };
-static vorbis_residue_template _res_44s_1[]={
-  {2,0,  &_residue_44_low,
+static const vorbis_residue_template _res_44s_1[]={
+  {2,0,16,  &_residue_44_low,
    &_huff_book__44c1_s_short,&_huff_book__44c1_sm_short,
    &_resbook_44s_1,&_resbook_44sm_1},
 
-  {2,0,  &_residue_44_low,
+  {2,0,32,  &_residue_44_low,
    &_huff_book__44c1_s_long,&_huff_book__44c1_sm_long,
    &_resbook_44s_1,&_resbook_44sm_1}
 };
 
-static vorbis_residue_template _res_44s_2[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_44s_2[]={
+  {2,0,16,  &_residue_44_mid,
    &_huff_book__44c2_s_short,&_huff_book__44c2_s_short,
    &_resbook_44s_2,&_resbook_44s_2},
 
-  {2,0,  &_residue_44_mid,
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__44c2_s_long,&_huff_book__44c2_s_long,
    &_resbook_44s_2,&_resbook_44s_2}
 };
-static vorbis_residue_template _res_44s_3[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_44s_3[]={
+  {2,0,16,  &_residue_44_mid,
    &_huff_book__44c3_s_short,&_huff_book__44c3_s_short,
    &_resbook_44s_3,&_resbook_44s_3},
 
-  {2,0,  &_residue_44_mid,
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__44c3_s_long,&_huff_book__44c3_s_long,
    &_resbook_44s_3,&_resbook_44s_3}
 };
-static vorbis_residue_template _res_44s_4[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_44s_4[]={
+  {2,0,16,  &_residue_44_mid,
    &_huff_book__44c4_s_short,&_huff_book__44c4_s_short,
    &_resbook_44s_4,&_resbook_44s_4},
 
-  {2,0,  &_residue_44_mid,
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__44c4_s_long,&_huff_book__44c4_s_long,
    &_resbook_44s_4,&_resbook_44s_4}
 };
-static vorbis_residue_template _res_44s_5[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_44s_5[]={
+  {2,0,16,  &_residue_44_mid,
    &_huff_book__44c5_s_short,&_huff_book__44c5_s_short,
    &_resbook_44s_5,&_resbook_44s_5},
 
-  {2,0,  &_residue_44_mid,
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__44c5_s_long,&_huff_book__44c5_s_long,
    &_resbook_44s_5,&_resbook_44s_5}
 };
-static vorbis_residue_template _res_44s_6[]={
-  {2,0,  &_residue_44_high,
+static const vorbis_residue_template _res_44s_6[]={
+  {2,0,16,  &_residue_44_high,
    &_huff_book__44c6_s_short,&_huff_book__44c6_s_short,
    &_resbook_44s_6,&_resbook_44s_6},
 
-  {2,0,  &_residue_44_high,
+  {2,0,32,  &_residue_44_high,
    &_huff_book__44c6_s_long,&_huff_book__44c6_s_long,
    &_resbook_44s_6,&_resbook_44s_6}
 };
-static vorbis_residue_template _res_44s_7[]={
-  {2,0,  &_residue_44_high,
+static const vorbis_residue_template _res_44s_7[]={
+  {2,0,16,  &_residue_44_high,
    &_huff_book__44c7_s_short,&_huff_book__44c7_s_short,
    &_resbook_44s_7,&_resbook_44s_7},
 
-  {2,0,  &_residue_44_high,
+  {2,0,32,  &_residue_44_high,
    &_huff_book__44c7_s_long,&_huff_book__44c7_s_long,
    &_resbook_44s_7,&_resbook_44s_7}
 };
-static vorbis_residue_template _res_44s_8[]={
-  {2,0,  &_residue_44_high,
+static const vorbis_residue_template _res_44s_8[]={
+  {2,0,16,  &_residue_44_high,
    &_huff_book__44c8_s_short,&_huff_book__44c8_s_short,
    &_resbook_44s_8,&_resbook_44s_8},
 
-  {2,0,  &_residue_44_high,
+  {2,0,32,  &_residue_44_high,
    &_huff_book__44c8_s_long,&_huff_book__44c8_s_long,
    &_resbook_44s_8,&_resbook_44s_8}
 };
-static vorbis_residue_template _res_44s_9[]={
-  {2,0,  &_residue_44_high,
+static const vorbis_residue_template _res_44s_9[]={
+  {2,0,16,  &_residue_44_high,
    &_huff_book__44c9_s_short,&_huff_book__44c9_s_short,
    &_resbook_44s_9,&_resbook_44s_9},
 
-  {2,0,  &_residue_44_high,
+  {2,0,32,  &_residue_44_high,
    &_huff_book__44c9_s_long,&_huff_book__44c9_s_long,
    &_resbook_44s_9,&_resbook_44s_9}
 };
 
-static vorbis_mapping_template _mapres_template_44_stereo[]={
+static const vorbis_mapping_template _mapres_template_44_stereo[]={
   { _map_nominal, _res_44s_n1 }, /* -1 */
   { _map_nominal, _res_44s_0 }, /* 0 */
   { _map_nominal, _res_44s_1 }, /* 1 */
@@ -290,5 +290,3 @@ static vorbis_mapping_template _mapres_template_44_stereo[]={
   { _map_nominal, _res_44s_8 }, /* 8 */
   { _map_nominal, _res_44s_9 }, /* 9 */
 };
-
-

+ 63 - 63
Engine/lib/libvorbis/lib/modes/residue_44u.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: toplevel residue templates for 32/44.1/48kHz uncoupled
- last mod: $Id: residue_44u.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: residue_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
@@ -22,41 +22,41 @@
 /***** residue backends *********************************************/
 
 
-static vorbis_info_residue0 _residue_44_low_un={
-  0,-1, -1, 8,-1,
+static const vorbis_info_residue0 _residue_44_low_un={
+  0,-1, -1, 8,-1,-1,
   {0},
   {-1},
-  {  .5,  1.5,  1.5,  2.5,  2.5,  4.5, 28.5},
-  {  -1,   25,   -1,   45,   -1,   -1,   -1}
+  {  0,  1,  1,  2,  2,  4, 28},
+  { -1, 25, -1, 45, -1, -1, -1}
 };
 
-static vorbis_info_residue0 _residue_44_mid_un={
-  0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8     9 */
+static const vorbis_info_residue0 _residue_44_mid_un={
+  0,-1, -1, 10,-1,-1,
+  /* 0   1   2   3   4   5   6   7   8   9 */
   {0},
   {-1},
-  {  .5,  1.5,  1.5,  2.5,  2.5,  4.5,  4.5, 16.5, 60.5},
-  {  -1,   30,   -1,   50,   -1,   80,   -1,   -1,   -1}
+  {  0,  1,  1,  2,  2,  4,  4, 16, 60},
+  { -1, 30, -1, 50, -1, 80, -1, -1, -1}
 };
 
-static vorbis_info_residue0 _residue_44_hi_un={
-  0,-1, -1, 10,-1,
-  /*  0     1     2     3     4     5     6     7     8     9 */
+static const vorbis_info_residue0 _residue_44_hi_un={
+  0,-1, -1, 10,-1,-1,
+  /* 0   1   2   3   4   5   6   7   8   9 */
   {0},
   {-1},
-  {  .5,  1.5,  2.5,  4.5,  8.5, 16.5, 32.5, 71.5,157.5},
-  {  -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1}
+  {  0,  1,  2,  4,  8, 16, 32, 71,157},
+  { -1, -1, -1, -1, -1, -1, -1, -1, -1}
 };
 
 /* mapping conventions:
    only one submap (this would change for efficient 5.1 support for example)*/
 /* Four psychoacoustic profiles are used, one for each blocktype */
-static vorbis_info_mapping0 _map_nominal_u[2]={
-  {1, {0,0}, {0}, {0}, 0,{0},{0}},
-  {1, {0,0}, {1}, {1}, 0,{0},{0}}
+static const vorbis_info_mapping0 _map_nominal_u[2]={
+  {1, {0,0,0,0,0,0}, {0}, {0}, 0,{0},{0}},
+  {1, {0,0,0,0,0,0}, {1}, {1}, 0,{0},{0}}
 };
 
-static static_bookblock _resbook_44u_n1={
+static const static_bookblock _resbook_44u_n1={
   {
     {0},
     {0,0,&_44un1__p1_0},
@@ -68,7 +68,7 @@ static static_bookblock _resbook_44u_n1={
     {&_44un1__p7_0,&_44un1__p7_1,&_44un1__p7_2}
    }
 };
-static static_bookblock _resbook_44u_0={
+static const static_bookblock _resbook_44u_0={
   {
     {0},
     {0,0,&_44u0__p1_0},
@@ -80,7 +80,7 @@ static static_bookblock _resbook_44u_0={
     {&_44u0__p7_0,&_44u0__p7_1,&_44u0__p7_2}
    }
 };
-static static_bookblock _resbook_44u_1={
+static const static_bookblock _resbook_44u_1={
   {
     {0},
     {0,0,&_44u1__p1_0},
@@ -92,7 +92,7 @@ static static_bookblock _resbook_44u_1={
     {&_44u1__p7_0,&_44u1__p7_1,&_44u1__p7_2}
    }
 };
-static static_bookblock _resbook_44u_2={
+static const static_bookblock _resbook_44u_2={
   {
     {0},
     {0,0,&_44u2__p1_0},
@@ -104,7 +104,7 @@ static static_bookblock _resbook_44u_2={
     {&_44u2__p7_0,&_44u2__p7_1,&_44u2__p7_2}
    }
 };
-static static_bookblock _resbook_44u_3={
+static const static_bookblock _resbook_44u_3={
   {
     {0},
     {0,0,&_44u3__p1_0},
@@ -116,7 +116,7 @@ static static_bookblock _resbook_44u_3={
     {&_44u3__p7_0,&_44u3__p7_1,&_44u3__p7_2}
    }
 };
-static static_bookblock _resbook_44u_4={
+static const static_bookblock _resbook_44u_4={
   {
     {0},
     {0,0,&_44u4__p1_0},
@@ -128,7 +128,7 @@ static static_bookblock _resbook_44u_4={
     {&_44u4__p7_0,&_44u4__p7_1,&_44u4__p7_2}
    }
 };
-static static_bookblock _resbook_44u_5={
+static const static_bookblock _resbook_44u_5={
   {
     {0},
     {0,0,&_44u5__p1_0},
@@ -142,7 +142,7 @@ static static_bookblock _resbook_44u_5={
     {&_44u5__p9_0,&_44u5__p9_1,&_44u5__p9_2}
    }
 };
-static static_bookblock _resbook_44u_6={
+static const static_bookblock _resbook_44u_6={
   {
     {0},
     {0,0,&_44u6__p1_0},
@@ -156,7 +156,7 @@ static static_bookblock _resbook_44u_6={
     {&_44u6__p9_0,&_44u6__p9_1,&_44u6__p9_2}
    }
 };
-static static_bookblock _resbook_44u_7={
+static const static_bookblock _resbook_44u_7={
   {
     {0},
     {0,0,&_44u7__p1_0},
@@ -170,7 +170,7 @@ static static_bookblock _resbook_44u_7={
     {&_44u7__p9_0,&_44u7__p9_1,&_44u7__p9_2}
    }
 };
-static static_bookblock _resbook_44u_8={
+static const static_bookblock _resbook_44u_8={
   {
     {0},
     {0,0,&_44u8_p1_0},
@@ -184,7 +184,7 @@ static static_bookblock _resbook_44u_8={
     {&_44u8_p9_0,&_44u8_p9_1,&_44u8_p9_2}
    }
 };
-static static_bookblock _resbook_44u_9={
+static const static_bookblock _resbook_44u_9={
   {
     {0},
     {0,0,&_44u9_p1_0},
@@ -199,111 +199,111 @@ static static_bookblock _resbook_44u_9={
    }
 };
 
-static vorbis_residue_template _res_44u_n1[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_44u_n1[]={
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44un1__short,&_huff_book__44un1__short,
    &_resbook_44u_n1,&_resbook_44u_n1},
 
-  {1,0,  &_residue_44_low_un,
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44un1__long,&_huff_book__44un1__long,
    &_resbook_44u_n1,&_resbook_44u_n1}
 };
-static vorbis_residue_template _res_44u_0[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_44u_0[]={
+  {1,0,16,  &_residue_44_low_un,
    &_huff_book__44u0__short,&_huff_book__44u0__short,
    &_resbook_44u_0,&_resbook_44u_0},
 
-  {1,0,  &_residue_44_low_un,
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44u0__long,&_huff_book__44u0__long,
    &_resbook_44u_0,&_resbook_44u_0}
 };
-static vorbis_residue_template _res_44u_1[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_44u_1[]={
+  {1,0,16,  &_residue_44_low_un,
    &_huff_book__44u1__short,&_huff_book__44u1__short,
    &_resbook_44u_1,&_resbook_44u_1},
 
-  {1,0,  &_residue_44_low_un,
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44u1__long,&_huff_book__44u1__long,
    &_resbook_44u_1,&_resbook_44u_1}
 };
-static vorbis_residue_template _res_44u_2[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_44u_2[]={
+  {1,0,16,  &_residue_44_low_un,
    &_huff_book__44u2__short,&_huff_book__44u2__short,
    &_resbook_44u_2,&_resbook_44u_2},
 
-  {1,0,  &_residue_44_low_un,
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44u2__long,&_huff_book__44u2__long,
    &_resbook_44u_2,&_resbook_44u_2}
 };
-static vorbis_residue_template _res_44u_3[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_44u_3[]={
+  {1,0,16,  &_residue_44_low_un,
    &_huff_book__44u3__short,&_huff_book__44u3__short,
    &_resbook_44u_3,&_resbook_44u_3},
 
-  {1,0,  &_residue_44_low_un,
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44u3__long,&_huff_book__44u3__long,
    &_resbook_44u_3,&_resbook_44u_3}
 };
-static vorbis_residue_template _res_44u_4[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_44u_4[]={
+  {1,0,16,  &_residue_44_low_un,
    &_huff_book__44u4__short,&_huff_book__44u4__short,
    &_resbook_44u_4,&_resbook_44u_4},
 
-  {1,0,  &_residue_44_low_un,
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__44u4__long,&_huff_book__44u4__long,
    &_resbook_44u_4,&_resbook_44u_4}
 };
 
-static vorbis_residue_template _res_44u_5[]={
-  {1,0,  &_residue_44_mid_un,
+static const vorbis_residue_template _res_44u_5[]={
+  {1,0,16,  &_residue_44_mid_un,
    &_huff_book__44u5__short,&_huff_book__44u5__short,
    &_resbook_44u_5,&_resbook_44u_5},
 
-  {1,0,  &_residue_44_mid_un,
+  {1,0,32,  &_residue_44_mid_un,
    &_huff_book__44u5__long,&_huff_book__44u5__long,
    &_resbook_44u_5,&_resbook_44u_5}
 };
 
-static vorbis_residue_template _res_44u_6[]={
-  {1,0,  &_residue_44_mid_un,
+static const vorbis_residue_template _res_44u_6[]={
+  {1,0,16,  &_residue_44_mid_un,
    &_huff_book__44u6__short,&_huff_book__44u6__short,
    &_resbook_44u_6,&_resbook_44u_6},
 
-  {1,0,  &_residue_44_mid_un,
+  {1,0,32,  &_residue_44_mid_un,
    &_huff_book__44u6__long,&_huff_book__44u6__long,
    &_resbook_44u_6,&_resbook_44u_6}
 };
 
-static vorbis_residue_template _res_44u_7[]={
-  {1,0,  &_residue_44_mid_un,
+static const vorbis_residue_template _res_44u_7[]={
+  {1,0,16,  &_residue_44_mid_un,
    &_huff_book__44u7__short,&_huff_book__44u7__short,
    &_resbook_44u_7,&_resbook_44u_7},
 
-  {1,0,  &_residue_44_mid_un,
+  {1,0,32,  &_residue_44_mid_un,
    &_huff_book__44u7__long,&_huff_book__44u7__long,
    &_resbook_44u_7,&_resbook_44u_7}
 };
 
-static vorbis_residue_template _res_44u_8[]={
-  {1,0,  &_residue_44_hi_un,
+static const vorbis_residue_template _res_44u_8[]={
+  {1,0,16,  &_residue_44_hi_un,
    &_huff_book__44u8__short,&_huff_book__44u8__short,
    &_resbook_44u_8,&_resbook_44u_8},
 
-  {1,0,  &_residue_44_hi_un,
+  {1,0,32,  &_residue_44_hi_un,
    &_huff_book__44u8__long,&_huff_book__44u8__long,
    &_resbook_44u_8,&_resbook_44u_8}
 };
-static vorbis_residue_template _res_44u_9[]={
-  {1,0,  &_residue_44_hi_un,
+static const vorbis_residue_template _res_44u_9[]={
+  {1,0,16,  &_residue_44_hi_un,
    &_huff_book__44u9__short,&_huff_book__44u9__short,
    &_resbook_44u_9,&_resbook_44u_9},
 
-  {1,0,  &_residue_44_hi_un,
+  {1,0,32,  &_residue_44_hi_un,
    &_huff_book__44u9__long,&_huff_book__44u9__long,
    &_resbook_44u_9,&_resbook_44u_9}
 };
 
-static vorbis_mapping_template _mapres_template_44_uncoupled[]={
+static const vorbis_mapping_template _mapres_template_44_uncoupled[]={
   { _map_nominal_u, _res_44u_n1 }, /* -1 */
   { _map_nominal_u, _res_44u_0 }, /* 0 */
   { _map_nominal_u, _res_44u_1 }, /* 1 */

+ 15 - 15
Engine/lib/libvorbis/lib/modes/residue_8.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: toplevel residue templates 8/11kHz
- last mod: $Id: residue_8.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: residue_8.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
@@ -20,7 +20,7 @@
 
 /***** residue backends *********************************************/
 
-static static_bookblock _resbook_8s_0={
+static const static_bookblock _resbook_8s_0={
   {
     {0},
     {0,0,&_8c0_s_p1_0},
@@ -34,7 +34,7 @@ static static_bookblock _resbook_8s_0={
     {&_8c0_s_p9_0,&_8c0_s_p9_1,&_8c0_s_p9_2}
    }
 };
-static static_bookblock _resbook_8s_1={
+static const static_bookblock _resbook_8s_1={
   {
     {0},
     {0,0,&_8c1_s_p1_0},
@@ -49,23 +49,23 @@ static static_bookblock _resbook_8s_1={
    }
 };
 
-static vorbis_residue_template _res_8s_0[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_8s_0[]={
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__8c0_s_single,&_huff_book__8c0_s_single,
    &_resbook_8s_0,&_resbook_8s_0},
 };
-static vorbis_residue_template _res_8s_1[]={
-  {2,0,  &_residue_44_mid,
+static const vorbis_residue_template _res_8s_1[]={
+  {2,0,32,  &_residue_44_mid,
    &_huff_book__8c1_s_single,&_huff_book__8c1_s_single,
    &_resbook_8s_1,&_resbook_8s_1},
 };
 
-static vorbis_mapping_template _mapres_template_8_stereo[2]={
+static const vorbis_mapping_template _mapres_template_8_stereo[2]={
   { _map_nominal, _res_8s_0 }, /* 0 */
   { _map_nominal, _res_8s_1 }, /* 1 */
 };
 
-static static_bookblock _resbook_8u_0={
+static const static_bookblock _resbook_8u_0={
   {
     {0},
     {0,0,&_8u0__p1_0},
@@ -77,7 +77,7 @@ static static_bookblock _resbook_8u_0={
     {&_8u0__p7_0,&_8u0__p7_1,&_8u0__p7_2}
    }
 };
-static static_bookblock _resbook_8u_1={
+static const static_bookblock _resbook_8u_1={
   {
     {0},
     {0,0,&_8u1__p1_0},
@@ -92,18 +92,18 @@ static static_bookblock _resbook_8u_1={
    }
 };
 
-static vorbis_residue_template _res_8u_0[]={
-  {1,0,  &_residue_44_low_un,
+static const vorbis_residue_template _res_8u_0[]={
+  {1,0,32,  &_residue_44_low_un,
    &_huff_book__8u0__single,&_huff_book__8u0__single,
    &_resbook_8u_0,&_resbook_8u_0},
 };
-static vorbis_residue_template _res_8u_1[]={
-  {1,0,  &_residue_44_mid_un,
+static const vorbis_residue_template _res_8u_1[]={
+  {1,0,32,  &_residue_44_mid_un,
    &_huff_book__8u1__single,&_huff_book__8u1__single,
    &_resbook_8u_1,&_resbook_8u_1},
 };
 
-static vorbis_mapping_template _mapres_template_8_uncoupled[2]={
+static const vorbis_mapping_template _mapres_template_8_uncoupled[2]={
   { _map_nominal_u, _res_8u_0 }, /* 0 */
   { _map_nominal_u, _res_8u_1 }, /* 1 */
 };

+ 22 - 20
Engine/lib/libvorbis/lib/modes/setup_11.h

@@ -5,46 +5,49 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 11kHz settings 
- last mod: $Id: setup_11.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 11kHz settings
+ last mod: $Id: setup_11.h 16894 2010-02-12 20:32:12Z xiphmont $
 
  ********************************************************************/
 
 #include "psych_11.h"
 
-static int blocksize_11[2]={
+static const int blocksize_11[2]={
   512,512
 };
 
-static int _floor_mapping_11[2]={
-  6,6,
+static const int _floor_mapping_11a[]={
+  6,6
+};
+static const int *_floor_mapping_11[]={
+  _floor_mapping_11a
 };
 
-static double rate_mapping_11[3]={
+static const double rate_mapping_11[3]={
   8000.,13000.,44000.,
 };
 
-static double rate_mapping_11_uncoupled[3]={
+static const double rate_mapping_11_uncoupled[3]={
   12000.,20000.,50000.,
 };
 
-static double quality_mapping_11[3]={
+static const double quality_mapping_11[3]={
   -.1,.0,1.
 };
 
-ve_setup_data_template ve_setup_11_stereo={
+static const ve_setup_data_template ve_setup_11_stereo={
   2,
   rate_mapping_11,
   quality_mapping_11,
   2,
   9000,
   15000,
-  
+
   blocksize_11,
   blocksize_11,
 
@@ -62,7 +65,7 @@ ve_setup_data_template ve_setup_11_stereo={
   NULL,
   NULL,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_8_mapping,
   NULL,
@@ -73,7 +76,7 @@ ve_setup_data_template ve_setup_11_stereo={
 
   _psy_ath_floater_8,
   _psy_ath_abs_8,
-  
+
   _psy_lowpass_11,
 
   _psy_global_44,
@@ -82,20 +85,20 @@ ve_setup_data_template ve_setup_11_stereo={
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_11,
-  NULL,
 
   _mapres_template_8_stereo
 };
 
-ve_setup_data_template ve_setup_11_uncoupled={
+static const ve_setup_data_template ve_setup_11_uncoupled={
   2,
   rate_mapping_11_uncoupled,
   quality_mapping_11,
   -1,
   9000,
   15000,
-  
+
   blocksize_11,
   blocksize_11,
 
@@ -113,7 +116,7 @@ ve_setup_data_template ve_setup_11_uncoupled={
   NULL,
   NULL,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_8_mapping,
   NULL,
@@ -124,7 +127,7 @@ ve_setup_data_template ve_setup_11_uncoupled={
 
   _psy_ath_floater_8,
   _psy_ath_abs_8,
-  
+
   _psy_lowpass_11,
 
   _psy_global_44,
@@ -133,9 +136,8 @@ ve_setup_data_template ve_setup_11_uncoupled={
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_11,
-  NULL,
 
   _mapres_template_8_uncoupled
 };
-

+ 27 - 23
Engine/lib/libvorbis/lib/modes/setup_16.h

@@ -5,55 +5,59 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 16kHz settings 
- last mod: $Id: setup_16.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 16kHz settings
+ last mod: $Id: setup_16.h 16894 2010-02-12 20:32:12Z xiphmont $
 
  ********************************************************************/
 
 #include "psych_16.h"
 #include "residue_16.h"
 
-static int blocksize_16_short[3]={
+static const int blocksize_16_short[3]={
   1024,512,512
 };
-static int blocksize_16_long[3]={
+static const int blocksize_16_long[3]={
   1024,1024,1024
 };
 
-static int _floor_mapping_16_short[3]={
+static const int _floor_mapping_16a[]={
   9,3,3
 };
-static int _floor_mapping_16[3]={
+static const int _floor_mapping_16b[]={
   9,9,9
 };
+static const int *_floor_mapping_16[]={
+  _floor_mapping_16a,
+  _floor_mapping_16b
+};
 
-static double rate_mapping_16[4]={
+static const double rate_mapping_16[4]={
   12000.,20000.,44000.,86000.
 };
 
-static double rate_mapping_16_uncoupled[4]={
+static const double rate_mapping_16_uncoupled[4]={
   16000.,28000.,64000.,100000.
 };
 
-static double _global_mapping_16[4]={ 1., 2., 3., 4. };
+static const double _global_mapping_16[4]={ 1., 2., 3., 4. };
 
-static double quality_mapping_16[4]={ -.1,.05,.5,1. };
+static const double quality_mapping_16[4]={ -.1,.05,.5,1. };
 
-static double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.};
+static const double _psy_compand_16_mapping[4]={ 0., .8, 1., 1.};
 
-ve_setup_data_template ve_setup_16_stereo={
+static const ve_setup_data_template ve_setup_16_stereo={
   3,
   rate_mapping_16,
   quality_mapping_16,
   2,
   15000,
   19000,
-  
+
   blocksize_16_short,
   blocksize_16_long,
 
@@ -71,7 +75,7 @@ ve_setup_data_template ve_setup_16_stereo={
   _psy_noisebias_16_short,
   _psy_noisebias_16,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_16_mapping,
   _psy_compand_16_mapping,
@@ -82,7 +86,7 @@ ve_setup_data_template ve_setup_16_stereo={
 
   _psy_ath_floater_16,
   _psy_ath_abs_16,
-  
+
   _psy_lowpass_16,
 
   _psy_global_44,
@@ -91,20 +95,20 @@ ve_setup_data_template ve_setup_16_stereo={
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_stereo
 };
 
-ve_setup_data_template ve_setup_16_uncoupled={
+static const ve_setup_data_template ve_setup_16_uncoupled={
   3,
   rate_mapping_16_uncoupled,
   quality_mapping_16,
   -1,
   15000,
   19000,
-  
+
   blocksize_16_short,
   blocksize_16_long,
 
@@ -116,13 +120,13 @@ ve_setup_data_template ve_setup_16_uncoupled={
   _vp_tonemask_adj_16,
   _vp_tonemask_adj_16,
 
-  _psy_noiseguards_8,
+  _psy_noiseguards_16,
   _psy_noisebias_16_impulse,
   _psy_noisebias_16_short,
   _psy_noisebias_16_short,
   _psy_noisebias_16,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_16_mapping,
   _psy_compand_16_mapping,
@@ -133,7 +137,7 @@ ve_setup_data_template ve_setup_16_uncoupled={
 
   _psy_ath_floater_16,
   _psy_ath_abs_16,
-  
+
   _psy_lowpass_16,
 
   _psy_global_44,
@@ -142,7 +146,7 @@ ve_setup_data_template ve_setup_16_uncoupled={
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_uncoupled

+ 21 - 21
Engine/lib/libvorbis/lib/modes/setup_22.h

@@ -5,34 +5,34 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 22kHz settings 
- last mod: $Id: setup_22.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 22kHz settings
+ last mod: $Id: setup_22.h 17026 2010-03-25 05:00:27Z xiphmont $
 
  ********************************************************************/
 
-static double rate_mapping_22[4]={
+static const double rate_mapping_22[4]={
   15000.,20000.,44000.,86000.
 };
 
-static double rate_mapping_22_uncoupled[4]={
+static const double rate_mapping_22_uncoupled[4]={
   16000.,28000.,50000.,90000.
 };
 
-static double _psy_lowpass_22[4]={9.5,11.,30.,99.};
+static const double _psy_lowpass_22[4]={9.5,11.,30.,99.};
 
-ve_setup_data_template ve_setup_22_stereo={
+static const ve_setup_data_template ve_setup_22_stereo={
   3,
   rate_mapping_22,
   quality_mapping_16,
   2,
   19000,
   26000,
-  
+
   blocksize_16_short,
   blocksize_16_long,
 
@@ -50,10 +50,10 @@ ve_setup_data_template ve_setup_22_stereo={
   _psy_noisebias_16_short,
   _psy_noisebias_16,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
-  _psy_compand_8_mapping,
-  _psy_compand_8_mapping,
+  _psy_compand_16_mapping,
+  _psy_compand_16_mapping,
 
   {_noise_start_16,_noise_start_16},
   { _noise_part_16, _noise_part_16},
@@ -61,7 +61,7 @@ ve_setup_data_template ve_setup_22_stereo={
 
   _psy_ath_floater_16,
   _psy_ath_abs_16,
-  
+
   _psy_lowpass_22,
 
   _psy_global_44,
@@ -70,20 +70,20 @@ ve_setup_data_template ve_setup_22_stereo={
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_stereo
 };
 
-ve_setup_data_template ve_setup_22_uncoupled={
+static const ve_setup_data_template ve_setup_22_uncoupled={
   3,
   rate_mapping_22_uncoupled,
   quality_mapping_16,
   -1,
   19000,
   26000,
-  
+
   blocksize_16_short,
   blocksize_16_long,
 
@@ -95,16 +95,16 @@ ve_setup_data_template ve_setup_22_uncoupled={
   _vp_tonemask_adj_16,
   _vp_tonemask_adj_16,
 
-  _psy_noiseguards_8,
+  _psy_noiseguards_16,
   _psy_noisebias_16_impulse,
   _psy_noisebias_16_short,
   _psy_noisebias_16_short,
   _psy_noisebias_16,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
-  _psy_compand_8_mapping,
-  _psy_compand_8_mapping,
+  _psy_compand_16_mapping,
+  _psy_compand_16_mapping,
 
   {_noise_start_16,_noise_start_16},
   { _noise_part_16, _noise_part_16},
@@ -112,7 +112,7 @@ ve_setup_data_template ve_setup_22_uncoupled={
 
   _psy_ath_floater_16,
   _psy_ath_abs_16,
-  
+
   _psy_lowpass_22,
 
   _psy_global_44,
@@ -121,7 +121,7 @@ ve_setup_data_template ve_setup_22_uncoupled={
 
   _floor_books,
   _floor,
-  _floor_mapping_16_short,
+  2,
   _floor_mapping_16,
 
   _mapres_template_16_uncoupled

+ 17 - 17
Engine/lib/libvorbis/lib/modes/setup_32.h

@@ -5,38 +5,38 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: toplevel settings for 32kHz
- last mod: $Id: setup_32.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: setup_32.h 16894 2010-02-12 20:32:12Z xiphmont $
 
  ********************************************************************/
 
-static double rate_mapping_32[12]={
+static const double rate_mapping_32[12]={
   18000.,28000.,35000.,45000.,56000.,60000.,
   75000.,90000.,100000.,115000.,150000.,190000.,
 };
 
-static double rate_mapping_32_un[12]={
+static const double rate_mapping_32_un[12]={
   30000.,42000.,52000.,64000.,72000.,78000.,
   86000.,92000.,110000.,120000.,140000.,190000.,
 };
 
-static double _psy_lowpass_32[12]={
+static const double _psy_lowpass_32[12]={
   12.3,13.,13.,14.,15.,99.,99.,99.,99.,99.,99.,99.
 };
 
-ve_setup_data_template ve_setup_32_stereo={
+static const ve_setup_data_template ve_setup_32_stereo={
   11,
   rate_mapping_32,
   quality_mapping_44,
   2,
   26000,
   40000,
-  
+
   blocksize_short_44,
   blocksize_long_44,
 
@@ -54,7 +54,7 @@ ve_setup_data_template ve_setup_32_stereo={
   _psy_noisebias_trans,
   _psy_noisebias_long,
   _psy_noise_suppress,
-  
+
   _psy_compand_44,
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
@@ -65,7 +65,7 @@ ve_setup_data_template ve_setup_32_stereo={
 
   _psy_ath_floater,
   _psy_ath_abs,
-  
+
   _psy_lowpass_32,
 
   _psy_global_44,
@@ -74,20 +74,20 @@ ve_setup_data_template ve_setup_32_stereo={
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_stereo
 };
 
-ve_setup_data_template ve_setup_32_uncoupled={
+static const ve_setup_data_template ve_setup_32_uncoupled={
   11,
   rate_mapping_32_un,
   quality_mapping_44,
   -1,
   26000,
   40000,
-  
+
   blocksize_short_44,
   blocksize_long_44,
 
@@ -105,7 +105,7 @@ ve_setup_data_template ve_setup_32_uncoupled={
   _psy_noisebias_trans,
   _psy_noisebias_long,
   _psy_noise_suppress,
-  
+
   _psy_compand_44,
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
@@ -116,7 +116,7 @@ ve_setup_data_template ve_setup_32_uncoupled={
 
   _psy_ath_floater,
   _psy_ath_abs,
-  
+
   _psy_lowpass_32,
 
   _psy_global_44,
@@ -125,8 +125,8 @@ ve_setup_data_template ve_setup_32_uncoupled={
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_uncoupled
 };

+ 28 - 18
Engine/lib/libvorbis/lib/modes/setup_44.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: toplevel settings for 44.1/48kHz
- last mod: $Id: setup_44.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: setup_44.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
@@ -19,49 +19,60 @@
 #include "modes/residue_44.h"
 #include "modes/psych_44.h"
 
-static double rate_mapping_44_stereo[12]={
+static const double rate_mapping_44_stereo[12]={
   22500.,32000.,40000.,48000.,56000.,64000.,
   80000.,96000.,112000.,128000.,160000.,250001.
 };
 
-static double quality_mapping_44[12]={
+static const double quality_mapping_44[12]={
   -.1,.0,.1,.2,.3,.4,.5,.6,.7,.8,.9,1.0
 };
 
-static int blocksize_short_44[11]={
+static const int blocksize_short_44[11]={
   512,256,256,256,256,256,256,256,256,256,256
 };
-static int blocksize_long_44[11]={
+static const int blocksize_long_44[11]={
   4096,2048,2048,2048,2048,2048,2048,2048,2048,2048,2048
 };
 
-static double _psy_compand_short_mapping[12]={
+static const double _psy_compand_short_mapping[12]={
   0.5, 1., 1., 1.3, 1.6, 2., 2., 2., 2., 2., 2., 2.
 };
-static double _psy_compand_long_mapping[12]={
+static const double _psy_compand_long_mapping[12]={
   3.5, 4., 4., 4.3, 4.6, 5., 5., 5., 5., 5., 5., 5.
 };
 
-static double _global_mapping_44[12]={
+static const double _global_mapping_44[12]={
   /* 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.5, 4., 4. */
  0., 1., 1., 1.5, 2., 2., 2.5, 2.7, 3.0, 3.7, 4., 4.
 };
 
-static int _floor_short_mapping_44[11]={
+static const int _floor_mapping_44a[11]={
   1,0,0,2,2,4,5,5,5,5,5
 };
-static int _floor_long_mapping_44[11]={
+
+static const int _floor_mapping_44b[11]={
   8,7,7,7,7,7,7,7,7,7,7
 };
 
-ve_setup_data_template ve_setup_44_stereo={
+static const int _floor_mapping_44c[11]={
+  10,10,10,10,10,10,10,10,10,10,10
+};
+
+static const int *_floor_mapping_44[]={
+  _floor_mapping_44a,
+  _floor_mapping_44b,
+  _floor_mapping_44c,
+};
+
+static const ve_setup_data_template ve_setup_44_stereo={
   11,
   rate_mapping_44_stereo,
   quality_mapping_44,
   2,
   40000,
   50000,
-  
+
   blocksize_short_44,
   blocksize_long_44,
 
@@ -79,7 +90,7 @@ ve_setup_data_template ve_setup_44_stereo={
   _psy_noisebias_trans,
   _psy_noisebias_long,
   _psy_noise_suppress,
-  
+
   _psy_compand_44,
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
@@ -90,7 +101,7 @@ ve_setup_data_template ve_setup_44_stereo={
 
   _psy_ath_floater,
   _psy_ath_abs,
-  
+
   _psy_lowpass_44,
 
   _psy_global_44,
@@ -99,9 +110,8 @@ ve_setup_data_template ve_setup_44_stereo={
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_stereo
 };
-

+ 10 - 10
Engine/lib/libvorbis/lib/modes/setup_44u.h

@@ -5,31 +5,31 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: toplevel settings for 44.1/48kHz uncoupled modes
- last mod: $Id: setup_44u.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: setup_44u.h 16962 2010-03-11 07:30:34Z xiphmont $
 
  ********************************************************************/
 
 #include "modes/residue_44u.h"
 
-static double rate_mapping_44_un[12]={
+static const double rate_mapping_44_un[12]={
   32000.,48000.,60000.,70000.,80000.,86000.,
   96000.,110000.,120000.,140000.,160000.,240001.
 };
 
-ve_setup_data_template ve_setup_44_uncoupled={
+static const ve_setup_data_template ve_setup_44_uncoupled={
   11,
   rate_mapping_44_un,
   quality_mapping_44,
   -1,
   40000,
   50000,
-  
+
   blocksize_short_44,
   blocksize_long_44,
 
@@ -47,7 +47,7 @@ ve_setup_data_template ve_setup_44_uncoupled={
   _psy_noisebias_trans,
   _psy_noisebias_long,
   _psy_noise_suppress,
-  
+
   _psy_compand_44,
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
@@ -58,17 +58,17 @@ ve_setup_data_template ve_setup_44_uncoupled={
 
   _psy_ath_floater,
   _psy_ath_abs,
-  
+
   _psy_lowpass_44,
 
   _psy_global_44,
   _global_mapping_44,
-  NULL,
+  _psy_stereo_modes_44,
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_uncoupled
 };

+ 25 - 22
Engine/lib/libvorbis/lib/modes/setup_8.h

@@ -5,51 +5,55 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
- function: 8kHz settings 
- last mod: $Id: setup_8.h 13293 2007-07-24 00:09:47Z xiphmont $
+ function: 8kHz settings
+ last mod: $Id: setup_8.h 16894 2010-02-12 20:32:12Z xiphmont $
 
  ********************************************************************/
 
 #include "psych_8.h"
 #include "residue_8.h"
 
-static int blocksize_8[2]={
+static const int blocksize_8[2]={
   512,512
 };
 
-static int _floor_mapping_8[2]={
-  6,6,
+static const int _floor_mapping_8a[]={
+  6,6
 };
 
-static double rate_mapping_8[3]={
+static const int *_floor_mapping_8[]={
+  _floor_mapping_8a
+};
+
+static const double rate_mapping_8[3]={
   6000.,9000.,32000.,
 };
 
-static double rate_mapping_8_uncoupled[3]={
+static const double rate_mapping_8_uncoupled[3]={
   8000.,14000.,42000.,
 };
 
-static double quality_mapping_8[3]={
+static const double quality_mapping_8[3]={
   -.1,.0,1.
 };
 
-static double _psy_compand_8_mapping[3]={ 0., 1., 1.};
+static const double _psy_compand_8_mapping[3]={ 0., 1., 1.};
 
-static double _global_mapping_8[3]={ 1., 2., 3. };
+static const double _global_mapping_8[3]={ 1., 2., 3. };
 
-ve_setup_data_template ve_setup_8_stereo={
+static const ve_setup_data_template ve_setup_8_stereo={
   2,
   rate_mapping_8,
   quality_mapping_8,
   2,
   8000,
   9000,
-  
+
   blocksize_8,
   blocksize_8,
 
@@ -67,7 +71,7 @@ ve_setup_data_template ve_setup_8_stereo={
   NULL,
   NULL,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_8_mapping,
   NULL,
@@ -78,7 +82,7 @@ ve_setup_data_template ve_setup_8_stereo={
 
   _psy_ath_floater_8,
   _psy_ath_abs_8,
-  
+
   _psy_lowpass_8,
 
   _psy_global_44,
@@ -87,20 +91,20 @@ ve_setup_data_template ve_setup_8_stereo={
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_stereo
 };
 
-ve_setup_data_template ve_setup_8_uncoupled={
+static const ve_setup_data_template ve_setup_8_uncoupled={
   2,
   rate_mapping_8_uncoupled,
   quality_mapping_8,
   -1,
   8000,
   9000,
-  
+
   blocksize_8,
   blocksize_8,
 
@@ -118,7 +122,7 @@ ve_setup_data_template ve_setup_8_uncoupled={
   NULL,
   NULL,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_8_mapping,
   NULL,
@@ -129,7 +133,7 @@ ve_setup_data_template ve_setup_8_uncoupled={
 
   _psy_ath_floater_8,
   _psy_ath_abs_8,
-  
+
   _psy_lowpass_8,
 
   _psy_global_44,
@@ -138,9 +142,8 @@ ve_setup_data_template ve_setup_8_uncoupled={
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_uncoupled
 };
-

+ 25 - 26
Engine/lib/libvorbis/lib/modes/setup_X.h

@@ -5,29 +5,29 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: catch-all toplevel settings for q modes only
- last mod: $Id: setup_X.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: setup_X.h 16894 2010-02-12 20:32:12Z xiphmont $
 
  ********************************************************************/
 
-static double rate_mapping_X[12]={
+static const double rate_mapping_X[12]={
   -1.,-1.,-1.,-1.,-1.,-1.,
   -1.,-1.,-1.,-1.,-1.,-1.
 };
 
-ve_setup_data_template ve_setup_X_stereo={
+static const ve_setup_data_template ve_setup_X_stereo={
   11,
   rate_mapping_X,
   quality_mapping_44,
   2,
   50000,
   200000,
-  
+
   blocksize_short_44,
   blocksize_long_44,
 
@@ -45,7 +45,7 @@ ve_setup_data_template ve_setup_X_stereo={
   _psy_noisebias_trans,
   _psy_noisebias_long,
   _psy_noise_suppress,
-  
+
   _psy_compand_44,
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
@@ -56,7 +56,7 @@ ve_setup_data_template ve_setup_X_stereo={
 
   _psy_ath_floater,
   _psy_ath_abs,
-  
+
   _psy_lowpass_44,
 
   _psy_global_44,
@@ -65,20 +65,20 @@ ve_setup_data_template ve_setup_X_stereo={
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_stereo
 };
 
-ve_setup_data_template ve_setup_X_uncoupled={
+static const ve_setup_data_template ve_setup_X_uncoupled={
   11,
   rate_mapping_X,
   quality_mapping_44,
   -1,
   50000,
   200000,
-  
+
   blocksize_short_44,
   blocksize_long_44,
 
@@ -96,7 +96,7 @@ ve_setup_data_template ve_setup_X_uncoupled={
   _psy_noisebias_trans,
   _psy_noisebias_long,
   _psy_noise_suppress,
-  
+
   _psy_compand_44,
   _psy_compand_short_mapping,
   _psy_compand_long_mapping,
@@ -107,7 +107,7 @@ ve_setup_data_template ve_setup_X_uncoupled={
 
   _psy_ath_floater,
   _psy_ath_abs,
-  
+
   _psy_lowpass_44,
 
   _psy_global_44,
@@ -116,20 +116,20 @@ ve_setup_data_template ve_setup_X_uncoupled={
 
   _floor_books,
   _floor,
-  _floor_short_mapping_44,
-  _floor_long_mapping_44,
+  2,
+  _floor_mapping_44,
 
   _mapres_template_44_uncoupled
 };
 
-ve_setup_data_template ve_setup_XX_stereo={
+static const ve_setup_data_template ve_setup_XX_stereo={
   2,
   rate_mapping_X,
   quality_mapping_8,
   2,
   0,
   8000,
-  
+
   blocksize_8,
   blocksize_8,
 
@@ -147,7 +147,7 @@ ve_setup_data_template ve_setup_XX_stereo={
   NULL,
   NULL,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_8_mapping,
   NULL,
@@ -158,7 +158,7 @@ ve_setup_data_template ve_setup_XX_stereo={
 
   _psy_ath_floater_8,
   _psy_ath_abs_8,
-  
+
   _psy_lowpass_8,
 
   _psy_global_44,
@@ -167,20 +167,20 @@ ve_setup_data_template ve_setup_XX_stereo={
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_stereo
 };
 
-ve_setup_data_template ve_setup_XX_uncoupled={
+static const ve_setup_data_template ve_setup_XX_uncoupled={
   2,
   rate_mapping_X,
   quality_mapping_8,
   -1,
   0,
   8000,
-  
+
   blocksize_8,
   blocksize_8,
 
@@ -198,7 +198,7 @@ ve_setup_data_template ve_setup_XX_uncoupled={
   NULL,
   NULL,
   _psy_noise_suppress,
-  
+
   _psy_compand_8,
   _psy_compand_8_mapping,
   NULL,
@@ -209,7 +209,7 @@ ve_setup_data_template ve_setup_XX_uncoupled={
 
   _psy_ath_floater_8,
   _psy_ath_abs_8,
-  
+
   _psy_lowpass_8,
 
   _psy_global_44,
@@ -218,9 +218,8 @@ ve_setup_data_template ve_setup_XX_uncoupled={
 
   _floor_books,
   _floor,
+  1,
   _floor_mapping_8,
-  NULL,
 
   _mapres_template_8_uncoupled
 };
-

+ 48 - 18
Engine/lib/libvorbis/lib/os.h

@@ -7,13 +7,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: os.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -47,7 +47,7 @@
 
 #if defined(_WIN32) && !defined(__SYMBIAN32__)
 #  include <malloc.h>
-#  define rint(x)   (floor((x)+0.5f)) 
+#  define rint(x)   (floor((x)+0.5f))
 #  define NO_FLOAT_MATH_LIB
 #  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
 #endif
@@ -79,6 +79,8 @@ void *_alloca(size_t size);
 #  define max(x,y)  ((x)<(y)?(y):(x))
 #endif
 
+
+/* Special i386 GCC implementation */
 #if defined(__i386__) && defined(__GNUC__) && !defined(__BEOS__)
 #  define VORBIS_FPU_CONTROL
 /* both GCC and MSVC are kinda stupid about rounding/casting to int.
@@ -94,10 +96,10 @@ static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
   ogg_int16_t ret;
   ogg_int16_t temp;
   __asm__ __volatile__("fnstcw %0\n\t"
-	  "movw %0,%%dx\n\t"
-	  "orw $62463,%%dx\n\t"
-	  "movw %%dx,%1\n\t"
-	  "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
+          "movw %0,%%dx\n\t"
+          "andw $62463,%%dx\n\t"
+          "movw %%dx,%1\n\t"
+          "fldcw %1\n\t":"=m"(ret):"m"(temp): "dx");
   *fpu=ret;
 }
 
@@ -113,21 +115,23 @@ static inline int vorbis_ftoi(double f){  /* yes, double!  Otherwise,
   __asm__("fistl %0": "=m"(i) : "t"(f));
   return(i);
 }
-#endif
+#endif /* Special i386 GCC implementation */
 
 
-#if defined(_WIN32) && !defined(__GNUC__) && !defined(__BORLANDC__) && !defined(_XBOX_VER)
+/* MSVC inline assembly. 32 bit only; inline ASM isn't implemented in the
+ * 64 bit compiler */
+#if defined(_MSC_VER) && !defined(_WIN64) && !defined(_WIN32_WCE)
 #  define VORBIS_FPU_CONTROL
 
 typedef ogg_int16_t vorbis_fpu_control;
 
 static __inline int vorbis_ftoi(double f){
-	int i;
-	__asm{
-		fld f
-		fistp i
-	}
-	return i;
+        int i;
+        __asm{
+                fld f
+                fistp i
+        }
+        return i;
 }
 
 static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
@@ -136,21 +140,47 @@ static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
 static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
 }
 
-#endif
+#endif /* Special MSVC 32 bit implementation */
+
+
+/* Optimized code path for x86_64 builds. Uses SSE2 intrinsics. This can be
+   done safely because all x86_64 CPUs supports SSE2. */
+#if (defined(_MSC_VER) && defined(_WIN64)) || (defined(__GNUC__) && defined (__x86_64__))
+#  define VORBIS_FPU_CONTROL
+
+typedef ogg_int16_t vorbis_fpu_control;
+
+#include <emmintrin.h>
+static __inline int vorbis_ftoi(double f){
+        return _mm_cvtsd_si32(_mm_load_sd(&f));
+}
+
+static __inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
+}
 
+static __inline void vorbis_fpu_restore(vorbis_fpu_control fpu){
+}
+
+#endif /* Special MSVC x64 implementation */
 
+
+/* If no special implementation was found for the current compiler / platform,
+   use the default implementation here: */
 #ifndef VORBIS_FPU_CONTROL
 
 typedef int vorbis_fpu_control;
 
 static int vorbis_ftoi(double f){
-  return (int)(f+.5);
+        /* Note: MSVC and GCC (at least on some systems) round towards zero, thus,
+           the floor() call is required to ensure correct roudning of
+           negative numbers */
+        return (int)floor(f+.5);
 }
 
 /* We don't have special code for this compiler/arch, so do it the slow way */
 #  define vorbis_fpu_setround(vorbis_fpu_control) {}
 #  define vorbis_fpu_restore(vorbis_fpu_control) {}
 
-#endif
+#endif /* default implementation */
 
 #endif /* _OS_H */

+ 550 - 571
Engine/lib/libvorbis/lib/psy.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2010             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: psy.c 18077 2011-09-02 02:49:00Z giles $
 
  ********************************************************************/
 
@@ -30,8 +30,8 @@
 #include "misc.h"
 
 #define NEGINF -9999.f
-static double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
-static double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
+static const double stereo_threshholds[]={0.0, .5, 1.0, 1.5, 2.5, 4.5, 8.5, 16.5, 9e10};
+static const double stereo_threshholds_limited[]={0.0, .5, 1.0, 1.5, 2.0, 2.5, 4.5, 8.5, 9e10};
 
 vorbis_look_psy_global *_vp_global_look(vorbis_info *vi){
   codec_setup_info *ci=vi->codec_setup;
@@ -67,13 +67,13 @@ void _vi_psy_free(vorbis_info_psy *i){
 }
 
 static void min_curve(float *c,
-		       float *c2){
-  int i;  
+                       float *c2){
+  int i;
   for(i=0;i<EHMER_MAX;i++)if(c2[i]<c[i])c[i]=c2[i];
 }
 static void max_curve(float *c,
-		       float *c2){
-  int i;  
+                       float *c2){
+  int i;
   for(i=0;i<EHMER_MAX;i++)if(c2[i]>c[i])c[i]=c2[i];
 }
 
@@ -84,7 +84,7 @@ static void attenuate_curve(float *c,float att){
 }
 
 static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
-				  float center_boost, float center_decay_rate){
+                                  float center_boost, float center_decay_rate){
   int i,j,k,m;
   float ath[EHMER_MAX];
   float workc[P_BANDS][P_LEVELS][EHMER_MAX];
@@ -101,16 +101,16 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
        curve limiting (last step). */
 
     /* A half-band's settings must be valid over the whole band, and
-       it's better to mask too little than too much */  
+       it's better to mask too little than too much */
     int ath_offset=i*4;
     for(j=0;j<EHMER_MAX;j++){
       float min=999.;
       for(k=0;k<4;k++)
-	if(j+k+ath_offset<MAX_ATH){
-	  if(min>ATH[j+k+ath_offset])min=ATH[j+k+ath_offset];
-	}else{
-	  if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1];
-	}
+        if(j+k+ath_offset<MAX_ATH){
+          if(min>ATH[j+k+ath_offset])min=ATH[j+k+ath_offset];
+        }else{
+          if(min>ATH[MAX_ATH-1])min=ATH[MAX_ATH-1];
+        }
       ath[j]=min;
     }
 
@@ -120,14 +120,14 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
       memcpy(workc[i][j+2],tonemasks[i][j],EHMER_MAX*sizeof(*tonemasks[i][j]));
     memcpy(workc[i][0],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
     memcpy(workc[i][1],tonemasks[i][0],EHMER_MAX*sizeof(*tonemasks[i][0]));
-    
+
     /* apply centered curve boost/decay */
     for(j=0;j<P_LEVELS;j++){
       for(k=0;k<EHMER_MAX;k++){
-	float adj=center_boost+abs(EHMER_OFFSET-k)*center_decay_rate;
-	if(adj<0. && center_boost>0)adj=0.;
-	if(adj>0. && center_boost<0)adj=0.;
-	workc[i][j][k]+=adj;
+        float adj=center_boost+abs(EHMER_OFFSET-k)*center_decay_rate;
+        if(adj<0. && center_boost>0)adj=0.;
+        if(adj>0. && center_boost<0)adj=0.;
+        workc[i][j][k]+=adj;
       }
     }
 
@@ -141,7 +141,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
     }
 
     /* Now limit the louder curves.
-       
+
        the idea is this: We don't know what the playback attenuation
        will be; 0dB SL moves every time the user twiddles the volume
        knob. So that means we have to use a single 'most pessimal' curve
@@ -149,7 +149,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
        can be in (we assume) a range of ...+100dB] SL.  However, sounds
        20dB down will be in a range ...+80], 40dB down is from ...+60],
        etc... */
-    
+
     for(j=1;j<P_LEVELS;j++){
       min_curve(athc[j],athc[j-1]);
       min_curve(workc[i][j],athc[j]);
@@ -168,7 +168,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
        composite of multiple octaves.  It also may mean that a single
        bin may span > an eighth of an octave and that the eighth
        octave values may also be composited. */
-    
+
     /* which octave curves will we be compositing? */
     bin=floor(fromOC(i*.5)/binHz);
     lo_curve=  ceil(toOC(bin*binHz+1)*2);
@@ -179,83 +179,83 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
 
     for(m=0;m<P_LEVELS;m++){
       ret[i][m]=_ogg_malloc(sizeof(***ret)*(EHMER_MAX+2));
-      
+
       for(j=0;j<n;j++)brute_buffer[j]=999.;
-      
+
       /* render the curve into bins, then pull values back into curve.
-	 The point is that any inherent subsampling aliasing results in
-	 a safe minimum */
+         The point is that any inherent subsampling aliasing results in
+         a safe minimum */
       for(k=lo_curve;k<=hi_curve;k++){
-	int l=0;
-
-	for(j=0;j<EHMER_MAX;j++){
-	  int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz;
-	  int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1;
-	  
-	  if(lo_bin<0)lo_bin=0;
-	  if(lo_bin>n)lo_bin=n;
-	  if(lo_bin<l)l=lo_bin;
-	  if(hi_bin<0)hi_bin=0;
-	  if(hi_bin>n)hi_bin=n;
-
-	  for(;l<hi_bin && l<n;l++)
-	    if(brute_buffer[l]>workc[k][m][j])
-	      brute_buffer[l]=workc[k][m][j];
-	}
-
-	for(;l<n;l++)
-	  if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
-	    brute_buffer[l]=workc[k][m][EHMER_MAX-1];
+        int l=0;
+
+        for(j=0;j<EHMER_MAX;j++){
+          int lo_bin= fromOC(j*.125+k*.5-2.0625)/binHz;
+          int hi_bin= fromOC(j*.125+k*.5-1.9375)/binHz+1;
+
+          if(lo_bin<0)lo_bin=0;
+          if(lo_bin>n)lo_bin=n;
+          if(lo_bin<l)l=lo_bin;
+          if(hi_bin<0)hi_bin=0;
+          if(hi_bin>n)hi_bin=n;
+
+          for(;l<hi_bin && l<n;l++)
+            if(brute_buffer[l]>workc[k][m][j])
+              brute_buffer[l]=workc[k][m][j];
+        }
+
+        for(;l<n;l++)
+          if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
+            brute_buffer[l]=workc[k][m][EHMER_MAX-1];
 
       }
 
       /* be equally paranoid about being valid up to next half ocatve */
       if(i+1<P_BANDS){
-	int l=0;
-	k=i+1;
-	for(j=0;j<EHMER_MAX;j++){
-	  int lo_bin= fromOC(j*.125+i*.5-2.0625)/binHz;
-	  int hi_bin= fromOC(j*.125+i*.5-1.9375)/binHz+1;
-	  
-	  if(lo_bin<0)lo_bin=0;
-	  if(lo_bin>n)lo_bin=n;
-	  if(lo_bin<l)l=lo_bin;
-	  if(hi_bin<0)hi_bin=0;
-	  if(hi_bin>n)hi_bin=n;
-
-	  for(;l<hi_bin && l<n;l++)
-	    if(brute_buffer[l]>workc[k][m][j])
-	      brute_buffer[l]=workc[k][m][j];
-	}
-
-	for(;l<n;l++)
-	  if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
-	    brute_buffer[l]=workc[k][m][EHMER_MAX-1];
+        int l=0;
+        k=i+1;
+        for(j=0;j<EHMER_MAX;j++){
+          int lo_bin= fromOC(j*.125+i*.5-2.0625)/binHz;
+          int hi_bin= fromOC(j*.125+i*.5-1.9375)/binHz+1;
+
+          if(lo_bin<0)lo_bin=0;
+          if(lo_bin>n)lo_bin=n;
+          if(lo_bin<l)l=lo_bin;
+          if(hi_bin<0)hi_bin=0;
+          if(hi_bin>n)hi_bin=n;
+
+          for(;l<hi_bin && l<n;l++)
+            if(brute_buffer[l]>workc[k][m][j])
+              brute_buffer[l]=workc[k][m][j];
+        }
+
+        for(;l<n;l++)
+          if(brute_buffer[l]>workc[k][m][EHMER_MAX-1])
+            brute_buffer[l]=workc[k][m][EHMER_MAX-1];
 
       }
 
 
       for(j=0;j<EHMER_MAX;j++){
-	int bin=fromOC(j*.125+i*.5-2.)/binHz;
-	if(bin<0){
-	  ret[i][m][j+2]=-999.;
-	}else{
-	  if(bin>=n){
-	    ret[i][m][j+2]=-999.;
-	  }else{
-	    ret[i][m][j+2]=brute_buffer[bin];
-	  }
-	}
+        int bin=fromOC(j*.125+i*.5-2.)/binHz;
+        if(bin<0){
+          ret[i][m][j+2]=-999.;
+        }else{
+          if(bin>=n){
+            ret[i][m][j+2]=-999.;
+          }else{
+            ret[i][m][j+2]=brute_buffer[bin];
+          }
+        }
       }
 
       /* add fenceposts */
       for(j=0;j<EHMER_OFFSET;j++)
-	if(ret[i][m][j+2]>-200.f)break;  
+        if(ret[i][m][j+2]>-200.f)break;
       ret[i][m][0]=j;
-      
+
       for(j=EHMER_MAX-1;j>EHMER_OFFSET+1;j--)
-	if(ret[i][m][j+2]>-200.f)
-	  break;
+        if(ret[i][m][j+2]>-200.f)
+          break;
       ret[i][m][1]=j;
 
     }
@@ -265,7 +265,7 @@ static float ***setup_tone_curves(float curveatt_dB[P_BANDS],float binHz,int n,
 }
 
 void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
-		  vorbis_info_psy_global *gi,int n,long rate){
+                  vorbis_info_psy_global *gi,int n,long rate){
   long i,j,lo=-99,hi=1;
   long maxoc;
   memset(p,0,sizeof(*p));
@@ -289,7 +289,7 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
   if(rate < 26000) p->m_val = 0;
   else if(rate < 38000) p->m_val = .94;   /* 32kHz */
   else if(rate > 46000) p->m_val = 1.275; /* 48kHz */
-  
+
   /* set up the lookups for a given blocksize and sample rate */
 
   for(i=0,j=0;i<MAX_ATH-1;i++){
@@ -304,15 +304,19 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
     }
   }
 
+  for(;j<n;j++){
+    p->ath[j]=p->ath[j-1];
+  }
+
   for(i=0;i<n;i++){
-    float bark=toBARK(rate/(2*n)*i); 
+    float bark=toBARK(rate/(2*n)*i);
+
+    for(;lo+vi->noisewindowlomin<i &&
+          toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++);
 
-    for(;lo+vi->noisewindowlomin<i && 
-	  toBARK(rate/(2*n)*lo)<(bark-vi->noisewindowlo);lo++);
-    
     for(;hi<=n && (hi<i+vi->noisewindowhimin ||
-	  toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++);
-    
+          toBARK(rate/(2*n)*hi)<(bark+vi->noisewindowhi));hi++);
+
     p->bark[i]=((lo-1)<<16)+(hi-1);
 
   }
@@ -321,28 +325,28 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
     p->octave[i]=toOC((i+.25f)*.5*rate/n)*(1<<(p->shiftoc+1))+.5f;
 
   p->tonecurves=setup_tone_curves(vi->toneatt,rate*.5/n,n,
-				  vi->tone_centerboost,vi->tone_decay);
-  
+                                  vi->tone_centerboost,vi->tone_decay);
+
   /* set up rolling noise median */
   p->noiseoffset=_ogg_malloc(P_NOISECURVES*sizeof(*p->noiseoffset));
   for(i=0;i<P_NOISECURVES;i++)
     p->noiseoffset[i]=_ogg_malloc(n*sizeof(**p->noiseoffset));
-  
+
   for(i=0;i<n;i++){
     float halfoc=toOC((i+.5)*rate/(2.*n))*2.;
     int inthalfoc;
     float del;
-    
+
     if(halfoc<0)halfoc=0;
     if(halfoc>=P_BANDS-1)halfoc=P_BANDS-1;
     inthalfoc=(int)halfoc;
     del=halfoc-inthalfoc;
-    
+
     for(j=0;j<P_NOISECURVES;j++)
       p->noiseoffset[j][i]=
-	p->vi->noiseoff[j][inthalfoc]*(1.-del) + 
-	p->vi->noiseoff[j][inthalfoc+1]*del;
-    
+        p->vi->noiseoff[j][inthalfoc]*(1.-del) +
+        p->vi->noiseoff[j][inthalfoc+1]*del;
+
   }
 #if 0
   {
@@ -362,10 +366,10 @@ void _vp_psy_clear(vorbis_look_psy *p){
     if(p->bark)_ogg_free(p->bark);
     if(p->tonecurves){
       for(i=0;i<P_BANDS;i++){
-	for(j=0;j<P_LEVELS;j++){
-	  _ogg_free(p->tonecurves[i][j]);
-	}
-	_ogg_free(p->tonecurves[i]);
+        for(j=0;j<P_LEVELS;j++){
+          _ogg_free(p->tonecurves[i][j]);
+        }
+        _ogg_free(p->tonecurves[i]);
       }
       _ogg_free(p->tonecurves);
     }
@@ -381,10 +385,10 @@ void _vp_psy_clear(vorbis_look_psy *p){
 
 /* octave/(8*eighth_octave_lines) x scale and dB y scale */
 static void seed_curve(float *seed,
-		       const float **curves,
-		       float amp,
-		       int oc, int n,
-		       int linesper,float dBoffset){
+                       const float **curves,
+                       float amp,
+                       int oc, int n,
+                       int linesper,float dBoffset){
   int i,post1;
   int seedptr;
   const float *posts,*curve;
@@ -408,11 +412,11 @@ static void seed_curve(float *seed,
 }
 
 static void seed_loop(vorbis_look_psy *p,
-		      const float ***curves,
-		      const float *f, 
-		      const float *flr,
-		      float *seed,
-		      float specmax){
+                      const float ***curves,
+                      const float *f,
+                      const float *flr,
+                      float *seed,
+                      float specmax){
   vorbis_info_psy *vi=p->vi;
   long n=p->n,i;
   float dBoffset=vi->max_curve_dB-specmax;
@@ -426,7 +430,7 @@ static void seed_loop(vorbis_look_psy *p,
       i++;
       if(f[i]>max)max=f[i];
     }
-    
+
     if(max+6.f>flr[i]){
       oc=oc>>p->shiftoc;
 
@@ -434,12 +438,12 @@ static void seed_loop(vorbis_look_psy *p,
       if(oc<0)oc=0;
 
       seed_curve(seed,
-		 curves[oc],
-		 max,
-		 p->octave[i]-p->firstoc,
-		 p->total_octave_lines,
-		 p->eighth_octave_lines,
-		 dBoffset);
+                 curves[oc],
+                 max,
+                 p->octave[i]-p->firstoc,
+                 p->total_octave_lines,
+                 p->eighth_octave_lines,
+                 dBoffset);
     }
   }
 }
@@ -457,24 +461,24 @@ static void seed_chase(float *seeds, int linesper, long n){
       ampstack[stack++]=seeds[i];
     }else{
       while(1){
-	if(seeds[i]<ampstack[stack-1]){
-	  posstack[stack]=i;
-	  ampstack[stack++]=seeds[i];
-	  break;
-	}else{
-	  if(i<posstack[stack-1]+linesper){
-	    if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] &&
-	       i<posstack[stack-2]+linesper){
-	      /* we completely overlap, making stack-1 irrelevant.  pop it */
-	      stack--;
-	      continue;
-	    }
-	  }
-	  posstack[stack]=i;
-	  ampstack[stack++]=seeds[i];
-	  break;
-
-	}
+        if(seeds[i]<ampstack[stack-1]){
+          posstack[stack]=i;
+          ampstack[stack++]=seeds[i];
+          break;
+        }else{
+          if(i<posstack[stack-1]+linesper){
+            if(stack>1 && ampstack[stack-1]<=ampstack[stack-2] &&
+               i<posstack[stack-2]+linesper){
+              /* we completely overlap, making stack-1 irrelevant.  pop it */
+              stack--;
+              continue;
+            }
+          }
+          posstack[stack]=i;
+          ampstack[stack++]=seeds[i];
+          break;
+
+        }
       }
     }
   }
@@ -488,13 +492,13 @@ static void seed_chase(float *seeds, int linesper, long n){
       endpos=posstack[i+1];
     }else{
       endpos=posstack[i]+linesper+1; /* +1 is important, else bin 0 is
-					discarded in short frames */
+                                        discarded in short frames */
     }
     if(endpos>n)endpos=n;
     for(;pos<endpos;pos++)
       seeds[pos]=ampstack[i];
   }
-  
+
   /* there.  Linear time.  I now remember this was on a problem set I
      had in Grad Skool... I didn't solve it at the time ;-) */
 
@@ -503,15 +507,15 @@ static void seed_chase(float *seeds, int linesper, long n){
 /* bleaugh, this is more complicated than it needs to be */
 #include<stdio.h>
 static void max_seeds(vorbis_look_psy *p,
-		      float *seed,
-		      float *flr){
+                      float *seed,
+                      float *flr){
   long   n=p->total_octave_lines;
   int    linesper=p->eighth_octave_lines;
   long   linpos=0;
   long   pos;
 
   seed_chase(seed,linesper,n); /* for masking */
- 
+
   pos=p->octave[0]-p->firstoc-(linesper>>1);
 
   while(linpos+1<p->n){
@@ -521,20 +525,20 @@ static void max_seeds(vorbis_look_psy *p,
     while(pos+1<=end){
       pos++;
       if((seed[pos]>NEGINF && seed[pos]<minV) || minV==NEGINF)
-	minV=seed[pos];
+        minV=seed[pos];
     }
-    
+
     end=pos+p->firstoc;
     for(;linpos<p->n && p->octave[linpos]<=end;linpos++)
       if(flr[linpos]<minV)flr[linpos]=minV;
   }
-  
+
   {
     float minV=seed[p->total_octave_lines-1];
     for(;linpos<p->n;linpos++)
       if(flr[linpos]<minV)flr[linpos]=minV;
   }
-  
+
 }
 
 static void bark_noise_hybridmp(int n,const long *b,
@@ -542,7 +546,7 @@ static void bark_noise_hybridmp(int n,const long *b,
                                 float *noise,
                                 const float offset,
                                 const int fixed){
-  
+
   float *N=alloca(n*sizeof(*N));
   float *X=alloca(n*sizeof(*N));
   float *XX=alloca(n*sizeof(*N));
@@ -565,7 +569,7 @@ static void bark_noise_hybridmp(int n,const long *b,
   if (y < 1.f) y = 1.f;
 
   w = y * y * .5;
-    
+
   tN += w;
   tX += w;
   tY += w * y;
@@ -577,12 +581,12 @@ static void bark_noise_hybridmp(int n,const long *b,
   XY[0] = tXY;
 
   for (i = 1, x = 1.f; i < n; i++, x += 1.f) {
-    
+
     y = f[i] + offset;
     if (y < 1.f) y = 1.f;
 
     w = y * y;
-    
+
     tN += w;
     tX += w * x;
     tXX += w * x * x;
@@ -595,59 +599,59 @@ static void bark_noise_hybridmp(int n,const long *b,
     Y[i] = tY;
     XY[i] = tXY;
   }
-  
+
   for (i = 0, x = 0.f;; i++, x += 1.f) {
-    
+
     lo = b[i] >> 16;
     if( lo>=0 ) break;
     hi = b[i] & 0xffff;
-    
+
     tN = N[hi] + N[-lo];
     tX = X[hi] - X[-lo];
     tXX = XX[hi] + XX[-lo];
-    tY = Y[hi] + Y[-lo];    
+    tY = Y[hi] + Y[-lo];
     tXY = XY[hi] - XY[-lo];
-    
+
     A = tY * tXX - tX * tXY;
     B = tN * tXY - tX * tY;
     D = tN * tXX - tX * tX;
     R = (A + x * B) / D;
     if (R < 0.f)
       R = 0.f;
-    
+
     noise[i] = R - offset;
   }
-  
+
   for ( ;; i++, x += 1.f) {
-    
+
     lo = b[i] >> 16;
     hi = b[i] & 0xffff;
     if(hi>=n)break;
-    
+
     tN = N[hi] - N[lo];
     tX = X[hi] - X[lo];
     tXX = XX[hi] - XX[lo];
     tY = Y[hi] - Y[lo];
     tXY = XY[hi] - XY[lo];
-    
+
     A = tY * tXX - tX * tXY;
     B = tN * tXY - tX * tY;
     D = tN * tXX - tX * tX;
     R = (A + x * B) / D;
     if (R < 0.f) R = 0.f;
-    
+
     noise[i] = R - offset;
   }
   for ( ; i < n; i++, x += 1.f) {
-    
+
     R = (A + x * B) / D;
     if (R < 0.f) R = 0.f;
-    
+
     noise[i] = R - offset;
   }
-  
+
   if (fixed <= 0) return;
-  
+
   for (i = 0, x = 0.f;; i++, x += 1.f) {
     hi = i + fixed / 2;
     lo = hi - fixed;
@@ -658,8 +662,8 @@ static void bark_noise_hybridmp(int n,const long *b,
     tXX = XX[hi] + XX[-lo];
     tY = Y[hi] + Y[-lo];
     tXY = XY[hi] - XY[-lo];
-    
-    
+
+
     A = tY * tXX - tX * tXY;
     B = tN * tXY - tX * tY;
     D = tN * tXX - tX * tX;
@@ -668,22 +672,22 @@ static void bark_noise_hybridmp(int n,const long *b,
     if (R - offset < noise[i]) noise[i] = R - offset;
   }
   for ( ;; i++, x += 1.f) {
-    
+
     hi = i + fixed / 2;
     lo = hi - fixed;
     if(hi>=n)break;
-    
+
     tN = N[hi] - N[lo];
     tX = X[hi] - X[lo];
     tXX = XX[hi] - XX[lo];
     tY = Y[hi] - Y[lo];
     tXY = XY[hi] - XY[lo];
-    
+
     A = tY * tXX - tX * tXY;
     B = tN * tXY - tX * tY;
     D = tN * tXX - tX * tX;
     R = (A + x * B) / D;
-    
+
     if (R - offset < noise[i]) noise[i] = R - offset;
   }
   for ( ; i < n; i++, x += 1.f) {
@@ -692,109 +696,23 @@ static void bark_noise_hybridmp(int n,const long *b,
   }
 }
 
-static float FLOOR1_fromdB_INV_LOOKUP[256]={
-  0.F, 8.81683e+06F, 8.27882e+06F, 7.77365e+06F, 
-  7.29930e+06F, 6.85389e+06F, 6.43567e+06F, 6.04296e+06F, 
-  5.67422e+06F, 5.32798e+06F, 5.00286e+06F, 4.69759e+06F, 
-  4.41094e+06F, 4.14178e+06F, 3.88905e+06F, 3.65174e+06F, 
-  3.42891e+06F, 3.21968e+06F, 3.02321e+06F, 2.83873e+06F, 
-  2.66551e+06F, 2.50286e+06F, 2.35014e+06F, 2.20673e+06F, 
-  2.07208e+06F, 1.94564e+06F, 1.82692e+06F, 1.71544e+06F, 
-  1.61076e+06F, 1.51247e+06F, 1.42018e+06F, 1.33352e+06F, 
-  1.25215e+06F, 1.17574e+06F, 1.10400e+06F, 1.03663e+06F, 
-  973377.F, 913981.F, 858210.F, 805842.F, 
-  756669.F, 710497.F, 667142.F, 626433.F, 
-  588208.F, 552316.F, 518613.F, 486967.F, 
-  457252.F, 429351.F, 403152.F, 378551.F, 
-  355452.F, 333762.F, 313396.F, 294273.F, 
-  276316.F, 259455.F, 243623.F, 228757.F, 
-  214798.F, 201691.F, 189384.F, 177828.F, 
-  166977.F, 156788.F, 147221.F, 138237.F, 
-  129802.F, 121881.F, 114444.F, 107461.F, 
-  100903.F, 94746.3F, 88964.9F, 83536.2F, 
-  78438.8F, 73652.5F, 69158.2F, 64938.1F, 
-  60975.6F, 57254.9F, 53761.2F, 50480.6F, 
-  47400.3F, 44507.9F, 41792.0F, 39241.9F, 
-  36847.3F, 34598.9F, 32487.7F, 30505.3F, 
-  28643.8F, 26896.0F, 25254.8F, 23713.7F, 
-  22266.7F, 20908.0F, 19632.2F, 18434.2F, 
-  17309.4F, 16253.1F, 15261.4F, 14330.1F, 
-  13455.7F, 12634.6F, 11863.7F, 11139.7F, 
-  10460.0F, 9821.72F, 9222.39F, 8659.64F, 
-  8131.23F, 7635.06F, 7169.17F, 6731.70F, 
-  6320.93F, 5935.23F, 5573.06F, 5232.99F, 
-  4913.67F, 4613.84F, 4332.30F, 4067.94F, 
-  3819.72F, 3586.64F, 3367.78F, 3162.28F, 
-  2969.31F, 2788.13F, 2617.99F, 2458.24F, 
-  2308.24F, 2167.39F, 2035.14F, 1910.95F, 
-  1794.35F, 1684.85F, 1582.04F, 1485.51F, 
-  1394.86F, 1309.75F, 1229.83F, 1154.78F, 
-  1084.32F, 1018.15F, 956.024F, 897.687F, 
-  842.910F, 791.475F, 743.179F, 697.830F, 
-  655.249F, 615.265F, 577.722F, 542.469F, 
-  509.367F, 478.286F, 449.101F, 421.696F, 
-  395.964F, 371.803F, 349.115F, 327.812F, 
-  307.809F, 289.026F, 271.390F, 254.830F, 
-  239.280F, 224.679F, 210.969F, 198.096F, 
-  186.008F, 174.658F, 164.000F, 153.993F, 
-  144.596F, 135.773F, 127.488F, 119.708F, 
-  112.404F, 105.545F, 99.1046F, 93.0572F, 
-  87.3788F, 82.0469F, 77.0404F, 72.3394F, 
-  67.9252F, 63.7804F, 59.8885F, 56.2341F, 
-  52.8027F, 49.5807F, 46.5553F, 43.7144F, 
-  41.0470F, 38.5423F, 36.1904F, 33.9821F, 
-  31.9085F, 29.9614F, 28.1332F, 26.4165F, 
-  24.8045F, 23.2910F, 21.8697F, 20.5352F, 
-  19.2822F, 18.1056F, 17.0008F, 15.9634F, 
-  14.9893F, 14.0746F, 13.2158F, 12.4094F, 
-  11.6522F, 10.9411F, 10.2735F, 9.64662F, 
-  9.05798F, 8.50526F, 7.98626F, 7.49894F, 
-  7.04135F, 6.61169F, 6.20824F, 5.82941F, 
-  5.47370F, 5.13970F, 4.82607F, 4.53158F, 
-  4.25507F, 3.99542F, 3.75162F, 3.52269F, 
-  3.30774F, 3.10590F, 2.91638F, 2.73842F, 
-  2.57132F, 2.41442F, 2.26709F, 2.12875F, 
-  1.99885F, 1.87688F, 1.76236F, 1.65482F, 
-  1.55384F, 1.45902F, 1.36999F, 1.28640F, 
-  1.20790F, 1.13419F, 1.06499F, 1.F
-};
-
-void _vp_remove_floor(vorbis_look_psy *p,
-		      float *mdct,
-		      int *codedflr,
-		      float *residue,
-		      int sliding_lowpass){ 
-
-  int i,n=p->n;
- 
-  if(sliding_lowpass>n)sliding_lowpass=n;
-  
-  for(i=0;i<sliding_lowpass;i++){
-    residue[i]=
-      mdct[i]*FLOOR1_fromdB_INV_LOOKUP[codedflr[i]];
-  }
-
-  for(;i<n;i++)
-    residue[i]=0.;
-}
-
 void _vp_noisemask(vorbis_look_psy *p,
-		   float *logmdct, 
-		   float *logmask){
+                   float *logmdct,
+                   float *logmask){
 
   int i,n=p->n;
   float *work=alloca(n*sizeof(*work));
 
   bark_noise_hybridmp(n,p->bark,logmdct,logmask,
-		      140.,-1);
+                      140.,-1);
 
   for(i=0;i<n;i++)work[i]=logmdct[i]-logmask[i];
 
   bark_noise_hybridmp(n,p->bark,work,logmask,0.,
-		      p->vi->noisewindowfixed);
+                      p->vi->noisewindowfixed);
 
   for(i=0;i<n;i++)work[i]=logmdct[i]-work[i];
-  
+
 #if 0
   {
     static int seq=0;
@@ -803,12 +721,12 @@ void _vp_noisemask(vorbis_look_psy *p,
     for(i=0;i<n;i++){
       work2[i]=logmask[i]+work[i];
     }
-    
+
     if(seq&1)
       _analysis_output("median2R",seq/2,work,n,1,0,0);
     else
       _analysis_output("median2L",seq/2,work,n,1,0,0);
-    
+
     if(seq&1)
       _analysis_output("envelope2R",seq/2,work2,n,1,0,0);
     else
@@ -827,21 +745,21 @@ void _vp_noisemask(vorbis_look_psy *p,
 }
 
 void _vp_tonemask(vorbis_look_psy *p,
-		  float *logfft,
-		  float *logmask,
-		  float global_specmax,
-		  float local_specmax){
+                  float *logfft,
+                  float *logmask,
+                  float global_specmax,
+                  float local_specmax){
 
   int i,n=p->n;
 
   float *seed=alloca(sizeof(*seed)*p->total_octave_lines);
   float att=local_specmax+p->vi->ath_adjatt;
   for(i=0;i<p->total_octave_lines;i++)seed[i]=NEGINF;
-  
+
   /* set the ATH (floating below localmax, not global max by a
      specified att) */
   if(att<p->vi->ath_maxatt)att=p->vi->ath_maxatt;
-  
+
   for(i=0;i<n;i++)
     logmask[i]=p->ath[i]+att;
 
@@ -852,18 +770,18 @@ void _vp_tonemask(vorbis_look_psy *p,
 }
 
 void _vp_offset_and_mix(vorbis_look_psy *p,
-			float *noise,
-			float *tone,
-			int offset_select,
-			float *logmask,
-			float *mdct,
-			float *logmdct){
+                        float *noise,
+                        float *tone,
+                        int offset_select,
+                        float *logmask,
+                        float *mdct,
+                        float *logmdct){
   int i,n=p->n;
   float de, coeffi, cx;/* AoTuV */
   float toneatt=p->vi->tone_masteratt[offset_select];
 
   cx = p->m_val;
-  
+
   for(i=0;i<n;i++){
     float val= noise[i]+p->noiseoffset[offset_select][i];
     if(val>p->vi->noisemaxsupp)val=p->vi->noisemaxsupp;
@@ -872,39 +790,39 @@ void _vp_offset_and_mix(vorbis_look_psy *p,
 
     /* AoTuV */
     /** @ M1 **
-	The following codes improve a noise problem.  
-	A fundamental idea uses the value of masking and carries out
-	the relative compensation of the MDCT. 
-	However, this code is not perfect and all noise problems cannot be solved. 
-	by Aoyumi @ 2004/04/18
+        The following codes improve a noise problem.
+        A fundamental idea uses the value of masking and carries out
+        the relative compensation of the MDCT.
+        However, this code is not perfect and all noise problems cannot be solved.
+        by Aoyumi @ 2004/04/18
     */
 
     if(offset_select == 1) {
       coeffi = -17.2;       /* coeffi is a -17.2dB threshold */
       val = val - logmdct[i];  /* val == mdct line value relative to floor in dB */
-      
+
       if(val > coeffi){
-	/* mdct value is > -17.2 dB below floor */
-	
-	de = 1.0-((val-coeffi)*0.005*cx);
-	/* pro-rated attenuation:
-	   -0.00 dB boost if mdct value is -17.2dB (relative to floor) 
-	   -0.77 dB boost if mdct value is 0dB (relative to floor) 
-	   -1.64 dB boost if mdct value is +17.2dB (relative to floor) 
-	   etc... */
-	
-	if(de < 0) de = 0.0001;
+        /* mdct value is > -17.2 dB below floor */
+
+        de = 1.0-((val-coeffi)*0.005*cx);
+        /* pro-rated attenuation:
+           -0.00 dB boost if mdct value is -17.2dB (relative to floor)
+           -0.77 dB boost if mdct value is 0dB (relative to floor)
+           -1.64 dB boost if mdct value is +17.2dB (relative to floor)
+           etc... */
+
+        if(de < 0) de = 0.0001;
       }else
-	/* mdct value is <= -17.2 dB below floor */
-	
-	de = 1.0-((val-coeffi)*0.0003*cx);
+        /* mdct value is <= -17.2 dB below floor */
+
+        de = 1.0-((val-coeffi)*0.0003*cx);
       /* pro-rated attenuation:
-	 +0.00 dB atten if mdct value is -17.2dB (relative to floor) 
-	 +0.45 dB atten if mdct value is -34.4dB (relative to floor) 
-	 etc... */
-      
+         +0.00 dB atten if mdct value is -17.2dB (relative to floor)
+         +0.45 dB atten if mdct value is -34.4dB (relative to floor)
+         etc... */
+
       mdct[i] *= de;
-      
+
     }
   }
 }
@@ -922,306 +840,367 @@ float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd){
   return(amp);
 }
 
-static void couple_lossless(float A, float B, 
-			    float *qA, float *qB){
-  int test1=fabs(*qA)>fabs(*qB);
-  test1-= fabs(*qA)<fabs(*qB);
-  
-  if(!test1)test1=((fabs(A)>fabs(B))<<1)-1;
-  if(test1==1){
-    *qB=(*qA>0.f?*qA-*qB:*qB-*qA);
-  }else{
-    float temp=*qB;  
-    *qB=(*qB>0.f?*qA-*qB:*qB-*qA);
-    *qA=temp;
-  }
-
-  if(*qB>fabs(*qA)*1.9999f){
-    *qB= -fabs(*qA)*2.f;
-    *qA= -*qA;
-  }
-}
+static float FLOOR1_fromdB_LOOKUP[256]={
+  1.0649863e-07F, 1.1341951e-07F, 1.2079015e-07F, 1.2863978e-07F,
+  1.3699951e-07F, 1.4590251e-07F, 1.5538408e-07F, 1.6548181e-07F,
+  1.7623575e-07F, 1.8768855e-07F, 1.9988561e-07F, 2.128753e-07F,
+  2.2670913e-07F, 2.4144197e-07F, 2.5713223e-07F, 2.7384213e-07F,
+  2.9163793e-07F, 3.1059021e-07F, 3.3077411e-07F, 3.5226968e-07F,
+  3.7516214e-07F, 3.9954229e-07F, 4.2550680e-07F, 4.5315863e-07F,
+  4.8260743e-07F, 5.1396998e-07F, 5.4737065e-07F, 5.8294187e-07F,
+  6.2082472e-07F, 6.6116941e-07F, 7.0413592e-07F, 7.4989464e-07F,
+  7.9862701e-07F, 8.5052630e-07F, 9.0579828e-07F, 9.6466216e-07F,
+  1.0273513e-06F, 1.0941144e-06F, 1.1652161e-06F, 1.2409384e-06F,
+  1.3215816e-06F, 1.4074654e-06F, 1.4989305e-06F, 1.5963394e-06F,
+  1.7000785e-06F, 1.8105592e-06F, 1.9282195e-06F, 2.0535261e-06F,
+  2.1869758e-06F, 2.3290978e-06F, 2.4804557e-06F, 2.6416497e-06F,
+  2.8133190e-06F, 2.9961443e-06F, 3.1908506e-06F, 3.3982101e-06F,
+  3.6190449e-06F, 3.8542308e-06F, 4.1047004e-06F, 4.3714470e-06F,
+  4.6555282e-06F, 4.9580707e-06F, 5.2802740e-06F, 5.6234160e-06F,
+  5.9888572e-06F, 6.3780469e-06F, 6.7925283e-06F, 7.2339451e-06F,
+  7.7040476e-06F, 8.2047000e-06F, 8.7378876e-06F, 9.3057248e-06F,
+  9.9104632e-06F, 1.0554501e-05F, 1.1240392e-05F, 1.1970856e-05F,
+  1.2748789e-05F, 1.3577278e-05F, 1.4459606e-05F, 1.5399272e-05F,
+  1.6400004e-05F, 1.7465768e-05F, 1.8600792e-05F, 1.9809576e-05F,
+  2.1096914e-05F, 2.2467911e-05F, 2.3928002e-05F, 2.5482978e-05F,
+  2.7139006e-05F, 2.8902651e-05F, 3.0780908e-05F, 3.2781225e-05F,
+  3.4911534e-05F, 3.7180282e-05F, 3.9596466e-05F, 4.2169667e-05F,
+  4.4910090e-05F, 4.7828601e-05F, 5.0936773e-05F, 5.4246931e-05F,
+  5.7772202e-05F, 6.1526565e-05F, 6.5524908e-05F, 6.9783085e-05F,
+  7.4317983e-05F, 7.9147585e-05F, 8.4291040e-05F, 8.9768747e-05F,
+  9.5602426e-05F, 0.00010181521F, 0.00010843174F, 0.00011547824F,
+  0.00012298267F, 0.00013097477F, 0.00013948625F, 0.00014855085F,
+  0.00015820453F, 0.00016848555F, 0.00017943469F, 0.00019109536F,
+  0.00020351382F, 0.00021673929F, 0.00023082423F, 0.00024582449F,
+  0.00026179955F, 0.00027881276F, 0.00029693158F, 0.00031622787F,
+  0.00033677814F, 0.00035866388F, 0.00038197188F, 0.00040679456F,
+  0.00043323036F, 0.00046138411F, 0.00049136745F, 0.00052329927F,
+  0.00055730621F, 0.00059352311F, 0.00063209358F, 0.00067317058F,
+  0.00071691700F, 0.00076350630F, 0.00081312324F, 0.00086596457F,
+  0.00092223983F, 0.00098217216F, 0.0010459992F, 0.0011139742F,
+  0.0011863665F, 0.0012634633F, 0.0013455702F, 0.0014330129F,
+  0.0015261382F, 0.0016253153F, 0.0017309374F, 0.0018434235F,
+  0.0019632195F, 0.0020908006F, 0.0022266726F, 0.0023713743F,
+  0.0025254795F, 0.0026895994F, 0.0028643847F, 0.0030505286F,
+  0.0032487691F, 0.0034598925F, 0.0036847358F, 0.0039241906F,
+  0.0041792066F, 0.0044507950F, 0.0047400328F, 0.0050480668F,
+  0.0053761186F, 0.0057254891F, 0.0060975636F, 0.0064938176F,
+  0.0069158225F, 0.0073652516F, 0.0078438871F, 0.0083536271F,
+  0.0088964928F, 0.009474637F, 0.010090352F, 0.010746080F,
+  0.011444421F, 0.012188144F, 0.012980198F, 0.013823725F,
+  0.014722068F, 0.015678791F, 0.016697687F, 0.017782797F,
+  0.018938423F, 0.020169149F, 0.021479854F, 0.022875735F,
+  0.024362330F, 0.025945531F, 0.027631618F, 0.029427276F,
+  0.031339626F, 0.033376252F, 0.035545228F, 0.037855157F,
+  0.040315199F, 0.042935108F, 0.045725273F, 0.048696758F,
+  0.051861348F, 0.055231591F, 0.058820850F, 0.062643361F,
+  0.066714279F, 0.071049749F, 0.075666962F, 0.080584227F,
+  0.085821044F, 0.091398179F, 0.097337747F, 0.10366330F,
+  0.11039993F, 0.11757434F, 0.12521498F, 0.13335215F,
+  0.14201813F, 0.15124727F, 0.16107617F, 0.17154380F,
+  0.18269168F, 0.19456402F, 0.20720788F, 0.22067342F,
+  0.23501402F, 0.25028656F, 0.26655159F, 0.28387361F,
+  0.30232132F, 0.32196786F, 0.34289114F, 0.36517414F,
+  0.38890521F, 0.41417847F, 0.44109412F, 0.46975890F,
+  0.50028648F, 0.53279791F, 0.56742212F, 0.60429640F,
+  0.64356699F, 0.68538959F, 0.72993007F, 0.77736504F,
+  0.82788260F, 0.88168307F, 0.9389798F, 1.F,
+};
 
-static float hypot_lookup[32]={
-  -0.009935, -0.011245, -0.012726, -0.014397, 
-  -0.016282, -0.018407, -0.020800, -0.023494, 
-  -0.026522, -0.029923, -0.033737, -0.038010, 
-  -0.042787, -0.048121, -0.054064, -0.060671, 
-  -0.068000, -0.076109, -0.085054, -0.094892, 
-  -0.105675, -0.117451, -0.130260, -0.144134, 
-  -0.159093, -0.175146, -0.192286, -0.210490, 
-  -0.229718, -0.249913, -0.271001, -0.292893};
-
-static void precomputed_couple_point(float premag,
-				     int floorA,int floorB,
-				     float *mag, float *ang){
-  
-  int test=(floorA>floorB)-1;
-  int offset=31-abs(floorA-floorB);
-  float floormag=hypot_lookup[((offset<0)-1)&offset]+1.f;
-
-  floormag*=FLOOR1_fromdB_INV_LOOKUP[(floorB&test)|(floorA&(~test))];
-
-  *mag=premag*floormag;
-  *ang=0.f;
+/* this is for per-channel noise normalization */
+static int apsort(const void *a, const void *b){
+  float f1=**(float**)a;
+  float f2=**(float**)b;
+  return (f1<f2)-(f1>f2);
 }
 
-/* just like below, this is currently set up to only do
-   single-step-depth coupling.  Otherwise, we'd have to do more
-   copying (which will be inevitable later) */
-
-/* doing the real circular magnitude calculation is audibly superior
-   to (A+B)/sqrt(2) */
-static float dipole_hypot(float a, float b){
-  if(a>0.){
-    if(b>0.)return sqrt(a*a+b*b);
-    if(a>-b)return sqrt(a*a-b*b);
-    return -sqrt(b*b-a*a);
-  }
-  if(b<0.)return -sqrt(a*a+b*b);
-  if(-a>b)return -sqrt(a*a-b*b);
-  return sqrt(b*b-a*a);
-}
-static float round_hypot(float a, float b){
-  if(a>0.){
-    if(b>0.)return sqrt(a*a+b*b);
-    if(a>-b)return sqrt(a*a+b*b);
-    return -sqrt(b*b+a*a);
+static void flag_lossless(int limit, float prepoint, float postpoint, float *mdct,
+                         float *floor, int *flag, int i, int jn){
+  int j;
+  for(j=0;j<jn;j++){
+    float point = j>=limit-i ? postpoint : prepoint;
+    float r = fabs(mdct[j])/floor[j];
+    if(r<point)
+      flag[j]=0;
+    else
+      flag[j]=1;
   }
-  if(b<0.)return -sqrt(a*a+b*b);
-  if(-a>b)return -sqrt(a*a+b*b);
-  return sqrt(b*b+a*a);
 }
 
-/* revert to round hypot for now */
-float **_vp_quantize_couple_memo(vorbis_block *vb,
-				 vorbis_info_psy_global *g,
-				 vorbis_look_psy *p,
-				 vorbis_info_mapping0 *vi,
-				 float **mdct){
-  
-  int i,j,n=p->n;
-  float **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
-  int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
-  
-  for(i=0;i<vi->coupling_steps;i++){
-    float *mdctM=mdct[vi->coupling_mag[i]];
-    float *mdctA=mdct[vi->coupling_ang[i]];
-    ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
-    for(j=0;j<limit;j++)
-      ret[i][j]=dipole_hypot(mdctM[j],mdctA[j]);
-    for(;j<n;j++)
-      ret[i][j]=round_hypot(mdctM[j],mdctA[j]);
-  }
+/* Overload/Side effect: On input, the *q vector holds either the
+   quantized energy (for elements with the flag set) or the absolute
+   values of the *r vector (for elements with flag unset).  On output,
+   *q holds the quantized energy for all elements */
+static float noise_normalize(vorbis_look_psy *p, int limit, float *r, float *q, float *f, int *flags, float acc, int i, int n, int *out){
 
-  return(ret);
-}
+  vorbis_info_psy *vi=p->vi;
+  float **sort = alloca(n*sizeof(*sort));
+  int j,count=0;
+  int start = (vi->normal_p ? vi->normal_start-i : n);
+  if(start>n)start=n;
 
-/* this is for per-channel noise normalization */
-static int apsort(const void *a, const void *b){
-  float f1=fabs(**(float**)a);
-  float f2=fabs(**(float**)b);
-  return (f1<f2)-(f1>f2);
-}
+  /* force classic behavior where only energy in the current band is considered */
+  acc=0.f;
+
+  /* still responsible for populating *out where noise norm not in
+     effect.  There's no need to [re]populate *q in these areas */
+  for(j=0;j<start;j++){
+    if(!flags || !flags[j]){ /* lossless coupling already quantized.
+                                Don't touch; requantizing based on
+                                energy would be incorrect. */
+      float ve = q[j]/f[j];
+      if(r[j]<0)
+        out[j] = -rint(sqrt(ve));
+      else
+        out[j] = rint(sqrt(ve));
+    }
+  }
 
-int **_vp_quantize_couple_sort(vorbis_block *vb,
-			       vorbis_look_psy *p,
-			       vorbis_info_mapping0 *vi,
-			       float **mags){
-
-
-  if(p->vi->normal_point_p){
-    int i,j,k,n=p->n;
-    int **ret=_vorbis_block_alloc(vb,vi->coupling_steps*sizeof(*ret));
-    int partition=p->vi->normal_partition;
-    float **work=alloca(sizeof(*work)*partition);
-    
-    for(i=0;i<vi->coupling_steps;i++){
-      ret[i]=_vorbis_block_alloc(vb,n*sizeof(**ret));
-      
-      for(j=0;j<n;j+=partition){
-	for(k=0;k<partition;k++)work[k]=mags[i]+k+j;
-	qsort(work,partition,sizeof(*work),apsort);
-	for(k=0;k<partition;k++)ret[i][k+j]=work[k]-mags[i];
+  /* sort magnitudes for noise norm portion of partition */
+  for(;j<n;j++){
+    if(!flags || !flags[j]){ /* can't noise norm elements that have
+                                already been loslessly coupled; we can
+                                only account for their energy error */
+      float ve = q[j]/f[j];
+      /* Despite all the new, more capable coupling code, for now we
+         implement noise norm as it has been up to this point. Only
+         consider promotions to unit magnitude from 0.  In addition
+         the only energy error counted is quantizations to zero. */
+      /* also-- the original point code only applied noise norm at > pointlimit */
+      if(ve<.25f && (!flags || j>=limit-i)){
+        acc += ve;
+        sort[count++]=q+j; /* q is fabs(r) for unflagged element */
+      }else{
+        /* For now: no acc adjustment for nonzero quantization.  populate *out and q as this value is final. */
+        if(r[j]<0)
+          out[j] = -rint(sqrt(ve));
+        else
+          out[j] = rint(sqrt(ve));
+        q[j] = out[j]*out[j]*f[j];
       }
-    }
-    return(ret);
+    }/* else{
+        again, no energy adjustment for error in nonzero quant-- for now
+        }*/
   }
-  return(NULL);
-}
 
-void _vp_noise_normalize_sort(vorbis_look_psy *p,
-			      float *magnitudes,int *sortedindex){
-  int i,j,n=p->n;
-  vorbis_info_psy *vi=p->vi;
-  int partition=vi->normal_partition;
-  float **work=alloca(sizeof(*work)*partition);
-  int start=vi->normal_start;
-
-  for(j=start;j<n;j+=partition){
-    if(j+partition>n)partition=n-j;
-    for(i=0;i<partition;i++)work[i]=magnitudes+i+j;
-    qsort(work,partition,sizeof(*work),apsort);
-    for(i=0;i<partition;i++){
-      sortedindex[i+j-start]=work[i]-magnitudes;
+  if(count){
+    /* noise norm to do */
+    qsort(sort,count,sizeof(*sort),apsort);
+    for(j=0;j<count;j++){
+      int k=sort[j]-q;
+      if(acc>=vi->normal_thresh){
+        out[k]=unitnorm(r[k]);
+        acc-=1.f;
+        q[k]=f[k];
+      }else{
+        out[k]=0;
+        q[k]=0.f;
+      }
     }
   }
+
+  return acc;
 }
 
-void _vp_noise_normalize(vorbis_look_psy *p,
-			 float *in,float *out,int *sortedindex){
-  int flag=0,i,j=0,n=p->n;
-  vorbis_info_psy *vi=p->vi;
-  int partition=vi->normal_partition;
-  int start=vi->normal_start;
+/* Noise normalization, quantization and coupling are not wholly
+   seperable processes in depth>1 coupling. */
+void _vp_couple_quantize_normalize(int blobno,
+                                   vorbis_info_psy_global *g,
+                                   vorbis_look_psy *p,
+                                   vorbis_info_mapping0 *vi,
+                                   float **mdct,
+                                   int   **iwork,
+                                   int    *nonzero,
+                                   int     sliding_lowpass,
+                                   int     ch){
 
-  if(start>n)start=n;
+  int i;
+  int n = p->n;
+  int partition=(p->vi->normal_p ? p->vi->normal_partition : 16);
+  int limit = g->coupling_pointlimit[p->vi->blockflag][blobno];
+  float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
+  float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
+#if 0
+  float de=0.1*p->m_val; /* a blend of the AoTuV M2 and M3 code here and below */
+#endif
+
+  /* mdct is our raw mdct output, floor not removed. */
+  /* inout passes in the ifloor, passes back quantized result */
+
+  /* unquantized energy (negative indicates amplitude has negative sign) */
+  float **raw = alloca(ch*sizeof(*raw));
+
+  /* dual pupose; quantized energy (if flag set), othersize fabs(raw) */
+  float **quant = alloca(ch*sizeof(*quant));
+
+  /* floor energy */
+  float **floor = alloca(ch*sizeof(*floor));
+
+  /* flags indicating raw/quantized status of elements in raw vector */
+  int   **flag  = alloca(ch*sizeof(*flag));
+
+  /* non-zero flag working vector */
+  int    *nz    = alloca(ch*sizeof(*nz));
 
-  if(vi->normal_channel_p){
-    for(;j<start;j++)
-      out[j]=rint(in[j]);
-    
-    for(;j+partition<=n;j+=partition){
-      float acc=0.;
-      int k;
-      
-      for(i=j;i<j+partition;i++)
-	acc+=in[i]*in[i];
-      
-      for(i=0;i<partition;i++){
-	k=sortedindex[i+j-start];
-	
-	if(in[k]*in[k]>=.25f){
-	  out[k]=rint(in[k]);
-	  acc-=in[k]*in[k];
-	  flag=1;
-	}else{
-	  if(acc<vi->normal_thresh)break;
-	  out[k]=unitnorm(in[k]);
-	  acc-=1.;
-	}
+  /* energy surplus/defecit tracking */
+  float  *acc   = alloca((ch+vi->coupling_steps)*sizeof(*acc));
+
+  /* The threshold of a stereo is changed with the size of n */
+  if(n > 1000)
+    postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]];
+
+  raw[0]   = alloca(ch*partition*sizeof(**raw));
+  quant[0] = alloca(ch*partition*sizeof(**quant));
+  floor[0] = alloca(ch*partition*sizeof(**floor));
+  flag[0]  = alloca(ch*partition*sizeof(**flag));
+
+  for(i=1;i<ch;i++){
+    raw[i]   = &raw[0][partition*i];
+    quant[i] = &quant[0][partition*i];
+    floor[i] = &floor[0][partition*i];
+    flag[i]  = &flag[0][partition*i];
+  }
+  for(i=0;i<ch+vi->coupling_steps;i++)
+    acc[i]=0.f;
+
+  for(i=0;i<n;i+=partition){
+    int k,j,jn = partition > n-i ? n-i : partition;
+    int step,track = 0;
+
+    memcpy(nz,nonzero,sizeof(*nz)*ch);
+
+    /* prefill */
+    memset(flag[0],0,ch*partition*sizeof(**flag));
+    for(k=0;k<ch;k++){
+      int *iout = &iwork[k][i];
+      if(nz[k]){
+
+        for(j=0;j<jn;j++)
+          floor[k][j] = FLOOR1_fromdB_LOOKUP[iout[j]];
+
+        flag_lossless(limit,prepoint,postpoint,&mdct[k][i],floor[k],flag[k],i,jn);
+
+        for(j=0;j<jn;j++){
+          quant[k][j] = raw[k][j] = mdct[k][i+j]*mdct[k][i+j];
+          if(mdct[k][i+j]<0.f) raw[k][j]*=-1.f;
+          floor[k][j]*=floor[k][j];
+        }
+
+        acc[track]=noise_normalize(p,limit,raw[k],quant[k],floor[k],NULL,acc[track],i,jn,iout);
+
+      }else{
+        for(j=0;j<jn;j++){
+          floor[k][j] = 1e-10f;
+          raw[k][j] = 0.f;
+          quant[k][j] = 0.f;
+          flag[k][j] = 0;
+          iout[j]=0;
+        }
+        acc[track]=0.f;
       }
-      
-      for(;i<partition;i++){
-	k=sortedindex[i+j-start];
-	out[k]=0.;
+      track++;
+    }
+
+    /* coupling */
+    for(step=0;step<vi->coupling_steps;step++){
+      int Mi = vi->coupling_mag[step];
+      int Ai = vi->coupling_ang[step];
+      int *iM = &iwork[Mi][i];
+      int *iA = &iwork[Ai][i];
+      float *reM = raw[Mi];
+      float *reA = raw[Ai];
+      float *qeM = quant[Mi];
+      float *qeA = quant[Ai];
+      float *floorM = floor[Mi];
+      float *floorA = floor[Ai];
+      int *fM = flag[Mi];
+      int *fA = flag[Ai];
+
+      if(nz[Mi] || nz[Ai]){
+        nz[Mi] = nz[Ai] = 1;
+
+        for(j=0;j<jn;j++){
+
+          if(j<sliding_lowpass-i){
+            if(fM[j] || fA[j]){
+              /* lossless coupling */
+
+              reM[j] = fabs(reM[j])+fabs(reA[j]);
+              qeM[j] = qeM[j]+qeA[j];
+              fM[j]=fA[j]=1;
+
+              /* couple iM/iA */
+              {
+                int A = iM[j];
+                int B = iA[j];
+
+                if(abs(A)>abs(B)){
+                  iA[j]=(A>0?A-B:B-A);
+                }else{
+                  iA[j]=(B>0?A-B:B-A);
+                  iM[j]=B;
+                }
+
+                /* collapse two equivalent tuples to one */
+                if(iA[j]>=abs(iM[j])*2){
+                  iA[j]= -iA[j];
+                  iM[j]= -iM[j];
+                }
+
+              }
+
+            }else{
+              /* lossy (point) coupling */
+              if(j<limit-i){
+                /* dipole */
+                reM[j] += reA[j];
+                qeM[j] = fabs(reM[j]);
+              }else{
+#if 0
+                /* AoTuV */
+                /** @ M2 **
+                    The boost problem by the combination of noise normalization and point stereo is eased.
+                    However, this is a temporary patch.
+                    by Aoyumi @ 2004/04/18
+                */
+                float derate = (1.0 - de*((float)(j-limit+i) / (float)(n-limit)));
+                /* elliptical */
+                if(reM[j]+reA[j]<0){
+                  reM[j] = - (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate);
+                }else{
+                  reM[j] =   (qeM[j] = (fabs(reM[j])+fabs(reA[j]))*derate*derate);
+                }
+#else
+                /* elliptical */
+                if(reM[j]+reA[j]<0){
+                  reM[j] = - (qeM[j] = fabs(reM[j])+fabs(reA[j]));
+                }else{
+                  reM[j] =   (qeM[j] = fabs(reM[j])+fabs(reA[j]));
+                }
+#endif
+
+              }
+              reA[j]=qeA[j]=0.f;
+              fA[j]=1;
+              iA[j]=0;
+            }
+          }
+          floorM[j]=floorA[j]=floorM[j]+floorA[j];
+        }
+        /* normalize the resulting mag vector */
+        acc[track]=noise_normalize(p,limit,raw[Mi],quant[Mi],floor[Mi],flag[Mi],acc[track],i,jn,iM);
+        track++;
       }
     }
   }
-  
-  for(;j<n;j++)
-    out[j]=rint(in[j]);
-  
-}
 
-void _vp_couple(int blobno,
-		vorbis_info_psy_global *g,
-		vorbis_look_psy *p,
-		vorbis_info_mapping0 *vi,
-		float **res,
-		float **mag_memo,
-		int   **mag_sort,
-		int   **ifloor,
-		int   *nonzero,
-		int  sliding_lowpass){
-
-  int i,j,k,n=p->n;
-
-  /* perform any requested channel coupling */
-  /* point stereo can only be used in a first stage (in this encoder)
-     because of the dependency on floor lookups */
   for(i=0;i<vi->coupling_steps;i++){
-
-    /* once we're doing multistage coupling in which a channel goes
-       through more than one coupling step, the floor vector
-       magnitudes will also have to be recalculated an propogated
-       along with PCM.  Right now, we're not (that will wait until 5.1
-       most likely), so the code isn't here yet. The memory management
-       here is all assuming single depth couplings anyway. */
-
     /* make sure coupling a zero and a nonzero channel results in two
        nonzero channels. */
     if(nonzero[vi->coupling_mag[i]] ||
        nonzero[vi->coupling_ang[i]]){
-     
-
-      float *rM=res[vi->coupling_mag[i]];
-      float *rA=res[vi->coupling_ang[i]];
-      float *qM=rM+n;
-      float *qA=rA+n;
-      int *floorM=ifloor[vi->coupling_mag[i]];
-      int *floorA=ifloor[vi->coupling_ang[i]];
-      float prepoint=stereo_threshholds[g->coupling_prepointamp[blobno]];
-      float postpoint=stereo_threshholds[g->coupling_postpointamp[blobno]];
-      int partition=(p->vi->normal_point_p?p->vi->normal_partition:p->n);
-      int limit=g->coupling_pointlimit[p->vi->blockflag][blobno];
-      int pointlimit=limit;
-
-      nonzero[vi->coupling_mag[i]]=1; 
-      nonzero[vi->coupling_ang[i]]=1; 
-
-       /* The threshold of a stereo is changed with the size of n */
-       if(n > 1000)
-         postpoint=stereo_threshholds_limited[g->coupling_postpointamp[blobno]]; 
- 
-      for(j=0;j<p->n;j+=partition){
-	float acc=0.f;
-
-	for(k=0;k<partition;k++){
-	  int l=k+j;
-
-	  if(l<sliding_lowpass){
-	    if((l>=limit && fabs(rM[l])<postpoint && fabs(rA[l])<postpoint) ||
-	       (fabs(rM[l])<prepoint && fabs(rA[l])<prepoint)){
-
-
-	      precomputed_couple_point(mag_memo[i][l],
-				       floorM[l],floorA[l],
-				       qM+l,qA+l);
-
-	      if(rint(qM[l])==0.f)acc+=qM[l]*qM[l];
-	    }else{
-	      couple_lossless(rM[l],rA[l],qM+l,qA+l);
-	    }
-	  }else{
-	    qM[l]=0.;
-	    qA[l]=0.;
-	  }
-	}
-	
-	if(p->vi->normal_point_p){
-	  for(k=0;k<partition && acc>=p->vi->normal_thresh;k++){
-	    int l=mag_sort[i][j+k];
-	    if(l<sliding_lowpass && l>=pointlimit && rint(qM[l])==0.f){
-	      qM[l]=unitnorm(qM[l]);
-	      acc-=1.f;
-	    }
-	  } 
-	}
-      }
+      nonzero[vi->coupling_mag[i]]=1;
+      nonzero[vi->coupling_ang[i]]=1;
     }
   }
 }
-
-/* AoTuV */
-/** @ M2 **
-   The boost problem by the combination of noise normalization and point stereo is eased. 
-   However, this is a temporary patch. 
-   by Aoyumi @ 2004/04/18
-*/
-
-void hf_reduction(vorbis_info_psy_global *g,
-                      vorbis_look_psy *p, 
-                      vorbis_info_mapping0 *vi,
-                      float **mdct){
- 
-  int i,j,n=p->n, de=0.3*p->m_val;
-  int limit=g->coupling_pointlimit[p->vi->blockflag][PACKETBLOBS/2];
-  int start=p->vi->normal_start;
-  
-  for(i=0; i<vi->coupling_steps; i++){
-    /* for(j=start; j<limit; j++){} // ???*/
-    for(j=limit; j<n; j++) 
-      mdct[i][j] *= (1.0 - de*((float)(j-limit) / (float)(n-limit)));
-  }
-}

+ 32 - 64
Engine/lib/libvorbis/lib/psy.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: random psychoacoustics (not including preecho)
- last mod: $Id: psy.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: psy.h 16946 2010-03-03 16:12:40Z xiphmont $
 
  ********************************************************************/
 
@@ -57,8 +57,7 @@ typedef struct vorbis_info_psy{
 
   float max_curve_dB;
 
-  int normal_channel_p;
-  int normal_point_p;
+  int normal_p;
   int normal_start;
   int normal_partition;
   double normal_thresh;
@@ -76,11 +75,11 @@ typedef struct{
   float ampmax_att_per_sec;
 
   /* channel coupling config */
-  int   coupling_pkHz[PACKETBLOBS];  
-  int   coupling_pointlimit[2][PACKETBLOBS];  
-  int   coupling_prepointamp[PACKETBLOBS];  
-  int   coupling_postpointamp[PACKETBLOBS];  
-  int   sliding_lowpass[2][PACKETBLOBS];  
+  int   coupling_pkHz[PACKETBLOBS];
+  int   coupling_pointlimit[2][PACKETBLOBS];
+  int   coupling_prepointamp[PACKETBLOBS];
+  int   coupling_postpointamp[PACKETBLOBS];
+  int   sliding_lowpass[2][PACKETBLOBS];
 
 } vorbis_info_psy_global;
 
@@ -89,7 +88,7 @@ typedef struct {
   int   channels;
 
   vorbis_info_psy_global *gi;
-  int   coupling_pointlimit[2][P_NOISECURVES];  
+  int   coupling_pointlimit[2][P_NOISECURVES];
 } vorbis_look_psy_global;
 
 
@@ -107,7 +106,7 @@ typedef struct {
   long  firstoc;
   long  shiftoc;
   int   eighth_octave_lines; /* power of two, please */
-  int   total_octave_lines;  
+  int   total_octave_lines;
   long  rate; /* cache it */
 
   float m_val; /* Masking compensation value */
@@ -115,72 +114,41 @@ typedef struct {
 } vorbis_look_psy;
 
 extern void   _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi,
-			   vorbis_info_psy_global *gi,int n,long rate);
+                           vorbis_info_psy_global *gi,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_remove_floor(vorbis_look_psy *p,
-			     float *mdct,
-			     int *icodedflr,
-			     float *residue,
-			     int sliding_lowpass);
-
 extern void _vp_noisemask(vorbis_look_psy *p,
-			  float *logmdct, 
-			  float *logmask);
+                          float *logmdct,
+                          float *logmask);
 
 extern void _vp_tonemask(vorbis_look_psy *p,
-			 float *logfft,
-			 float *logmask,
-			 float global_specmax,
-			 float local_specmax);
+                         float *logfft,
+                         float *logmask,
+                         float global_specmax,
+                         float local_specmax);
 
 extern void _vp_offset_and_mix(vorbis_look_psy *p,
-			       float *noise,
-			       float *tone,
-			       int offset_select,
-			       float *logmask,
-			       float *mdct,
-			       float *logmdct);
+                               float *noise,
+                               float *tone,
+                               int offset_select,
+                               float *logmask,
+                               float *mdct,
+                               float *logmdct);
 
 extern float _vp_ampmax_decay(float amp,vorbis_dsp_state *vd);
 
-extern float **_vp_quantize_couple_memo(vorbis_block *vb,
-					vorbis_info_psy_global *g,
-					vorbis_look_psy *p,
-					vorbis_info_mapping0 *vi,
-					float **mdct);
-
-extern void _vp_couple(int blobno,
-		       vorbis_info_psy_global *g,
-		       vorbis_look_psy *p,
-		       vorbis_info_mapping0 *vi,
-		       float **res,
-		       float **mag_memo,
-		       int   **mag_sort,
-		       int   **ifloor,
-		       int   *nonzero,
-		       int   sliding_lowpass);
-
-extern void _vp_noise_normalize(vorbis_look_psy *p,
-				float *in,float *out,int *sortedindex);
-
-extern void _vp_noise_normalize_sort(vorbis_look_psy *p,
-				     float *magnitudes,int *sortedindex);
-
-extern int **_vp_quantize_couple_sort(vorbis_block *vb,
-				      vorbis_look_psy *p,
-				      vorbis_info_mapping0 *vi,
-				      float **mags);
-
-extern void hf_reduction(vorbis_info_psy_global *g,
-			 vorbis_look_psy *p,
-			 vorbis_info_mapping0 *vi,
-			 float **mdct);
-
+extern void _vp_couple_quantize_normalize(int blobno,
+                                          vorbis_info_psy_global *g,
+                                          vorbis_look_psy *p,
+                                          vorbis_info_mapping0 *vi,
+                                          float **mdct,
+                                          int   **iwork,
+                                          int    *nonzero,
+                                          int     sliding_lowpass,
+                                          int     ch);
 
 #endif
-

+ 11 - 12
Engine/lib/libvorbis/lib/registry.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: registry.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -22,25 +22,24 @@
 /* seems like major overkill now; the backend numbers will grow into
    the infrastructure soon enough */
 
-extern vorbis_func_floor     floor0_exportbundle;
-extern vorbis_func_floor     floor1_exportbundle;
-extern vorbis_func_residue   residue0_exportbundle;
-extern vorbis_func_residue   residue1_exportbundle;
-extern vorbis_func_residue   residue2_exportbundle;
-extern vorbis_func_mapping   mapping0_exportbundle;
+extern const vorbis_func_floor     floor0_exportbundle;
+extern const vorbis_func_floor     floor1_exportbundle;
+extern const vorbis_func_residue   residue0_exportbundle;
+extern const vorbis_func_residue   residue1_exportbundle;
+extern const vorbis_func_residue   residue2_exportbundle;
+extern const vorbis_func_mapping   mapping0_exportbundle;
 
-vorbis_func_floor     *_floor_P[]={
+const vorbis_func_floor     *const _floor_P[]={
   &floor0_exportbundle,
   &floor1_exportbundle,
 };
 
-vorbis_func_residue   *_residue_P[]={
+const vorbis_func_residue   *const _residue_P[]={
   &residue0_exportbundle,
   &residue1_exportbundle,
   &residue2_exportbundle,
 };
 
-vorbis_func_mapping   *_mapping_P[]={
+const vorbis_func_mapping   *const _mapping_P[]={
   &mapping0_exportbundle,
 };
-

+ 4 - 4
Engine/lib/libvorbis/lib/registry.h

@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: registry for time, floor, res backends and channel mappings
- last mod: $Id: registry.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: registry.h 15531 2008-11-24 23:50:06Z xiphmont $
 
  ********************************************************************/
 
@@ -25,8 +25,8 @@
 #define VI_RESB 3
 #define VI_MAPB 1
 
-extern vorbis_func_floor     *_floor_P[];
-extern vorbis_func_residue   *_residue_P[];
-extern vorbis_func_mapping   *_mapping_P[];
+extern const vorbis_func_floor     *const _floor_P[];
+extern const vorbis_func_residue   *const _residue_P[];
+extern const vorbis_func_mapping   *const _mapping_P[];
 
 #endif

File diff suppressed because it is too large
+ 326 - 355
Engine/lib/libvorbis/lib/res0.c


+ 11 - 7
Engine/lib/libvorbis/lib/scales.h

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: linear scale -> dB, Bark and Mel scales
- last mod: $Id: scales.h 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: scales.h 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -21,11 +21,16 @@
 #include <math.h>
 #include "os.h"
 
+#ifdef _MSC_VER
+/* MS Visual Studio doesn't have C99 inline keyword. */
+#define inline __inline
+#endif
+
 /* 20log10(x) */
 #define VORBIS_IEEE_FLOAT32 1
 #ifdef VORBIS_IEEE_FLOAT32
 
-static float unitnorm(float x){
+static inline float unitnorm(float x){
   union {
     ogg_uint32_t i;
     float f;
@@ -36,7 +41,7 @@ static float unitnorm(float x){
 }
 
 /* Segher was off (too high) by ~ .3 decibel.  Center the conversion correctly. */
-static float todB(const float *x){
+static inline float todB(const float *x){
   union {
     ogg_uint32_t i;
     float f;
@@ -58,9 +63,9 @@ static float unitnorm(float x){
 #define todB(x)   (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
 #define todB_nn(x)   (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
 
-#endif 
+#endif
 
-#define fromdB(x) (exp((x)*.11512925f))  
+#define fromdB(x) (exp((x)*.11512925f))
 
 /* The bark scale equations are approximations, since the original
    table was somewhat hand rolled.  The below are chosen to have the
@@ -83,4 +88,3 @@ static float unitnorm(float x){
 #define fromOC(o)   (exp(((o)+5.965784f)*.693147f))
 
 #endif
-

+ 163 - 319
Engine/lib/libvorbis/lib/sharedbook.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: sharedbook.c 17030 2010-03-25 06:52:55Z xiphmont $
 
  ********************************************************************/
 
@@ -36,7 +36,7 @@ int _ilog(unsigned int v){
 }
 
 /* 32 bit float (not IEEE; nonnormalized mantissa +
-   biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm 
+   biased exponent) : neeeeeee eeemmmmm mmmmmmmm mmmmmmmm
    Why not IEEE?  It's just not that important here. */
 
 #define VQ_FEXP 10
@@ -52,7 +52,7 @@ long _float32_pack(float val){
     sign=0x80000000;
     val= -val;
   }
-  exp= floor(log(val)/log(2.f));
+  exp= floor(log(val)/log(2.f)+.001); //+epsilon
   mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
   exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
 
@@ -80,51 +80,64 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
     long length=l[i];
     if(length>0){
       ogg_uint32_t entry=marker[length];
-      
+
       /* when we claim a node for an entry, we also claim the nodes
-	 below it (pruning off the imagined tree that may have dangled
-	 from it) as well as blocking the use of any nodes directly
-	 above for leaves */
-      
+         below it (pruning off the imagined tree that may have dangled
+         from it) as well as blocking the use of any nodes directly
+         above for leaves */
+
       /* update ourself */
       if(length<32 && (entry>>length)){
-	/* error condition; the lengths must specify an overpopulated tree */
-	_ogg_free(r);
-	return(NULL);
+        /* error condition; the lengths must specify an overpopulated tree */
+        _ogg_free(r);
+        return(NULL);
       }
       r[count++]=entry;
-    
+
       /* Look to see if the next shorter marker points to the node
-	 above. if so, update it and repeat.  */
+         above. if so, update it and repeat.  */
       {
-	for(j=length;j>0;j--){
-	  
-	  if(marker[j]&1){
-	    /* have to jump branches */
-	    if(j==1)
-	      marker[1]++;
-	    else
-	      marker[j]=marker[j-1]<<1;
-	    break; /* invariant says next upper marker would already
-		      have been moved if it was on the same path */
-	  }
-	  marker[j]++;
-	}
+        for(j=length;j>0;j--){
+
+          if(marker[j]&1){
+            /* have to jump branches */
+            if(j==1)
+              marker[1]++;
+            else
+              marker[j]=marker[j-1]<<1;
+            break; /* invariant says next upper marker would already
+                      have been moved if it was on the same path */
+          }
+          marker[j]++;
+        }
       }
-      
+
       /* prune the tree; the implicit invariant says all the longer
-	 markers were dangling from our just-taken node.  Dangle them
-	 from our *new* node. */
+         markers were dangling from our just-taken node.  Dangle them
+         from our *new* node. */
       for(j=length+1;j<33;j++)
-	if((marker[j]>>1) == entry){
-	  entry=marker[j];
-	  marker[j]=marker[j-1]<<1;
-	}else
-	  break;
+        if((marker[j]>>1) == entry){
+          entry=marker[j];
+          marker[j]=marker[j-1]<<1;
+        }else
+          break;
     }else
       if(sparsecount==0)count++;
   }
-    
+
+  /* sanity check the huffman tree; an underpopulated tree must be
+     rejected. The only exception is the one-node pseudo-nil tree,
+     which appears to be underpopulated because the tree doesn't
+     really exist; there's only one possible 'codeword' or zero bits,
+     but the above tree-gen code doesn't mark that. */
+  if(sparsecount != 1){
+    for(i=1;i<33;i++)
+      if(marker[i] & (0xffffffffUL>>(32-i))){
+	_ogg_free(r);
+	return(NULL);
+      }
+  }
+
   /* bitreverse the words because our bitwise packer/unpacker is LSb
      endian */
   for(i=0,count=0;i<n;i++){
@@ -136,7 +149,7 @@ ogg_uint32_t *_make_words(long *l,long n,long sparsecount){
 
     if(sparsecount){
       if(l[i])
-	r[count++]=temp;
+        r[count++]=temp;
     }else
       r[count++]=temp;
   }
@@ -167,9 +180,9 @@ long _book_maptype1_quantvals(const static_codebook *b){
       return(vals);
     }else{
       if(acc>b->entries){
-	vals--;
+        vals--;
       }else{
-	vals++;
+        vals++;
       }
     }
   }
@@ -193,49 +206,49 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
     switch(b->maptype){
     case 1:
       /* most of the time, entries%dimensions == 0, but we need to be
-	 well defined.  We define that the possible vales at each
-	 scalar is values == entries/dim.  If entries%dim != 0, we'll
-	 have 'too few' values (values*dim<entries), which means that
-	 we'll have 'left over' entries; left over entries use zeroed
-	 values (and are wasted).  So don't generate codebooks like
-	 that */
+         well defined.  We define that the possible vales at each
+         scalar is values == entries/dim.  If entries%dim != 0, we'll
+         have 'too few' values (values*dim<entries), which means that
+         we'll have 'left over' entries; left over entries use zeroed
+         values (and are wasted).  So don't generate codebooks like
+         that */
       quantvals=_book_maptype1_quantvals(b);
       for(j=0;j<b->entries;j++){
-	if((sparsemap && b->lengthlist[j]) || !sparsemap){
-	  float last=0.f;
-	  int indexdiv=1;
-	  for(k=0;k<b->dim;k++){
-	    int index= (j/indexdiv)%quantvals;
-	    float val=b->quantlist[index];
-	    val=fabs(val)*delta+mindel+last;
-	    if(b->q_sequencep)last=val;	  
-	    if(sparsemap)
-	      r[sparsemap[count]*b->dim+k]=val;
-	    else
-	      r[count*b->dim+k]=val;
-	    indexdiv*=quantvals;
-	  }
-	  count++;
-	}
+        if((sparsemap && b->lengthlist[j]) || !sparsemap){
+          float last=0.f;
+          int indexdiv=1;
+          for(k=0;k<b->dim;k++){
+            int index= (j/indexdiv)%quantvals;
+            float val=b->quantlist[index];
+            val=fabs(val)*delta+mindel+last;
+            if(b->q_sequencep)last=val;
+            if(sparsemap)
+              r[sparsemap[count]*b->dim+k]=val;
+            else
+              r[count*b->dim+k]=val;
+            indexdiv*=quantvals;
+          }
+          count++;
+        }
 
       }
       break;
     case 2:
       for(j=0;j<b->entries;j++){
-	if((sparsemap && b->lengthlist[j]) || !sparsemap){
-	  float last=0.f;
-	  
-	  for(k=0;k<b->dim;k++){
-	    float val=b->quantlist[j*b->dim+k];
-	    val=fabs(val)*delta+mindel+last;
-	    if(b->q_sequencep)last=val;	  
-	    if(sparsemap)
-	      r[sparsemap[count]*b->dim+k]=val;
-	    else
-	      r[count*b->dim+k]=val;
-	  }
-	  count++;
-	}
+        if((sparsemap && b->lengthlist[j]) || !sparsemap){
+          float last=0.f;
+
+          for(k=0;k<b->dim;k++){
+            float val=b->quantlist[j*b->dim+k];
+            val=fabs(val)*delta+mindel+last;
+            if(b->q_sequencep)last=val;
+            if(sparsemap)
+              r[sparsemap[count]*b->dim+k]=val;
+            else
+              r[count*b->dim+k]=val;
+          }
+          count++;
+        }
       }
       break;
     }
@@ -245,34 +258,13 @@ float *_book_unquantize(const static_codebook *b,int n,int *sparsemap){
   return(NULL);
 }
 
-void vorbis_staticbook_clear(static_codebook *b){
+void vorbis_staticbook_destroy(static_codebook *b){
   if(b->allocedp){
     if(b->quantlist)_ogg_free(b->quantlist);
     if(b->lengthlist)_ogg_free(b->lengthlist);
-    if(b->nearest_tree){
-      _ogg_free(b->nearest_tree->ptr0);
-      _ogg_free(b->nearest_tree->ptr1);
-      _ogg_free(b->nearest_tree->p);
-      _ogg_free(b->nearest_tree->q);
-      memset(b->nearest_tree,0,sizeof(*b->nearest_tree));
-      _ogg_free(b->nearest_tree);
-    }
-    if(b->thresh_tree){
-      _ogg_free(b->thresh_tree->quantthresh);
-      _ogg_free(b->thresh_tree->quantmap);
-      memset(b->thresh_tree,0,sizeof(*b->thresh_tree));
-      _ogg_free(b->thresh_tree);
-    }
-
     memset(b,0,sizeof(*b));
-  }
-}
-
-void vorbis_staticbook_destroy(static_codebook *b){
-  if(b->allocedp){
-    vorbis_staticbook_clear(b);
     _ogg_free(b);
-  }
+  } /* otherwise, it is in static memory */
 }
 
 void vorbis_book_clear(codebook *b){
@@ -296,7 +288,10 @@ int vorbis_book_init_encode(codebook *c,const static_codebook *s){
   c->used_entries=s->entries;
   c->dim=s->dim;
   c->codelist=_make_words(s->lengthlist,s->entries,0);
-  c->valuelist=_book_unquantize(s,s->entries,NULL);
+  //c->valuelist=_book_unquantize(s,s->entries,NULL);
+  c->quantvals=_book_maptype1_quantvals(s);
+  c->minval=(int)rint(_float32_unpack(s->q_min));
+  c->delta=(int)rint(_float32_unpack(s->q_delta));
 
   return(0);
 }
@@ -310,7 +305,7 @@ static ogg_uint32_t bitreverse(ogg_uint32_t x){
 }
 
 static int sort32a(const void *a,const void *b){
-  return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)- 
+  return ( **(ogg_uint32_t **)a>**(ogg_uint32_t **)b)-
     ( **(ogg_uint32_t **)a<**(ogg_uint32_t **)b);
 }
 
@@ -319,7 +314,7 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
   int i,j,n=0,tabn;
   int *sortindex;
   memset(c,0,sizeof(*c));
-  
+
   /* count actually used entries */
   for(i=0;i<s->entries;i++)
     if(s->lengthlist[i]>0)
@@ -330,30 +325,30 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
   c->dim=s->dim;
 
   if(n>0){
-    
-    /* two different remappings go on here.  
-       
+
+    /* two different remappings go on here.
+
     First, we collapse the likely sparse codebook down only to
     actually represented values/words.  This collapsing needs to be
     indexed as map-valueless books are used to encode original entry
     positions as integers.
-    
+
     Second, we reorder all vectors, including the entry index above,
     by sorted bitreversed codeword to allow treeless decode. */
 
     /* perform sort */
     ogg_uint32_t *codes=_make_words(s->lengthlist,s->entries,c->used_entries);
     ogg_uint32_t **codep=alloca(sizeof(*codep)*n);
-    
+
     if(codes==NULL)goto err_out;
-    
+
     for(i=0;i<n;i++){
       codes[i]=bitreverse(codes[i]);
       codep[i]=codes+i;
     }
-    
+
     qsort(codep,n,sizeof(*codep),sort32a);
-    
+
     sortindex=alloca(n*sizeof(*sortindex));
     c->codelist=_ogg_malloc(n*sizeof(*c->codelist));
     /* the index is a reverse index */
@@ -365,63 +360,63 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
     for(i=0;i<n;i++)
       c->codelist[sortindex[i]]=codes[i];
     _ogg_free(codes);
-  
+
 
     c->valuelist=_book_unquantize(s,n,sortindex);
     c->dec_index=_ogg_malloc(n*sizeof(*c->dec_index));
-    
+
     for(n=0,i=0;i<s->entries;i++)
       if(s->lengthlist[i]>0)
-	c->dec_index[sortindex[n++]]=i;
-    
+        c->dec_index[sortindex[n++]]=i;
+
     c->dec_codelengths=_ogg_malloc(n*sizeof(*c->dec_codelengths));
     for(n=0,i=0;i<s->entries;i++)
       if(s->lengthlist[i]>0)
-	c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
-    
+        c->dec_codelengths[sortindex[n++]]=s->lengthlist[i];
+
     c->dec_firsttablen=_ilog(c->used_entries)-4; /* this is magic */
     if(c->dec_firsttablen<5)c->dec_firsttablen=5;
     if(c->dec_firsttablen>8)c->dec_firsttablen=8;
-    
+
     tabn=1<<c->dec_firsttablen;
     c->dec_firsttable=_ogg_calloc(tabn,sizeof(*c->dec_firsttable));
     c->dec_maxlength=0;
-    
+
     for(i=0;i<n;i++){
       if(c->dec_maxlength<c->dec_codelengths[i])
-	c->dec_maxlength=c->dec_codelengths[i];
+        c->dec_maxlength=c->dec_codelengths[i];
       if(c->dec_codelengths[i]<=c->dec_firsttablen){
-	ogg_uint32_t orig=bitreverse(c->codelist[i]);
-	for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
-	  c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
+        ogg_uint32_t orig=bitreverse(c->codelist[i]);
+        for(j=0;j<(1<<(c->dec_firsttablen-c->dec_codelengths[i]));j++)
+          c->dec_firsttable[orig|(j<<c->dec_codelengths[i])]=i+1;
       }
     }
-    
+
     /* now fill in 'unused' entries in the firsttable with hi/lo search
        hints for the non-direct-hits */
     {
       ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen);
       long lo=0,hi=0;
-      
+
       for(i=0;i<tabn;i++){
-	ogg_uint32_t word=i<<(32-c->dec_firsttablen);
-	if(c->dec_firsttable[bitreverse(word)]==0){
-	  while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
-	  while(    hi<n && word>=(c->codelist[hi]&mask))hi++;
-	  
-	  /* we only actually have 15 bits per hint to play with here.
-	     In order to overflow gracefully (nothing breaks, efficiency
-	     just drops), encode as the difference from the extremes. */
-	  {
-	    unsigned long loval=lo;
-	    unsigned long hival=n-hi;
-	    
-	    if(loval>0x7fff)loval=0x7fff;
-	    if(hival>0x7fff)hival=0x7fff;
-	    c->dec_firsttable[bitreverse(word)]=
-	      0x80000000UL | (loval<<15) | hival;
-	  }
-	}
+        ogg_uint32_t word=i<<(32-c->dec_firsttablen);
+        if(c->dec_firsttable[bitreverse(word)]==0){
+          while((lo+1)<n && c->codelist[lo+1]<=word)lo++;
+          while(    hi<n && word>=(c->codelist[hi]&mask))hi++;
+
+          /* we only actually have 15 bits per hint to play with here.
+             In order to overflow gracefully (nothing breaks, efficiency
+             just drops), encode as the difference from the extremes. */
+          {
+            unsigned long loval=lo;
+            unsigned long hival=n-hi;
+
+            if(loval>0x7fff)loval=0x7fff;
+            if(hival>0x7fff)hival=0x7fff;
+            c->dec_firsttable[bitreverse(word)]=
+              0x80000000UL | (loval<<15) | hival;
+          }
+        }
       }
     }
   }
@@ -432,157 +427,6 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){
   return(-1);
 }
 
-static float _dist(int el,float *ref, float *b,int step){
-  int i;
-  float acc=0.f;
-  for(i=0;i<el;i++){
-    float val=(ref[i]-b[i*step]);
-    acc+=val*val;
-  }
-  return(acc);
-}
-
-int _best(codebook *book, float *a, int step){
-  encode_aux_threshmatch *tt=book->c->thresh_tree;
-
-#if 0
-  encode_aux_nearestmatch *nt=book->c->nearest_tree;
-  encode_aux_pigeonhole *pt=book->c->pigeon_tree;
-#endif
-  int dim=book->dim;
-  int k,o;
-  /*int savebest=-1;
-    float saverr;*/
-
-  /* do we have a threshhold encode hint? */
-  if(tt){
-    int index=0,i;
-    /* find the quant val of each scalar */
-    for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
-
-      i=tt->threshvals>>1;
-      if(a[o]<tt->quantthresh[i]){
-
-	for(;i>0;i--)
-	  if(a[o]>=tt->quantthresh[i-1])
-	    break;
-	
-      }else{
-
-	for(i++;i<tt->threshvals-1;i++)
-	  if(a[o]<tt->quantthresh[i])break;
-
-      }
-
-      index=(index*tt->quantvals)+tt->quantmap[i];
-    }
-    /* regular lattices are easy :-) */
-    if(book->c->lengthlist[index]>0) /* is this unused?  If so, we'll
-					use a decision tree after all
-					and fall through*/
-      return(index);
-  }
-
-#if 0
-  /* do we have a pigeonhole encode hint? */
-  if(pt){
-    const static_codebook *c=book->c;
-    int i,besti=-1;
-    float best=0.f;
-    int entry=0;
-
-    /* dealing with sequentialness is a pain in the ass */
-    if(c->q_sequencep){
-      int pv;
-      long mul=1;
-      float qlast=0;
-      for(k=0,o=0;k<dim;k++,o+=step){
-	pv=(int)((a[o]-qlast-pt->min)/pt->del);
-	if(pv<0 || pv>=pt->mapentries)break;
-	entry+=pt->pigeonmap[pv]*mul;
-	mul*=pt->quantvals;
-	qlast+=pv*pt->del+pt->min;
-      }
-    }else{
-      for(k=0,o=step*(dim-1);k<dim;k++,o-=step){
-	int pv=(int)((a[o]-pt->min)/pt->del);
-	if(pv<0 || pv>=pt->mapentries)break;
-	entry=entry*pt->quantvals+pt->pigeonmap[pv];
-      }
-    }
-
-    /* must be within the pigeonholable range; if we quant outside (or
-       in an entry that we define no list for), brute force it */
-    if(k==dim && pt->fitlength[entry]){
-      /* search the abbreviated list */
-      long *list=pt->fitlist+pt->fitmap[entry];
-      for(i=0;i<pt->fitlength[entry];i++){
-	float this=_dist(dim,book->valuelist+list[i]*dim,a,step);
-	if(besti==-1 || this<best){
-	  best=this;
-	  besti=list[i];
-	}
-      }
-
-      return(besti); 
-    }
-  }
-
-  if(nt){
-    /* optimized using the decision tree */
-    while(1){
-      float c=0.f;
-      float *p=book->valuelist+nt->p[ptr];
-      float *q=book->valuelist+nt->q[ptr];
-      
-      for(k=0,o=0;k<dim;k++,o+=step)
-	c+=(p[k]-q[k])*(a[o]-(p[k]+q[k])*.5);
-      
-      if(c>0.f) /* in A */
-	ptr= -nt->ptr0[ptr];
-      else     /* in B */
-	ptr= -nt->ptr1[ptr];
-      if(ptr<=0)break;
-    }
-    return(-ptr);
-  }
-#endif 
-
-  /* brute force it! */
-  {
-    const static_codebook *c=book->c;
-    int i,besti=-1;
-    float best=0.f;
-    float *e=book->valuelist;
-    for(i=0;i<book->entries;i++){
-      if(c->lengthlist[i]>0){
-	float this=_dist(dim,e,a,step);
-	if(besti==-1 || this<best){
-	  best=this;
-	  besti=i;
-	}
-      }
-      e+=dim;
-    }
-
-    /*if(savebest!=-1 && savebest!=besti){
-      fprintf(stderr,"brute force/pigeonhole disagreement:\n"
-	      "original:");
-      for(i=0;i<dim*step;i+=step)fprintf(stderr,"%g,",a[i]);
-      fprintf(stderr,"\n"
-	      "pigeonhole (entry %d, err %g):",savebest,saverr);
-      for(i=0;i<dim;i++)fprintf(stderr,"%g,",
-				(book->valuelist+savebest*dim)[i]);
-      fprintf(stderr,"\n"
-	      "bruteforce (entry %d, err %g):",besti,best);
-      for(i=0;i<dim;i++)fprintf(stderr,"%g,",
-				(book->valuelist+besti*dim)[i]);
-      fprintf(stderr,"\n");
-      }*/
-    return(besti);
-  }
-}
-
 long vorbis_book_codeword(codebook *book,int entry){
   if(book->c) /* only use with encode; decode optimizations are
                  allowed to break this */
@@ -625,10 +469,10 @@ static_codebook test1={
   0,
   0,0,0,0,
   NULL,
-  NULL,NULL
+  0
 };
 static float *test1_result=NULL;
-  
+
 /* linear, full mapping, nonsequential */
 static_codebook test2={
   4,3,
@@ -636,7 +480,7 @@ static_codebook test2={
   2,
   -533200896,1611661312,4,0,
   full_quantlist1,
-  NULL,NULL
+  0
 };
 static float test2_result[]={-3,-2,-1,0, 1,2,3,4, 5,0,3,-2};
 
@@ -647,7 +491,7 @@ static_codebook test3={
   2,
   -533200896,1611661312,4,1,
   full_quantlist1,
-  NULL,NULL
+  0
 };
 static float test3_result[]={-3,-5,-6,-6, 1,3,6,10, 5,5,8,6};
 
@@ -658,17 +502,17 @@ static_codebook test4={
   1,
   -533200896,1611661312,4,0,
   partial_quantlist1,
-  NULL,NULL
+  0
 };
 static float test4_result[]={-3,-3,-3, 4,-3,-3, -1,-3,-3,
-			      -3, 4,-3, 4, 4,-3, -1, 4,-3,
-			      -3,-1,-3, 4,-1,-3, -1,-1,-3, 
-			      -3,-3, 4, 4,-3, 4, -1,-3, 4,
-			      -3, 4, 4, 4, 4, 4, -1, 4, 4,
-			      -3,-1, 4, 4,-1, 4, -1,-1, 4,
-			      -3,-3,-1, 4,-3,-1, -1,-3,-1,
-			      -3, 4,-1, 4, 4,-1, -1, 4,-1,
-			      -3,-1,-1, 4,-1,-1, -1,-1,-1};
+                              -3, 4,-3, 4, 4,-3, -1, 4,-3,
+                              -3,-1,-3, 4,-1,-3, -1,-1,-3,
+                              -3,-3, 4, 4,-3, 4, -1,-3, 4,
+                              -3, 4, 4, 4, 4, 4, -1, 4, 4,
+                              -3,-1, 4, 4,-1, 4, -1,-1, 4,
+                              -3,-3,-1, 4,-3,-1, -1,-3,-1,
+                              -3, 4,-1, 4, 4,-1, -1, 4,-1,
+                              -3,-1,-1, 4,-1,-1, -1,-1,-1};
 
 /* linear, algorithmic mapping, sequential */
 static_codebook test5={
@@ -677,17 +521,17 @@ static_codebook test5={
   1,
   -533200896,1611661312,4,1,
   partial_quantlist1,
-  NULL,NULL
+  0
 };
 static float test5_result[]={-3,-6,-9, 4, 1,-2, -1,-4,-7,
-			      -3, 1,-2, 4, 8, 5, -1, 3, 0,
-			      -3,-4,-7, 4, 3, 0, -1,-2,-5, 
-			      -3,-6,-2, 4, 1, 5, -1,-4, 0,
-			      -3, 1, 5, 4, 8,12, -1, 3, 7,
-			      -3,-4, 0, 4, 3, 7, -1,-2, 2,
-			      -3,-6,-7, 4, 1, 0, -1,-4,-5,
-			      -3, 1, 0, 4, 8, 7, -1, 3, 2,
-			      -3,-4,-5, 4, 3, 2, -1,-2,-3};
+                              -3, 1,-2, 4, 8, 5, -1, 3, 0,
+                              -3,-4,-7, 4, 3, 0, -1,-2,-5,
+                              -3,-6,-2, 4, 1, 5, -1,-4, 0,
+                              -3, 1, 5, 4, 8,12, -1, 3, 7,
+                              -3,-4, 0, 4, 3, 7, -1,-2, 2,
+                              -3,-6,-7, 4, 1, 0, -1,-4,-5,
+                              -3, 1, 0, 4, 8, 7, -1, 3, 2,
+                              -3,-4,-5, 4, 3, 2, -1,-2,-3};
 
 void run_test(static_codebook *b,float *comp){
   float *out=_book_unquantize(b,b->entries,NULL);
@@ -701,15 +545,15 @@ void run_test(static_codebook *b,float *comp){
 
     for(i=0;i<b->entries*b->dim;i++)
       if(fabs(out[i]-comp[i])>.0001){
-	fprintf(stderr,"disagreement in unquantized and reference data:\n"
-		"position %d, %g != %g\n",i,out[i],comp[i]);
-	exit(1);
+        fprintf(stderr,"disagreement in unquantized and reference data:\n"
+                "position %d, %g != %g\n",i,out[i],comp[i]);
+        exit(1);
       }
 
   }else{
     if(out){
       fprintf(stderr,"_book_unquantize returned a value array: \n"
-	      " correct result should have been NULL\n");
+              " correct result should have been NULL\n");
       exit(1);
     }
   }
@@ -728,7 +572,7 @@ int main(){
   fprintf(stderr,"OK\nDequant test 5... ");
   run_test(&test5,test5_result);
   fprintf(stderr,"OK\n\n");
-  
+
   return(0);
 }
 

+ 16 - 16
Engine/lib/libvorbis/lib/smallft.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: *unnormalized* fft transform
- last mod: $Id: smallft.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: smallft.c 16227 2009-07-08 06:58:46Z xiphmont $
 
  ********************************************************************/
 
@@ -94,10 +94,10 @@ static void drfti1(int n, float *wa, int *ifac){
       argld=(float)ld*argh;
       fi=0.f;
       for (ii=2;ii<ido;ii+=2){
-	fi+=1.f;
-	arg=fi*argld;
-	wa[i++]=cos(arg);
-	wa[i++]=sin(arg);
+        fi+=1.f;
+        arg=fi*argld;
+        wa[i++]=cos(arg);
+        wa[i++]=sin(arg);
       }
       is+=ido;
     }
@@ -125,7 +125,7 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
     t1+=ido;
     t2+=ido;
   }
-    
+
   if(ido<2)return;
   if(ido==2)goto L105;
 
@@ -167,12 +167,12 @@ static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){
 }
 
 static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
-	    float *wa2,float *wa3){
+            float *wa2,float *wa3){
   static float hsqt2 = .70710678118654752f;
   int i,k,t0,t1,t2,t3,t4,t5,t6;
   float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
   t0=l1*ido;
-  
+
   t1=t0;
   t4=t1<<1;
   t2=t1+(t1<<1);
@@ -244,7 +244,7 @@ static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1,
   if(ido&1)return;
 
  L105:
-  
+
   t2=(t1=t0+ido-1)+(t0<<1);
   t3=ido<<2;
   t4=ido;
@@ -278,7 +278,7 @@ static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
   int nbd;
   float dcp,arg,dsp,ar1h,ar2h;
   int idp2,ipp2;
-  
+
   arg=tpi/(float)ip;
   dcp=cos(arg);
   dsp=sin(arg);
@@ -636,7 +636,7 @@ static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){
   float ti2,tr2;
 
   t0=l1*ido;
-  
+
   t1=0;
   t2=0;
   t3=(ido<<1)-1;
@@ -747,12 +747,12 @@ static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1,
 }
 
 static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
-			  float *wa2,float *wa3){
+                          float *wa2,float *wa3){
   static float sqrt2=1.414213562373095f;
   int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8;
   float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4;
   t0=l1*ido;
-  
+
   t1=0;
   t2=ido<<2;
   t3=0;
@@ -761,7 +761,7 @@ static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1,
     t4=t3+t6;
     t5=t1;
     tr3=cc[t4-1]+cc[t4-1];
-    tr4=cc[t4]+cc[t4]; 
+    tr4=cc[t4]+cc[t4];
     tr1=cc[t3]-cc[(t4+=t6)-1];
     tr2=cc[t3]+cc[t4-1];
     ch[t5]=tr2+tr3;
@@ -856,7 +856,7 @@ static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1,
   ipp2=ip;
   ipph=(ip+1)>>1;
   if(ido<l1)goto L103;
-  
+
   t1=0;
   t2=0;
   for(k=0;k<l1;k++){

+ 34 - 20
Engine/lib/libvorbis/lib/synthesis.c

@@ -5,13 +5,13 @@
  * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
  * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
  *                                                                  *
- * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2007             *
+ * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2009             *
  * by the Xiph.Org Foundation http://www.xiph.org/                  *
  *                                                                  *
  ********************************************************************
 
  function: single-block PCM synthesis
- last mod: $Id: synthesis.c 13293 2007-07-24 00:09:47Z xiphmont $
+ last mod: $Id: synthesis.c 17474 2010-09-30 03:41:41Z gmaxwell $
 
  ********************************************************************/
 
@@ -24,13 +24,17 @@
 #include "os.h"
 
 int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
-  vorbis_dsp_state     *vd=vb->vd;
-  private_state        *b=vd->backend_state;
-  vorbis_info          *vi=vd->vi;
-  codec_setup_info     *ci=vi->codec_setup;
-  oggpack_buffer       *opb=&vb->opb;
+  vorbis_dsp_state     *vd= vb ? vb->vd : 0;
+  private_state        *b= vd ? vd->backend_state : 0;
+  vorbis_info          *vi= vd ? vd->vi : 0;
+  codec_setup_info     *ci= vi ? vi->codec_setup : 0;
+  oggpack_buffer       *opb=vb ? &vb->opb : 0;
   int                   type,mode,i;
- 
+
+  if (!vd || !b || !vi || !ci || !opb) {
+    return OV_EBADPACKET;
+  }
+
   /* first things first.  Make sure decode is ready */
   _vorbis_block_ripcord(vb);
   oggpack_readinit(opb,op->packet,op->bytes);
@@ -43,9 +47,15 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
 
   /* read our mode and pre/post windowsize */
   mode=oggpack_read(opb,b->modebits);
-  if(mode==-1)return(OV_EBADPACKET);
-  
+  if(mode==-1){
+    return(OV_EBADPACKET);
+  }
+
   vb->mode=mode;
+  if(!ci->mode_param[mode]){
+    return(OV_EBADPACKET);
+  }
+
   vb->W=ci->mode_param[mode]->blockflag;
   if(vb->W){
 
@@ -53,12 +63,14 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
        only for window selection */
     vb->lW=oggpack_read(opb,1);
     vb->nW=oggpack_read(opb,1);
-    if(vb->nW==-1)   return(OV_EBADPACKET);
+    if(vb->nW==-1){
+      return(OV_EBADPACKET);
+    }
   }else{
     vb->lW=0;
     vb->nW=0;
   }
-  
+
   /* more setup */
   vb->granulepos=op->granulepos;
   vb->sequence=op->packetno;
@@ -74,7 +86,7 @@ int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){
   type=ci->map_type[ci->mode_param[mode]->mapping];
 
   return(_mapping_P[type]->inverse(vb,ci->map_param[ci->mode_param[mode]->
-						   mapping]));
+                                                   mapping]));
 }
 
 /* used to track pcm position without actually performing decode.
@@ -86,7 +98,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
   codec_setup_info     *ci=vi->codec_setup;
   oggpack_buffer       *opb=&vb->opb;
   int                   mode;
- 
+
   /* first things first.  Make sure decode is ready */
   _vorbis_block_ripcord(vb);
   oggpack_readinit(opb,op->packet,op->bytes);
@@ -100,8 +112,12 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
   /* read our mode and pre/post windowsize */
   mode=oggpack_read(opb,b->modebits);
   if(mode==-1)return(OV_EBADPACKET);
-  
+
   vb->mode=mode;
+  if(!ci->mode_param[mode]){
+    return(OV_EBADPACKET);
+  }
+  
   vb->W=ci->mode_param[mode]->blockflag;
   if(vb->W){
     vb->lW=oggpack_read(opb,1);
@@ -111,7 +127,7 @@ int vorbis_synthesis_trackonly(vorbis_block *vb,ogg_packet *op){
     vb->lW=0;
     vb->nW=0;
   }
-  
+
   /* more setup */
   vb->granulepos=op->granulepos;
   vb->sequence=op->packetno;
@@ -128,7 +144,7 @@ long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
   codec_setup_info     *ci=vi->codec_setup;
   oggpack_buffer       opb;
   int                  mode;
- 
+
   oggpack_readinit(&opb,op->packet,op->bytes);
 
   /* Check the packet type */
@@ -155,7 +171,7 @@ long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){
 int vorbis_synthesis_halfrate(vorbis_info *vi,int flag){
   /* set / clear half-sample-rate mode */
   codec_setup_info     *ci=vi->codec_setup;
-  
+
   /* right now, our MDCT can't handle < 64 sample windows. */
   if(ci->blocksizes[0]<=64 && flag)return -1;
   ci->halfrate_flag=(flag?1:0);
@@ -166,5 +182,3 @@ int vorbis_synthesis_halfrate_p(vorbis_info *vi){
   codec_setup_info     *ci=vi->codec_setup;
   return ci->halfrate_flag;
 }
-
-

File diff suppressed because it is too large
+ 306 - 304
Engine/lib/libvorbis/lib/vorbisenc.c


File diff suppressed because it is too large
+ 510 - 431
Engine/lib/libvorbis/lib/vorbisfile.c


File diff suppressed because it is too large
+ 2051 - 2051
Engine/lib/libvorbis/lib/window.c


Some files were not shown because too many files changed in this diff