ref: bdb5871bc4807e6facbb8a00b4cddc14cd219c43
parent: 8823261738ae121ec68c68c15f40a6141c273558
author: Jean-Marc Valin <[email protected]>
date: Fri May 28 14:58:42 EDT 2010
Simplification to the transient detection code Discarding the amplitude of the overlap for "frame_max"
--- a/libcelt/celt.c
+++ b/libcelt/celt.c
@@ -95,7 +95,6 @@
celt_word16 gain_prod;
celt_word32 frame_max;
int start, end;
- int next_transient;
/* VBR-related parameters */
celt_int32 vbr_reservoir;
@@ -176,7 +175,6 @@
st->delayedIntra = 1;
st->tonal_average = QCONST16(1.f,8);
st->fold_decision = 1;
- st->next_transient = 0;
st->in_mem = celt_alloc(st->overlap*C*sizeof(celt_sig));
st->out_mem = celt_alloc((MAX_PERIOD+st->overlap)*C*sizeof(celt_sig));
@@ -261,9 +259,9 @@
static int transient_analysis(const celt_word32 * restrict in, int len, int C,
int *transient_time, int *transient_shift,
- int *next, celt_word32 *frame_max, int overlap)
+ celt_word32 *frame_max, int overlap)
{
- int i, n, ret;
+ int i, n;
celt_word32 ratio;
celt_word32 threshold;
VARDECL(celt_word32, begin);
@@ -312,12 +310,10 @@
*transient_shift = 0;
*transient_time = n;
- *frame_max = begin[len];
+ *frame_max = begin[len-overlap];
- ret = ratio > 20 || *next;
- *next = ret && n>len-overlap;
RESTORE_STACK;
- return ret;
+ return ratio > 20;
}
/** Apply window and compute the MDCT for all sub-frames and
@@ -551,7 +547,7 @@
VARDECL(int, path0);
VARDECL(int, path1);
/* FIXME: lambda should depend on the bit-rate */
- celt_word16 lambda = 1;
+ celt_word16 lambda = QCONST16(1.f,DB_SHIFT);
SAVE_STACK;
ALLOC(metric, len, celt_word16);
@@ -727,7 +723,7 @@
resynth = st->pitch_available>0 || optional_resynthesis!=NULL;
- if (M > 1 && transient_analysis(in, N+st->overlap, C, &transient_time, &transient_shift, &st->next_transient, &st->frame_max, st->overlap))
+ if (M > 1 && transient_analysis(in, N+st->overlap, C, &transient_time, &transient_shift, &st->frame_max, st->overlap))
{
#ifndef FIXED_POINT
float gain_1;