[vorbis-dev] vorbis under win32

Slavo Kopinec macik at europe.com
Mon Nov 15 00:49:26 PST 1999



Hello Monty,

I tried to complile vorbis under win32 (using MS Visual C 5.0)

I found some things:

1.) 
  In bitvise.c there must be buffer cleared after malloc:

void _oggpack_writeinit(oggpack_buffer *b){
  memset(b,0,sizeof(oggpack_buffer));
  b->ptr=b->buffer=malloc(BUFFER_INCREMENT);
+  memset(b->ptr,0,BUFFER_INCREMENT);
  b->storage=BUFFER_INCREMENT;
}

void _oggpack_write(oggpack_buffer *b,unsigned long value,int bits){
  if(b->endbyte+4>=b->storage){
    b->buffer=realloc(b->buffer,b->storage+BUFFER_INCREMENT);
+    memset(b->buffer+b->storage,0,BUFFER_INCREMENT);
    b->storage+=BUFFER_INCREMENT;
    b->ptr=b->buffer+b->endbyte;
  }

  value&=mask[bits]; 
  bits+=b->endbit;

////////////////////////////////////////////////////
// { because of this
  b->ptr[0]|=value<<b->endbit;  
// }
////////////////////////////////////////////////////
  

2.)
undefined under win32 so define them:

#define M_PI (3.14159265359)
#define rint(x) (floor((x)+0.5)) // is this correct?

3.)
thousands of tons things like that had become

double out[winsize/2];
to
double *out=(double *) _alloca((winsize/2)*sizeof(double));

4.)
I found different behaviour between gcc and msvc when dividing very small doubles (like 2.13e-312)

void _vs_residue_quantize(double *data,double *curve,
                                 vorbis_info *vi,int n){

  /* The following is temporary, hardwired bullshit */
  int i;

  for(i=0;i<n;i++){

    int val=rint(data[i]/curve[i]);

if curve[i] is too small (zero?), under gcc val==-2147483648 (-INF?), under msvc val==0

That's all.

macik
__________________________________________________
FREE Email for ALL! Sign up at http://www.mail.com

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list