about summary refs log tree commit diff
path: root/src/engine/external/wavpack
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/external/wavpack')
-rw-r--r--src/engine/external/wavpack/wavpack.h198
1 files changed, 99 insertions, 99 deletions
diff --git a/src/engine/external/wavpack/wavpack.h b/src/engine/external/wavpack/wavpack.h
index 7c260586..29e6af75 100644
--- a/src/engine/external/wavpack/wavpack.h
+++ b/src/engine/external/wavpack/wavpack.h
@@ -1,16 +1,16 @@
-////////////////////////////////////////////////////////////////////////////

-//                           **** WAVPACK ****                            //

-//                  Hybrid Lossless Wavefile Compressor                   //

-//              Copyright (c) 1998 - 2004 Conifer Software.               //

-//                          All Rights Reserved.                          //

-//      Distributed under the BSD Software License (see license.txt)      //

-////////////////////////////////////////////////////////////////////////////

+/*////////////////////////////////////////////////////////////////////////// */
+/*                           **** WAVPACK ****                            // */
+/*                  Hybrid Lossless Wavefile Compressor                   // */
+/*              Copyright (c) 1998 - 2004 Conifer Software.               // */
+/*                          All Rights Reserved.                          // */
+/*      Distributed under the BSD Software License (see license.txt)      // */
+/*////////////////////////////////////////////////////////////////////////// */
 

-// wavpack.h

+/* wavpack.h */
 

 #include <sys/types.h>

 

-// This header file contains all the definitions required by WavPack.

+/* This header file contains all the definitions required by WavPack. */
 

 #ifdef __BORLANDC__

 typedef unsigned long uint32_t;

@@ -37,11 +37,11 @@ typedef unsigned int    uint;
 #define FALSE 0

 #define TRUE 1

 

-////////////////////////////// WavPack Header /////////////////////////////////

+/*//////////////////////////// WavPack Header ///////////////////////////////// */
 

-// Note that this is the ONLY structure that is written to (or read from)

-// WavPack 4.0 files, and is the preamble to every block in both the .wv

-// and .wvc files.

+/* Note that this is the ONLY structure that is written to (or read from) */
+/* WavPack 4.0 files, and is the preamble to every block in both the .wv */
+/* and .wvc files. */
 

 typedef struct {

     char ckID [4];

@@ -53,22 +53,22 @@ typedef struct {
 

 #define WavpackHeaderFormat "4LS2LLLLL"

 

-// or-values for "flags"

+/* or-values for "flags" */
 

-#define BYTES_STORED    3       // 1-4 bytes/sample

-#define MONO_FLAG       4       // not stereo

-#define HYBRID_FLAG     8       // hybrid mode

-#define JOINT_STEREO    0x10    // joint stereo

-#define CROSS_DECORR    0x20    // no-delay cross decorrelation

-#define HYBRID_SHAPE    0x40    // noise shape (hybrid mode only)

-#define FLOAT_DATA      0x80    // ieee 32-bit floating point data

+#define BYTES_STORED    3       /* 1-4 bytes/sample */
+#define MONO_FLAG       4       /* not stereo */
+#define HYBRID_FLAG     8       /* hybrid mode */
+#define JOINT_STEREO    0x10    /* joint stereo */
+#define CROSS_DECORR    0x20    /* no-delay cross decorrelation */
+#define HYBRID_SHAPE    0x40    /* noise shape (hybrid mode only) */
+#define FLOAT_DATA      0x80    /* ieee 32-bit floating point data */
 

-#define INT32_DATA      0x100   // special extended int handling

-#define HYBRID_BITRATE  0x200   // bitrate noise (hybrid mode only)

-#define HYBRID_BALANCE  0x400   // balance noise (hybrid stereo mode only)

+#define INT32_DATA      0x100   /* special extended int handling */
+#define HYBRID_BITRATE  0x200   /* bitrate noise (hybrid mode only) */
+#define HYBRID_BALANCE  0x400   /* balance noise (hybrid stereo mode only) */
 

-#define INITIAL_BLOCK   0x800   // initial block of multichannel segment

-#define FINAL_BLOCK     0x1000  // final block of multichannel segment

+#define INITIAL_BLOCK   0x800   /* initial block of multichannel segment */
+#define FINAL_BLOCK     0x1000  /* final block of multichannel segment */
 

 #define SHIFT_LSB       13

 #define SHIFT_MASK      (0x1fL << SHIFT_LSB)

@@ -79,21 +79,21 @@ typedef struct {
 #define SRATE_LSB       23

 #define SRATE_MASK      (0xfL << SRATE_LSB)

 

-#define FALSE_STEREO    0x40000000      // block is stereo, but data is mono

+#define FALSE_STEREO    0x40000000      /* block is stereo, but data is mono */
 

-#define IGNORED_FLAGS   0x18000000      // reserved, but ignore if encountered

-#define NEW_SHAPING     0x20000000      // use IIR filter for negative shaping

-#define UNKNOWN_FLAGS   0x80000000      // also reserved, but refuse decode if

-                                        //  encountered

+#define IGNORED_FLAGS   0x18000000      /* reserved, but ignore if encountered */
+#define NEW_SHAPING     0x20000000      /* use IIR filter for negative shaping */
+#define UNKNOWN_FLAGS   0x80000000      /* also reserved, but refuse decode if */
+                                        /*  encountered */
 

 #define MONO_DATA (MONO_FLAG | FALSE_STEREO)

 

-#define MIN_STREAM_VERS     0x402       // lowest stream version we'll decode

-#define MAX_STREAM_VERS     0x410       // highest stream version we'll decode

+#define MIN_STREAM_VERS     0x402       /* lowest stream version we'll decode */
+#define MAX_STREAM_VERS     0x410       /* highest stream version we'll decode */
 

-//////////////////////////// WavPack Metadata /////////////////////////////////

+/*////////////////////////// WavPack Metadata ///////////////////////////////// */
 

-// This is an internal representation of metadata.

+/* This is an internal representation of metadata. */
 

 typedef struct {

     int32_t byte_length;

@@ -127,11 +127,11 @@ typedef struct {
 #define ID_CONFIG_BLOCK         (ID_OPTIONAL_DATA | 0x5)

 #define ID_MD5_CHECKSUM         (ID_OPTIONAL_DATA | 0x6)

 

-///////////////////////// WavPack Configuration ///////////////////////////////

+/*/////////////////////// WavPack Configuration /////////////////////////////// */
 

-// This internal structure is used during encode to provide configuration to

-// the encoding engine and during decoding to provide fle information back to

-// the higher level functions. Not all fields are used in both modes.

+/* This internal structure is used during encode to provide configuration to */
+/* the encoding engine and during decoding to provide fle information back to */
+/* the higher level functions. Not all fields are used in both modes. */
 

 typedef struct {

     int bits_per_sample, bytes_per_sample;

@@ -139,38 +139,38 @@ typedef struct {
     uint32_t flags, sample_rate, channel_mask;

 } WavpackConfig;

 

-#define CONFIG_BYTES_STORED     3       // 1-4 bytes/sample

-#define CONFIG_MONO_FLAG        4       // not stereo

-#define CONFIG_HYBRID_FLAG      8       // hybrid mode

-#define CONFIG_JOINT_STEREO     0x10    // joint stereo

-#define CONFIG_CROSS_DECORR     0x20    // no-delay cross decorrelation

-#define CONFIG_HYBRID_SHAPE     0x40    // noise shape (hybrid mode only)

-#define CONFIG_FLOAT_DATA       0x80    // ieee 32-bit floating point data

-

-#define CONFIG_FAST_FLAG        0x200   // fast mode

-#define CONFIG_HIGH_FLAG        0x800   // high quality mode

-#define CONFIG_VERY_HIGH_FLAG   0x1000  // very high

-#define CONFIG_BITRATE_KBPS     0x2000  // bitrate is kbps, not bits / sample

-#define CONFIG_AUTO_SHAPING     0x4000  // automatic noise shaping

-#define CONFIG_SHAPE_OVERRIDE   0x8000  // shaping mode specified

-#define CONFIG_JOINT_OVERRIDE   0x10000 // joint-stereo mode specified

-#define CONFIG_CREATE_EXE       0x40000 // create executable

-#define CONFIG_CREATE_WVC       0x80000 // create correction file

-#define CONFIG_OPTIMIZE_WVC     0x100000 // maximize bybrid compression

-#define CONFIG_CALC_NOISE       0x800000 // calc noise in hybrid mode

-#define CONFIG_LOSSY_MODE       0x1000000 // obsolete (for information)

-#define CONFIG_EXTRA_MODE       0x2000000 // extra processing mode

-#define CONFIG_SKIP_WVX         0x4000000 // no wvx stream w/ floats & big ints

-#define CONFIG_MD5_CHECKSUM     0x8000000 // compute & store MD5 signature

-#define CONFIG_OPTIMIZE_MONO    0x80000000 // optimize for mono streams posing as stereo

-

-//////////////////////////////// WavPack Stream ///////////////////////////////

-

-// This internal structure contains everything required to handle a WavPack

-// "stream", which is defined as a stereo or mono stream of audio samples. For

-// multichannel audio several of these would be required. Each stream contains

-// pointers to hold a complete allocated block of WavPack data, although it's

-// possible to decode WavPack blocks without buffering an entire block.

+#define CONFIG_BYTES_STORED     3       /* 1-4 bytes/sample */
+#define CONFIG_MONO_FLAG        4       /* not stereo */
+#define CONFIG_HYBRID_FLAG      8       /* hybrid mode */
+#define CONFIG_JOINT_STEREO     0x10    /* joint stereo */
+#define CONFIG_CROSS_DECORR     0x20    /* no-delay cross decorrelation */
+#define CONFIG_HYBRID_SHAPE     0x40    /* noise shape (hybrid mode only) */
+#define CONFIG_FLOAT_DATA       0x80    /* ieee 32-bit floating point data */
+

+#define CONFIG_FAST_FLAG        0x200   /* fast mode */
+#define CONFIG_HIGH_FLAG        0x800   /* high quality mode */
+#define CONFIG_VERY_HIGH_FLAG   0x1000  /* very high */
+#define CONFIG_BITRATE_KBPS     0x2000  /* bitrate is kbps, not bits / sample */
+#define CONFIG_AUTO_SHAPING     0x4000  /* automatic noise shaping */
+#define CONFIG_SHAPE_OVERRIDE   0x8000  /* shaping mode specified */
+#define CONFIG_JOINT_OVERRIDE   0x10000 /* joint-stereo mode specified */
+#define CONFIG_CREATE_EXE       0x40000 /* create executable */
+#define CONFIG_CREATE_WVC       0x80000 /* create correction file */
+#define CONFIG_OPTIMIZE_WVC     0x100000 /* maximize bybrid compression */
+#define CONFIG_CALC_NOISE       0x800000 /* calc noise in hybrid mode */
+#define CONFIG_LOSSY_MODE       0x1000000 /* obsolete (for information) */
+#define CONFIG_EXTRA_MODE       0x2000000 /* extra processing mode */
+#define CONFIG_SKIP_WVX         0x4000000 /* no wvx stream w/ floats & big ints */
+#define CONFIG_MD5_CHECKSUM     0x8000000 /* compute & store MD5 signature */
+#define CONFIG_OPTIMIZE_MONO    0x80000000 /* optimize for mono streams posing as stereo */
+

+/*////////////////////////////// WavPack Stream /////////////////////////////// */
+

+/* This internal structure contains everything required to handle a WavPack */
+/* "stream", which is defined as a stereo or mono stream of audio samples. For */
+/* multichannel audio several of these would be required. Each stream contains */
+/* pointers to hold a complete allocated block of WavPack data, although it's */
+/* possible to decode WavPack blocks without buffering an entire block. */
 

 typedef int32_t (*read_stream)(void *, int32_t);

 

@@ -217,20 +217,20 @@ typedef struct {
 

 } WavpackStream;

 

-// flags for float_flags:

+/* flags for float_flags: */
 

-#define FLOAT_SHIFT_ONES 1      // bits left-shifted into float = '1'

-#define FLOAT_SHIFT_SAME 2      // bits left-shifted into float are the same

-#define FLOAT_SHIFT_SENT 4      // bits shifted into float are sent literally

-#define FLOAT_ZEROS_SENT 8      // "zeros" are not all real zeros

-#define FLOAT_NEG_ZEROS  0x10   // contains negative zeros

-#define FLOAT_EXCEPTIONS 0x20   // contains exceptions (inf, nan, etc.)

+#define FLOAT_SHIFT_ONES 1      /* bits left-shifted into float = '1' */
+#define FLOAT_SHIFT_SAME 2      /* bits left-shifted into float are the same */
+#define FLOAT_SHIFT_SENT 4      /* bits shifted into float are sent literally */
+#define FLOAT_ZEROS_SENT 8      /* "zeros" are not all real zeros */
+#define FLOAT_NEG_ZEROS  0x10   /* contains negative zeros */
+#define FLOAT_EXCEPTIONS 0x20   /* contains exceptions (inf, nan, etc.) */
 

-/////////////////////////////// WavPack Context ///////////////////////////////

+/*///////////////////////////// WavPack Context /////////////////////////////// */
 

-// This internal structure holds everything required to encode or decode WavPack

-// files. It is recommended that direct access to this structure be minimized

-// and the provided utilities used instead.

+/* This internal structure holds everything required to encode or decode WavPack */
+/* files. It is recommended that direct access to this structure be minimized */
+/* and the provided utilities used instead. */
 

 typedef struct {

     WavpackConfig config;

@@ -245,11 +245,11 @@ typedef struct {
 

 } WavpackContext;

 

-//////////////////////// function prototypes and macros //////////////////////

+/*////////////////////// function prototypes and macros ////////////////////// */
 

 #define CLEAR(destin) memset (&destin, 0, sizeof (destin));

 

-// bits.c

+/* bits.c */
 

 void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_stream file, uint32_t file_bytes);

 

@@ -284,15 +284,15 @@ void bs_open_read (Bitstream *bs, uchar *buffer_start, uchar *buffer_end, read_s
 void little_endian_to_native (void *data, char *format);

 void native_to_little_endian (void *data, char *format);

 

-// These macros implement the weight application and update operations

-// that are at the heart of the decorrelation loops. Note that when there

-// are several alternative versions of the same macro (marked with PERFCOND)

-// then the versions are functionally equivalent with respect to WavPack

-// decoding and the user should choose the one that provides the best

-// performance. This may be easier to check when NOT using the assembly

-// language optimizations.

+/* These macros implement the weight application and update operations */
+/* that are at the heart of the decorrelation loops. Note that when there */
+/* are several alternative versions of the same macro (marked with PERFCOND) */
+/* then the versions are functionally equivalent with respect to WavPack */
+/* decoding and the user should choose the one that provides the best */
+/* performance. This may be easier to check when NOT using the assembly */
+/* language optimizations. */
 

-#if 1   // PERFCOND

+#if 1   /* PERFCOND */
 #define apply_weight_i(weight, sample) ((weight * sample + 512) >> 10)

 #else

 #define apply_weight_i(weight, sample) ((((weight * sample) >> 8) + 2) >> 2)

@@ -301,14 +301,14 @@ void native_to_little_endian (void *data, char *format);
 #define apply_weight_f(weight, sample) (((((sample & 0xffffL) * weight) >> 9) + \

     (((sample & ~0xffffL) >> 9) * weight) + 1) >> 1)

 

-#if 1   // PERFCOND

+#if 1   /* PERFCOND */
 #define apply_weight(weight, sample) (sample != (short) sample ? \

     apply_weight_f (weight, sample) : apply_weight_i (weight, sample))

 #else

 #define apply_weight(weight, sample) ((int32_t)((weight * (int64_t) sample + 512) >> 10))

 #endif

 

-#if 0   // PERFCOND

+#if 0   /* PERFCOND */
 #define update_weight(weight, delta, source, result) \

     if (source && result) { int32_t s = (int32_t) (source ^ result) >> 31; weight = (delta ^ s) + (weight - s); }

 #elif 1

@@ -323,7 +323,7 @@ void native_to_little_endian (void *data, char *format);
     if (source && result && ((source ^ result) < 0 ? (weight -= delta) < -1024 : (weight += delta) > 1024)) \

         weight = weight < 0 ? -1024 : 1024

 

-// unpack.c

+/* unpack.c */
 

 int unpack_init (WavpackContext *wpc);

 int init_wv_bitstream (WavpackContext *wpc, WavpackMetadata *wpmd);

@@ -337,12 +337,12 @@ int read_config_info (WavpackContext *wpc, WavpackMetadata *wpmd);
 int32_t unpack_samples (WavpackContext *wpc, int32_t *buffer, uint32_t sample_count);

 int check_crc_error (WavpackContext *wpc);

 

-// metadata.c stuff

+/* metadata.c stuff */
 

 int read_metadata_buff (WavpackContext *wpc, WavpackMetadata *wpmd);

 int process_metadata (WavpackContext *wpc, WavpackMetadata *wpmd);

 

-// words.c stuff

+/* words.c stuff */
 

 int read_entropy_vars (WavpackStream *wps, WavpackMetadata *wpmd);

 int read_hybrid_profile (WavpackStream *wps, WavpackMetadata *wpmd);

@@ -353,12 +353,12 @@ int restore_weight (signed char weight);
 

 #define WORD_EOF (1L << 31)

 

-// float.c

+/* float.c */
 

 int read_float_info (WavpackStream *wps, WavpackMetadata *wpmd);

 void float_values (WavpackStream *wps, int32_t *values, int32_t num_values);

 

-// wputils.c

+/* wputils.c */
 

 WavpackContext *WavpackOpenFileInput (read_stream infile, char *error);