[xiph-cvs] cvs commit: speex/libspeex cb_search.c stack_alloc.h
Jean-Marc Valin
jm at xiph.org
Mon Oct 21 20:22:54 PDT 2002
jm 02/10/21 23:22:54
Modified: libspeex cb_search.c stack_alloc.h
Log:
Slight optimization to the way the target is updated in the search. Also
fixed the stack PUSH.
Revision Changes Path
1.68 +23 -0 speex/libspeex/cb_search.c
Index: cb_search.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/cb_search.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -r1.67 -r1.68
--- cb_search.c 21 Oct 2002 20:39:38 -0000 1.67
+++ cb_search.c 22 Oct 2002 03:22:54 -0000 1.68
@@ -184,6 +184,9 @@
for (m=0;m<nsf;m++)
t[m]=ot[j][m];
/*update target*/
+
+#if 0
+ /* Old code: update all target */
for (m=0;m<subvect_size;m++)
{
float g=shape_cb[best_index[k]*subvect_size+m];
@@ -191,6 +194,15 @@
t[n] -= g*r[q];
}
+#else
+ /* New code: update only enough to calculate error*/
+ {
+ float *res = resp+best_index[k]*subvect_size;
+ for (m=0;m<subvect_size;m++)
+ t[subvect_size*i+m] -= res[m];
+ }
+#endif
+
/*compute error (distance)*/
err=odist[j];
for (m=i*subvect_size;m<(i+1)*subvect_size;m++)
@@ -198,6 +210,17 @@
/*update n-best list*/
if (err<ndist[N-1] || ndist[N-1]<-.5)
{
+#if 1
+ /* New code: update the rest of the target only if it's worth it */
+ for (m=0;m<subvect_size;m++)
+ {
+ float g=shape_cb[best_index[k]*subvect_size+m];
+ q=subvect_size-m;
+ for (n=subvect_size*(i+1);n<nsf;n++,q++)
+ t[n] -= g*r[q];
+ }
+#endif
+
for (m=0;m<N;m++)
{
if (err < ndist[m] || ndist[m]<-.5)
<p><p>1.6 +3 -3 speex/libspeex/stack_alloc.h
Index: stack_alloc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/stack_alloc.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- stack_alloc.h 22 Oct 2002 01:50:07 -0000 1.5
+++ stack_alloc.h 22 Oct 2002 03:22:54 -0000 1.6
@@ -39,10 +39,10 @@
#define POP(stack) (stack-=((int*)stack)[-1]+1)
*/
-#define PUSH(stack, size) (stack+=(size),stack-(size))
+/*#define PUSH(stack, size) (stack+=(size),stack-(size))
+ */
+#define PUSH(stack, size) (stack=(float*)(((int)stack)+((size)*sizeof(float))),(float*)(((int)stack)-((size)*sizeof(float))))
-/*#define PUSH(stack, size) (stack=(float*)(((int)stack)+(size*sizeof(float))),(float*)(((int)stack)-(size*sizeof(float))))
- */
#endif
<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