add coeffs to *state_is_valid everywhere it's implemented
This commit is contained in:
parent
99afa41b8d
commit
d5dda7f26b
@ -462,8 +462,7 @@ static inline char bw_gain_coeffs_is_valid(
|
|||||||
if (!bw_is_finite(coeffs->gain))
|
if (!bw_is_finite(coeffs->gain))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return bw_one_pole_coeffs_is_valid(&coeffs->smooth_coeffs) && bw_one_pole_state_is_valid(&coeffs->smooth_state);
|
return bw_one_pole_coeffs_is_valid(&coeffs->smooth_coeffs) && bw_one_pole_state_is_valid(&coeffs->smooth_coeffs, &coeffs->smooth_state);
|
||||||
// reset id...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct bw_gain_coeffs {
|
struct bw_gain_coeffs {
|
||||||
|
@ -229,12 +229,16 @@ static inline char bw_hp1_coeffs_is_valid(
|
|||||||
* #### bw_hp1_state_is_valid()
|
* #### bw_hp1_state_is_valid()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
static inline char bw_hp1_state_is_valid(
|
static inline char bw_hp1_state_is_valid(
|
||||||
const bw_hp1_state * BW_RESTRICT state);
|
const bw_hp1_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_hp1_state * BW_RESTRICT state);
|
||||||
/*! <<<```
|
/*! <<<```
|
||||||
* Tries to determine whether `state` is valid and returns non-`0` if it
|
* Tries to determine whether `state` is valid and returns non-`0` if it
|
||||||
* seems to be the case and `0` if it is certainly not. False positives are
|
* seems to be the case and `0` if it is certainly not. False positives are
|
||||||
* possible, false negatives are not.
|
* possible, false negatives are not.
|
||||||
*
|
*
|
||||||
|
* If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
|
||||||
|
* is supposed to be associated to `coeffs`).
|
||||||
|
*
|
||||||
* `state` must at least point to a readable memory block of size greater
|
* `state` must at least point to a readable memory block of size greater
|
||||||
* than or equal to that of `bw_hp1_state`.
|
* than or equal to that of `bw_hp1_state`.
|
||||||
* }}} */
|
* }}} */
|
||||||
@ -349,8 +353,7 @@ static inline void bw_hp1_reset_state(
|
|||||||
#endif
|
#endif
|
||||||
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_hp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bw_hp1_update_coeffs_ctrl(
|
static inline void bw_hp1_update_coeffs_ctrl(
|
||||||
@ -385,8 +388,7 @@ static inline float bw_hp1_process1(
|
|||||||
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_hp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
|
|
||||||
const float lp = bw_lp1_process1(&coeffs->lp1_coeffs, &state->lp1_state, x);
|
const float lp = bw_lp1_process1(&coeffs->lp1_coeffs, &state->lp1_state, x);
|
||||||
@ -394,8 +396,7 @@ static inline float bw_hp1_process1(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_hp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -411,8 +412,7 @@ static inline void bw_hp1_process(
|
|||||||
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_hp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(x != NULL);
|
BW_ASSERT(x != NULL);
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
||||||
BW_ASSERT(y != NULL);
|
BW_ASSERT(y != NULL);
|
||||||
@ -425,8 +425,7 @@ static inline void bw_hp1_process(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_hp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_hp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_hp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_hp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(y, n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(y, n_samples));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -513,15 +512,21 @@ static inline char bw_hp1_coeffs_is_valid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline char bw_hp1_state_is_valid(
|
static inline char bw_hp1_state_is_valid(
|
||||||
const bw_hp1_state * BW_RESTRICT state) {
|
const bw_hp1_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_hp1_state * BW_RESTRICT state) {
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
|
|
||||||
#ifdef BW_DEBUG_DEEP
|
#ifdef BW_DEBUG_DEEP
|
||||||
if (state->hash != bw_hash_sdbm("bw_hp1_state"))
|
if (state->hash != bw_hash_sdbm("bw_hp1_state"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
|
||||||
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return bw_lp1_state_is_valid(&state->lp1_state);
|
(void)coeffs;
|
||||||
|
|
||||||
|
return bw_lp1_state_is_valid(&coeffs->lp1_coeffs, &state->lp1_state);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -232,12 +232,16 @@ static inline char bw_lp1_coeffs_is_valid(
|
|||||||
* #### bw_lp1_state_is_valid()
|
* #### bw_lp1_state_is_valid()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
static inline char bw_lp1_state_is_valid(
|
static inline char bw_lp1_state_is_valid(
|
||||||
const bw_lp1_state * BW_RESTRICT state);
|
const bw_lp1_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_lp1_state * BW_RESTRICT state);
|
||||||
/*! <<<```
|
/*! <<<```
|
||||||
* Tries to determine whether `state` is valid and returns non-`0` if it
|
* Tries to determine whether `state` is valid and returns non-`0` if it
|
||||||
* seems to be the case and `0` if it is certainly not. False positives are
|
* seems to be the case and `0` if it is certainly not. False positives are
|
||||||
* possible, false negatives are not.
|
* possible, false negatives are not.
|
||||||
*
|
*
|
||||||
|
* If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
|
||||||
|
* is supposed to be associated to `coeffs`).
|
||||||
|
*
|
||||||
* `state` must at least point to a readable memory block of size greater
|
* `state` must at least point to a readable memory block of size greater
|
||||||
* than or equal to that of `bw_lp1_state`.
|
* than or equal to that of `bw_lp1_state`.
|
||||||
* }}} */
|
* }}} */
|
||||||
@ -404,8 +408,7 @@ static inline void bw_lp1_reset_state(
|
|||||||
#endif
|
#endif
|
||||||
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_lp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_lp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bw_lp1_update_coeffs_ctrl(
|
static inline void bw_lp1_update_coeffs_ctrl(
|
||||||
@ -437,8 +440,7 @@ static inline float bw_lp1_process1(
|
|||||||
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_lp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_lp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
|
|
||||||
const float X = coeffs->X_x * (x - state->y_z1) - coeffs->X_X_z1 * state->X_z1;
|
const float X = coeffs->X_x * (x - state->y_z1) - coeffs->X_X_z1 * state->X_z1;
|
||||||
@ -448,8 +450,7 @@ static inline float bw_lp1_process1(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_lp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_lp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -465,8 +466,7 @@ static inline void bw_lp1_process(
|
|||||||
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_lp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_lp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(x != NULL);
|
BW_ASSERT(x != NULL);
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
||||||
BW_ASSERT(y != NULL);
|
BW_ASSERT(y != NULL);
|
||||||
@ -478,8 +478,7 @@ static inline void bw_lp1_process(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_lp1_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_lp1_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_lp1_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_lp1_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(y, n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(y, n_samples));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,14 +589,20 @@ static inline char bw_lp1_coeffs_is_valid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline char bw_lp1_state_is_valid(
|
static inline char bw_lp1_state_is_valid(
|
||||||
const bw_lp1_state * BW_RESTRICT state) {
|
const bw_lp1_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_lp1_state * BW_RESTRICT state) {
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
|
|
||||||
#ifdef BW_DEBUG_DEEP
|
#ifdef BW_DEBUG_DEEP
|
||||||
if (state->hash != bw_hash_sdbm("bw_lp1_state"))
|
if (state->hash != bw_hash_sdbm("bw_lp1_state"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
|
||||||
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)coeffs;
|
||||||
|
|
||||||
return bw_is_finite(state->y_z1) && bw_is_finite(state->X_z1);
|
return bw_is_finite(state->y_z1) && bw_is_finite(state->X_z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,8 @@
|
|||||||
* <li>Now using backward Euler rather than impulse invariant
|
* <li>Now using backward Euler rather than impulse invariant
|
||||||
* method.</li>
|
* method.</li>
|
||||||
* <li>Clearly specificed parameter validity ranges.</li>
|
* <li>Clearly specificed parameter validity ranges.</li>
|
||||||
* <li>Added more debugging code.</li>
|
* <li>Added more debugging code and added `coeffs` argument to
|
||||||
|
* <code>bw_one_pole_state_is_valid()</code>.</li>
|
||||||
* <li>Added pragmas to silence bogus GCC uninitialized variable
|
* <li>Added pragmas to silence bogus GCC uninitialized variable
|
||||||
* warnings.</li>
|
* warnings.</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
@ -404,12 +405,16 @@ static inline char bw_one_pole_coeffs_is_valid(
|
|||||||
* #### bw_one_pole_state_is_valid()
|
* #### bw_one_pole_state_is_valid()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
static inline char bw_one_pole_state_is_valid(
|
static inline char bw_one_pole_state_is_valid(
|
||||||
const bw_one_pole_state * BW_RESTRICT state);
|
const bw_one_pole_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_one_pole_state * BW_RESTRICT state);
|
||||||
/*! <<<```
|
/*! <<<```
|
||||||
* Tries to determine whether `state` is valid and returns non-`0` if it
|
* Tries to determine whether `state` is valid and returns non-`0` if it
|
||||||
* seems to be the case and `0` if it is certainly not. False positives are
|
* seems to be the case and `0` if it is certainly not. False positives are
|
||||||
* possible, false negatives are not.
|
* possible, false negatives are not.
|
||||||
*
|
*
|
||||||
|
* If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
|
||||||
|
* is supposed to be associated to `coeffs`).
|
||||||
|
*
|
||||||
* `state` must at least point to a readable memory block of size greater
|
* `state` must at least point to a readable memory block of size greater
|
||||||
* than or equal to that of `bw_one_pole_state`.
|
* than or equal to that of `bw_one_pole_state`.
|
||||||
* }}} */
|
* }}} */
|
||||||
@ -559,8 +564,7 @@ static inline void bw_one_pole_reset_state(
|
|||||||
#endif
|
#endif
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bw_one_pole_update_coeffs_ctrl(
|
static inline void bw_one_pole_update_coeffs_ctrl(
|
||||||
@ -592,8 +596,7 @@ static inline float bw_one_pole_process1(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT_DEEP(coeffs->mA1u == coeffs->mA1d && coeffs->st2 == 0.f);
|
BW_ASSERT_DEEP(coeffs->mA1u == coeffs->mA1d && coeffs->st2 == 0.f);
|
||||||
|
|
||||||
@ -602,8 +605,7 @@ static inline float bw_one_pole_process1(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -617,8 +619,7 @@ static inline float bw_one_pole_process1_sticky_abs(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT_DEEP(coeffs->mA1u == coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_abs);
|
BW_ASSERT_DEEP(coeffs->mA1u == coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_abs);
|
||||||
|
|
||||||
@ -630,8 +631,7 @@ static inline float bw_one_pole_process1_sticky_abs(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -645,8 +645,7 @@ static inline float bw_one_pole_process1_sticky_rel(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT_DEEP(coeffs->mA1u == coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_rel);
|
BW_ASSERT_DEEP(coeffs->mA1u == coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_rel);
|
||||||
|
|
||||||
@ -658,8 +657,7 @@ static inline float bw_one_pole_process1_sticky_rel(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -673,8 +671,7 @@ static inline float bw_one_pole_process1_asym(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT_DEEP(coeffs->mA1u != coeffs->mA1d && coeffs->st2 == 0.f);
|
BW_ASSERT_DEEP(coeffs->mA1u != coeffs->mA1d && coeffs->st2 == 0.f);
|
||||||
|
|
||||||
@ -683,8 +680,7 @@ static inline float bw_one_pole_process1_asym(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -698,8 +694,7 @@ static inline float bw_one_pole_process1_asym_sticky_abs(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT_DEEP(coeffs->mA1u != coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_abs);
|
BW_ASSERT_DEEP(coeffs->mA1u != coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_abs);
|
||||||
|
|
||||||
@ -711,8 +706,7 @@ static inline float bw_one_pole_process1_asym_sticky_abs(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -726,8 +720,7 @@ static inline float bw_one_pole_process1_asym_sticky_rel(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT_DEEP(coeffs->mA1u != coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_rel);
|
BW_ASSERT_DEEP(coeffs->mA1u != coeffs->mA1d && coeffs->st2 != 0.f && coeffs->sticky_mode == bw_one_pole_sticky_mode_rel);
|
||||||
|
|
||||||
@ -739,8 +732,7 @@ static inline float bw_one_pole_process1_asym_sticky_rel(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -756,8 +748,7 @@ static inline void bw_one_pole_process(
|
|||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(x != NULL);
|
BW_ASSERT(x != NULL);
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
||||||
|
|
||||||
@ -824,8 +815,7 @@ static inline void bw_one_pole_process(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_one_pole_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_one_pole_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT_DEEP(y != NULL ? bw_has_only_finite(y, n_samples) : 1);
|
BW_ASSERT_DEEP(y != NULL ? bw_has_only_finite(y, n_samples) : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1086,7 +1076,7 @@ static inline void bw_one_pole_set_sticky_mode(
|
|||||||
static inline float bw_one_pole_get_y_z1(
|
static inline float bw_one_pole_get_y_z1(
|
||||||
const bw_one_pole_state * BW_RESTRICT state) {
|
const bw_one_pole_state * BW_RESTRICT state) {
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_one_pole_state_is_valid(NULL, state));
|
||||||
|
|
||||||
return state->y_z1;
|
return state->y_z1;
|
||||||
}
|
}
|
||||||
@ -1131,14 +1121,20 @@ static inline char bw_one_pole_coeffs_is_valid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline char bw_one_pole_state_is_valid(
|
static inline char bw_one_pole_state_is_valid(
|
||||||
const bw_one_pole_state * BW_RESTRICT state) {
|
const bw_one_pole_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_one_pole_state * BW_RESTRICT state) {
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
|
|
||||||
#ifdef BW_DEBUG_DEEP
|
#ifdef BW_DEBUG_DEEP
|
||||||
if (state->hash != bw_hash_sdbm("bw_one_pole_state"))
|
if (state->hash != bw_hash_sdbm("bw_one_pole_state"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
|
||||||
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)coeffs;
|
||||||
|
|
||||||
return bw_is_finite(state->y_z1);
|
return bw_is_finite(state->y_z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,12 +282,16 @@ static inline char bw_slew_lim_coeffs_is_valid(
|
|||||||
* #### bw_slew_lim_state_is_valid()
|
* #### bw_slew_lim_state_is_valid()
|
||||||
* ```>>> */
|
* ```>>> */
|
||||||
static inline char bw_slew_lim_state_is_valid(
|
static inline char bw_slew_lim_state_is_valid(
|
||||||
const bw_slew_lim_state * BW_RESTRICT state);
|
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_slew_lim_state * BW_RESTRICT state);
|
||||||
/*! <<<```
|
/*! <<<```
|
||||||
* Tries to determine whether `state` is valid and returns non-`0` if it
|
* Tries to determine whether `state` is valid and returns non-`0` if it
|
||||||
* seems to be the case and `0` if it is certainly not. False positives are
|
* seems to be the case and `0` if it is certainly not. False positives are
|
||||||
* possible, false negatives are not.
|
* possible, false negatives are not.
|
||||||
*
|
*
|
||||||
|
* If `coeffs` is not `NULL` extra cross-checks might be performed (`state`
|
||||||
|
* is supposed to be associated to `coeffs`).
|
||||||
|
*
|
||||||
* `state` must at least point to a readable memory block of size greater
|
* `state` must at least point to a readable memory block of size greater
|
||||||
* than or equal to that of `bw_slew_lim_state`.
|
* than or equal to that of `bw_slew_lim_state`.
|
||||||
* }}} */
|
* }}} */
|
||||||
@ -418,8 +422,7 @@ static inline void bw_slew_lim_reset_state(
|
|||||||
#endif
|
#endif
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void bw_slew_lim_update_coeffs_ctrl(
|
static inline void bw_slew_lim_update_coeffs_ctrl(
|
||||||
@ -451,8 +454,7 @@ static inline float bw_slew_lim_process1(
|
|||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT(bw_is_finite(coeffs->max_inc) && bw_is_finite(coeffs->max_dec));
|
BW_ASSERT(bw_is_finite(coeffs->max_inc) && bw_is_finite(coeffs->max_dec));
|
||||||
|
|
||||||
@ -461,8 +463,7 @@ static inline float bw_slew_lim_process1(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -476,8 +477,7 @@ static inline float bw_slew_lim_process1_up(
|
|||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT(bw_is_finite(coeffs->max_inc) && !bw_is_finite(coeffs->max_dec));
|
BW_ASSERT(bw_is_finite(coeffs->max_inc) && !bw_is_finite(coeffs->max_dec));
|
||||||
|
|
||||||
@ -486,8 +486,7 @@ static inline float bw_slew_lim_process1_up(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -501,8 +500,7 @@ static inline float bw_slew_lim_process1_down(
|
|||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT(!bw_is_finite(coeffs->max_inc) && bw_is_finite(coeffs->max_dec));
|
BW_ASSERT(!bw_is_finite(coeffs->max_inc) && bw_is_finite(coeffs->max_dec));
|
||||||
|
|
||||||
@ -511,8 +509,7 @@ static inline float bw_slew_lim_process1_down(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(y));
|
BW_ASSERT(bw_is_finite(y));
|
||||||
|
|
||||||
return y;
|
return y;
|
||||||
@ -526,8 +523,7 @@ static inline float bw_slew_lim_process1_none(
|
|||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(bw_is_finite(x));
|
BW_ASSERT(bw_is_finite(x));
|
||||||
BW_ASSERT(!bw_is_finite(coeffs->max_inc) && !bw_is_finite(coeffs->max_dec));
|
BW_ASSERT(!bw_is_finite(coeffs->max_inc) && !bw_is_finite(coeffs->max_dec));
|
||||||
|
|
||||||
@ -536,8 +532,7 @@ static inline float bw_slew_lim_process1_none(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
@ -552,8 +547,7 @@ static inline void bw_slew_lim_process(
|
|||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT(x != NULL);
|
BW_ASSERT(x != NULL);
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(x, n_samples));
|
||||||
|
|
||||||
@ -595,8 +589,7 @@ static inline void bw_slew_lim_process(
|
|||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
BW_ASSERT_DEEP(bw_slew_lim_coeffs_is_valid(coeffs));
|
||||||
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
BW_ASSERT_DEEP(coeffs->state >= bw_slew_lim_coeffs_state_reset_coeffs);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state->coeffs_reset_id);
|
|
||||||
BW_ASSERT_DEEP(y != NULL ? bw_has_only_finite(y, n_samples) : 1);
|
BW_ASSERT_DEEP(y != NULL ? bw_has_only_finite(y, n_samples) : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -643,8 +636,7 @@ static inline void bw_slew_lim_process_multi(
|
|||||||
else
|
else
|
||||||
for (size_t j = 0; j < n_channels; j++) {
|
for (size_t j = 0; j < n_channels; j++) {
|
||||||
BW_ASSERT(state[j] != NULL);
|
BW_ASSERT(state[j] != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state[j]));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state[j]->coeffs_reset_id);
|
|
||||||
BW_ASSERT(x[j] != NULL);
|
BW_ASSERT(x[j] != NULL);
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(x[j], n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(x[j], n_samples));
|
||||||
|
|
||||||
@ -653,8 +645,7 @@ static inline void bw_slew_lim_process_multi(
|
|||||||
y[j][i] = x[j][i];
|
y[j][i] = x[j][i];
|
||||||
state[j]->y_z1 = x[j][n_samples - 1];
|
state[j]->y_z1 = x[j][n_samples - 1];
|
||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state[j]));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state[j]->coeffs_reset_id);
|
|
||||||
BW_ASSERT_DEEP(y[j] != NULL ? bw_has_only_finite(y[j], n_samples) : 1);
|
BW_ASSERT_DEEP(y[j] != NULL ? bw_has_only_finite(y[j], n_samples) : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -676,15 +667,13 @@ static inline void bw_slew_lim_process_multi(
|
|||||||
else
|
else
|
||||||
for (size_t j = 0; j < n_channels; j++) {
|
for (size_t j = 0; j < n_channels; j++) {
|
||||||
BW_ASSERT(state[j] != NULL);
|
BW_ASSERT(state[j] != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state[j]));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state[j]->coeffs_reset_id);
|
|
||||||
BW_ASSERT(x[j] != NULL);
|
BW_ASSERT(x[j] != NULL);
|
||||||
BW_ASSERT_DEEP(bw_has_only_finite(x[j], n_samples));
|
BW_ASSERT_DEEP(bw_has_only_finite(x[j], n_samples));
|
||||||
|
|
||||||
state[j]->y_z1 = x[j][n_samples - 1];
|
state[j]->y_z1 = x[j][n_samples - 1];
|
||||||
|
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state[j]));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(coeffs, state[j]));
|
||||||
BW_ASSERT_DEEP(coeffs->reset_id == state[j]->coeffs_reset_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -742,7 +731,7 @@ static inline void bw_slew_lim_set_max_rate_down(
|
|||||||
static inline float bw_slew_lim_get_y_z1(
|
static inline float bw_slew_lim_get_y_z1(
|
||||||
const bw_slew_lim_state * BW_RESTRICT state) {
|
const bw_slew_lim_state * BW_RESTRICT state) {
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(state));
|
BW_ASSERT_DEEP(bw_slew_lim_state_is_valid(NULL, state));
|
||||||
|
|
||||||
return state->y_z1;
|
return state->y_z1;
|
||||||
}
|
}
|
||||||
@ -781,14 +770,20 @@ static inline char bw_slew_lim_coeffs_is_valid(
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline char bw_slew_lim_state_is_valid(
|
static inline char bw_slew_lim_state_is_valid(
|
||||||
const bw_slew_lim_state * BW_RESTRICT state) {
|
const bw_slew_lim_coeffs * BW_RESTRICT coeffs,
|
||||||
|
const bw_slew_lim_state * BW_RESTRICT state) {
|
||||||
BW_ASSERT(state != NULL);
|
BW_ASSERT(state != NULL);
|
||||||
|
|
||||||
#ifdef BW_DEBUG_DEEP
|
#ifdef BW_DEBUG_DEEP
|
||||||
if (state->hash != bw_hash_sdbm("bw_slew_lim_state"))
|
if (state->hash != bw_hash_sdbm("bw_slew_lim_state"))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (coeffs != NULL && coeffs->reset_id != state->coeffs_reset_id)
|
||||||
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
(void)coeffs;
|
||||||
|
|
||||||
return bw_is_finite(state->y_z1);
|
return bw_is_finite(state->y_z1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user