diff options
author | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2010-05-29 08:28:06 +0400 |
---|---|---|
committer | Jean-Marc Valin <jean-marc.valin@usherbrooke.ca> | 2010-05-29 08:28:06 +0400 |
commit | 524623899c7c03cd116d6782315ab29f9a1dab2b (patch) | |
tree | 4f7349fd0f2d3e90755f23b0fc1fde723109b2c4 /libcelt | |
parent | 7331977c29a50a41f196b385752b286e5220fbdc (diff) |
Folding tuning
Trying to fold only from regions where we have at least 2 bits of depth
Diffstat (limited to 'libcelt')
-rw-r--r-- | libcelt/bands.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/libcelt/bands.c b/libcelt/bands.c index 945d3e3..22812ea 100644 --- a/libcelt/bands.c +++ b/libcelt/bands.c @@ -888,6 +888,8 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce int B; int M; int spread; + celt_norm *lowband; + int update_lowband = 1; SAVE_STACK; M = 1<<LM; @@ -897,6 +899,7 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce norm = _norm; balance = 0; + lowband = NULL; for (i=start;i<m->nbEBands;i++) { int tell; @@ -904,7 +907,6 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce 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 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce 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 @@ void quant_all_bands(int encode, const CELTMode *m, int start, celt_norm *_X, ce 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; } |