5 #include "filters/splitter.h"
13 using ChannelDec
= ALfloat
[MAX_AMBI_COEFFS
];
16 static constexpr size_t sHFBand
{0};
17 static constexpr size_t sLFBand
{1};
18 static constexpr size_t sNumBands
{2};
20 ALuint mEnabled
; /* Bitfield of enabled channels. */
23 ALfloat Dual
[MAX_OUTPUT_CHANNELS
][sNumBands
][MAX_AMBI_COEFFS
];
24 ALfloat Single
[MAX_OUTPUT_CHANNELS
][MAX_AMBI_COEFFS
];
27 /* NOTE: BandSplitter filters are unused with single-band decoding */
28 BandSplitter mXOver
[MAX_AMBI_COEFFS
];
30 al::vector
<std::array
<ALfloat
,BUFFERSIZE
>, 16> mSamples
;
31 /* These two alias into Samples */
32 std::array
<ALfloat
,BUFFERSIZE
> *mSamplesHF
;
33 std::array
<ALfloat
,BUFFERSIZE
> *mSamplesLF
;
35 SplitterAllpass mUpAllpass
[MAX_OUTPUT_CHANNELS
];
37 BandSplitter Splitter
;
38 ALfloat Gains
[sNumBands
];
45 void reset(const AmbDecConf
*conf
, bool allow_2band
, ALsizei inchans
, ALuint srate
, const ALsizei (&chanmap
)[MAX_OUTPUT_CHANNELS
]);
47 void reset(const ALsizei inchans
, const ALfloat xover_norm
, const ALsizei chancount
, const ChannelDec (&chancoeffs
)[MAX_OUTPUT_CHANNELS
], const ALsizei (&chanmap
)[MAX_OUTPUT_CHANNELS
]);
49 /* Decodes the ambisonic input to the given output channels. */
50 void process(ALfloat (*OutBuffer
)[BUFFERSIZE
], const ALsizei OutChannels
, const ALfloat (*InSamples
)[BUFFERSIZE
], const ALsizei SamplesToDo
);
52 /* Up-samples a first-order input to the decoder's configuration. */
53 void upSample(ALfloat (*OutBuffer
)[BUFFERSIZE
], const ALsizei OutChannels
, const ALfloat (*InSamples
)[BUFFERSIZE
], const ALsizei InChannels
, const ALsizei SamplesToDo
);
55 DEF_NEWDEL(BFormatDec
)
59 /* Stand-alone first-order upsampler. Kept here because it shares some stuff
63 static constexpr size_t sHFBand
{0};
64 static constexpr size_t sLFBand
{1};
65 static constexpr size_t sNumBands
{2};
67 SplitterAllpass mAllpass
[MAX_OUTPUT_CHANNELS
];
68 alignas(16) ALfloat mSamples
[sNumBands
][BUFFERSIZE
];
70 BandSplitter Splitter
;
71 ALfloat Gains
[sNumBands
];
75 void reset(const ALsizei out_order
, const ALfloat xover_norm
);
76 void process(ALfloat (*OutBuffer
)[BUFFERSIZE
], const ALsizei OutChannels
, const ALfloat (*InSamples
)[BUFFERSIZE
], const ALsizei InChannels
, const ALsizei SamplesToDo
);
78 static std::array
<ALfloat
,MAX_AMBI_ORDER
+1> GetHFOrderScales(const ALsizei in_order
, const ALsizei out_order
) noexcept
;
80 DEF_NEWDEL(AmbiUpsampler
)
83 #endif /* BFORMATDEC_H */