[xiph-cvs] cvs commit: speex/src speexdec.c speexenc.c

Jean-Marc Valin jm at xiph.org
Sat Oct 26 23:01:31 PDT 2002



jm          02/10/27 01:01:31

  Modified:    libspeex Makefile.am bits.c cb_search.c filters.c filters.h
                        lsp.c ltp.c ltp_sse.h misc.c misc.h modes.c
                        nb_celp.c sb_celp.c speex_callbacks.c
                        speex_header.c testenc.c testenc_wb.c
               src      speexdec.c speexenc.c
  Log:
  Made the code valid for a C++ compiler (void* stuff), plus some cleanup

Revision  Changes    Path
1.42      +2 -2      speex/libspeex/Makefile.am

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/Makefile.am,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- Makefile.am	26 Oct 2002 04:37:15 -0000	1.41
+++ Makefile.am	27 Oct 2002 06:01:30 -0000	1.42
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in. -*-Makefile-*-
 
-# $Id: Makefile.am,v 1.41 2002/10/26 04:37:15 jm Exp $
+# $Id: Makefile.am,v 1.42 2002/10/27 06:01:30 jm Exp $
 
 # Disable automatic dependency tracking if using other tools than gcc and gmake
 #AUTOMAKE_OPTIONS = no-dependencies
@@ -60,7 +60,7 @@
         
 libspeex_la_LDFLAGS = -release $(LT_RELEASE)
 
-bin_PROGRAMS = testenc testenc_wb
+noinst_PROGRAMS = testenc testenc_wb
 
 testenc_SOURCES = testenc.c
 testenc_LDADD = libspeex.la

<p><p>1.21      +2 -2      speex/libspeex/bits.c

Index: bits.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/bits.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- bits.c	11 Oct 2002 03:39:34 -0000	1.20
+++ bits.c	27 Oct 2002 06:01:30 -0000	1.21
@@ -40,7 +40,7 @@
 void speex_bits_init(SpeexBits *bits)
 {
    int i;
-   bits->bytes = speex_alloc(MAX_BYTES_PER_FRAME);
+   bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
 
    for (i=0;i<MAX_BYTES_PER_FRAME;i++)
       bits->bytes[i]=0;
@@ -53,7 +53,7 @@
 void speex_bits_init_buffer(SpeexBits *bits, void *buff)
 {
    int i;
-   bits->bytes = buff;
+   bits->bytes = (char*)buff;
 
    for (i=0;i<MAX_BYTES_PER_FRAME;i++)
       bits->bytes[i]=0;

<p><p>1.79      +7 -7      speex/libspeex/cb_search.c

Index: cb_search.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/cb_search.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -r1.78 -r1.79
--- cb_search.c	27 Oct 2002 02:59:00 -0000	1.78
+++ cb_search.c	27 Oct 2002 06:01:30 -0000	1.79
@@ -55,10 +55,9 @@
    int i,j,k,m,n,q;
    float *resp;
    float *t, *e, *E, *r2;
-   /*FIXME: Should make this dynamic*/
-   float *tmp, *_ot[20], *_nt[20];
+   float *tmp;
    float *ndist, *odist;
-   int *itmp, *_nind[20], *_oind[20];
+   int *itmp;
    float **ot, **nt;
    int **nind, **oind;
    int *ind;
@@ -70,13 +69,14 @@
    float *best_dist;
    int have_sign;
 
-   ot=_ot;
-   nt=_nt;
-   oind=_oind;
-   nind=_nind;
    N=complexity;
    if (N>10)
       N=10;
+
+   ot=PUSH(stack, N, float*);
+   nt=PUSH(stack, N, float*);
+   oind=PUSH(stack, N, int*);
+   nind=PUSH(stack, N, int*);
 
    params = (split_cb_params *) par;
    subvect_size = params->subvect_size;

<p><p>1.30      +10 -19    speex/libspeex/filters.c

Index: filters.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- filters.c	27 Oct 2002 02:59:00 -0000	1.29
+++ filters.c	27 Oct 2002 06:01:30 -0000	1.30
@@ -32,17 +32,8 @@
 
 #include "filters.h"
 #include "stack_alloc.h"
-#include <stdio.h>
 #include <math.h>
 
-void print_vec(float *vec, int len, char *name)
-{
-   int i;
-   printf ("%s ", name);
-   for (i=0;i<len;i++)
-      printf (" %f", vec[i]);
-   printf ("\n");
-}
 
 void bw_lpc(float gamma, float *lpc_in, float *lpc_out, int order)
 {
@@ -131,16 +122,17 @@
    fir_mem2(y, awk2, y, N, ord, mem);
 }
 
-#define MAX_FILTER 100
-#define MAX_SIGNAL 1000
 
-void qmf_decomp(float *xx, float *aa, float *y1, float *y2, int N, int M, float *mem)
+void qmf_decomp(float *xx, float *aa, float *y1, float *y2, int N, int M, float *mem, void *stack)
 {
    int i,j,k,M2;
-   /* FIXME: this should be dynamic */
-   float a[MAX_FILTER];
-   float x[MAX_SIGNAL];
-   float *x2=x+M-1;
+   float *a;
+   float *x;
+   float *x2;
+   
+   a = PUSH(stack, M, float);
+   x = PUSH(stack, N+M-1, float);
+   x2=x+M-1;
    M2=M>>1;
    for (i=0;i<M;i++)
       a[M-i-1]=aa[i];
@@ -166,14 +158,13 @@
 }
 
 /* By segher */
-void fir_mem_up(float *x, float *a, float *y, int N, int M, float *mem)
+void fir_mem_up(float *x, float *a, float *y, int N, int M, float *mem, void *stack)
    /* assumptions:
       all odd x[i] are zero -- well, actually they are left out of the array now
       N and M are multiples of 4 */
 {
    int i, j;
-   /*FIXME: Make that dynamic*/
-   float xx[384];
+   float *xx=PUSH(stack, M+N-1, float);
 
    for (i = 0; i < N/2; i++)
       xx[2*i] = x[N/2-1-i];

<p><p>1.21      +2 -3      speex/libspeex/filters.h

Index: filters.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/filters.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- filters.h	27 Oct 2002 02:59:00 -0000	1.20
+++ filters.h	27 Oct 2002 06:01:30 -0000	1.21
@@ -33,10 +33,9 @@
 #ifndef FILTERS_H
 #define FILTERS_H
 
-void qmf_decomp(float *xx, float *aa, float *y1, float *y2, int N, int M, float *mem);
-void fir_mem_up(float *x, float *a, float *y, int N, int M, float *mem);
+void qmf_decomp(float *xx, float *aa, float *y1, float *y2, int N, int M, float *mem, void *stack);
+void fir_mem_up(float *x, float *a, float *y, int N, int M, float *mem, void *stack);
 
-void print_vec(float *vec, int len, char *name);
 
 void filter_mem2(float *x, float *num, float *den, float *y, int N, int ord, float *mem);
 void fir_mem2(float *x, float *num, float *y, int N, int ord, float *mem);

<p><p>1.18      +1 -1      speex/libspeex/lsp.c

Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/lsp.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- lsp.c	27 Oct 2002 02:59:00 -0000	1.17
+++ lsp.c	27 Oct 2002 06:01:30 -0000	1.18
@@ -68,7 +68,7 @@
 
 
 
-float cheb_poly_eva(float *coef,float x,int m,float *stack)
+float cheb_poly_eva(float *coef,float x,int m,void *stack)
 /*  float coef[]  	coefficients of the polynomial to be evaluated 	*/
 /*  float x   		the point where polynomial is to be evaluated 	*/
 /*  int m 		order of the polynomial 			*/

<p><p>1.64      +2 -2      speex/libspeex/ltp.c

Index: ltp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- ltp.c	27 Oct 2002 02:59:00 -0000	1.63
+++ ltp.c	27 Oct 2002 06:01:30 -0000	1.64
@@ -357,8 +357,8 @@
    N=complexity;
    if (N>10)
       N=10;
-   /*FIXME: This breaks if sizeof(int) != sizeof(float) */
-   nbest=(int*)PUSH(stack, N, float);
+
+   nbest=PUSH(stack, N, int);
    gains = PUSH(stack, N, float);
    params = (ltp_params*) par;
 

<p><p>1.2       +0 -2      speex/libspeex/ltp_sse.h

Index: ltp_sse.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/ltp_sse.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ltp_sse.h	26 Oct 2002 04:37:15 -0000	1.1
+++ ltp_sse.h	27 Oct 2002 06:01:30 -0000	1.2
@@ -84,9 +84,7 @@
   movhlps %%xmm3, %%xmm4
   addps %%xmm4, %%xmm3
   movaps %%xmm3, %%xmm4
-  //FIXME: which one?
   shufps $0x55, %%xmm4, %%xmm4
-  //shufps $33, %%xmm4, %%xmm4
   addss %%xmm4, %%xmm3
   movss %%xmm3, (%%edx)
   

<p><p>1.5       +12 -0     speex/libspeex/misc.c

Index: misc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- misc.c	11 Oct 2002 03:39:34 -0000	1.4
+++ misc.c	27 Oct 2002 06:01:30 -0000	1.5
@@ -33,6 +33,18 @@
 #include "misc.h"
 #include <stdlib.h>
 #include <string.h>
+#include <stdio.h>
+
+#ifndef RELEASE
+void print_vec(float *vec, int len, char *name)
+{
+   int i;
+   printf ("%s ", name);
+   for (i=0;i<len;i++)
+      printf (" %f", vec[i]);
+   printf ("\n");
+}
+#endif
 
 unsigned int be_int(unsigned int i)
 {

<p><p>1.9       +4 -0      speex/libspeex/misc.h

Index: misc.h
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/misc.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- misc.h	26 Oct 2002 04:51:10 -0000	1.8
+++ misc.h	27 Oct 2002 06:01:30 -0000	1.9
@@ -39,6 +39,10 @@
 #define VERSION "Speex-1.0beta2"
 #endif
 
+#ifndef RELEASE
+void print_vec(float *vec, int len, char *name);
+#endif
+
 unsigned int be_int(unsigned int i);
 unsigned int le_int(unsigned int i);
 

<p><p>1.83      +2 -2      speex/libspeex/modes.c

Index: modes.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/modes.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- modes.c	23 Oct 2002 06:03:16 -0000	1.82
+++ modes.c	27 Oct 2002 06:01:30 -0000	1.83
@@ -506,7 +506,7 @@
 
 static void nb_mode_query(void *mode, int request, void *ptr)
 {
-   SpeexNBMode *m = mode;
+   SpeexNBMode *m = (SpeexNBMode*)mode;
    
    switch (request)
    {
@@ -524,7 +524,7 @@
 
 static void wb_mode_query(void *mode, int request, void *ptr)
 {
-   SpeexSBMode *m = mode;
+   SpeexSBMode *m = (SpeexSBMode*)mode;
 
    switch (request)
    {

<p><p>1.73      +55 -55    speex/libspeex/nb_celp.c

Index: nb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/nb_celp.c,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -r1.72 -r1.73
--- nb_celp.c	27 Oct 2002 02:59:00 -0000	1.72
+++ nb_celp.c	27 Oct 2002 06:01:30 -0000	1.73
@@ -67,8 +67,8 @@
    SpeexNBMode *mode;
    int i;
 
-   mode=m->mode;
-   st = speex_alloc(sizeof(EncState));
+   mode=(SpeexNBMode *)m->mode;
+   st = (EncState*)speex_alloc(sizeof(EncState));
    st->mode=m;
    /* Codec parameters, should eventually have several "modes"*/
    st->frameSize = mode->frameSize;
@@ -92,71 +92,71 @@
    st->bounded_pitch = 0;
 
    /* Allocating input buffer */
-   st->inBuf = speex_alloc(st->bufSize*sizeof(float));
+   st->inBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
    st->frame = st->inBuf + st->bufSize - st->windowSize;
    /* Allocating excitation buffer */
-   st->excBuf = speex_alloc(st->bufSize*sizeof(float));
+   st->excBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
    st->exc = st->excBuf + st->bufSize - st->windowSize;
-   st->swBuf = speex_alloc(st->bufSize*sizeof(float));
+   st->swBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
    st->sw = st->swBuf + st->bufSize - st->windowSize;
 
-   st->exc2Buf = speex_alloc(st->bufSize*sizeof(float));
+   st->exc2Buf = (float*)speex_alloc(st->bufSize*sizeof(float));
    st->exc2 = st->exc2Buf + st->bufSize - st->windowSize;
 
-   st->innov = speex_alloc(st->frameSize*sizeof(float));
+   st->innov = (float*)speex_alloc(st->frameSize*sizeof(float));
 
    /* Asymetric "pseudo-Hamming" window */
    {
       int part1, part2;
       part1 = st->subframeSize*7/2;
       part2 = st->subframeSize*5/2;
-      st->window = speex_alloc(st->windowSize*sizeof(float));
+      st->window = (float*)speex_alloc(st->windowSize*sizeof(float));
       for (i=0;i<part1;i++)
          st->window[i]=.54-.46*cos(M_PI*i/part1);
       for (i=0;i<part2;i++)
          st->window[part1+i]=.54+.46*cos(M_PI*i/part2);
    }
    /* Create the window for autocorrelation (lag-windowing) */
-   st->lagWindow = speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->lagWindow = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
    for (i=0;i<st->lpcSize+1;i++)
       st->lagWindow[i]=exp(-.5*sqr(2*M_PI*st->lag_factor*i));
 
-   st->autocorr = speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->autocorr = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
 
-   st->stack = speex_alloc(20000*sizeof(float));
+   st->stack = (float*)speex_alloc(20000*sizeof(float));
 
-   st->buf2 = speex_alloc(st->windowSize*sizeof(float));
+   st->buf2 = (float*)speex_alloc(st->windowSize*sizeof(float));
 
-   st->lpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->interp_lpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->interp_qlpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->bw_lpc1 = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->bw_lpc2 = speex_alloc((st->lpcSize+1)*sizeof(float));
-
-   st->lsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->old_lsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->old_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_lsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->rc = speex_alloc(st->lpcSize*sizeof(float));
+   st->lpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->interp_lpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->interp_qlpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->bw_lpc1 = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->bw_lpc2 = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+
+   st->lsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->old_lsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->old_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_lsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->rc = (float*)speex_alloc(st->lpcSize*sizeof(float));
    st->first = 1;
    for (i=0;i<st->lpcSize;i++)
    {
       st->lsp[i]=(M_PI*((float)(i+1)))/(st->lpcSize+1);
    }
 
-   st->mem_sp = speex_alloc(st->lpcSize*sizeof(float));
-   st->mem_sw = speex_alloc(st->lpcSize*sizeof(float));
-   st->mem_sw_whole = speex_alloc(st->lpcSize*sizeof(float));
-   st->mem_exc = speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sw = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sw_whole = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_exc = (float*)speex_alloc(st->lpcSize*sizeof(float));
 
-   st->pi_gain = speex_alloc(st->nbSubframes*sizeof(float));
+   st->pi_gain = (float*)speex_alloc(st->nbSubframes*sizeof(float));
 
-   st->pitch = speex_alloc(st->nbSubframes*sizeof(int));
+   st->pitch = (int*)speex_alloc(st->nbSubframes*sizeof(int));
 
    if (1) {
-      st->vbr = speex_alloc(sizeof(VBRState));
+      st->vbr = (VBRState*)speex_alloc(sizeof(VBRState));
       vbr_init(st->vbr);
       st->vbr_quality = 8;
       st->vbr_enabled = 0;
@@ -170,14 +170,14 @@
 
 void nb_encoder_destroy(void *state)
 {
-   EncState *st=state;
+   EncState *st=(EncState *)state;
    /* Free all allocated memory */
    speex_free(st->inBuf);
    speex_free(st->excBuf);
    speex_free(st->swBuf);
    speex_free(st->exc2Buf);
    speex_free(st->innov);
-   speex_free(st->stack);
+   speex_free((float*)st->stack);
 
    speex_free(st->window);
    speex_free(st->buf2);
@@ -208,7 +208,7 @@
    speex_free(st->vbr);
 
    /*Free state memory... should be last*/
-   speex_free(st);
+   speex_free((float*)st);
 }
 
 void nb_encode(void *state, float *in, SpeexBits *bits)
@@ -223,7 +223,7 @@
    void *stack;
    float *syn_resp;
 
-   st=state;
+   st=(EncState *)state;
    stack=st->stack;
 
    /* Copy new data in input buffer */
@@ -671,7 +671,7 @@
 
          /* In some (rare) modes, we do a second search (more bits) to reduce noise even more */
          if (SUBMODE(double_codebook)) {
-            float *tmp_stack=stack;
+            void *tmp_stack=stack;
             float *innov2 = PUSH(tmp_stack, st->subframeSize, float);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
@@ -731,8 +731,8 @@
    SpeexNBMode *mode;
    int i;
 
-   mode=m->mode;
-   st = speex_alloc(sizeof(DecState));
+   mode=(SpeexNBMode*)m->mode;
+   st = (DecState *)speex_alloc(sizeof(DecState));
    st->mode=m;
 
    st->first=1;
@@ -757,23 +757,23 @@
 
    st->stack = speex_alloc(20000*sizeof(float));
 
-   st->inBuf = speex_alloc(st->bufSize*sizeof(float));
+   st->inBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
    st->frame = st->inBuf + st->bufSize - st->windowSize;
-   st->excBuf = speex_alloc(st->bufSize*sizeof(float));
+   st->excBuf = (float*)speex_alloc(st->bufSize*sizeof(float));
    st->exc = st->excBuf + st->bufSize - st->windowSize;
    for (i=0;i<st->bufSize;i++)
       st->inBuf[i]=0;
    for (i=0;i<st->bufSize;i++)
       st->excBuf[i]=0;
-   st->innov = speex_alloc(st->frameSize*sizeof(float));
+   st->innov = (float*)speex_alloc(st->frameSize*sizeof(float));
 
-   st->interp_qlpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->old_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->mem_sp = speex_alloc(5*st->lpcSize*sizeof(float));
+   st->interp_qlpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->old_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sp = (float*)speex_alloc(5*st->lpcSize*sizeof(float));
 
-   st->pi_gain = speex_alloc(st->nbSubframes*sizeof(float));
+   st->pi_gain = (float*)speex_alloc(st->nbSubframes*sizeof(float));
    st->last_pitch = 40;
    st->count_lost=0;
 
@@ -789,7 +789,7 @@
 void nb_decoder_destroy(void *state)
 {
    DecState *st;
-   st=state;
+   st=(DecState*)state;
    speex_free(st->inBuf);
    speex_free(st->excBuf);
    speex_free(st->innov);
@@ -901,7 +901,7 @@
    int m;
    void *stack;
    float *awk1, *awk2, *awk3;
-   st=state;
+   st=(DecState*)state;
    stack=st->stack;
 
    /* If bits is NULL, consider the packet to be lost (what could we do anyway) */
@@ -1156,7 +1156,7 @@
          /* Decode second codebook (only for some modes) */
          if (SUBMODE(double_codebook))
          {
-            float *tmp_stack=stack;
+            void *tmp_stack=stack;
             float *innov2 = PUSH(tmp_stack, st->subframeSize, float);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
@@ -1215,7 +1215,7 @@
 void nb_encoder_ctl(void *state, int request, void *ptr)
 {
    EncState *st;
-   st=state;     
+   st=(EncState*)state;     
    switch(request)
    {
    case SPEEX_GET_FRAME_SIZE:
@@ -1286,7 +1286,7 @@
 void nb_decoder_ctl(void *state, int request, void *ptr)
 {
    DecState *st;
-   st=state;
+   st=(DecState*)state;
    switch(request)
    {
    case SPEEX_SET_ENH:
@@ -1306,7 +1306,7 @@
       break;
    case SPEEX_SET_HANDLER:
       {
-         SpeexCallback *c = ptr;
+         SpeexCallback *c = (SpeexCallback*)ptr;
          st->speex_callbacks[c->callback_id].func=c->func;
          st->speex_callbacks[c->callback_id].data=c->data;
          st->speex_callbacks[c->callback_id].callback_id=c->callback_id;
@@ -1314,7 +1314,7 @@
       break;
    case SPEEX_SET_USER_HANDLER:
       {
-         SpeexCallback *c = ptr;
+         SpeexCallback *c = (SpeexCallback*)ptr;
          st->user_callback.func=c->func;
          st->user_callback.data=c->data;
          st->user_callback.callback_id=c->callback_id;

<p><p>1.83      +75 -76    speex/libspeex/sb_celp.c

Index: sb_celp.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/sb_celp.c,v
retrieving revision 1.82
retrieving revision 1.83
diff -u -r1.82 -r1.83
--- sb_celp.c	27 Oct 2002 02:59:00 -0000	1.82
+++ sb_celp.c	27 Oct 2002 06:01:30 -0000	1.83
@@ -131,9 +131,9 @@
    SBEncState *st;
    SpeexSBMode *mode;
 
-   st = speex_alloc(sizeof(SBEncState));
+   st = (SBEncState*)speex_alloc(sizeof(SBEncState));
    st->mode = m;
-   mode = m->mode;
+   mode = (SpeexSBMode*)m->mode;
 
    st->st_low = nb_encoder_init(mode->nb_mode);
    st->full_frame_size = 2*mode->frameSize;
@@ -158,58 +158,57 @@
    st->first=1;
    st->stack = speex_alloc(10000*sizeof(float));
 
-   st->x0d=speex_alloc(st->frame_size*sizeof(float));
-   st->x1d=speex_alloc(st->frame_size*sizeof(float));
-   st->high=speex_alloc(st->full_frame_size*sizeof(float));
-   st->y0=speex_alloc(st->full_frame_size*sizeof(float));
-   st->y1=speex_alloc(st->full_frame_size*sizeof(float));
-
-   st->h0_mem=speex_alloc(QMF_ORDER*sizeof(float));
-   st->h1_mem=speex_alloc(QMF_ORDER*sizeof(float));
-   st->g0_mem=speex_alloc(QMF_ORDER*sizeof(float));
-   st->g1_mem=speex_alloc(QMF_ORDER*sizeof(float));
+   st->x0d=(float*)speex_alloc(st->frame_size*sizeof(float));
+   st->x1d=(float*)speex_alloc(st->frame_size*sizeof(float));
+   st->high=(float*)speex_alloc(st->full_frame_size*sizeof(float));
+   st->y0=(float*)speex_alloc(st->full_frame_size*sizeof(float));
+   st->y1=(float*)speex_alloc(st->full_frame_size*sizeof(float));
+
+   st->h0_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+   st->h1_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+   st->g0_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+   st->g1_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
 
-   st->buf=speex_alloc(st->windowSize*sizeof(float));
-   st->excBuf=speex_alloc(st->bufSize*sizeof(float));
+   st->buf=(float*)speex_alloc(st->windowSize*sizeof(float));
+   st->excBuf=(float*)speex_alloc(st->bufSize*sizeof(float));
    st->exc = st->excBuf + st->bufSize - st->windowSize;
-   /*st->exc=st->excBuf+st->frame_size;*/
 
-   st->res=speex_alloc(st->frame_size*sizeof(float));
-   st->sw=speex_alloc(st->frame_size*sizeof(float));
-   st->target=speex_alloc(st->frame_size*sizeof(float));
+   st->res=(float*)speex_alloc(st->frame_size*sizeof(float));
+   st->sw=(float*)speex_alloc(st->frame_size*sizeof(float));
+   st->target=(float*)speex_alloc(st->frame_size*sizeof(float));
    /*Asymetric "pseudo-Hamming" window*/
    {
       int part1, part2;
       part1 = st->subframeSize*7/2;
       part2 = st->subframeSize*5/2;
-      st->window = speex_alloc(st->windowSize*sizeof(float));
+      st->window = (float*)speex_alloc(st->windowSize*sizeof(float));
       for (i=0;i<part1;i++)
          st->window[i]=.54-.46*cos(M_PI*i/part1);
       for (i=0;i<part2;i++)
          st->window[part1+i]=.54+.46*cos(M_PI*i/part2);
    }
 
-   st->lagWindow = speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->lagWindow = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
    for (i=0;i<st->lpcSize+1;i++)
       st->lagWindow[i]=exp(-.5*sqr(2*M_PI*st->lag_factor*i));
 
-   st->rc = speex_alloc(st->lpcSize*sizeof(float));
-   st->autocorr = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->lpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->bw_lpc1 = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->bw_lpc2 = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->lsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->old_lsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->old_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_lsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_lpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-   st->interp_qlpc = speex_alloc((st->lpcSize+1)*sizeof(float));
-
-   st->mem_sp = speex_alloc(st->lpcSize*sizeof(float));
-   st->mem_sp2 = speex_alloc(st->lpcSize*sizeof(float));
-   st->mem_sw = speex_alloc(st->lpcSize*sizeof(float));
+   st->rc = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->autocorr = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->lpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->bw_lpc1 = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->bw_lpc2 = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->lsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->old_lsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->old_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_lsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_lpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->interp_qlpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
+
+   st->mem_sp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sp2 = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sw = (float*)speex_alloc(st->lpcSize*sizeof(float));
    st->complexity=2;
 
    return st;
@@ -217,7 +216,7 @@
 
 void sb_encoder_destroy(void *state)
 {
-   SBEncState *st=state;
+   SBEncState *st=(SBEncState*)state;
 
    nb_encoder_destroy(st->st_low);
    speex_free(st->x0d);
@@ -268,11 +267,11 @@
    void *stack;
    float *mem, *innov, *syn_resp;
 
-   st = state;
+   st = (SBEncState*)state;
    stack=st->stack;
 
    /* Compute the two sub-bands by filtering with h0 and h1*/
-   qmf_decomp(in, h0, st->x0d, st->x1d, st->full_frame_size, QMF_ORDER, st->h0_mem);
+   qmf_decomp(in, h0, st->x0d, st->x1d, st->full_frame_size, QMF_ORDER, st->h0_mem, stack);
 
    /* Encode the narrowband part*/
    nb_encode(st->st_low, st->x0d, bits);
@@ -342,8 +341,8 @@
 #ifndef RELEASE
 
       /* Reconstruct the original */
-      fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem);
-      fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem);
+      fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
+      fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
       for (i=0;i<st->full_frame_size;i++)
          in[i]=2*(st->y0[i]-st->y1[i]);
@@ -544,7 +543,7 @@
             exc[i] += innov[i]*scale;
 
          if (SUBMODE(double_codebook)) {
-            float *tmp_stack=stack;
+            void *tmp_stack=stack;
             float *innov2 = PUSH(tmp_stack, st->subframeSize, float);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
@@ -586,8 +585,8 @@
 #ifndef RELEASE
 
    /* Reconstruct the original */
-   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem);
-   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem);
+   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
+   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
    for (i=0;i<st->full_frame_size;i++)
       in[i]=2*(st->y0[i]-st->y1[i]);
@@ -608,9 +607,9 @@
 {
    SBDecState *st;
    SpeexSBMode *mode;
-   st = speex_alloc(sizeof(SBDecState));
+   st = (SBDecState*)speex_alloc(sizeof(SBDecState));
    st->mode = m;
-   mode=m->mode;
+   mode=(SpeexSBMode*)m->mode;
 
    st->st_low = nb_decoder_init(mode->nb_mode);
    st->full_frame_size = 2*mode->frameSize;
@@ -625,32 +624,32 @@
    st->first=1;
    st->stack = speex_alloc(10000*sizeof(float));
 
-   st->x0d=speex_alloc(st->frame_size*sizeof(float));
-   st->x1d=speex_alloc(st->frame_size*sizeof(float));
-   st->high=speex_alloc(st->full_frame_size*sizeof(float));
-   st->y0=speex_alloc(st->full_frame_size*sizeof(float));
-   st->y1=speex_alloc(st->full_frame_size*sizeof(float));
-
-   st->h0_mem=speex_alloc(QMF_ORDER*sizeof(float));
-   st->h1_mem=speex_alloc(QMF_ORDER*sizeof(float));
-   st->g0_mem=speex_alloc(QMF_ORDER*sizeof(float));
-   st->g1_mem=speex_alloc(QMF_ORDER*sizeof(float));
-
-   st->exc=speex_alloc(st->frame_size*sizeof(float));
-
-   st->qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->old_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_qlsp = speex_alloc(st->lpcSize*sizeof(float));
-   st->interp_qlpc = speex_alloc((st->lpcSize+1)*sizeof(float));
+   st->x0d=(float*)speex_alloc(st->frame_size*sizeof(float));
+   st->x1d=(float*)speex_alloc(st->frame_size*sizeof(float));
+   st->high=(float*)speex_alloc(st->full_frame_size*sizeof(float));
+   st->y0=(float*)speex_alloc(st->full_frame_size*sizeof(float));
+   st->y1=(float*)speex_alloc(st->full_frame_size*sizeof(float));
+
+   st->h0_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+   st->h1_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+   st->g0_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+   st->g1_mem=(float*)speex_alloc(QMF_ORDER*sizeof(float));
+
+   st->exc=(float*)speex_alloc(st->frame_size*sizeof(float));
+
+   st->qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->old_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_qlsp = (float*)speex_alloc(st->lpcSize*sizeof(float));
+   st->interp_qlpc = (float*)speex_alloc((st->lpcSize+1)*sizeof(float));
 
-   st->mem_sp = speex_alloc(st->lpcSize*sizeof(float));
+   st->mem_sp = (float*)speex_alloc(st->lpcSize*sizeof(float));
    return st;
 }
 
 void sb_decoder_destroy(void *state)
 {
    SBDecState *st;
-   st = state;
+   st = (SBDecState*)state;
    nb_decoder_destroy(st->st_low);
    speex_free(st->x0d);
    speex_free(st->x1d);
@@ -687,8 +686,8 @@
    iir_mem2(st->exc, st->interp_qlpc, st->high, st->subframeSize, st->lpcSize, st->mem_sp);
    
    /* Reconstruct the original */
-   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem);
-   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem);
+   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
+   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
    for (i=0;i<st->full_frame_size;i++)
       out[i]=2*(st->y0[i]-st->y1[i]);
@@ -704,7 +703,7 @@
    int ret;
    void *stack;
 
-   st = state;
+   st = (SBDecState*)state;
    stack=st->stack;
 
    /* Decode the low-band */
@@ -749,8 +748,8 @@
       /* Final signal synthesis from excitation */
       iir_mem2(st->exc, st->interp_qlpc, st->high, st->subframeSize, st->lpcSize, st->mem_sp);
 
-      fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem);
-      fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem);
+      fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
+      fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
       for (i=0;i<st->full_frame_size;i++)
          out[i]=2*(st->y0[i]-st->y1[i]);
@@ -843,7 +842,7 @@
             exc[i]*=scale;
 
          if (SUBMODE(double_codebook)) {
-            float *tmp_stack=stack;
+            void *tmp_stack=stack;
             float *innov2 = PUSH(tmp_stack, st->subframeSize, float);
             for (i=0;i<st->subframeSize;i++)
                innov2[i]=0;
@@ -860,8 +859,8 @@
 
    }
 
-   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem);
-   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem);
+   fir_mem_up(st->x0d, h0, st->y0, st->full_frame_size, QMF_ORDER, st->g0_mem, stack);
+   fir_mem_up(st->high, h1, st->y1, st->full_frame_size, QMF_ORDER, st->g1_mem, stack);
 
    for (i=0;i<st->full_frame_size;i++)
       out[i]=2*(st->y0[i]-st->y1[i]);
@@ -878,7 +877,7 @@
 void sb_encoder_ctl(void *state, int request, void *ptr)
 {
    SBEncState *st;
-   st=state;
+   st=(SBEncState*)state;
    switch(request)
    {
    case SPEEX_GET_FRAME_SIZE:
@@ -983,7 +982,7 @@
 void sb_decoder_ctl(void *state, int request, void *ptr)
 {
    SBDecState *st;
-   st=state;
+   st=(SBDecState*)state;
    switch(request)
    {
    case SPEEX_GET_FRAME_SIZE:

<p><p>1.5       +1 -1      speex/libspeex/speex_callbacks.c

Index: speex_callbacks.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_callbacks.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- speex_callbacks.c	11 Oct 2002 03:39:34 -0000	1.4
+++ speex_callbacks.c	27 Oct 2002 06:01:30 -0000	1.5
@@ -119,7 +119,7 @@
 int speex_std_char_handler(SpeexBits *bits, void *state, void *data)
 {
    unsigned char ch;
-   FILE *f = data;
+   FILE *f = (FILE *)data;
    ch = speex_bits_unpack_unsigned(bits, 8);
    fputc(ch, f);
    return 0;

<p><p>1.9       +2 -2      speex/libspeex/speex_header.c

Index: speex_header.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/speex_header.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- speex_header.c	11 Oct 2002 03:39:34 -0000	1.8
+++ speex_header.c	27 Oct 2002 06:01:30 -0000	1.9
@@ -98,7 +98,7 @@
 char *speex_header_to_packet(SpeexHeader *header, int *size)
 {
    SpeexHeader *le_header;
-   le_header = speex_alloc(sizeof(SpeexHeader));
+   le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
    
    speex_move(le_header, header, sizeof(SpeexHeader));
    
@@ -136,7 +136,7 @@
       return NULL;
    }
    
-   le_header = speex_alloc(sizeof(SpeexHeader));
+   le_header = (SpeexHeader*)speex_alloc(sizeof(SpeexHeader));
    
    speex_move(le_header, packet, sizeof(SpeexHeader));
    

<p><p>1.43      +1 -1      speex/libspeex/testenc.c

Index: testenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/testenc.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- testenc.c	21 Oct 2002 20:39:38 -0000	1.42
+++ testenc.c	27 Oct 2002 06:01:30 -0000	1.43
@@ -114,7 +114,7 @@
       }
       speex_bits_reset(&bits);
       for (i=0;i<FRAME_SIZE;i++)
-         in[i]=input[i];
+         in[i]=(short)input[i];
       for (i=0;i<FRAME_SIZE;i++)
          bak2[i]=bak[i];
       fwrite(in, sizeof(short), FRAME_SIZE, fout);

<p><p>1.31      +1 -1      speex/libspeex/testenc_wb.c

Index: testenc_wb.c
===================================================================
RCS file: /usr/local/cvsroot/speex/libspeex/testenc_wb.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- testenc_wb.c	27 Oct 2002 02:59:00 -0000	1.30
+++ testenc_wb.c	27 Oct 2002 06:01:30 -0000	1.31
@@ -90,7 +90,7 @@
       }
       speex_bits_reset(&bits);
       for (i=0;i<FRAME_SIZE;i++)
-         in[i]=input[i];
+         in[i]=(short)input[i];
       for (i=0;i<FRAME_SIZE;i++)
          bak2[i]=bak[i];
       fwrite(in, sizeof(short), FRAME_SIZE, fout);

<p><p>1.52      +3 -3      speex/src/speexdec.c

Index: speexdec.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexdec.c,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -r1.51 -r1.52
--- speexdec.c	26 Oct 2002 04:51:10 -0000	1.51
+++ speexdec.c	27 Oct 2002 06:01:31 -0000	1.52
@@ -190,7 +190,7 @@
    printf (" --no-enh              Disable perceptual enhancement (default FOR NOW)\n");
    printf (" --force-nb            Force decoding in narrowband, even for wideband\n");
    printf (" --force-wb            Force decoding in wideband, even for narrowband\n");
-   printf (" --packet-loss n       Simulate n % random packet loss\n");
+   printf (" --packet-loss n       Simulate n %% random packet loss\n");
    printf (" -V                    Verbose mode (show bit-rate)\n"); 
    printf (" -h, --help            This help\n");
    printf (" -v, --version         Version information\n");
@@ -441,7 +441,7 @@
                fout = out_file_open(outFile, rate);
 
             } else if (packet_count==1){
-               print_comments(op.packet, op.bytes);
+               print_comments((char*)op.packet, op.bytes);
                /*
                fprintf (stderr, "File comments: ");
                fwrite(op.packet, 1, op.bytes, stderr);
@@ -484,7 +484,7 @@
                   }
                   /*Convert to short and save to output file*/
                   for (i=0;i<frame_size;i++)
-                     out[i]=(short)le_short(output[i]);
+                     out[i]=(short)le_short((short)output[i]);
 #if defined WIN32 || defined _WIN32
                   if (strlen(outFile)==0)
                       WIN_Play_Samples (out, sizeof(short) * frame_size);

<p><p>1.49      +4 -3      speex/src/speexenc.c

Index: speexenc.c
===================================================================
RCS file: /usr/local/cvsroot/speex/src/speexenc.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- speexenc.c	20 Oct 2002 04:05:10 -0000	1.48
+++ speexenc.c	27 Oct 2002 06:01:31 -0000	1.49
@@ -51,8 +51,9 @@
 #include <fcntl.h>
 #endif
 
-void comment_init();
-void comment_add();
+
+void comment_init(char **comments, int* length, char *vendor_string);
+void comment_add(char **comments, int* length, char *tag, char *val);
 
 
 /*Write an Ogg page to a file pointer*/
@@ -636,7 +637,7 @@
   int val_len=strlen(val);
   int len=(*length)+4+tag_len+val_len;
 
-  p=realloc(p, len);
+  p=(char*)realloc(p, len);
   if(p==NULL){
   }
 

<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