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

github.com/mumble-voip/speex.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>2002-04-05 23:51:58 +0400
committerjmvalin <jmvalin@0101bb08-14d6-0310-b084-bc0e0c8e3800>2002-04-05 23:51:58 +0400
commit4d1eaf158132f7c874da217e81f81020d7938080 (patch)
tree23e9e0779bc9b898c01eae6efb947077e296da09 /libspeex
parent060146f5c02b893e40e25f2004aefdb380448a94 (diff)
Cleaned up SB-CELP and added more pulses and tracks for low-band.
git-svn-id: http://svn.xiph.org/trunk/speex@3221 0101bb08-14d6-0310-b084-bc0e0c8e3800
Diffstat (limited to 'libspeex')
-rw-r--r--libspeex/modes.c10
-rw-r--r--libspeex/sb_celp.c50
-rw-r--r--libspeex/speex.c3
3 files changed, 20 insertions, 43 deletions
diff --git a/libspeex/modes.c b/libspeex/modes.c
index 090230e..fa0cc38 100644
--- a/libspeex/modes.c
+++ b/libspeex/modes.c
@@ -71,10 +71,10 @@ mpulse_params mpulse_nb = {
mpulse_params mpulse_sb = {
- 24, /*nb_pulse*/
- 4, /*nb_tracks*/
- 2.2, /*gain_coef*/
- 20
+ 50, /*nb_pulse*/
+ 10, /*nb_tracks*/
+ 2.5, /*gain_coef*/
+ 10
};
@@ -202,7 +202,7 @@ SpeexMode mp_sb_mode = {
17, /*pitchStart*/
144, /*pitchEnd*/
0.9, /*gamma1*/
- 0.6, /*gamma2*/
+ 0.4, /*gamma2*/
.002, /*lag_factor*/
1.0001, /*lpc_floor*/
0.0, /*preemph*/
diff --git a/libspeex/sb_celp.c b/libspeex/sb_celp.c
index e814bb6..629241d 100644
--- a/libspeex/sb_celp.c
+++ b/libspeex/sb_celp.c
@@ -157,7 +157,7 @@ void sb_encoder_init(SBEncState *st, SpeexMode *mode)
st->subframeSize = 40;
st->nbSubframes = 4;
st->windowSize = mode->windowSize;
- st->lpcSize=12;
+ st->lpcSize=8;
st->lag_factor = .002;
st->lpc_floor = 1.0001;
@@ -353,16 +353,12 @@ void sb_encode(SBEncState *st, float *in, FrameBits *bits)
bw_lpc(st->gamma1, st->interp_lpc, st->bw_lpc1, st->lpcSize);
bw_lpc(st->gamma2, st->interp_lpc, st->bw_lpc2, st->lpcSize);
-#if 0
+#if 1 /* 1 for spectral folding excitation, 0 for stochastic */
for (i=0;i<st->lpcSize;i++)
mem[i]=st->mem_sp[i];
- residue_mem(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, mem);
- if (1) {
+ residue_mem(sp, st->interp_qlpc, exc, st->subframeSize, st->lpcSize, st->mem_sp);
+ {
float el=0,eh=0,g;
- printf ("exc0");
- for (i=0;i<st->subframeSize;i++)
- printf (" %f", exc[i]);
- printf ("\n");
for (i=0;i<st->subframeSize;i++)
eh+=sqr(exc[i]);
for (i=0;i<st->subframeSize;i++)
@@ -371,11 +367,9 @@ void sb_encode(SBEncState *st, float *in, FrameBits *bits)
g=sqrt(g);
for (i=0;i<st->subframeSize;i++)
exc[i]=g*st->st_low.exc[offset+i];
- printf ("exc1");
- for (i=0;i<st->subframeSize;i++)
- printf (" %f", exc[i]);
- printf ("\n");
}
+ syn_filt_mem(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, mem);
+
#else
/* Reset excitation */
for (i=0;i<st->subframeSize;i++)
@@ -403,28 +397,20 @@ void sb_encode(SBEncState *st, float *in, FrameBits *bits)
/* Compute target signal */
for (i=0;i<st->subframeSize;i++)
target[i]=sw[i]-res[i];
- if (0)
{
- syn_filt_zero(target, st->bw_lpc1, exc, st->subframeSize, st->lpcSize);
- residue_zero(exc, st->interp_qlpc, exc, st->subframeSize, st->lpcSize);
- residue_zero(exc, st->bw_lpc2, exc, st->subframeSize, st->lpcSize);
- printf ("exca");
- for (i=0;i<st->subframeSize;i++)
- printf (" %f", exc[i]);
- printf ("\n");
- } else {
- int ind,k,N=1;
+ int ind;
float gain;
- for (i=0;i<st->subframeSize;i++)
- exc[i]=0;
-#if 1
+#if 0
overlap_cb_search(target, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2,
&stoc[0], 512, &gain, &ind, st->lpcSize,
st->subframeSize);
for (i=0;i<st->subframeSize;i++)
exc[i]=gain*stoc[ind+i];
#else
-for (k=0;k<N;k++)
+ int k,N=2;
+ for (i=0;i<st->subframeSize;i++)
+ exc[i]=0;
+ for (k=0;k<N;k++)
{
int of=k*st->subframeSize/N;
overlap_cb_search(target+of, st->interp_qlpc, st->bw_lpc1, st->bw_lpc2,
@@ -445,25 +431,17 @@ for (k=0;k<N;k++)
#endif
}
-#endif
- printf ("sp");
- for (i=0;i<st->subframeSize;i++)
- printf (" %f", sp[i]);
- printf("\n");
- printf ("lpc");
- for (i=0;i<st->lpcSize;i++)
- printf (" %f", st->interp_lpc[i]);
- printf("\n");
/*Keep the previous memory*/
for (i=0;i<st->lpcSize;i++)
mem[i]=st->mem_sp[i];
/* Final signal synthesis from excitation */
syn_filt_mem(exc, st->interp_qlpc, sp, st->subframeSize, st->lpcSize, st->mem_sp);
-
+
/* Compute weighted signal again, from synthesized speech (not sure it's the right thing) */
residue_mem(sp, st->bw_lpc1, sw, st->subframeSize, st->lpcSize, mem);
syn_filt_mem(sw, st->bw_lpc2, sw, st->subframeSize, st->lpcSize, st->mem_sw);
+#endif
POP(st->stack);
}
diff --git a/libspeex/speex.c b/libspeex/speex.c
index d44f0ab..491793b 100644
--- a/libspeex/speex.c
+++ b/libspeex/speex.c
@@ -29,8 +29,6 @@
#include "filters.h"
#include "stack_alloc.h"
-extern float stoc[];
-extern float exc_table[][8];
#ifndef M_PI
#define M_PI 3.14159265358979323846 /* pi */
#endif
@@ -164,6 +162,7 @@ void encoder_destroy(EncState *st)
free(st->mem_sw);
}
+
void encode(EncState *st, float *in, FrameBits *bits)
{
int i, sub, roots;