[xiph-cvs] cvs commit: vorbis/lib block.c codebook.c floor0.c mdct.c psy.c res0.c sharedbook.c vorbisenc.c

Segher Boessenkool segher at xiph.org
Fri Dec 21 06:52:38 PST 2001



segher      01/12/21 06:52:38

  Modified:    lib      block.c codebook.c floor0.c mdct.c psy.c res0.c
                        sharedbook.c vorbisenc.c
  Log:
  fix nasty warnings, and some non-ansi constructs.  increase portability.

Revision  Changes    Path
1.54      +2 -2      vorbis/lib/block.c

Index: block.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/block.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- block.c	2001/12/20 01:00:26	1.53
+++ block.c	2001/12/21 14:52:35	1.54
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: PCM data vector blocking, windowing and dis/reassembly
- last mod: $Id: block.c,v 1.53 2001/12/20 01:00:26 segher Exp $
+ last mod: $Id: block.c,v 1.54 2001/12/21 14:52:35 segher Exp $
 
  Handle windowing, overlap-add, etc of the PCM vectors.  This is made
  more amusing by Vorbis' current two allowed block sizes.
@@ -712,7 +712,7 @@
 
     /* overlap/add PCM */
 
-    switch(v->W){
+    switch((int)v->W){
     case 0:
       beginSl=0;
       endSl=ci->blocksizes[0]/2;

1.35      +4 -4      vorbis/lib/codebook.c

Index: codebook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/codebook.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -r1.34 -r1.35
--- codebook.c	2001/12/20 01:00:26	1.34
+++ codebook.c	2001/12/21 14:52:35	1.35
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.34 2001/12/20 01:00:26 segher Exp $
+ last mod: $Id: codebook.c,v 1.35 2001/12/21 14:52:35 segher Exp $
 
  ********************************************************************/
 
@@ -160,7 +160,7 @@
   if(s->entries==-1)goto _eofout;
 
   /* codeword ordering.... length ordered or unordered? */
-  switch(oggpack_read(opb,1)){
+  switch((int)oggpack_read(opb,1)){
   case 0:
     /* unordered */
     s->lengthlist=_ogg_malloc(sizeof(*s->lengthlist)*s->entries);
@@ -327,7 +327,7 @@
   }
 
   do{
-    switch(oggpack_read1(b)){
+    switch((int)oggpack_read1(b)){
     case 0:
       ptr=t->ptr0[ptr];
       break;
@@ -377,7 +377,7 @@
       if(entry==-1)return(-1);
       t     = book->valuelist+entry*book->dim;
       j=0;
-      switch(book->dim){
+      switch((int)book->dim){
       case 8:
         a[i++]+=t[j++];
       case 7:

1.49      +3 -3      vorbis/lib/floor0.c

Index: floor0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor0.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -r1.48 -r1.49
--- floor0.c	2001/12/20 01:00:26	1.48
+++ floor0.c	2001/12/21 14:52:35	1.49
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: floor backend 0 implementation
- last mod: $Id: floor0.c,v 1.48 2001/12/20 01:00:26 segher Exp $
+ last mod: $Id: floor0.c,v 1.49 2001/12/21 14:52:35 segher Exp $
 
  ********************************************************************/
 
@@ -392,7 +392,7 @@
     for(j=0;j<look->n;j++)
       codedflr[j]=1.f;
     vorbis_lsp_to_curve(codedflr,look->linearmap,look->n,look->ln,
-			lspwork,look->m,amp,info->ampdB);
+			lspwork,look->m,amp,(float)info->ampdB);
 
     _analysis_output("barklsp",seq-1,codedflr,look->n,1,1);
     _analysis_output("lsp3",seq-1,codedflr,look->n,0,1);
@@ -452,7 +452,7 @@
 
     /* take the coefficients back to a spectral envelope curve */
     vorbis_lsp_to_curve(out,look->linearmap,look->n,look->ln,
-			lsp,look->m,amp,info->ampdB);
+			lsp,look->m,amp,(float)info->ampdB);
     return(1);
   }
   memset(out,0,sizeof(*out)*look->n);

1.28      +2 -2      vorbis/lib/mdct.c

Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -r1.27 -r1.28
--- mdct.c	2001/12/20 01:00:29	1.27
+++ mdct.c	2001/12/21 14:52:35	1.28
@@ -12,7 +12,7 @@
 
  function: normalized modified discrete cosine transform
            power of two length transform only [64 <= n ]
- last mod: $Id: mdct.c,v 1.27 2001/12/20 01:00:29 segher Exp $
+ last mod: $Id: mdct.c,v 1.28 2001/12/21 14:52:35 segher Exp $
 
  Original algorithm adapted long ago from _The use of multirate filter
  banks for coding of high quality digital audio_, by T. Sporer,
@@ -54,7 +54,7 @@
   
   int i;
   int n2=n>>1;
-  int log2n=lookup->log2n=rint(log(n)/log(2));
+  int log2n=lookup->log2n=rint(log((float)n)/log(2.f));
   lookup->n=n;
   lookup->trig=T;
   lookup->bitrev=bitrev;

1.62      +4 -4      vorbis/lib/psy.c

Index: psy.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/psy.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -r1.61 -r1.62
--- psy.c	2001/12/19 18:06:17	1.61
+++ psy.c	2001/12/21 14:52:35	1.62
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: psychoacoustics not including preecho
- last mod: $Id: psy.c,v 1.61 2001/12/19 18:06:17 segher Exp $
+ last mod: $Id: psy.c,v 1.62 2001/12/21 14:52:35 segher Exp $
 
  ********************************************************************/
 
@@ -80,7 +80,7 @@
   int i,j=0;
 
   for(i=0;i<MAX_BARK-1;i++){
-    int endpos=rint(fromBARK(i+1)*2*n/crate);
+    int endpos=rint(fromBARK((float)(i+1))*2*n/crate);
     float base=ref[i];
     if(j<endpos){
       float delta=(ref[i+1]-base)/(endpos-j);
@@ -211,7 +211,7 @@
 
 
   p->eighth_octave_lines=gi->eighth_octave_lines;
-  p->shiftoc=rint(log(gi->eighth_octave_lines*8)/log(2))-1;
+  p->shiftoc=rint(log(gi->eighth_octave_lines*8.f)/log(2.f))-1;
 
   p->firstoc=toOC(.25f*rate/n)*(1<<(p->shiftoc+1))-gi->eighth_octave_lines;
   maxoc=toOC((n*.5f-.25f)*rate/n)*(1<<(p->shiftoc+1))+.5f;
@@ -227,7 +227,7 @@
 
   /* set up the lookups for a given blocksize and sample rate */
   if(vi->ath)
-    set_curve(vi->ath, p->ath,n,rate);
+    set_curve(vi->ath, p->ath,n,(float)rate);
   for(i=0;i<n;i++){
     float bark=toBARK(rate/(2*n)*i); 
 

1.43      +2 -2      vorbis/lib/res0.c

Index: res0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/res0.c,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- res0.c	2001/12/20 01:00:29	1.42
+++ res0.c	2001/12/21 14:52:36	1.43
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: residue backend 0, 1 and 2 implementation
- last mod: $Id: res0.c,v 1.42 2001/12/20 01:00:29 segher Exp $
+ last mod: $Id: res0.c,v 1.43 2001/12/21 14:52:36 segher Exp $
 
  ********************************************************************/
 
@@ -272,7 +272,7 @@
     }
   }
 
-  look->partvals=rint(pow(look->parts,dim));
+  look->partvals=rint(pow((float)look->parts,(pow)dim));
   look->stages=maxstage;
   look->decodemap=_ogg_malloc(look->partvals*sizeof(*look->decodemap));
   for(j=0;j<look->partvals;j++){

1.22      +3 -3      vorbis/lib/sharedbook.c

Index: sharedbook.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/sharedbook.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- sharedbook.c	2001/12/20 01:00:30	1.21
+++ sharedbook.c	2001/12/21 14:52:36	1.22
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: basic shared codebook operations
- last mod: $Id: sharedbook.c,v 1.21 2001/12/20 01:00:30 segher Exp $
+ last mod: $Id: sharedbook.c,v 1.22 2001/12/21 14:52:36 segher Exp $
 
  ********************************************************************/
 
@@ -51,7 +51,7 @@
     sign=0x80000000;
     val= -val;
   }
-  exp= floor(log(val)/log(2));
+  exp= floor(log(val)/log(2.f));
   mant=rint(ldexp(val,(VQ_FMAN-1)-exp));
   exp=(exp+VQ_FEXP_BIAS)<<VQ_FMAN;
 
@@ -197,7 +197,7 @@
    that's portable and totally safe against roundoff, but I haven't
    thought of it.  Therefore, we opt on the side of caution */
 long _book_maptype1_quantvals(const static_codebook *b){
-  long vals=floor(pow(b->entries,1.f/b->dim));
+  long vals=floor(pow((float)b->entries,1.f/b->dim));
 
   /* the above *should* be reliable, but we'll not assume that FP is
      ever reliable when bitstream sync is at stake; verify via integer

1.30      +2 -2      vorbis/lib/vorbisenc.c

Index: vorbisenc.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisenc.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- vorbisenc.c	2001/12/21 08:44:07	1.29
+++ vorbisenc.c	2001/12/21 14:52:36	1.30
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: simple programmatic interface for encoder mode setup
- last mod: $Id: vorbisenc.c,v 1.29 2001/12/21 08:44:07 xiphmont Exp $
+ last mod: $Id: vorbisenc.c,v 1.30 2001/12/21 14:52:36 segher Exp $
 
  ********************************************************************/
 
@@ -915,7 +915,7 @@
                                 long min_bitrate){
 
   double approx_vbr=approx_bitrate_to_vbr(channels,(channels==2), 
-					  nominal_bitrate,rate);
+					  (float)nominal_bitrate,rate);
   int ret=0;
   if(approx_vbr<0)return(OV_EIMPL);
 

--- >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