2727 * You should have received a copy of the GNU General Public License
2828 * along with this program; if not, write to the Free Software
2929 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
30- *
31- * $Id: echo.c,v 1.20 2006/12/01 18:00:48 steveu Exp $
3230 */
3331
3432/*! \file */
113111
114112#define MIN_TX_POWER_FOR_ADAPTION 64
115113#define MIN_RX_POWER_FOR_ADAPTION 64
116- #define DTD_HANGOVER 600 /* 600 samples, or 75ms */
117- #define DC_LOG2BETA 3 /* log2() of DC filter Beta */
114+ #define DTD_HANGOVER 600 /* 600 samples, or 75ms */
115+ #define DC_LOG2BETA 3 /* log2() of DC filter Beta */
118116
119117/*-----------------------------------------------------------------------*\
120- FUNCTIONS
118+ FUNCTIONS
121119\*-----------------------------------------------------------------------*/
122120
123121/* adapting coeffs using the traditional stochastic descent (N)LMS algorithm */
124122
125123#ifdef __bfin__
126- static void __inline__ lms_adapt_bg (struct oslec_state * ec , int clean ,
124+ static inline void lms_adapt_bg (struct oslec_state * ec , int clean ,
127125 int shift )
128126{
129127 int i , j ;
@@ -147,13 +145,13 @@ static void __inline__ lms_adapt_bg(struct oslec_state *ec, int clean,
147145
148146 /* st: and en: help us locate the assembler in echo.s */
149147
150- // asm("st:");
148+ /* asm("st:"); */
151149 n = ec -> taps ;
152150 for (i = 0 , j = offset2 ; i < n ; i ++ , j ++ ) {
153151 exp = * phist ++ * factor ;
154152 ec -> fir_taps16 [1 ][i ] += (int16_t ) ((exp + (1 << 14 )) >> 15 );
155153 }
156- // asm("en:");
154+ /* asm("en:"); */
157155
158156 /* Note the asm for the inner loop above generated by Blackfin gcc
159157 4.1.1 is pretty good (note even parallel instructions used):
@@ -195,7 +193,7 @@ static void __inline__ lms_adapt_bg(struct oslec_state *ec, int clean,
195193*/
196194
197195#else
198- static __inline__ void lms_adapt_bg (struct oslec_state * ec , int clean ,
196+ static inline void lms_adapt_bg (struct oslec_state * ec , int clean ,
199197 int shift )
200198{
201199 int i ;
@@ -249,9 +247,8 @@ struct oslec_state *oslec_create(int len, int adaption_mode)
249247 fir16_create (& ec -> fir_state , ec -> fir_taps16 [0 ], ec -> taps );
250248 fir16_create (& ec -> fir_state_bg , ec -> fir_taps16 [1 ], ec -> taps );
251249
252- for (i = 0 ; i < 5 ; i ++ ) {
250+ for (i = 0 ; i < 5 ; i ++ )
253251 ec -> xvtx [i ] = ec -> yvtx [i ] = ec -> xvrx [i ] = ec -> yvrx [i ] = 0 ;
254- }
255252
256253 ec -> cng_level = 1000 ;
257254 oslec_adaption_mode (ec , adaption_mode );
@@ -271,14 +268,13 @@ struct oslec_state *oslec_create(int len, int adaption_mode)
271268
272269 return ec ;
273270
274- error_oom :
271+ error_oom :
275272 for (i = 0 ; i < 2 ; i ++ )
276273 kfree (ec -> fir_taps16 [i ]);
277274
278275 kfree (ec );
279276 return NULL ;
280277}
281-
282278EXPORT_SYMBOL_GPL (oslec_create );
283279
284280void oslec_free (struct oslec_state * ec )
@@ -292,14 +288,12 @@ void oslec_free(struct oslec_state *ec)
292288 kfree (ec -> snapshot );
293289 kfree (ec );
294290}
295-
296291EXPORT_SYMBOL_GPL (oslec_free );
297292
298293void oslec_adaption_mode (struct oslec_state * ec , int adaption_mode )
299294{
300295 ec -> adaption_mode = adaption_mode ;
301296}
302-
303297EXPORT_SYMBOL_GPL (oslec_adaption_mode );
304298
305299void oslec_flush (struct oslec_state * ec )
@@ -326,14 +320,12 @@ void oslec_flush(struct oslec_state *ec)
326320 ec -> curr_pos = ec -> taps - 1 ;
327321 ec -> Pstates = 0 ;
328322}
329-
330323EXPORT_SYMBOL_GPL (oslec_flush );
331324
332325void oslec_snapshot (struct oslec_state * ec )
333326{
334327 memcpy (ec -> snapshot , ec -> fir_taps16 [0 ], ec -> taps * sizeof (int16_t ));
335328}
336-
337329EXPORT_SYMBOL_GPL (oslec_snapshot );
338330
339331/* Dual Path Echo Canceller ------------------------------------------------*/
@@ -399,7 +391,7 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
399391 /* efficient "out with the old and in with the new" algorithm so
400392 we don't have to recalculate over the whole block of
401393 samples. */
402- new = (int )tx * (int )tx ;
394+ new = (int )tx * (int )tx ;
403395 old = (int )ec -> fir_state .history [ec -> fir_state .curr_pos ] *
404396 (int )ec -> fir_state .history [ec -> fir_state .curr_pos ];
405397 ec -> Pstates +=
@@ -498,15 +490,15 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
498490
499491 if ((ec -> adaption_mode & ECHO_CAN_USE_ADAPTION ) &&
500492 (ec -> nonupdate_dwell == 0 ) &&
501- ( 8 * ec -> Lclean_bg <
502- 7 * ec -> Lclean ) /* (ec-> Lclean_bg < 0.875* ec->Lclean) */ &&
503- ( 8 * ec -> Lclean_bg <
504- ec -> Ltx ) /* ( ec->Lclean_bg < 0.125* ec->Ltx) */ ) {
493+ /* ( ec->Lclean_bg < 0.875*ec->Lclean) */
494+ ( 8 * ec -> Lclean_bg < 7 * ec -> Lclean ) &&
495+ /* ( ec->Lclean_bg < 0.125*ec->Ltx) */
496+ ( 8 * ec -> Lclean_bg < ec -> Ltx )) {
505497 if (ec -> cond_met == 6 ) {
506498 /* BG filter has had better results for 6 consecutive samples */
507499 ec -> adapt = 1 ;
508500 memcpy (ec -> fir_taps16 [0 ], ec -> fir_taps16 [1 ],
509- ec -> taps * sizeof (int16_t ));
501+ ec -> taps * sizeof (int16_t ));
510502 } else
511503 ec -> cond_met ++ ;
512504 } else
@@ -580,7 +572,6 @@ int16_t oslec_update(struct oslec_state *ec, int16_t tx, int16_t rx)
580572
581573 return (int16_t ) ec -> clean_nlp << 1 ;
582574}
583-
584575EXPORT_SYMBOL_GPL (oslec_update );
585576
586577/* This function is seperated from the echo canceller is it is usually called
@@ -604,7 +595,7 @@ EXPORT_SYMBOL_GPL(oslec_update);
604595 precision, which noise shapes things, giving very clean DC removal.
605596*/
606597
607- int16_t oslec_hpf_tx (struct oslec_state * ec , int16_t tx )
598+ int16_t oslec_hpf_tx (struct oslec_state * ec , int16_t tx )
608599{
609600 int tmp , tmp1 ;
610601
@@ -629,7 +620,6 @@ int16_t oslec_hpf_tx(struct oslec_state * ec, int16_t tx)
629620
630621 return tx ;
631622}
632-
633623EXPORT_SYMBOL_GPL (oslec_hpf_tx );
634624
635625MODULE_LICENSE ("GPL" );
0 commit comments