10 #ifndef MPG123_H_INTERN 11 #define MPG123_H_INTERN 13 #define MPG123_RATES 9 14 #define MPG123_ENCODINGS 12 22 #if defined(WIN32) && defined(DYNAMIC_BUILD) 23 #define BUILD_MPG123_DLL 31 # define M_PI 3.14159265358979323846 34 # define M_SQRT2 1.41421356237309504880 38 #define memmove(dst,src,size) bcopy(src,dst,size) 46 #elif defined(REAL_IS_FIXED) 49 # define dreal int64_t 55 #define PRECALC_TABLES 57 # define REAL_RADIX 24 58 # define REAL_FACTOR 16777216.0 60 static inline int32_t double_to_long_rounded(
double x,
double scalefac)
63 x += (
x > 0) ? 0.5 : -0.5;
76 # if defined(OPT_I386) 78 # define REAL_MUL_ASM(x, y, radix) \ 80 long _x=(x), _y=(y); \ 83 "shrdl %2, %%edx, %0 \n\t" \ 85 : "mr" (_y), "I" (radix) \ 91 # define REAL_MUL_SCALE_LAYER3_ASM(x, y, radix) \ 93 long _x=(x), _y=(y), _radix=(radix); \ 96 "shrdl %%cl, %%edx, %0 \n\t" \ 98 : "mr" (_y), "c" (_radix) \ 103 # elif defined(OPT_PPC) 105 # define REAL_MUL_ASM(x, y, radix) \ 107 long _x=(x), _y=(y), _mull, _mulh; \ 109 "mullw %0, %2, %3 \n\t" \ 110 "mulhw %1, %2, %3 \n\t" \ 111 "srwi %0, %0, %4 \n\t" \ 112 "rlwimi %0, %1, %5, 0, %6 \n\t" \ 113 : "=&r" (_mull), "=&r" (_mulh) \ 114 : "r" (_x), "r" (_y), "i" (radix), "i" (32-(radix)), "i" ((radix)-1) \ 119 # define REAL_MUL_SCALE_LAYER3_ASM(x, y, radix) \ 121 long _x=(x), _y=(y), _radix=(radix), _mull, _mulh, _radix2; \ 123 "mullw %0, %3, %4 \n\t" \ 124 "mulhw %1, %3, %4 \n\t" \ 125 "subfic %2, %5, 32 \n\t" \ 126 "srw %0, %0, %5 \n\t" \ 127 "slw %1, %1, %2 \n\t" \ 128 "or %0, %0, %1 \n\t" \ 129 : "=&r" (_mull), "=&r" (_mulh), "=&r" (_radix2) \ 130 : "r" (_x), "r" (_y), "r" (_radix) \ 135 # elif defined(OPT_ARM) 137 # define REAL_MUL_ASM(x, y, radix) \ 139 long _x=(x), _y=(y), _mull, _mulh; \ 141 "smull %0, %1, %2, %3 \n\t" \ 142 "mov %0, %0, lsr %4 \n\t" \ 143 "orr %0, %0, %1, lsl %5 \n\t" \ 144 : "=&r" (_mull), "=&r" (_mulh) \ 145 : "r" (_x), "r" (_y), "M" (radix), "M" (32-(radix)) \ 150 # define REAL_MUL_SCALE_LAYER3_ASM(x, y, radix) \ 152 long _x=(x), _y=(y), _radix=(radix), _mull, _mulh, _radix2; \ 154 "smull %0, %1, %3, %4 \n\t" \ 155 "mov %0, %0, lsr %5 \n\t" \ 156 "rsb %2, %5, #32 \n\t" \ 157 "mov %1, %1, lsl %2 \n\t" \ 158 "orr %0, %0, %1 \n\t" \ 159 : "=&r" (_mull), "=&r" (_mulh), "=&r" (_radix2) \ 160 : "r" (_x), "r" (_y), "r" (_radix) \ 168 # define DOUBLE_TO_REAL(x) (double_to_long_rounded(x, REAL_FACTOR)) 169 # define DOUBLE_TO_REAL_15(x) (double_to_long_rounded(x, 32768.0)) 170 # define DOUBLE_TO_REAL_POW43(x) (double_to_long_rounded(x, 8192.0)) 171 # define DOUBLE_TO_REAL_SCALE_LAYER12(x) (double_to_long_rounded(x, 1073741824.0)) 172 # define DOUBLE_TO_REAL_SCALE_LAYER3(x, y) (double_to_long_rounded(x, pow(2.0,gainpow2_scale[y]))) 173 # define REAL_TO_DOUBLE(x) ((double)(x) / REAL_FACTOR) 175 # define REAL_MUL(x, y) REAL_MUL_ASM(x, y, REAL_RADIX) 176 # define REAL_MUL_15(x, y) REAL_MUL_ASM(x, y, 15) 177 # define REAL_MUL_SCALE_LAYER12(x, y) REAL_MUL_ASM(x, y, 15 + 30 - REAL_RADIX) 179 # define REAL_MUL(x, y) (((dreal)(x) * (dreal)(y)) >> REAL_RADIX) 180 # define REAL_MUL_15(x, y) (((dreal)(x) * (dreal)(y)) >> 15) 181 # define REAL_MUL_SCALE_LAYER12(x, y) (((dreal)(x) * (dreal)(y)) >> (15 + 30 - REAL_RADIX)) 183 # ifdef REAL_MUL_SCALE_LAYER3_ASM 184 # define REAL_MUL_SCALE_LAYER3(x, y, z) REAL_MUL_SCALE_LAYER3_ASM(x, y, 13 + gainpow2_scale[z] - REAL_RADIX) 186 # define REAL_MUL_SCALE_LAYER3(x, y, z) (((dreal)(x) * (dreal)(y)) >> (13 + gainpow2_scale[z] - REAL_RADIX)) 188 # define REAL_SCALE_LAYER12(x) ((real)((x) >> (30 - REAL_RADIX))) 189 # define REAL_SCALE_LAYER3(x, y) ((real)((x) >> (gainpow2_scale[y] - REAL_RADIX))) 190 # ifdef ACCURATE_ROUNDING 191 # define REAL_MUL_SYNTH(x, y) REAL_MUL(x, y) 192 # define REAL_SCALE_DCT64(x) (x) 193 # define REAL_SCALE_WINDOW(x) (x) 195 # define REAL_MUL_SYNTH(x, y) ((x) * (y)) 196 # define REAL_SCALE_DCT64(x) ((x) >> 8) 197 # define REAL_SCALE_WINDOW(x) scale_rounded(x, 16) 203 # define REAL_IS_DOUBLE 207 #ifndef REAL_IS_FIXED 208 # if (defined SIZEOF_INT32_T) && (SIZEOF_INT32_T != 4) 209 # error "Bad 32bit types!!!" 213 #ifndef DOUBLE_TO_REAL 214 # define DOUBLE_TO_REAL(x) (real)(x) 216 #ifndef DOUBLE_TO_REAL_15 217 # define DOUBLE_TO_REAL_15(x) (real)(x) 219 #ifndef DOUBLE_TO_REAL_POW43 220 # define DOUBLE_TO_REAL_POW43(x) (real)(x) 222 #ifndef DOUBLE_TO_REAL_SCALE_LAYER12 223 # define DOUBLE_TO_REAL_SCALE_LAYER12(x) (real)(x) 225 #ifndef DOUBLE_TO_REAL_SCALE_LAYER3 226 # define DOUBLE_TO_REAL_SCALE_LAYER3(x, y) (real)(x) 228 #ifndef REAL_TO_DOUBLE 229 # define REAL_TO_DOUBLE(x) (x) 233 # define REAL_MUL(x, y) ((x) * (y)) 235 #ifndef REAL_MUL_SYNTH 236 # define REAL_MUL_SYNTH(x, y) ((x) * (y)) 239 # define REAL_MUL_15(x, y) ((x) * (y)) 241 #ifndef REAL_MUL_SCALE_LAYER12 242 # define REAL_MUL_SCALE_LAYER12(x, y) ((x) * (y)) 244 #ifndef REAL_MUL_SCALE_LAYER3 245 # define REAL_MUL_SCALE_LAYER3(x, y, z) ((x) * (y)) 247 #ifndef REAL_SCALE_LAYER12 248 # define REAL_SCALE_LAYER12(x) (x) 250 #ifndef REAL_SCALE_LAYER3 251 # define REAL_SCALE_LAYER3(x, y) (x) 253 #ifndef REAL_SCALE_DCT64 254 # define REAL_SCALE_DCT64(x) (x) 259 #define AUDIOBUFSIZE 2 263 #define MAX_NAME_SIZE 81 265 #define SCALE_BLOCK 12 269 #define MPG_MD_STEREO 0 270 #define MPG_MD_JOINT_STEREO 1 271 #define MPG_MD_DUAL_CHANNEL 2 272 #define MPG_MD_MONO 3 276 #define SHORT_SCALE 32768 279 #define S32_RESCALE 65536 290 #define NOQUIET (!(fr->p.flags & MPG123_QUIET)) 291 #define VERBOSE (NOQUIET && fr->p.verbose) 292 #define VERBOSE2 (NOQUIET && fr->p.verbose > 1) 293 #define VERBOSE3 (NOQUIET && fr->p.verbose > 2) 294 #define VERBOSE4 (NOQUIET && fr->p.verbose > 3) 295 #define PVERB(mp, level) (!((mp)->flags & MPG123_QUIET) && (mp)->verbose >= (level)) 310 #if defined (NETWORK) && !defined (WANT_WIN32_SOCKETS)
off_t decoder_synth_bytes(mpg123_handle *fr, off_t s)
off_t outblock_bytes(mpg123_handle *fr, off_t s)
GLint GLint GLint GLint GLint x
int open_fixed_post(mpg123_handle *mh, int channels, int encoding)
GLboolean GLboolean GLboolean b
off_t samples_to_bytes(mpg123_handle *fr, off_t s)
int open_fixed_pre(mpg123_handle *mh, int channels, int encoding)
int decode_update(mpg123_handle *mh)
off_t bytes_to_samples(mpg123_handle *fr, off_t b)
void postprocess_buffer(mpg123_handle *fr)