Commit 9dff0218 authored by Jean-Marc Valin's avatar Jean-Marc Valin
Browse files

Minor stuff: preventing float underflow in celt_exp2(), preventing the use of

intra energy for low bitrates, and a bit of very high bitrate tuning
parent 9edb7b42
......@@ -670,15 +670,7 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
freq[i] = (1./(1<<mdct_weight_shift))*freq[i];
}
#endif
/*printf ("%f\n", short_ratio);*/
/*if (short_ratio < 1)
short_ratio = 1;
short_ratio = 1<<(int)floor(.5+log2(short_ratio));
if (short_ratio>4)
short_ratio = 4;*/
}/* else if (transient_shift)
printf ("8\n");
else printf ("1\n");*/
}
compute_band_energies(st->mode, freq, bandE);
for (i=0;i<st->mode->nbEBands*C;i++)
......@@ -689,6 +681,10 @@ int celt_encode_float(CELTEncoder * restrict st, const celt_sig_t * pcm, celt_si
st->delayedIntra = 1;
else
st->delayedIntra = 0;
/* Don't use intra energy when we're operating at low bit-rate */
if (nbCompressedBytes < 20)
intra_ener = 0;
/* Pitch analysis: we do it early to save on the peak stack space */
/* Don't use pitch if there isn't enough data available yet,
or if we're using shortBlocks */
......
......@@ -144,6 +144,8 @@ static inline float celt_exp2(float x)
celt_uint32_t i;
} res;
integer = floor(x);
if (integer < -50)
return 0;
frac = x-integer;
/* K0 = 1, K1 = log(2), K2 = 3-4*log(2), K3 = 3*log(2) - 2 */
res.f = 1.f + frac * (0.696147f + frac * (0.224411f + 0.079442f*frac));
......
......@@ -122,8 +122,8 @@ static const int band_allocation[BARK_BANDS*BITALLOC_SIZE] =
5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 8, 8, 10, 12, 12, 11, 11, 17, 12, 15, 15, 20, 18, 10, 1,
8, 7, 7, 7, 7, 7, 8, 8, 9, 10, 11, 12, 14, 17, 18, 21, 22, 27, 29, 39, 37, 38, 40, 35, 1,
7, 7, 7, 7, 7, 7, 10, 10, 10, 13, 14, 18, 20, 24, 28, 32, 32, 35, 38, 38, 42, 50, 59, 54, 31,
8, 8, 8, 8, 8, 9, 10, 12, 14, 20, 22, 25, 28, 30, 35, 42, 46, 50, 55, 60, 62, 62, 62, 62, 62,
12, 12, 12, 12, 12, 13, 15, 18, 22, 30, 32, 35, 40, 45, 55, 62, 66, 70, 85, 90, 92, 92, 92, 92, 92,
8, 8, 8, 8, 8, 9, 10, 12, 14, 20, 22, 25, 28, 30, 35, 42, 46, 50, 55, 60, 62, 62, 72, 82, 62,
9, 9, 9, 10, 12, 13, 15, 18, 22, 30, 32, 35, 40, 45, 55, 62, 66, 70, 85, 90, 92, 92, 92,102, 92,
};
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment