Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/speexdsp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>2007-06-25 01:16:56 +0400
committerjm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800>2007-06-25 01:16:56 +0400
commite485ebe5bf8855db6433de1d07ca61229a203dbe (patch)
treeeb812b1cbc1b653ec33aa4bcbe41854c1eb6e3d8 /libspeex/nb_celp.c
parent172946d39d1847cbc68e332fceb5b76ffbd75bd8 (diff)
Tuned the vocoder gains and prevented the ol_gain from being reduced by
the encoder for voiced segments. git-svn-id: http://svn.xiph.org/trunk/speex@13186 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'libspeex/nb_celp.c')
-rw-r--r--libspeex/nb_celp.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/libspeex/nb_celp.c b/libspeex/nb_celp.c
index a632287..6b2c812 100644
--- a/libspeex/nb_celp.c
+++ b/libspeex/nb_celp.c
@@ -355,7 +355,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
/*Open-loop pitch*/
- if (st->complexity>2 || !st->submodes[st->submodeID] || st->vbr_enabled || st->vad_enabled || SUBMODE(forced_pitch_gain) ||
+ if ((st->complexity>2 && SUBMODE(have_subframe_gain)<3) || !st->submodes[st->submodeID] || st->vbr_enabled || st->vad_enabled || SUBMODE(forced_pitch_gain) ||
SUBMODE(lbr_pitch) != -1)
{
int nol_pitch[6];
@@ -440,7 +440,7 @@ int nb_encode(void *state, void *vin, SpeexBits *bits)
#endif
{
spx_word16_t g = compute_rms16(st->exc, st->frameSize);
- if (ol_pitch>0)
+ if (st->submodeID!=1 && ol_pitch>0)
ol_gain = MULT16_16(g, MULT16_16_Q14(QCONST16(1.1,14),
spx_sqrt(QCONST32(1.,28)-MULT16_32_Q15(QCONST16(.8,15),SHL32(MULT16_16(ol_pitch_coef,ol_pitch_coef),16)))));
else
@@ -1607,31 +1607,30 @@ int nb_decode(void *state, SpeexBits *bits, void *vout)
if (st->submodeID==1)
{
float g=ol_pitch_coef*GAIN_SCALING_1;
+ g=1.5*(g-.2);
+ if (g<0)
+ g=0;
+ if (g>1)
+ g=1;
-
for (i=0;i<st->subframeSize;i++)
exc[i]=0;
while (st->voc_offset<st->subframeSize)
{
+ /* Not quite sure why we need the factor of two in the sqrt */
if (st->voc_offset>=0)
- exc[st->voc_offset]=sqrt(1.0*ol_pitch);
+ exc[st->voc_offset]=g*sqrt(2.0*ol_pitch)*PSHR32(ol_gain,SIG_SHIFT);
st->voc_offset+=ol_pitch;
}
st->voc_offset -= st->subframeSize;
-
- g=.5+2*(g-.6);
- if (g<0)
- g=0;
- if (g>1)
- g=1;
+
for (i=0;i<st->subframeSize;i++)
{
spx_word16_t exci=exc[i];
- /* FIXME: cleanup the innov[i]/SIG_SCALING */
- exc[i]=.8*g*exc[i]*PSHR32(ol_gain,SIG_SHIFT) + .6*g*st->voc_m1*PSHR32(ol_gain,SIG_SHIFT) + (1-.5*g)*PSHR32(innov[i],SIG_SHIFT) - .5*g*PSHR32(st->voc_m2,SIG_SHIFT);
+ exc[i]= .7*exc[i] + .3*st->voc_m1 + (1-.85*g)*PSHR32(innov[i],SIG_SHIFT) - .15*g*PSHR32(st->voc_m2,SIG_SHIFT);
st->voc_m1 = exci;
st->voc_m2=innov[i];
- st->voc_mean = .95*st->voc_mean + .05*exc[i];
+ st->voc_mean = .8*st->voc_mean + .2*exc[i];
exc[i]-=st->voc_mean;
}
}