Turns out that the worse case of the vector split is the same as that of the

pulse split. Also, added an allocation line for even higher bit-rates
This commit is contained in:
Jean-Marc Valin 2008-08-02 20:51:44 -04:00
parent eb7ce03165
commit 9eba823cf7
3 changed files with 5 additions and 46 deletions

View file

@ -429,8 +429,8 @@ int get_required_bits(int N, int K, int frac)
RESTORE_STACK;
} else {
nbits = log2_frac64(N, frac);
nbits += get_required_bits((N+1)/2, (K+1)/2, frac);
nbits += get_required_bits((N+1)/2, K/2, frac);
nbits += get_required_bits(N/2+1, (K+1)/2, frac);
nbits += get_required_bits(N/2+1, K/2, frac);
}
return nbits;
}

View file

@ -104,7 +104,7 @@ static const celt_int16_t pitch_freq[PBANDS+1] ={0, 345, 689, 1034, 1378, 2067,
int BITALLOC_SIZE;
int *band_allocation;
#else
#define BITALLOC_SIZE 10
#define BITALLOC_SIZE 11
static const int band_allocation[BARK_BANDS*BITALLOC_SIZE] =
{ 2, 2, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 1, 2, 2, 2, 2, 2, 1, 2, 2, 4, 5, 7, 7, 7, 5, 4, 0, 0, 0, 0, 0, 0,
@ -116,6 +116,7 @@ static const int band_allocation[BARK_BANDS*BITALLOC_SIZE] =
6, 6, 6, 6, 6, 6, 7, 7, 9, 9, 11, 12, 13, 18, 22, 23, 24, 25, 28, 30, 35, 35, 35, 35, 15,
7, 7, 7, 7, 7, 7, 10, 10, 10, 13, 14, 18, 20, 24, 28, 32, 32, 35, 38, 38, 42, 50, 59, 54, 31,
8, 8, 8, 8, 8, 9, 10, 12, 14, 20, 22, 25, 28, 30, 35, 42, 46, 50, 55, 60, 62, 62, 62, 62, 62,
12, 12, 12, 12, 12, 13, 15, 18, 22, 30, 32, 35, 40, 45, 55, 62, 66, 70, 85, 90, 92, 92, 92, 92, 92,
};
#endif

View file

@ -47,48 +47,6 @@ const celt_word16_t eMeans[24] = {11520, -2048, -3072, -640, 256, 0, 0, 0, 0, 0,
const celt_word16_t eMeans[24] = {45.f, -8.f, -12.f, -2.5f, 1.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f, 0.f};
#endif
/*const int frac[24] = {4, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};*/
/*const int frac[24] = {8, 6, 5, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};*/
void compute_fine_allocation(const CELTMode *m, int *bits, int budget)
{
int i,j;
int len;
len = m->nbEBands;
for (i=0;i<m->nbAllocVectors;i++)
{
if (m->energy_alloc[i*(len+1)+len] > budget)
break;
}
if (i==0)
{
for (j=0;j<len;j++)
bits[j] = 0;
} else {
for (j=0;j<len;j++)
bits[j] = m->energy_alloc[(i-1)*(len+1)+j];
budget -= m->energy_alloc[(i-1)*(len+1)+len];
}
if (i<m->nbAllocVectors)
{
j=0;
while (budget>0)
{
if (m->energy_alloc[i*(len+1)+j]>bits[j])
{
bits[j]++;
budget--;
}
j++;
if (j>=len)
j=0;
}
}
/*for (j=0;j<len;j++)
printf ("%d ", bits[j]);
printf ("\n");*/
}
#ifdef FIXED_POINT
static inline celt_ener_t dB2Amp(celt_ener_t dB)