Commit Graph

5782 Commits

Author SHA1 Message Date
Chris Robinson 95631aa358 Make the Compressor more class-like 2018-12-24 09:17:00 -08:00
Chris Robinson d49eeb576c Only check ambisonic attributes with B-Format output 2018-12-24 07:33:38 -08:00
Chris Robinson 68352d3188 Apply the limiter before distance compensation 2018-12-24 07:30:01 -08:00
Chris Robinson ef10152361 Assume alignment for some buffers 2018-12-23 20:56:27 -08:00
Chris Robinson 1f966c11ef Add some more ASSUMEs 2018-12-23 17:56:01 -08:00
Chris Robinson 11d815cfd3 Repack some AmbiUpsampler fields for better access patterns 2018-12-23 15:55:12 -08:00
Chris Robinson ba9aba699d Properly rebalance the HF scale with ambisonic upsampling 2018-12-23 10:37:07 -08:00
Chris Robinson 3fe38fed7c Mix effect slot output to the effect target if it's set 2018-12-23 08:51:28 -08:00
Chris Robinson e218999b4f Dynamically sort the effect slots when mixing
This is to be able to support effects that output to other effects. When an
effect outputs to another effect, the former needs to process first, so the
former mixes to the latter's buffer before the latter is processed.

This sorting needs to happen in the mixer because the effect slot's "Target"
property changes asynchronously.
2018-12-22 22:31:26 -08:00
Chris Robinson ebfe818d2e Fix narrowing conversion from double to float 2018-12-22 20:32:00 -08:00
Chris Robinson bfa98be48a Cleanup definitions and declarations in reverb.cpp 2018-12-22 19:31:12 -08:00
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