Move the filters to core

This commit is contained in:
Chris Robinson 2020-12-04 09:42:13 -08:00
parent 84d47f7d4c
commit 69d55d7e03
25 changed files with 62 additions and 68 deletions

View File

@ -633,6 +633,12 @@ set(ALC_OBJS
core/bufferline.h core/bufferline.h
core/devformat.cpp core/devformat.cpp
core/devformat.h core/devformat.h
core/filters/biquad.h
core/filters/biquad.cpp
core/filters/nfc.cpp
core/filters/nfc.h
core/filters/splitter.cpp
core/filters/splitter.h
core/mastering.cpp core/mastering.cpp
core/mastering.h core/mastering.h
@ -674,12 +680,6 @@ set(ALC_OBJS
alc/effects/pshifter.cpp alc/effects/pshifter.cpp
alc/effects/reverb.cpp alc/effects/reverb.cpp
alc/effects/vmorpher.cpp alc/effects/vmorpher.cpp
alc/filters/biquad.h
alc/filters/biquad.cpp
alc/filters/nfc.cpp
alc/filters/nfc.h
alc/filters/splitter.cpp
alc/filters/splitter.h
alc/fmt_traits.cpp alc/fmt_traits.cpp
alc/fmt_traits.h alc/fmt_traits.h
alc/fpu_ctrl.cpp alc/fpu_ctrl.cpp

View File

@ -59,10 +59,10 @@
#include "backends/base.h" #include "backends/base.h"
#include "bformatdec.h" #include "bformatdec.h"
#include "buffer.h" #include "buffer.h"
#include "core/filters/nfc.h"
#include "core/filters/splitter.h"
#include "event.h" #include "event.h"
#include "filter.h" #include "filter.h"
#include "filters/nfc.h"
#include "filters/splitter.h"
#include "inprogext.h" #include "inprogext.h"
#include "logging.h" #include "logging.h"
#include "math_defs.h" #include "math_defs.h"

View File

@ -82,10 +82,10 @@
#include "compat.h" #include "compat.h"
#include "core/devformat.h" #include "core/devformat.h"
#include "core/mastering.h" #include "core/mastering.h"
#include "core/filters/nfc.h"
#include "core/filters/splitter.h"
#include "cpu_caps.h" #include "cpu_caps.h"
#include "effects/base.h" #include "effects/base.h"
#include "filters/nfc.h"
#include "filters/splitter.h"
#include "fpu_ctrl.h" #include "fpu_ctrl.h"
#include "front_stablizer.h" #include "front_stablizer.h"
#include "hrtf.h" #include "hrtf.h"

View File

@ -25,7 +25,7 @@
#include "atomic.h" #include "atomic.h"
#include "core/bufferline.h" #include "core/bufferline.h"
#include "core/devformat.h" #include "core/devformat.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
#include "hrtf.h" #include "hrtf.h"
#include "inprogext.h" #include "inprogext.h"
#include "intrusive_ptr.h" #include "intrusive_ptr.h"

View File

@ -61,12 +61,12 @@
#include "bs2b.h" #include "bs2b.h"
#include "core/bsinc_tables.h" #include "core/bsinc_tables.h"
#include "core/devformat.h" #include "core/devformat.h"
#include "core/filters/biquad.h"
#include "core/filters/nfc.h"
#include "core/filters/splitter.h"
#include "core/mastering.h" #include "core/mastering.h"
#include "cpu_caps.h" #include "cpu_caps.h"
#include "effects/base.h" #include "effects/base.h"
#include "filters/biquad.h"
#include "filters/nfc.h"
#include "filters/splitter.h"
#include "fpu_ctrl.h" #include "fpu_ctrl.h"
#include "front_stablizer.h" #include "front_stablizer.h"
#include "hrtf.h" #include "hrtf.h"

View File

@ -10,12 +10,10 @@
#include <iterator> #include <iterator>
#include <numeric> #include <numeric>
#include "AL/al.h"
#include "almalloc.h" #include "almalloc.h"
#include "alu.h" #include "alu.h"
#include "ambdec.h" #include "ambdec.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
#include "front_stablizer.h" #include "front_stablizer.h"
#include "math_defs.h" #include "math_defs.h"
#include "opthelpers.h" #include "opthelpers.h"
@ -33,7 +31,7 @@ constexpr std::array<float,MAX_AMBI_ORDER+1> Ambi3DDecoderHFScale3O{{
5.89792205e-01f, 8.79693856e-01f, 1.00000000e+00f, 1.00000000e+00f 5.89792205e-01f, 8.79693856e-01f, 1.00000000e+00f, 1.00000000e+00f
}}; }};
inline auto GetDecoderHFScales(ALuint order) noexcept -> const std::array<float,MAX_AMBI_ORDER+1>& inline auto GetDecoderHFScales(uint order) noexcept -> const std::array<float,MAX_AMBI_ORDER+1>&
{ {
if(order >= 3) return Ambi3DDecoderHFScale3O; if(order >= 3) return Ambi3DDecoderHFScale3O;
if(order == 2) return Ambi3DDecoderHFScale2O; if(order == 2) return Ambi3DDecoderHFScale2O;
@ -52,7 +50,7 @@ inline auto GetAmbiScales(AmbDecScale scaletype) noexcept
BFormatDec::BFormatDec(const AmbDecConf *conf, const bool allow_2band, const size_t inchans, BFormatDec::BFormatDec(const AmbDecConf *conf, const bool allow_2band, const size_t inchans,
const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS], const uint srate, const uint (&chanmap)[MAX_OUTPUT_CHANNELS],
std::unique_ptr<FrontStablizer> stablizer) std::unique_ptr<FrontStablizer> stablizer)
: mStablizer{std::move(stablizer)}, mDualBand{allow_2band && (conf->FreqBands == 2)} : mStablizer{std::move(stablizer)}, mDualBand{allow_2band && (conf->FreqBands == 2)}
, mChannelDec{inchans} , mChannelDec{inchans}
@ -269,7 +267,7 @@ void BFormatDec::processStablize(const al::span<FloatBufferLine> OutBuffer,
} }
auto BFormatDec::GetHFOrderScales(const ALuint in_order, const ALuint out_order) noexcept auto BFormatDec::GetHFOrderScales(const uint in_order, const uint out_order) noexcept
-> std::array<float,MAX_AMBI_ORDER+1> -> std::array<float,MAX_AMBI_ORDER+1>
{ {
std::array<float,MAX_AMBI_ORDER+1> ret{}; std::array<float,MAX_AMBI_ORDER+1> ret{};
@ -286,7 +284,7 @@ auto BFormatDec::GetHFOrderScales(const ALuint in_order, const ALuint out_order)
} }
std::unique_ptr<BFormatDec> BFormatDec::Create(const AmbDecConf *conf, const bool allow_2band, std::unique_ptr<BFormatDec> BFormatDec::Create(const AmbDecConf *conf, const bool allow_2band,
const size_t inchans, const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS], const size_t inchans, const uint srate, const uint (&chanmap)[MAX_OUTPUT_CHANNELS],
std::unique_ptr<FrontStablizer> stablizer) std::unique_ptr<FrontStablizer> stablizer)
{ {
return std::unique_ptr<BFormatDec>{new(FamCount(inchans)) return std::unique_ptr<BFormatDec>{new(FamCount(inchans))

View File

@ -5,14 +5,12 @@
#include <cstddef> #include <cstddef>
#include <memory> #include <memory>
#include "AL/al.h"
#include "alcmain.h"
#include "almalloc.h" #include "almalloc.h"
#include "alspan.h" #include "alspan.h"
#include "ambidefs.h" #include "ambidefs.h"
#include "core/bufferline.h"
#include "core/devformat.h" #include "core/devformat.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
struct AmbDecConf; struct AmbDecConf;
struct FrontStablizer; struct FrontStablizer;
@ -44,7 +42,7 @@ class BFormatDec {
public: public:
BFormatDec(const AmbDecConf *conf, const bool allow_2band, const size_t inchans, BFormatDec(const AmbDecConf *conf, const bool allow_2band, const size_t inchans,
const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS], const uint srate, const uint (&chanmap)[MAX_OUTPUT_CHANNELS],
std::unique_ptr<FrontStablizer> stablizer); std::unique_ptr<FrontStablizer> stablizer);
BFormatDec(const size_t inchans, const al::span<const ChannelDec> coeffs, BFormatDec(const size_t inchans, const al::span<const ChannelDec> coeffs,
const al::span<const ChannelDec> coeffslf, std::unique_ptr<FrontStablizer> stablizer); const al::span<const ChannelDec> coeffslf, std::unique_ptr<FrontStablizer> stablizer);
@ -61,11 +59,11 @@ public:
const size_t SamplesToDo); const size_t SamplesToDo);
/* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */ /* Retrieves per-order HF scaling factors for "upsampling" ambisonic data. */
static std::array<float,MAX_AMBI_ORDER+1> GetHFOrderScales(const ALuint in_order, static std::array<float,MAX_AMBI_ORDER+1> GetHFOrderScales(const uint in_order,
const ALuint out_order) noexcept; const uint out_order) noexcept;
static std::unique_ptr<BFormatDec> Create(const AmbDecConf *conf, const bool allow_2band, static std::unique_ptr<BFormatDec> Create(const AmbDecConf *conf, const bool allow_2band,
const size_t inchans, const ALuint srate, const ALuint (&chanmap)[MAX_OUTPUT_CHANNELS], const size_t inchans, const uint srate, const uint (&chanmap)[MAX_OUTPUT_CHANNELS],
std::unique_ptr<FrontStablizer> stablizer); std::unique_ptr<FrontStablizer> stablizer);
static std::unique_ptr<BFormatDec> Create(const size_t inchans, static std::unique_ptr<BFormatDec> Create(const size_t inchans,
const al::span<const ChannelDec> coeffs, const al::span<const ChannelDec> coeffslf, const al::span<const ChannelDec> coeffs, const al::span<const ChannelDec> coeffslf,

View File

@ -29,7 +29,7 @@
#include "alcmain.h" #include "alcmain.h"
#include "alcontext.h" #include "alcontext.h"
#include "alu.h" #include "alu.h"
#include "filters/biquad.h" #include "core/filters/biquad.h"
#include "vecmat.h" #include "vecmat.h"
namespace { namespace {

View File

@ -8,7 +8,6 @@
#include "AL/al.h" #include "AL/al.h"
#include "AL/alc.h" #include "AL/alc.h"
#include "al/auxeffectslot.h"
#include "alcmain.h" #include "alcmain.h"
#include "alcomplex.h" #include "alcomplex.h"
#include "alcontext.h" #include "alcontext.h"
@ -17,8 +16,9 @@
#include "ambidefs.h" #include "ambidefs.h"
#include "bformatdec.h" #include "bformatdec.h"
#include "buffer_storage.h" #include "buffer_storage.h"
#include "core/filters/splitter.h"
#include "effects/base.h" #include "effects/base.h"
#include "filters/splitter.h" #include "effectslot.h"
#include "fmt_traits.h" #include "fmt_traits.h"
#include "logging.h" #include "logging.h"
#include "polyphase_resampler.h" #include "polyphase_resampler.h"

View File

@ -24,11 +24,10 @@
#include <cmath> #include <cmath>
#include <cstdlib> #include <cstdlib>
#include "al/auxeffectslot.h"
#include "alcmain.h" #include "alcmain.h"
#include "alcontext.h" #include "alcontext.h"
#include "alu.h" #include "core/filters/biquad.h"
#include "filters/biquad.h" #include "effectslot.h"
namespace { namespace {

View File

@ -25,17 +25,19 @@
#include <algorithm> #include <algorithm>
#include "al/auxeffectslot.h" #include "AL/efx.h"
#include "al/filter.h"
#include "alcmain.h" #include "alcmain.h"
#include "alcontext.h" #include "alcontext.h"
#include "alu.h" #include "core/filters/biquad.h"
#include "filters/biquad.h" #include "effectslot.h"
#include "vector.h" #include "vector.h"
namespace { namespace {
constexpr float LowpassFreqRef{5000.0f};
struct EchoState final : public EffectState { struct EchoState final : public EffectState {
al::vector<float,16> mSampleBuffer; al::vector<float,16> mSampleBuffer;
@ -95,7 +97,7 @@ void EchoState::update(const ALCcontext *context, const EffectSlot *slot,
mTap[1].delay = float2uint(props->Echo.LRDelay*frequency + 0.5f) + mTap[0].delay; mTap[1].delay = float2uint(props->Echo.LRDelay*frequency + 0.5f) + mTap[0].delay;
const float gainhf{maxf(1.0f - props->Echo.Damping, 0.0625f)}; /* Limit -24dB */ const float gainhf{maxf(1.0f - props->Echo.Damping, 0.0625f)}; /* Limit -24dB */
mFilter.setParamsFromSlope(BiquadType::HighShelf, LOWPASSFREQREF/frequency, gainhf, 1.0f); mFilter.setParamsFromSlope(BiquadType::HighShelf, LowpassFreqRef/frequency, gainhf, 1.0f);
mFeedGain = props->Echo.Feedback; mFeedGain = props->Echo.Feedback;

View File

@ -26,11 +26,10 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include "al/auxeffectslot.h"
#include "alcmain.h" #include "alcmain.h"
#include "alcontext.h" #include "alcontext.h"
#include "alu.h" #include "core/filters/biquad.h"
#include "filters/biquad.h" #include "effectslot.h"
#include "vecmat.h" #include "vecmat.h"

View File

@ -26,11 +26,10 @@
#include <cmath> #include <cmath>
#include <algorithm> #include <algorithm>
#include "al/auxeffectslot.h"
#include "alcmain.h" #include "alcmain.h"
#include "alcontext.h" #include "alcontext.h"
#include "alu.h" #include "core/filters/biquad.h"
#include "filters/biquad.h" #include "effectslot.h"
#include "vecmat.h" #include "vecmat.h"

View File

@ -29,13 +29,12 @@
#include <algorithm> #include <algorithm>
#include <functional> #include <functional>
#include "al/auxeffectslot.h"
#include "al/listener.h"
#include "alcmain.h" #include "alcmain.h"
#include "alcontext.h" #include "alcontext.h"
#include "alu.h" #include "alnumeric.h"
#include "bformatdec.h" #include "bformatdec.h"
#include "filters/biquad.h" #include "core/filters/biquad.h"
#include "effectslot.h"
#include "vector.h" #include "vector.h"
#include "vecmat.h" #include "vecmat.h"

View File

@ -6,7 +6,7 @@
#include "almalloc.h" #include "almalloc.h"
#include "core/bufferline.h" #include "core/bufferline.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
struct FrontStablizer { struct FrontStablizer {

View File

@ -47,7 +47,7 @@
#include "alnumeric.h" #include "alnumeric.h"
#include "aloptional.h" #include "aloptional.h"
#include "alspan.h" #include "alspan.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
#include "logging.h" #include "logging.h"
#include "math_defs.h" #include "math_defs.h"
#include "opthelpers.h" #include "opthelpers.h"

View File

@ -11,7 +11,7 @@
#include "ambidefs.h" #include "ambidefs.h"
#include "atomic.h" #include "atomic.h"
#include "core/bufferline.h" #include "core/bufferline.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
#include "intrusive_ptr.h" #include "intrusive_ptr.h"
#include "vector.h" #include "vector.h"

View File

@ -47,10 +47,10 @@
#include "alstring.h" #include "alstring.h"
#include "alu.h" #include "alu.h"
#include "core/devformat.h" #include "core/devformat.h"
#include "core/filters/biquad.h"
#include "core/filters/nfc.h"
#include "core/filters/splitter.h"
#include "cpu_caps.h" #include "cpu_caps.h"
#include "filters/biquad.h"
#include "filters/nfc.h"
#include "filters/splitter.h"
#include "fmt_traits.h" #include "fmt_traits.h"
#include "hrtf.h" #include "hrtf.h"
#include "inprogext.h" #include "inprogext.h"

View File

@ -8,9 +8,9 @@
#include "alu.h" #include "alu.h"
#include "buffer_storage.h" #include "buffer_storage.h"
#include "core/devformat.h" #include "core/devformat.h"
#include "filters/biquad.h" #include "core/filters/biquad.h"
#include "filters/nfc.h" #include "core/filters/nfc.h"
#include "filters/splitter.h" #include "core/filters/splitter.h"
#include "hrtf.h" #include "hrtf.h"
#include "mixer/defs.h" #include "mixer/defs.h"

View File

@ -1,5 +1,5 @@
#ifndef FILTERS_BIQUAD_H #ifndef CORE_FILTERS_BIQUAD_H
#define FILTERS_BIQUAD_H #define CORE_FILTERS_BIQUAD_H
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
@ -141,4 +141,4 @@ struct DualBiquadR {
using BiquadFilter = BiquadFilterR<float>; using BiquadFilter = BiquadFilterR<float>;
using DualBiquad = DualBiquadR<float>; using DualBiquad = DualBiquadR<float>;
#endif /* FILTERS_BIQUAD_H */ #endif /* CORE_FILTERS_BIQUAD_H */

View File

@ -1,5 +1,5 @@
#ifndef FILTER_NFC_H #ifndef CORE_FILTERS_NFC_H
#define FILTER_NFC_H #define CORE_FILTERS_NFC_H
#include <cstddef> #include <cstddef>
@ -60,4 +60,4 @@ public:
void process4(const al::span<const float> src, float *RESTRICT dst); void process4(const al::span<const float> src, float *RESTRICT dst);
}; };
#endif /* FILTER_NFC_H */ #endif /* CORE_FILTERS_NFC_H */

View File

@ -1,5 +1,5 @@
#ifndef FILTER_SPLITTER_H #ifndef CORE_FILTERS_SPLITTER_H
#define FILTER_SPLITTER_H #define CORE_FILTERS_SPLITTER_H
#include <cstddef> #include <cstddef>
@ -33,4 +33,4 @@ public:
}; };
using BandSplitter = BandSplitterR<float>; using BandSplitter = BandSplitterR<float>;
#endif /* FILTER_SPLITTER_H */ #endif /* CORE_FILTERS_SPLITTER_H */