diff --git a/libcelt/celt.c b/libcelt/celt.c index d7740ab3..f9ce003d 100644 --- a/libcelt/celt.c +++ b/libcelt/celt.c @@ -364,7 +364,7 @@ static const signed char tf_select_table[4][8] = { {0, -2, 0, -3, 2, 0, 1 -1}, }; -celt_word32 l1_metric(const celt_norm *tmp, int N, int LM, int width) +static celt_word32 l1_metric(const celt_norm *tmp, int N, int LM, int width) { int i, j; static const celt_word16 sqrtM_1[4] = {Q15ONE, QCONST16(0.70711f,15), QCONST16(0.5f,15), QCONST16(0.35355f,15)}; @@ -408,7 +408,7 @@ static int tf_analysis(const CELTMode *m, celt_word16 *bandLogE, celt_word16 *ol if (nbCompressedBytes<15*C) { for (i=0;ieBands[i]<eBands[i+1]< QCONST16(.9,10)) + trim_index-=3; + else if (sum > QCONST16(.65,10)) + trim_index-=2; + else if (sum > QCONST16(.45,10)) + trim_index--; + } +#if 0 + float diff=0; + for (c=0;c 4) + trim_index--; + if (diff > 8) + trim_index--; + /*if (diff < -10) + trim_index++;*/ +#endif + if (trim_index<0) + trim_index = 0; + if (trim_index>5) + trim_index = 5; + return trim_index; +} + #ifdef FIXED_POINT int celt_encode_with_ec(CELTEncoder * restrict st, const celt_int16 * pcm, celt_int16 * optional_resynthesis, int frame_size, unsigned char *compressed, int nbCompressedBytes, ec_enc *enc) { @@ -738,14 +790,7 @@ int celt_encode_with_ec_float(CELTEncoder * restrict st, const celt_sig * pcm, c offsets[i] *= (6<mode, X, bandLogE, st->mode->nbEBands, LM, C, N); alloc_trim = trim_coef[trim_index]; ec_encode_bin(enc, trim_cdf[trim_index], trim_cdf[trim_index+1], 7); } diff --git a/libcelt/mdct.c b/libcelt/mdct.c index f7fd58b6..daa9d6bf 100644 --- a/libcelt/mdct.c +++ b/libcelt/mdct.c @@ -66,9 +66,10 @@ void clt_mdct_init(mdct_lookup *l,int N, int maxshift) { int i; - int N4; + int N4, N2; kiss_twiddle_scalar *trig; l->n = N; + N2 = N>>1; N4 = N>>2; l->maxshift = maxshift; for (i=0;i<=maxshift;i++)