audio.h   audio.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: audio.h,v 1.6 2000/03/19 06:43:38 rob Exp $ * $Id: audio.h,v 1.7 2000/04/22 04:36:50 rob Exp $
*/ */
# ifndef AUDIO_H # ifndef AUDIO_H
# define AUDIO_H # define AUDIO_H
# include "libmad.h" # include "libmad.h"
# define MAX_NSAMPLES 1152 # define MAX_NSAMPLES 1152
enum { enum {
skipping to change at line 53 skipping to change at line 53
struct audio_config { struct audio_config {
short command; short command;
unsigned short channels; unsigned short channels;
unsigned int speed; unsigned int speed;
} config; } config;
struct audio_play { struct audio_play {
short command; short command;
unsigned short nsamples; unsigned short nsamples;
fixed_t const *samples[2]; mad_fixed_t const *samples[2];
} play; } play;
struct audio_finish { struct audio_finish {
short command; short command;
} finish; } finish;
}; };
extern char const *audio_error; extern char const *audio_error;
typedef int (*audio_ctlfunc_t)(union audio_control *); typedef int (*audio_ctlfunc_t)(union audio_control *);
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 bit.h   bit.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: bit.h,v 1.6 2000/03/19 06:43:38 rob Exp $ * $Id: bit.h,v 1.7 2000/03/22 23:52:59 rob Exp $
*/ */
# ifndef BIT_H # ifndef BIT_H
# define BIT_H # define BIT_H
struct mad_bitptr { struct mad_bitptr {
unsigned char const *byte; unsigned char const *byte;
unsigned short cache; unsigned short cache;
unsigned short left; unsigned short left;
}; };
void mad_bit_init(struct mad_bitptr *, unsigned char const *); void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */ # define mad_bit_finish(bitptr) /* nothing */
unsigned int mad_bit_length(struct mad_bitptr const *, unsigned int mad_bit_length(struct mad_bitptr const *,
struct mad_bitptr const *); struct mad_bitptr const *);
# define mad_bit_left(bitptr) ((bitptr)->left) # define mad_bit_bitsleft(bitptr) ((bitptr)->left)
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
void mad_bit_skip(struct mad_bitptr *, unsigned int); void mad_bit_skip(struct mad_bitptr *, unsigned int);
unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short) ; unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short) ;
# endif # endif
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 config.h   config.h 
skipping to change at line 64 skipping to change at line 64
/* Define to be the name of your default audio output module. */ /* Define to be the name of your default audio output module. */
#define AUDIO_DEFAULT audio_oss #define AUDIO_DEFAULT audio_oss
/* Define only if compiling for the empeg-car. */ /* Define only if compiling for the empeg-car. */
/* #undef EMPEG */ /* #undef EMPEG */
/* Define to enable diagnostic debugging support. */ /* Define to enable diagnostic debugging support. */
/* #undef DEBUG */ /* #undef DEBUG */
/* The number of bytes in a int. */
#define SIZEOF_INT 4
/* The number of bytes in a long. */
#define SIZEOF_LONG 4
/* The number of bytes in a long long. */
#define SIZEOF_LONG_LONG 8
/* Define if you have the getpagesize function. */ /* Define if you have the getpagesize function. */
/* #undef HAVE_GETPAGESIZE */ /* #undef HAVE_GETPAGESIZE */
/* Define if you have the <fcntl.h> header file. */ /* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1 #define HAVE_FCNTL_H 1
/* Define if you have the <limits.h> header file. */ /* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1 #define HAVE_LIMITS_H 1
/* Define if you have the <sys/ioctl.h> header file. */ /* Define if you have the <sys/ioctl.h> header file. */
 End of changes. 1 change blocks. 
0 lines changed or deleted 9 lines changed or added


 fixed.h   fixed.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: fixed.h,v 1.8 2000/03/08 14:01:11 rob Exp $ * $Id: fixed.h,v 1.9 2000/04/22 04:36:50 rob Exp $
*/ */
# ifndef FIXED_H # ifndef FIXED_H
# define FIXED_H # define FIXED_H
typedef signed long fixed_t; # if SIZEOF_INT >= 4
typedef signed int mad_fixed_t;
typedef signed long fixed64hi_t; typedef signed int mad_fixed64hi_t;
typedef unsigned long fixed64lo_t; typedef unsigned int mad_fixed64lo_t;
# else
typedef signed long mad_fixed_t;
typedef signed long mad_fixed64hi_t;
typedef unsigned long mad_fixed64lo_t;
# endif
/* /*
* Fixed-point format: 0xABBBBBBB * Fixed-point format: 0xABBBBBBB
* A == whole part (sign + 3 bits) * A == whole part (sign + 3 bits)
* B == fractional part (28 bits) * B == fractional part (28 bits)
* *
* Values are signed two's complement, so the effective range is: * Values are signed two's complement, so the effective range is:
* 0x80000000 to 0x7fffffff * 0x80000000 to 0x7fffffff
* -8.0 to +7.9999999962747097015380859375 * -8.0 to +7.9999999962747097015380859375
* *
* The smallest representable value is: * The smallest representable value is:
* 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.73e-9) * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.73e-9)
* *
* 28 bits of fractional accuracy represent about * 28 bits of fractional accuracy represent about
* 8.6 digits of decimal accuracy. * 8.6 digits of decimal accuracy.
* *
* Fixed-point numbers can be added or subtracted as normal * Fixed-point numbers can be added or subtracted as normal
* integers, but multiplication requires shifting the 64-bit result * integers, but multiplication requires shifting the 64-bit result
* from 56 fractional bits back to 28 (and rounding.) * from 56 fractional bits back to 28 (and rounding.)
* *
* The CPU-specific versions of f_mul() perform rounding by truncation. * The CPU-specific versions of mad_f_mul() perform rounding by truncation.
*/ */
# define f_add(x, y) ((x) + (y)) # define MAD_F_MIN 0x80000000L
# define f_sub(x, y) ((x) - (y)) # define MAD_F_MAX 0x7fffffffL
# define f_scale64(hi, lo) ((fixed_t) (((fixed64hi_t) (hi) << 4) | \ # define mad_f_add(x, y) ((x) + (y))
((fixed64lo_t) (lo) >> 28))) # define mad_f_sub(x, y) ((x) - (y))
# define mad_f_scale64(hi, lo) ((mad_fixed_t) \
(((mad_fixed64hi_t) (hi) << 4) | \
((mad_fixed64lo_t) (lo) >> 28)))
# if defined(FPM_APPROX) # if defined(FPM_APPROX)
/* This version is the most portable but loses 14 bits of accuracy. */ /* This version is the most portable but loses 14 bits of accuracy. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) ((((x) + 0x00002000L) >> 14) * \ # define mad_f_mul(x, y) ((((x) + 0x00002000L) >> 14) * \
(((y) + 0x00002000L) >> 14)) (((y) + 0x00002000L) >> 14))
# elif defined(FPM_64BIT) # elif defined(FPM_64BIT)
/* This version should be the most accurate if 64-bit (long long) types /* This version should be the most accurate if 64-bit (long long) types
are supported by the compiler. */ are supported by the compiler. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
((fixed_t) (((((signed long long) (x) * (y)) + 0x08000000L) >> 28))) ((mad_fixed_t) (((((signed long long) (x) * (y)) + 0x08000000L) >> 28)
))
# elif defined(FPM_INTEL) # elif defined(FPM_INTEL)
/* This Intel version is accurate but always rounds down the least /* This Intel version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("imull %3" \ asm ("imull %3" \
: "=a" (__lo), "=d" (__hi) \ : "=a" (__lo), "=d" (__hi) \
: "%a" (x), "rm" (y)); \ : "%a" (x), "rm" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# if 0 # if 0
/* this is slower than the C multiply/add version */ /* this is slower than the C multiply/add version */
# define FPM_MACC # define FPM_MACC
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("imull %3" \ asm ("imull %3" \
: "=a" (__lo), "=d" (__hi) \ : "=a" (__lo), "=d" (__hi) \
: "%a" (x), "rm" (y)); \ : "%a" (x), "rm" (y)); \
asm ("add %2,%0" \ asm ("add %2,%0" \
: "=r,rm" (lo) \ : "=r,rm" (lo) \
: "%0,0" (lo), "rm,r" (__lo)); \ : "%0,0" (lo), "rm,r" (__lo)); \
asm ("adc %2,%0" \ asm ("adc %2,%0" \
: "=r,rm" (hi) \ : "=r,rm" (hi) \
: "%0,0" (hi), "rm,r" (__hi)); \ : "%0,0" (hi), "rm,r" (__hi)); \
}) })
# endif # endif
# elif defined(FPM_ARM) # elif defined(FPM_ARM)
/* This ARM V4 version is accurate but always rounds down the least /* This ARM V4 version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("smull %0,%1,%2,%3" \ asm ("smull %0,%1,%2,%3" \
: "=&r" (__lo), "=&r" (__hi) \ : "=&r" (__lo), "=&r" (__hi) \
: "%r" (x), "r" (y)); \ : "%r" (x), "r" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# if 0 # if 0
/* this is slower than explicit multiply/add */ /* this is slower than explicit multiply/add */
# define FPM_MACC # define FPM_MACC
# if 0 # if 0
/* this was for debugging only */ /* this was for debugging only */
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("smull %0,%1,%2,%3" \ asm ("smull %0,%1,%2,%3" \
: "=&r" (__lo), "=&r" (__hi) \ : "=&r" (__lo), "=&r" (__hi) \
: "%r" (x), "r" (y)); \ : "%r" (x), "r" (y)); \
asm ("adds %0,%2,%3; adc %1,%4,%5" \ asm ("adds %0,%2,%3; adc %1,%4,%5" \
: "=r" (lo), "=r" (hi) \ : "=r" (lo), "=r" (hi) \
: "%r" (lo), "r" (__lo), "%r" (hi), "r" (__hi) \ : "%r" (lo), "r" (__lo), "%r" (hi), "r" (__hi) \
: "cc"); \ : "cc"); \
}) })
# else # else
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
asm ("smlal %0,%1,%2,%3" \ asm ("smlal %0,%1,%2,%3" \
: "+r" (lo), "+r" (hi) \ : "+r" (lo), "+r" (hi) \
: "%r" (x), "r" (y)) : "%r" (x), "r" (y))
# endif # endif
# endif # endif
# elif defined(FPM_MIPS) # elif defined(FPM_MIPS)
/* This MIPS version is accurate but always rounds down the least /* This MIPS version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("mult %2,%3" \ asm ("mult %2,%3" \
: "=l" (__lo), "=h" (__hi) \ : "=l" (__lo), "=h" (__hi) \
: "%r" (x), "r" (y)); \ : "%r" (x), "r" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# if 0 # if 0
/* assembler doesn't recognize this instruction? */ /* assembler doesn't recognize this instruction? */
# define FPM_MACC # define FPM_MACC
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
asm ("macc r0,%2,%3" \ asm ("macc r0,%2,%3" \
: "+l" (lo), "+h" (hi) \ : "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y)); : "%r" (x), "r" (y));
# endif # endif
# elif defined(FPM_SPARC) # elif defined(FPM_SPARC)
/* This SPARC V8 version is accurate but always rounds down the least /* This SPARC V8 version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("smul %2,%3,%0; rd %%y,%1" \ asm ("smul %2,%3,%0; rd %%y,%1" \
: "=r" (__lo), "=r" (__hi) \ : "=r" (__lo), "=r" (__hi) \
: "%r" (x), "rI" (y)); \ : "%r" (x), "rI" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# else # else
fixed_t f_mul(fixed_t, fixed_t); mad_fixed_t mad_f_mul(mad_fixed_t, mad_fixed_t);
# endif # endif
fixed_t f_abs(fixed_t);
# ifdef DEBUG # ifdef DEBUG
fixed_t f_tofixed(double); mad_fixed_t mad_f_abs(mad_fixed_t);
double f_todouble(fixed_t);
mad_fixed_t mad_f_tofixed(double);
double mad_f_todouble(mad_fixed_t);
# endif # endif
# endif # endif
 End of changes. 23 change blocks. 
42 lines changed or deleted 54 lines changed or added


 frame.h   frame.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: frame.h,v 1.4 2000/03/19 06:43:38 rob Exp $ * $Id: frame.h,v 1.5 2000/04/22 04:36:50 rob Exp $
*/ */
# ifndef FRAME_H # ifndef FRAME_H
# define FRAME_H # define FRAME_H
# include "fixed.h" # include "fixed.h"
# include "timer.h" # include "timer.h"
# include "stream.h" # include "stream.h"
struct mad_frame { struct mad_frame {
skipping to change at line 42 skipping to change at line 42
int mode_ext; /* additional mode info */ int mode_ext; /* additional mode info */
int emphasis; /* de-emphasis to use (see b elow) */ int emphasis; /* de-emphasis to use (see b elow) */
unsigned int bitrate; /* stream bitrate (bps) */ unsigned int bitrate; /* stream bitrate (bps) */
unsigned int sfreq; /* sampling frequency (Hz) */ unsigned int sfreq; /* sampling frequency (Hz) */
struct mad_timer duration; /* audio playing time of frame */ struct mad_timer duration; /* audio playing time of frame */
int flags; /* flags and private bits (below) */ int flags; /* flags and private bits (below) */
fixed_t sbsample[2][36][32]; /* synthesis subband filter samples mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples
*/ */
fixed_t (*overlap)[2][32][18]; /* layer III block overlap data */ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
}; };
# define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1) # define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1)
# define MAD_NUMSBSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36) # define MAD_NUMSBSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36)
# define MAD_MODE_SINGLE_CHANNEL 0 # define MAD_MODE_SINGLE_CHANNEL 0
# define MAD_MODE_DUAL_CHANNEL 1 # define MAD_MODE_DUAL_CHANNEL 1
# define MAD_MODE_JOINT_STEREO 2 # define MAD_MODE_JOINT_STEREO 2
# define MAD_MODE_STEREO 3 # define MAD_MODE_STEREO 3
# define MAD_EMPH_NONE 0 /* no emphasis */ # define MAD_EMPH_NONE 0 /* no emphasis */
# define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */ # define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */
# define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */ # define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */
# define MAD_FLAG_PROTECTION 0x0100 /* frame has CRC protection */ # define MAD_FLAG_PROTECTION 0x0100 /* frame has CRC protection */
# define MAD_FLAG_CRCFAILED 0x0200 /* frame CRC failed */ # define MAD_FLAG_COPYRIGHT 0x0200 /* frame is copyright */
# define MAD_FLAG_COPYRIGHT 0x0400 /* frame is copyright */ # define MAD_FLAG_ORIGINAL 0x0400 /* frame is original (else copy) */
# define MAD_FLAG_ORIGINAL 0x0800 /* frame is original (else copy) */ # define MAD_FLAG_PADDING 0x0800 /* frame has additional slot */
# define MAD_FLAG_PADDING 0x1000 /* frame has additional slot */
# define MAD_FLAG_I_STEREO 0x1000 /* uses intensity joint stereo */
# define MAD_FLAG_MS_STEREO 0x2000 /* uses middle/side joint stereo */
# define MAD_FLAG_PRIVATE 0x0040 /* header private bit */ # define MAD_FLAG_PRIVATE 0x0040 /* header private bit */
# define MAD_FLAG_III_PRIVATE 0x001f /* layer III private bits */ # define MAD_FLAG_III_PRIVATE 0x001f /* Layer III private bits */
# define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */ # define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */
void mad_frame_init(struct mad_frame *); void mad_frame_init(struct mad_frame *);
void mad_frame_finish(struct mad_frame *); void mad_frame_finish(struct mad_frame *);
void mad_frame_mute(struct mad_frame *); void mad_frame_mute(struct mad_frame *);
int mad_frame_header(struct mad_frame *, struct mad_stream *, int mad_frame_header(struct mad_frame *, struct mad_stream *,
unsigned short *); unsigned short *);
int mad_frame_decode(struct mad_frame *, struct mad_stream *); int mad_frame_decode(struct mad_frame *, struct mad_stream *);
 End of changes. 4 change blocks. 
9 lines changed or deleted 11 lines changed or added


 huffman.h   huffman.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: huffman.h,v 1.4 2000/03/19 06:43:38 rob Exp $ * $Id: huffman.h,v 1.5 2000/03/22 23:52:59 rob Exp $
*/ */
# ifndef HUFFMAN_H # ifndef HUFFMAN_H
# define HUFFMAN_H # define HUFFMAN_H
union huffquad { union huffquad {
struct { struct {
unsigned short final : 1; unsigned short final : 1;
unsigned short hlen : 3; unsigned short hlen : 3;
unsigned short v : 1; unsigned short v : 1;
unsigned short w : 1; unsigned short w : 1;
unsigned short x : 1; unsigned short x : 1;
unsigned short y : 1; unsigned short y : 1;
} value; } value;
struct { struct {
unsigned short final : 1; unsigned short final : 1;
unsigned short bits : 3; unsigned short bits : 3;
unsigned short offset : 12; unsigned short offset : 12;
} ptr; } ptr;
unsigned short final : 1; unsigned short final : 1;
}; };
union huffpair { union huffpair {
struct { struct {
unsigned short final : 1; unsigned short final : 1;
unsigned short hlen : 3; unsigned short hlen : 3;
unsigned short x : 4; unsigned short x : 4;
unsigned short y : 4; unsigned short y : 4;
} value; } value;
struct { struct {
unsigned short final : 1; unsigned short final : 1;
unsigned short bits : 3; unsigned short bits : 3;
unsigned short offset : 12; unsigned short offset : 12;
} ptr; } ptr;
unsigned short final : 1; unsigned short final : 1;
}; };
struct hufftable { struct hufftable {
union huffpair const *table; union huffpair const *table;
unsigned short linbits; unsigned short linbits;
unsigned short startbits; unsigned short startbits;
}; };
extern union huffquad const *const mad_huff_quad_table[2]; extern union huffquad const *const mad_huff_quad_table[2];
extern struct hufftable const mad_huff_pair_table[32]; extern struct hufftable const mad_huff_pair_table[32];
 End of changes. 7 change blocks. 
17 lines changed or deleted 17 lines changed or added


 libmad.h   libmad.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: version.h,v 1.12 2000/03/19 06:43:39 rob Exp * Id: version.h,v 1.13 2000/03/20 03:43:04 rob Exp
*/ */
# define MAD_VERSION "0.10.0 (beta)" # define MAD_VERSION "0.10.1 (beta)"
# define MAD_PUBLISHYEAR "2000" # define MAD_PUBLISHYEAR "2000"
# define MAD_AUTHOR "Robert Leslie" # define MAD_AUTHOR "Robert Leslie"
# define MAD_EMAIL "rob@mars.org" # define MAD_EMAIL "rob@mars.org"
extern char const mad_version[]; extern char const mad_version[];
extern char const mad_copyright[]; extern char const mad_copyright[];
extern char const mad_author[]; extern char const mad_author[];
extern char const mad_license[]; extern char const mad_license[];
/* /*
skipping to change at line 50 skipping to change at line 50
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: fixed.h,v 1.8 2000/03/08 14:01:11 rob Exp * Id: fixed.h,v 1.9 2000/04/22 04:36:50 rob Exp
*/ */
# ifndef FIXED_H # ifndef FIXED_H
# define FIXED_H # define FIXED_H
typedef signed long fixed_t; # if SIZEOF_INT >= 4
typedef signed int mad_fixed_t;
typedef signed long fixed64hi_t; typedef signed int mad_fixed64hi_t;
typedef unsigned long fixed64lo_t; typedef unsigned int mad_fixed64lo_t;
# else
typedef signed long mad_fixed_t;
typedef signed long mad_fixed64hi_t;
typedef unsigned long mad_fixed64lo_t;
# endif
/* /*
* Fixed-point format: 0xABBBBBBB * Fixed-point format: 0xABBBBBBB
* A == whole part (sign + 3 bits) * A == whole part (sign + 3 bits)
* B == fractional part (28 bits) * B == fractional part (28 bits)
* *
* Values are signed two's complement, so the effective range is: * Values are signed two's complement, so the effective range is:
* 0x80000000 to 0x7fffffff * 0x80000000 to 0x7fffffff
* -8.0 to +7.9999999962747097015380859375 * -8.0 to +7.9999999962747097015380859375
* *
* The smallest representable value is: * The smallest representable value is:
* 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.73e-9) * 0x00000001 == 0.0000000037252902984619140625 (i.e. about 3.73e-9)
* *
* 28 bits of fractional accuracy represent about * 28 bits of fractional accuracy represent about
* 8.6 digits of decimal accuracy. * 8.6 digits of decimal accuracy.
* *
* Fixed-point numbers can be added or subtracted as normal * Fixed-point numbers can be added or subtracted as normal
* integers, but multiplication requires shifting the 64-bit result * integers, but multiplication requires shifting the 64-bit result
* from 56 fractional bits back to 28 (and rounding.) * from 56 fractional bits back to 28 (and rounding.)
* *
* The CPU-specific versions of f_mul() perform rounding by truncation. * The CPU-specific versions of mad_f_mul() perform rounding by truncation.
*/ */
# define f_add(x, y) ((x) + (y)) # define MAD_F_MIN 0x80000000L
# define f_sub(x, y) ((x) - (y)) # define MAD_F_MAX 0x7fffffffL
# define f_scale64(hi, lo) ((fixed_t) (((fixed64hi_t) (hi) << 4) | \ # define mad_f_add(x, y) ((x) + (y))
((fixed64lo_t) (lo) >> 28))) # define mad_f_sub(x, y) ((x) - (y))
# define mad_f_scale64(hi, lo) ((mad_fixed_t) \
(((mad_fixed64hi_t) (hi) << 4) | \
((mad_fixed64lo_t) (lo) >> 28)))
# if defined(FPM_APPROX) # if defined(FPM_APPROX)
/* This version is the most portable but loses 14 bits of accuracy. */ /* This version is the most portable but loses 14 bits of accuracy. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) ((((x) + 0x00002000L) >> 14) * \ # define mad_f_mul(x, y) ((((x) + 0x00002000L) >> 14) * \
(((y) + 0x00002000L) >> 14)) (((y) + 0x00002000L) >> 14))
# elif defined(FPM_64BIT) # elif defined(FPM_64BIT)
/* This version should be the most accurate if 64-bit (long long) types /* This version should be the most accurate if 64-bit (long long) types
are supported by the compiler. */ are supported by the compiler. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
((fixed_t) (((((signed long long) (x) * (y)) + 0x08000000L) >> 28))) ((mad_fixed_t) (((((signed long long) (x) * (y)) + 0x08000000L) >> 28)
))
# elif defined(FPM_INTEL) # elif defined(FPM_INTEL)
/* This Intel version is accurate but always rounds down the least /* This Intel version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("imull %3" \ asm ("imull %3" \
: "=a" (__lo), "=d" (__hi) \ : "=a" (__lo), "=d" (__hi) \
: "%a" (x), "rm" (y)); \ : "%a" (x), "rm" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# if 0 # if 0
/* this is slower than the C multiply/add version */ /* this is slower than the C multiply/add version */
# define FPM_MACC # define FPM_MACC
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("imull %3" \ asm ("imull %3" \
: "=a" (__lo), "=d" (__hi) \ : "=a" (__lo), "=d" (__hi) \
: "%a" (x), "rm" (y)); \ : "%a" (x), "rm" (y)); \
asm ("add %2,%0" \ asm ("add %2,%0" \
: "=r,rm" (lo) \ : "=r,rm" (lo) \
: "%0,0" (lo), "rm,r" (__lo)); \ : "%0,0" (lo), "rm,r" (__lo)); \
asm ("adc %2,%0" \ asm ("adc %2,%0" \
: "=r,rm" (hi) \ : "=r,rm" (hi) \
: "%0,0" (hi), "rm,r" (__hi)); \ : "%0,0" (hi), "rm,r" (__hi)); \
}) })
# endif # endif
# elif defined(FPM_ARM) # elif defined(FPM_ARM)
/* This ARM V4 version is accurate but always rounds down the least /* This ARM V4 version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("smull %0,%1,%2,%3" \ asm ("smull %0,%1,%2,%3" \
: "=&r" (__lo), "=&r" (__hi) \ : "=&r" (__lo), "=&r" (__hi) \
: "%r" (x), "r" (y)); \ : "%r" (x), "r" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# if 0 # if 0
/* this is slower than explicit multiply/add */ /* this is slower than explicit multiply/add */
# define FPM_MACC # define FPM_MACC
# if 0 # if 0
/* this was for debugging only */ /* this was for debugging only */
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("smull %0,%1,%2,%3" \ asm ("smull %0,%1,%2,%3" \
: "=&r" (__lo), "=&r" (__hi) \ : "=&r" (__lo), "=&r" (__hi) \
: "%r" (x), "r" (y)); \ : "%r" (x), "r" (y)); \
asm ("adds %0,%2,%3; adc %1,%4,%5" \ asm ("adds %0,%2,%3; adc %1,%4,%5" \
: "=r" (lo), "=r" (hi) \ : "=r" (lo), "=r" (hi) \
: "%r" (lo), "r" (__lo), "%r" (hi), "r" (__hi) \ : "%r" (lo), "r" (__lo), "%r" (hi), "r" (__hi) \
: "cc"); \ : "cc"); \
}) })
# else # else
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
asm ("smlal %0,%1,%2,%3" \ asm ("smlal %0,%1,%2,%3" \
: "+r" (lo), "+r" (hi) \ : "+r" (lo), "+r" (hi) \
: "%r" (x), "r" (y)) : "%r" (x), "r" (y))
# endif # endif
# endif # endif
# elif defined(FPM_MIPS) # elif defined(FPM_MIPS)
/* This MIPS version is accurate but always rounds down the least /* This MIPS version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("mult %2,%3" \ asm ("mult %2,%3" \
: "=l" (__lo), "=h" (__hi) \ : "=l" (__lo), "=h" (__hi) \
: "%r" (x), "r" (y)); \ : "%r" (x), "r" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# if 0 # if 0
/* assembler doesn't recognize this instruction? */ /* assembler doesn't recognize this instruction? */
# define FPM_MACC # define FPM_MACC
# define f_macc(hi, lo, x, y) \ # define mad_f_macc(hi, lo, x, y) \
asm ("macc r0,%2,%3" \ asm ("macc r0,%2,%3" \
: "+l" (lo), "+h" (hi) \ : "+l" (lo), "+h" (hi) \
: "%r" (x), "r" (y)); : "%r" (x), "r" (y));
# endif # endif
# elif defined(FPM_SPARC) # elif defined(FPM_SPARC)
/* This SPARC V8 version is accurate but always rounds down the least /* This SPARC V8 version is accurate but always rounds down the least
significant bit. */ significant bit. */
# define FPM_MACRO # define FPM_MACRO
# define f_mul(x, y) \ # define mad_f_mul(x, y) \
({ fixed64hi_t __hi; \ ({ mad_fixed64hi_t __hi; \
fixed64lo_t __lo; \ mad_fixed64lo_t __lo; \
asm ("smul %2,%3,%0; rd %%y,%1" \ asm ("smul %2,%3,%0; rd %%y,%1" \
: "=r" (__lo), "=r" (__hi) \ : "=r" (__lo), "=r" (__hi) \
: "%r" (x), "rI" (y)); \ : "%r" (x), "rI" (y)); \
f_scale64(__hi, __lo); \ mad_f_scale64(__hi, __lo); \
}) })
# else # else
fixed_t f_mul(fixed_t, fixed_t); mad_fixed_t mad_f_mul(mad_fixed_t, mad_fixed_t);
# endif # endif
fixed_t f_abs(fixed_t);
# ifdef DEBUG # ifdef DEBUG
fixed_t f_tofixed(double); mad_fixed_t mad_f_abs(mad_fixed_t);
double f_todouble(fixed_t);
mad_fixed_t mad_f_tofixed(double);
double mad_f_todouble(mad_fixed_t);
# endif # endif
# endif # endif
/* /*
* mad - MPEG audio decoder * mad - MPEG audio decoder
* Copyright (C) 2000 Robert Leslie * Copyright (C) 2000 Robert Leslie
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
skipping to change at line 248 skipping to change at line 259
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: bit.h,v 1.6 2000/03/19 06:43:38 rob Exp * Id: bit.h,v 1.7 2000/03/22 23:52:59 rob Exp
*/ */
# ifndef BIT_H # ifndef BIT_H
# define BIT_H # define BIT_H
struct mad_bitptr { struct mad_bitptr {
unsigned char const *byte; unsigned char const *byte;
unsigned short cache; unsigned short cache;
unsigned short left; unsigned short left;
}; };
void mad_bit_init(struct mad_bitptr *, unsigned char const *); void mad_bit_init(struct mad_bitptr *, unsigned char const *);
# define mad_bit_finish(bitptr) /* nothing */ # define mad_bit_finish(bitptr) /* nothing */
unsigned int mad_bit_length(struct mad_bitptr const *, unsigned int mad_bit_length(struct mad_bitptr const *,
struct mad_bitptr const *); struct mad_bitptr const *);
# define mad_bit_left(bitptr) ((bitptr)->left) # define mad_bit_bitsleft(bitptr) ((bitptr)->left)
unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *); unsigned char const *mad_bit_nextbyte(struct mad_bitptr const *);
void mad_bit_skip(struct mad_bitptr *, unsigned int); void mad_bit_skip(struct mad_bitptr *, unsigned int);
unsigned long mad_bit_read(struct mad_bitptr *, unsigned int); unsigned long mad_bit_read(struct mad_bitptr *, unsigned int);
void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long); void mad_bit_write(struct mad_bitptr *, unsigned int, unsigned long);
unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short) ; unsigned short mad_bit_crc(struct mad_bitptr, unsigned int, unsigned short) ;
# endif # endif
skipping to change at line 344 skipping to change at line 355
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: stream.h,v 1.4 2000/03/19 06:43:38 rob Exp * Id: stream.h,v 1.6 2000/04/22 04:36:51 rob Exp
*/ */
# ifndef STREAM_H # ifndef STREAM_H
# define STREAM_H # define STREAM_H
struct mad_stream { struct mad_stream {
unsigned char const *buffer; /* input bitstream buffer */ unsigned char const *buffer; /* input bitstream buffer */
unsigned char const *bufend; /* end of buffer */ unsigned char const *bufend; /* end of buffer */
unsigned long skiplen; /* bytes to skip before next frame * / unsigned long skiplen; /* bytes to skip before next frame * /
int sync; /* stream sync found */ int sync; /* stream sync found */
unsigned int freerate; /* free bitrate (fixed) */ unsigned int freerate; /* free bitrate (fixed) */
unsigned char const *this_frame; /* start of current frame */ unsigned char const *this_frame; /* start of current frame */
unsigned char const *next_frame; /* start of next frame */ unsigned char const *next_frame; /* start of next frame */
struct mad_bitptr ptr; /* current processing bit pointer */ struct mad_bitptr ptr; /* current processing bit pointer */
struct mad_bitptr anc_ptr; /* ancillary bits pointer */ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
unsigned int anc_bitlen; /* number of ancillary bits */ unsigned int anc_bitlen; /* number of ancillary bits */
unsigned char (*main_data)[1935]; /* layer III main_data */ unsigned char (*main_data)[1935]; /* Layer III main_data */
unsigned int md_len; /* bytes in main_data */ unsigned int md_len; /* bytes in main_data */
int error; /* error code (see below) */ int error; /* error code (see below) */
}; };
# define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */ # define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */
# define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */ # define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */
# define MAD_ERR_NOMEM 0x0031 /* not enough memory */ # define MAD_ERR_NOMEM 0x0031 /* not enough memory */
# define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */ # define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */
# define MAD_ERR_BADID 0x0102 /* bad header ID field */ # define MAD_ERR_BADID 0x0102 /* bad header ID field */
# define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */ # define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */
# define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */ # define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */
# define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * / # define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * /
# define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */ # define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */
# define MAD_ERR_BADCRC 0x0201 /* CRC check failed */ # define MAD_ERR_BADCRC 0x0201 /* CRC check failed */
# define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */ # define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */
# define MAD_ERR_BADSCALEFACTOR 0x0221 /* bad scalefactor index */ # define MAD_ERR_BADSCALEFACTOR 0x0221 /* bad scalefactor index */
# define MAD_ERR_BADBIGVALUES 0x0231 /* bad big_values count */ # define MAD_ERR_BADFRAMELEN 0x0231 /* bad frame length */
# define MAD_ERR_BADBLOCKTYPE 0x0232 /* reserved block_type */ # define MAD_ERR_BADBIGVALUES 0x0232 /* bad big_values count */
# define MAD_ERR_BADDATAPTR 0x0233 /* bad main_data_begin pointer */ # define MAD_ERR_BADBLOCKTYPE 0x0233 /* reserved block_type */
# define MAD_ERR_BADDATALENGTH 0x0234 /* bad main data length */ # define MAD_ERR_BADDATAPTR 0x0234 /* bad main_data_begin pointer */
# define MAD_ERR_BADPART3LEN 0x0235 /* bad audio data length */ # define MAD_ERR_BADDATALEN 0x0235 /* bad main data length */
# define MAD_ERR_BADHUFFTABLE 0x0236 /* bad Huffman table select */ # define MAD_ERR_BADPART3LEN 0x0236 /* bad audio data length */
# define MAD_ERR_BADHUFFDATA 0x0237 /* Huffman data value out of range * # define MAD_ERR_BADHUFFTABLE 0x0237 /* bad Huffman table select */
/ # define MAD_ERR_BADHUFFDATA 0x0238 /* Huffman data value out of range *
# define MAD_ERR_BADSTEREO 0x0238 /* incompatible block_type for M/S * /
/ # define MAD_ERR_BADSTEREO 0x0239 /* incompatible block_type for M/S *
/
# define MAD_RECOVERABLE(error) ((error) & 0xff00) # define MAD_RECOVERABLE(error) ((error) & 0xff00)
void mad_stream_init(struct mad_stream *); void mad_stream_init(struct mad_stream *);
void mad_stream_finish(struct mad_stream *); void mad_stream_finish(struct mad_stream *);
void mad_stream_buffer(struct mad_stream *, void mad_stream_buffer(struct mad_stream *,
unsigned char const *, unsigned long); unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long); void mad_stream_skip(struct mad_stream *, unsigned long);
skipping to change at line 426 skipping to change at line 438
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: frame.h,v 1.4 2000/03/19 06:43:38 rob Exp * Id: frame.h,v 1.5 2000/04/22 04:36:50 rob Exp
*/ */
# ifndef FRAME_H # ifndef FRAME_H
# define FRAME_H # define FRAME_H
struct mad_frame { struct mad_frame {
int layer; /* audio layer (1, 2, or 3) */ int layer; /* audio layer (1, 2, or 3) */
int mode; /* channel mode (see below) */ int mode; /* channel mode (see below) */
int mode_ext; /* additional mode info */ int mode_ext; /* additional mode info */
int emphasis; /* de-emphasis to use (see b elow) */ int emphasis; /* de-emphasis to use (see b elow) */
unsigned int bitrate; /* stream bitrate (bps) */ unsigned int bitrate; /* stream bitrate (bps) */
unsigned int sfreq; /* sampling frequency (Hz) */ unsigned int sfreq; /* sampling frequency (Hz) */
struct mad_timer duration; /* audio playing time of frame */ struct mad_timer duration; /* audio playing time of frame */
int flags; /* flags and private bits (below) */ int flags; /* flags and private bits (below) */
fixed_t sbsample[2][36][32]; /* synthesis subband filter samples mad_fixed_t sbsample[2][36][32]; /* synthesis subband filter samples
*/ */
fixed_t (*overlap)[2][32][18]; /* layer III block overlap data */ mad_fixed_t (*overlap)[2][32][18]; /* Layer III block overlap data */
}; };
# define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1) # define MAD_NUMCHANNELS(frame) ((frame)->mode ? 2 : 1)
# define MAD_NUMSBSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36) # define MAD_NUMSBSAMPLES(frame) ((frame)->layer == 1 ? 12 : 36)
# define MAD_MODE_SINGLE_CHANNEL 0 # define MAD_MODE_SINGLE_CHANNEL 0
# define MAD_MODE_DUAL_CHANNEL 1 # define MAD_MODE_DUAL_CHANNEL 1
# define MAD_MODE_JOINT_STEREO 2 # define MAD_MODE_JOINT_STEREO 2
# define MAD_MODE_STEREO 3 # define MAD_MODE_STEREO 3
# define MAD_EMPH_NONE 0 /* no emphasis */ # define MAD_EMPH_NONE 0 /* no emphasis */
# define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */ # define MAD_EMPH_50_15_MS 1 /* 50/15 microseconds */
# define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */ # define MAD_EMPH_CCITT_J_17 3 /* CCITT J.17 */
# define MAD_FLAG_PROTECTION 0x0100 /* frame has CRC protection */ # define MAD_FLAG_PROTECTION 0x0100 /* frame has CRC protection */
# define MAD_FLAG_CRCFAILED 0x0200 /* frame CRC failed */ # define MAD_FLAG_COPYRIGHT 0x0200 /* frame is copyright */
# define MAD_FLAG_COPYRIGHT 0x0400 /* frame is copyright */ # define MAD_FLAG_ORIGINAL 0x0400 /* frame is original (else copy) */
# define MAD_FLAG_ORIGINAL 0x0800 /* frame is original (else copy) */ # define MAD_FLAG_PADDING 0x0800 /* frame has additional slot */
# define MAD_FLAG_PADDING 0x1000 /* frame has additional slot */
# define MAD_FLAG_I_STEREO 0x1000 /* uses intensity joint stereo */
# define MAD_FLAG_MS_STEREO 0x2000 /* uses middle/side joint stereo */
# define MAD_FLAG_PRIVATE 0x0040 /* header private bit */ # define MAD_FLAG_PRIVATE 0x0040 /* header private bit */
# define MAD_FLAG_III_PRIVATE 0x001f /* layer III private bits */ # define MAD_FLAG_III_PRIVATE 0x001f /* Layer III private bits */
# define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */ # define MAD_FLAG_III_5BITPRIV 0x0020 /* 5 bits in III private (else 3) */
void mad_frame_init(struct mad_frame *); void mad_frame_init(struct mad_frame *);
void mad_frame_finish(struct mad_frame *); void mad_frame_finish(struct mad_frame *);
void mad_frame_mute(struct mad_frame *); void mad_frame_mute(struct mad_frame *);
int mad_frame_header(struct mad_frame *, struct mad_stream *, int mad_frame_header(struct mad_frame *, struct mad_stream *,
unsigned short *); unsigned short *);
int mad_frame_decode(struct mad_frame *, struct mad_stream *); int mad_frame_decode(struct mad_frame *, struct mad_stream *);
skipping to change at line 500 skipping to change at line 514
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* Id: synth.h,v 1.5 2000/03/19 06:43:38 rob Exp * Id: synth.h,v 1.6 2000/04/22 04:36:51 rob Exp
*/ */
# ifndef SYNTH_H # ifndef SYNTH_H
# define SYNTH_H # define SYNTH_H
struct mad_synth { struct mad_synth {
fixed_t filterout[2][2][256]; /* polyphase filterbank outp uts */ mad_fixed_t filterout[2][2][256]; /* polyphase filterbank outputs */
unsigned short slot; /* current processing slot */ unsigned short slot; /* current processing slot */
unsigned short pcmlen; /* number of PCM samples */ unsigned short pcmlen; /* number of PCM samples */
fixed_t pcmout[2][1152]; /* PCM sample outputs */ mad_fixed_t pcmout[2][1152]; /* PCM sample outputs */
}; };
void mad_synth_init(struct mad_synth *); void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */ # define mad_synth_finish(synth) /* nothing */
void mad_synth_frame(struct mad_synth *, struct mad_frame const *); void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif # endif
 End of changes. 37 change blocks. 
70 lines changed or deleted 85 lines changed or added


 stream.h   stream.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: stream.h,v 1.4 2000/03/19 06:43:38 rob Exp $ * $Id: stream.h,v 1.6 2000/04/22 04:36:51 rob Exp $
*/ */
# ifndef STREAM_H # ifndef STREAM_H
# define STREAM_H # define STREAM_H
# include "bit.h" # include "bit.h"
struct mad_stream { struct mad_stream {
unsigned char const *buffer; /* input bitstream buffer */ unsigned char const *buffer; /* input bitstream buffer */
unsigned char const *bufend; /* end of buffer */ unsigned char const *bufend; /* end of buffer */
skipping to change at line 42 skipping to change at line 42
int sync; /* stream sync found */ int sync; /* stream sync found */
unsigned int freerate; /* free bitrate (fixed) */ unsigned int freerate; /* free bitrate (fixed) */
unsigned char const *this_frame; /* start of current frame */ unsigned char const *this_frame; /* start of current frame */
unsigned char const *next_frame; /* start of next frame */ unsigned char const *next_frame; /* start of next frame */
struct mad_bitptr ptr; /* current processing bit pointer */ struct mad_bitptr ptr; /* current processing bit pointer */
struct mad_bitptr anc_ptr; /* ancillary bits pointer */ struct mad_bitptr anc_ptr; /* ancillary bits pointer */
unsigned int anc_bitlen; /* number of ancillary bits */ unsigned int anc_bitlen; /* number of ancillary bits */
unsigned char (*main_data)[1935]; /* layer III main_data */ unsigned char (*main_data)[1935]; /* Layer III main_data */
unsigned int md_len; /* bytes in main_data */ unsigned int md_len; /* bytes in main_data */
int error; /* error code (see below) */ int error; /* error code (see below) */
}; };
# define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */ # define MAD_ERR_BUFLEN 0x0001 /* input buffer too small (o r EOF) */
# define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */ # define MAD_ERR_BUFPTR 0x0002 /* invalid (null) buffer poi nter */
# define MAD_ERR_NOMEM 0x0031 /* not enough memory */ # define MAD_ERR_NOMEM 0x0031 /* not enough memory */
# define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */ # define MAD_ERR_LOSTSYNC 0x0101 /* lost synchronization */
# define MAD_ERR_BADID 0x0102 /* bad header ID field */ # define MAD_ERR_BADID 0x0102 /* bad header ID field */
# define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */ # define MAD_ERR_BADLAYER 0x0103 /* reserved header layer value */
# define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */ # define MAD_ERR_BADBITRATE 0x0104 /* forbidden bitrate value */
# define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * / # define MAD_ERR_BADSAMPLEFREQ 0x0105 /* reserved sample frequency value * /
# define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */ # define MAD_ERR_BADEMPHASIS 0x0106 /* reserved emphasis value */
# define MAD_ERR_BADCRC 0x0201 /* CRC check failed */ # define MAD_ERR_BADCRC 0x0201 /* CRC check failed */
# define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */ # define MAD_ERR_BADBITALLOC 0x0211 /* forbidden bit allocation value */
# define MAD_ERR_BADSCALEFACTOR 0x0221 /* bad scalefactor index */ # define MAD_ERR_BADSCALEFACTOR 0x0221 /* bad scalefactor index */
# define MAD_ERR_BADBIGVALUES 0x0231 /* bad big_values count */ # define MAD_ERR_BADFRAMELEN 0x0231 /* bad frame length */
# define MAD_ERR_BADBLOCKTYPE 0x0232 /* reserved block_type */ # define MAD_ERR_BADBIGVALUES 0x0232 /* bad big_values count */
# define MAD_ERR_BADDATAPTR 0x0233 /* bad main_data_begin pointer */ # define MAD_ERR_BADBLOCKTYPE 0x0233 /* reserved block_type */
# define MAD_ERR_BADDATALENGTH 0x0234 /* bad main data length */ # define MAD_ERR_BADDATAPTR 0x0234 /* bad main_data_begin pointer */
# define MAD_ERR_BADPART3LEN 0x0235 /* bad audio data length */ # define MAD_ERR_BADDATALEN 0x0235 /* bad main data length */
# define MAD_ERR_BADHUFFTABLE 0x0236 /* bad Huffman table select */ # define MAD_ERR_BADPART3LEN 0x0236 /* bad audio data length */
# define MAD_ERR_BADHUFFDATA 0x0237 /* Huffman data value out of range * # define MAD_ERR_BADHUFFTABLE 0x0237 /* bad Huffman table select */
/ # define MAD_ERR_BADHUFFDATA 0x0238 /* Huffman data value out of range *
# define MAD_ERR_BADSTEREO 0x0238 /* incompatible block_type for M/S * /
/ # define MAD_ERR_BADSTEREO 0x0239 /* incompatible block_type for M/S *
/
# define MAD_RECOVERABLE(error) ((error) & 0xff00) # define MAD_RECOVERABLE(error) ((error) & 0xff00)
void mad_stream_init(struct mad_stream *); void mad_stream_init(struct mad_stream *);
void mad_stream_finish(struct mad_stream *); void mad_stream_finish(struct mad_stream *);
void mad_stream_buffer(struct mad_stream *, void mad_stream_buffer(struct mad_stream *,
unsigned char const *, unsigned long); unsigned char const *, unsigned long);
void mad_stream_skip(struct mad_stream *, unsigned long); void mad_stream_skip(struct mad_stream *, unsigned long);
 End of changes. 3 change blocks. 
12 lines changed or deleted 13 lines changed or added


 synth.h   synth.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: synth.h,v 1.5 2000/03/19 06:43:38 rob Exp $ * $Id: synth.h,v 1.6 2000/04/22 04:36:51 rob Exp $
*/ */
# ifndef SYNTH_H # ifndef SYNTH_H
# define SYNTH_H # define SYNTH_H
# include "fixed.h" # include "fixed.h"
# include "frame.h" # include "frame.h"
struct mad_synth { struct mad_synth {
fixed_t filterout[2][2][256]; /* polyphase filterbank outp uts */ mad_fixed_t filterout[2][2][256]; /* polyphase filterbank outputs */
unsigned short slot; /* current processing slot */ unsigned short slot; /* current processing slot */
unsigned short pcmlen; /* number of PCM samples */ unsigned short pcmlen; /* number of PCM samples */
fixed_t pcmout[2][1152]; /* PCM sample outputs */ mad_fixed_t pcmout[2][1152]; /* PCM sample outputs */
}; };
void mad_synth_init(struct mad_synth *); void mad_synth_init(struct mad_synth *);
# define mad_synth_finish(synth) /* nothing */ # define mad_synth_finish(synth) /* nothing */
void mad_synth_frame(struct mad_synth *, struct mad_frame const *); void mad_synth_frame(struct mad_synth *, struct mad_frame const *);
# endif # endif
 End of changes. 3 change blocks. 
3 lines changed or deleted 3 lines changed or added


 version.h   version.h 
skipping to change at line 19 skipping to change at line 19
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
* $Id: version.h,v 1.12 2000/03/19 06:43:39 rob Exp $ * $Id: version.h,v 1.13 2000/03/20 03:43:04 rob Exp $
*/ */
# define MAD_VERSION "0.10.0 (beta)" # define MAD_VERSION "0.10.1 (beta)"
# define MAD_PUBLISHYEAR "2000" # define MAD_PUBLISHYEAR "2000"
# define MAD_AUTHOR "Robert Leslie" # define MAD_AUTHOR "Robert Leslie"
# define MAD_EMAIL "rob@mars.org" # define MAD_EMAIL "rob@mars.org"
extern char const mad_version[]; extern char const mad_version[];
extern char const mad_copyright[]; extern char const mad_copyright[];
extern char const mad_author[]; extern char const mad_author[];
extern char const mad_license[]; extern char const mad_license[];
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/