shithub: opus

Download patch

ref: 276e6afc03b93dc6d8e6df1e59502aaa9ff80379
parent: 69f9dea7c5d67f63b0ad602ee0cf46c2bedb5119
author: Jean-Marc Valin <[email protected]>
date: Sat Feb 2 15:15:51 EST 2008

Fixed a typo and removed an old warning from speexenc. Also, using more useful
bitrate defaults.

--- a/tools/celtdec.c
+++ b/tools/celtdec.c
@@ -585,7 +585,7 @@
                      celt_int32_t tmp=40;
                      char ch=13;
                      fputc (ch, stderr);
-                     fprintf (stderr, "Bitrate is use: %d bytes/packet     ", tmp);
+                     fprintf (stderr, "Bitrate in use: %d bytes/packet     ", tmp);
                   }
                   /*Convert to short and save to output file*/
                   if (strlen(outFile)!=0)
--- a/tools/celtenc.c
+++ b/tools/celtenc.c
@@ -282,7 +282,7 @@
    int comments_length;
    int close_in=0, close_out=0;
    int eos=0;
-   celt_int32_t bitrate=64;
+   celt_int32_t bitrate=-1;
    char first_bytes[12];
    int wave_input=0;
    celt_int32_t lookahead = 0;
@@ -431,19 +431,30 @@
    }
 
    if (chan == 1)
+   {
       mode = celt_mono;
+      if (bitrate < 0)
+         bitrate = 64;
+      if (bitrate < 40)
+         bitrate = 40;
+      if (bitrate > 80)
+         bitrate = 80;
+   }
    else if (chan == 2)
+   {
       mode = celt_stereo;
-   else {
+      if (bitrate < 0)
+         bitrate = 128;
+      if (bitrate < 64)
+         bitrate = 64;
+      if (bitrate > 150)
+         bitrate = 150;
+   } else {
       fprintf (stderr, "Only mono and stereo are supported\n");
       return 1;
    }
    celt_mode_info(mode, CELT_GET_FRAME_SIZE, &frame_size);
    
-   if (bitrate>250)
-      bitrate = 150;
-   if (bitrate<40)
-      bitrate = 40;
    bytes_per_packet = (bitrate*1000*frame_size/rate+4)/8;
    
    celt_header_init(&header, rate, 1, mode);
--- a/tools/wav_io.c
+++ b/tools/wav_io.c
@@ -118,11 +118,6 @@
    fread(&itmp, 4, 1, file);
    itmp = le_int(itmp);
    *rate = itmp;
-   if (*rate != 8000 && *rate != 16000 && *rate != 11025 && *rate != 22050 && *rate != 32000 && *rate != 44100 && *rate != 48000)
-   {
-      fprintf (stderr, "Only 8 kHz (narrowband) and 16 kHz (wideband) supported (plus 11.025 kHz and 22.05 kHz, but your mileage may vary)\n");
-      return -1;
-   }
 
    fread(&itmp, 4, 1, file);
    bpersec = le_int(itmp);