From 13294b54c02134dd13a1ae4ce08f75dac297248d Mon Sep 17 00:00:00 2001 From: Jean-Marc Valin Date: Fri, 30 May 2008 16:07:06 +1000 Subject: [PATCH] Adjusted stereo bit allocation to be higher than mono for the same alloc line --- libcelt/modes.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/libcelt/modes.c b/libcelt/modes.c index a9a94e78..404e07ec 100644 --- a/libcelt/modes.c +++ b/libcelt/modes.c @@ -208,19 +208,22 @@ static void compute_allocation_table(CELTMode *mode, int res) eband = 0; for (j=0;jeBands[eband+1]*res; + alloc = band_allocation[i*BARK_BANDS+j]; + if (mode->nbChannels == 2) + alloc += alloc/2; if (edge < bark_freq[j+1]) { int num, den; - num = band_allocation[i*BARK_BANDS+j] * (edge-bark_freq[j]); + num = alloc * (edge-bark_freq[j]); den = bark_freq[j+1]-bark_freq[j]; low = (num+den/2)/den; allocVectors[i*mode->nbEBands+eband] += low; eband++; - allocVectors[i*mode->nbEBands+eband] += band_allocation[i*BARK_BANDS+j]-low; + allocVectors[i*mode->nbEBands+eband] += alloc-low; } else { - allocVectors[i*mode->nbEBands+eband] += band_allocation[i*BARK_BANDS+j]; + allocVectors[i*mode->nbEBands+eband] += alloc; } } }