diff options
Diffstat (limited to 'celt/pitch.c')
-rw-r--r-- | celt/pitch.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/celt/pitch.c b/celt/pitch.c index b4079026..743528d0 100644 --- a/celt/pitch.c +++ b/celt/pitch.c @@ -307,6 +307,7 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, int T1, T1b; opus_val16 g1; opus_val16 cont=0; + opus_val16 thresh; T1 = (2*T0+k)/(2*k); if (T1 < minperiod) break; @@ -348,7 +349,14 @@ opus_val16 remove_doubling(opus_val16 *x, int maxperiod, int minperiod, cont = HALF32(prev_gain); else cont = 0; - if (g1 > QCONST16(.3f,15) + MULT16_16_Q15(QCONST16(.4f,15),g0)-cont) + thresh = MAX16(QCONST16(.3f,15), MULT16_16_Q15(QCONST16(.7,15),g0)-cont); + /* Bias against very high pitch (very short period) to avoid false-positives + due to short-term correlation */ + if (T1<3*minperiod) + thresh = MAX16(QCONST16(.4f,15), MULT16_16_Q15(QCONST16(.85,15),g0)-cont); + else if (T1<2*minperiod) + thresh = MAX16(QCONST16(.5f,15), MULT16_16_Q15(QCONST16(.9,15),g0)-cont); + if (g1 > thresh) { best_xy = xy; best_yy = yy; |