[xiph-commits] r7136 - in trunk/speex: . include/speex libspeex

jm at dactyl.lonelymoon.com jm
Thu Jul 15 00:52:16 PDT 2004


Author: jm
Date: Thu Jul 15 00:52:16 2004
New Revision: 7136

Modified:
trunk/speex/Makefile.am
trunk/speex/include/speex/speex_echo.h
trunk/speex/include/speex/speex_jitter.h
trunk/speex/libspeex/jitter.c
trunk/speex/libspeex/mdf.c
Log:
cleanup in EC and hitter buffer. removed some automake options


Modified: trunk/speex/Makefile.am
===================================================================
--- trunk/speex/Makefile.am	2004-07-15 07:46:53 UTC (rev 7135)
+++ trunk/speex/Makefile.am	2004-07-15 07:52:16 UTC (rev 7136)
@@ -2,7 +2,7 @@

# To disable automatic dependency tracking if using other tools than
# gcc and gmake, add the option 'no-dependencies'
-AUTOMAKE_OPTIONS = foreign 1.6 dist-zip
+AUTOMAKE_OPTIONS = 1.6

m4datadir = $(datadir)/aclocal
m4data_DATA = speex.m4

Modified: trunk/speex/include/speex/speex_echo.h
===================================================================
--- trunk/speex/include/speex/speex_echo.h	2004-07-15 07:46:53 UTC (rev 7135)
+++ trunk/speex/include/speex/speex_echo.h	2004-07-15 07:52:16 UTC (rev 7136)
@@ -58,7 +58,6 @@
float *power;
float *power_1;
float *grad;
-   float *old_grad;

struct drft_lookup *fft_lookup;

@@ -75,6 +74,9 @@
/** Performs echo cancellation a frame */
void speex_echo_cancel(SpeexEchoState *st, short *ref, short *echo, short *out, int *Y);

+/** Reset the echo canceller state */
+void speex_echo_reset(SpeexEchoState *st);
+
#ifdef __cplusplus
}
#endif

Modified: trunk/speex/include/speex/speex_jitter.h
===================================================================
--- trunk/speex/include/speex/speex_jitter.h	2004-07-15 07:46:53 UTC (rev 7135)
+++ trunk/speex/include/speex/speex_jitter.h	2004-07-15 07:52:16 UTC (rev 7136)
@@ -64,12 +64,8 @@
int reset_state;

int lost_count;
-   float drift_average;
float shortterm_margin[MAX_MARGIN];
float longterm_margin[MAX_MARGIN];
-   float late_ratio;
-   float ontime_ratio;
-   float early_ratio;
float loss_rate;
} SpeexJitter;

@@ -79,10 +75,8 @@

void speex_jitter_put(SpeexJitter *jitter, char *packet, int len, int time);

-void speex_jitter_get(SpeexJitter *jitter, short *out);
+void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp);

-int speex_jitter_get_pointer_timestamp(SpeexJitter *jitter);
-
#ifdef __cplusplus
}
#endif

Modified: trunk/speex/libspeex/jitter.c
===================================================================
--- trunk/speex/libspeex/jitter.c	2004-07-15 07:46:53 UTC (rev 7135)
+++ trunk/speex/libspeex/jitter.c	2004-07-15 07:52:16 UTC (rev 7136)
@@ -85,10 +85,6 @@
{
jitter->reset_state=0;
jitter->pointer_timestamp = timestamp-jitter->frame_time * jitter->buffer_size;
-      jitter->drift_average = 0;
-      jitter->late_ratio = 0;
-      jitter->early_ratio = 0;
-      jitter->ontime_ratio = 0;
for (i=0;i<MAX_MARGIN;i++)
{
jitter->shortterm_margin[i] = 0;
@@ -178,7 +174,7 @@
/*fprintf (stderr, "margin : %d %d %f %f %f %f\n", arrival_margin, jitter->buffer_size, 100*jitter->loss_rate, 100*jitter->late_ratio, 100*jitter->ontime_ratio, 100*jitter->early_ratio);*/
}

-void speex_jitter_get(SpeexJitter *jitter, short *out)
+void speex_jitter_get(SpeexJitter *jitter, short *out, int *current_timestamp)
{
int i;
int ret;
@@ -223,7 +219,8 @@
jitter->longterm_margin[0] = 0;
/*fprintf (stderr, "interpolate frame\n");*/
speex_decode_int(jitter->dec, NULL, out);
-      jitter->drift_average += jitter->frame_time;
+      if (current_timestamp)
+         *current_timestamp = jitter->pointer_timestamp;
return;
}

@@ -243,9 +240,10 @@
jitter->longterm_margin[MAX_MARGIN-1] = 0;
/*fprintf (stderr, "drop frame\n");*/
jitter->pointer_timestamp += jitter->frame_time;
-      jitter->drift_average -= jitter->frame_time;
}

+   if (current_timestamp)
+      *current_timestamp = jitter->pointer_timestamp;

/* Send zeros while we fill in the buffer */
if (jitter->pointer_timestamp<0)

Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c	2004-07-15 07:46:53 UTC (rev 7135)
+++ trunk/speex/libspeex/mdf.c	2004-07-15 07:52:16 UTC (rev 7136)
@@ -75,7 +75,6 @@
st->power = (float*)speex_alloc((frame_size+1)*sizeof(float));
st->power_1 = (float*)speex_alloc((frame_size+1)*sizeof(float));
st->grad = (float*)speex_alloc(N*M*sizeof(float));
-   st->old_grad = (float*)speex_alloc(N*M*sizeof(float));

for (i=0;i<N*M;i++)
{
@@ -84,6 +83,20 @@
return st;
}

+void speex_echo_reset(SpeexEchoState *st)
+{
+   int i, M, N;
+   st->cancel_count=0;
+   st->adapt_rate = .01f;
+   N = st->window_size;
+   M = st->M;
+   for (i=0;i<N*M;i++)
+   {
+      st->W[i] = 0;
+      st->X[i] = 0;
+   }
+}
+
/** Destroys an echo canceller state */
void speex_echo_state_destroy(SpeexEchoState *st)
{
@@ -102,7 +115,6 @@
speex_free(st->power);
speex_free(st->power_1);
speex_free(st->grad);
-   speex_free(st->old_grad);

speex_free(st);
}
@@ -291,7 +303,6 @@

for (i=0;i<N;i++)
{
-         st->old_grad[j*N+i] = st->PHI[i];
st->grad[j*N+i] = st->PHI[i];
}




More information about the commits mailing list