1159b3361Sopenharmony_ci/*
2159b3361Sopenharmony_ci * Copyright (C) 1999-2010 The L.A.M.E. project
3159b3361Sopenharmony_ci *
4159b3361Sopenharmony_ci * Initially written by Michael Hipp, see also AUTHORS and README.
5159b3361Sopenharmony_ci *
6159b3361Sopenharmony_ci * This library is free software; you can redistribute it and/or
7159b3361Sopenharmony_ci * modify it under the terms of the GNU Library General Public
8159b3361Sopenharmony_ci * License as published by the Free Software Foundation; either
9159b3361Sopenharmony_ci * version 2 of the License, or (at your option) any later version.
10159b3361Sopenharmony_ci *
11159b3361Sopenharmony_ci * This library is distributed in the hope that it will be useful,
12159b3361Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
13159b3361Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14159b3361Sopenharmony_ci * Library General Public License for more details.
15159b3361Sopenharmony_ci *
16159b3361Sopenharmony_ci * You should have received a copy of the GNU Library General Public
17159b3361Sopenharmony_ci * License along with this library; if not, write to the
18159b3361Sopenharmony_ci * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19159b3361Sopenharmony_ci * Boston, MA 02111-1307, USA.
20159b3361Sopenharmony_ci */
21159b3361Sopenharmony_ci#ifndef MPG123_H_INCLUDED
22159b3361Sopenharmony_ci#define MPG123_H_INCLUDED
23159b3361Sopenharmony_ci
24159b3361Sopenharmony_ci#include        <stdio.h>
25159b3361Sopenharmony_ci
26159b3361Sopenharmony_ci#ifdef STDC_HEADERS
27159b3361Sopenharmony_ci# include <string.h>
28159b3361Sopenharmony_ci#else
29159b3361Sopenharmony_ci# ifndef HAVE_STRCHR
30159b3361Sopenharmony_ci#  define strchr index
31159b3361Sopenharmony_ci#  define strrchr rindex
32159b3361Sopenharmony_ci# endif
33159b3361Sopenharmony_cichar   *strchr(), *strrchr();
34159b3361Sopenharmony_ci# ifndef HAVE_MEMCPY
35159b3361Sopenharmony_ci#  define memcpy(d, s, n) bcopy ((s), (d), (n))
36159b3361Sopenharmony_ci#  define memmove(d, s, n) bcopy ((s), (d), (n))
37159b3361Sopenharmony_ci# endif
38159b3361Sopenharmony_ci#endif
39159b3361Sopenharmony_ci
40159b3361Sopenharmony_ci#include        <signal.h>
41159b3361Sopenharmony_ci
42159b3361Sopenharmony_ci
43159b3361Sopenharmony_ci#if defined(__riscos__) && defined(FPA10)
44159b3361Sopenharmony_ci#include "ymath.h"
45159b3361Sopenharmony_ci#else
46159b3361Sopenharmony_ci#include <math.h>
47159b3361Sopenharmony_ci#endif
48159b3361Sopenharmony_ci
49159b3361Sopenharmony_ci#ifndef M_PI
50159b3361Sopenharmony_ci#define M_PI       3.14159265358979323846
51159b3361Sopenharmony_ci#endif
52159b3361Sopenharmony_ci#ifndef M_SQRT2
53159b3361Sopenharmony_ci#define M_SQRT2    1.41421356237309504880
54159b3361Sopenharmony_ci#endif
55159b3361Sopenharmony_ci
56159b3361Sopenharmony_ci#ifndef FALSE
57159b3361Sopenharmony_ci#define         FALSE                   0
58159b3361Sopenharmony_ci#endif
59159b3361Sopenharmony_ci#ifndef TRUE
60159b3361Sopenharmony_ci#define         TRUE                    1
61159b3361Sopenharmony_ci#endif
62159b3361Sopenharmony_ci
63159b3361Sopenharmony_ci#undef REAL_IS_FLOAT
64159b3361Sopenharmony_ci#define REAL_IS_FLOAT
65159b3361Sopenharmony_ci
66159b3361Sopenharmony_ci#ifdef REAL_IS_FLOAT
67159b3361Sopenharmony_ci#  define real float
68159b3361Sopenharmony_ci#elif defined(REAL_IS_LONG_DOUBLE)
69159b3361Sopenharmony_ci#  define real long double
70159b3361Sopenharmony_ci#else
71159b3361Sopenharmony_ci#  define real double
72159b3361Sopenharmony_ci#endif
73159b3361Sopenharmony_ci
74159b3361Sopenharmony_ci#define         FALSE                   0
75159b3361Sopenharmony_ci#define         TRUE                    1
76159b3361Sopenharmony_ci
77159b3361Sopenharmony_ci#define         SBLIMIT                 32
78159b3361Sopenharmony_ci#define         SSLIMIT                 18
79159b3361Sopenharmony_ci
80159b3361Sopenharmony_ci#define         MPG_MD_STEREO           0
81159b3361Sopenharmony_ci#define         MPG_MD_JOINT_STEREO     1
82159b3361Sopenharmony_ci#define         MPG_MD_DUAL_CHANNEL     2
83159b3361Sopenharmony_ci#define         MPG_MD_MONO             3
84159b3361Sopenharmony_ci
85159b3361Sopenharmony_ci#define MAXFRAMESIZE 2880
86159b3361Sopenharmony_ci
87159b3361Sopenharmony_ci/* AF: ADDED FOR LAYER1/LAYER2 */
88159b3361Sopenharmony_ci#define         SCALE_BLOCK             12
89159b3361Sopenharmony_ci
90159b3361Sopenharmony_ci
91159b3361Sopenharmony_ci/* Pre Shift fo 16 to 8 bit converter table */
92159b3361Sopenharmony_ci#define AUSHIFT (3)
93159b3361Sopenharmony_ci
94159b3361Sopenharmony_cistruct frame {
95159b3361Sopenharmony_ci    int     stereo;
96159b3361Sopenharmony_ci    int     single;          /* single channel (monophonic) */
97159b3361Sopenharmony_ci    int     lsf;             /* 0 = MPEG-1, 1 = MPEG-2/2.5 */
98159b3361Sopenharmony_ci    int     mpeg25;          /* 1 = MPEG-2.5, 0 = MPEG-1/2 */
99159b3361Sopenharmony_ci    int     header_change;
100159b3361Sopenharmony_ci    int     lay;             /* Layer */
101159b3361Sopenharmony_ci    int     error_protection; /* 1 = CRC-16 code following header */
102159b3361Sopenharmony_ci    int     bitrate_index;
103159b3361Sopenharmony_ci    int     sampling_frequency; /* sample rate of decompressed audio in Hz */
104159b3361Sopenharmony_ci    int     padding;
105159b3361Sopenharmony_ci    int     extension;
106159b3361Sopenharmony_ci    int     mode;
107159b3361Sopenharmony_ci    int     mode_ext;
108159b3361Sopenharmony_ci    int     copyright;
109159b3361Sopenharmony_ci    int     original;
110159b3361Sopenharmony_ci    int     emphasis;
111159b3361Sopenharmony_ci    int     framesize;       /* computed framesize */
112159b3361Sopenharmony_ci
113159b3361Sopenharmony_ci    /* AF: ADDED FOR LAYER1/LAYER2 */
114159b3361Sopenharmony_ci    int     II_sblimit;
115159b3361Sopenharmony_ci    struct al_table2 const *alloc;
116159b3361Sopenharmony_ci    int     down_sample_sblimit;
117159b3361Sopenharmony_ci    int     down_sample;
118159b3361Sopenharmony_ci
119159b3361Sopenharmony_ci
120159b3361Sopenharmony_ci};
121159b3361Sopenharmony_ci
122159b3361Sopenharmony_cistruct gr_info_s {
123159b3361Sopenharmony_ci    int     scfsi;
124159b3361Sopenharmony_ci    unsigned part2_3_length;
125159b3361Sopenharmony_ci    unsigned big_values;
126159b3361Sopenharmony_ci    unsigned scalefac_compress;
127159b3361Sopenharmony_ci    unsigned block_type;
128159b3361Sopenharmony_ci    unsigned mixed_block_flag;
129159b3361Sopenharmony_ci    unsigned table_select[3];
130159b3361Sopenharmony_ci    unsigned subblock_gain[3];
131159b3361Sopenharmony_ci    unsigned maxband[3];
132159b3361Sopenharmony_ci    unsigned maxbandl;
133159b3361Sopenharmony_ci    unsigned maxb;
134159b3361Sopenharmony_ci    unsigned region1start;
135159b3361Sopenharmony_ci    unsigned region2start;
136159b3361Sopenharmony_ci    unsigned preflag;
137159b3361Sopenharmony_ci    unsigned scalefac_scale;
138159b3361Sopenharmony_ci    unsigned count1table_select;
139159b3361Sopenharmony_ci    real   *full_gain[3];
140159b3361Sopenharmony_ci    real   *pow2gain;
141159b3361Sopenharmony_ci};
142159b3361Sopenharmony_ci
143159b3361Sopenharmony_cistruct III_sideinfo {
144159b3361Sopenharmony_ci    unsigned main_data_begin;
145159b3361Sopenharmony_ci    unsigned private_bits;
146159b3361Sopenharmony_ci    struct {
147159b3361Sopenharmony_ci        struct gr_info_s gr[2];
148159b3361Sopenharmony_ci    } ch[2];
149159b3361Sopenharmony_ci};
150159b3361Sopenharmony_ci
151159b3361Sopenharmony_ci
152159b3361Sopenharmony_ci#endif
153