Commit 540161c1 authored by Christophe Favergeon's avatar Christophe Favergeon
Browse files

Corrected issue #106

Energy saturation in fixed point for lms norm
parent 8703d454
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;
+3 −2
Original line number Diff line number Diff line
@@ -115,7 +115,8 @@ void arm_lms_norm_q31(

    /* Update the energy calculation */
    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 */
    acc = 0;