diff options
author | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-19 04:04:16 +0000 |
---|---|---|
committer | kpfleming <kpfleming@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-12-19 04:04:16 +0000 |
commit | 4a8f1fb6fa4e4ad06f171c30d129dfeef6d07867 (patch) | |
tree | 9489f3307b1958505c482cccf5c5a06fe7da6fdf /mg2ec.h | |
parent | e68e5ec9adb20f793ad0319b181cfdeea336826d (diff) |
add ability to provide parameters to echo cancelers on a per-channel basis, and remove the three versions of the 'Mark' echo canceler (later replaced by KB1 and then by MG2)
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.4@3524 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'mg2ec.h')
-rw-r--r-- | mg2ec.h | 66 |
1 files changed, 33 insertions, 33 deletions
@@ -508,7 +508,7 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short memset(max_coeffs, 0, USED_COEFFS*sizeof(int)); #endif #ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "updating coefficients with: ec->Lu_i %9d\n", ec->Lu_i); + printk(KERN_INFO "updating coefficients with: ec->Lu_i %9d\n", ec->Lu_i); #endif #ifdef MEC2_STATS ec->avg_Lu_i_ok = ec->avg_Lu_i_ok + ec->Lu_i; @@ -550,7 +550,7 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short #endif } else { #ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "insufficient signal to update coefficients ec->Lu_i %5d < %5d\n", ec->Lu_i, MIN_UPDATE_THRESH_I); + printk(KERN_INFO "insufficient signal to update coefficients ec->Lu_i %5d < %5d\n", ec->Lu_i, MIN_UPDATE_THRESH_I); #endif #ifdef MEC2_STATS ec->avg_Lu_i_toolow = ec->avg_Lu_i_toolow + ec->Lu_i; @@ -565,7 +565,7 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short */ #ifdef MEC2_STATS_DETAILED if (ec->HCNTR_d == 0) - printk( KERN_INFO "possibily correcting frame with ec->Ly_i %9d ec->Lu_i %9d and expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); + printk(KERN_INFO "possibily correcting frame with ec->Ly_i %9d ec->Lu_i %9d and expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); #endif #ifndef NO_ECHO_SUPPRESSOR @@ -575,7 +575,7 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1); } #ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "aggresively correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); + printk(KERN_INFO "aggresively correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); #endif #ifdef MEC2_STATS ++ec->cntr_residualcorrected_frames; @@ -588,7 +588,7 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short u = u * (ec->Lu_i >> DEFAULT_SIGMA_LU_I) / ((ec->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1); } #ifdef MEC2_STATS_DETAILED - printk( KERN_INFO "correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); + printk(KERN_INFO "correcting frame with ec->Ly_i %9d ec->Lu_i %9d expression %d\n", ec->Ly_i, ec->Lu_i, (ec->Ly_i/(ec->Lu_i + 1))); #endif #ifdef MEC2_STATS ++ec->cntr_residualcorrected_frames; @@ -628,7 +628,7 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short else ec->avg_Lu_i_ok = -1; - printk( KERN_INFO "%d: Near end speech: %5d Residuals corrected/skipped: %5d/%5d Coefficients updated ok/low sig: %3d/%3d Lu_i avg ok/low sig %6d/%5d\n", + printk(KERN_INFO "%d: Near end speech: %5d Residuals corrected/skipped: %5d/%5d Coefficients updated ok/low sig: %3d/%3d Lu_i avg ok/low sig %6d/%5d\n", ec->id, ec->cntr_nearend_speech_frames, ec->cntr_residualcorrected_frames, ec->cntr_residualcorrected_framesskipped, @@ -650,12 +650,19 @@ static inline short echo_can_update(struct echo_can_state *ec, short iref, short return u; } -static inline struct echo_can_state *echo_can_create(int len, int adaption_mode) +static int echo_can_create(struct zt_echocanparams *ecp, struct zt_echocanparam *p, + struct echo_can_state **ec) { - struct echo_can_state *ec; int maxy; int maxu; - maxy = len + DEFAULT_M; + size_t size; + + if (ecp->param_count > 0) { + printk(KERN_WARNING "MG2 echo canceler does not support parameters; failing request\n"); + return -EINVAL; + } + + maxy = ecp->tap_length + DEFAULT_M; maxu = DEFAULT_M; if (maxy < (1 << DEFAULT_ALPHA_YT_I)) maxy = (1 << DEFAULT_ALPHA_YT_I); @@ -663,30 +670,23 @@ static inline struct echo_can_state *echo_can_create(int len, int adaption_mode) maxy = (1 << DEFAULT_SIGMA_LY_I); if (maxu < (1 << DEFAULT_SIGMA_LU_I)) maxu = (1 << DEFAULT_SIGMA_LU_I); - ec = (struct echo_can_state *)MALLOC(sizeof(struct echo_can_state) + - 4 + /* align */ - sizeof(int) * len + /* a_i */ - sizeof(short) * len + /* a_s */ - sizeof(int) * len + /* b_i */ - sizeof(int) * len + /* c_i */ - 2 * sizeof(short) * (maxy) + /* y_s */ - 2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */ - 2 * sizeof(short) * (maxu) + /* u_s */ - 2 * sizeof(short) * len); /* y_tilde_s */ - if (ec) { - memset(ec, 0, sizeof(struct echo_can_state) + - 4 + /* align */ - sizeof(int) * len + /* a_i */ - sizeof(short) * len + /* a_s */ - sizeof(int) * len + /* b_i */ - sizeof(int) * len + /* c_i */ - 2 * sizeof(short) * (maxy) + /* y_s */ - 2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */ - 2 * sizeof(short) * (maxu) + /* u_s */ - 2 * sizeof(short) * len); /* y_tilde_s */ - init_cc(ec, len, maxy, maxu); - } - return ec; + size = sizeof(**ec) + + 4 + /* align */ + sizeof(int) * ecp->tap_length + /* a_i */ + sizeof(short) * ecp->tap_length + /* a_s */ + sizeof(int) * ecp->tap_length + /* b_i */ + sizeof(int) * ecp->tap_length + /* c_i */ + 2 * sizeof(short) * (maxy) + /* y_s */ + 2 * sizeof(short) * (1 << DEFAULT_ALPHA_ST_I) + /* s_s */ + 2 * sizeof(short) * (maxu) + /* u_s */ + 2 * sizeof(short) * ecp->tap_length; /* y_tilde_s */ + + if (!(*ec = MALLOC(size))) + return -ENOMEM; + + memset(*ec, 0, size); + + return 0; } static inline int echo_can_traintap(struct echo_can_state *ec, int pos, short val) |