1ea81d6eaSJerome Leveque /*
2ea81d6eaSJerome Leveque * Copyright 2012 Jérôme Leveque
3ea81d6eaSJerome Leveque * Copyright 2012 Jérôme Duval
4ea81d6eaSJerome Leveque * Copyright 2003 Marcus Overhagen
5ea81d6eaSJerome Leveque * Distributed under the terms of the MIT License.
6ea81d6eaSJerome Leveque */
7ea81d6eaSJerome Leveque
8ea81d6eaSJerome Leveque
9ea81d6eaSJerome Leveque #include "Resampler.h"
10ea81d6eaSJerome Leveque #include "MultiAudioUtility.h"
11ea81d6eaSJerome Leveque #include "debug.h"
12ea81d6eaSJerome Leveque
13ea81d6eaSJerome Leveque
14ea81d6eaSJerome Leveque /*! A simple resampling class for the multi_audio add-ons.
15ea81d6eaSJerome Leveque You pick the conversion function on object creation,
16ea81d6eaSJerome Leveque and then call the Resample() function, specifying data pointer,
17ea81d6eaSJerome Leveque offset (in bytes) to the next sample, and count of samples.
18ea81d6eaSJerome Leveque */
19ea81d6eaSJerome Leveque
20ea81d6eaSJerome Leveque
Resampler(uint32 sourceFormat,uint32 destFormat)21ea81d6eaSJerome Leveque Resampler::Resampler(uint32 sourceFormat, uint32 destFormat)
22ea81d6eaSJerome Leveque :
237633665cSJerome Duval fFunc(&Resampler::_Void)
24ea81d6eaSJerome Leveque {
25ea81d6eaSJerome Leveque PRINT(("Resampler() in 0x%x, out 0x%x\n", (unsigned int)sourceFormat,
26ea81d6eaSJerome Leveque (unsigned int)destFormat));
27ea81d6eaSJerome Leveque
28ea81d6eaSJerome Leveque switch (sourceFormat) {
29ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
30ea81d6eaSJerome Leveque switch (destFormat) {
31ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
327633665cSJerome Duval fFunc = &Resampler::_CopyFloat2Float;
33ea81d6eaSJerome Leveque break;
34ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
35ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyFloat2Double;
36ea81d6eaSJerome Leveque break;
37ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
38ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyFloat2Int;
39ea81d6eaSJerome Leveque break;
40ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
41ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyFloat2Short;
42ea81d6eaSJerome Leveque break;
43ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
44ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyFloat2UChar;
45ea81d6eaSJerome Leveque break;
46ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
47ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyFloat2Char;
48ea81d6eaSJerome Leveque break;
49ea81d6eaSJerome Leveque }
50ea81d6eaSJerome Leveque break;
51ea81d6eaSJerome Leveque
52ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
53ea81d6eaSJerome Leveque switch (destFormat) {
54ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
55ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyDouble2Float;
56ea81d6eaSJerome Leveque break;
57ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
587633665cSJerome Duval fFunc = &Resampler::_CopyDouble2Double;
59ea81d6eaSJerome Leveque break;
60ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
61ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyDouble2Int;
62ea81d6eaSJerome Leveque break;
63ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
64ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyDouble2Short;
65ea81d6eaSJerome Leveque break;
66ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
67ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyDouble2UChar;
68ea81d6eaSJerome Leveque break;
69ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
70ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyDouble2Char;
71ea81d6eaSJerome Leveque break;
72ea81d6eaSJerome Leveque }
73ea81d6eaSJerome Leveque break;
74ea81d6eaSJerome Leveque
75ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
76ea81d6eaSJerome Leveque switch (destFormat) {
77ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
78ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyInt2Float;
79ea81d6eaSJerome Leveque break;
80ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
81ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyInt2Double;
82ea81d6eaSJerome Leveque break;
83ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
847633665cSJerome Duval fFunc = &Resampler::_CopyInt2Int;
85ea81d6eaSJerome Leveque break;
86ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
87ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyInt2Short;
88ea81d6eaSJerome Leveque break;
89ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
90ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyInt2UChar;
91ea81d6eaSJerome Leveque break;
92ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
93ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyInt2Char;
94ea81d6eaSJerome Leveque break;
95ea81d6eaSJerome Leveque }
96ea81d6eaSJerome Leveque break;
97ea81d6eaSJerome Leveque
98ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
99ea81d6eaSJerome Leveque switch (destFormat) {
100ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
101ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyShort2Float;
102ea81d6eaSJerome Leveque break;
103ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
104ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyShort2Double;
105ea81d6eaSJerome Leveque break;
106ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
107ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyShort2Int;
108ea81d6eaSJerome Leveque break;
109ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
1107633665cSJerome Duval fFunc = &Resampler::_CopyShort2Short;
111ea81d6eaSJerome Leveque break;
112ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
113ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyShort2UChar;
114ea81d6eaSJerome Leveque break;
115ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
116ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyShort2Char;
117ea81d6eaSJerome Leveque break;
118ea81d6eaSJerome Leveque }
119ea81d6eaSJerome Leveque break;
120ea81d6eaSJerome Leveque
121ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
122ea81d6eaSJerome Leveque switch (destFormat) {
123ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
124ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyUChar2Float;
125ea81d6eaSJerome Leveque break;
126ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
127ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyUChar2Double;
128ea81d6eaSJerome Leveque break;
129ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
130ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyUChar2Int;
131ea81d6eaSJerome Leveque break;
132ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
133ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyUChar2Short;
134ea81d6eaSJerome Leveque break;
135ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
1367633665cSJerome Duval fFunc = &Resampler::_CopyUChar2UChar;
137ea81d6eaSJerome Leveque break;
138ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
139ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyUChar2Char;
140ea81d6eaSJerome Leveque break;
141ea81d6eaSJerome Leveque }
142ea81d6eaSJerome Leveque break;
143ea81d6eaSJerome Leveque
144ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
145ea81d6eaSJerome Leveque switch (destFormat) {
146ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_FLOAT:
147ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyChar2Float;
148ea81d6eaSJerome Leveque break;
149ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_DOUBLE:
150ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyChar2Double;
151ea81d6eaSJerome Leveque break;
152ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_INT:
153ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyChar2Int;
154ea81d6eaSJerome Leveque break;
155ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_SHORT:
156ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyChar2Short;
157ea81d6eaSJerome Leveque break;
158ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_UCHAR:
159ea81d6eaSJerome Leveque fFunc = &Resampler::_CopyChar2UChar;
160ea81d6eaSJerome Leveque break;
161ea81d6eaSJerome Leveque case media_raw_audio_format::B_AUDIO_CHAR:
1627633665cSJerome Duval fFunc = &Resampler::_CopyChar2Char;
163ea81d6eaSJerome Leveque break;
164ea81d6eaSJerome Leveque }
165ea81d6eaSJerome Leveque break;
166ea81d6eaSJerome Leveque }
167ea81d6eaSJerome Leveque }
168ea81d6eaSJerome Leveque
169ea81d6eaSJerome Leveque
~Resampler()170ea81d6eaSJerome Leveque Resampler::~Resampler()
171ea81d6eaSJerome Leveque {
172ea81d6eaSJerome Leveque }
173ea81d6eaSJerome Leveque
174ea81d6eaSJerome Leveque
1757633665cSJerome Duval void
_Void(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)1767633665cSJerome Duval Resampler::_Void(const void *inputData, uint32 inputStride,
1777633665cSJerome Duval void *outputData, uint32 outputStride, uint32 sampleCount)
178ea81d6eaSJerome Leveque {
1797633665cSJerome Duval
180ea81d6eaSJerome Leveque }
181ea81d6eaSJerome Leveque
182ea81d6eaSJerome Leveque
183ea81d6eaSJerome Leveque void
_CopyFloat2Float(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)1847633665cSJerome Duval Resampler::_CopyFloat2Float(const void *inputData, uint32 inputStride,
185ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
186ea81d6eaSJerome Leveque {
187ea81d6eaSJerome Leveque while (sampleCount > 0) {
1887633665cSJerome Duval *(float*)outputData = *(const float*)inputData;
189ea81d6eaSJerome Leveque
190ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
191ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
192ea81d6eaSJerome Leveque
193ea81d6eaSJerome Leveque sampleCount--;
194ea81d6eaSJerome Leveque }
195ea81d6eaSJerome Leveque }
196ea81d6eaSJerome Leveque
197ea81d6eaSJerome Leveque
198ea81d6eaSJerome Leveque void
_CopyFloat2Double(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)199ea81d6eaSJerome Leveque Resampler::_CopyFloat2Double(const void *inputData, uint32 inputStride,
200ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
201ea81d6eaSJerome Leveque {
202ea81d6eaSJerome Leveque while (sampleCount > 0) {
203ea81d6eaSJerome Leveque *(double*)outputData = *(const float*)inputData;
204ea81d6eaSJerome Leveque
205ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
206ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
207ea81d6eaSJerome Leveque
208ea81d6eaSJerome Leveque sampleCount--;
209ea81d6eaSJerome Leveque }
210ea81d6eaSJerome Leveque }
211ea81d6eaSJerome Leveque
212ea81d6eaSJerome Leveque
213ea81d6eaSJerome Leveque void
_CopyFloat2Int(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)214ea81d6eaSJerome Leveque Resampler::_CopyFloat2Int(const void *inputData, uint32 inputStride,
215ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
216ea81d6eaSJerome Leveque {
217ea81d6eaSJerome Leveque while (sampleCount > 0) {
218*2e68fbd2SMáximo Castañeda float data = *(const float*)inputData;
219*2e68fbd2SMáximo Castañeda if (data <= -1.0f)
220*2e68fbd2SMáximo Castañeda *(int32*)outputData = INT32_MIN;
221*2e68fbd2SMáximo Castañeda else if (data >= 1.0f)
222*2e68fbd2SMáximo Castañeda *(int32*)outputData = INT32_MAX;
223*2e68fbd2SMáximo Castañeda else
224*2e68fbd2SMáximo Castañeda *(int32*)outputData = (int32)(data * INT32_MAX);
225ea81d6eaSJerome Leveque
226ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
227ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
228ea81d6eaSJerome Leveque
229ea81d6eaSJerome Leveque sampleCount--;
230ea81d6eaSJerome Leveque }
231ea81d6eaSJerome Leveque }
232ea81d6eaSJerome Leveque
233ea81d6eaSJerome Leveque void
_CopyFloat2Short(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)234ea81d6eaSJerome Leveque Resampler::_CopyFloat2Short(const void *inputData, uint32 inputStride,
235ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
236ea81d6eaSJerome Leveque {
237ea81d6eaSJerome Leveque while (sampleCount > 0) {
238ea81d6eaSJerome Leveque *(int16*)outputData = (int16)(*(const float*)inputData * 32767.0f);
239ea81d6eaSJerome Leveque
240ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
241ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
242ea81d6eaSJerome Leveque
243ea81d6eaSJerome Leveque sampleCount--;
244ea81d6eaSJerome Leveque }
245ea81d6eaSJerome Leveque }
246ea81d6eaSJerome Leveque
247ea81d6eaSJerome Leveque
248ea81d6eaSJerome Leveque void
_CopyFloat2UChar(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)249ea81d6eaSJerome Leveque Resampler::_CopyFloat2UChar(const void *inputData, uint32 inputStride,
250ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
251ea81d6eaSJerome Leveque {
252ea81d6eaSJerome Leveque while (sampleCount > 0) {
253ea81d6eaSJerome Leveque *(uint8*)outputData = (uint8)(128.0f + *(const float*)inputData * 127.0f);
254ea81d6eaSJerome Leveque
255ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
256ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
257ea81d6eaSJerome Leveque
258ea81d6eaSJerome Leveque sampleCount--;
259ea81d6eaSJerome Leveque }
260ea81d6eaSJerome Leveque }
261ea81d6eaSJerome Leveque
262ea81d6eaSJerome Leveque
263ea81d6eaSJerome Leveque void
_CopyFloat2Char(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)264ea81d6eaSJerome Leveque Resampler::_CopyFloat2Char(const void *inputData, uint32 inputStride,
265ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
266ea81d6eaSJerome Leveque {
267ea81d6eaSJerome Leveque while (sampleCount > 0) {
268ea81d6eaSJerome Leveque *(int8*)outputData = (int8)(*(const float*)inputData * 127.0f);
269ea81d6eaSJerome Leveque
270ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
271ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
272ea81d6eaSJerome Leveque
273ea81d6eaSJerome Leveque sampleCount--;
274ea81d6eaSJerome Leveque }
275ea81d6eaSJerome Leveque }
276ea81d6eaSJerome Leveque
277ea81d6eaSJerome Leveque
278ea81d6eaSJerome Leveque void
_CopyDouble2Float(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)279ea81d6eaSJerome Leveque Resampler::_CopyDouble2Float(const void *inputData, uint32 inputStride,
280ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
281ea81d6eaSJerome Leveque {
282ea81d6eaSJerome Leveque while (sampleCount > 0) {
283ea81d6eaSJerome Leveque *(float*)outputData = *(const double*)inputData;
284ea81d6eaSJerome Leveque
285ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
286ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
287ea81d6eaSJerome Leveque
288ea81d6eaSJerome Leveque sampleCount--;
289ea81d6eaSJerome Leveque }
290ea81d6eaSJerome Leveque }
291ea81d6eaSJerome Leveque
292ea81d6eaSJerome Leveque
293ea81d6eaSJerome Leveque void
_CopyDouble2Double(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)2947633665cSJerome Duval Resampler::_CopyDouble2Double(const void *inputData, uint32 inputStride,
2957633665cSJerome Duval void *outputData, uint32 outputStride, uint32 sampleCount)
2967633665cSJerome Duval {
2977633665cSJerome Duval while (sampleCount > 0) {
2987633665cSJerome Duval *(double*)outputData = *(const double*)inputData;
2997633665cSJerome Duval
3007633665cSJerome Duval outputData = (void*)((uint8*)outputData + outputStride);
3017633665cSJerome Duval inputData = (void*)((uint8*)inputData + inputStride);
3027633665cSJerome Duval
3037633665cSJerome Duval sampleCount--;
3047633665cSJerome Duval }
3057633665cSJerome Duval }
3067633665cSJerome Duval
3077633665cSJerome Duval
3087633665cSJerome Duval void
_CopyDouble2Int(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)309ea81d6eaSJerome Leveque Resampler::_CopyDouble2Int(const void *inputData, uint32 inputStride,
310ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
311ea81d6eaSJerome Leveque {
312ea81d6eaSJerome Leveque while (sampleCount > 0) {
313*2e68fbd2SMáximo Castañeda *(int32*)outputData = (int32)(*(const double*)inputData
314*2e68fbd2SMáximo Castañeda * (double)INT32_MAX);
315ea81d6eaSJerome Leveque
316ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
317ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
318ea81d6eaSJerome Leveque
319ea81d6eaSJerome Leveque sampleCount--;
320ea81d6eaSJerome Leveque }
321ea81d6eaSJerome Leveque }
322ea81d6eaSJerome Leveque
323ea81d6eaSJerome Leveque
324ea81d6eaSJerome Leveque void
_CopyDouble2Short(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)325ea81d6eaSJerome Leveque Resampler::_CopyDouble2Short(const void *inputData, uint32 inputStride,
326ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
327ea81d6eaSJerome Leveque {
328ea81d6eaSJerome Leveque while (sampleCount > 0) {
329ea81d6eaSJerome Leveque *(int16*)outputData = (int16)(*(const double*)inputData * 32767.0f);
330ea81d6eaSJerome Leveque
331ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
332ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
333ea81d6eaSJerome Leveque
334ea81d6eaSJerome Leveque sampleCount--;
335ea81d6eaSJerome Leveque }
336ea81d6eaSJerome Leveque }
337ea81d6eaSJerome Leveque
338ea81d6eaSJerome Leveque
339ea81d6eaSJerome Leveque void
_CopyDouble2UChar(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)340ea81d6eaSJerome Leveque Resampler::_CopyDouble2UChar(const void *inputData, uint32 inputStride,
341ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
342ea81d6eaSJerome Leveque {
343ea81d6eaSJerome Leveque while (sampleCount > 0) {
344ea81d6eaSJerome Leveque *(uint8*)outputData = (uint8)(128.0f + *(const double*)inputData * 127.0f);
345ea81d6eaSJerome Leveque
346ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
347ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
348ea81d6eaSJerome Leveque
349ea81d6eaSJerome Leveque sampleCount--;
350ea81d6eaSJerome Leveque }
351ea81d6eaSJerome Leveque }
352ea81d6eaSJerome Leveque
353ea81d6eaSJerome Leveque
354ea81d6eaSJerome Leveque void
_CopyDouble2Char(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)355ea81d6eaSJerome Leveque Resampler::_CopyDouble2Char(const void *inputData, uint32 inputStride,
356ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
357ea81d6eaSJerome Leveque {
358ea81d6eaSJerome Leveque while (sampleCount > 0) {
359ea81d6eaSJerome Leveque *(int8*)outputData = (int8)(*(const double*)inputData * 127.0f);
360ea81d6eaSJerome Leveque
361ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
362ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
363ea81d6eaSJerome Leveque
364ea81d6eaSJerome Leveque sampleCount--;
365ea81d6eaSJerome Leveque }
366ea81d6eaSJerome Leveque }
367ea81d6eaSJerome Leveque
368ea81d6eaSJerome Leveque
369ea81d6eaSJerome Leveque void
_CopyShort2Float(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)370ea81d6eaSJerome Leveque Resampler::_CopyShort2Float(const void *inputData, uint32 inputStride,
371ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
372ea81d6eaSJerome Leveque {
373ea81d6eaSJerome Leveque while (sampleCount > 0) {
374ea81d6eaSJerome Leveque *(float*)outputData = *(const int16*)inputData / 32767.0f;
375ea81d6eaSJerome Leveque
376ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
377ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
378ea81d6eaSJerome Leveque
379ea81d6eaSJerome Leveque sampleCount--;
380ea81d6eaSJerome Leveque }
381ea81d6eaSJerome Leveque }
382ea81d6eaSJerome Leveque
383ea81d6eaSJerome Leveque
384ea81d6eaSJerome Leveque void
_CopyShort2Double(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)385ea81d6eaSJerome Leveque Resampler::_CopyShort2Double(const void *inputData, uint32 inputStride,
386ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
387ea81d6eaSJerome Leveque {
388ea81d6eaSJerome Leveque while (sampleCount > 0) {
389ea81d6eaSJerome Leveque *(double*)outputData = *(const int16*)inputData / 32767.0;
390ea81d6eaSJerome Leveque
391ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
392ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
393ea81d6eaSJerome Leveque
394ea81d6eaSJerome Leveque sampleCount--;
395ea81d6eaSJerome Leveque }
396ea81d6eaSJerome Leveque }
397ea81d6eaSJerome Leveque
398ea81d6eaSJerome Leveque
399ea81d6eaSJerome Leveque void
_CopyShort2Int(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)400ea81d6eaSJerome Leveque Resampler::_CopyShort2Int(const void *inputData, uint32 inputStride,
401ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
402ea81d6eaSJerome Leveque {
403ea81d6eaSJerome Leveque while (sampleCount > 0) {
404ea81d6eaSJerome Leveque *(int32*)outputData = (int32)*(const int16*)inputData << 16;
405ea81d6eaSJerome Leveque
406ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
407ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
408ea81d6eaSJerome Leveque
409ea81d6eaSJerome Leveque sampleCount--;
410ea81d6eaSJerome Leveque }
411ea81d6eaSJerome Leveque }
412ea81d6eaSJerome Leveque
413ea81d6eaSJerome Leveque
414ea81d6eaSJerome Leveque void
_CopyShort2Short(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)4157633665cSJerome Duval Resampler::_CopyShort2Short(const void *inputData, uint32 inputStride,
4167633665cSJerome Duval void *outputData, uint32 outputStride, uint32 sampleCount)
4177633665cSJerome Duval {
4187633665cSJerome Duval while (sampleCount > 0) {
4197633665cSJerome Duval *(int16*)outputData = *(const int16*)inputData;
4207633665cSJerome Duval
4217633665cSJerome Duval outputData = (void*)((uint8*)outputData + outputStride);
4227633665cSJerome Duval inputData = (void*)((uint8*)inputData + inputStride);
4237633665cSJerome Duval
4247633665cSJerome Duval sampleCount--;
4257633665cSJerome Duval }
4267633665cSJerome Duval }
4277633665cSJerome Duval
4287633665cSJerome Duval
4297633665cSJerome Duval void
_CopyShort2UChar(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)430ea81d6eaSJerome Leveque Resampler::_CopyShort2UChar(const void *inputData, uint32 inputStride,
431ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
432ea81d6eaSJerome Leveque {
433ea81d6eaSJerome Leveque while (sampleCount > 0) {
434ea81d6eaSJerome Leveque *(uint8*)outputData = 128 + (*(const int16*)inputData >> 8);
435ea81d6eaSJerome Leveque
436ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
437ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
438ea81d6eaSJerome Leveque
439ea81d6eaSJerome Leveque sampleCount--;
440ea81d6eaSJerome Leveque }
441ea81d6eaSJerome Leveque }
442ea81d6eaSJerome Leveque
443ea81d6eaSJerome Leveque
444ea81d6eaSJerome Leveque void
_CopyShort2Char(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)445ea81d6eaSJerome Leveque Resampler::_CopyShort2Char(const void *inputData, uint32 inputStride,
446ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
447ea81d6eaSJerome Leveque {
448ea81d6eaSJerome Leveque while (sampleCount > 0) {
449ea81d6eaSJerome Leveque *(int8*)outputData = *(const int16*)inputData >> 8;
450ea81d6eaSJerome Leveque
451ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
452ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
453ea81d6eaSJerome Leveque
454ea81d6eaSJerome Leveque sampleCount--;
455ea81d6eaSJerome Leveque }
456ea81d6eaSJerome Leveque }
457ea81d6eaSJerome Leveque
458ea81d6eaSJerome Leveque
459ea81d6eaSJerome Leveque void
_CopyInt2Float(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)460ea81d6eaSJerome Leveque Resampler::_CopyInt2Float(const void *inputData, uint32 inputStride,
461ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
462ea81d6eaSJerome Leveque {
463ea81d6eaSJerome Leveque while (sampleCount > 0) {
464ea81d6eaSJerome Leveque *(float*)outputData = *(const int32*)inputData / 2147483647.0f;
465ea81d6eaSJerome Leveque
466ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
467ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
468ea81d6eaSJerome Leveque
469ea81d6eaSJerome Leveque sampleCount--;
470ea81d6eaSJerome Leveque }
471ea81d6eaSJerome Leveque }
472ea81d6eaSJerome Leveque
473ea81d6eaSJerome Leveque
474ea81d6eaSJerome Leveque void
_CopyInt2Double(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)475ea81d6eaSJerome Leveque Resampler::_CopyInt2Double(const void *inputData, uint32 inputStride,
476ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
477ea81d6eaSJerome Leveque {
478ea81d6eaSJerome Leveque while (sampleCount > 0) {
479ea81d6eaSJerome Leveque *(double*)outputData = *(const int32*)inputData / 2147483647.0;
480ea81d6eaSJerome Leveque
481ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
482ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
483ea81d6eaSJerome Leveque
484ea81d6eaSJerome Leveque sampleCount--;
485ea81d6eaSJerome Leveque }
486ea81d6eaSJerome Leveque }
487ea81d6eaSJerome Leveque
488ea81d6eaSJerome Leveque
489ea81d6eaSJerome Leveque void
_CopyInt2Int(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)4907633665cSJerome Duval Resampler::_CopyInt2Int(const void *inputData, uint32 inputStride,
4917633665cSJerome Duval void *outputData, uint32 outputStride, uint32 sampleCount)
4927633665cSJerome Duval {
4937633665cSJerome Duval while (sampleCount > 0) {
4947633665cSJerome Duval *(int32*)outputData = *(const int32*)inputData;
4957633665cSJerome Duval
4967633665cSJerome Duval outputData = (void*)((uint8*)outputData + outputStride);
4977633665cSJerome Duval inputData = (void*)((uint8*)inputData + inputStride);
4987633665cSJerome Duval
4997633665cSJerome Duval sampleCount--;
5007633665cSJerome Duval }
5017633665cSJerome Duval }
5027633665cSJerome Duval
5037633665cSJerome Duval
5047633665cSJerome Duval void
_CopyInt2Short(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)505ea81d6eaSJerome Leveque Resampler::_CopyInt2Short(const void *inputData, uint32 inputStride,
506ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
507ea81d6eaSJerome Leveque {
508ea81d6eaSJerome Leveque while (sampleCount > 0) {
509ea81d6eaSJerome Leveque *(int16*)outputData = *(const int32*)inputData >> 16;
510ea81d6eaSJerome Leveque
511ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
512ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
513ea81d6eaSJerome Leveque
514ea81d6eaSJerome Leveque sampleCount--;
515ea81d6eaSJerome Leveque }
516ea81d6eaSJerome Leveque }
517ea81d6eaSJerome Leveque
518ea81d6eaSJerome Leveque
519ea81d6eaSJerome Leveque void
_CopyInt2UChar(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)520ea81d6eaSJerome Leveque Resampler::_CopyInt2UChar(const void *inputData, uint32 inputStride,
521ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
522ea81d6eaSJerome Leveque {
523ea81d6eaSJerome Leveque while (sampleCount > 0) {
524ea81d6eaSJerome Leveque *(uint8*)outputData = 128 + (*(const int32*)inputData >> 24);
525ea81d6eaSJerome Leveque
526ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
527ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
528ea81d6eaSJerome Leveque
529ea81d6eaSJerome Leveque sampleCount--;
530ea81d6eaSJerome Leveque }
531ea81d6eaSJerome Leveque }
532ea81d6eaSJerome Leveque
533ea81d6eaSJerome Leveque
534ea81d6eaSJerome Leveque void
_CopyInt2Char(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)535ea81d6eaSJerome Leveque Resampler::_CopyInt2Char(const void *inputData, uint32 inputStride,
536ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
537ea81d6eaSJerome Leveque {
538ea81d6eaSJerome Leveque while (sampleCount > 0) {
539ea81d6eaSJerome Leveque *(uint8*)outputData = *(const int32*)inputData >> 24;
540ea81d6eaSJerome Leveque
541ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
542ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
543ea81d6eaSJerome Leveque
544ea81d6eaSJerome Leveque sampleCount--;
545ea81d6eaSJerome Leveque }
546ea81d6eaSJerome Leveque }
547ea81d6eaSJerome Leveque
548ea81d6eaSJerome Leveque
549ea81d6eaSJerome Leveque void
_CopyUChar2Float(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)550ea81d6eaSJerome Leveque Resampler::_CopyUChar2Float(const void *inputData, uint32 inputStride,
551ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
552ea81d6eaSJerome Leveque {
553ea81d6eaSJerome Leveque while (sampleCount > 0) {
554ea81d6eaSJerome Leveque *(float*)outputData = (*(const uint8*)inputData - 128) / 127.0f;
555ea81d6eaSJerome Leveque
556ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
557ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
558ea81d6eaSJerome Leveque
559ea81d6eaSJerome Leveque sampleCount--;
560ea81d6eaSJerome Leveque }
561ea81d6eaSJerome Leveque }
562ea81d6eaSJerome Leveque
563ea81d6eaSJerome Leveque
564ea81d6eaSJerome Leveque void
_CopyUChar2Double(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)565ea81d6eaSJerome Leveque Resampler::_CopyUChar2Double(const void *inputData, uint32 inputStride,
566ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
567ea81d6eaSJerome Leveque {
568ea81d6eaSJerome Leveque while (sampleCount > 0) {
569ea81d6eaSJerome Leveque *(double*)outputData = (*(const uint8*)inputData - 128) / 127.0;
570ea81d6eaSJerome Leveque
571ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
572ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
573ea81d6eaSJerome Leveque
574ea81d6eaSJerome Leveque sampleCount--;
575ea81d6eaSJerome Leveque }
576ea81d6eaSJerome Leveque }
577ea81d6eaSJerome Leveque
578ea81d6eaSJerome Leveque
579ea81d6eaSJerome Leveque void
_CopyUChar2Short(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)580ea81d6eaSJerome Leveque Resampler::_CopyUChar2Short(const void *inputData, uint32 inputStride,
581ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
582ea81d6eaSJerome Leveque {
583ea81d6eaSJerome Leveque while (sampleCount > 0) {
584ea81d6eaSJerome Leveque *(int16*)outputData = (int16)(*(const uint8*)inputData - 128) << 8;
585ea81d6eaSJerome Leveque
586ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
587ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
588ea81d6eaSJerome Leveque
589ea81d6eaSJerome Leveque sampleCount--;
590ea81d6eaSJerome Leveque }
591ea81d6eaSJerome Leveque }
592ea81d6eaSJerome Leveque
593ea81d6eaSJerome Leveque
594ea81d6eaSJerome Leveque void
_CopyUChar2Int(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)595ea81d6eaSJerome Leveque Resampler::_CopyUChar2Int(const void *inputData, uint32 inputStride,
596ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
597ea81d6eaSJerome Leveque {
598ea81d6eaSJerome Leveque while (sampleCount > 0) {
599ea81d6eaSJerome Leveque *(int32*)outputData = (int32)(*(const uint8*)inputData - 128) << 24;
600ea81d6eaSJerome Leveque
601ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
602ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
603ea81d6eaSJerome Leveque
604ea81d6eaSJerome Leveque sampleCount--;
605ea81d6eaSJerome Leveque }
606ea81d6eaSJerome Leveque }
607ea81d6eaSJerome Leveque
608ea81d6eaSJerome Leveque
609ea81d6eaSJerome Leveque void
_CopyUChar2UChar(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)6107633665cSJerome Duval Resampler::_CopyUChar2UChar(const void *inputData, uint32 inputStride,
6117633665cSJerome Duval void *outputData, uint32 outputStride, uint32 sampleCount)
6127633665cSJerome Duval {
6137633665cSJerome Duval while (sampleCount > 0) {
6147633665cSJerome Duval *(uint8*)outputData = *(const uint8*)inputData;
6157633665cSJerome Duval
6167633665cSJerome Duval outputData = (void*)((uint8*)outputData + outputStride);
6177633665cSJerome Duval inputData = (void*)((uint8*)inputData + inputStride);
6187633665cSJerome Duval
6197633665cSJerome Duval sampleCount--;
6207633665cSJerome Duval }
6217633665cSJerome Duval }
6227633665cSJerome Duval
6237633665cSJerome Duval
6247633665cSJerome Duval void
_CopyUChar2Char(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)625ea81d6eaSJerome Leveque Resampler::_CopyUChar2Char(const void *inputData, uint32 inputStride,
626ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
627ea81d6eaSJerome Leveque {
628ea81d6eaSJerome Leveque while (sampleCount > 0) {
629ea81d6eaSJerome Leveque *(int8*)outputData = *(const uint8*)inputData - 128;
630ea81d6eaSJerome Leveque
631ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
632ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
633ea81d6eaSJerome Leveque
634ea81d6eaSJerome Leveque sampleCount--;
635ea81d6eaSJerome Leveque }
636ea81d6eaSJerome Leveque }
637ea81d6eaSJerome Leveque
638ea81d6eaSJerome Leveque
639ea81d6eaSJerome Leveque void
_CopyChar2Float(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)640ea81d6eaSJerome Leveque Resampler::_CopyChar2Float(const void *inputData, uint32 inputStride,
641ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
642ea81d6eaSJerome Leveque {
643ea81d6eaSJerome Leveque while (sampleCount > 0) {
644ea81d6eaSJerome Leveque *(float*)outputData = *(const int8*)inputData / 127.0f;
645ea81d6eaSJerome Leveque
646ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
647ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
648ea81d6eaSJerome Leveque
649ea81d6eaSJerome Leveque sampleCount--;
650ea81d6eaSJerome Leveque }
651ea81d6eaSJerome Leveque }
652ea81d6eaSJerome Leveque
653ea81d6eaSJerome Leveque
654ea81d6eaSJerome Leveque void
_CopyChar2Double(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)655ea81d6eaSJerome Leveque Resampler::_CopyChar2Double(const void *inputData, uint32 inputStride,
656ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
657ea81d6eaSJerome Leveque {
658ea81d6eaSJerome Leveque while (sampleCount > 0) {
659ea81d6eaSJerome Leveque *(double*)outputData = *(const int8*)inputData / 127.0;
660ea81d6eaSJerome Leveque
661ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
662ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
663ea81d6eaSJerome Leveque
664ea81d6eaSJerome Leveque sampleCount--;
665ea81d6eaSJerome Leveque }
666ea81d6eaSJerome Leveque }
667ea81d6eaSJerome Leveque
668ea81d6eaSJerome Leveque
669ea81d6eaSJerome Leveque void
_CopyChar2Short(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)670ea81d6eaSJerome Leveque Resampler::_CopyChar2Short(const void *inputData, uint32 inputStride,
671ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
672ea81d6eaSJerome Leveque {
673ea81d6eaSJerome Leveque while (sampleCount > 0) {
674ea81d6eaSJerome Leveque *(int16*)outputData = ((int16)*(const int8*)inputData) << 8;
675ea81d6eaSJerome Leveque
676ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
677ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
678ea81d6eaSJerome Leveque
679ea81d6eaSJerome Leveque sampleCount--;
680ea81d6eaSJerome Leveque }
681ea81d6eaSJerome Leveque }
682ea81d6eaSJerome Leveque
683ea81d6eaSJerome Leveque
684ea81d6eaSJerome Leveque void
_CopyChar2Int(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)685ea81d6eaSJerome Leveque Resampler::_CopyChar2Int(const void *inputData, uint32 inputStride,
686ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
687ea81d6eaSJerome Leveque {
688ea81d6eaSJerome Leveque while (sampleCount > 0) {
689ea81d6eaSJerome Leveque *(int32*)outputData = ((int16)*(const int8*)inputData) << 24;
690ea81d6eaSJerome Leveque
691ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
692ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
693ea81d6eaSJerome Leveque
694ea81d6eaSJerome Leveque sampleCount--;
695ea81d6eaSJerome Leveque }
696ea81d6eaSJerome Leveque }
697ea81d6eaSJerome Leveque
698ea81d6eaSJerome Leveque
699ea81d6eaSJerome Leveque void
_CopyChar2UChar(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)700ea81d6eaSJerome Leveque Resampler::_CopyChar2UChar(const void *inputData, uint32 inputStride,
701ea81d6eaSJerome Leveque void *outputData, uint32 outputStride, uint32 sampleCount)
702ea81d6eaSJerome Leveque {
703ea81d6eaSJerome Leveque while (sampleCount > 0) {
704ea81d6eaSJerome Leveque *(uint8*)outputData = *(const int8*)inputData + 128;
705ea81d6eaSJerome Leveque
706ea81d6eaSJerome Leveque outputData = (void*)((uint8*)outputData + outputStride);
707ea81d6eaSJerome Leveque inputData = (void*)((uint8*)inputData + inputStride);
708ea81d6eaSJerome Leveque
709ea81d6eaSJerome Leveque sampleCount--;
710ea81d6eaSJerome Leveque }
711ea81d6eaSJerome Leveque }
712ea81d6eaSJerome Leveque
7137633665cSJerome Duval
7147633665cSJerome Duval void
_CopyChar2Char(const void * inputData,uint32 inputStride,void * outputData,uint32 outputStride,uint32 sampleCount)7157633665cSJerome Duval Resampler::_CopyChar2Char(const void *inputData, uint32 inputStride,
7167633665cSJerome Duval void *outputData, uint32 outputStride, uint32 sampleCount)
7177633665cSJerome Duval {
7187633665cSJerome Duval while (sampleCount > 0) {
7197633665cSJerome Duval *(int8*)outputData = *(const int8*)inputData;
7207633665cSJerome Duval
7217633665cSJerome Duval outputData = (void*)((uint8*)outputData + outputStride);
7227633665cSJerome Duval inputData = (void*)((uint8*)inputData + inputStride);
7237633665cSJerome Duval
7247633665cSJerome Duval sampleCount--;
7257633665cSJerome Duval }
7267633665cSJerome Duval }
7277633665cSJerome Duval
728