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

Jean-Marc Valin jm at xiph.org
Sun Nov 10 22:05:22 PST 2002



jm          02/11/11 01:05:22

  Modified:    doc      manual.lyx manual.pdf
               libspeex speex_header.h speex_stereo.h
               src      speexdec.1 speexdec.c
  Log:
  Last updates (hopefully) for beta 3.

Revision  Changes    Path
1.34      +71 -6     speex/doc/manual.lyx

Index: manual.lyx
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.lyx,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- manual.lyx	11 Nov 2002 01:08:29 -0000	1.33
+++ manual.lyx	11 Nov 2002 06:05:21 -0000	1.34
@@ -244,25 +244,55 @@
 
 \layout Standard
 
+Linear prediction is at the base of may speech coding techniques, including
+ CELP.
+ The idea behind it is to predict the signal 
+\begin_inset Formula $x(n)$
+\end_inset 
+
+ using a linear combination of its past samples:
+\layout Standard
+
 
 \begin_inset Formula \[
 y(n)=\sum _{i=1}^{N}a_{i}x(n-i)\]
 
 \end_inset 
 
+where 
+\begin_inset Formula $y(n)$
+\end_inset 
+
+ is the linear prediction of 
+\begin_inset Formula $x(n)$
+\end_inset 
 
+.
+ The prediction error is thus given by:
 \begin_inset Formula \[
 e(n)=x(n)-y(n)=x(n)-\sum _{i=1}^{N}a_{i}x(n-i)\]
 
 \end_inset 
 
 
+\layout Standard
+
+The goal of the LPC analysis is to find the best prediction coefficients
+ 
+\begin_inset Formula $a_{i}$
+\end_inset 
+
+ which minimize the quadratic error function:
 \begin_inset Formula \[
 E=\sum _{n=0}^{L-1}\left[e(n)\right]^{2}=\sum _{n=0}^{L-1}\left[x(n)-\sum _{i=1}^{N}a_{i}x(n-i)\right]^{2}\]
 
 \end_inset 
 
+That can be done by making all derivatives 
+\begin_inset Formula $\frac{\partial E}{\partial a_{i}}$
+\end_inset 
 
+ equal to zero:
 \begin_inset Formula \[
 \frac{\partial E}{\partial a_{i}}=\frac{\partial }{\partial a_{i}}\sum _{n=0}^{L-1}\left[x(n)-\sum _{i=1}^{N}a_{i}x(n-i)\right]^{2}=0\]
 
@@ -785,7 +815,7 @@
 
 
 \begin_inset Float table
-placement htbp
+placement h
 wide true
 collapsed false
 
@@ -1836,7 +1866,7 @@
 
 
 \begin_inset Float table
-placement htbp
+placement h
 wide true
 collapsed false
 
@@ -2603,7 +2633,7 @@
 
 
 \begin_inset Float table
-placement htbp
+placement h
 wide true
 collapsed false
 
@@ -3042,6 +3072,19 @@
 \end_inset 
 
 
+\layout Standard
+
+
+\begin_inset ERT
+status Open
+
+\layout Standard
+
+\backslash 
+clearpage
+\end_inset 
+
+
 \layout Section
 \pagebreak_top 
 Command-line encoder/decoder
@@ -3195,8 +3238,12 @@
 --stereo Force decoding in stereo 
 \layout Description
 
+--rate\SpecialChar ~
+n For decoding at n Hz sampling rate
+\layout Description
+
 --packet-loss\SpecialChar ~
-n Simulate n % random packet loss
+n Simulate n % rando m packet loss
 \layout Description
 
 -V Verbose operation, print bit-rate currently in use
@@ -4202,10 +4249,17 @@
 
 \end_inset 
 
- Payload Format
+ Payload Format 
 \layout Standard
 
-This is a work in progress.
+The latest RTP payload draft can be found at 
+\begin_inset LatexCommand \url{http://www.speex.org/drafts/latest}
+
+\end_inset 
+
+.
+ We are (2002/11/11) about to send the latest draft to the IETF for comments.
+ 
 \layout Comment
 
 Since Speex encoded frames already contain mode information, they can be
@@ -4214,6 +4268,17 @@
  the end of frames, except the last one.
  The number of frames contained in each packet MUST be transmitted out-of-band.
  
+\layout Subsection
+
+MIME Type
+\layout Standard
+
+Speex will use the MIME type 
+\family typewriter 
+audio/speex
+\family default 
+.
+ We will apply for that type in the near future.
 \layout Subsection
 
 Ogg

<p><p>1.4       +3274 -3044speex/doc/manual.pdf

Index: manual.pdf
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.pdf,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
Binary files /tmp/cvsyuJdJj and /tmp/cvsOWysTC differ

<p><p>1.12      +14 -14    speex/libspeex/speex_header.h

Index: speex_header.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_header.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- speex_header.h	11 Oct 2002 03:39:34 -0000	1.11
+++ speex_header.h	11 Nov 2002 06:05:22 -0000	1.12
@@ -47,25 +47,25 @@
 #define SPEEX_HEADER_VERSION_LENGTH 20
 
 /** Current version of the Speex header */
-#define SPEEX_HEADER_VERSION -1
+#define SPEEX_HEADER_VERSION 1
 
 /** Speex header info for file-based formats */
 typedef struct SpeexHeader {
-   char speex_string[8]; /**< Identifies a Speex bit-stream, always set to "Speex   " */
+   char speex_string[8];       /**< Identifies a Speex bit-stream, always set to "Speex   " */
    char speex_version[SPEEX_HEADER_VERSION_LENGTH]; /**< Speex version */
-   int speex_header_version; /**< Version number for the header */
-   int header_size; /**< Total size of the header ( sizeof(SpeexHeader) ) */
-   int rate; /**< Sampling rate used */
-   int mode; /**< Mode used (0 for narrowband, 1 for wideband) */
+   int speex_header_version;   /**< Version number for the header */
+   int header_size;            /**< Total size of the header ( sizeof(SpeexHeader) ) */
+   int rate;                   /**< Sampling rate used */
+   int mode;                   /**< Mode used (0 for narrowband, 1 for wideband) */
    int mode_bitstream_version; /**< Version ID of the bit-stream */
-   int nb_channels; /**< Number of channels encoded */
-   int bitrate; /**< Bit-rate used */
-   int frame_size; /**< Size of frames */
-   int vbr; /**< 1 for a VBR encoding, 0 otherwise */
-   int frames_per_packet; /**< Number of frames stored per Ogg packet */
-   int reserved1; /**< Reserved for future use */
-   int reserved2; /**< Reserved for future use */
-   int reserved3; /**< Reserved for future use */
+   int nb_channels;            /**< Number of channels encoded */
+   int bitrate;                /**< Bit-rate used */
+   int frame_size;             /**< Size of frames */
+   int vbr;                    /**< 1 for a VBR encoding, 0 otherwise */
+   int frames_per_packet;      /**< Number of frames stored per Ogg packet */
+   int reserved1;              /**< Reserved for future use, must be zero */
+   int reserved2;              /**< Reserved for future use, must be zero */
+   int reserved3;              /**< Reserved for future use, must be zero */
 } SpeexHeader;
 
 /** Initializes a SpeexHeader using basic information */

<p><p>1.3       +12 -5     speex/libspeex/speex_stereo.h

Index: speex_stereo.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_stereo.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- speex_stereo.h	7 Nov 2002 22:13:15 -0000	1.2
+++ speex_stereo.h	11 Nov 2002 06:05:22 -0000	1.3
@@ -1,6 +1,9 @@
-/* Copyright (C) 2002 Jean-Marc Valin 
-   File: stereo.c
-
+/* Copyright (C) 2002 Jean-Marc Valin*/
+/**
+   @file speex_stereo.h
+   @brief Describes the handling for intensity stereo
+*/
+/*
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
    are met:
@@ -34,17 +37,21 @@
 
 #include "speex_bits.h"
 
+/** State used for decoding (intensity) stereo information */
 typedef struct SpeexStereoState {
-   float balance;
-   float e_ratio;
+   float balance;     /**< Left/right balance info */
+   float e_ratio;     /**< Ratio of energies: E(left+right)/[E(left)+E(right)]  */
 } SpeexStereoState;
 
 #define SPEEX_STEREO_STATE_INIT {1,.5}
 
+/** Transforms a stereo frame into a mono frame and stores intensity stereo info in 'bits' */
 void speex_encode_stereo(float *data, int frame_size, SpeexBits *bits);
 
+/** Transforms a mono frame into a stereo frame using intensity stereo info */
 void speex_decode_stereo(float *data, int frame_size, SpeexStereoState *stereo);
 
+/** Callback handler for intensity stereo info */
 int speex_std_stereo_request_handler(SpeexBits *bits, void *state, void *data);
 
 #endif

<p><p>1.5       +3 -0      speex/src/speexdec.1

Index: speexdec.1
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.1,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- speexdec.1	11 Nov 2002 01:08:29 -0000	1.4
+++ speexdec.1	11 Nov 2002 06:05:22 -0000	1.5
@@ -50,6 +50,9 @@
 \fB\-\-stereo\fR
 Force decoding in stereo
 .TP
+\fB\-\-rate\fR n
+Force decoding at sampling rate n Hz
+.TP
 \fB\-\-packet\-loss\fR n
 Simulate n % random packet loss
 .TP

<p><p>1.60      +8 -2      speex/src/speexdec.c

Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -r1.59 -r1.60
--- speexdec.c	11 Nov 2002 01:08:29 -0000	1.59
+++ speexdec.c	11 Nov 2002 06:05:22 -0000	1.60
@@ -203,6 +203,7 @@
    printf (" --force-uwb           Force decoding in ultra-wideband\n");
    printf (" --mono                Force decoding in mono\n");
    printf (" --stereo              Force decoding in stereo\n");
+   printf (" --rate n              Force decoding at sampling rate n Hz\n");
    printf (" --packet-loss n       Simulate n %% random packet loss\n");
    printf (" -V                    Verbose mode (show bit-rate)\n"); 
    printf (" -h, --help            This help\n");
@@ -273,7 +274,8 @@
    callback.data = stereo;
    speex_decoder_ctl(st, SPEEX_SET_HANDLER, &callback);
    
-   *rate = header->rate;
+   if (!*rate)
+      *rate = header->rate;
    /* Adjust rate if --force-* options are used */
    if (forceMode!=-1)
    {
@@ -329,6 +331,7 @@
       {"force-nb", no_argument, NULL, 0},
       {"force-wb", no_argument, NULL, 0},
       {"force-uwb", no_argument, NULL, 0},
+      {"rate", required_argument, NULL, 0},
       {"mono", no_argument, NULL, 0},
       {"stereo", no_argument, NULL, 0},
       {"packet-loss", required_argument, NULL, 0},
@@ -348,6 +351,7 @@
    float loss_percent=-1;
    SpeexStereoState stereo = SPEEX_STEREO_STATE_INIT;
    int channels=-1;
+   int rate=0;
 
    enh_enabled = 0;
 
@@ -403,6 +407,9 @@
          } else if (strcmp(long_options[option_index].name,"stereo")==0)
          {
             channels=2;
+         } else if (strcmp(long_options[option_index].name,"rate")==0)
+         {
+            rate=atoi (optarg);
          } else if (strcmp(long_options[option_index].name,"packet-loss")==0)
          {
             loss_percent = atof(optarg);
@@ -490,7 +497,6 @@
             /*If first packet, process as Speex header*/
             if (packet_count==0)
             {
-               int rate;
                st = process_header(&op, enh_enabled, &frame_size, &rate, &nframes, forceMode, &channels, &stereo);
                if (!nframes)
                   nframes=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