ref: 524623899c7c03cd116d6782315ab29f9a1dab2b
parent: 7331977c29a50a41f196b385752b286e5220fbdc
author: Jean-Marc Valin <[email protected]>
date: Fri May 28 20:28:06 EDT 2010
Folding tuning Trying to fold only from regions where we have at least 2 bits of depth
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -888,6 +888,8 @@
int B;
int M;
int spread;
+ celt_norm *lowband;
+ int update_lowband = 1;
SAVE_STACK;
M = 1<<LM;
@@ -897,6 +899,7 @@
norm = _norm;
balance = 0;
+ lowband = NULL;
for (i=start;i<m->nbEBands;i++)
{
int tell;
@@ -904,7 +907,6 @@
int N;
int curr_balance;
celt_norm * restrict X, * restrict Y;
- celt_norm *lowband;
int tf_change=0;
X = _X+M*eBands[i];
@@ -930,8 +932,10 @@
b = 0;
if (M*eBands[i]-N >= M*eBands[start])
- lowband = norm+M*eBands[i]-N;
- else
+ {
+ if (update_lowband)
+ lowband = norm+M*eBands[i]-N;
+ } else
lowband = NULL;
if (shortBlocks)
@@ -943,6 +947,9 @@
quant_band(encode, m, i, X, Y, N, b, spread, tf_change, lowband, resynth, ec, &remaining_bits, LM, norm+M*eBands[i], bandE, 0);
balance += pulses[i] + tell;
+
+ /* Update the folding position only as long as we have 2 bit/sample depth */
+ update_lowband = (b>>BITRES)>2*N;
}
RESTORE_STACK;
}