Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 249719
b: refs/heads/master
c: 7a9aea5
h: refs/heads/master
i:
  249717: 1e82a8c
  249715: cb536c4
  249711: 6a5cea2
v: v3
  • Loading branch information
Rahul Tank authored and Greg Kroah-Hartman committed May 17, 2011
1 parent 38b3d8c commit 59896f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 1c6e79d9922a8199dce9efbdda3e1942b8ee4a0b
refs/heads/master: 7a9aea511a902d12b7a37e93b8c1eff24a0b2e48
26 changes: 15 additions & 11 deletions trunk/drivers/staging/echo/echo.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,10 @@
#define DTD_HANGOVER 600 /* 600 samples, or 75ms */
#define DC_LOG2BETA 3 /* log2() of DC filter Beta */


/* adapting coeffs using the traditional stochastic descent (N)LMS algorithm */

#ifdef __bfin__
static inline void lms_adapt_bg(struct oslec_state *ec, int clean,
int shift)
static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
{
int i, j;
int offset1;
Expand Down Expand Up @@ -189,8 +187,7 @@ static inline void lms_adapt_bg(struct oslec_state *ec, int clean,
*/

#else
static inline void lms_adapt_bg(struct oslec_state *ec, int clean,
int shift)
static inline void lms_adapt_bg(struct oslec_state *ec, int clean, int shift)
{
int i;

Expand Down Expand Up @@ -225,7 +222,7 @@ static inline int top_bit(unsigned int bits)
if (bits == 0)
return -1;
else
return (int)fls((int32_t)bits)-1;
return (int)fls((int32_t) bits) - 1;
}

struct oslec_state *oslec_create(int len, int adaption_mode)
Expand Down Expand Up @@ -279,6 +276,7 @@ struct oslec_state *oslec_create(int len, int adaption_mode)
kfree(ec);
return NULL;
}

EXPORT_SYMBOL_GPL(oslec_create);

void oslec_free(struct oslec_state *ec)
Expand All @@ -292,12 +290,14 @@ void oslec_free(struct oslec_state *ec)
kfree(ec->snapshot);
kfree(ec);
}

EXPORT_SYMBOL_GPL(oslec_free);

void oslec_adaption_mode(struct oslec_state *ec, int adaption_mode)
{
ec->adaption_mode = adaption_mode;
}

EXPORT_SYMBOL_GPL(oslec_adaption_mode);

void oslec_flush(struct oslec_state *ec)
Expand All @@ -324,12 +324,14 @@ void oslec_flush(struct oslec_state *ec)
ec->curr_pos = ec->taps - 1;
ec->Pstates = 0;
}

EXPORT_SYMBOL_GPL(oslec_flush);

void oslec_snapshot(struct oslec_state *ec)
{
memcpy(ec->snapshot, ec->fir_taps16[0], ec->taps * sizeof(int16_t));
}

EXPORT_SYMBOL_GPL(oslec_snapshot);

/* Dual Path Echo Canceller */
Expand Down Expand Up @@ -404,11 +406,11 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
/* efficient "out with the old and in with the new" algorithm so
we don't have to recalculate over the whole block of
samples. */
new = (int)tx * (int)tx;
new = (int)tx *(int)tx;
old = (int)ec->fir_state.history[ec->fir_state.curr_pos] *
(int)ec->fir_state.history[ec->fir_state.curr_pos];
ec->Pstates +=
((new - old) + (1 << (ec->log2taps-1))) >> ec->log2taps;
((new - old) + (1 << (ec->log2taps - 1))) >> ec->log2taps;
if (ec->Pstates < 0)
ec->Pstates = 0;
}
Expand Down Expand Up @@ -466,7 +468,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
factor = (2^30) * (2^-2) * clean_bg_rx/P
(30 - 2 - log2(P))
(30 - 2 - log2(P))
factor = clean_bg_rx 2 ----- (3)
To avoid a divide we approximate log2(P) as top_bit(P),
Expand Down Expand Up @@ -514,7 +516,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
*/
ec->adapt = 1;
memcpy(ec->fir_taps16[0], ec->fir_taps16[1],
ec->taps * sizeof(int16_t));
ec->taps * sizeof(int16_t));
} else
ec->cond_met++;
} else
Expand Down Expand Up @@ -601,6 +603,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)

return (int16_t) ec->clean_nlp << 1;
}

EXPORT_SYMBOL_GPL(oslec_update);

/* This function is separated from the echo canceller is it is usually called
Expand All @@ -625,7 +628,7 @@ EXPORT_SYMBOL_GPL(oslec_update);
giving very clean DC removal.
*/

int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx)
int16_t oslec_hpf_tx(struct oslec_state * ec, int16_t tx)
{
int tmp, tmp1;

Expand Down Expand Up @@ -654,6 +657,7 @@ int16_t oslec_hpf_tx(struct oslec_state *ec, int16_t tx)

return tx;
}

EXPORT_SYMBOL_GPL(oslec_hpf_tx);

MODULE_LICENSE("GPL");
Expand Down

0 comments on commit 59896f2

Please sign in to comment.