mad.h | mad.h | |||
---|---|---|---|---|
/* | /* | |||
* libmad - MPEG audio decoder library | * libmad - MPEG audio decoder library | |||
* Copyright (C) 2000-2003 Underbit Technologies, Inc. | * Copyright (C) 2000-2004 Underbit Technologies, Inc. | |||
* | * | |||
* 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 | |||
* the Free Software Foundation; either version 2 of the License, or | * the Free Software Foundation; either version 2 of the License, or | |||
* (at your option) any later version. | * (at your option) any later version. | |||
* | * | |||
* 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. | |||
skipping to change at line 33 | skipping to change at line 33 | |||
# ifdef __cplusplus | # ifdef __cplusplus | |||
extern "C" { | extern "C" { | |||
# endif | # endif | |||
# define FPM_INTEL | # define FPM_INTEL | |||
# define SIZEOF_INT 4 | # define SIZEOF_INT 4 | |||
# define SIZEOF_LONG 4 | # define SIZEOF_LONG 4 | |||
# define SIZEOF_LONG_LONG 8 | # define SIZEOF_LONG_LONG 8 | |||
/* Id: version.h,v 1.24 2003/05/27 22:40:37 rob Exp */ | /* Id: version.h,v 1.26 2004/01/23 09:41:33 rob Exp */ | |||
# ifndef LIBMAD_VERSION_H | # ifndef LIBMAD_VERSION_H | |||
# define LIBMAD_VERSION_H | # define LIBMAD_VERSION_H | |||
# define MAD_VERSION_MAJOR 0 | # define MAD_VERSION_MAJOR 0 | |||
# define MAD_VERSION_MINOR 15 | # define MAD_VERSION_MINOR 15 | |||
# define MAD_VERSION_PATCH 0 | # define MAD_VERSION_PATCH 1 | |||
# define MAD_VERSION_EXTRA " (beta)" | # define MAD_VERSION_EXTRA " (beta)" | |||
# define MAD_VERSION_STRINGIZE(str) #str | # define MAD_VERSION_STRINGIZE(str) #str | |||
# define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) | # define MAD_VERSION_STRING(num) MAD_VERSION_STRINGIZE(num) | |||
# define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ | # define MAD_VERSION MAD_VERSION_STRING(MAD_VERSION_MAJOR) "." \ | |||
MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ | MAD_VERSION_STRING(MAD_VERSION_MINOR) "." \ | |||
MAD_VERSION_STRING(MAD_VERSION_PATCH) \ | MAD_VERSION_STRING(MAD_VERSION_PATCH) \ | |||
MAD_VERSION_EXTRA | MAD_VERSION_EXTRA | |||
# define MAD_PUBLISHYEAR "2000-2003" | # define MAD_PUBLISHYEAR "2000-2004" | |||
# define MAD_AUTHOR "Underbit Technologies, Inc." | # define MAD_AUTHOR "Underbit Technologies, Inc." | |||
# define MAD_EMAIL "info@underbit.com" | # define MAD_EMAIL "info@underbit.com" | |||
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_build[]; | extern char const mad_build[]; | |||
# endif | # endif | |||
/* Id: fixed.h,v 1.36 2003/05/28 04:36:00 rob Exp */ | /* Id: fixed.h,v 1.38 2004/02/17 02:02:03 rob Exp */ | |||
# ifndef LIBMAD_FIXED_H | # ifndef LIBMAD_FIXED_H | |||
# define LIBMAD_FIXED_H | # define LIBMAD_FIXED_H | |||
# if SIZEOF_INT >= 4 | # if SIZEOF_INT >= 4 | |||
typedef signed int mad_fixed_t; | typedef signed int mad_fixed_t; | |||
typedef signed int mad_fixed64hi_t; | typedef signed int mad_fixed64hi_t; | |||
typedef unsigned int mad_fixed64lo_t; | typedef unsigned int mad_fixed64lo_t; | |||
# else | # else | |||
skipping to change at line 253 | skipping to change at line 253 | |||
: "=rm" (__lo_), "=rm" (__hi_) \ | : "=rm" (__lo_), "=rm" (__hi_) \ | |||
: "0" (lo), "1" (hi), \ | : "0" (lo), "1" (hi), \ | |||
"ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | "ir" (1L << (MAD_F_SCALEBITS - 1)), "ir" (0) \ | |||
: "cc"); \ | : "cc"); \ | |||
asm ("shrdl %3,%2,%1" \ | asm ("shrdl %3,%2,%1" \ | |||
: "=rm" (__result) \ | : "=rm" (__result) \ | |||
: "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | : "0" (__lo_), "r" (__hi_), "I" (MAD_F_SCALEBITS) \ | |||
: "cc"); \ | : "cc"); \ | |||
__result; \ | __result; \ | |||
}) | }) | |||
# else | # elif defined(OPT_INTEL) | |||
/* | ||||
* Alternate Intel scaling that may or may not perform better. | ||||
*/ | ||||
# define mad_f_scale64(hi, lo) \ | ||||
({ mad_fixed_t __result; \ | ||||
asm ("shrl %3,%1\n\t" \ | ||||
"shll %4,%2\n\t" \ | ||||
"orl %2,%1" \ | ||||
: "=rm" (__result) \ | ||||
: "0" (lo), "r" (hi), \ | ||||
"I" (MAD_F_SCALEBITS), "I" (32 - MAD_F_SCALEBITS) \ | ||||
: "cc"); \ | ||||
__result; \ | ||||
}) | ||||
# else | ||||
# define mad_f_scale64(hi, lo) \ | # define mad_f_scale64(hi, lo) \ | |||
({ mad_fixed_t __result; \ | ({ mad_fixed_t __result; \ | |||
asm ("shrdl %3,%2,%1" \ | asm ("shrdl %3,%2,%1" \ | |||
: "=rm" (__result) \ | : "=rm" (__result) \ | |||
: "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | : "0" (lo), "r" (hi), "I" (MAD_F_SCALEBITS) \ | |||
: "cc"); \ | : "cc"); \ | |||
__result; \ | __result; \ | |||
}) | }) | |||
# endif /* OPT_ACCURACY */ | # endif /* OPT_ACCURACY */ | |||
skipping to change at line 528 | skipping to change at line 543 | |||
# define MAD_F_SCALEBITS MAD_F_FRACBITS | # define MAD_F_SCALEBITS MAD_F_FRACBITS | |||
# endif | # endif | |||
/* C routines */ | /* C routines */ | |||
mad_fixed_t mad_f_abs(mad_fixed_t); | mad_fixed_t mad_f_abs(mad_fixed_t); | |||
mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); | mad_fixed_t mad_f_div(mad_fixed_t, mad_fixed_t); | |||
# endif | # endif | |||
/* Id: bit.h,v 1.11 2003/05/27 22:40:36 rob Exp */ | /* Id: bit.h,v 1.12 2004/01/23 09:41:32 rob Exp */ | |||
# ifndef LIBMAD_BIT_H | # ifndef LIBMAD_BIT_H | |||
# define LIBMAD_BIT_H | # define LIBMAD_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; | |||
}; | }; | |||
skipping to change at line 557 | skipping to change at line 572 | |||
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 | |||
/* Id: timer.h,v 1.15 2003/05/27 22:40:37 rob Exp */ | /* Id: timer.h,v 1.16 2004/01/23 09:41:33 rob Exp */ | |||
# ifndef LIBMAD_TIMER_H | # ifndef LIBMAD_TIMER_H | |||
# define LIBMAD_TIMER_H | # define LIBMAD_TIMER_H | |||
typedef struct { | typedef struct { | |||
signed long seconds; /* whole seconds */ | signed long seconds; /* whole seconds */ | |||
unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ | unsigned long fraction; /* 1/MAD_TIMER_RESOLUTION seconds */ | |||
} mad_timer_t; | } mad_timer_t; | |||
extern mad_timer_t const mad_timer_zero; | extern mad_timer_t const mad_timer_zero; | |||
skipping to change at line 639 | skipping to change at line 654 | |||
void mad_timer_add(mad_timer_t *, mad_timer_t); | void mad_timer_add(mad_timer_t *, mad_timer_t); | |||
void mad_timer_multiply(mad_timer_t *, signed long); | void mad_timer_multiply(mad_timer_t *, signed long); | |||
signed long mad_timer_count(mad_timer_t, enum mad_units); | signed long mad_timer_count(mad_timer_t, enum mad_units); | |||
unsigned long mad_timer_fraction(mad_timer_t, unsigned long); | unsigned long mad_timer_fraction(mad_timer_t, unsigned long); | |||
void mad_timer_string(mad_timer_t, char *, char const *, | void mad_timer_string(mad_timer_t, char *, char const *, | |||
enum mad_units, enum mad_units, unsigned long); | enum mad_units, enum mad_units, unsigned long); | |||
# endif | # endif | |||
/* Id: stream.h,v 1.18 2003/05/27 22:40:37 rob Exp */ | /* Id: stream.h,v 1.20 2004/02/05 09:02:39 rob Exp */ | |||
# ifndef LIBMAD_STREAM_H | # ifndef LIBMAD_STREAM_H | |||
# define LIBMAD_STREAM_H | # define LIBMAD_STREAM_H | |||
# define MAD_BUFFER_GUARD 8 | # define MAD_BUFFER_GUARD 8 | |||
# define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) | # define MAD_BUFFER_MDLEN (511 + 2048 + MAD_BUFFER_GUARD) | |||
enum mad_error { | enum mad_error { | |||
MAD_ERROR_NONE = 0x0000, /* no error */ | MAD_ERROR_NONE = 0x0000, /* no error */ | |||
skipping to change at line 664 | skipping to change at line 679 | |||
MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ | MAD_ERROR_LOSTSYNC = 0x0101, /* lost synchronization */ | |||
MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ | MAD_ERROR_BADLAYER = 0x0102, /* reserved header layer value */ | |||
MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ | MAD_ERROR_BADBITRATE = 0x0103, /* forbidden bitrate value */ | |||
MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value * / | MAD_ERROR_BADSAMPLERATE = 0x0104, /* reserved sample frequency value * / | |||
MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value * / | MAD_ERROR_BADEMPHASIS = 0x0105, /* reserved emphasis value * / | |||
MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ | MAD_ERROR_BADCRC = 0x0201, /* CRC check failed */ | |||
MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ | MAD_ERROR_BADBITALLOC = 0x0211, /* forbidden bit allocation value */ | |||
MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ | MAD_ERROR_BADSCALEFACTOR = 0x0221, /* bad scalefactor index */ | |||
MAD_ERROR_BADMODE = 0x0222, /* bad bitrate/mode combination */ | ||||
MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ | MAD_ERROR_BADFRAMELEN = 0x0231, /* bad frame length */ | |||
MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ | MAD_ERROR_BADBIGVALUES = 0x0232, /* bad big_values count */ | |||
MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ | MAD_ERROR_BADBLOCKTYPE = 0x0233, /* reserved block_type */ | |||
MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ | MAD_ERROR_BADSCFSI = 0x0234, /* bad scalefactor selection info */ | |||
MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ | MAD_ERROR_BADDATAPTR = 0x0235, /* bad main_data_begin pointer */ | |||
MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ | MAD_ERROR_BADPART3LEN = 0x0236, /* bad audio data length */ | |||
MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ | MAD_ERROR_BADHUFFTABLE = 0x0237, /* bad Huffman table select */ | |||
MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ | MAD_ERROR_BADHUFFDATA = 0x0238, /* Huffman data overrun */ | |||
MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ | MAD_ERROR_BADSTEREO = 0x0239 /* incompatible block_type for JS */ | |||
}; | }; | |||
skipping to change at line 726 | skipping to change at line 742 | |||
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); | |||
int mad_stream_sync(struct mad_stream *); | int mad_stream_sync(struct mad_stream *); | |||
char const *mad_stream_errorstr(struct mad_stream const *); | char const *mad_stream_errorstr(struct mad_stream const *); | |||
# endif | # endif | |||
/* Id: frame.h,v 1.19 2003/05/27 22:40:36 rob Exp */ | /* Id: frame.h,v 1.20 2004/01/23 09:41:32 rob Exp */ | |||
# ifndef LIBMAD_FRAME_H | # ifndef LIBMAD_FRAME_H | |||
# define LIBMAD_FRAME_H | # define LIBMAD_FRAME_H | |||
enum mad_layer { | enum mad_layer { | |||
MAD_LAYER_I = 1, /* Layer I */ | MAD_LAYER_I = 1, /* Layer I */ | |||
MAD_LAYER_II = 2, /* Layer II */ | MAD_LAYER_II = 2, /* Layer II */ | |||
MAD_LAYER_III = 3 /* Layer III */ | MAD_LAYER_III = 3 /* Layer III */ | |||
}; | }; | |||
skipping to change at line 822 | skipping to change at line 838 | |||
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 *); | |||
int mad_frame_decode(struct mad_frame *, struct mad_stream *); | int mad_frame_decode(struct mad_frame *, struct mad_stream *); | |||
void mad_frame_mute(struct mad_frame *); | void mad_frame_mute(struct mad_frame *); | |||
# endif | # endif | |||
/* Id: synth.h,v 1.14 2003/05/27 22:40:37 rob Exp */ | /* Id: synth.h,v 1.15 2004/01/23 09:41:33 rob Exp */ | |||
# ifndef LIBMAD_SYNTH_H | # ifndef LIBMAD_SYNTH_H | |||
# define LIBMAD_SYNTH_H | # define LIBMAD_SYNTH_H | |||
struct mad_pcm { | struct mad_pcm { | |||
unsigned int samplerate; /* sampling frequency (Hz) */ | unsigned int samplerate; /* sampling frequency (Hz) */ | |||
unsigned short channels; /* number of channels */ | unsigned short channels; /* number of channels */ | |||
unsigned short length; /* number of samples per channel */ | unsigned short length; /* number of samples per channel */ | |||
mad_fixed_t samples[2][1152]; /* PCM output samples [ch][s ample] */ | mad_fixed_t samples[2][1152]; /* PCM output samples [ch][s ample] */ | |||
}; | }; | |||
skipping to change at line 870 | skipping to change at line 886 | |||
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_mute(struct mad_synth *); | void mad_synth_mute(struct mad_synth *); | |||
void mad_synth_frame(struct mad_synth *, struct mad_frame const *); | void mad_synth_frame(struct mad_synth *, struct mad_frame const *); | |||
# endif | # endif | |||
/* Id: decoder.h,v 1.16 2003/05/27 22:40:36 rob Exp */ | /* Id: decoder.h,v 1.17 2004/01/23 09:41:32 rob Exp */ | |||
# ifndef LIBMAD_DECODER_H | # ifndef LIBMAD_DECODER_H | |||
# define LIBMAD_DECODER_H | # define LIBMAD_DECODER_H | |||
enum mad_decoder_mode { | enum mad_decoder_mode { | |||
MAD_DECODER_MODE_SYNC = 0, | MAD_DECODER_MODE_SYNC = 0, | |||
MAD_DECODER_MODE_ASYNC | MAD_DECODER_MODE_ASYNC | |||
}; | }; | |||
enum mad_flow { | enum mad_flow { | |||
End of changes. 13 change blocks. | ||||
12 lines changed or deleted | 28 lines changed or added | |||