41 Commits

Author SHA1 Message Date
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
0dd13a9dfe Make the AmbDec speaker and matrix arrays dynamic 2018-12-15 02:56:19 -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
b779ebb512 Fix some MSVC conversion warnings 2018-12-12 21:18:31 -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
Chris Robinson
0d56c59f14 Avoid some more explicit loops 2018-12-10 00:01:13 -08:00
Chris Robinson
0a805727db Use std::accumulate to find the max channel count 2018-12-09 18:16:00 -08:00
Chris Robinson
b1beb7dfdc Avoid some more explicit loops 2018-12-09 17:24:00 -08:00
Chris Robinson
efb8e076c7 Pass a reference to an array for a function parameter 2018-12-09 15:21:24 -08:00
Chris Robinson
c9f5617f06 Avoid several uses of memset 2018-12-08 14:22:20 -08:00
Chris Robinson
5ea3c8fb60 Use member functions for BFormatDec and AmbiUpsampler 2018-12-08 02:50:34 -08:00
Chris Robinson
7695afe0cb Clean up some more loops 2018-12-08 02:15:00 -08:00
Chris Robinson
42d26472eb Remove some more explicit loops 2018-12-05 17:11:33 -08:00
Chris Robinson
e60d0886d0 Use class methods for BandSplitter and SplitterAllpass filters 2018-12-05 15:38:05 -08:00
Chris Robinson
438e626993 Avoid a couple explicit loops 2018-11-22 22:53:22 -08:00
Chris Robinson
9c155a57fb Use unique_ptr for DirectHrtfState 2018-11-22 07:54:29 -08:00
Chris Robinson
ab6db9a589 Clean up some unnecessary specifiers 2018-11-22 06:59:32 -08:00
Chris Robinson
9d73e03aaa Use unique_ptr for bs2b 2018-11-22 06:49:37 -08:00
Chris Robinson
b3b4220182 Use unique_ptr for BFormatDec and AmbiUpsampler 2018-11-22 05:37:35 -08:00
Chris Robinson
671ed1abf8 Use a unique_ptr for the FrontStablizer 2018-11-22 04:53:29 -08:00
Chris Robinson
eefc379a23 Use a unique_ptr for Uhj2Encoder 2018-11-21 15:31:32 -08:00
Chris Robinson
757c42c74b Use a normal vector for the distance buffer storage 2018-11-21 05:06:31 -08:00
Chris Robinson
d64d64d4a5 Use an enum class for AmbiLayout/Norm settings 2018-11-20 22:47:24 -08:00
Chris Robinson
140c139852 Use a standard string for the device's HRTF name 2018-11-18 19:28:01 -08:00
Chris Robinson
2c06ec7093 Use a regular vector for the enumerated HRTF list 2018-11-18 19:19:35 -08:00
Chris Robinson
bafcba7194 Use a std::string for the device name 2018-11-18 18:45:45 -08:00
Chris Robinson
8b8f01e25d Avoid more cases of an enum variable and type name clash 2018-11-18 08:01:50 -08:00
Chris Robinson
d10301c209 Remove unused headers and checks 2018-11-17 19:52:54 -08:00
Chris Robinson
7b3a2085aa Use a regular char* for the device's name 2018-11-15 06:23:01 -08:00
Chris Robinson
ab9f8162b8 Pass a normal const char* to EnumerateHrtf 2018-11-15 05:38:27 -08:00
Chris Robinson
a6d780574d Make the enumerated HRTF entry name a char*
Would ideally be a std::string with the HRTF name itself, but they're still
seen in C code.
2018-11-12 22:26:12 -08:00
Chris Robinson
d4d0b1fdd4 Use a regular char* for the HRTF string name 2018-11-12 19:02:38 -08:00
Chris Robinson
96819237d6 Convert ambdec.c to C++ 2018-11-03 19:51:23 -07:00
Chris Robinson
4bfaa173c4 Convert panning.c to C++ 2018-11-03 19:05:23 -07:00