Energy saturation in fixed point for lms norm
@ -116,6 +116,7 @@ void arm_lms_norm_q15(
/* Update the energy calculation */
energy -= (((q31_t) x0 * (x0)) >> 15);
energy += (((q31_t) in * (in)) >> 15);
energy = (q15_t) __SSAT(energy, 16);
/* Set the accumulator to zero */
acc = 0;
@ -115,7 +115,8 @@ void arm_lms_norm_q31(
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);