65 Commits

Author SHA1 Message Date
Chris Robinson
c8f67cffc5 Use a more appropriate size value for copying 2020-06-07 11:00:19 -07:00
Chris Robinson
70d345bbf2 Avoid convolving an always-0 sample 2020-05-30 16:29:23 -07:00
Chris Robinson
4e82feffef Only apply non-silent inputs for blended HRIR 2020-05-25 16:37:31 -07:00
Chris Robinson
5eb1ae5a14 Simplify the HRTF blending fade out gain scaling 2020-05-25 13:18:10 -07:00
Chris Robinson
e880c04f32 Clarify a comment about the band-splitter 2020-05-20 11:22:53 -07:00
Chris Robinson
200c164d78 Improve HRTF delay handling
Ensures source-level HRTF, the dry mix, and direct output all align properly,
and simplifies adding the delay in the direct mix output.
2020-05-20 11:13:06 -07:00
Chris Robinson
f38b813ba8 Fix some comments 2020-05-19 18:22:38 -07:00
Chris Robinson
19baf646d2 Rename applyHfScale to processHfScale 2020-05-19 13:58:55 -07:00
Chris Robinson
825206bfa2 Apply the ambisonic HF scaling in real-time with HRTF
Rather than applying the HF scale to the IRs necessitating them to be truncated
along with increasing the IR size, it can be applied to the input signal for
the same results. Consequently, the IR size can be notably shortened while
avoiding the extra truncation. In its place, the delayed reversed all-pass
technique can still be used on the input for maintaining phase when applying
the bandsplit/hfscalar filter to the input signal.
2020-05-19 10:27:52 -07:00
Chris Robinson
2f8f829772 Properly count the last number of samples to mix 2020-05-12 04:45:25 -07:00
Chris Robinson
b52fde7c0e Simplify SIMD linear resampler loop count 2020-05-02 20:27:05 -07:00
Chris Robinson
b051f2e33d Use a matching type given the initializer 2020-05-02 19:24:21 -07:00
Chris Robinson
6823fa2de2 Improve the leftover and realignment mixing loops
Using a mask helps the compiler recognize that the leftover (any remaining non-
multiple-of-4) and realignment loops will only have 3 iterations at most, which
it can unroll or otherwise make more meaningful optimizations for. Previously
it would try to vectorize and partially unroll the loops, which is wasteful
when there would never be enough to vectorize.
2020-05-02 16:42:24 -07:00
Chris Robinson
3898b77dd6 Avoid iterators for the main mixer 2020-05-01 21:14:41 -07:00
Chris Robinson
8acf16fc82 Make BuildBFormatHrtf a member of DirectHrtfState 2020-05-01 10:28:16 -07:00
Chris Robinson
ae09e1f60c Don't truncate odd IR sizes with SSE 2020-04-30 20:33:35 -07:00
Chris Robinson
6bc3ae178e Use a more efficient type for holding the IrSize 2020-04-30 17:03:56 -07:00
Chris Robinson
dc41f276d8 Get rid of the specialized MixRow_ methods 2020-04-16 01:47:33 -07:00
Chris Robinson
1130597562 Use structs for the mixer and resampler tags 2020-04-03 03:52:23 -07:00
Chris Robinson
d9225083b4 Avoid using ALfloat in the mixer functions 2020-04-03 03:11:32 -07:00
Chris Robinson
236564b54a Another small cleanup 2020-04-03 02:57:51 -07:00
Chris Robinson
8adbde90f5 Jump to the target gain if the fade amount is small 2020-04-03 02:48:35 -07:00
Chris Robinson
367d4af07c Avoid unnecessary duplication in the resamplers 2020-04-03 02:39:23 -07:00
Chris Robinson
8853519d89 Generate the bsinc tables using constexpr methods
All the methods used should be compliant with C++14 constexpr rules. However,
the number of scales and phases cause GenerateBSincCoeffs to reach the allowed
step limit, preventing full compile-time generation. It's not a terribly big
deal, it'll generate them very quickly when loading, but it does prevent using
shared read-only memory pages.
2020-04-02 00:49:19 -07:00
Chris Robinson
54b49594e6 Simplify post-mix HRTF gain storage 2020-01-05 17:12:48 -08:00
Chris Robinson
ac7a5dcbfa Use size_t for array indices 2019-12-11 02:44:05 -08:00
Chris Robinson
053de62398 Don't force the HRIR length to a rounded value
The coefficient and accumulation buffers are guaranteed large enough for the
full size, and the SIMD handlers will behave the same either way.
2019-12-11 02:24:44 -08:00
Chris Robinson
7ff165b095 Use unsigned for array indices 2019-11-29 08:33:46 -08:00
Chris Robinson
d2608e4bde Avoid holding HRTF accumulation samples per-source
It notably simplifies things to mix HRTF sources into an accumulation buffer
together, which the Dry buffer's Ambisonic-to-HRTF decode is then added to,
before being mixed to the Real output.
2019-11-03 00:30:33 -07:00
Chris Robinson
1bb93f4fc2 Avoid direct function template and alias types
It's somewhat ambiguous what they mean. Sometimes acting as a pointer, other
times having weird behavior. Pointer-to-function types are explicitly defined
as such, whereas uses of these tend to be as references (never null and not
changeable).
2019-10-03 04:22:39 -07:00
Chris Robinson
b350ae3766 Remove the Offset parameter from ApplyCoeffs 2019-10-02 22:38:19 -07:00
Chris Robinson
50198ee30c Clean up some ALfloat -> float 2019-10-02 17:07:23 -07:00
Chris Robinson
64e2c377d8 Move ALvoice from alu.h to a separate header 2019-10-02 16:53:23 -07:00
Chris Robinson
c833af9ecd Repack the bsinc resamplers coefficients
This puts the base coefficients and the phase deltas next to each other. This
improves caching, as the base and phase deltas are always used together while
the scales are only used for the non-fast versions.
2019-09-29 23:39:04 -07:00
Chris Robinson
9b64e5e0db Implement a "fast" bsinc path
This takes advantage of the fact than when increment <= 1 (when not down-
sampling), the scale factor is always 0. As a result, the scale and scale-phase
deltas never contribute to the filtered output. Removing those multiply+add
operations cuts half of the work done by the inner loop.

Sounds that do need to down-sample (when played with a high pitch, or is 48khz
on 44.1khz output, for example), still go through the normal bsinc process.
2019-09-26 19:24:29 -07:00
Chris Robinson
aca9f4e095 Make the bsinc l and m coefficients unsigned 2019-09-17 18:38:46 -07:00
Chris Robinson
650764775f Fix typo 2019-09-16 07:50:39 -07:00
Chris Robinson
bf2c865d39 Clean up some more shadowing warnings 2019-09-16 07:16:31 -07:00
Chris Robinson
4b8f78a8d6 Fix a few more GCC warnings 2019-09-14 19:42:54 -07:00
Chris Robinson
2c348cecb6 Fix some more implicit conversions noted by GCC 2019-09-14 18:35:23 -07:00
Chris Robinson
f09734b707 Pass IrSize to the HRTF mixers as unsigned 2019-09-13 11:19:11 -07:00
Chris Robinson
4254888576 Make IrSize unsigned 2019-09-13 09:38:35 -07:00
Chris Robinson
c1690178ec Make the resampler increment unsigned 2019-09-13 03:25:13 -07:00
Chris Robinson
1a9f1e0869 Fix a few more C-style casts 2019-09-11 08:08:23 -07:00
Chris Robinson
e873165019 Only ASSUME values where a variable is used 2019-09-04 19:31:30 -07:00
Chris Robinson
8940bbd034 Only use one accumulation buffer for B-Format HRTF mixing
It's all getting added together anyway and all channels are continuous inputs,
so this is fewer passes over various buffers.
2019-09-03 23:19:24 -07:00
Chris Robinson
3973334a64 Store the voice fraction offset as unsigned 2019-08-31 15:49:34 -07:00
Chris Robinson
b7ab8b6896 Fix a variable declaration 2019-08-22 18:53:09 -07:00
Chris Robinson
7ad2ed965c Avoid reading from pointers to __m128 values 2019-08-21 07:43:28 -07:00
Chris Robinson
3a6676b61e Fix NEON store call 2019-08-20 12:19:38 -07:00