ref: 40e993c029ff48af39a24d2cc093ba661b62c3c8
parent: c5d00a066ea782c2c32eb3ff3e15f87d23b82c60
author: Jean-Marc Valin <[email protected]>
date: Wed May 26 11:04:29 EDT 2010
Re-organised the special case for N==1
--- a/libcelt/bands.c
+++ b/libcelt/bands.c
@@ -493,26 +493,29 @@
/* Special case for one sample */
if (N==1)
{
- if (b>=1<<BITRES && *remaining_bits>=1<<BITRES)
+ int c;
+ celt_norm *x = X;
+ for (c=0;c<1+stereo;c++)
{
- int sign;
- if (encode)
+ int sign=0;
+ if (b>=1<<BITRES && *remaining_bits>=1<<BITRES)
{
- sign = X[0]<0;
- ec_enc_bits(ec, sign, 1);
- } else {
- sign = ec_dec_bits((ec_dec*)ec, 1);
+ if (encode)
+ {
+ sign = x[0]<0;
+ ec_enc_bits(ec, sign, 1);
+ } else {
+ sign = ec_dec_bits((ec_dec*)ec, 1);
+ }
+ *remaining_bits -= 1<<BITRES;
+ b-=1<<BITRES;
}
if (resynth)
- X[0] = sign ? -NORM_SCALING : NORM_SCALING;
- *remaining_bits -= 1<<BITRES;
- b--;
- } else if (resynth) {
- X[0] = NORM_SCALING;
+ x[0] = sign ? -NORM_SCALING : NORM_SCALING;
+ x = Y;
}
- if (stereo)
- quant_band(encode, m, i, Y, NULL, N, b, spread, NULL, resynth, ec,
- remaining_bits, LM, NULL, NULL, level);
+ if (c==0 && lowband_out)
+ lowband_out[0] = X[0];
return;
}