Skip to content

Commit

Permalink
Corrected issue #106
Browse files Browse the repository at this point in the history
Energy saturation in fixed point for lms norm
  • Loading branch information
christophe0606 committed Jun 14, 2023
1 parent 8703d45 commit 540161c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions Source/FilteringFunctions/arm_lms_norm_q15.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions Source/FilteringFunctions/arm_lms_norm_q31.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ 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;

Expand Down

0 comments on commit 540161c

Please sign in to comment.