shithub: opus

Download patch

ref: 20639c416c76d9213559bf1f681ec57b817c08a4
parent: 5f96146a853d01a184ef616dff07968c8a1c693a
author: Jean-Marc Valin <[email protected]>
date: Wed May 19 12:10:12 EDT 2010

Tuned the 5ms mode to have a band at 4 kHz and one at 8 kHz

--- a/libcelt/modes.c
+++ b/libcelt/modes.c
@@ -114,11 +114,22 @@
    };
 #endif
 
+static const celt_int16 eband5ms[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 23, 27, 33, 40, 48, 60, 78, 100};
+
 static celt_int16 *compute_ebands(celt_int32 Fs, int frame_size, int res, int *nbEBands)
 {
    celt_int16 *eBands;
    int i, lin, low, high, nBark, offset=0;
 
+   if (Fs == 400*(celt_int32)frame_size && Fs >= 40000)
+   {
+      *nbEBands = sizeof(eband5ms)/sizeof(eband5ms[0])-1;
+      eBands = celt_alloc(sizeof(celt_int16)*(*nbEBands+2));
+      for (i=0;i<*nbEBands+2;i++)
+         eBands[i] = eband5ms[i];
+      eBands[*nbEBands+1] = frame_size;
+      return eBands;
+   }
    /* Find the number of critical bands supported by our sampling rate */
    for (nBark=1;nBark<BARK_BANDS;nBark++)
     if (bark_freq[nBark+1]*2 >= Fs)