********************************************************************
function: packing variable sized words into an octet stream
- last mod: $Id: bitwise.c,v 1.6 2000/01/12 11:16:35 xiphmont Exp $
+ last mod: $Id: bitwise.c,v 1.7 2000/02/05 23:23:56 xiphmont Exp $
********************************************************************/
if(b->endbyte+4>=b->storage){
/* not the main path */
- if(b->endbyte+(bits+b->endbit-1)/8>b->storage)return(-1);
+ if(b->endbyte+(bits-1)/8>=b->storage)return(-1);
}
ret=b->ptr[0]>>b->endbit;
if(b->endbyte+4>=b->storage){
/* not the main path */
ret=-1;
- if(b->endbyte+(bits+b->endbit-1)/8>b->storage)goto overflow;
+ if(b->endbyte+(bits-1)/8>=b->storage)goto overflow;
}
ret=b->ptr[0]>>b->endbit;
fprintf(stderr,"\nSingle bit unclicpped packing: ");
cliptest(testbuffer3,test3size,1,six,sixsize);
- fprintf(stderr,"ok.\n");
+ fprintf(stderr,"ok.\n\n");
return(0);
}
#endif
********************************************************************
function: basic codebook pack/unpack/code/decode operations
- last mod: $Id: codebook.c,v 1.4 2000/01/28 09:05:08 xiphmont Exp $
+ last mod: $Id: codebook.c,v 1.5 2000/02/05 23:23:58 xiphmont Exp $
********************************************************************/
_oggpack_reset(&write);
vorbis_book_init_encode(&c,testlist[ptr]); /* get it into memory
we can write */
- vorbis_book_pack(testlist[ptr],&write);
+ vorbis_staticbook_pack(testlist[ptr],&write);
fprintf(stderr,"Codebook size %ld bytes... ",_oggpack_bytes(&write));
for(i=0;i<TESTSIZE;i+=TESTDIM)
vorbis_book_encodev(&c,qv+i,&write);
/* transfer the write data to a read buffer and unpack/read */
_oggpack_readinit(&read,_oggpack_buffer(&write),_oggpack_bytes(&write));
- if(vorbis_book_unpack(&read,&s)){
+ if(vorbis_staticbook_unpack(&read,&s)){
fprintf(stderr,"Error unpacking codebook.\n");
exit(1);
}