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

Jean-Marc Valin jm at xiph.org
Fri Jan 3 23:04:53 PST 2003



jm          03/01/04 02:04:53

  Modified:    doc      manual.lyx
               src      speexdec.c speexenc.c
  Log:
  speexdec a bit more robust to corrupted files, misc doc fixes

Revision  Changes    Path
1.41      +6 -2      speex/doc/manual.lyx

Index: manual.lyx
===================================================================
RCS file: /usr/local/cvsroot/speex/doc/manual.lyx,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- manual.lyx	31 Dec 2002 18:41:46 -0000	1.40
+++ manual.lyx	4 Jan 2003 07:04:53 -0000	1.41
@@ -3239,6 +3239,10 @@
 \layout Subsection*
 
 Average Bit-Rate (ABR)
+\layout Standard
+
+Average bit-rate solves one of the problems of VBR, as it dynamically adjusts
+ VBR quality in order to meet a specific target bit-rate.
 \layout Subsection*
 
 Voice Activity Detection (VAD)
@@ -3287,7 +3291,7 @@
 \emph default 
  better (subjective improvement).
 \layout Section
-
+\pagebreak_top 
 Command-line encoder/decoder
 \begin_inset LatexCommand \label{sec:Command-line-encoder/decoder}
 
@@ -3342,7 +3346,7 @@
 \layout Description
 
 --quality\SpecialChar ~
-n Set the encoding quality (0-10), default is 3
+n Set the encoding quality (0-10), default is 8
 \layout Description
 
 --bitrate\SpecialChar ~

<p><p>1.65      +33 -2     speex/src/speexdec.c

Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- speexdec.c	20 Dec 2002 19:42:57 -0000	1.64
+++ speexdec.c	4 Jan 2003 07:04:53 -0000	1.65
@@ -76,18 +76,45 @@
 {
    char *c=comments;
    int len, i, nb_fields;
-
+   char *end;
+   
+   if (length<8)
+   {
+      fprintf (stderr, "Invalid/corrupted comments\n");
+      return;
+   }
+   end = c+length;
    len=readint(c, 0);
    c+=4;
+   if (c+len>=end)
+   {
+      fprintf (stderr, "Invalid/corrupted comments\n");
+      return;
+   }
    fwrite(c, 1, len, stderr);
    c+=len;
    fprintf (stderr, "\n");
+   if (c+4>=end)
+   {
+      fprintf (stderr, "Invalid/corrupted comments\n");
+      return;
+   }
    nb_fields=readint(c, 0);
    c+=4;
    for (i=0;i<nb_fields;i++)
    {
+      if (c+4>=end)
+      {
+         fprintf (stderr, "Invalid/corrupted comments\n");
+         return;
+      }
       len=readint(c, 0);
       c+=4;
+      if (c+len>=end)
+      {
+         fprintf (stderr, "Invalid/corrupted comments\n");
+         return;
+      }
       fwrite(c, 1, len, stderr);
       c+=len;
       fprintf (stderr, "\n");
@@ -593,12 +620,16 @@
 
    if (st)
       speex_decoder_destroy(st);
+   else 
+   {
+      fprintf (stderr, "This doesn't look like a Speex file\n");
+   }
    speex_bits_destroy(&bits);
    ogg_sync_clear(&oy);
    ogg_stream_clear(&os);
 
 #if defined WIN32 || defined _WIN32
-   if (strlen(outFile)==0)
+   if (fout && strlen(outFile)==0)
       WIN_Audio_close ();
 #endif
 

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

Index: speexenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -r1.65 -r1.66
--- speexenc.c	20 Dec 2002 08:24:46 -0000	1.65
+++ speexenc.c	4 Jan 2003 07:04:53 -0000	1.66
@@ -141,7 +141,7 @@
    printf (" -n, --narrowband   Narrowband (8 kHz) input file\n"); 
    printf (" -w, --wideband     Wideband (16 kHz) input file\n"); 
    printf (" -u, --ultra-wideband \"Ultra-wideband\" (32 kHz) input file\n"); 
-   printf (" --quality n        Encoding quality (0-10), default 3\n"); 
+   printf (" --quality n        Encoding quality (0-10), default 8\n"); 
    printf (" --bitrate n        Encoding bit-rate (use bit-rate n or lower)\n"); 
    printf (" --vbr              Enable variable bit-rate (VBR)\n"); 
    printf (" --abr rate         Enable average bit-rate (ABR) at rate bps\n"); 

<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