[Vorbis-dev] Regarding static codebooks.

Shashank Khanvilkar shashank at mia.ece.uic.edu
Wed Aug 24 13:30:53 PDT 2005


HI,
All help is appreciated.
I am trying to print out the static codebooks after they have been 
unpacked. For this I wrote a small function as below and put it in 
codebook.c
This function does print out the codewords, but somehow is failing to 
print the codevalues (prints only zeros and -1). Probably I am making 
some mistake while calling _book_unquantize function.
Can someone please verify if the below is correct?
Shank



#ifdef _SK_DEBUG
void printStaticCodebook(static_codebook *s){
   ogg_uint32_t *codelist;
   float *valuelist;
   int i, j;

   codelist=_ogg_malloc(s->entries*sizeof(*codelist));
   codelist=_make_words(s->lengthlist,s->entries,0);
   valuelist= _book_unquantize(s,s->entries,NULL);
   fprintf(stderr, "Entry#, CodeWordLen, Codeword (Hex), CodeValues 
(Hex)\n");
   for(i=0;i<s->entries;i++){
     if (s->lengthlist[i]){
       fprintf(stderr, "%4d, %4d,%8x, ", i, s->lengthlist[i], codelist[i]);
       if(s->maptype==1 || s->maptype==2){
         for(j=0; j<s->dim; j++){
           fprintf(stderr, "%f, ", valuelist[i*s->dim+j]);
         }
       }
       fprintf(stderr, "\n");
     }
   }
}


More information about the Vorbis-dev mailing list