[xiph-commits] r9365 - trunk/speex/libspeex

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Sun Jun 5 20:41:13 PDT 2005


Author: jm
Date: 2005-06-05 20:41:09 -0700 (Sun, 05 Jun 2005)
New Revision: 9365

Modified:
   trunk/speex/libspeex/bits.c
   trunk/speex/libspeex/mdf.c
   trunk/speex/libspeex/sb_celp.c
   trunk/speex/libspeex/testenc.c
Log:
Minor cleanup patch by Alfred E. Heggestad


Modified: trunk/speex/libspeex/bits.c
===================================================================
--- trunk/speex/libspeex/bits.c	2005-06-05 16:57:01 UTC (rev 9364)
+++ trunk/speex/libspeex/bits.c	2005-06-06 03:41:09 UTC (rev 9365)
@@ -45,14 +45,14 @@
 void speex_bits_init(SpeexBits *bits)
 {
    bits->chars = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
+   if (!bits->chars)
+      return;
+
    bits->buf_size = MAX_BYTES_PER_FRAME;
 
-   bits->chars[0]=0;
-   bits->nbBits=0;
-   bits->charPtr=0;
-   bits->bitPtr=0;
    bits->owner=1;
-   bits->overflow=0;
+
+   speex_bits_reset(bits);
 }
 
 void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
@@ -60,12 +60,9 @@
    bits->chars = (char*)buff;
    bits->buf_size = buf_size;
 
-   bits->chars[0]=0;
-   bits->nbBits=0;
-   bits->charPtr=0;
-   bits->bitPtr=0;
    bits->owner=0;
-   bits->overflow=0;
+
+   speex_bits_reset(bits);
 }
 
 void speex_bits_destroy(SpeexBits *bits)
@@ -96,7 +93,7 @@
    int i;
    if (len > bits->buf_size)
    {
-      speex_warning_int("Packet if larger than allocated buffer: ", len);
+      speex_warning_int("Packet is larger than allocated buffer: ", len);
       if (bits->owner)
       {
          char *tmp = (char*)speex_realloc(bits->chars, len);

Modified: trunk/speex/libspeex/mdf.c
===================================================================
--- trunk/speex/libspeex/mdf.c	2005-06-05 16:57:01 UTC (rev 9364)
+++ trunk/speex/libspeex/mdf.c	2005-06-06 03:41:09 UTC (rev 9365)
@@ -47,6 +47,7 @@
 #define M_PI 3.14159265358979323846
 #endif
 
+#undef BETA
 #define BETA .65
 
 #define min(a,b) ((a)<(b) ? (a) : (b))

Modified: trunk/speex/libspeex/sb_celp.c
===================================================================
--- trunk/speex/libspeex/sb_celp.c	2005-06-05 16:57:01 UTC (rev 9364)
+++ trunk/speex/libspeex/sb_celp.c	2005-06-06 03:41:09 UTC (rev 9365)
@@ -1267,6 +1267,9 @@
          speex_encoder_ctl(state, SPEEX_SET_QUALITY, &q);
          break;
       }
+   case SPEEX_GET_VBR_QUALITY:
+      (*(float*)ptr) = st->vbr_quality;
+      break;
    case SPEEX_SET_ABR:
       st->abr_enabled = (*(int*)ptr);
       st->vbr_enabled = 1;
@@ -1437,6 +1440,9 @@
       speex_decoder_ctl(st->st_low, request, ptr);
       st->lpc_enh_enabled = *((int*)ptr);
       break;
+   case SPEEX_GET_ENH:
+      *((int*)ptr) = st->lpc_enh_enabled;
+      break;
    case SPEEX_SET_MODE:
    case SPEEX_SET_QUALITY:
       {

Modified: trunk/speex/libspeex/testenc.c
===================================================================
--- trunk/speex/libspeex/testenc.c	2005-06-05 16:57:01 UTC (rev 9364)
+++ trunk/speex/libspeex/testenc.c	2005-06-06 03:41:09 UTC (rev 9365)
@@ -19,7 +19,6 @@
    FILE *fin, *fout, *fbits=NULL;
    short in_short[FRAME_SIZE];
    short out_short[FRAME_SIZE];
-   float in_float[FRAME_SIZE];
    float sigpow,errpow,snr, seg_snr=0;
    int snr_frames = 0;
    char cbits[200];
@@ -82,8 +81,6 @@
       fread(in_short, sizeof(short), FRAME_SIZE, fin);
       if (feof(fin))
          break;
-      for (i=0;i<FRAME_SIZE;i++)
-         in_float[i]=in_short[i];
       speex_bits_reset(&bits);
 
       speex_encode_int(st, in_short, &bits);



More information about the commits mailing list