[xiph-cvs] cvs commit: speex/libspeex misc.h nb_celp.c sb_celp.c speex.h
Jean-Marc Valin
jm at xiph.org
Sun Dec 1 16:12:49 PST 2002
jm 02/12/01 19:12:49
Modified: libspeex misc.h nb_celp.c sb_celp.c speex.h
Log:
Implemented SPEEX_RESET_STATE and reduced memory allocation size.
Revision Changes Path
1.10 +1 -1 speex/libspeex/misc.h
Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- misc.h 27 Oct 2002 06:01:30 -0000 1.9
+++ misc.h 2 Dec 2002 00:12:48 -0000 1.10
@@ -36,7 +36,7 @@
#define MISC_H
#ifndef VERSION
-#define VERSION "Speex-1.0beta2"
+#define VERSION "Speex-1.0beta4"
#endif
#ifndef RELEASE
<p><p>1.87 +26 -22 speex/libspeex/nb_celp.c
Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- nb_celp.c 28 Nov 2002 06:32:50 -0000 1.86
+++ nb_celp.c 2 Dec 2002 00:12:48 -0000 1.87
@@ -96,7 +96,7 @@
st->submodeID=mode->defaultSubmode;
st->pre_mem=0;
st->pre_mem2=0;
- st->bounded_pitch = 0;
+ st->bounded_pitch = 1;
/* Allocating input buffer */
st->inBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
@@ -130,7 +130,7 @@
st->autocorr = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
- st->stack = (float*)speex_alloc(20000*sizeof(float));
+ st->stack = (float*)speex_alloc(4000*sizeof(float));
st->buf2 = (float*)speex_alloc(st->windowSize*sizeof(float));
@@ -412,6 +412,7 @@
for (i=0;i<st->lpcSize;i++)
st->mem_sw[i]=0;
st->first=1;
+ st->bounded_pitch = 1;
/* Final signal synthesis from excitation */
iir_mem2(st->exc, st->interp_qlpc, st->frame, st->frameSize, st->lpcSize, st->mem_sp);
@@ -774,7 +775,7 @@
st->pre_mem=0;
st->lpc_enh_enabled=0;
- st->stack = speex_alloc(20000*sizeof(float));
+ st->stack = speex_alloc(2000*sizeof(float));
st->inBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
st->frame = st->inBuf + st->bufSize - st->windowSize;
@@ -1360,25 +1361,6 @@
case SPEEX_SET_QUALITY:
{
int quality = (*(int*)ptr);
- /*
- if (quality<=0)
- st->submodeID = 0;
- else if (quality<=1)
- st->submodeID = 1;
- else if (quality<=2)
- st->submodeID = 2;
- else if (quality<=4)
- st->submodeID = 3;
- else if (quality<=6)
- st->submodeID = 4;
- else if (quality<=8)
- st->submodeID = 5;
- else if (quality<=9)
- st->submodeID = 6;
- else if (quality<=10)
- st->submodeID = 7;
- else
- fprintf(stderr, "Unknown nb_ctl quality: %d\n", quality);*/
if (quality < 0)
quality = 0;
if (quality > 10)
@@ -1420,6 +1402,19 @@
case SPEEX_GET_SAMPLING_RATE:
(*(int*)ptr)=st->sampling_rate;
break;
+ case SPEEX_RESET_STATE:
+ {
+ int i;
+ st->bounded_pitch = 1;
+ st->first = 1;
+ for (i=0;i<st->lpcSize;i++)
+ st->lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);
+ for (i=0;i<st->lpcSize;i++)
+ st->mem_sw[i]=st->mem_sw_whole[i]=st->mem_sp[i]=st->mem_exc[i]=0;
+ for (i=0;i<st->bufSize;i++)
+ st->excBuf[i]=st->swBuf[i]=st->inBuf[i]=st->exc2Buf[i]=0;
+ }
+ break;
case SPEEX_GET_PI_GAIN:
{
int i;
@@ -1493,6 +1488,15 @@
st->user_callback.func=c->func;
st->user_callback.data=c->data;
st->user_callback.callback_id=c->callback_id;
+ }
+ break;
+ case SPEEX_RESET_STATE:
+ {
+ int i;
+ for (i=0;i<2*st->lpcSize;i++)
+ st->mem_sp[i]=0;
+ for (i=0;i<st->bufSize;i++)
+ st->excBuf[i]=st->inBuf[i]=0;
}
break;
case SPEEX_GET_PI_GAIN:
<p><p>1.99 +25 -2 speex/libspeex/sb_celp.c
Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.98
retrieving revision 1.99
diff -u -r1.98 -r1.99
--- sb_celp.c 30 Nov 2002 05:24:41 -0000 1.98
+++ sb_celp.c 2 Dec 2002 00:12:48 -0000 1.99
@@ -163,7 +163,7 @@
st->gamma1=mode->gamma1;
st->gamma2=mode->gamma2;
st->first=1;
- st->stack = speex_alloc(20000*sizeof(float));
+ st->stack = speex_alloc(4000*sizeof(float));
st->x0d=(float*)speex_alloc(st->frame_size*sizeof(float));
st->x1d=(float*)speex_alloc(st->frame_size*sizeof(float));
@@ -694,7 +694,7 @@
st->submodeID=mode->defaultSubmode;
st->first=1;
- st->stack = speex_alloc(20000*sizeof(float));
+ st->stack = speex_alloc(2000*sizeof(float));
st->x0d=(float*)speex_alloc(st->frame_size*sizeof(float));
st->x1d=(float*)speex_alloc(st->frame_size*sizeof(float));
@@ -1052,6 +1052,20 @@
case SPEEX_GET_SAMPLING_RATE:
(*(int*)ptr)=st->sampling_rate;
break;
+ case SPEEX_RESET_STATE:
+ {
+ int i;
+ st->first = 1;
+ for (i=0;i<st->lpcSize;i++)
+ st->lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);
+ for (i=0;i<st->lpcSize;i++)
+ st->mem_sw[i]=st->mem_sp[i]=st->mem_sp2[i]=0;
+ for (i=0;i<st->bufSize;i++)
+ st->excBuf[i]=0;
+ for (i=0;i<QMF_ORDER;i++)
+ st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;
+ }
+ break;
case SPEEX_GET_PI_GAIN:
{
int i;
@@ -1124,6 +1138,15 @@
break;
case SPEEX_SET_USER_HANDLER:
speex_decoder_ctl(st->st_low, SPEEX_SET_USER_HANDLER, ptr);
+ break;
+ case SPEEX_RESET_STATE:
+ {
+ int i;
+ for (i=0;i<2*st->lpcSize;i++)
+ st->mem_sp[i]=0;
+ for (i=0;i<QMF_ORDER;i++)
+ st->h0_mem[i]=st->h1_mem[i]=st->g0_mem[i]=st->g1_mem[i]=0;
+ }
break;
case SPEEX_GET_PI_GAIN:
{
<p><p>1.67 +2 -0 speex/libspeex/speex.h
Index: speex.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- speex.h 15 Nov 2002 06:26:50 -0000 1.66
+++ speex.h 2 Dec 2002 00:12:48 -0000 1.67
@@ -102,6 +102,8 @@
#define SPEEX_SET_SAMPLING_RATE 24
#define SPEEX_GET_SAMPLING_RATE 25
+#define SPEEX_RESET_STATE 26
+
#define SPEEX_GET_RELATIVE_QUALITY 27
/* Used internally, not to be used in applications */
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list