1 /* 2 * Copyright (C) 1999-2010 The L.A.M.E. project 3 * 4 * Initially written by Michael Hipp, see also AUTHORS and README. 5 * 6 * This library is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU Library General Public 8 * License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * This library is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 * Library General Public License for more details. 15 * 16 * You should have received a copy of the GNU Library General Public 17 * License along with this library; if not, write to the 18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 * Boston, MA 02111-1307, USA. 20 */ 21 #ifndef MPG123_H_INCLUDED 22 #define MPG123_H_INCLUDED 23 24 #include <stdio.h> 25 26 #ifdef STDC_HEADERS 27 # include <string.h> 28 #else 29 # ifndef HAVE_STRCHR 30 # define strchr index 31 # define strrchr rindex 32 # endif 33 char *strchr(), *strrchr(); 34 # ifndef HAVE_MEMCPY 35 # define memcpy(d, s, n) bcopy ((s), (d), (n)) 36 # define memmove(d, s, n) bcopy ((s), (d), (n)) 37 # endif 38 #endif 39 40 #include <signal.h> 41 42 43 #if defined(__riscos__) && defined(FPA10) 44 #include "ymath.h" 45 #else 46 #include <math.h> 47 #endif 48 49 #ifndef M_PI 50 #define M_PI 3.14159265358979323846 51 #endif 52 #ifndef M_SQRT2 53 #define M_SQRT2 1.41421356237309504880 54 #endif 55 56 #ifndef FALSE 57 #define FALSE 0 58 #endif 59 #ifndef TRUE 60 #define TRUE 1 61 #endif 62 63 #undef REAL_IS_FLOAT 64 #define REAL_IS_FLOAT 65 66 #ifdef REAL_IS_FLOAT 67 # define real float 68 #elif defined(REAL_IS_LONG_DOUBLE) 69 # define real long double 70 #else 71 # define real double 72 #endif 73 74 #define FALSE 0 75 #define TRUE 1 76 77 #define SBLIMIT 32 78 #define SSLIMIT 18 79 80 #define MPG_MD_STEREO 0 81 #define MPG_MD_JOINT_STEREO 1 82 #define MPG_MD_DUAL_CHANNEL 2 83 #define MPG_MD_MONO 3 84 85 #define MAXFRAMESIZE 2880 86 87 /* AF: ADDED FOR LAYER1/LAYER2 */ 88 #define SCALE_BLOCK 12 89 90 91 /* Pre Shift fo 16 to 8 bit converter table */ 92 #define AUSHIFT (3) 93 94 struct frame { 95 int stereo; 96 int single; /* single channel (monophonic) */ 97 int lsf; /* 0 = MPEG-1, 1 = MPEG-2/2.5 */ 98 int mpeg25; /* 1 = MPEG-2.5, 0 = MPEG-1/2 */ 99 int header_change; 100 int lay; /* Layer */ 101 int error_protection; /* 1 = CRC-16 code following header */ 102 int bitrate_index; 103 int sampling_frequency; /* sample rate of decompressed audio in Hz */ 104 int padding; 105 int extension; 106 int mode; 107 int mode_ext; 108 int copyright; 109 int original; 110 int emphasis; 111 int framesize; /* computed framesize */ 112 113 /* AF: ADDED FOR LAYER1/LAYER2 */ 114 int II_sblimit; 115 struct al_table2 const *alloc; 116 int down_sample_sblimit; 117 int down_sample; 118 119 120 }; 121 122 struct gr_info_s { 123 int scfsi; 124 unsigned part2_3_length; 125 unsigned big_values; 126 unsigned scalefac_compress; 127 unsigned block_type; 128 unsigned mixed_block_flag; 129 unsigned table_select[3]; 130 unsigned subblock_gain[3]; 131 unsigned maxband[3]; 132 unsigned maxbandl; 133 unsigned maxb; 134 unsigned region1start; 135 unsigned region2start; 136 unsigned preflag; 137 unsigned scalefac_scale; 138 unsigned count1table_select; 139 real *full_gain[3]; 140 real *pow2gain; 141 }; 142 143 struct III_sideinfo { 144 unsigned main_data_begin; 145 unsigned private_bits; 146 struct { 147 struct gr_info_s gr[2]; 148 } ch[2]; 149 }; 150 151 152 #endif 153