FastLED 3.9.15
Loading...
Searching...
No Matches

◆ PolyphaseStereo()

void fl::third_party::PolyphaseStereo ( short * pcm,
int32_t * vbuf,
const int32_t * coefBase )

Definition at line 243 of file polyphase.hpp.

244{
245 int i;
246 const int32_t *coef;
247 int32_t *vb1;
248 int vLo, vHi, c1, c2;
249 Word64 sum1L, sum2L, sum1R, sum2R, rndVal;
250
251 rndVal = (Word64)( (i64)1 << (DEF_NFRACBITS - 1 + (32 - CSHIFT)) );
252
253 /* special case, output sample 0 */
254 coef = coefBase;
255 vb1 = vbuf;
256 sum1L = sum1R = rndVal;
257
258 MC0S(0)
259 MC0S(1)
260 MC0S(2)
261 MC0S(3)
262 MC0S(4)
263 MC0S(5)
264 MC0S(6)
265 MC0S(7)
266
267 *(pcm + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
268 *(pcm + 1) = ClipToShort((int)SAR64(sum1R, (32-CSHIFT)), DEF_NFRACBITS);
269
270 /* special case, output sample 16 */
271 coef = coefBase + 256;
272 vb1 = vbuf + 64*16;
273 sum1L = sum1R = rndVal;
274
275 MC1S(0)
276 MC1S(1)
277 MC1S(2)
278 MC1S(3)
279 MC1S(4)
280 MC1S(5)
281 MC1S(6)
282 MC1S(7)
283
284 *(pcm + 2*16 + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
285 *(pcm + 2*16 + 1) = ClipToShort((int)SAR64(sum1R, (32-CSHIFT)), DEF_NFRACBITS);
286
287 /* main convolution loop: sum1L = samples 1, 2, 3, ... 15 sum2L = samples 31, 30, ... 17 */
288 coef = coefBase + 16;
289 vb1 = vbuf + 64;
290 pcm += 2;
291
292 /* right now, the compiler creates bad asm from this... */
293 for (i = 15; i > 0; i--) {
294 sum1L = sum2L = rndVal;
295 sum1R = sum2R = rndVal;
296
297 MC2S(0)
298 MC2S(1)
299 MC2S(2)
300 MC2S(3)
301 MC2S(4)
302 MC2S(5)
303 MC2S(6)
304 MC2S(7)
305
306 vb1 += 64;
307 *(pcm + 0) = ClipToShort((int)SAR64(sum1L, (32-CSHIFT)), DEF_NFRACBITS);
308 *(pcm + 1) = ClipToShort((int)SAR64(sum1R, (32-CSHIFT)), DEF_NFRACBITS);
309 *(pcm + 2*2*i + 0) = ClipToShort((int)SAR64(sum2L, (32-CSHIFT)), DEF_NFRACBITS);
310 *(pcm + 2*2*i + 1) = ClipToShort((int)SAR64(sum2R, (32-CSHIFT)), DEF_NFRACBITS);
311 pcm += 2;
312 }
313}
static __inline short ClipToShort(int x, int fracBits) FL_NOEXCEPT
Definition polyphase.hpp:74
fl::i64 i64
Definition coder.h:222
fl::i32 int32_t
Definition coder.h:220
long long Word64
Definition assembly.h:498
__inline Word64 SAR64(Word64 x, int n) FL_NOEXCEPT
Shift right.
Definition assembly.h:564
#define MC2S(x)
#define DEF_NFRACBITS
Definition polyphase.hpp:71
#define MC0S(x)
#define CSHIFT
Definition polyphase.hpp:72
#define MC1S(x)

References ClipToShort(), CSHIFT, DEF_NFRACBITS, FL_NOEXCEPT, MC0S, MC1S, MC2S, and SAR64().

Referenced by Subband().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: