ref: 908958cad5fe507219d770cd5ebf95807e826886
parent: 9099bc36dbc48db37b120e1ad71fc9e85fa54fb7
author: Jean-Marc Valin <[email protected]>
date: Sat Aug 7 18:15:02 EDT 2010
Shuffling code around -- no change to the algorithm
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -746,16 +746,7 @@
/* Band normalisation */
normalise_bands(st->mode, freq, X, bandE, effEnd, C, M);
- if (!shortBlocks && !folding_decision(st->mode, X, &st->tonal_average, &st->fold_decision, effEnd, C, M))
- has_fold = 0;
- /* Don't use intra energy when we're operating at low bit-rate */
- intra_ener = st->force_intra || (st->delayedIntra && nbAvailableBytes > st->end);
- if (shortBlocks || intra_decision(bandLogE, st->oldBandE, st->start, effEnd, st->mode->nbEBands, C))
- st->delayedIntra = 1;
- else
- st->delayedIntra = 0;
-
NN = M*st->mode->eBands[effEnd];
if (shortBlocks && !transient_shift)
{
@@ -808,6 +799,13 @@
for (i=effEnd;i<st->end;i++)
tf_res[i] = tf_res[effEnd-1];
+ /* Don't use intra energy when we're operating at low bit-rate */
+ intra_ener = st->force_intra || (st->delayedIntra && nbAvailableBytes > st->end);
+ if (shortBlocks || intra_decision(bandLogE, st->oldBandE, st->start, effEnd, st->mode->nbEBands, C))
+ st->delayedIntra = 1;
+ else
+ st->delayedIntra = 0;
+
/* Encode the global flags using a simple probability model
(first symbols in the stream) */
ec_enc_bit_prob(enc, intra_ener, 8192);
@@ -820,7 +818,6 @@
#endif
quant_coarse_energy(st->mode, st->start, st->end, bandLogE, st->oldBandE, nbCompressedBytes*8, intra_ener, st->mode->prob, error, enc, C, LM, max_decay);
-
ec_enc_bit_prob(enc, shortBlocks!=0, 8192);
if (shortBlocks)
@@ -839,6 +836,8 @@
tf_encode(st->start, st->end, isTransient, tf_res, nbAvailableBytes, LM, tf_select, enc);
+ if (!shortBlocks && !folding_decision(st->mode, X, &st->tonal_average, &st->fold_decision, effEnd, C, M))
+ has_fold = 0;
ec_enc_bit_prob(enc, has_fold>>1, 8192);
ec_enc_bit_prob(enc, has_fold&1, (has_fold>>1) ? 32768 : 49152);