@@ -88,9 +88,7 @@ arr_real FftFilter::process(const arr_real& x) {
8888
8989// ----------------------------------------------------------------------------------------------
9090static arr_real _lowpass_fir (int n, real_t wn, const arr_real& win) {
91- if (win.size () != (n + 1 )) {
92- DSPLIB_THROW (" Window must be n+1 elements" );
93- }
91+ DSPLIB_ASSERT (win.size () == (n + 1 ), " Window must be n+1 elements" );
9492
9593 const bool is_odd = (n % 2 == 1 );
9694 const int M = win.size ();
@@ -184,18 +182,14 @@ arr_real fir1(int n, real_t wn1, real_t wn2, FilterType ftype, const arr_real& w
184182}
185183
186184arr_real fir1 (int n, real_t wn, FilterType ftype) {
187- if ((ftype != FilterType::High) && (ftype != FilterType::Low)) {
188- DSPLIB_THROW (" Not supported for current filter type" );
189- }
190-
185+ DSPLIB_ASSERT ((ftype == FilterType::High) || (ftype == FilterType::Low), " Not supported for current filter type" );
191186 const int nn = ((n % 2 == 1 ) && (ftype == FilterType::High)) ? (n + 2 ) : (n + 1 );
192187 return fir1 (n, wn, ftype, window::hamming (nn));
193188}
194189
195190arr_real fir1 (int n, real_t wn1, real_t wn2, FilterType ftype) {
196- if ((ftype != FilterType::Bandstop) && (ftype != FilterType::Bandpass)) {
197- DSPLIB_THROW (" Not supported for current filter type" );
198- }
191+ DSPLIB_ASSERT ((ftype == FilterType::Bandstop) || (ftype == FilterType::Bandpass),
192+ " Not supported for current filter type" );
199193 const int nn = ((n % 2 == 1 ) && (ftype == FilterType::Bandstop)) ? (n + 2 ) : (n + 1 );
200194 return fir1 (n, wn1, wn2, ftype, window::hamming (nn));
201195}
0 commit comments