Corrected issue #106

Energy saturation in fixed point for lms norm
pull/100/merge
Christophe Favergeon 3 years ago
parent 8703d4547d
commit 540161c115

@ -116,6 +116,7 @@ void arm_lms_norm_q15(
/* Update the energy calculation */ /* Update the energy calculation */
energy -= (((q31_t) x0 * (x0)) >> 15); energy -= (((q31_t) x0 * (x0)) >> 15);
energy += (((q31_t) in * (in)) >> 15); energy += (((q31_t) in * (in)) >> 15);
energy = (q15_t) __SSAT(energy, 16);
/* Set the accumulator to zero */ /* Set the accumulator to zero */
acc = 0; acc = 0;

@ -115,8 +115,9 @@ void arm_lms_norm_q31(
/* Update the energy calculation */ /* Update the energy calculation */
energy = (q31_t) ((((q63_t) energy << 32) - (((q63_t) x0 * x0) << 1)) >> 32); energy = (q31_t) ((((q63_t) energy << 32) - (((q63_t) x0 * x0) << 1)) >> 32);
energy = (q31_t) (((((q63_t) in * in) << 1) + (energy << 32)) >> 32); energy = ((((q63_t) in * in) << 1) + (energy << 32)) >> 32;
energy = clip_q63_to_q31(energy);
/* Set the accumulator to zero */ /* Set the accumulator to zero */
acc = 0; acc = 0;

Loading…
Cancel
Save