From c29ec40711f1511aba25187e5443f48ca4095876 Mon Sep 17 00:00:00 2001 From: "Raine M. Ekman" Date: Tue, 10 Jun 2014 11:57:59 +0300 Subject: [PATCH 1/2] basic_filters.h: Remove unneccessary LP filter calculations in Formantfilter --- include/basic_filters.h | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/include/basic_filters.h b/include/basic_filters.h index e41046e61..4ba03f110 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -315,7 +315,7 @@ public: case Formantfilter: { - sample_t lp, hp, bp, in; + sample_t hp, bp, in; out = 0; for(int o=0; o<4; o++) @@ -325,10 +325,6 @@ public: in = (in > +1.f) ? +1.f : in; in = (in < -1.f) ? -1.f : in; - lp = in * m_vfb[0] + m_vflp[0][_chnl] * m_vfa[0]; - lp = (lp > +1.f) ? +1.f : lp; - lp = (lp < -1.f) ? -1.f : lp; - hp = m_vfc[0] * ( m_vfhp[0][_chnl] + in - m_vflast[0][_chnl] ); hp = (hp > +1.f) ? +1.f : hp; hp = (hp < -1.f) ? -1.f : hp; @@ -338,7 +334,6 @@ public: bp = (bp < -1.f) ? -1.f : bp; m_vflast[0][_chnl] = in; - m_vflp[0][_chnl] = lp; m_vfhp[0][_chnl] = hp; m_vfbp[0][_chnl] = bp; @@ -346,10 +341,6 @@ public: in = (in > +1.f) ? +1.f : in; in = (in < -1.f) ? -1.f : in; - lp = in * m_vfb[0] + m_vflp[2][_chnl] * m_vfa[0]; - lp = (lp > +1.f) ? +1.f : lp; - lp = (lp < -1.f) ? -1.f : lp; - hp = m_vfc[0] * ( m_vfhp[2][_chnl] + in - m_vflast[2][_chnl] ); hp = (hp > +1.f) ? +1.f : hp; hp = (hp < -1.f) ? -1.f : hp; @@ -359,7 +350,6 @@ public: bp = (bp < -1.f) ? -1.f : bp; m_vflast[2][_chnl] = in; - m_vflp[2][_chnl] = lp; m_vfhp[2][_chnl] = hp; m_vfbp[2][_chnl] = bp; @@ -367,10 +357,6 @@ public: in = (in > +1.f) ? +1.f : in; in = (in < -1.f) ? -1.f : in; - lp = in * m_vfb[0] + m_vflp[4][_chnl] * m_vfa[0]; - lp = (lp > +1.f) ? +1.f : lp; - lp = (lp < -1.f) ? -1.f : lp; - hp = m_vfc[0] * ( m_vfhp[4][_chnl] + in - m_vflast[4][_chnl] ); hp = (hp > +1.f) ? +1.f : hp; hp = (hp < -1.f) ? -1.f : hp; @@ -380,7 +366,6 @@ public: bp = (bp < -1.f) ? -1.f : bp; m_vflast[4][_chnl] = in; - m_vflp[4][_chnl] = lp; m_vfhp[4][_chnl] = hp; m_vfbp[4][_chnl] = bp; @@ -391,10 +376,6 @@ public: in = (in > +1.f) ? +1.f : in; in = (in < -1.f) ? -1.f : in; - lp = in * m_vfb[1] + m_vflp[1][_chnl] * m_vfa[1]; - lp = (lp > +1.f) ? +1.f : lp; - lp = (lp < -1.f) ? -1.f : lp; - hp = m_vfc[1] * ( m_vfhp[1][_chnl] + in - m_vflast[1][_chnl] ); hp = (hp > +1.f) ? +1.f : hp; hp = (hp < -1.f) ? -1.f : hp; @@ -404,7 +385,6 @@ public: bp = (bp < -1.f) ? -1.f : bp; m_vflast[1][_chnl] = in; - m_vflp[1][_chnl] = lp; m_vfhp[1][_chnl] = hp; m_vfbp[1][_chnl] = bp; @@ -412,10 +392,6 @@ public: in = (in > +1.f) ? +1.f : in; in = (in < -1.f) ? -1.f : in; - lp = in * m_vfb[1] + m_vflp[3][_chnl] * m_vfa[1]; - lp = (lp > +1.f) ? +1.f : lp; - lp = (lp < -1.f) ? -1.f : lp; - hp = m_vfc[1] * ( m_vfhp[3][_chnl] + in - m_vflast[3][_chnl] ); hp = (hp > +1.f) ? +1.f : hp; hp = (hp < -1.f) ? -1.f : hp; @@ -425,7 +401,6 @@ public: bp = (bp < -1.f) ? -1.f : bp; m_vflast[3][_chnl] = in; - m_vflp[3][_chnl] = lp; m_vfhp[3][_chnl] = hp; m_vfbp[3][_chnl] = bp; @@ -433,10 +408,6 @@ public: in = (in > +1.f) ? +1.f : in; in = (in < -1.f) ? -1.f : in; - lp = in * m_vfb[1] + m_vflp[5][_chnl] * m_vfa[1]; - lp = (lp > +1.f) ? +1.f : lp; - lp = (lp < -1.f) ? -1.f : lp; - hp = m_vfc[1] * ( m_vfhp[5][_chnl] + in - m_vflast[5][_chnl] ); hp = (hp > +1.f) ? +1.f : hp; hp = (hp < -1.f) ? -1.f : hp; @@ -446,7 +417,6 @@ public: bp = (bp < -1.f) ? -1.f : bp; m_vflast[5][_chnl] = in; - m_vflp[5][_chnl] = lp; m_vfhp[5][_chnl] = hp; m_vfbp[5][_chnl] = bp; From 0941520d8cdf12914f443b4476dcaade37ac3588 Mon Sep 17 00:00:00 2001 From: "Raine M. Ekman" Date: Tue, 10 Jun 2014 12:10:42 +0300 Subject: [PATCH 2/2] basic_filters.h: One unnecessary m_vflp array removed. --- include/basic_filters.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/basic_filters.h b/include/basic_filters.h index 4ba03f110..e32ed886b 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -138,7 +138,7 @@ public: m_rclp1[_chnl] = m_rcbp1[_chnl] = m_rchp1[_chnl] = m_rclast1[_chnl] = 0.0f; for(int i=0; i<6; i++) - m_vflp[i][_chnl] = m_vfbp[i][_chnl] = m_vfhp[i][_chnl] = m_vflast[i][_chnl] = 0.0f; + m_vfbp[i][_chnl] = m_vfhp[i][_chnl] = m_vflast[i][_chnl] = 0.0f; } } @@ -631,7 +631,7 @@ private: frame m_rcbp1, m_rclp1, m_rchp1, m_rclast1; // in/out history for Formant-filters - frame m_vfbp[6], m_vflp[6], m_vfhp[6], m_vflast[6]; + frame m_vfbp[6], m_vfhp[6], m_vflast[6]; FilterTypes m_type; bool m_doubleFilter;