diff options
author | Monty <xiphmont@xiph.org> | 2002-01-22 02:16:40 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2002-01-22 02:16:40 +0000 |
commit | a356bd149bc9017a03859b119a6675b427d1a64b (patch) | |
tree | 6eaddff67164fa1f60a26b8148ad93003985025e /lib/sharedbook.c | |
parent | 175628aa2f16e99ebe2ca235ac998439299621c6 (diff) | |
download | libvorbis-git-a356bd149bc9017a03859b119a6675b427d1a64b.tar.gz |
Finished treeless decode optimizations for now.
Fixed the approx_vbr assignment bug in vorbisenc
svn path=/trunk/vorbis/; revision=2973
Diffstat (limited to 'lib/sharedbook.c')
-rw-r--r-- | lib/sharedbook.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/sharedbook.c b/lib/sharedbook.c index 40235fcb..5d9fba7d 100644 --- a/lib/sharedbook.c +++ b/lib/sharedbook.c @@ -11,7 +11,7 @@ ******************************************************************** function: basic shared codebook operations - last mod: $Id: sharedbook.c,v 1.25 2002/01/21 20:51:28 xiphmont Exp $ + last mod: $Id: sharedbook.c,v 1.26 2002/01/22 02:16:40 xiphmont Exp $ ********************************************************************/ @@ -398,14 +398,14 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ hints for the non-direct-hits */ { ogg_uint32_t mask=0xfffffffeUL<<(31-c->dec_firsttablen); + long lo=0,hi=0; for(i=0;i<tabn;i++){ - if(c->dec_firsttable[i]==0){ - ogg_uint32_t testword=bitreverse(i); - long lo=0,hi=0; - while((lo+1)<n && c->codelist[lo+1]<=testword)lo++; - while( hi<n && testword>=(c->codelist[hi]&mask))hi++; - + ogg_uint32_t word=i<<(32-c->dec_firsttablen); + if(c->dec_firsttable[bitreverse(word)]==0){ + while((lo+1)<n && c->codelist[lo+1]<=word)lo++; + while( hi<n && word>=(c->codelist[hi]&mask))hi++; + /* we only actually have 15 bits per hint to play with here. In order to overflow gracefully (nothing breaks, efficiency just drops), encode as the difference from the extremes. */ @@ -415,7 +415,8 @@ int vorbis_book_init_decode(codebook *c,const static_codebook *s){ if(loval>0x7fff)loval=0x7fff; if(hival>0x7fff)hival=0x7fff; - c->dec_firsttable[i]=0x80000000UL | (loval<<15) | hival; + c->dec_firsttable[bitreverse(word)]= + 0x80000000UL | (loval<<15) | hival; } } } |