diff options
author | Chris Robinson <[email protected]> | 2022-08-08 03:44:25 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2022-08-08 03:44:25 -0700 |
commit | 7e5dd4196846f61307e156d55ae0fc12fbd29512 (patch) | |
tree | ac818d0bcde0328b13fbe563a5a6d3fa82a605d7 /core | |
parent | 250f1624964c2c53e00d18fd1ec2bbc77c860298 (diff) |
Add an option for higher quality UHJ filters
Diffstat (limited to 'core')
-rw-r--r-- | core/uhjfilter.cpp | 3 | ||||
-rw-r--r-- | core/uhjfilter.h | 2 | ||||
-rw-r--r-- | core/voice.cpp | 24 |
3 files changed, 25 insertions, 4 deletions
diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp index b327a627..4917ffa8 100644 --- a/core/uhjfilter.cpp +++ b/core/uhjfilter.cpp @@ -12,6 +12,9 @@ #include "phase_shifter.h" +size_t UhjQuality{UhjLengthStd}; + + namespace { const PhaseShifterT<UhjLengthLq> PShiftLq{}; diff --git a/core/uhjfilter.h b/core/uhjfilter.h index c14ed5bf..d1e0a5eb 100644 --- a/core/uhjfilter.h +++ b/core/uhjfilter.h @@ -13,6 +13,8 @@ static constexpr size_t UhjLengthLq{256}; static constexpr size_t UhjLengthHq{512}; static constexpr size_t UhjLengthStd{UhjLengthLq}; +extern size_t UhjQuality; + struct UhjEncoderBase { virtual ~UhjEncoderBase() = default; diff --git a/core/voice.cpp b/core/voice.cpp index 15230726..4030fc5b 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -854,13 +854,29 @@ void Voice::prepare(DeviceBase *device) if(mFmtChannels == FmtSuperStereo) { - mDecoder = std::make_unique<UhjStereoDecoder<UhjLengthStd>>(); - mDecoderPadding = UhjStereoDecoder<UhjLengthStd>::sFilterDelay; + if(UhjQuality >= UhjLengthHq) + { + mDecoder = std::make_unique<UhjStereoDecoder<UhjLengthHq>>(); + mDecoderPadding = UhjStereoDecoder<UhjLengthHq>::sFilterDelay; + } + else + { + mDecoder = std::make_unique<UhjStereoDecoder<UhjLengthLq>>(); + mDecoderPadding = UhjStereoDecoder<UhjLengthLq>::sFilterDelay; + } } else if(IsUHJ(mFmtChannels)) { - mDecoder = std::make_unique<UhjDecoder<UhjLengthStd>>(); - mDecoderPadding = UhjDecoder<UhjLengthStd>::sFilterDelay; + if(UhjQuality >= UhjLengthHq) + { + mDecoder = std::make_unique<UhjDecoder<UhjLengthHq>>(); + mDecoderPadding = UhjDecoder<UhjLengthHq>::sFilterDelay; + } + else + { + mDecoder = std::make_unique<UhjDecoder<UhjLengthLq>>(); + mDecoderPadding = UhjDecoder<UhjLengthLq>::sFilterDelay; + } } else { |