Debian Codegraph @

external/portaudio/pa_converters.h

raw symbols SCIP
1 #cxx . . $ `<file>/external/portaudio/pa_converters.h`/ifndef PA_CONVERTERS_H
2 #define PA_CONVERTERS_Hcxx . . $ `external/portaudio/pa_converters.h:2:9`!
3 /*
4 * $Id$
5 * Portable Audio I/O Library sample conversion mechanism
6 *
7 * Based on the Open Source API proposed by Ross Bencina
8 * Copyright (c) 1999-2002 Phil Burk, Ross Bencina
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * a copy of this software and associated documentation files
12 * (the "Software"), to deal in the Software without restriction,
13 * including without limitation the rights to use, copy, modify, merge,
14 * publish, distribute, sublicense, and/or sell copies of the Software,
15 * and to permit persons to whom the Software is furnished to do so,
16 * subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
25 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30 /*
31 * The text above constitutes the entire PortAudio license; however,
32 * the PortAudio community also makes the following non-binding requests:
33 *
34 * Any person wishing to distribute modifications to the Software is
35 * requested to send the modifications to the original developer so that
36 * they can be incorporated into the canonical version. It is also
37 * requested that these non-binding requests be included along with the
38 * license above.
39 */
40
41 /** @file
42 @ingroup common_src
43
44 @brief Conversion functions used to convert buffers of samples from one
45 format to another.
46 */
47
48
49 #include "portaudio.h"cxx . . $ `<file>/external/portaudio/portaudio.h`/ /* for PaSampleFormat */
50
51 #ifdef __cplusplus
52 extern "C"
53 {
54 #endif /* __cplusplus */
55
56
57 struct PaUtilTriangularDitherGeneratorcxx . . $ PaUtilTriangularDitherGenerator#;
58
59
60 /** Choose an available sample format which is most appropriate for
61 representing the requested format. If the requested format is not available
62 higher quality formats are considered before lower quality formats.
63 @param availableFormats A variable containing the logical OR of all available
64 formats.
65 @param format The desired format.
66 @return The most appropriate available format for representing the requested
67 format.
68 */
69 PaSampleFormatcxx . . $ PaSampleFormat# PaUtil_SelectClosestAvailableFormatcxx . . $ PaUtil_SelectClosestAvailableFormat(80bad76eed2d2579).(
70 PaSampleFormatcxx . . $ PaSampleFormat# availableFormats, PaSampleFormatcxx . . $ PaSampleFormat# format );
71
72
73 /* high level conversions functions for use by implementations */
74
75
76 /** The generic sample converter prototype. Sample converters convert count
77 samples from sourceBuffer to destinationBuffer. The actual type of the data
78 pointed to by these parameters varys for different converter functions.
79 @param destinationBuffer A pointer to the first sample of the destination.
80 @param destinationStride An offset between successive destination samples
81 expressed in samples (not bytes.) It may be negative.
82 @param sourceBuffer A pointer to the first sample of the source.
83 @param sourceStride An offset between successive source samples
84 expressed in samples (not bytes.) It may be negative.
85 @param count The number of samples to convert.
86 @param ditherState State information used to calculate dither. Converters
87 that do not perform dithering will ignore this parameter, in which case
88 NULL or invalid dither state may be passed.
89 */
90 typedef void PaUtilConvertercxx . . $ PaUtilConverter#(
91 void *destinationBuffer, signed int destinationStride,
92 void *sourceBuffer, signed int sourceStride,
93 unsigned int count, struct PaUtilTriangularDitherGeneratorcxx . . $ PaUtilTriangularDitherGenerator# *ditherGenerator );
94
95
96 /** Find a sample converter function for the given source and destinations
97 formats and flags (clip and dither.)
98 @return
99 A pointer to a PaUtilConverter which will perform the requested
100 conversion, or NULL if the given format conversion is not supported.
101 For conversions where clipping or dithering is not necessary, the
102 clip and dither flags are ignored and a non-clipping or dithering
103 version is returned.
104 If the source and destination formats are the same, a function which
105 copies data of the appropriate size will be returned.
106 */
107 PaUtilConvertercxx . . $ PaUtilConverter#* PaUtil_SelectConvertercxx . . $ PaUtil_SelectConverter(6220d32be7461764).( PaSampleFormatcxx . . $ PaSampleFormat# sourceFormat,
108 PaSampleFormatcxx . . $ PaSampleFormat# destinationFormat, PaStreamFlagscxx . . $ PaStreamFlags# flags );
109
110
111 /** The generic buffer zeroer prototype. Buffer zeroers copy count zeros to
112 destinationBuffer. The actual type of the data pointed to varys for
113 different zeroer functions.
114 @param destinationBuffer A pointer to the first sample of the destination.
115 @param destinationStride An offset between successive destination samples
116 expressed in samples (not bytes.) It may be negative.
117 @param count The number of samples to zero.
118 */
119 typedef void PaUtilZeroercxx . . $ PaUtilZeroer#(
120 void *destinationBuffer, signed int destinationStride, unsigned int count );
121
122
123 /** Find a buffer zeroer function for the given destination format.
124 @return
125 A pointer to a PaUtilZeroer which will perform the requested
126 zeroing.
127 */
128 PaUtilZeroercxx . . $ PaUtilZeroer#* PaUtil_SelectZeroercxx . . $ PaUtil_SelectZeroer(8b9f5260aad0a7d4).( PaSampleFormatcxx . . $ PaSampleFormat# destinationFormat );
129
130 /*----------------------------------------------------------------------------*/
131 /* low level functions and data structures which may be used for
132 substituting conversion functions */
133
134
135 /** The type used to store all sample conversion functions.
136 @see paConverters;
137 */
138 typedef structcxx . . $ $anonymous_type_74f3a508f779b330_0#{
139 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int32cxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int32.;
140 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int32_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int32_Dither.;
141 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int32_Clipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int32_Clip.;
142 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int32_DitherClipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int32_DitherClip.;
143
144 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int24cxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int24.;
145 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int24_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int24_Dither.;
146 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int24_Clipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int24_Clip.;
147 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int24_DitherClipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int24_DitherClip.;
148
149 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int16cxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int16.;
150 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int16_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int16_Dither.;
151 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int16_Clipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int16_Clip.;
152 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int16_DitherClipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int16_DitherClip.;
153
154 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int8cxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int8.;
155 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int8_Dither.;
156 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int8_Clipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int8_Clip.;
157 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_Int8_DitherClipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_Int8_DitherClip.;
158
159 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_UInt8cxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_UInt8.;
160 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_UInt8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_UInt8_Dither.;
161 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_UInt8_Clipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_UInt8_Clip.;
162 PaUtilConvertercxx . . $ PaUtilConverter# *Float32_To_UInt8_DitherClipcxx . . $ $anonymous_type_74f3a508f779b330_0#Float32_To_UInt8_DitherClip.;
163
164 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Float32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Float32.;
165 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Int24cxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Int24.;
166 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Int24_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Int24_Dither.;
167 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Int16cxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Int16.;
168 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Int16_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Int16_Dither.;
169 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Int8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Int8.;
170 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_Int8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_Int8_Dither.;
171 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_UInt8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_UInt8.;
172 PaUtilConvertercxx . . $ PaUtilConverter# *Int32_To_UInt8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int32_To_UInt8_Dither.;
173
174 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_Float32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_Float32.;
175 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_Int32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_Int32.;
176 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_Int16cxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_Int16.;
177 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_Int16_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_Int16_Dither.;
178 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_Int8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_Int8.;
179 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_Int8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_Int8_Dither.;
180 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_UInt8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_UInt8.;
181 PaUtilConvertercxx . . $ PaUtilConverter# *Int24_To_UInt8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int24_To_UInt8_Dither.;
182
183 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_Float32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_Float32.;
184 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_Int32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_Int32.;
185 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_Int24cxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_Int24.;
186 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_Int8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_Int8.;
187 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_Int8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_Int8_Dither.;
188 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_UInt8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_UInt8.;
189 PaUtilConvertercxx . . $ PaUtilConverter# *Int16_To_UInt8_Dithercxx . . $ $anonymous_type_74f3a508f779b330_0#Int16_To_UInt8_Dither.;
190
191 PaUtilConvertercxx . . $ PaUtilConverter# *Int8_To_Float32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int8_To_Float32.;
192 PaUtilConvertercxx . . $ PaUtilConverter# *Int8_To_Int32cxx . . $ $anonymous_type_74f3a508f779b330_0#Int8_To_Int32.;
193 PaUtilConvertercxx . . $ PaUtilConverter# *Int8_To_Int24cxx . . $ $anonymous_type_74f3a508f779b330_0#Int8_To_Int24.;
194 PaUtilConvertercxx . . $ PaUtilConverter# *Int8_To_Int16cxx . . $ $anonymous_type_74f3a508f779b330_0#Int8_To_Int16.;
195 PaUtilConvertercxx . . $ PaUtilConverter# *Int8_To_UInt8cxx . . $ $anonymous_type_74f3a508f779b330_0#Int8_To_UInt8.;
196
197 PaUtilConvertercxx . . $ PaUtilConverter# *UInt8_To_Float32cxx . . $ $anonymous_type_74f3a508f779b330_0#UInt8_To_Float32.;
198 PaUtilConvertercxx . . $ PaUtilConverter# *UInt8_To_Int32cxx . . $ $anonymous_type_74f3a508f779b330_0#UInt8_To_Int32.;
199 PaUtilConvertercxx . . $ PaUtilConverter# *UInt8_To_Int24cxx . . $ $anonymous_type_74f3a508f779b330_0#UInt8_To_Int24.;
200 PaUtilConvertercxx . . $ PaUtilConverter# *UInt8_To_Int16cxx . . $ $anonymous_type_74f3a508f779b330_0#UInt8_To_Int16.;
201 PaUtilConvertercxx . . $ PaUtilConverter# *UInt8_To_Int8cxx . . $ $anonymous_type_74f3a508f779b330_0#UInt8_To_Int8.;
202
203 PaUtilConvertercxx . . $ PaUtilConverter# *Copy_8_To_8cxx . . $ $anonymous_type_74f3a508f779b330_0#Copy_8_To_8.; /* copy without any conversion */
204 PaUtilConvertercxx . . $ PaUtilConverter# *Copy_16_To_16cxx . . $ $anonymous_type_74f3a508f779b330_0#Copy_16_To_16.; /* copy without any conversion */
205 PaUtilConvertercxx . . $ PaUtilConverter# *Copy_24_To_24cxx . . $ $anonymous_type_74f3a508f779b330_0#Copy_24_To_24.; /* copy without any conversion */
206 PaUtilConvertercxx . . $ PaUtilConverter# *Copy_32_To_32cxx . . $ $anonymous_type_74f3a508f779b330_0#Copy_32_To_32.; /* copy without any conversion */
207 } PaUtilConverterTablecxx . . $ PaUtilConverterTable#;
208
209
210 /** A table of pointers to all required converter functions.
211 PaUtil_SelectConverter() uses this table to lookup the appropriate
212 conversion functions. The fields of this structure are initialized
213 with default conversion functions. Fields may be NULL, indicating that
214 no conversion function is available. User code may substitute optimised
215 conversion functions by assigning different function pointers to
216 these fields.
217
218 @note
219 If the PA_NO_STANDARD_CONVERTERS preprocessor variable is defined,
220 PortAudio's standard converters will not be compiled, and all fields
221 of this structure will be initialized to NULL. In such cases, users
222 should supply their own conversion functions if the require PortAudio
223 to open a stream that requires sample conversion.
224
225 @see PaUtilConverterTable, PaUtilConverter, PaUtil_SelectConverter
226 */
227 extern PaUtilConverterTablecxx . . $ PaUtilConverterTable# paConverterscxx . . $ paConverters.;
228
229
230 /** The type used to store all buffer zeroing functions.
231 @see paZeroers;
232 */
233 typedef structcxx . . $ $anonymous_type_74f3a508f779b330_1#{
234 PaUtilZeroercxx . . $ PaUtilZeroer# *ZeroU8cxx . . $ $anonymous_type_74f3a508f779b330_1#ZeroU8.; /* unsigned 8 bit, zero == 128 */
235 PaUtilZeroercxx . . $ PaUtilZeroer# *Zero8cxx . . $ $anonymous_type_74f3a508f779b330_1#Zero8.;
236 PaUtilZeroercxx . . $ PaUtilZeroer# *Zero16cxx . . $ $anonymous_type_74f3a508f779b330_1#Zero16.;
237 PaUtilZeroercxx . . $ PaUtilZeroer# *Zero24cxx . . $ $anonymous_type_74f3a508f779b330_1#Zero24.;
238 PaUtilZeroercxx . . $ PaUtilZeroer# *Zero32cxx . . $ $anonymous_type_74f3a508f779b330_1#Zero32.;
239 } PaUtilZeroerTablecxx . . $ PaUtilZeroerTable#;
240
241
242 /** A table of pointers to all required zeroer functions.
243 PaUtil_SelectZeroer() uses this table to lookup the appropriate
244 conversion functions. The fields of this structure are initialized
245 with default conversion functions. User code may substitute optimised
246 conversion functions by assigning different function pointers to
247 these fields.
248
249 @note
250 If the PA_NO_STANDARD_ZEROERS preprocessor variable is defined,
251 PortAudio's standard zeroers will not be compiled, and all fields
252 of this structure will be initialized to NULL. In such cases, users
253 should supply their own zeroing functions for the sample sizes which
254 they intend to use.
255
256 @see PaUtilZeroerTable, PaUtilZeroer, PaUtil_SelectZeroer
257 */
258 extern PaUtilZeroerTablecxx . . $ PaUtilZeroerTable# paZeroerscxx . . $ paZeroers.;
259
260 #ifdef __cplusplus
261 }
262 #endif /* __cplusplus */
263 #endif /* PA_CONVERTERS_H */