Mercurial > libavcodec.hg
changeset 3874:84890fea8074 libavcodec
Original Commit: r74 | ods15 | 2006-09-29 13:03:31 +0300 (Fri, 29 Sep 2006) | 2 lines
support multiple codebooks for floor
author | ods15 |
---|---|
date | Mon, 02 Oct 2006 06:08:19 +0000 |
parents | 41bddab6a00b |
children | ad075294470d |
files | vorbis_enc.c |
diffstat | 1 files changed, 21 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/vorbis_enc.c Mon Oct 02 06:08:16 2006 +0000 +++ b/vorbis_enc.c Mon Oct 02 06:08:19 2006 +0000 @@ -753,11 +753,29 @@ counter = 2; for (i = 0; i < fc->partitions; i++) { floor_class_t * c = &fc->classes[fc->partition_to_class[i]]; - codebook_t * book = &venc->codebooks[c->books[0]]; - int k; - assert(!c->subclass); + int k, cval = 0, csub = 1<<c->subclass; + if (c->subclass) { + codebook_t * book = &venc->codebooks[c->masterbook]; + int cshift = 0; + for (k = 0; k < c->dim; k++) { + int l; + for (l = 0; l < csub; l++) { + int maxval = 1; + if (c->books[l] != -1) maxval = venc->codebooks[c->books[l]].nentries; + // coded could be -1, but this still works, cause thats 0 + if (coded[counter + k] < maxval) break; + } + assert(l != csub); + cval |= l << cshift; + cshift += c->subclass; + } + assert(cval < book->nentries); + put_bits(pb, book->entries[cval].len, book->entries[cval].codeword); + } for (k = 0; k < c->dim; k++) { + codebook_t * book = &venc->codebooks[c->books[cval & (csub-1)]]; int entry = coded[counter++]; + cval >>= c->subclass; if (entry == -1) entry = 0; assert(entry < book->nentries); assert(entry >= 0);