[xiph-cvs] cvs commit: speex/src speexdec.1 speexdec.c speexenc.1 speexenc.c

Jean-Marc Valin jm at xiph.org
Fri Dec 20 00:24:47 PST 2002



jm          02/12/20 03:24:47

  Modified:    .        configure.in
               doc      manual.lyx manual.pdf
               libspeex modes.c nb_celp.c nb_celp.h sb_celp.c sb_celp.h
                        speex.h
               src      speexdec.1 speexdec.c speexenc.1 speexenc.c
  Log:
  misc stuff for beta4

Revision  Changes    Path
1.39      +1 -1      speex/configure.in

Index: configure.in
===================================================================
RCS file: /usr/local/cvsroot/speex/configure.in,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- configure.in	27 Nov 2002 02:54:34 -0000	1.38
+++ configure.in	20 Dec 2002 08:24:46 -0000	1.39
@@ -5,7 +5,7 @@
 SPEEX_MAJOR_VERSION=0
 SPEEX_MINOR_VERSION=99
 SPEEX_MICRO_VERSION=0
-SPEEX_VERSION=1.0beta4cvs
+SPEEX_VERSION=1.0beta4
 SPEEX_BINARY_AGE=0
 SPEEX_INTERFACE_AGE=0
 

<p><p>1.38      +15 -4     speex/doc/manual.lyx

Index: manual.lyx
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.lyx,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- manual.lyx	2 Dec 2002 00:12:48 -0000	1.37
+++ manual.lyx	20 Dec 2002 08:24:46 -0000	1.38
@@ -3239,6 +3239,16 @@
 --vbr Enable VBR (Variable Bit-Rate), disabled by default
 \layout Description
 
+--abr\SpecialChar ~
+n Enable ABR (Average Bit-Rate) at n kbps, disabled by default
+\layout Description
+
+--vad Enable VAD (Voice Activity Detection), disabled by default
+\layout Description
+
+--dtx Enable DTX (Discontinuous Transmission), disabled by default
+\layout Description
+
 --nframes\SpecialChar ~
 n Pack n frames in each Ogg packet (this saves space at low bit-rates)
 \layout Description
@@ -3310,10 +3320,10 @@
 The decoder takes the following options:
 \layout Description
 
---enh enable post-filter
+--enh enable post-filter (default)
 \layout Description
 
---no-enh disable post-filter (default)
+--no-enh disable post-filter
 \layout Description
 
 --force-nb Force decoding in narrowband 
@@ -3897,7 +3907,7 @@
 
 \layout Standard
 
-Notify decoder of discontinuous transmission (DTX)
+reserved
 \end_inset 
 </cell>
 </row>
@@ -4053,7 +4063,7 @@
 
 \layout Standard
 
-Asks encoder to set VBR off (0), on(1), VAD-only (2)
+Asks encoder to set VBR off (0), on(1), VAD(2), DTX(3)
 \end_inset 
 </cell>
 </row>
@@ -5103,6 +5113,7 @@
 I guess it all depends on the bit-rate used.
  Though no formal testing has yet been performed, I'd say don't go below
  the 15 kbps mode if you want DTMF to be transmitted correctly.
+ DTMF at 8 kbps may work but your mileage may vary.
  Also, make sure you don't use the lowest complexity (see SPEEX_SET_COMPLEXITY
  or --comp option), as it causes important noise.
 \layout Subsection*

<p><p>1.5       +2195 -2204speex/doc/manual.pdf

Index: manual.pdf
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.pdf,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
Binary files /tmp/cvsxYkckC and /tmp/cvsSnbkXe differ

<p><p>1.93      +2 -2      speex/libspeex/modes.c

Index: modes.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.c,v
retrieving revision 1.92
retrieving revision 1.93
diff -u -r1.92 -r1.93
--- modes.c	20 Dec 2002 07:16:10 -0000	1.92
+++ modes.c	20 Dec 2002 08:24:46 -0000	1.93
@@ -530,9 +530,9 @@
    (*((SpeexMode**)state))->enc_destroy(state);
 }
 
-void speex_encode(void *state, float *in, SpeexBits *bits)
+int speex_encode(void *state, float *in, SpeexBits *bits)
 {
-   (*((SpeexMode**)state))->enc(state, in, bits);
+   return (*((SpeexMode**)state))->enc(state, in, bits);
 }
 
 void speex_decoder_destroy(void *state)

<p><p>1.100     +59 -47    speex/libspeex/nb_celp.c

Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- nb_celp.c	20 Dec 2002 07:16:10 -0000	1.99
+++ nb_celp.c	20 Dec 2002 08:24:46 -0000	1.100
@@ -173,6 +173,7 @@
 
    st->complexity=2;
    st->sampling_rate=8000;
+   st->dtx_count=0;
 
    return st;
 }
@@ -220,7 +221,7 @@
    speex_free((float*)st);
 }
 
-void nb_encode(void *state, float *in, SpeexBits *bits)
+int nb_encode(void *state, float *in, SpeexBits *bits)
 {
    EncState *st;
    int i, sub, roots;
@@ -428,14 +429,15 @@
       } else {
          /*VAD only case*/
          int mode;
-         if (st->relative_quality<4)
+         if (st->relative_quality<2)
          {
-            if (st->submodeID>1 || lsp_dist>.05 || !st->dtx_enabled)
-               mode=1;
-            else
+            if (st->submodeID>1 || lsp_dist>.05 || !st->dtx_enabled || st->dtx_count>20)
             {
+               st->dtx_count=0;
+               mode=1;
+            } else {
                mode=0;
-               fprintf (stderr, "tata\n");
+               st->dtx_count++;
             }
          } else
             mode=st->submodeSelect;
@@ -473,7 +475,7 @@
          in[i]=st->frame[i] + st->preemph*in[i-1];
       st->pre_mem2=in[st->frameSize-1];
 
-      return;
+      return 0;
 
    }
 
@@ -823,6 +825,8 @@
       st->bounded_pitch = 1;
    else
       st->bounded_pitch = 0;
+
+   return 1;
 }
 
 
@@ -1050,54 +1054,62 @@
    st=(DecState*)state;
    stack=st->stack;
 
-   /* If bits is NULL, consider the packet to be lost (what could we do anyway) */
-   if (!bits)
+   /* Check if we're in DTX mode*/
+   if (!bits && st->submodeID<2)
    {
-      nb_decode_lost(st, out, stack);
-      return 0;
-   }
+      st->submodeID=0;
+   } else 
+   {
+      /* If bits is NULL, consider the packet to be lost (what could we do anyway) */
+      if (!bits)
+      {
+         nb_decode_lost(st, out, stack);
+         return 0;
+      }
 
-   /* Search for next narrwoband block (handle requests, skip wideband blocks) */
-   do {
-      wideband = speex_bits_unpack_unsigned(bits, 1);
-      if (wideband) /* Skip wideband block (for compatibility) */
-      {
-         int submode;
-         int advance;
-         advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
-         speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
-         advance -= (SB_SUBMODE_BITS+1);
-         speex_bits_advance(bits, advance);
+      /* Search for next narrwoband block (handle requests, skip wideband blocks) */
+      do {
          wideband = speex_bits_unpack_unsigned(bits, 1);
-         if (wideband)
+         if (wideband) /* Skip wideband block (for compatibility) */
          {
-            fprintf (stderr, "Corrupted stream?\n");
+            int submode;
+            int advance;
+            advance = submode = speex_bits_unpack_unsigned(bits, SB_SUBMODE_BITS);
+            speex_mode_query(&speex_wb_mode, SPEEX_SUBMODE_BITS_PER_FRAME, &advance);
+            advance -= (SB_SUBMODE_BITS+1);
+            speex_bits_advance(bits, advance);
+            wideband = speex_bits_unpack_unsigned(bits, 1);
+            if (wideband)
+            {
+               fprintf (stderr, "Corrupted stream?\n");
+            }
          }
-      }
 
-      m = speex_bits_unpack_unsigned(bits, 4);
-      if (m==15) /* We found a terminator */
-      {
-         return -1;
-      } else if (m==14) /* Speex in-band request */
-      {
-         int ret = speex_inband_handler(bits, st->speex_callbacks, state);
-         if (ret)
-            return ret;
-      } else if (m==13) /* User in-band request */
-      {
-         int ret = st->user_callback.func(bits, state, st->user_callback.data);
-         if (ret)
-            return ret;
-      } else if (m>7) /* Invalid mode */
-      {
-         return -2;
-      }
+         m = speex_bits_unpack_unsigned(bits, 4);
+         if (m==15) /* We found a terminator */
+         {
+            return -1;
+         } else if (m==14) /* Speex in-band request */
+         {
+            int ret = speex_inband_handler(bits, st->speex_callbacks, state);
+            if (ret)
+               return ret;
+         } else if (m==13) /* User in-band request */
+         {
+            int ret = st->user_callback.func(bits, state, st->user_callback.data);
+            if (ret)
+               return ret;
+         } else if (m>7) /* Invalid mode */
+         {
+            return -2;
+         }
       
-   } while (m>7);
+      } while (m>7);
+
+      /* Get the sub-mode that was used */
+      st->submodeID = m;
 
-   /* Get the sub-mode that was used */
-   st->submodeID = m;
+   }
 
    /* Shift all buffers by one frame */
    speex_move(st->inBuf, st->inBuf+st->frameSize, (st->bufSize-st->frameSize)*sizeof(float));

<p><p>1.44      +2 -1      speex/libspeex/nb_celp.h

Index: nb_celp.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.h,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- nb_celp.h	20 Dec 2002 07:16:10 -0000	1.43
+++ nb_celp.h	20 Dec 2002 08:24:46 -0000	1.44
@@ -105,6 +105,7 @@
    int    vbr_enabled;    /**< 1 for enabling VBR, 0 otherwise */
    int    vad_enabled;    /**< 1 for enabling VAD, 0 otherwise */
    int    dtx_enabled;    /**< 1 for enabling DTX, 0 otherwise */
+   int    dtx_count;      /**< Number of consecutive DTX frames */
    int    abr_enabled;    /**< ABR setting (in bps), 0 if off */
    float  abr_drift;
    float  abr_drift2;
@@ -177,7 +178,7 @@
 void nb_encoder_destroy(void *state);
 
 /** Encodes one frame*/
-void nb_encode(void *state, float *in, SpeexBits *bits);
+int nb_encode(void *state, float *in, SpeexBits *bits);
 
 
 /** Initializes decoder state*/

<p><p>1.106     +7 -3      speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -r1.105 -r1.106
--- sb_celp.c	20 Dec 2002 05:20:28 -0000	1.105
+++ sb_celp.c	20 Dec 2002 08:24:46 -0000	1.106
@@ -270,7 +270,7 @@
 }
 
 
-void sb_encode(void *state, float *in, SpeexBits *bits)
+int sb_encode(void *state, float *in, SpeexBits *bits)
 {
    SBEncState *st;
    int i, roots, sub;
@@ -462,8 +462,10 @@
          in[i]=2*(st->y0[i]-st->y1[i]);
 #endif
 
-      return;
-
+      if (dtx)
+         return 0;
+      else
+         return 1;
    }
 
 
@@ -714,6 +716,8 @@
       st->old_qlsp[i] = st->qlsp[i];
 
    st->first=0;
+
+   return 1;
 }
 
 

<p><p>1.36      +1 -1      speex/libspeex/sb_celp.h

Index: sb_celp.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- sb_celp.h	15 Dec 2002 06:45:43 -0000	1.35
+++ sb_celp.h	20 Dec 2002 08:24:46 -0000	1.36
@@ -148,7 +148,7 @@
 void sb_encoder_destroy(void *state);
 
 /**Encodes one frame*/
-void sb_encode(void *state, float *in, SpeexBits *bits);
+int sb_encode(void *state, float *in, SpeexBits *bits);
 
 
 /**Initializes decoder state*/

<p><p>1.71      +2 -2      speex/libspeex/speex.h

Index: speex.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex.h,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -r1.70 -r1.71
--- speex.h	19 Dec 2002 08:21:11 -0000	1.70
+++ speex.h	20 Dec 2002 08:24:46 -0000	1.71
@@ -152,7 +152,7 @@
 typedef void (*encoder_destroy_func)(void *st);
 
 /** Main encoding function */
-typedef void (*encode_func)(void *state, float *in, SpeexBits *bits);
+typedef int (*encode_func)(void *state, float *in, SpeexBits *bits);
 
 /** Function for controlling the encoder options */
 typedef void (*encoder_ctl_func)(void *state, int request, void *ptr);
@@ -238,7 +238,7 @@
  @param in Frame that will be encoded with a +-2^16 range
  @param bits Bit-stream where the data will be written
  */
-void speex_encode(void *state, float *in, SpeexBits *bits);
+int speex_encode(void *state, float *in, SpeexBits *bits);
 
 /** Used like the ioctl function to control the encoder parameters
  *

<p><p>1.6       +4 -4      speex/src/speexdec.1

Index: speexdec.1
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.1,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- speexdec.1	11 Nov 2002 06:05:22 -0000	1.5
+++ speexdec.1	20 Dec 2002 08:24:46 -0000	1.6
@@ -1,7 +1,7 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.29.
-.TH SPEEXDEC "1" "November 2002" "speexdec version 1.0beta3" "User Commands"
+.TH SPEEXDEC "1" "December 2002" "speexdec version 1.0beta4" "User Commands"
 .SH NAME
-speexdec \- manual page for speexdec version 1.0beta3
+speexdec \- manual page for speexdec version 1.0beta4
 .SH SYNOPSIS
 .B speexdec
 [\fIoptions\fR] \fIinput_file.spx \fR[\fIoutput_file\fR]
@@ -30,10 +30,10 @@
 .SH OPTIONS
 .TP
 \fB\-\-enh\fR
-Enable perceptual enhancement
+Enable perceptual enhancement (default)
 .TP
 \fB\-\-no\-enh\fR
-Disable perceptual enhancement (default FOR NOW)
+Disable perceptual enhancement
 .TP
 \fB\-\-force\-nb\fR
 Force decoding in narrowband

<p><p>1.63      +3 -3      speex/src/speexdec.c

Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -r1.62 -r1.63
--- speexdec.c	20 Dec 2002 05:20:28 -0000	1.62
+++ speexdec.c	20 Dec 2002 08:24:46 -0000	1.63
@@ -197,8 +197,8 @@
    printf ("  (nothing)            Will be played to soundcard\n");
    printf ("\n");  
    printf ("Options:\n");
-   printf (" --enh                 Enable perceptual enhancement\n");
-   printf (" --no-enh              Disable perceptual enhancement (default FOR NOW)\n");
+   printf (" --enh                 Enable perceptual enhancement (default)\n");
+   printf (" --no-enh              Disable perceptual enhancement\n");
    printf (" --force-nb            Force decoding in narrowband\n");
    printf (" --force-wb            Force decoding in wideband\n");
    printf (" --force-uwb           Force decoding in ultra-wideband\n");
@@ -354,7 +354,7 @@
    int channels=-1;
    int rate=0;
 
-   enh_enabled = 0;
+   enh_enabled = 1;
 
    /*Process options*/
    while(1)

<p><p>1.4       +11 -2     speex/src/speexenc.1

Index: speexenc.1
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.1,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- speexenc.1	11 Nov 2002 01:08:29 -0000	1.3
+++ speexenc.1	20 Dec 2002 08:24:46 -0000	1.4
@@ -1,7 +1,7 @@
 .\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.29.
-.TH SPEEXENC "1" "November 2002" "speexenc version 1.0beta3" "User Commands"
+.TH SPEEXENC "1" "December 2002" "speexenc version 1.0beta4" "User Commands"
 .SH NAME
-speexenc \- manual page for speexenc version 1.0beta3
+speexenc \- manual page for speexenc version 1.0beta4
 .SH SYNOPSIS
 .B speexenc
 [\fIoptions\fR] \fIinput_file output_file\fR
@@ -42,6 +42,15 @@
 .TP
 \fB\-\-vbr\fR
 Enable variable bit-rate (VBR)
+.TP
+\fB\-\-abr\fR rate
+Enable average bit-rate (ABR) at rate bps
+.TP
+\fB\-\-vad\fR
+Enable voice activity detection (VAD)
+.TP
+\fB\-\-dtx\fR
+Enable file-based discontinuous transmission (DTX)
 .TP
 \fB\-\-comp\fR n
 Set encoding complexity (0-10), default 3

<p><p>1.65      +1 -2      speex/src/speexenc.c

Index: speexenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- speexenc.c	19 Dec 2002 17:52:59 -0000	1.64
+++ speexenc.c	20 Dec 2002 08:24:46 -0000	1.65
@@ -569,8 +569,7 @@
       int tmp;
       tmp=1;
       speex_encoder_ctl(st, SPEEX_SET_VBR, &tmp);
-   }
-   if (vad_enabled)
+   } else if (vad_enabled)
    {
       int tmp;
       tmp=1;

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list