54 |
bq_t resonance; |
bq_t resonance; |
55 |
bq_t cutoff; |
bq_t cutoff; |
56 |
::gig::vcf_type_t Type; |
::gig::vcf_type_t Type; |
57 |
|
static const float fFB = LSF_FB; |
58 |
public: |
public: |
|
bool Enabled; |
|
59 |
|
|
60 |
inline Filter() { |
Filter() { |
61 |
// set filter type to 'lowpass' by default |
// set filter type to 'lowpass' by default |
62 |
pFilter = &LPFilter; |
pFilter = &LPFilter; |
63 |
Type = ::gig::vcf_type_lowpass; |
Type = ::gig::vcf_type_lowpass; |
123 |
this->cutoff = cutoff; |
this->cutoff = cutoff; |
124 |
} |
} |
125 |
|
|
126 |
|
void Reset() { |
127 |
|
BasicBPFilter.Reset(); |
128 |
|
HPFilter.Reset(); |
129 |
|
BPFilter.Reset(); |
130 |
|
LPFilter.Reset(); |
131 |
|
} |
132 |
|
|
133 |
inline bq_t Apply(const bq_t in) { |
inline bq_t Apply(const bq_t in) { |
134 |
return (Enabled) ? pFilter->Apply(in) * this->scale + |
return pFilter->Apply(in) * this->scale + |
135 |
BasicBPFilter.ApplyFB(in, this->resonance * LSF_FB) * this->resonance |
BasicBPFilter.ApplyFB(in, this->resonance * LSF_FB) * this->resonance; |
|
: in; |
|
136 |
} |
} |
137 |
|
|
138 |
inline bq_t Apply(biquad_param_t* base, biquad_param_t* main, const bq_t in) { |
inline bq_t Apply(biquad_param_t* base, biquad_param_t* main, const bq_t in) { |
139 |
return (Enabled) ? pFilter->Apply(main, in) * this->scale + |
return pFilter->Apply(main, in) * this->scale + |
140 |
BasicBPFilter.ApplyFB(base, in, this->resonance * LSF_FB) * this->resonance |
BasicBPFilter.ApplyFB(base, in, this->resonance * LSF_FB) * this->resonance; |
141 |
: in; |
} |
142 |
|
|
143 |
|
// expects to find input in xmm0 and leaves output in xmm7 |
144 |
|
inline void Apply4StepsSSE(biquad_param_t* base, biquad_param_t* main) { |
145 |
|
float fb; |
146 |
|
__asm__ __volatile__ ( |
147 |
|
"movss %0, %%xmm4\n\t" |
148 |
|
"mulss %1, %%xmm4 # this->resonance * LSF_FB\n\t" |
149 |
|
"movss %%xmm4, %2\n\t" |
150 |
|
:: "m" (fFB), /* %0 */ |
151 |
|
"m" (resonance), /* %1 */ |
152 |
|
"m" (fb) /* %2 */ |
153 |
|
); |
154 |
|
BasicBPFilter.ApplyFB4StepsSSE(base, fb); // leaves output in xmm7 |
155 |
|
__asm__ __volatile__ ( |
156 |
|
"movss %0, %%xmm4\n\t" |
157 |
|
"shufps $0, %%xmm4, %%xmm4 # copy to other 3 cells\n\t" |
158 |
|
"mulps %%xmm4, %%xmm7 # ApplyFB() * this->resonance\n\t" |
159 |
|
:: "m" (resonance) /* %0 */ |
160 |
|
); |
161 |
|
pFilter->Apply4StepsSSE(main); // leaves output in xmm6 |
162 |
|
__asm__ __volatile__ ( |
163 |
|
"movss %0, %%xmm5\n\t" |
164 |
|
"shufps $0, %%xmm5, %%xmm5 # copy to other 3 cells\n\t" |
165 |
|
"mulps %%xmm5, %%xmm6 # Apply() * this->scale\n\t" |
166 |
|
"addps %%xmm6, %%xmm7 # xmm7 = result\n\t" |
167 |
|
:: "m" (scale) /* %0 */ |
168 |
|
); |
169 |
} |
} |
170 |
}; |
}; |
171 |
|
|