2 synth_8bit.c: The functions for synthesizing 8bit samples, at the end of decoding.
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
9 #include "mpg123lib_intern.h"
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 .
19 #define SAMPLE_T unsigned char
20 #define WRITE_SAMPLE(samples,sum,clip) WRITE_8BIT_SAMPLE(samples,sum,clip)
22 /* Part 2a: All straight 1to1 decoding functions */
23 #define BLOCK 0x40 /* One decoding block is 64 samples. */
25 #define SYNTH_NAME synth_1to1_8bit
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_mono2stereo
33 #include "synth_mono.h"
36 #undef MONO2STEREO_NAME
39 #define NO_AUTOINCREMENT
40 #define SYNTH_NAME synth_1to1_8bit_i386
43 /* i386 uses the normal mono functions. */
44 #undef NO_AUTOINCREMENT
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! */
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_mono2stereo
54 #include "synth_8bit.h"
55 #undef BASE_SYNTH_NAME
58 #undef MONO2STEREO_NAME
65 Part 2b: 2to1 synth. Only generic and i386.
67 #define BLOCK 0x20 /* One decoding block is 32 samples. */
69 #define SYNTH_NAME synth_2to1_8bit
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_mono2stereo
77 #include "synth_mono.h"
80 #undef MONO2STEREO_NAME
83 #define NO_AUTOINCREMENT
84 #define SYNTH_NAME synth_2to1_8bit_i386
87 /* i386 uses the normal mono functions. */
88 #undef NO_AUTOINCREMENT
94 Part 2c: 4to1 synth. Only generic and i386.
96 #define BLOCK 0x10 /* One decoding block is 16 samples. */
98 #define SYNTH_NAME synth_4to1_8bit
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_mono2stereo
106 #include "synth_mono.h"
109 #undef MONO2STEREO_NAME
112 #define NO_AUTOINCREMENT
113 #define SYNTH_NAME synth_4to1_8bit_i386
116 /* i386 uses the normal mono functions. */
117 #undef NO_AUTOINCREMENT
122 #endif /* NO_DOWNSAMPLE */
127 Same procedure as above... Just no extra play anymore, straight synth that may use an optimized dct64.
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_mono2stereo
134 #include "synth_ntom.h"
137 #undef MONO2STEREO_NAME