ReactOS 0.4.15-dev-8219-ge8b88cf
synth_8bit.c
Go to the documentation of this file.
1/*
2 synth_8bit.c: The functions for synthesizing 8bit samples, at the end of decoding.
3
4 copyright 1995-2008 by the mpg123 project - free software under the terms of the LGPL 2.1
5 see COPYING and AUTHORS files in distribution or http://mpg123.org
6 initially written by Michael Hipp, heavily dissected and rearranged by Thomas Orgis
7*/
8
9#include "mpg123lib_intern.h"
10#include "sample.h"
11#include "debug.h"
12
13/*
14 Part 2: All synth functions that produce 8bit output.
15 What we need is just a special WRITE_SAMPLE. For the generic and i386 functions, that is.
16 For the rather optimized synth_1to1, we will need the postprocessing 8bit converters from synth_8bit.h .
17*/
18
19#define SAMPLE_T unsigned char
20#define WRITE_SAMPLE(samples,sum,clip) WRITE_8BIT_SAMPLE(samples,sum,clip)
21
22/* Part 2a: All straight 1to1 decoding functions */
23#define BLOCK 0x40 /* One decoding block is 64 samples. */
24
25#define SYNTH_NAME synth_1to1_8bit
26#include "synth.h"
27#undef SYNTH_NAME
28
29/* Mono-related synths; they wrap over _some_ synth_1to1_8bit (could be generic, could be i386). */
30#define SYNTH_NAME fr->synths.plain[r_1to1][f_8]
31#define MONO_NAME synth_1to1_8bit_mono
32#define MONO2STEREO_NAME synth_1to1_8bit_m2s
33#include "synth_mono.h"
34#undef SYNTH_NAME
35#undef MONO_NAME
36#undef MONO2STEREO_NAME
37
38#ifdef OPT_X86
39#define NO_AUTOINCREMENT
40#define SYNTH_NAME synth_1to1_8bit_i386
41#include "synth.h"
42#undef SYNTH_NAME
43/* i386 uses the normal mono functions. */
44#undef NO_AUTOINCREMENT
45#endif
46
47/* But now, we need functions that take the 16bit output of optimized synth_1to1 and convert it.
48 I suppose that is still faster than dropping the optimization altogether! */
49
50#define BASE_SYNTH_NAME fr->synths.plain[r_1to1][f_16]
51#define SYNTH_NAME synth_1to1_8bit_wrap
52#define MONO_NAME synth_1to1_8bit_wrap_mono
53#define MONO2STEREO_NAME synth_1to1_8bit_wrap_m2s
54#include "synth_8bit.h"
55#undef BASE_SYNTH_NAME
56#undef SYNTH_NAME
57#undef MONO_NAME
58#undef MONO2STEREO_NAME
59
60#undef BLOCK
61
62#ifndef NO_DOWNSAMPLE
63
64/*
65 Part 2b: 2to1 synth. Only generic and i386.
66*/
67#define BLOCK 0x20 /* One decoding block is 32 samples. */
68
69#define SYNTH_NAME synth_2to1_8bit
70#include "synth.h"
71#undef SYNTH_NAME
72
73/* Mono-related synths; they wrap over _some_ synth_2to1_8bit (could be generic, could be i386). */
74#define SYNTH_NAME fr->synths.plain[r_2to1][f_8]
75#define MONO_NAME synth_2to1_8bit_mono
76#define MONO2STEREO_NAME synth_2to1_8bit_m2s
77#include "synth_mono.h"
78#undef SYNTH_NAME
79#undef MONO_NAME
80#undef MONO2STEREO_NAME
81
82#ifdef OPT_X86
83#define NO_AUTOINCREMENT
84#define SYNTH_NAME synth_2to1_8bit_i386
85#include "synth.h"
86#undef SYNTH_NAME
87/* i386 uses the normal mono functions. */
88#undef NO_AUTOINCREMENT
89#endif
90
91#undef BLOCK
92
93/*
94 Part 2c: 4to1 synth. Only generic and i386.
95*/
96#define BLOCK 0x10 /* One decoding block is 16 samples. */
97
98#define SYNTH_NAME synth_4to1_8bit
99#include "synth.h"
100#undef SYNTH_NAME
101
102/* Mono-related synths; they wrap over _some_ synth_4to1_8bit (could be generic, could be i386). */
103#define SYNTH_NAME fr->synths.plain[r_4to1][f_8]
104#define MONO_NAME synth_4to1_8bit_mono
105#define MONO2STEREO_NAME synth_4to1_8bit_m2s
106#include "synth_mono.h"
107#undef SYNTH_NAME
108#undef MONO_NAME
109#undef MONO2STEREO_NAME
110
111#ifdef OPT_X86
112#define NO_AUTOINCREMENT
113#define SYNTH_NAME synth_4to1_8bit_i386
114#include "synth.h"
115#undef SYNTH_NAME
116/* i386 uses the normal mono functions. */
117#undef NO_AUTOINCREMENT
118#endif
119
120#undef BLOCK
121
122#endif /* NO_DOWNSAMPLE */
123
124#ifndef NO_NTOM
125/*
126 Part 2d: ntom synth.
127 Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
128*/
129
130/* These are all in one header, there's no flexibility to gain. */
131#define SYNTH_NAME synth_ntom_8bit
132#define MONO_NAME synth_ntom_8bit_mono
133#define MONO2STEREO_NAME synth_ntom_8bit_m2s
134#include "synth_ntom.h"
135#undef SYNTH_NAME
136#undef MONO_NAME
137#undef MONO2STEREO_NAME
138
139#endif
140
141#undef SAMPLE_T
142#undef WRITE_SAMPLE