ReactOS  0.4.14-dev-358-gbef841c
decode.h
Go to the documentation of this file.
1 /*
2  decode.h: common definitions for decode functions
3 
4  This file is strongly tied with optimize.h concerning the synth functions.
5  Perhaps one should restructure that a bit.
6 
7  copyright 2007-8 by the mpg123 project - free software under the terms of the LGPL 2.1
8  see COPYING and AUTHORS files in distribution or http://mpg123.org
9  initially written by Thomas Orgis, taking WRITE_SAMPLE from decode.c
10 */
11 #ifndef MPG123_DECODE_H
12 #define MPG123_DECODE_H
13 
14 /* Selection of class of output routines for basic format. */
15 #ifndef REAL_IS_FIXED
16 #define OUT_FORMATS 4 /* Basic output formats: 16bit, 8bit, real and s32 */
17 #else
18 #define OUT_FORMATS 2 /* Only up to 16bit */
19 #endif
20 
21 #define OUT_16 0
22 #define OUT_8 1
23 /* Those are defined but not supported for fixed point decoding! */
24 #define OUT_REAL 2 /* Write a floating point sample (that is, one matching the internal real type). */
25 #define OUT_S32 3
26 
27 #ifdef NO_NTOM
28 #define NTOM_MAX 1
29 #else
30 #define NTOM_MAX 8 /* maximum allowed factor for upsampling */
31 #define NTOM_MAX_FREQ 96000 /* maximum frequency to upsample to / downsample from */
32 #define NTOM_MUL (32768)
34 #endif
35 
36 /* Let's collect all possible synth functions here, for an overview.
37  If they are actually defined and used depends on preprocessor machinery.
38  See synth.c and optimize.h for that, also some special C and assembler files. */
39 
40 #ifndef NO_16BIT
41 /* The signed-16bit-producing variants. */
42 int synth_1to1 (real*, int, mpg123_handle*, int);
43 int synth_1to1_dither (real*, int, mpg123_handle*, int);
44 int synth_1to1_i386 (real*, int, mpg123_handle*, int);
45 int synth_1to1_i586 (real*, int, mpg123_handle*, int);
46 int synth_1to1_i586_dither(real*, int, mpg123_handle*, int);
47 int synth_1to1_mmx (real*, int, mpg123_handle*, int);
48 int synth_1to1_3dnow (real*, int, mpg123_handle*, int);
49 int synth_1to1_sse (real*, int, mpg123_handle*, int);
51 int synth_1to1_3dnowext (real*, int, mpg123_handle*, int);
52 int synth_1to1_altivec (real*, int, mpg123_handle*, int);
54 int synth_1to1_x86_64 (real*, int, mpg123_handle*, int);
56 int synth_1to1_avx (real*, int, mpg123_handle*, int);
58 int synth_1to1_arm (real*, int, mpg123_handle*, int);
59 int synth_1to1_neon (real*, int, mpg123_handle*, int);
61 int synth_1to1_neon64 (real*, int, mpg123_handle*, int);
63 /* This is different, special usage in layer3.c only.
64  Hence, the name... and now forget about it.
65  Never use it outside that special portion of code inside layer3.c! */
66 int absynth_1to1_i486(real*, int, mpg123_handle*, int);
67 /* These mono/stereo converters use one of the above for the grunt work. */
70 
71 /* Sample rate decimation comes in less flavours. */
72 #ifndef NO_DOWNSAMPLE
73 int synth_2to1 (real*, int, mpg123_handle*, int);
74 int synth_2to1_dither (real*, int, mpg123_handle*, int);
75 int synth_2to1_i386 (real*, int, mpg123_handle*, int);
78 int synth_4to1 (real *,int, mpg123_handle*, int);
79 int synth_4to1_dither (real *,int, mpg123_handle*, int);
80 int synth_4to1_i386 (real*, int, mpg123_handle*, int);
83 #endif
84 #ifndef NO_NTOM
85 /* NtoM is really just one implementation. */
86 int synth_ntom (real *,int, mpg123_handle*, int);
89 #endif
90 #endif
91 
92 #ifndef NO_8BIT
93 /* The 8bit-producing variants. */
94 /* There are direct 8-bit synths and wrappers over a possibly optimized 16bit one. */
95 int synth_1to1_8bit (real*, int, mpg123_handle*, int);
96 int synth_1to1_8bit_i386 (real*, int, mpg123_handle*, int);
97 #ifndef NO_16BIT
98 int synth_1to1_8bit_wrap (real*, int, mpg123_handle*, int);
100 #endif
102 #ifndef NO_16BIT
105 #endif
106 #ifndef NO_DOWNSAMPLE
107 int synth_2to1_8bit (real*, int, mpg123_handle*, int);
108 int synth_2to1_8bit_i386 (real*, int, mpg123_handle*, int);
111 int synth_4to1_8bit (real*, int, mpg123_handle*, int);
112 int synth_4to1_8bit_i386 (real*, int, mpg123_handle*, int);
115 #endif
116 #ifndef NO_NTOM
117 int synth_ntom_8bit (real*, int, mpg123_handle*, int);
120 #endif
121 #endif
122 
123 #ifndef REAL_IS_FIXED
124 
125 #ifndef NO_REAL
126 /* The real-producing variants. */
127 int synth_1to1_real (real*, int, mpg123_handle*, int);
128 int synth_1to1_real_i386 (real*, int, mpg123_handle*, int);
129 int synth_1to1_real_sse (real*, int, mpg123_handle*, int);
131 int synth_1to1_real_x86_64 (real*, int, mpg123_handle*, int);
133 int synth_1to1_real_avx (real*, int, mpg123_handle*, int);
135 int synth_1to1_real_altivec (real*, int, mpg123_handle*, int);
137 int synth_1to1_real_neon (real*, int, mpg123_handle*, int);
139 int synth_1to1_real_neon64 (real*, int, mpg123_handle*, int);
143 #ifndef NO_DOWNSAMPLE
144 int synth_2to1_real (real*, int, mpg123_handle*, int);
145 int synth_2to1_real_i386 (real*, int, mpg123_handle*, int);
148 int synth_4to1_real (real*, int, mpg123_handle*, int);
149 int synth_4to1_real_i386 (real*, int, mpg123_handle*, int);
152 #endif
153 #ifndef NO_NTOM
154 int synth_ntom_real (real*, int, mpg123_handle*, int);
157 #endif
158 #endif
159 
160 #ifndef NO_32BIT
161 /* 32bit integer */
162 int synth_1to1_s32 (real*, int, mpg123_handle*, int);
163 int synth_1to1_s32_i386 (real*, int, mpg123_handle*, int);
164 int synth_1to1_s32_sse (real*, int, mpg123_handle*, int);
166 int synth_1to1_s32_x86_64 (real*, int, mpg123_handle*, int);
168 int synth_1to1_s32_avx (real*, int, mpg123_handle*, int);
170 int synth_1to1_s32_altivec (real*, int, mpg123_handle*, int);
172 int synth_1to1_s32_neon (real*, int, mpg123_handle*, int);
174 int synth_1to1_s32_neon64 (real*, int, mpg123_handle*, int);
178 #ifndef NO_DOWNSAMPLE
179 int synth_2to1_s32 (real*, int, mpg123_handle*, int);
180 int synth_2to1_s32_i386 (real*, int, mpg123_handle*, int);
183 int synth_4to1_s32 (real*, int, mpg123_handle*, int);
184 int synth_4to1_s32_i386 (real*, int, mpg123_handle*, int);
187 #endif
188 #ifndef NO_NTOM
189 int synth_ntom_s32 (real*, int, mpg123_handle*, int);
192 #endif
193 #endif
194 
195 #endif /* FIXED */
196 
197 
198 /* Inside these synth functions, some dct64 variants may be used.
199  The special optimized ones that only appear in assembler code are not mentioned here.
200  And, generally, these functions are only employed in a matching synth function. */
201 void dct64 (real *,real *,real *);
202 void dct64_i386 (real *,real *,real *);
203 void dct64_altivec(real *,real *,real *);
204 void dct64_i486(int*, int* , real*); /* Yeah, of no use outside of synth_i486.c .*/
205 
206 /* This is used by the layer 3 decoder, one generic function and 3DNow variants. */
207 void dct36 (real *,real *,real *,real *,real *);
208 void dct36_3dnow (real *,real *,real *,real *,real *);
209 void dct36_3dnowext(real *,real *,real *,real *,real *);
210 void dct36_x86_64 (real *,real *,real *,real *,real *);
211 void dct36_sse (real *,real *,real *,real *,real *);
212 void dct36_avx (real *,real *,real *,real *,real *);
213 void dct36_neon (real *,real *,real *,real *,real *);
214 void dct36_neon64 (real *,real *,real *,real *,real *);
215 
216 /* Tools for NtoM resampling synth, defined in ntom.c . */
217 int synth_ntom_set_step(mpg123_handle *fr); /* prepare ntom decoding */
218 unsigned long ntom_val(mpg123_handle *fr, off_t frame); /* compute ntom_val for frame offset */
219 /* Frame and sample offsets. */
220 #ifndef NO_NTOM
221 /*
222  Outsamples of _this_ frame.
223  To be exact: The samples to be expected from the next frame decode (using the current ntom_val). When you already decoded _this_ frame, this is the number of samples to be expected from the next one.
224 */
226 /* Total out/insample offset. */
230 #endif
231 
232 /* Initialization of any static data that majy be needed at runtime.
233  Make sure you call these once before it is too late. */
234 #ifndef NO_LAYER3
235 void init_layer3(void);
237 void init_layer3_stuff(mpg123_handle *fr, real (*gainpow2)(mpg123_handle *fr, int i));
238 #endif
239 #ifndef NO_LAYER12
240 void init_layer12(void);
242 void init_layer12_stuff(mpg123_handle *fr, real* (*init_table)(mpg123_handle *fr, real *table, int m));
243 #endif
244 
245 void prepare_decode_tables(void);
246 
247 extern real *pnts[5]; /* tabinit provides, dct64 needs */
248 
249 /* Runtime (re)init functions; needed more often. */
250 void make_decode_tables(mpg123_handle *fr); /* For every volume change. */
251 /* Stuff needed after updating synth setup (see set_synth_functions()). */
252 
253 #ifdef OPT_MMXORSSE
254 /* Special treatment for mmx-like decoders, these functions go into the slots below. */
256 #ifndef NO_LAYER3
258 #endif
259 #ifndef NO_LAYER12
261 #endif
262 #endif
263 
264 #ifndef NO_8BIT
265 /* Needed when switching to 8bit output. */
267 #endif
268 
269 /* These are the actual workers.
270  They operate on the parsed frame data and handle decompression to audio samples.
271  The synth functions defined above are called from inside the layer handlers. */
272 
273 #ifndef NO_LAYER3
274 int do_layer3(mpg123_handle *fr);
275 #endif
276 #ifndef NO_LAYER2
277 int do_layer2(mpg123_handle *fr);
278 #endif
279 #ifndef NO_LAYER1
280 int do_layer1(mpg123_handle *fr);
281 #endif
282 /* There's an 3DNow counterpart in asm. */
283 void do_equalizer(real *bandPtr,int channel, real equalizer[2][32]);
284 
285 #endif
int synth_1to1_fltst_neon64(real *, real *, mpg123_handle *)
int synth_2to1_s32(real *, int, mpg123_handle *, int)
int synth_1to1_s32_sse(real *, int, mpg123_handle *, int)
int synth_1to1_8bit_mono(real *, mpg123_handle *)
int synth_1to1_s32_i386(real *, int, mpg123_handle *, int)
void do_equalizer(real *bandPtr, int channel, real equalizer[2][32])
Definition: equalizer.c:12
real init_layer3_gainpow2(mpg123_handle *fr, int i)
Definition: layer3.c:172
int synth_1to1_real_stereo_neon(real *, real *, mpg123_handle *)
off_t ntom_frameoff(mpg123_handle *fr, off_t soff)
Definition: ntom.c:130
int synth_4to1(real *, int, mpg123_handle *, int)
int synth_4to1_s32_mono(real *, mpg123_handle *)
int synth_ntom_real_m2s(real *, mpg123_handle *)
int synth_1to1_stereo_neon64(real *, real *, mpg123_handle *)
int synth_4to1_i386(real *, int, mpg123_handle *, int)
int synth_1to1_i586_dither(real *, int, mpg123_handle *, int)
int synth_1to1_stereo_x86_64(real *, real *, mpg123_handle *)
int synth_1to1_s32_stereo_neon(real *, real *, mpg123_handle *)
void dct36_neon64(real *, real *, real *, real *, real *)
#define init_layer12_table_mmx
Definition: intsym.h:159
int synth_1to1_s32_stereo_sse(real *, real *, mpg123_handle *)
void dct36(real *, real *, real *, real *, real *)
Definition: layer3.c:1504
int synth_1to1_real_i386(real *, int, mpg123_handle *, int)
int synth_4to1_real_m2s(real *, mpg123_handle *)
int synth_1to1_i586(real *, int, mpg123_handle *, int)
void dct36_3dnow(real *, real *, real *, real *, real *)
int synth_1to1_i386(real *, int, mpg123_handle *, int)
__kernel_off_t off_t
Definition: linux.h:201
int synth_1to1_s32_mono(real *, mpg123_handle *)
int synth_1to1_stereo_neon(real *, real *, mpg123_handle *)
int synth_2to1_mono(real *, mpg123_handle *)
int synth_4to1_dither(real *, int, mpg123_handle *, int)
int do_layer2(mpg123_handle *fr)
Definition: layer2.c:329
int synth_ntom_8bit_mono(real *, mpg123_handle *)
_Tp _STLP_CALL real(const complex< _Tp > &__z)
Definition: _complex.h:727
int synth_1to1_8bit_wrap_m2s(real *, mpg123_handle *)
int do_layer1(mpg123_handle *fr)
Definition: layer1.c:158
int synth_4to1_8bit_i386(real *, int, mpg123_handle *, int)
int synth_1to1_s32_x86_64(real *, int, mpg123_handle *, int)
real * init_layer12_table(mpg123_handle *fr, real *table, int m)
Definition: layer2.c:78
int synth_1to1_avx(real *, int, mpg123_handle *, int)
int synth_ntom_real(real *, int, mpg123_handle *, int)
int synth_1to1_mmx(real *, int, mpg123_handle *, int)
int synth_ntom_s32(real *, int, mpg123_handle *, int)
int synth_1to1_stereo_sse(real *, real *, mpg123_handle *)
int synth_4to1_s32_i386(real *, int, mpg123_handle *, int)
int synth_2to1_i386(real *, int, mpg123_handle *, int)
int synth_1to1_sse(real *, int, mpg123_handle *, int)
const GLfloat * m
Definition: glext.h:10848
void ntom_set_ntom(mpg123_handle *fr, off_t num)
Definition: ntom.c:66
void init_layer12_stuff(mpg123_handle *fr, real *(*init_table)(mpg123_handle *fr, real *table, int m))
Definition: layer2.c:67
int synth_1to1_fltst_avx(real *, real *, mpg123_handle *)
void init_layer3_stuff(mpg123_handle *fr, real(*gainpow2)(mpg123_handle *fr, int i))
Definition: layer3.c:376
int synth_ntom_s32_m2s(real *, mpg123_handle *)
int synth_1to1_fltst_altivec(real *, real *, mpg123_handle *)
int synth_1to1_s32(real *, int, mpg123_handle *, int)
void init_layer12(void)
Definition: layer2.c:39
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
int synth_1to1_s32_altivec(real *, int, mpg123_handle *, int)
void dct36_x86_64(real *, real *, real *, real *, real *)
void dct64_altivec(real *, real *, real *)
Definition: dct64_altivec.c:27
int synth_2to1_8bit_i386(real *, int, mpg123_handle *, int)
int synth_1to1_dither(real *, int, mpg123_handle *, int)
int synth_1to1_8bit_m2s(real *, mpg123_handle *)
int synth_4to1_real_mono(real *, mpg123_handle *)
int synth_1to1_real_stereo_x86_64(real *, real *, mpg123_handle *)
int synth_4to1_real_i386(real *, int, mpg123_handle *, int)
int synth_ntom_m2s(real *, mpg123_handle *)
void dct36_3dnowext(real *, real *, real *, real *, real *)
int synth_2to1(real *, int, mpg123_handle *, int)
int synth_1to1_s32st_neon64(real *, real *, mpg123_handle *)
int make_conv16to8_table(mpg123_handle *fr)
Definition: tabinit.c:277
int synth_4to1_s32_m2s(real *, mpg123_handle *)
int synth_1to1_s32_stereo_x86_64(real *, real *, mpg123_handle *)
int synth_2to1_8bit_mono(real *, mpg123_handle *)
int synth_1to1_s32_neon64(real *, int, mpg123_handle *, int)
int synth_1to1_real_neon(real *, int, mpg123_handle *, int)
int synth_ntom_real_mono(real *, mpg123_handle *)
int synth_2to1_8bit(real *, int, mpg123_handle *, int)
int synth_2to1_real_i386(real *, int, mpg123_handle *, int)
void dct36_neon(real *, real *, real *, real *, real *)
int synth_ntom_8bit_m2s(real *, mpg123_handle *)
int synth_4to1_mono(real *, mpg123_handle *)
int synth_1to1_s32_m2s(real *, mpg123_handle *)
int synth_1to1_real_m2s(real *, mpg123_handle *)
int synth_1to1_3dnowext(real *, int, mpg123_handle *, int)
int synth_4to1_8bit_m2s(real *, mpg123_handle *)
int synth_2to1_s32_mono(real *, mpg123_handle *)
int synth_1to1_real(real *, int, mpg123_handle *, int)
int synth_1to1_8bit_i386(real *, int, mpg123_handle *, int)
GLuint GLuint num
Definition: glext.h:9618
unsigned long ntom_val(mpg123_handle *fr, off_t frame)
Definition: ntom.c:46
int synth_ntom_mono(real *, mpg123_handle *)
void dct36_avx(real *, real *, real *, real *, real *)
int synth_2to1_s32_m2s(real *, mpg123_handle *)
int synth_ntom_s32_mono(real *, mpg123_handle *)
int synth_4to1_8bit(real *, int, mpg123_handle *, int)
void init_layer3(void)
Definition: layer3.c:183
int do_layer3(mpg123_handle *fr)
Definition: layer3.c:1982
int absynth_1to1_i486(real *, int, mpg123_handle *, int)
Definition: synth_i486.c:108
int synth_1to1_3dnow(real *, int, mpg123_handle *, int)
int synth_1to1_real_sse(real *, int, mpg123_handle *, int)
void prepare_decode_tables(void)
Definition: tabinit.c:76
int synth_ntom(real *, int, mpg123_handle *, int)
#define make_decode_tables_mmx
Definition: intsym.h:157
int synth_2to1_real_mono(real *, mpg123_handle *)
int synth_1to1_stereo_altivec(real *, real *, mpg123_handle *)
int synth_2to1_dither(real *, int, mpg123_handle *, int)
int synth_2to1_real(real *, int, mpg123_handle *, int)
int synth_1to1_s32_avx(real *, int, mpg123_handle *, int)
int synth_1to1_8bit(real *, int, mpg123_handle *, int)
int synth_1to1_neon64(real *, int, mpg123_handle *, int)
#define init_layer3_gainpow2_mmx
Definition: intsym.h:158
int synth_1to1_altivec(real *, int, mpg123_handle *, int)
off_t ntom_frmouts(mpg123_handle *fr, off_t frame)
Definition: ntom.c:82
void dct64_i486(int *, int *, real *)
Definition: dct64_i486.c:320
int synth_1to1_s32_stereo_altivec(real *, real *, mpg123_handle *)
int synth_1to1_real_stereo_sse(real *, real *, mpg123_handle *)
void make_decode_tables(mpg123_handle *fr)
Definition: tabinit.c:181
int synth_ntom_set_step(mpg123_handle *fr)
Definition: ntom.c:13
int synth_1to1_stereo_avx(real *, real *, mpg123_handle *)
int synth_1to1_real_avx(real *, int, mpg123_handle *, int)
int synth_1to1_m2s(real *, mpg123_handle *)
int synth_1to1_neon(real *, int, mpg123_handle *, int)
int synth_1to1_8bit_wrap(real *, int, mpg123_handle *, int)
int synth_1to1_x86_64(real *, int, mpg123_handle *, int)
int synth_1to1(real *, int, mpg123_handle *, int)
int synth_2to1_m2s(real *, mpg123_handle *)
int synth_1to1_real_altivec(real *, int, mpg123_handle *, int)
int synth_1to1_mono(real *, mpg123_handle *)
void dct36_sse(real *, real *, real *, real *, real *)
int synth_1to1_real_neon64(real *, int, mpg123_handle *, int)
int synth_1to1_real_x86_64(real *, int, mpg123_handle *, int)
int synth_1to1_arm(real *, int, mpg123_handle *, int)
real * pnts[5]
Definition: tabinit.c:45
off_t ntom_frame_outsamples(mpg123_handle *fr)
Definition: ntom.c:73
int synth_4to1_m2s(real *, mpg123_handle *)
void dct64_i386(real *, real *, real *)
Definition: dct64_i386.c:331
int synth_2to1_s32_i386(real *, int, mpg123_handle *, int)
int synth_1to1_8bit_wrap_mono(real *, mpg123_handle *)
off_t ntom_ins2outs(mpg123_handle *fr, off_t ins)
Definition: ntom.c:104
int synth_ntom_8bit(real *, int, mpg123_handle *, int)
void dct64(real *, real *, real *)
Definition: dct64.c:22
int synth_4to1_real(real *, int, mpg123_handle *, int)
int synth_1to1_real_mono(real *, mpg123_handle *)
int synth_2to1_8bit_m2s(real *, mpg123_handle *)
int synth_1to1_s32_stereo_avx(real *, real *, mpg123_handle *)
int synth_4to1_8bit_mono(real *, mpg123_handle *)
int synth_4to1_s32(real *, int, mpg123_handle *, int)
int synth_2to1_real_m2s(real *, mpg123_handle *)
int synth_1to1_s32_neon(real *, int, mpg123_handle *, int)