6071 Commits

Author SHA1 Message Date
Chris Robinson
86caf2683e Constify a parameter 2018-12-22 18:43:34 -08:00
Chris Robinson
334b3a905a Clean up some math stuff 2018-12-22 16:01:14 -08:00
Chris Robinson
d4d98e2fe9 Fix for C++11 compatibility
std::array::operator[] isn't constexpr until C++14.
2018-12-22 11:41:03 -08:00
Chris Robinson
10ce121dbd Use a normal delete instead of ll_ringbuffer_free
And use RingBufferPtr in more places
2018-12-22 11:38:38 -08:00
Chris Robinson
b955c5cf5d A bit of cleanup for CalcPanningAndFilters 2018-12-22 10:00:06 -08:00
Chris Robinson
87724db6e3 Rename a couple HRTF structs 2018-12-22 09:20:50 -08:00
Chris Robinson
985d03d13d Try to help GetHrtfCoeffs vectorize 2018-12-21 21:07:42 -08:00
Chris Robinson
5e4378f30a Small cleanup for BuildBFormatHrtf 2018-12-21 18:17:59 -08:00
Chris Robinson
3553ce1f67 Don't convert the HRTF decoder virtual speaker positions to radians 2018-12-21 08:55:22 -08:00
Chris Robinson
b785d80526 Use a dodecahedron for the ambisonic HRTF decode
Also uses full second-order for "basic" HRTF rendering. Note that the supplied
matrix is full third-order, but only the first- and second-order coefficients
are used. The base matrices are the identical, only differing by the high-
frequency scalars.
2018-12-21 06:32:18 -08:00
Chris Robinson
7744e4ff72 Pass RealMixParams by reference instead of pointer 2018-12-20 13:26:39 -08:00
Chris Robinson
9fde260df9 Fix the type used for another subtraction 2018-12-20 12:29:46 -08:00
Chris Robinson
768ed3cfbb Silence some MSVC warnings 2018-12-20 12:04:34 -08:00
Chris Robinson
837881eb79 Fix the type used for subtraction 2018-12-20 12:03:32 -08:00
Chris Robinson
7dc553350b Clean up most of the compressor loops 2018-12-20 11:46:57 -08:00
Chris Robinson
08b79b9bbf Add an assume_aligned helper 2018-12-20 11:46:40 -08:00
Chris Robinson
10f87c5d26 Use std::accumulate to get the max composited buffer length loaded 2018-12-20 07:10:09 -08:00
Chris Robinson
49ac268334 Add index maps from 2D and 3D 2018-12-20 04:19:35 -08:00
Chris Robinson
8d3f7651c9 Use std::array in place of some C-style arrays 2018-12-20 03:26:46 -08:00
Chris Robinson
d18140391a Rename some conversion arrays 2018-12-20 02:46:59 -08:00
Chris Robinson
0214a11024 Use inline methods for the device format sizes 2018-12-19 05:57:36 -08:00
Chris Robinson
b49e8985a4 Don't hardcode the channel count from the device ambisonic order 2018-12-19 03:13:15 -08:00
Chris Robinson
fbd47961d5 Don't allow FuMa ordering or normalization above third-order 2018-12-19 02:55:21 -08:00
Chris Robinson
e2896dc839 Combine handling of attribute processing 2018-12-18 09:27:00 -08:00
Chris Robinson
5243516149 Use the AmbiUpsampler with higher order basic and custom panning
Also allocate the BFormatDec and AmbiUpsampler where they're (re)set.
2018-12-17 07:29:55 -08:00
Chris Robinson
59013b5cb5 Avoid hard-coded scale factors in BFormatDec's upsampler 2018-12-17 07:12:37 -08:00
Chris Robinson
a359cb85e6 Mix each frequency band individually for ambisonic upsampling 2018-12-16 22:37:29 -08:00
Chris Robinson
3b0fd20bee Always use the transcode method with the AmbiUpsampler 2018-12-16 21:03:24 -08:00
Chris Robinson
064f4f500a Avoid extraneous alignment requirements 2018-12-16 01:27:52 -08:00
Chris Robinson
741861eaa6 Put the ACN index map in a header
Also put it and the Ambisonic scales in a more appropriate header.
2018-12-15 23:28:49 -08:00
Chris Robinson
a6a5634adb Reorder some math terms to help optimizations
Because floating-point math is not associative ((a*b)*c does not necessarily
give the same result as a*(b*c)), the ordering of terms can inhibit reuse of
temporary values. For example, both

coeffs[9]  =  2.091650066f * y * (3.0f*x*x - y*y);
and
coeffs[15] =  2.091650066f * x * (x*x - 3.0f*y*y);

contain x*x and y*y terms that could be calculated once, stored in temporary
registers, and reused to multiply with 3. But since 3.0f*(x*x) would produce
different results, the compiler is not allowed to make that optimization. If,
however, the multiply with 3 is moved to the right side:

coeffs[9]  =  2.091650066f * y * (x*x*3.0f - y*y);
and
coeffs[15] =  2.091650066f * x * (x*x - y*y*3.0f);

in both cases x*x and y*y are calculated first in their respective groups,
guaranteeing the same results for both instances prior to the multiply with 3
and allowing the compiler to reuse those intermediate values.
2018-12-15 20:28:52 -08:00
Chris Robinson
dea077cbae Add encoding calculations for fourth-order ambisonics 2018-12-15 19:23:42 -08:00
Chris Robinson
e0f635b20d Move some ambisonic-related macros to a separate header 2018-12-15 03:30:47 -08:00
Chris Robinson
0dd13a9dfe Make the AmbDec speaker and matrix arrays dynamic 2018-12-15 02:56:19 -08:00
Chris Robinson
640c06c292 Avoid some explicit loop counts 2018-12-15 01:48:54 -08:00
Chris Robinson
4d36730baa Clean up panning.cpp a bit 2018-12-15 00:38:38 -08:00
Chris Robinson
2d13e0af29 Add macros for the ambisonic order masks 2018-12-14 23:26:44 -08:00
Chris Robinson
0882728dec Cleanup bformatdec.cpp a bit 2018-12-13 22:48:02 -08:00
Chris Robinson
d18ae81e9c Add POPCNT32 and CTZ32 macros 2018-12-13 22:05:47 -08:00
Chris Robinson
0d73b13f59 Add more casts for MSVC 2018-12-12 21:58:41 -08:00
Chris Robinson
b779ebb512 Fix some MSVC conversion warnings 2018-12-12 21:18:31 -08:00
Chris Robinson
b37bc9f8b7 Fix an MSVC warning 2018-12-12 19:24:06 -08:00
Chris Robinson
43f6a7c626 Remove an unused source 2018-12-12 04:34:09 -08:00
Chris Robinson
5a283c66ee Use proper classes for Vector and Matrix types 2018-12-12 04:22:11 -08:00
Chris Robinson
19c5c41c70 Cleanup alu.cpp some 2018-12-12 01:09:04 -08:00
Chris Robinson
0d36ba0fbb Use helpers to get the Ambisonic scales and layout maps 2018-12-10 22:35:32 -08:00
Chris Robinson
e87eb07db4 A bit more cleanup 2018-12-10 21:30:22 -08:00
Chris Robinson
ed18fd76c5 Clean up a few more loops 2018-12-10 14:49:57 -08:00
Chris Robinson
d91ada2e02 Add missing header 2018-12-10 02:13:57 -08:00
Chris Robinson
9bb7ed0129 Put static methods into an anonymous namespace 2018-12-10 02:08:54 -08:00