[dahdi-commits] mattf: branch linux/kpfleming/echocan_work r6425 - /linux/team/kpfleming/echo...
SVN commits to the DAHDI project
dahdi-commits at lists.digium.com
Tue Apr 21 14:13:25 CDT 2009
Author: mattf
Date: Tue Apr 21 14:13:22 2009
New Revision: 6425
URL: http://svn.digium.com/svn-view/dahdi?view=rev&rev=6425
Log:
Add support for NLP toggling of KB1 and MG2
Modified:
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c
linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c?view=diff&rev=6425&r1=6424&r2=6425
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_kb1.c Tue Apr 21 14:13:22 2009
@@ -147,6 +147,7 @@
static void echo_can_free(struct dahdi_echocan_state *ec);
static void echo_can_array_update(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
+static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
static const struct dahdi_echocan_factory my_factory = {
.name = "KB1",
@@ -154,10 +155,15 @@
.echocan_create = echo_can_create,
};
+static const struct dahdi_echocan_features my_features = {
+ .NLP_toggle = 1,
+};
+
static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
+ .echocan_NLP_toggle = echocan_NLP_toggle,
};
struct ec_pvt {
@@ -226,6 +232,7 @@
int avg_Lu_i_ok;
#endif
unsigned int aggressive:1;
+ int use_nlp;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
@@ -524,36 +531,38 @@
#endif
#ifndef NO_ECHO_SUPPRESSOR
- if (pvt->aggressive) {
- if ((pvt->HCNTR_d < AGGRESSIVE_HCNTR) && (pvt->Ly_i > (pvt->Lu_i << 1))) {
- for (k=0; k < 2; k++) {
- u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1);
- }
-#ifdef MEC2_STATS_DETAILED
- printk(KERN_INFO "aggresively correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
-#endif
-#ifdef MEC2_STATS
- ++pvt->cntr_residualcorrected_frames;
-#endif
- }
- } else {
- if (pvt->HCNTR_d == 0) {
- if ((pvt->Ly_i/(pvt->Lu_i + 1)) > DEFAULT_SUPPR_I) {
- for (k=0; k < 1; k++) {
- u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1);
+ if (pvt->use_nlp) {
+ if (pvt->aggressive) {
+ if ((pvt->HCNTR_d < AGGRESSIVE_HCNTR) && (pvt->Ly_i > (pvt->Lu_i << 1))) {
+ for (k=0; k < 2; k++) {
+ u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1);
}
#ifdef MEC2_STATS_DETAILED
- printk(KERN_INFO "correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
+ printk(KERN_INFO "aggresively correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifdef MEC2_STATS
++pvt->cntr_residualcorrected_frames;
#endif
}
-#ifdef MEC2_STATS
- else {
- ++pvt->cntr_residualcorrected_framesskipped;
+ } else {
+ if (pvt->HCNTR_d == 0) {
+ if ((pvt->Ly_i/(pvt->Lu_i + 1)) > DEFAULT_SUPPR_I) {
+ for (k=0; k < 1; k++) {
+ u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1);
+ }
+#ifdef MEC2_STATS_DETAILED
+ printk(KERN_INFO "correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
+#endif
+#ifdef MEC2_STATS
+ ++pvt->cntr_residualcorrected_frames;
+#endif
+ }
+#ifdef MEC2_STATS
+ else {
+ ++pvt->cntr_residualcorrected_framesskipped;
+ }
+#endif
}
-#endif
}
}
#endif
@@ -653,6 +662,7 @@
pvt->dahdi.ops = &my_ops;
pvt->aggressive = aggressive;
+ pvt->dahdi.features = my_features;
for (x = 0; x < ecp->param_count; x++) {
for (c = p[x].name; *c; c++)
@@ -668,6 +678,10 @@
}
init_cc(pvt, ecp->tap_length, maxy, maxu);
+ /* Non-linear processor - a fancy way to say "zap small signals, to avoid
+ accumulating noise". */
+ pvt->use_nlp = TRUE;
+ pvt->dahdi.status.NLP_enabled = 1;
*ec = &pvt->dahdi;
return 0;
@@ -694,6 +708,14 @@
return 0;
}
+static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable)
+{
+ struct ec_pvt *pvt = dahdi_to_pvt(ec);
+
+ pvt->use_nlp = enable ? 1 : 0;
+ pvt->dahdi.status.NLP_enabled = enable;
+}
+
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
Modified: linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c
URL: http://svn.digium.com/svn-view/dahdi/linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c?view=diff&rev=6425&r1=6424&r2=6425
==============================================================================
--- linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c (original)
+++ linux/team/kpfleming/echocan_work/drivers/dahdi/dahdi_echocan_mg2.c Tue Apr 21 14:13:22 2009
@@ -179,6 +179,7 @@
static void echo_can_free(struct dahdi_echocan_state *ec);
static void echo_can_array_update(struct dahdi_echocan_state *ec, short *isig, const short *iref, u32 size);
static int echo_can_traintap(struct dahdi_echocan_state *ec, int pos, short val);
+static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable);
static const struct dahdi_echocan_factory my_factory = {
.name = "MG2",
@@ -186,10 +187,15 @@
.echocan_create = echo_can_create,
};
+static const struct dahdi_echocan_features my_features = {
+ .NLP_toggle = 1,
+};
+
static const struct dahdi_echocan_ops my_ops = {
.echocan_free = echo_can_free,
.echocan_array_update = echo_can_array_update,
.echocan_traintap = echo_can_traintap,
+ .echocan_NLP_toggle = echocan_NLP_toggle,
};
struct ec_pvt {
@@ -267,6 +273,7 @@
#ifdef DC_NORMALIZE
int dc_estimate;
#endif
+ int use_nlp;
};
#define dahdi_to_pvt(a) container_of(a, struct ec_pvt, dahdi)
@@ -664,36 +671,38 @@
#endif
#ifndef NO_ECHO_SUPPRESSOR
- if (pvt->aggressive) {
- if ((pvt->HCNTR_d < AGGRESSIVE_HCNTR) && (pvt->Ly_i > (pvt->Lu_i << 1))) {
- for (k=0; k < 2; k++) {
- u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1);
- }
-#ifdef MEC2_STATS_DETAILED
- printk(KERN_INFO "aggresively correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
-#endif
-#ifdef MEC2_STATS
- ++pvt->cntr_residualcorrected_frames;
-#endif
- }
- } else {
- if (pvt->HCNTR_d == 0) {
- if ((pvt->Ly_i/(pvt->Lu_i + 1)) > DEFAULT_SUPPR_I) {
- for (k=0; k < 1; k++) {
- u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1);
+ if (pvt->use_nlp) {
+ if (pvt->aggressive) {
+ if ((pvt->HCNTR_d < AGGRESSIVE_HCNTR) && (pvt->Ly_i > (pvt->Lu_i << 1))) {
+ for (k=0; k < 2; k++) {
+ u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I)) + 1);
}
#ifdef MEC2_STATS_DETAILED
- printk(KERN_INFO "correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
+ printk(KERN_INFO "aggresively correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
#endif
#ifdef MEC2_STATS
++pvt->cntr_residualcorrected_frames;
#endif
}
-#ifdef MEC2_STATS
- else {
- ++pvt->cntr_residualcorrected_framesskipped;
+ } else {
+ if (pvt->HCNTR_d == 0) {
+ if ((pvt->Ly_i/(pvt->Lu_i + 1)) > DEFAULT_SUPPR_I) {
+ for (k=0; k < 1; k++) {
+ u = u * (pvt->Lu_i >> DEFAULT_SIGMA_LU_I) / ((pvt->Ly_i >> (DEFAULT_SIGMA_LY_I + 2)) + 1);
+ }
+#ifdef MEC2_STATS_DETAILED
+ printk(KERN_INFO "correcting frame with pvt->Ly_i %9d pvt->Lu_i %9d expression %d\n", pvt->Ly_i, pvt->Lu_i, (pvt->Ly_i/(pvt->Lu_i + 1)));
+#endif
+#ifdef MEC2_STATS
+ ++pvt->cntr_residualcorrected_frames;
+#endif
+ }
+#ifdef MEC2_STATS
+ else {
+ ++pvt->cntr_residualcorrected_framesskipped;
+ }
+#endif
}
-#endif
}
}
#endif
@@ -794,6 +803,7 @@
pvt->dahdi.ops = &my_ops;
pvt->aggressive = aggressive;
+ pvt->dahdi.features = my_features;
for (x = 0; x < ecp->param_count; x++) {
for (c = p[x].name; *c; c++)
@@ -809,6 +819,10 @@
}
init_cc(pvt, ecp->tap_length, maxy, maxu);
+ /* Non-linear processor - a fancy way to say "zap small signals, to avoid
+ accumulating noise". */
+ pvt->use_nlp = TRUE;
+ pvt->dahdi.status.NLP_enabled = 1;
*ec = &pvt->dahdi;
return 0;
@@ -841,6 +855,14 @@
return 0;
}
+static void echocan_NLP_toggle(struct dahdi_echocan_state *ec, unsigned int enable)
+{
+ struct ec_pvt *pvt = dahdi_to_pvt(ec);
+
+ pvt->use_nlp = enable ? 1 : 0;
+ pvt->dahdi.status.NLP_enabled = enable;
+}
+
static int __init mod_init(void)
{
if (dahdi_register_echocan_factory(&my_factory)) {
More information about the dahdi-commits
mailing list