Skip to content

Commit c77cd63

Browse files
committed
refactor(zlp::controller): use dispatch to handle different stereo cases
1 parent 33d7a89 commit c77cd63

4 files changed

Lines changed: 225 additions & 252 deletions

File tree

source/dsp/filter/spec_dynamic/spec_dynamic.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ namespace zldsp::filter {
4040
const auto v_coeffb = hn::Set(d, coeff_b_);
4141
const auto v_zero = hn::Set(d, static_cast<FloatType>(0));
4242
const auto v_one = hn::Set(d, static_cast<FloatType>(1));
43-
const auto i_start = response.getStartIdx();
44-
const auto i_stop = response.getEndIdx();
43+
const auto i_start = response.getDiffStartIdx();
44+
const auto i_stop = response.getDiffEndIdx();
4545
for (size_t i = i_start; i < i_stop; i+= lanes) {
4646
// threshold & knee
4747
const auto v_side = hn::Load(d, side_log_sqr + i);

source/dsp/filter/spec_dynamic/spec_response.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace zldsp::filter {
2424
const auto spec_size = fft_size / 2;
2525
base_response_.resize(spec_size);
2626
diff_response_.resize(spec_size);
27-
start_idx_ = 0;
27+
diff_start_idx_ = 0;
2828
diff_size_ = 0;
2929
}
3030

@@ -65,7 +65,7 @@ namespace zldsp::filter {
6565
break;
6666
}
6767
}
68-
start_idx_ = i;
68+
diff_start_idx_ = i;
6969
for (; i < base_response_.size(); i += lanes) {
7070
const auto v = hn::Load(d, diff_response_.data() + i);
7171
const auto v_log = hn::Log(d, hn::Max(v, v_min));
@@ -76,9 +76,9 @@ namespace zldsp::filter {
7676
}
7777
hn::Store(diff, d, diff_response_.data() + i);
7878
}
79-
diff_size_ = i - start_idx_;
79+
diff_size_ = i - diff_start_idx_;
8080
if (diff_size_ == 0) {
81-
start_idx_ = 0;
81+
diff_start_idx_ = 0;
8282
}
8383
}
8484

@@ -90,12 +90,12 @@ namespace zldsp::filter {
9090
return diff_response_;
9191
}
9292

93-
[[nodiscard]] auto getStartIdx() const {
94-
return start_idx_;
93+
[[nodiscard]] auto getDiffStartIdx() const {
94+
return diff_start_idx_;
9595
}
9696

97-
[[nodiscard]] auto getEndIdx() const {
98-
return end_idx_;
97+
[[nodiscard]] auto getDiffEndIdx() const {
98+
return diff_end_idx_;
9999
}
100100

101101
[[nodiscard]] auto getDiffSize() const {
@@ -105,7 +105,7 @@ namespace zldsp::filter {
105105
private:
106106
vector::aligned_vector<FloatType> base_response_;
107107
vector::aligned_vector<FloatType> diff_response_;
108-
size_t start_idx_{0}, end_idx_{0}, diff_size_{0};
108+
size_t diff_start_idx_{0}, diff_end_idx_{0}, diff_size_{0};
109109

110110
static constexpr auto kLogSqrMin = static_cast<FloatType>(1e-24);
111111
static constexpr auto kDiffMin = static_cast<FloatType>(1e-2);

0 commit comments

Comments
 (0)