ref: 70d90d115d01cb47426295efca7a5a3ffcafd130
parent: a20545781e2541ea3bbdee5ef33fabcba20b1dc1
author: Jean-Marc Valin <[email protected]>
date: Mon Nov 28 09:17:47 EST 2011
VBR tuning
--- a/celt/celt.c
+++ b/celt/celt.c
@@ -823,7 +823,7 @@
trim_index-=1;
#ifndef FIXED_POINT
trim += MAX16(-QCONST16(4.f, 8), .75f*log2(1.001-sum*sum));
- *stereo_saving = -.5*log2(1.01-sum*sum);
+ *stereo_saving = -.25*log2(1.01-sum*sum);
/*printf("%f\n", *stereo_saving);*/
#else
*stereo_saving = 0;
@@ -854,7 +854,7 @@
if (analysis->valid)
{
trim -= MAX16(-QCONST16(2.f, 8), MIN16(QCONST16(2.f, 8), 2*(analysis->tonality_slope+.05)));
- if (analysis->tonality_slope > .15)
+ /*if (analysis->tonality_slope > .15)
trim_index--;
if (analysis->tonality_slope > .3)
trim_index--;
@@ -861,10 +861,11 @@
if (analysis->tonality_slope < -.15)
trim_index++;
if (analysis->tonality_slope < -.3)
- trim_index++;
+ trim_index++;*/
}
#endif
- trim_index = floor(.5+trim);
+ /*printf("%d %f\n", trim_index, trim);*/
+ /*trim_index = floor(.5+trim);*/
if (trim_index<0)
trim_index = 0;
if (trim_index>10)
@@ -1316,10 +1317,10 @@
} else {
if (st->analysis.valid)
{
- static const opus_val16 spread_thresholds[3] = {-QCONST16(.7f, 15), -QCONST16(.3f, 15), -QCONST16(.1f, 15)};
- static const opus_val16 spread_histeresis[3] = {QCONST16(.2f, 15), QCONST16(.1f, 15), QCONST16(.05f, 15)};
+ static const opus_val16 spread_thresholds[3] = {-QCONST16(.6f, 15), -QCONST16(.2f, 15), -QCONST16(.07f, 15)};
+ static const opus_val16 spread_histeresis[3] = {QCONST16(.15f, 15), QCONST16(.07f, 15), QCONST16(.02f, 15)};
static const opus_val16 tapset_thresholds[2] = {QCONST16(.0f, 15), QCONST16(.15f, 15)};
- static const opus_val16 tapset_histeresis[2] = {QCONST16(.05f, 15), QCONST16(.05f, 15)};
+ static const opus_val16 tapset_histeresis[2] = {QCONST16(.1f, 15), QCONST16(.05f, 15)};
st->spread_decision = hysteresis_decision(-st->analysis.tonality, spread_thresholds, spread_histeresis, 3, st->spread_decision);
st->tapset_decision = hysteresis_decision(st->analysis.tonality_slope, tapset_thresholds, tapset_histeresis, 2, st->tapset_decision);
} else {
@@ -1327,6 +1328,7 @@
&st->tonal_average, st->spread_decision, &st->hf_average,
&st->tapset_decision, pf_on&&!shortBlocks, effEnd, C, M);
}
+ /*printf("%d %d\n", st->tapset_decision, st->spread_decision);*/
/*printf("%f %d %f %d\n\n", st->analysis.tonality, st->spread_decision, st->analysis.tonality_slope, st->tapset_decision);*/
}
ec_enc_icdf(enc, st->spread_decision, spread_icdf, 5);
@@ -1482,11 +1484,12 @@
if (st->constrained_vbr)
target += (st->vbr_offset>>lm_diff);
+ /*printf("%f %f %f\n", st->analysis.activity, st->analysis.tonality, tf_estimate);*/
#ifndef FIXED_POINT
if (st->analysis.valid && st->analysis.activity<.4)
- target -= (coded_bins<<BITRES)*2*(.4-st->analysis.activity);
-
- target -= MIN32(target/3, stereo_saving*(st->mode->eBands[intensity]<<LM<<BITRES));
+ target -= (coded_bins<<BITRES)*1*(.4-st->analysis.activity);
+ if (C==2)
+ target -= MIN32(target/3, stereo_saving*(st->mode->eBands[intensity]<<LM<<BITRES));
#endif
#ifdef FIXED_POINT
@@ -1499,9 +1502,10 @@
if (st->analysis.valid) {
int tonal_target;
float tonal;
- tonal = st->analysis.tonality;
- tonal -= .06;
- tonal_target = target + (coded_bins<<BITRES)*1.55*tonal;
+ tonal = st->analysis.tonality*st->analysis.tonality;
+ tonal -= .08;
+ tonal_target = target + (coded_bins<<BITRES)*1.5f*tonal;
+ /*printf("%f %d\n", tonal, tonal_target);*/
new_target = IMAX(tonal_target,new_target);
}
#endif
--- a/src/analysis.c
+++ b/src/analysis.c
@@ -70,7 +70,7 @@
2, 4, 6, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 68, 80, 96, 120
};
-#define NB_TONAL_SKIP_BANDS 8
+#define NB_TONAL_SKIP_BANDS 0
typedef struct {
float angle[240];
@@ -260,6 +260,7 @@
if (b>=NB_TONAL_SKIP_BANDS)
frame_tonality += band_tonality[b];
slope += band_tonality[b]*(b-8);
+ /*printf("%f %f ", band_tonality[b], stationarity);*/
if (band_tonality[b] > info->boost_amount[1] && b>=7 && b < NB_TBANDS-1)
{
if (band_tonality[b] > info->boost_amount[0])