ref: 1213ba5e6837be1ddb33aa22fb0ca32e38fff0c7
parent: a6a53ab56b5a965161b4f1db5d54d6d3b161331f
author: Jean-Marc Valin <[email protected]>
date: Tue Aug 31 13:03:13 EDT 2010
Complexity setting now does something again
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -74,6 +74,7 @@
int channels;
int force_intra;
+ int complexity;
int start, end;
celt_int32 vbr_rate_norm; /* Target number of 16th bits per frame */
@@ -143,8 +144,9 @@
st->vbr_rate_norm = 0;
st->force_intra = 0;
st->delayedIntra = 1;
- st->tonal_average = QCONST16(1.f,8);
+ st->tonal_average = 256;
st->fold_decision = 1;
+ st->complexity = 5;
if (error)
*error = CELT_OK;
@@ -627,8 +629,16 @@
resynth = optional_resynthesis!=NULL;
- if (M > 1 && transient_analysis(in, N+st->overlap, C, &transient_time, &transient_shift, &st->frame_max, st->overlap))
+ if (st->complexity > 1)
{
+ isTransient = M > 1 &&
+ transient_analysis(in, N+st->overlap, C, &transient_time,
+ &transient_shift, &st->frame_max, st->overlap);
+ } else {
+ isTransient = 0;
+ }
+ if (isTransient)
+ {
#ifndef FIXED_POINT
float gain_1;
#endif
@@ -654,7 +664,6 @@
in[C*i+c] *= gain_1;
#endif
}
- isTransient = 1;
has_fold = 1;
}
@@ -754,10 +763,16 @@
tf_encode(st->start, st->end, isTransient, tf_res, nbAvailableBytes, LM, tf_select, enc);
- if (shortBlocks)
+ if (shortBlocks || st->complexity < 3)
{
- has_fold = 1;
- st->fold_decision = 1;
+ if (st->complexity == 0)
+ {
+ has_fold = 0;
+ st->fold_decision = 3;
+ } else {
+ has_fold = 1;
+ st->fold_decision = 1;
+ }
} else {
has_fold = folding_decision(st->mode, X, &st->tonal_average, &st->fold_decision, effEnd, C, M);
}
@@ -1041,6 +1056,7 @@
int value = va_arg(ap, celt_int32);
if (value<0 || value>10)
goto bad_arg;
+ st->complexity = value;
}
break;
case CELT_SET_START_BAND_REQUEST: