Remove a left-over assignment
[openal-soft.git] / core / bformatdec.h
blobb86f771da15cc5f423db3709b9fbe615d9ea1c87
1 #ifndef CORE_BFORMATDEC_H
2 #define CORE_BFORMATDEC_H
4 #include <array>
5 #include <cstddef>
6 #include <memory>
7 #include <variant>
8 #include <vector>
10 #include "alspan.h"
11 #include "ambidefs.h"
12 #include "bufferline.h"
13 #include "devformat.h"
14 #include "filters/splitter.h"
15 #include "front_stablizer.h"
16 #include "opthelpers.h"
19 using ChannelDec = std::array<float,MaxAmbiChannels>;
21 class SIMDALIGN BFormatDec {
22 static constexpr size_t sHFBand{0};
23 static constexpr size_t sLFBand{1};
24 static constexpr size_t sNumBands{2};
26 struct ChannelDecoderSingle {
27 std::array<float,MaxOutputChannels> mGains{};
30 struct ChannelDecoderDual {
31 BandSplitter mXOver;
32 std::array<std::array<float,MaxOutputChannels>,sNumBands> mGains{};
35 alignas(16) std::array<FloatBufferLine,2> mSamples{};
37 const std::unique_ptr<FrontStablizer> mStablizer;
39 std::variant<std::vector<ChannelDecoderSingle>,std::vector<ChannelDecoderDual>> mChannelDec;
41 public:
42 BFormatDec(const size_t inchans, const al::span<const ChannelDec> coeffs,
43 const al::span<const ChannelDec> coeffslf, const float xover_f0norm,
44 std::unique_ptr<FrontStablizer> stablizer);
46 [[nodiscard]] auto hasStablizer() const noexcept -> bool { return mStablizer != nullptr; }
48 /* Decodes the ambisonic input to the given output channels. */
49 void process(const al::span<FloatBufferLine> OutBuffer,
50 const al::span<const FloatBufferLine> InSamples, const size_t SamplesToDo);
52 /* Decodes the ambisonic input to the given output channels with stablization. */
53 void processStablize(const al::span<FloatBufferLine> OutBuffer,
54 const al::span<const FloatBufferLine> InSamples, const size_t lidx, const size_t ridx,
55 const size_t cidx, const size_t SamplesToDo);
57 static std::unique_ptr<BFormatDec> Create(const size_t inchans,
58 const al::span<const ChannelDec> coeffs, const al::span<const ChannelDec> coeffslf,
59 const float xover_f0norm, std::unique_ptr<FrontStablizer> stablizer);
62 #endif /* CORE_BFORMATDEC_H */