Commit 6a978022 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Adjusting the allocation for stereo directly in the alloc function rather than

in the table.
parent a9947c48
......@@ -184,7 +184,6 @@ static void compute_allocation_table(CELTMode *mode, int res)
{
int i, j, nBark;
celt_int16_t *allocVectors;
const int C = CHANNELS(mode);
/* Find the number of critical bands supported by our sampling rate */
for (nBark=1;nBark<BARK_BANDS;nBark++)
......@@ -205,8 +204,7 @@ static void compute_allocation_table(CELTMode *mode, int res)
int edge, low;
celt_int32_t alloc;
edge = mode->eBands[eband+1]*res;
alloc = band_allocation[i*BARK_BANDS+j];
alloc = alloc*C*mode->mdctSize;
alloc = mode->mdctSize*band_allocation[i*BARK_BANDS+j];
if (edge < bark_freq[j+1])
{
int num, den;
......
......@@ -175,6 +175,7 @@ static void interp_bits2pulses(const CELTMode *m, int *bits1, int *bits2, int to
void compute_allocation(const CELTMode *m, int *offsets, int total, int *pulses, int *ebits, int *fine_priority)
{
int lo, hi, len, j;
const int C = CHANNELS(m);
VARDECL(int, bits1);
VARDECL(int, bits2);
SAVE_STACK;
......@@ -191,7 +192,7 @@ void compute_allocation(const CELTMode *m, int *offsets, int total, int *pulses,
int mid = (lo+hi) >> 1;
for (j=0;j<len;j++)
{
bits1[j] = (m->allocVectors[mid*len+j] + offsets[j])<<BITRES;
bits1[j] = (C*m->allocVectors[mid*len+j] + offsets[j])<<BITRES;
if (bits1[j] < 0)
bits1[j] = 0;
psum += bits1[j];
......@@ -207,8 +208,8 @@ void compute_allocation(const CELTMode *m, int *offsets, int total, int *pulses,
/*printf ("interp between %d and %d\n", lo, hi);*/
for (j=0;j<len;j++)
{
bits1[j] = m->allocVectors[lo*len+j] + offsets[j];
bits2[j] = m->allocVectors[hi*len+j] + offsets[j];
bits1[j] = C*m->allocVectors[lo*len+j] + offsets[j];
bits2[j] = C*m->allocVectors[hi*len+j] + offsets[j];
if (bits1[j] < 0)
bits1[j] = 0;
if (bits2[j] < 0)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment